Files
2026-03-22 03:21:45 +02:00

23 lines
706 KiB
JavaScript

"use strict";var ___resolve=require.resolve;!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.animationUtilities=e()}}(function(){var e;return function t(e,r,n){function o(a,s){if(!r[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(i)return i(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var u=r[a]={exports:{}};e[a][0].call(u.exports,function(t){var r=e[a][1][t];return o(r?r:t)},u,u.exports,t,e,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(require,e,exports){(function(e,t,r,n,o,i,a,s,l){function h(){function e(){}try{var t=new Uint8Array(1);return t.foo=function(){return 42},t.constructor=e,42===t.foo()&&t.constructor===e&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function u(){return r.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function r(e){return this instanceof r?(r.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof e?c(this,e):"string"==typeof e?f(this,e,arguments.length>1?arguments[1]:"utf8"):d(this,e)):arguments.length>1?new r(e,arguments[1]):new r(e)}function c(e,t){if(e=b(e,0>t?0:0|w(t)),!r.TYPED_ARRAY_SUPPORT)for(var n=0;t>n;n++)e[n]=0;return e}function f(e,t,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|T(t,r);return e=b(e,n),e.write(t,r),e}function d(e,t){if(r.isBuffer(t))return p(e,t);if(re(t))return m(e,t);if(null==t)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(t.buffer instanceof ArrayBuffer)return g(e,t);if(t instanceof ArrayBuffer)return y(e,t)}return t.length?v(e,t):_(e,t)}function p(e,t){var r=0|w(t.length);return e=b(e,r),t.copy(e,0,0,r),e}function m(e,t){var r=0|w(t.length);e=b(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function g(e,t){var r=0|w(t.length);e=b(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function y(e,t){return r.TYPED_ARRAY_SUPPORT?(t.byteLength,e=r._augment(new Uint8Array(t))):e=g(e,new Uint8Array(t)),e}function v(e,t){var r=0|w(t.length);e=b(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function _(e,t){var r,n=0;"Buffer"===t.type&&re(t.data)&&(r=t.data,n=0|w(r.length)),e=b(e,n);for(var o=0;n>o;o+=1)e[o]=255&r[o];return e}function b(e,t){r.TYPED_ARRAY_SUPPORT?(e=r._augment(new Uint8Array(t)),e.__proto__=r.prototype):(e.length=t,e._isBuffer=!0);var n=0!==t&&t<=r.poolSize>>>1;return n&&(e.parent=ne),e}function w(e){if(e>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|e}function x(e,t){if(!(this instanceof x))return new x(e,t);var n=new r(e,t);return delete n.parent,n}function T(e,t){"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(n)return Y(e).length;t=(""+t).toLowerCase(),n=!0}}function M(e,t,r){var n=!1;if(t=0|t,r=void 0===r||r===1/0?this.length:0|r,e||(e="utf8"),0>t&&(t=0),r>this.length&&(r=this.length),t>=r)return"";for(;;)switch(e){case"hex":return N(this,t,r);case"utf8":case"utf-8":return D(this,t,r);case"ascii":return O(this,t,r);case"binary":return k(this,t,r);case"base64":return F(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function S(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var i=t.length;if(i%2!==0)throw new Error("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;n>a;a++){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");e[r+a]=s}return a}function C(e,t,r,n){return Z(Y(t,e.length-r),e,r,n)}function E(e,t,r,n){return Z(Q(t),e,r,n)}function A(e,t,r,n){return E(e,t,r,n)}function L(e,t,r,n){return Z(J(t),e,r,n)}function P(e,t,r,n){return Z(K(t,e.length-r),e,r,n)}function F(e,t,r){return 0===t&&r===e.length?ee.fromByteArray(e):ee.fromByteArray(e.slice(t,r))}function D(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;r>o;){var i=e[o],a=null,s=i>239?4:i>223?3:i>191?2:1;if(r>=o+s){var l,h,u,c;switch(s){case 1:128>i&&(a=i);break;case 2:l=e[o+1],128===(192&l)&&(c=(31&i)<<6|63&l,c>127&&(a=c));break;case 3:l=e[o+1],h=e[o+2],128===(192&l)&&128===(192&h)&&(c=(15&i)<<12|(63&l)<<6|63&h,c>2047&&(55296>c||c>57343)&&(a=c));break;case 4:l=e[o+1],h=e[o+2],u=e[o+3],128===(192&l)&&128===(192&h)&&128===(192&u)&&(c=(15&i)<<18|(63&l)<<12|(63&h)<<6|63&u,c>65535&&1114112>c&&(a=c))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),o+=s}return R(n)}function R(e){var t=e.length;if(oe>=t)return String.fromCharCode.apply(String,e);for(var r="",n=0;t>n;)r+=String.fromCharCode.apply(String,e.slice(n,n+=oe));return r}function O(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;r>o;o++)n+=String.fromCharCode(127&e[o]);return n}function k(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;r>o;o++)n+=String.fromCharCode(e[o]);return n}function N(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var o="",i=t;r>i;i++)o+=q(e[i]);return o}function B(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function U(e,t,r){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,n,o,i,a){if(!r.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||a>t)throw new RangeError("value is out of bounds");if(n+o>e.length)throw new RangeError("index out of range")}function V(e,t,r,n){0>t&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);i>o;o++)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function z(e,t,r,n){0>t&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);i>o;o++)e[r+o]=t>>>8*(n?o:3-o)&255}function G(e,t,r,n,o,i){if(t>o||i>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function H(e,t,r,n,o){return o||G(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),te.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return o||G(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),te.write(e,t,r,n,52,8),r+8}function W(e){if(e=X(e).replace(ae,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function X(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function q(e){return 16>e?"0"+e.toString(16):e.toString(16)}function Y(e,t){t=t||1/0;for(var r,n=e.length,o=null,i=[],a=0;n>a;a++){if(r=e.charCodeAt(a),r>55295&&57344>r){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(56320>r){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,128>r){if((t-=1)<0)break;i.push(r)}else if(2048>r){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function Q(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}function K(e,t){for(var r,n,o,i=[],a=0;a<e.length&&!((t-=2)<0);a++)r=e.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function J(e){return ee.toByteArray(W(e))}function Z(e,t,r,n){for(var o=0;n>o&&!(o+r>=t.length||o>=e.length);o++)t[o+r]=e[o];return o}var ee=require("base64-js"),te=require("ieee754"),re=require("isarray");exports.Buffer=r,exports.SlowBuffer=x,exports.INSPECT_MAX_BYTES=50,r.poolSize=8192;var ne={};r.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:h(),r.TYPED_ARRAY_SUPPORT?(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array):(r.prototype.length=void 0,r.prototype.parent=void 0),r.isBuffer=function(e){return!(null==e||!e._isBuffer)},r.compare=function(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,o=t.length,i=0,a=Math.min(n,o);a>i&&e[i]===t[i];)++i;return i!==a&&(n=e[i],o=t[i]),o>n?-1:n>o?1:0},r.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.concat=function(e,t){if(!re(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new r(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;n++)t+=e[n].length;var o=new r(t),i=0;for(n=0;n<e.length;n++){var a=e[n];a.copy(o,i),i+=a.length}return o},r.byteLength=T,r.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?D(this,0,e):M.apply(this,arguments)},r.prototype.equals=function(e){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===r.compare(this,e)},r.prototype.inspect=function(){var e="",t=exports.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},r.prototype.compare=function(e){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:r.compare(this,e)},r.prototype.indexOf=function(e,t){function n(e,t,r){for(var n=-1,o=0;r+o<e.length;o++)if(e[r+o]===t[-1===n?0:o-n]){if(-1===n&&(n=o),o-n+1===t.length)return r+n}else n=-1;return-1}if(t>2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,t);if(r.isBuffer(e))return n(this,e,t);if("number"==typeof e)return r.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):n(this,[e],t);throw new TypeError("val must be string, number or Buffer")},r.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},r.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},r.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var o=n;n=t,t=0|r,r=o}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return S(this,e,t,r);case"utf8":case"utf-8":return C(this,e,t,r);case"ascii":return E(this,e,t,r);case"binary":return A(this,e,t,r);case"base64":return L(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var oe=4096;r.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),e>t&&(t=e);var o;if(r.TYPED_ARRAY_SUPPORT)o=r._augment(this.subarray(e,t));else{var i=t-e;o=new r(i,void 0);for(var a=0;i>a;a++)o[a]=this[a+e]}return o.length&&(o.parent=this.parent||this),o},r.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||U(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},r.prototype.readUIntBE=function(e,t,r){e=0|e,t=0|t,r||U(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},r.prototype.readUInt8=function(e,t){return t||U(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||U(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||U(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUInt32BE=function(e,t){return t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||U(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},r.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||U(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},r.prototype.readInt8=function(e,t){return t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||U(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt16BE=function(e,t){t||U(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt32LE=function(e,t){return t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,t){return t||U(e,4,this.length),te.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||U(e,4,this.length),te.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||U(e,8,this.length),te.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||U(e,8,this.length),te.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||I(this,e,t,r,Math.pow(2,8*r),0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},r.prototype.writeUIntBE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||I(this,e,t,r,Math.pow(2,8*r),0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},r.prototype.writeUInt8=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,1,255,0),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},r.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):V(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):V(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):z(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):z(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var o=Math.pow(2,8*r-1);I(this,e,t,r,o-1,-o)}var i=0,a=1,s=0>e?1:0;for(this[t]=255&e;++i<r&&(a*=256);)this[t+i]=(e/a>>0)-s&255;return t+r},r.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var o=Math.pow(2,8*r-1);I(this,e,t,r,o-1,-o)}var i=r-1,a=1,s=0>e?1:0;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=(e/a>>0)-s&255;return t+r},r.prototype.writeInt8=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,1,127,-128),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},r.prototype.writeInt16LE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):V(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):V(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):z(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):z(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,r){return H(this,e,t,!0,r)},r.prototype.writeFloatBE=function(e,t,r){return H(this,e,t,!1,r)},r.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},r.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},r.prototype.copy=function(e,t,n,o){if(n||(n=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&n>o&&(o=n),o===n)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>o)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);var i,a=o-n;if(this===e&&t>n&&o>t)for(i=a-1;i>=0;i--)e[i+t]=this[i+n];else if(1e3>a||!r.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)e[i+t]=this[i+n];else e._set(this.subarray(n,n+a),t);return a},r.prototype.fill=function(e,t,r){if(e||(e=0),t||(t=0),r||(r=this.length),t>r)throw new RangeError("end < start");if(r!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof e)for(n=t;r>n;n++)this[n]=e;else{var o=Y(e.toString()),i=o.length;for(n=t;r>n;n++)this[n]=o[n%i]}return this}},r.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(r.TYPED_ARRAY_SUPPORT)return new r(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;n>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var ie=r.prototype;r._augment=function(e){return e.constructor=r,e._isBuffer=!0,e._set=e.set,e.get=ie.get,e.set=ie.set,e.write=ie.write,e.toString=ie.toString,e.toLocaleString=ie.toString,e.toJSON=ie.toJSON,e.equals=ie.equals,e.compare=ie.compare,e.indexOf=ie.indexOf,e.copy=ie.copy,e.slice=ie.slice,e.readUIntLE=ie.readUIntLE,e.readUIntBE=ie.readUIntBE,e.readUInt8=ie.readUInt8,e.readUInt16LE=ie.readUInt16LE,e.readUInt16BE=ie.readUInt16BE,e.readUInt32LE=ie.readUInt32LE,e.readUInt32BE=ie.readUInt32BE,e.readIntLE=ie.readIntLE,e.readIntBE=ie.readIntBE,e.readInt8=ie.readInt8,e.readInt16LE=ie.readInt16LE,e.readInt16BE=ie.readInt16BE,e.readInt32LE=ie.readInt32LE,e.readInt32BE=ie.readInt32BE,e.readFloatLE=ie.readFloatLE,e.readFloatBE=ie.readFloatBE,e.readDoubleLE=ie.readDoubleLE,e.readDoubleBE=ie.readDoubleBE,e.writeUInt8=ie.writeUInt8,e.writeUIntLE=ie.writeUIntLE,e.writeUIntBE=ie.writeUIntBE,e.writeUInt16LE=ie.writeUInt16LE,e.writeUInt16BE=ie.writeUInt16BE,e.writeUInt32LE=ie.writeUInt32LE,e.writeUInt32BE=ie.writeUInt32BE,e.writeIntLE=ie.writeIntLE,e.writeIntBE=ie.writeIntBE,e.writeInt8=ie.writeInt8,e.writeInt16LE=ie.writeInt16LE,e.writeInt16BE=ie.writeInt16BE,e.writeInt32LE=ie.writeInt32LE,e.writeInt32BE=ie.writeInt32BE,e.writeFloatLE=ie.writeFloatLE,e.writeFloatBE=ie.writeFloatBE,e.writeDoubleLE=ie.writeDoubleLE,e.writeDoubleBE=ie.writeDoubleBE,e.fill=ie.fill,e.inspect=ie.inspect,e.toArrayBuffer=ie.toArrayBuffer,e};var ae=/[^+\/0-9A-Za-z-_]/g}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/browserify/node_modules/buffer/index.js","/node_modules/browserify/node_modules/buffer")},{_process:5,"base64-js":2,buffer:1,ieee754:3,isarray:4}],2:[function(require,e,exports){(function(e,t,r,n,o,i,a,s,l){var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(exports){function e(e){var t=e.charCodeAt(0);return t===o||t===u?62:t===i||t===c?63:a>t?-1:a+10>t?t-a+26+26:l+26>t?t-l:s+26>t?t-s+26:void 0}function t(t){function r(e){h[c++]=e}var o,i,a,s,l,h;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=t.length;l="="===t.charAt(u-2)?2:"="===t.charAt(u-1)?1:0,h=new n(3*t.length/4-l),a=l>0?t.length-4:t.length;var c=0;for(o=0,i=0;a>o;o+=4,i+=3)s=e(t.charAt(o))<<18|e(t.charAt(o+1))<<12|e(t.charAt(o+2))<<6|e(t.charAt(o+3)),r((16711680&s)>>16),r((65280&s)>>8),r(255&s);return 2===l?(s=e(t.charAt(o))<<2|e(t.charAt(o+1))>>4,r(255&s)):1===l&&(s=e(t.charAt(o))<<10|e(t.charAt(o+1))<<4|e(t.charAt(o+2))>>2,r(s>>8&255),r(255&s)),h}function r(e){function t(e){return h.charAt(e)}function r(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var n,o,i,a=e.length%3,s="";for(n=0,i=e.length-a;i>n;n+=3)o=(e[n]<<16)+(e[n+1]<<8)+e[n+2],s+=r(o);switch(a){case 1:o=e[e.length-1],s+=t(o>>2),s+=t(o<<4&63),s+="==";break;case 2:o=(e[e.length-2]<<8)+e[e.length-1],s+=t(o>>10),s+=t(o>>4&63),s+=t(o<<2&63),s+="="}return s}var n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="+".charCodeAt(0),i="/".charCodeAt(0),a="0".charCodeAt(0),s="a".charCodeAt(0),l="A".charCodeAt(0),u="-".charCodeAt(0),c="_".charCodeAt(0);exports.toByteArray=t,exports.fromByteArray=r}("undefined"==typeof exports?this.base64js={}:exports)}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/browserify/node_modules/buffer/node_modules/base64-js/lib/b64.js","/node_modules/browserify/node_modules/buffer/node_modules/base64-js/lib")},{_process:5,buffer:1}],3:[function(require,e,exports){(function(e,t,r,n,o,i,a,s,l){exports.read=function(e,t,r,n,o){var i,a,s=8*o-n-1,l=(1<<s)-1,h=l>>1,u=-7,c=r?o-1:0,f=r?-1:1,d=e[t+c];for(c+=f,i=d&(1<<-u)-1,d>>=-u,u+=s;u>0;i=256*i+e[t+c],c+=f,u-=8);for(a=i&(1<<-u)-1,i>>=-u,u+=n;u>0;a=256*a+e[t+c],c+=f,u-=8);if(0===i)i=1-h;else{if(i===l)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,n),i-=h}return(d?-1:1)*a*Math.pow(2,i-n)},exports.write=function(e,t,r,n,o,i){var a,s,l,h=8*i-o-1,u=(1<<h)-1,c=u>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),t+=a+c>=1?f/l:f*Math.pow(2,1-c),t*l>=2&&(a++,l/=2),a+c>=u?(s=0,a=u):a+c>=1?(s=(t*l-1)*Math.pow(2,o),a+=c):(s=t*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;e[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<<o|s,h+=o;h>0;e[r+d]=255&a,d+=p,a/=256,h-=8);e[r+d-p]|=128*m}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/browserify/node_modules/buffer/node_modules/ieee754/index.js","/node_modules/browserify/node_modules/buffer/node_modules/ieee754")},{_process:5,buffer:1}],4:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==u.call(e)}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/browserify/node_modules/buffer/node_modules/isarray/index.js","/node_modules/browserify/node_modules/buffer/node_modules/isarray")},{_process:5,buffer:1}],5:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){function u(){g=!1,p.length?m=p.concat(m):y=-1,m.length&&c()}function c(){if(!g){var e=setTimeout(u);g=!0;for(var t=m.length;t;){for(p=m,m=[];++y<t;)p&&p[y].run();y=-1,t=m.length}p=null,g=!1,clearTimeout(e)}}function f(e,t){this.fun=e,this.array=t}function d(){}var p,t=e.exports={},m=[],g=!1,y=-1;t.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];m.push(new f(e,t)),1!==m.length||g||setTimeout(c,0)},f.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=d,t.addListener=d,t.once=d,t.off=d,t.removeListener=d,t.removeAllListeners=d,t.emit=d,t.binding=function(e){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(e){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/browserify/node_modules/process/browser.js","/node_modules/browserify/node_modules/process")},{_process:5,buffer:1}],6:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-motion/src/base/Motion"),c=require("ifr-motion/src/base/MotionValidator"),f=require("ifr-motion/src/base/MotionTrack"),d=require("ifr-motion/src/base/TimestampedBuffer"),p=require("ifr-motion/src/base/AccelPlanner"),m=require("./TransitionBuilder"),g=function(e,t,r){m.call(this),this.minTransitionTime=null,this.defaultMaxVelocity=t,this.defaultMaxAccel=r,this.maxVelocityByDOF={},this.maxAccelByDOF={},this.robotInfo=e,this.planner=new p};g.prototype=Object.create(m.prototype),g.prototype.constructor=g,g.prototype.setDefaultLimits=function(e,t){this.defaultMaxVelocity=e,this.defaultMaxAccel=t},g.prototype.setMinTransitionTime=function(e){this.minTransitionTime=e},g.prototype.setLimits=function(e,t,r){for(var n=0;n<e.length;n++)this.maxVelocityByDOF[e[n]]=t,this.maxAccelByDOF[e[n]]=r},g.prototype.generateTransition=function(e,t,r,n){var o,i,a,s,l,h=1/30;for(l=0;l<n.length;l++){if(o=n[l],!this.robotInfo.getDOFInfo(o))throw new Error("Error transitioning, no dofInfo found for "+o);var p=e.get(o,0);if(null==p||Array.isArray(p)&&p.length<1)throw new Error("Error transitioning, no FROM value for "+o)}c.valuesExist(t,n);var m=this.robotInfo.getKinematicInfo().getInterpolatorSet(),g=new u("Transition:"+t.getName()),y=0,v=t.getPoseAtTime(r,m),_=this.robotInfo.getKinematicInfo().getDOFGlobalAlignment();_.refineToGloballyClosestTargetPose(e,v,n);var b,w;for(l=0;l<n.length;l++)if(o=n[l],this.robotInfo.getDOFInfo(o).isMetric()){i=e.get(o,0),a=e.get(o,1),null===a&&(a=0),s=v.get(o,0);var x=this.defaultMaxAccel;this.maxAccelByDOF[o]&&(x=this.maxAccelByDOF[o]);var T=this.planner.computeWithFixedAccel(a,0,s-i,x)._totalTime;T>y&&(y=T,b=o,w=Math.abs(s-i))}this.minTransitionTime&&this.minTransitionTime>y&&(y=this.minTransitionTime);var M={};for(l=0;l<n.length;l++)o=n[l],this.robotInfo.getDOFInfo(o).isMetric()&&(i=e.get(o,0),a=e.get(o,1),null===a&&(a=0),s=v.get(o,0),y>1e-10?M[o]=this.planner.computeWithFixedTime(a,0,s-i,y):M[o]=null);for(l=0;l<n.length;l++){o=n[l],i=e.get(o,0),s=v.get(o,0);var S=new d;S.append(0,i);var C=M[o];if(C)for(var E=h;y>E;){var A=i+C.displacementAtTime(E);S.append(E,A),E+=h}S.append(y,s),g.addTrack(new f(o,S,y))}return g},g.prototype.clone=function(){var e=new g(this.robotInfo,this.defaultMaxVelocity,this.defaultMaxAccel);e.minTransitionTime=this.minTransitionTime;var t,r=Object.keys(this.maxVelocityByDOF);for(t=0;t<r.length;t++)e.maxVelocityByDOF[r[t]]=this.maxVelocityByDOF[r[t]];for(r=Object.keys(this.maxAccelByDOF),t=0;t<r.length;t++)e.maxAccelByDOF[r[t]]=this.maxAccelByDOF[r[t]];return e},e.exports=g}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/AccelerationTransitionBuilder.js","/release_modules/animation-animate/src")},{"./TransitionBuilder":10,_process:5,buffer:1,"ifr-motion/src/base/AccelPlanner":72,"ifr-motion/src/base/Motion":79,"ifr-motion/src/base/MotionTrack":81,"ifr-motion/src/base/MotionValidator":82,"ifr-motion/src/base/TimestampedBuffer":85}],7:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){function u(e){for(var t=[],r=e.getOutputs(),n=0;n<r.length;n++)r[n]instanceof w&&(t=t.concat(r[n].getRenderers()));return t}var c=require("ifr-motion/src/loaders/AnimationLoader"),f=require("ifr-motion/src/base/Motion"),d=require("ifr-motion/src/base/AnnotatedMotion"),p=require("ifr-motion/src/base/Pose"),m=require("./LinearTransitionBuilderImpl"),g=require("./AccelerationTransitionBuilder"),y=require("./SingleLookatBuilder"),v=require("./timeline/SimpleMotionGenerator"),_=require("./timeline/LoopedMotionGenerator"),b=(require("./timeline/LayerState"),require("./timeline/LayerCombiner"),require("./timeline/PropertiesPose"),require("ifr-core/src/SLog")),w=require("animation-visualize/src/RendererOutput"),x=require("geometry-info/src/DOFSet"),T=require("three"),M={},S=new c,C=function(e,t,r,n,o){var i=e;D.trajectory.getAnimation(t,function(e){var t=null;e&&(t=new L(i.timeline,e,null===i.defaultTransition?null:i.defaultTransition.clone(),i.robotInfo,o)),r&&r(t)},n)},E=function(){};E.prototype.init=function(e,t){var r=this;this.timeline=e,this.robotInfo=t,this.defaultTransition=this.createAccelerationTransitionBuilder(3,5),this.defaultTransition.setLimits(t.getBodyDOFNames(),3,5),this.defaultTransition.setLimits(t.getEyeDOFNames(),20,40),this.defaultTransition.setLimits(t.getDOFSet("LED").getDOFs(),10,20),this.blinkBuilder=null,this.blinkInProgress=!1,C(this,t.getConfig().getRobotURL()+"jibo_blink.anim",function(e){e.setTransitionIn(null),e.on(D.AnimationEventType.STOPPED,function(){r.blinkInProgress=!1}),e.on(D.AnimationEventType.CANCELLED,function(){r.blinkInProgress=!1}),r.blinkBuilder=e},!1,"blink");var n={ALL:t.getDOFSet("ALL"),BASE:t.getDOFSet("BASE"),BODY:t.getDOFSet("BODY"),EYE:t.getDOFSet("EYE"),LED:t.getDOFSet("LED"),OVERLAY:t.getDOFSet("OVERLAY"),SCREEN:t.getDOFSet("SCREEN"),EYE_ROOT:t.getDOFSet("EYE_ROOT"),EYE_DEFORM:t.getDOFSet("EYE_DEFORM"),EYE_RENDER:t.getDOFSet("EYE_RENDER"),EYE_TRANSLATE:t.getDOFSet("EYE_TRANSLATE"),EYE_ROTATE:t.getDOFSet("EYE_ROTATE"),EYE_COLOR:t.getDOFSet("EYE_COLOR"),EYE_TEXTURE:t.getDOFSet("EYE_TEXTURE"),OVERLAY_ROOT:t.getDOFSet("OVERLAY_ROOT"),OVERLAY_DEFORM:t.getDOFSet("OVERLAY_DEFORM"),OVERLAY_RENDER:t.getDOFSet("OVERLAY_RENDER"),OVERLAY_TRANSLATE:t.getDOFSet("OVERLAY_TRANSLATE"),OVERLAY_ROTATE:t.getDOFSet("OVERLAY_ROTATE"),OVERLAY_COLOR:t.getDOFSet("OVERLAY_COLOR"),OVERLAY_TEXTURE:t.getDOFSet("OVERLAY_TEXTURE"),SCREEN_BG_RENDER:t.getDOFSet("SCREEN_BG_RENDER"),SCREEN_BG_COLOR:t.getDOFSet("SCREEN_BG_COLOR"),SCREEN_BG_TEXTURE:t.getDOFSet("SCREEN_BG_TEXTURE")};this.dofs=n},E.prototype.getRobotInfo=function(){return this.robotInfo},E.prototype.getClock=function(){return this.timeline.getClock()},E.prototype.createAnimationBuilder=function(e,t,r){C(this,e,t,r)},E.prototype.createAnimationBuilderFromData=function(e,t,r){var n=D.trajectory.parseAnimation(e,t,r);return n?new L(this.timeline,n,null===this.defaultTransition?null:this.defaultTransition.clone(),this.robotInfo):null},E.prototype.createLookatBuilder=function(){return new y(this.timeline,this.robotInfo,null===this.defaultTransition?null:this.defaultTransition.clone())},E.prototype.blink=function(e){null!=this.blinkBuilder?(this.blinkInProgress===!1||e===!0)&&(this.blinkBuilder.play(),this.blinkInProgress=!0):b.warn("Blink requested but blink builder not yet loaded")},E.prototype.stopAll=function(){},E.prototype.setEyeVisible=function(e){var t=this.robotInfo.getDOFSet("EYE_TEXTURE").getDOFs()[0],r=this.robotInfo.getDOFSet("OVERLAY_TEXTURE").getDOFs()[0],n=this.robotInfo.getDefaultDOFValues(),o=n[t],i=n[r],a=new p("eye visibility pose",[t,r]);e?(a.set(t,o,0),a.set(r,i,0)):(a.set(t,i,0),a.set(r,i,0));var s=f.createFromPose("eye visibility motion",a,.5),l=this.timeline.getClock().currentTime();this.timeline.add(new v(s,l,this.robotInfo),"default")},
E.prototype.setEyeScale=function(e){for(var t=this.robotInfo.getDOFSet("EYE_DEFORM").plus("OVERLAY_DEFORM").getDOFs(),r=this.robotInfo.getKinematicInfo().getDefaultPose(),n=new p("eye pose",t),o=0;o<t.length;o++)n.set(t[o],r.get(t[o],0)*e,0);var i=f.createFromPose("eye scale motion",n,.5),a=this.timeline.getClock().currentTime();this.timeline.add(new v(i,a,this.robotInfo),"default")},E.prototype.setEyeScaleXY=function(e,t){for(var r=this.robotInfo.getDOFSet("EYE_DEFORM").plus("OVERLAY_DEFORM").getDOFs(),n=this.robotInfo.getKinematicInfo().getDefaultPose(),o=new p("eye pose",r),i=0;i<r.length;i++)r[i].indexOf("_t_2")>-1?o.set(r[i],n.get(r[i],0)*t,0):o.set(r[i],n.get(r[i],0)*e,0);var a=f.createFromPose("eye scale motion",o,.5),s=this.timeline.getClock().currentTime();this.timeline.add(new v(a,s,this.robotInfo),"default")},E.prototype.setEyePosition=function(e,t){var r=this.robotInfo.getDOFSet("EYE_TRANSLATE").getDOFs(),n=this.robotInfo.getDOFSet("OVERLAY_TRANSLATE").getDOFs(),o=new p("eye pose",r.concat(n));o.set(r[0],e,0),o.set(r[1],t,0),o.set(n[0],e,0),o.set(n[1],t,0);var i=f.createFromPose("eye position motion",o,.5),a=this.timeline.getClock().currentTime();this.timeline.add(new v(i,a,this.robotInfo),"default")},E.prototype.setLEDColor=function(e){var t=null;t=Array.isArray(e)?e:e.toArray();for(var r=this.robotInfo.getDOFSet("LED").getDOFs(),n=new p("LED pose",r),o=0;3>o;o++)n.set(r[o],t[o],0);var i=f.createFromPose("LED motion",n,.5),a=0,s=this.timeline.getClock().currentTime().add(a);this.timeline.add(new v(i,s,this.robotInfo),"default")},E.prototype.centerRobot=function(e,t,r){(void 0===e||null===e)&&(e=this.dofs.ALL),(void 0===t||null===t)&&(t=!1);var n=f.createFromPose("center motion",this.robotInfo.getKinematicInfo().getDefaultPose(),1/30,e.getDOFs()),o=new L(this.timeline,new d(n),this.defaultTransition.clone(),this.robotInfo),i=1,a=t&&e.hasDOF(this.dofs.BASE.getDOFs()[0]),s=null;if(a&&(s=this.createLookatBuilder(),s.setDOFs(this.dofs.BASE),i++),r){var l=function(){i--,0===i&&r()};o.on(D.AnimationEventType.CANCELLED,l),o.on(D.AnimationEventType.STOPPED,l),s&&(s.on(D.LookatEventType.CANCELLED,l),s.on(D.LookatEventType.STOPPED,l))}o.play(),s&&s.startLookat(new T.Vector3(1,0,0))},E.prototype.setDefaultTransition=function(e){this.defaultTransition=e},E.prototype.getDefaultTransition=function(){return this.defaultTransition},E.prototype.createLinearTransitionBuilder=function(){return D.trajectory.createLinearTransitionBuilder(this.robotInfo)},E.prototype.createAccelerationTransitionBuilder=function(e,t){return D.trajectory.createAccelerationTransitionBuilder(this.robotInfo,e,t)},E.prototype.installRenderPlugin=function(e){for(var t=u(this.timeline),r=0;r<t.length;r++)t[r].installRenderPlugin(e)},E.prototype.removeRenderPlugin=function(e){for(var t=u(this.timeline),r=0;r<t.length;r++)t[r].removeRenderPlugin(e)},E.prototype.getInstalledRenderPluginNames=function(){for(var e=[],t=u(this.timeline),r=0;r<t.length;r++)for(var n=t[r].getInstalledRenderPluginNames(),o=0;o<n.length;o++)e.indexOf(n[o])<0&&e.push(n[o]);return e};var A=function(e,t,r,n){this.builder=e,this.transitionClip=t,this.animationClip=r,this.layer=n};A.prototype.stop=function(){var e=this.builder.timeline,t=0,r=e.getClock().currentTime().add(t);if(r.isGreater(this.animationClip.getEndTime()))return void(this.animationClip.hasExited()?b.warn("Ignoring stop on "+this.animationClip.getName()+" as it is already over"):b.warn("Ignoring stop on "+this.animationClip.getName()+" as it is already committed"));null===this.transitionClip?this.animationClip.getStartTime().isGreater(r)&&(r=this.animationClip.getStartTime(),b.info("Stopping called on transitionless animation "+this.animationClip.getName()+" before anim started, moving stopTime forward")):this.transitionClip.getStartTime().isGreater(r)&&(r=this.transitionClip.getStartTime(),b.info("Stopping called on animation "+this.animationClip.getName()+" before its transition started, moving stopTime forward"));var n=null;n=null!==this.transitionClip&&this.transitionClip.getEndTime().isGreater(r)?this.transitionClip:this.animationClip;for(var o=[],i=n.getDOFs(),a=r.subtract(n.getStartTime()),s=0;s<i.length;s++){var l=n.getDurationForDOF(i[s]);null!==l&&l>a&&o.push(i[s])}for(var h=new p("stop pose",o),u=0;u<o.length;u++)h.set(o[u],[0]);var c=f.createFromPose(n.getName()+"_stop",h,0),d=new v(c,r,this.builder.robotInfo);e.add(d,this.layer)},A.prototype.getTransitionStartTime=function(){return this.transitionClip?this.transitionClip.getStartTime():this.animationClip.getStartTime()},A.prototype.getAnimationStartTime=function(){return this.animationClip.getStartTime()},A.prototype.getAnimationEndTime=function(){return this.animationClip.getEndTime()},A.prototype.getBuilder=function(){return this.builder};var L=function(e,t,r,n,o){null==o&&(o="default"),this.layer=o,this.timeline=e,this.motion=t,this.dofNames=Object.keys(t.getMotion().getTracks()),this.eventHandlers={},this.speed=1,this.numLoops=1,this.inPoint=0,this.outPoint=t.getDuration(),this.transition=r,this.stopOrient=!0,this.layerDOFs=e.getDOFsForLayer(o),this.robotInfo=n,this.setDOFs(null)};L.prototype._createStartedHandler=function(e){var t=this.eventHandlers[D.AnimationEventType.STARTED];if(t){var r=t.slice(0);return function(){for(var t=0;t<r.length;t++)r[t](D.AnimationEventType.STARTED,e,{})}}return null},L.prototype._createStoppedHandler=function(e){var t=this.eventHandlers[D.AnimationEventType.STOPPED];if(t){var r=t.slice(0);return function(t){for(var n=0;n<r.length;n++)r[n](D.AnimationEventType.STOPPED,e,{interrupted:t})}}return null},L.prototype._createRemovedHandler=function(e){var t=this.eventHandlers[D.AnimationEventType.STOPPED],r=this.eventHandlers[D.AnimationEventType.CANCELLED];if(t||r){var n=null,o=null;return t&&(n=t.slice(0)),r&&(o=r.slice(0)),function(t,r){var i;if(n&&t&&!r)for(i=0;i<n.length;i++)n[i](D.AnimationEventType.STOPPED,e,{interrupted:!0});if(o&&!t)for(i=0;i<n.length;i++)o[i](D.AnimationEventType.CANCELLED,e,{})}}return null},L.prototype._createEventHandler=function(e){var t=null;this.eventHandlers[D.AnimationEventType.EVENT]&&(t=this.eventHandlers[D.AnimationEventType.EVENT].slice(0));for(var r={},n=Object.keys(this.eventHandlers),o=0;o<n.length;o++){var i=n[o];i!==D.AnimationEventType.STARTED&&i!==D.AnimationEventType.STOPPED&&i!==D.AnimationEventType.CANCELLED&&i!==D.AnimationEventType.EVENT&&this.eventHandlers[i]&&(r[i]=this.eventHandlers[i].slice(0))}return t||Object.keys(r).length>0?function(n){var o;if(t)for(o=0;o<t.length;o++)t[o](D.AnimationEventType.EVENT,e,{eventName:n.getEventName(),payload:n.getPayload()});var i=n.getEventName();if(r[i])for(o=0;o<r[i].length;o++)r[i][o](i,e,n.getPayload())}:null},L.prototype.play=function(){for(var e=this.timeline.getClock().currentTime(),t=new f(this.motion.getMotion().getName()),r=0;r<this.dofNames.length;r++){var n=this.motion.getMotion().getTracks()[this.dofNames[r]];n&&t.addTrack(n)}var o=new d(t,this.motion.getEvents());1!==this.speed&&o.setSpeed(this.speed);var i=0,a=null;if(this.transition){var s,l,h;if("default"===this.layer){if(s=this.timeline.getCurrentState([this.layer]).getPose(),l=o.getMotion(),h=null,this.stopOrient){var u=this.timeline.getCurrentState(["lookat"]).getPose(),c=f.createFromPose("stop look",u,1),p=this.transition.generateTransition(u,c,0,u.getDOFNames());this.timeline.add(new v(p,e,this.robotInfo),"lookat")}}else s=this.timeline.getCurrentState([this.layer]).getPose(),l=o.getMotion(),h=null;var m=this.transition.generateTransition(s,l,0,this.dofNames);a=new v(m,e,this.robotInfo),a.setProperties(h),a=this.timeline.add(a,this.layer),null!==a&&(i=a.getDuration())}var g=new A(this,null,null,this.layer),y=null;if(1===this.numLoops)y=new v(o.getMotion(),e.add(i),this.robotInfo),y.setEvents(o.getEvents());else{var b=[o.getMotion()],w=[o.getEvents()];if(this.transition){var x=o.getMotion().getPoseAtTime(o.getMotion().getDuration(),this.robotInfo.getKinematicInfo().getInterpolatorSet()),T=this.transition.generateTransition(x,o.getMotion(),0,this.dofNames);b.push(T),w.push([])}y=new _(b,this.numLoops,e.add(i),this.robotInfo),y.setEvents(w)}return y.setHandlers(this._createStartedHandler(g),this._createStoppedHandler(g),this._createRemovedHandler(g),this._createEventHandler(g)),y=this.timeline.add(y,this.layer),g.transitionClip=a,g.animationClip=y,g},L.prototype.on=function(e,t){var r=this.eventHandlers[e];r||(r=[],this.eventHandlers[e]=r),-1===r.indexOf(t)&&r.push(t)},L.prototype.off=function(e,t){var r=this.eventHandlers[e];if(r){var n=r.indexOf(t);-1!==n&&r.splice(n,1)}},L.prototype.setSpeed=function(e){this.speed=e},L.prototype.setNumLoops=function(e){if(0>e)throw new Error("numLoops value is negative: "+e);this.numLoops=e},L.prototype.setDOFs=function(e){null==e?e=Object.keys(this.motion.getMotion().getTracks()):e instanceof x&&(e=e.getDOFs()),this.dofNames=[];for(var t=0;t<e.length;t++)this.motion.getMotion().getTracks().hasOwnProperty(e[t])&&this.layerDOFs.indexOf(e[t])>-1&&this.dofNames.push(e[t])},L.prototype.getDOFs=function(){return this.dofNames},L.prototype.setPlayBounds=function(e,t){null!==e&&void 0!==e?this.inPoint=e:this.inPoint=0,null!==t&&void 0!==t?this.outPoint=t:this.outPoint=this.getSourceAnimationDuration()},L.prototype.getSourceAnimationDuration=function(){return this.motion.getSourceMotionDuration()},L.prototype.getConfiguredAnimationDuration=function(){var e=this.outPoint-this.inPoint;return e/this.speed},L.prototype.setTransitionIn=function(e){this.transition=e},L.prototype.getTransitionIn=function(){return this.transition},L.prototype.setStopOrient=function(e){this.stopOrient=e},L.prototype.setLayer=function(e){null===this.timeline.getDOFsForLayer(e)?b.error("AnimationBuilder: ignoring setLayer with unknown layer name: "+e):(this.layer=e,this.layerDOFs=this.timeline.getDOFsForLayer(e),this.setDOFs(this.dofNames.slice(0)))};var P={};P.prototype={stop:function(){},updateTarget:function(e){},getTarget:function(){},getBuilder:function(){}};var F={};F.prototype={startLookat:function(e){},on:function(e,t){},off:function(e,t){},setDOFs:function(e){},getDOFs:function(){},setOrientFully:function(e){},setContinuousMode:function(e){}};var D={MODALITY_NAME:"MOTION",createAnimationUtilities:function(e,t){var r=new E;return e&&t&&r.init(e,t),r}};D.trajectory={getAnimation:function(e,t,r){var n;r||(n=M[e]),n?t&&t(new d(n.motion,n.events)):S.load(e,function(){var r=S.getResult();r.success?(M[e]=r,t&&t(new d(r.motion,r.events))):(b.error("animation load failed, "+r.message+' with URL:"'+e+'"'),t&&t(null))})},parseAnimation:function(e,t,r){var n=null;if(r&&(n=M[r]),n)return new d(n.motion,n.events);var o=new c;if(t){var i=t.slice(-1);"/"!==i&&"\\"!==i&&(t+="/"),o.resolvePaths=!0}else o.resolvePaths=!1;o.parseData(e,t);var a=o.getResult();return a.success?(r&&(M[r]=a),new d(a.motion,a.events)):(b.error("animation parse failed: "+a.message),null)},createLinearTransitionBuilder:function(e){return new m(e)},createAccelerationTransitionBuilder:function(e,t,r){return new g(e,t,r)}};var R={STARTED:"STARTED",STOPPED:"STOPPED",CANCELLED:"CANCELLED",EVENT:"EVENT"};D.AnimationEventType=R;var O={STARTED:"STARTED",TARGET_REACHED:"TARGET_REACHED",TARGET_SUPERSEDED:"TARGET_SUPERSEDED",STOPPED:"STOPPED",CANCELLED:"CANCELLED"};D.LookatEventType=O,e.exports=D}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-animate/src/AnimateImpl.js","/release_modules/animation-utilities/node_modules/animation-animate/src")},{"./AccelerationTransitionBuilder":6,"./LinearTransitionBuilderImpl":8,"./SingleLookatBuilder":9,"./timeline/LayerCombiner":14,"./timeline/LayerState":15,"./timeline/LoopedMotionGenerator":18,"./timeline/PropertiesPose":21,"./timeline/SimpleMotionGenerator":25,_process:5,"animation-visualize/src/RendererOutput":46,buffer:1,"geometry-info/src/DOFSet":48,"ifr-core/src/SLog":62,"ifr-motion/src/base/AnnotatedMotion":73,"ifr-motion/src/base/Motion":79,"ifr-motion/src/base/Pose":83,"ifr-motion/src/loaders/AnimationLoader":99,three:40}],8:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-motion/src/base/Motion"),c=require("ifr-motion/src/base/MotionValidator"),f=require("ifr-motion/src/base/MotionTrack"),d=require("ifr-motion/src/base/TimestampedBuffer"),p=require("./TransitionBuilder"),m=function(e){p.call(this),this._transitionTime=1,this._defaultMaxVelocity=null,this._maxVelocityByDOF=null,this._robotInfo=e};m.prototype=Object.create(p.prototype),m.prototype.constructor=m,m.prototype.setTransitionTime=function(e){this._transitionTime=e,this._defaultMaxVelocity=null,this._maxVelocityByDOF=null},m.prototype.setMaxVelocity=function(e,t){this._defaultMaxVelocity=e,this._maxVelocityByDOF=t,this._transitionTime=null},m.prototype.generateTransition=function(e,t,r,n){var o,i,a,s;for(s=0;s<n.length;s++){if(o=n[s],!this._robotInfo.getDOFInfo(o))throw new Error("Error transitioning, no dofInfo found for "+o);var l=e.get(o,0);if(null==l||Array.isArray(l)&&l.length<1)throw new Error("Error transitioning, no FROM value for "+o)}c.valuesExist(t,n);var h=this._robotInfo.getKinematicInfo().getInterpolatorSet(),p=new u("Transition:"+t.getName()),m=0,g=t.getPoseAtTime(r,h),y=this._robotInfo.getKinematicInfo().getDOFGlobalAlignment();if(y.refineToGloballyClosestTargetPose(e,g,n),null!==this._transitionTime)m=this._transitionTime;else{var v,_;for(s=0;s<n.length;s++)if(o=n[s],this._robotInfo.getDOFInfo(o).isMetric()){i=e.get(o,0),a=g.get(o,0);var b=this._defaultMaxVelocity;this._maxVelocityByDOF&&this._maxVelocityByDOF[o]&&(b=this._maxVelocityByDOF[o]);var w=Math.abs(a-i),x=w/b;x>m&&(m=x,v=o,_=w)}}for(s=0;s<n.length;s++){o=n[s],i=e.get(o),a=g.get(o,0);var T=new d;T.append(0,i),T.append(m,a),p.addTrack(new f(o,T,m))}return p},m.prototype.clone=function(){for(var e=new m(this._robotInfo),t=Object.keys(this),r=0;r<t.length;r++)e[t[r]]=this[t[r]];return e},e.exports=m}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/LinearTransitionBuilderImpl.js","/release_modules/animation-animate/src")},{"./TransitionBuilder":10,_process:5,buffer:1,"ifr-motion/src/base/Motion":79,"ifr-motion/src/base/MotionTrack":81,"ifr-motion/src/base/MotionValidator":82,"ifr-motion/src/base/TimestampedBuffer":85}],9:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("ifr-motion/src/lookat/Lookat"),require("ifr-motion/src/lookat/MotionLookat")),c=require("ifr-motion/src/lookat/LookatNode"),f=require("ifr-motion/src/lookat/LookatMotionNode"),d=require("ifr-motion/src/lookat/RotationalLookatDOF"),p=require("ifr-motion/src/lookat/RotationalPlaneAlignmentLookatDOF"),m=require("ifr-motion/src/lookat/PlaneDisplacementLookatDOF"),g=require("ifr-motion/src/base/Pose"),y=require("ifr-motion/src/base/Motion"),v=(require("ifr-motion/src/base/AnnotatedMotion"),require("ifr-motion/src/base/MotionTrack"),require("ifr-motion/src/base/TimestampedBuffer"),require("three")),_=(require("./timeline/TimelineEventDispatcher"),require("./timeline/SimpleMotionGenerator")),b=(require("./timeline/LookatMotionGenerator"),require("./timeline/PropertiesPose"),require("./timeline/LayerCombiner"),require("ifr-core/src/SLog")),w=require("./timeline/LookatMultiLayerStatusManager"),x=require("geometry-info/src/DOFSet"),T="LOOKAT",M={STARTED:"STARTED",TARGET_REACHED:"TARGET_REACHED",TARGET_SUPERSEDED:"TARGET_SUPERSEDED",STOPPED:"STOPPED",CANCELLED:"CANCELLED"},S=function(e,t,r,n){var o=this,i=function(){var e=t.getKinematicInfo().getFullKinematicGroup();return new u([new f(new c("BaseLookatNode",[new d("BaseLookatDOF","bottomSection_r",new v.Vector3(0,0,-1))]),t.getKinematicInfo().getDOFGlobalAlignment(),3,f.LookStabilizationMode.POINT_AUTO),new f(new c("TorsoLookatNode",[new p("TorsoLookatDOF","middleSection_r",new v.Vector3(9.509979e-9,.9271838,.37460676),.18703285,.29670632)]),t.getKinematicInfo().getDOFGlobalAlignment(),3,f.LookStabilizationMode.POINT_AUTO),new f(new c("TopLookatNode",[new d("TopLookatDOF","topSection_r",new v.Vector3(0,0,-1))]),t.getKinematicInfo().getDOFGlobalAlignment(),3,f.LookStabilizationMode.POINT_AUTO),new f(new c("Eye",[new m("EyeLeftRight","eyeSubRootBn_t","eyeRootBn",new v.Vector3(0,0,1),new v.Vector3(0,1,0),.2,-.03643574,.03643574),new m("EyeUpDown","eyeSubRootBn_t_2","eyeRootBn",new v.Vector3(0,0,1),new v.Vector3(-1,0,0),.1,-.008008724,.008008724)]),t.getKinematicInfo().getDOFGlobalAlignment(),1,f.LookStabilizationMode.POINT_TARGET)],e)},a=!0,s=!1,l={},h=i(),S=new g("LookPose",h.getDOFs()),C=function(r,n,i){r=r.clone();var a=null,s=null,l=i;this.getTarget=function(){return r},this.updateTarget=function(e){Array.isArray(e)?r.set(e[0],e[1],e[2]):r.copy(e),l.setTarget(r)},this.getBuilder=function(){return o},this.setClip=function(e,t){a=e,s=t},this.stop=function(){a&&h(a,"default"),s&&h(s,"lookat")};var h=function(e){var t=function(t,r){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(r,n){var o=0,i=e.getClock().currentTime().add(o);if(i.isGreater(r.getEndTime()))return void(r.hasExited()?b.info("Ignoring stop on SingleLookat as it is already over"):b.info("Ignoring stop on SingleLookat as it is already committed"));r.getStartTime().isGreater(i)&&(i=r.getStartTime(),b.info("Stopping called on lookat before it started, moving stopTime forward"));for(var a=[],s=r.getDOFs(),l=i.subtract(r.getStartTime()),h=0;h<s.length;h++){var u=r.getDurationForDOF(s[h]);null!==u&&u>l&&a.push(s[h])}for(var c=new g("stop pose",a),f=0;f<a.length;f++)c.set(a[f],[0]);var d=y.createFromPose(r.getName()+"_stop",c,0),p=new _(d,i,t);e.add(p,n)})};this.startLookat=function(r){var n=null;n=Array.isArray(r)?new v.Vector3(r[0],r[1],r[2]):r;var o=e.getClock().currentTime();h=i();for(var l=e.getCurrentState(["lookat"]).getPose(),u=[],c=[],f=S.getDOFNames(),d=0;d<f.length;d++)null!==l.get(f[d])?c.push(f[d]):u.push(f[d]);var p=e.getCurrentState(["default","lookat"]),m=p.getPose(),x=p.getTime(),M=null,D=new w(h,o,n,s),R=!1;if(R){h.reset();for(var O=o,k=[],N=[],B=Number.MAX_VALUE;B>.001;){b(T,"Creating lookat pose at time "+O.subtract(o)+" with remaining:"+B),h.generatePose(m,S,n,O),B=h.getDistanceRemaining();var U=new g("Pose "+O,S.getDOFNames());U.setPose(S),k.push(U),N.push(O.subtract(o)),m.setPose(S),O=O.add(1/30)}var I=y.createFromPoses("ToLook",k,N,O.subtract(o));M=new _(I,o,t)}else{if(h.reset(),a)h.generatePose(m,S,n,x);else{for(d=0;d<c.length;d++)h.generatePoseIncremental(l,S,n,x,c[d]);for(d=0;d<u.length;d++)h.generatePoseIncremental(m,S,n,x,u[d])}M=D.createGenerator(u)}var V=new C(n,h,D);D.setHandlers(E(V),P(V),F(V),A(V),L(V)),M=e.add(M,"default");var z=null;if(c.length>0){if(a){var G=y.createFromPose("zero motion",t.getKinematicInfo().getDefaultPose().getCopy(),1,c);e.add(new _(G,o,t,c),"default")}z=D.createGenerator(c),e.add(z,"lookat")}return V.setClip(M,z),V},this.on=function(e,t){var r=l[e];r||(r=[],l[e]=r),-1===r.indexOf(t)&&r.push(t)},this.off=function(e,t){var r=l[e];if(r){var n=r.indexOf(t);-1!==n&&r.splice(n,1)}},this.setDOFs=function(e){e?e instanceof x&&(e=e.getDOFs()):e=h.getDOFs();for(var t=h.getDOFs(),r=[],n=0;n<e.length;n++)t.indexOf(e[n])>-1&&r.push(e[n]);S=new g("LookPose",r)},this.getDOFs=function(){return S.getDOFNames().slice(0)},this.setOrientFully=function(e){a=e},this.setContinuousMode=function(e){s=e},this.setTransitionIn=function(e){r=e};var E=function(e){var t=l[M.STARTED];if(t){var r=t.slice(0);return function(){for(var t=0;t<r.length;t++)r[t](M.STARTED,e,{})}}return null},A=function(e){var t=l[M.TARGET_REACHED];if(t){var r=t.slice(0);return function(t){for(var n=0;n<r.length;n++)r[n](M.TARGET_REACHED,e,{target:t})}}return null},L=function(e){var t=l[M.TARGET_SUPERSEDED];if(t){var r=t.slice(0);return function(t){for(var n=0;n<r.length;n++)r[n](M.TARGET_SUPERSEDED,e,{target:t})}}return null},P=function(e){var t=l[M.STOPPED];if(t){var r=null;return t&&(r=t.slice(0)),function(t){if(r)for(var n=0;n<r.length;n++)r[n](M.STOPPED,e,{interrupted:t})}}return null},F=function(e){var t=l[M.STOPPED],r=l[M.CANCELLED];if(t||r){var n=null,o=null;return t&&(n=t.slice(0)),r&&(o=r.slice(0)),function(t,r){var i;if(n&&t&&!r)for(i=0;i<n.length;i++)n[i](M.STOPPED,e,{interrupted:!0});if(o&&!t)for(i=0;i<n.length;i++)o[i](M.CANCELLED,e,{})}}return null}};e.exports=S}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/SingleLookatBuilder.js","/release_modules/animation-animate/src")},{"./timeline/LayerCombiner":14,"./timeline/LookatMotionGenerator":16,"./timeline/LookatMultiLayerStatusManager":17,"./timeline/PropertiesPose":21,"./timeline/SimpleMotionGenerator":25,"./timeline/TimelineEventDispatcher":26,_process:5,buffer:1,"geometry-info/src/DOFSet":48,"ifr-core/src/SLog":62,"ifr-motion/src/base/AnnotatedMotion":73,"ifr-motion/src/base/Motion":79,"ifr-motion/src/base/MotionTrack":81,"ifr-motion/src/base/Pose":83,"ifr-motion/src/base/TimestampedBuffer":85,"ifr-motion/src/lookat/Lookat":102,"ifr-motion/src/lookat/LookatMotionNode":104,"ifr-motion/src/lookat/LookatNode":105,"ifr-motion/src/lookat/MotionLookat":106,"ifr-motion/src/lookat/PlaneDisplacementLookatDOF":108,"ifr-motion/src/lookat/RotationalLookatDOF":111,"ifr-motion/src/lookat/RotationalPlaneAlignmentLookatDOF":112,three:40}],10:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(){};u.prototype.generateTransition=function(e,t,r,n){},u.prototype.clone=function(){},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/TransitionBuilder.js","/release_modules/animation-animate/src")},{_process:5,buffer:1}],11:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./SampleCombiner"),c=function(){u.call(this)};c.prototype=Object.create(u.prototype),c.prototype.constructor=c,c.prototype.combineSamples=function(e,t,r,n){for(var o=[],i=0;i<t.length;i++)i<r.length?o.push(t[i]+r[i]):o.push(t[i]);return o},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/animation-animate/src/timeline/AddSampleCombiner.js","/release_modules/node_modules/animation-animate/src/timeline")},{"./SampleCombiner":22,_process:5,buffer:1}],12:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./MotionGenerator"),c=require("./TimelineEventDispatcher"),f=(require("./DOFState"),function(e,t,r,n){u.call(this),this._startTime=t,this._name=e,this._customEvents=[],this._targetDuration=n,this._properties=null,this._entered=!1,this._exited=!1,this._clipStartedHandler=null,this._clipStoppedHandler=null,this._clipRemovedHandler=null,this._clipEventHandler=null,this._mask={};for(var o=0;o<r.length;o++)this._mask[r[o]]=n;this._currentTime=null});f.prototype=Object.create(u.prototype),f.prototype.constructor=f,f.prototype.setHandlers=function(e,t,r,n){this._clipStartedHandler=e,this._clipStoppedHandler=t,this._clipRemovedHandler=r,this._clipEventHandler=n},f.prototype.setEvents=function(e){for(var t=0;t<e.length;t++)this._customEvents.push(e[t])},f.prototype.setProperties=function(e){this._properties=e},f.prototype.getName=function(){return this._name},f.prototype.getStartTime=function(){return this._startTime},f.prototype.getEndTime=function(){return this._startTime.add(this.getDuration())},f.prototype.getDuration=function(){for(var e=0,t=Object.keys(this._mask),r=0;r<t.length;r++){var n=t[r];this._mask[n]>e&&(e=this._mask[n])}return e},f.prototype.getEndTimeForDOF=function(e){return this._mask.hasOwnProperty(e)?this.getStartTime().add(this._mask[e]):null},f.prototype.getDurationForDOF=function(e){return this._mask.hasOwnProperty(e)?this._mask[e]:null},f.prototype.cropEnd=function(e,t){var r;r=null!=t?t:Object.keys(this._mask);var n,o=e.subtract(this._startTime);if(o>0)for(n=0;n<r.length;n++){var i=r[n];this._mask.hasOwnProperty(i)&&this._mask[i]>o&&(this._mask[i]=o)}else for(n=0;n<r.length;n++)delete this._mask[r[n]]},f.prototype.getDOFs=function(){return Object.keys(this._mask)},f.prototype.getActiveDOFs=function(e){var t=[];if(e.isGreaterOrEqual(this._startTime))for(var r=Object.keys(this._mask),n=0;n<r.length;n++)this.getEndTimeForDOF(r[n]).isGreater(e)&&t.push(r[n]);return t},f.prototype.hasEntered=function(){return this._entered},f.prototype.hasExited=function(){return this._exited},f.prototype.notifyUpdateStarted=function(e){this._currentTime=e},f.prototype.notifyUpdateFinished=function(){if(!this._entered&&this._currentTime.isGreaterOrEqual(this.getStartTime())&&(this._entered=!0,this._clipStartedHandler&&c.queueEvent(this._clipStartedHandler,[])),this._entered&&!this._exited&&this.queueCustomEvents(),this._entered&&!this._exited&&this._currentTime.isGreaterOrEqual(this.getEndTime())){this._exited=!0;var e=Math.abs(this.getDuration()-this._targetDuration)>.001;this._clipStoppedHandler&&c.queueEvent(this._clipStoppedHandler,[e])}},f.prototype.notifyRemoved=function(){this._clipRemovedHandler&&c.queueEvent(this._clipRemovedHandler,[this._entered,this._exited])},f.prototype.queueCustomEvents=function(){if(this.hasEntered()&&!this.hasExited()&&this._clipEventHandler)for(var e=this._currentTime.subtract(this.getStartTime()),t=this.getDuration();this._customEvents.length>0&&this._customEvents[0].getTimestamp()<=e&&this._customEvents[0].getTimestamp()<=t;)c.queueEvent(this._clipEventHandler,[this._customEvents[0]]),this._customEvents.shift()},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/BaseMotionGenerator.js","/release_modules/animation-animate/src/timeline")},{"./DOFState":13,"./MotionGenerator":19,"./TimelineEventDispatcher":26,_process:5,buffer:1}],13:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t){e=e?e:[],t=t?t:{},this.getValue=function(){return e},this.getProperties=function(){return t}};e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/DOFState.js","/release_modules/animation-animate/src/timeline")},{_process:5,buffer:1}],14:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(){};u.prototype.combineLayers=function(e,t){},u.prototype.incrementState=function(e,t,r,n){},u.getSkipLayerProperty=function(e){return"skip_layer:"+e},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/LayerCombiner.js","/release_modules/animation-animate/src/timeline")},{_process:5,buffer:1}],15:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./PropertiesPose"),c=require("./DOFState"),f=function(e){var t=function(t,r,n){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e,t,r){(null===r||void 0===r)&&(r=new u(t.getDOFNames())),this.getTime=function(){return e},this.getPose=function(){return t},this.getProperties=function(){return r},this.getDOFNames=function(){return t.getDOFNames()},this.getDOFState=function(e){var n=t.get(e),o=r.get(e);return null!==n?new c(n,o):null},this.setDOFState=function(e,n){t.set(e,n.getValue()),r.set(e,n.getProperties())},this.getCopy=function(n){return(null===n||void 0===n)&&(n=e),new f(n,t.getCopy(),r.getCopy())}});e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/LayerState.js","/release_modules/animation-animate/src/timeline")},{"./DOFState":13,"./PropertiesPose":21,_process:5,buffer:1}],16:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("ifr-motion/src/lookat/MotionLookat"),require("./DOFState")),c=require("./BaseMotionGenerator"),f=require("ifr-motion/src/base/Pose"),d=require("ifr-core/src/SLog"),p="LOOKAT",m=function(e,t,r,n,o){var i,a=e.getDOFs();if(null!=n){i=[];for(var s=0;s<n.length;s++)a.indexOf(n[s])>=0?i.push(n[s]):d(p,"Rejecting dof "+n[s]+" from lookat set as it is covered by no lookat nodes")}else i=a;c.call(this,"SingleLookGenerator",t,i,Number.MAX_VALUE),this._motionLookat=e,this._target=r.clone(),this._generatedPose=new f("LMG generated pose",a),this._frozenPose=new f("LMG frozen pose",i),this._motionLookat.getPose(this._frozenPose),this._multiLayerLookatStatus=o};m.prototype=Object.create(c.prototype),m.prototype.constructor=m,m.prototype.setTarget=function(e){this._target.copy(e)},m.prototype.notifyUpdateFinished=function(e){var t=this._multiLayerLookatStatus.handleUpdateFinishedForGenerator(this,e);t&&(this._targetDuration=e.subtract(this._startTime),this.cropEnd(e)),c.prototype.notifyUpdateFinished.call(this,e)},m.prototype.getDOFState=function(e,t){var r=this._currentTime.subtract(this.getStartTime()),n=this.getDurationForDOF(e),o=null;if(null!==n&&(n>r?(this._motionLookat.generatePoseIncremental(t.getPose(),this._generatedPose,this._target,this._currentTime,e),o=this._generatedPose.get(e),null!==o&&this._frozenPose.set(e,o)):o=this._frozenPose.get(e)),null!==o){var i=null;return this._properties&&(i=this._properties.get(e)),new u(o,i)}return null},e.exports=m}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/LookatMotionGenerator.js","/release_modules/animation-animate/src/timeline")},{"./BaseMotionGenerator":12,"./DOFState":13,_process:5,buffer:1,"ifr-core/src/SLog":62,"ifr-motion/src/base/Pose":83,"ifr-motion/src/lookat/MotionLookat":106}],17:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/SLog"),c=require("./LookatMotionGenerator"),f="LOOKAT",d=function(e){this.generator=e,this.layerHasStarted=!1,this.layerHasStopped=!1,this.layerHasRemoved=!1},p=function(e,t,r,n){this._layerStatuses=new Map,this._clipStartedHandler=null,this._clipStoppedHandler=null,this._clipRemovedHandler=null,this._targetReachedHandler=null,this._targetSupersededHandler=null,this._waitingToNotifyOnTarget=null,this._lookat=e,this._startTime=t,this._target=null,this._continuous=n,this._haveSentStart=!1,this.setTarget(r)};p.prototype.createGenerator=function(e){var t=new c(this._lookat,this._startTime,this._target,e,this);return this._layerStatuses.set(t,new d(t)),t.setHandlers(this.handleStarted.bind(this,t),this.handleStopped.bind(this,t),this.handleRemoved.bind(this,t),null),t},p.prototype.setHandlers=function(e,t,r,n,o){this._clipStartedHandler=e,this._clipStoppedHandler=t,this._clipRemovedHandler=r,this._targetReachedHandler=n,this._targetSupersededHandler=o},p.prototype.setTarget=function(e){
var t=!0,r=!1,n=void 0;try{for(var o,i=this._layerStatuses.keys()[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;a.setTarget(e)}}catch(s){r=!0,n=s}finally{try{!t&&i["return"]&&i["return"]()}finally{if(r)throw n}}null!=this._waitingToNotifyOnTarget&&null!=this._targetSupersededHandler&&this._targetSupersededHandler(this._waitingToNotifyOnTarget),this._waitingToNotifyOnTarget=e.clone(),this._target=this._waitingToNotifyOnTarget},p.prototype.handleUpdateFinishedForGenerator=function(e,t){var r=this.getActiveDOFs(t),n=r.length>0&&this._lookat.getDistanceRemaining(r)<.001;return n&&null!=this._waitingToNotifyOnTarget&&(null!=this._targetReachedHandler&&this._targetReachedHandler(this._waitingToNotifyOnTarget),this._waitingToNotifyOnTarget=null),n&&!this._continuous?!0:!1},p.prototype.getActiveDOFs=function(e){var t=new Set,r=!0,n=!1,o=void 0;try{for(var i,a=this._layerStatuses.keys()[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var s=i.value,l=s.getActiveDOFs(e),h=!0,u=!1,c=void 0;try{for(var f,d=l[Symbol.iterator]();!(h=(f=d.next()).done);h=!0){var p=f.value;t.add(p)}}catch(m){u=!0,c=m}finally{try{!h&&d["return"]&&d["return"]()}finally{if(u)throw c}}}}catch(m){n=!0,o=m}finally{try{!r&&a["return"]&&a["return"]()}finally{if(n)throw o}}return Array.from(t)},p.prototype.handleStarted=function(e){var t=this._layerStatuses.get(e);if(t.layerHasStarted=!0,this._clipStartedHandler){var r=!0,n=!0,o=!1,i=void 0;try{for(var a,s=this._layerStatuses.values()[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;l.layerHasStarted||l.layerHasRemoved||(r=!1)}}catch(h){o=!0,i=h}finally{try{!n&&s["return"]&&s["return"]()}finally{if(o)throw i}}r&&(this._clipStartedHandler(),this._haveSentStart=!0)}},p.prototype.handleStopped=function(e,t){var r=this._layerStatuses.get(e);if(r.layerHasStopped&&u(f,"LookatMultiLayerStatManager: getting stop event for stopped layer "+e),r.layerHasStopped=!0,this._clipStoppedHandler){var n=!0,o=!0,i=!1,a=void 0;try{for(var s,l=this._layerStatuses.values()[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var h=s.value;h.layerHasStopped||h.layerHasRemoved||(n=!1)}}catch(c){i=!0,a=c}finally{try{!o&&l["return"]&&l["return"]()}finally{if(i)throw a}}n&&this._clipStoppedHandler(t)}},p.prototype.handleRemoved=function(e,t,r){var n=this._layerStatuses.get(e);n.layerHasRemoved=!0;var o=null;if(!this._haveSentStart&&this._clipStartedHandler){var i=!0,a=!0,s=!1,l=void 0;try{for(var h,u=this._layerStatuses.values()[Symbol.iterator]();!(a=(h=u.next()).done);a=!0)o=h.value,o.layerHasRemoved||o.layerHasStarted||(i=!1)}catch(c){s=!0,l=c}finally{try{!a&&u["return"]&&u["return"]()}finally{if(s)throw l}}i&&(this._clipRemovedHandler(),this._haveSentStart=!0)}if(this._clipRemovedHandler){var f=!0,d=!0,p=!1,m=void 0;try{for(var g,y=this._layerStatuses.values()[Symbol.iterator]();!(d=(g=y.next()).done);d=!0)o=g.value,o.layerHasRemoved||(f=!1)}catch(c){p=!0,m=c}finally{try{!d&&y["return"]&&y["return"]()}finally{if(p)throw m}}f&&this._clipRemovedHandler(t,r)}},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/LookatMultiLayerStatusManager.js","/release_modules/animation-animate/src/timeline")},{"./LookatMotionGenerator":16,_process:5,buffer:1,"ifr-core/src/SLog":62}],18:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-motion/src/base/MotionValidator"),c=require("./DOFState"),f=require("./BaseMotionGenerator"),d=require("./TimelineEventDispatcher"),p=function(e,t,r,n,o){if(!e)throw new Error("tried to construct LoopedMotionGenerator with empty motion list");if(0>t)throw new Error("numLoops value is negative: "+t);o||(o=Object.keys(e[0].getTracks()));var i,a,s;for(i=0;i<e.length;i++)for(s=e[i].getTracks(),a=0;a<o.length;a++)if(!s.hasOwnProperty(o[a]))throw new Error("LoopedMotionGenerator: motion "+i+" doesn't have a track for required DOF: "+o[a]);for(this._durationList=[],i=0;i<e.length;i++){var l=0;for(a=0;a<o.length;a++){var h=e[i].getTracks()[o[a]].getLength();h>l&&(l=h)}this._durationList.push(l)}for(this._loopDuration=0,i=0;i<e.length;i++)this._loopDuration=this._loopDuration+this._durationList[i];var c=0;for(c=0===t?Number.MAX_VALUE:this._loopDuration*t,f.call(this,e[0].getName(),r,o,c),i=0;i<e.length;i++)u.valuesExist(e[i]);this._motionList=e,this._numLoops=t,this._customEventTimes=[],this._eventLoopIndex=0,this._eventIndex=0,this._interpolatorSet=n.getKinematicInfo().getInterpolatorSet()};p.prototype=Object.create(f.prototype),p.prototype.constructor=p,p.prototype.setEvents=function(e){if(e.length!==this._motionList.length)throw new Error("motionEventsList length "+e.length+" doesn't match motionList length "+this._motionList.length);for(var t=0,r=0;r<this._motionList.length;r++){for(var n=e[r],o=0;o<n.length;o++)this._customEvents.push(n[o]),this._customEventTimes.push(t+n[o].getTimestamp());t+=this._durationList[r]}},p.prototype.getDOFState=function(e,t){var r=this._currentTime.subtract(this.getStartTime()),n=this.getDurationForDOF(e);if(null!==n){var o=Math.min(r,n);o=Math.max(o,0);var i=Math.floor(o/this._loopDuration);0!==this._numLoops&&(i=Math.min(i,this._numLoops-1));for(var a=o-this._loopDuration*i,s=0,l=a;s<this._motionList.length-1&&l>this._durationList[s];)l-=this._durationList[s],s++;var h=this._motionList[s].getTracks()[e].getDataAtTime(l,this._interpolatorSet.getInterpolator(e)),u=null;return this._properties&&(u=this._properties.get(e)),new c(h,u)}return null},p.prototype.queueCustomEvents=function(){if(this.hasEntered()&&!this.hasExited()&&this._clipEventHandler){var e=this._currentTime.subtract(this.getStartTime()),t=this.getDuration(),r=Math.min(e,t);r=Math.max(r,0);var n=Math.floor(r/this._loopDuration);0!==this._numLoops&&(n=Math.min(n,this._numLoops-1));for(var o=r-this._loopDuration*n;this._eventLoopIndex<n;){for(;this._eventIndex<this._customEvents.length;)d.queueEvent(this._clipEventHandler,[this._customEvents[this._eventIndex]]),this._eventIndex++;this._eventLoopIndex++,this._eventIndex=0}for(;this._eventIndex<this._customEvents.length&&this._customEventTimes[this._eventIndex]<=o;)d.queueEvent(this._clipEventHandler,[this._customEvents[this._eventIndex]]),this._eventIndex++}},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/LoopedMotionGenerator.js","/release_modules/animation-animate/src/timeline")},{"./BaseMotionGenerator":12,"./DOFState":13,"./TimelineEventDispatcher":26,_process:5,buffer:1,"ifr-motion/src/base/MotionValidator":82}],19:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(){};u.prototype.getName=function(){},u.prototype.getStartTime=function(){},u.prototype.getEndTime=function(){},u.prototype.getDuration=function(){},u.prototype.getEndTimeForDOF=function(e){},u.prototype.getDurationForDOF=function(e){},u.prototype.cropEnd=function(e,t){},u.prototype.getDOFs=function(){},u.prototype.hasEntered=function(){},u.prototype.hasExited=function(){},u.prototype.notifyUpdateStarted=function(e){},u.prototype.notifyUpdateFinished=function(){},u.prototype.notifyRemoved=function(){},u.prototype.getDOFState=function(e,t){},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/MotionGenerator.js","/release_modules/animation-animate/src/timeline")},{_process:5,buffer:1}],20:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-motion/src/base/Pose"),c=require("ifr-motion/src/base/Motion"),f=require("ifr-motion/src/base/MotionTrack"),d=require("ifr-motion/src/base/TimestampedBuffer"),p=require("ifr-motion/src/base/DOFGlobalAlignment"),m=require("ifr-core/src/SLog"),g=require("./TimelineEventDispatcher"),y=require("./LayerState"),v=function(e,t,r,n,o){this._name=e,this._layers={},this._layerNames=[],this._robotInfo=t,this._dofNames=t.getDOFNames(),this._layerStates={},this._outputs=[],this._clock=r,this._layerCombiner=n,this._modalityName=o,this._bufferOfRecentRendererdPoses=[],this._timesRecentRendererdPoses=[],this._bufferOfRecentLayerStates=[],this._timesRecentLayerStates=[],this._dofAlignment=new p(this._robotInfo.getKinematicInfo().getFullKinematicGroup(),null),this._sortedDOFNames=this._dofNames.slice(0),this._sortedDOFNames=this._dofAlignment.sortDOFsByDepth(this._sortedDOFNames),this._dofMapByLayer={}};v.prototype.getModalityDelegate=function(e){return e===this._modalityName?this:null},v.prototype.getClock=function(){return this._clock},v.prototype.getName=function(){return this._name},v.prototype.createLayer=function(e,t){if(this._layers.hasOwnProperty(e))m.error("Not creating Timeline layer "+e+" since we already have one!");else{null==t&&(t=this._dofNames),this._layers[e]=[],this._layerNames.push(e);var r=this._robotInfo.getKinematicInfo().getDefaultPose(),n=new u(e+"_pose",t.slice(0));n.setPose(r),this._layerStates[e]=new y(this._clock.currentTime(),n),this._dofMapByLayer[e]={};for(var o=0;o<t.length;o++){var i=t[o];this._dofMapByLayer[e][i]=i}}},v.prototype.getLayerNames=function(){return this._layerNames.slice(0)},v.prototype.getLayerCombiner=function(){return this._layerCombiner},v.prototype.getCurrentState=function(e){e=e?e:this._layerNames;var t,r=[];for(t=0;t<e.length;t++){if(!this._layerStates.hasOwnProperty(e[t]))return m.error("MotionTimeline: requested state for unknown layer: "+e[t]),null;r.push(this._layerStates[e[t]])}var n=this._layerCombiner.combineLayers(e,r);if(null!==n){for(var o=null,i=this._timesRecentLayerStates.length-1;i>-1;i--)if(n.getTime().subtract(this._timesRecentLayerStates[i])>.01){o=this._bufferOfRecentLayerStates[i];break}if(null!==o){var a=[];for(t=0;t<e.length;t++){if(!o.hasOwnProperty(e[t])){a=null;break}a.push(o[e[t]])}if(null!==a){var s=this._layerCombiner.combineLayers(e,a);if(null!==s){var l=n.getTime().subtract(s.getTime()),h=s.getPose().getCopy(),u=n.getPose().getCopy(),c=n.getDOFNames();this._dofAlignment.refineToLocallyClosestTargetPose(h,u,c);for(var f=0;f<c.length;f++){var d=c[f];if(this._robotInfo.getDOFInfo(d).isMetric()){var p=(u.get(d,0)-h.get(d,0))/l;n.getPose().set(d,p,1)}}}}}}return n},v.prototype.add=function(e,t){if(!this._layers.hasOwnProperty(t))return m.error("MotionTimeline: skipping add on unknown layer: "+t),null;for(var r=e.getStartTime(),n=e.getDOFs(),o=0,i=this._layers[t],a=0;a<i.length;){var s=i[a];s.getEndTime().isGreater(r)&&s.cropEnd(r,n),s.getDuration()>0?a++:(i.splice(a,1),s.notifyRemoved()),r.isGreaterOrEqual(s.getStartTime())&&(o=a)}return e.getDuration()>0?i.splice(o,0,e):(e.notifyRemoved(),e=null),e},v.prototype.cullUpToTime=function(e){for(var t=Object.keys(this._layers),r=0;r<t.length;r++)for(var n=this._layers[t[r]],o=0;o<n.length&&e.isGreater(n[o].getStartTime());){var i=n[o];e.isGreaterOrEqual(i.getEndTime())?(n.splice(o,1),i.notifyRemoved()):o++}},v.prototype.render=function(e,t){var r,n,o,i,a,s,l,h,c,f,d,p;if(t){var m={};for(r=0;r<this._layerNames.length;r++)i=this._layerNames[r],h=this.getDOFsForLayer(i),c=new y(e,new u(i+"_pose",h.slice(0))),m[i]=c;var g=new y(e,new u("partial render pose",this._sortedDOFNames.slice(0)));for(n=0;n<this._sortedDOFNames.length;n++)for(a=this._sortedDOFNames[n],r=0;r<this._layerNames.length;r++)if(i=this._layerNames[r],this._dofMapByLayer[i].hasOwnProperty(a)){for(s=this._layers[i],d=null,o=0;o<s.length&&e.isGreaterOrEqual(s[o].getStartTime());)l=s[o],p=l.getEndTimeForDOF(a),null!==p&&p.isGreater(this._layerStates[i].getTime())&&(d=l),o++;f=null,f=d?d.getDOFState(a,g):this._layerStates[i].getDOFState(a),m[i].setDOFState(a,f),0===r?g.setDOFState(a,f):this._layerCombiner.incrementState(g,i,m[i],a)}for(r=0;r<this._layerNames.length;r++)i=this._layerNames[r],this._layerStates[i]=m[i]}else for(r=0;r<this._layerNames.length;r++){for(i=this._layerNames[r],s=this._layers[i],h=this.getDOFsForLayer(i),c=new y(e,new u(i+"_pose",h.slice(0))),n=0;n<h.length;n++){for(a=h[n],d=null,o=0;o<s.length&&e.isGreaterOrEqual(s[o].getStartTime());)l=s[o],p=l.getEndTimeForDOF(a),null!==p&&p.isGreater(this._layerStates[i].getTime())&&(d=l),o++;f=null,f=d?d.getDOFState(a,null):this._layerStates[i].getDOFState(a),c.setDOFState(a,f)}this._layerStates[i]=c}},v.prototype.addOutput=function(e){this._outputs.push(e)},v.prototype.removeOutput=function(e){var t=this._outputs.indexOf(e);t>-1&&this._outputs.splice(t,1)},v.prototype.getOutputs=function(){return this._outputs};var _=function(e,t,r){for(;t.length>1&&r.isGreaterOrEqual(t[1]);)e.shift(),t.shift()},b=function(e,t){for(var r=e[0].getDOFNames(),n=t[0],o=new c("TimelineOutput"),i=0;i<r.length;i++){for(var a=new d,s=r[i],l=0;l<e.length;l++)a.append(t[l].subtract(n),e[l].get(s));o.addTrack(new f(s,a,a.getEndTime()))}return o};v.prototype.update=function(){var e,t,r,n,o=this._clock.currentTime(),i=this._layerNames;for(e=0;e<i.length;e++)for(r=this._layers[i[e]],t=0;t<r.length;t++)n=r[t],n.notifyUpdateStarted(o);this.render(o,!0);var a=this.getCurrentState();this._bufferOfRecentRendererdPoses.push(a.getPose()),this._timesRecentRendererdPoses.push(o),_(this._bufferOfRecentRendererdPoses,this._timesRecentRendererdPoses,o.add(-.2));for(var s=b(this._bufferOfRecentRendererdPoses,this._timesRecentRendererdPoses),l=this._timesRecentRendererdPoses[0],h=0;h<this._outputs.length;h++){var u=this._outputs[h];u.handleOutput(l,s,o)}var c={};for(e=0;e<i.length;e++)c[i[e]]=this._layerStates[i[e]];for(this._bufferOfRecentLayerStates.push(c),this._timesRecentLayerStates.push(o),_(this._bufferOfRecentLayerStates,this._timesRecentLayerStates,o.add(-.2)),e=0;e<i.length;e++)for(r=this._layers[i[e]],t=0;t<r.length;t++)n=r[t],n.notifyUpdateFinished(o);this.cullUpToTime(o),g.dispatchQueuedEvents()},v.prototype.getDOFsForLayer=function(e){return this._layerStates.hasOwnProperty(e)?this._layerStates[e].getDOFNames():null},e.exports=v}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/animation-animate/src/timeline/MotionTimeline.js","/release_modules/node_modules/animation-animate/src/timeline")},{"./LayerState":15,"./TimelineEventDispatcher":26,_process:5,buffer:1,"ifr-core/src/SLog":62,"ifr-motion/src/base/DOFGlobalAlignment":76,"ifr-motion/src/base/Motion":79,"ifr-motion/src/base/MotionTrack":81,"ifr-motion/src/base/Pose":83,"ifr-motion/src/base/TimestampedBuffer":85}],21:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e){e=void 0!==e?e:[],this.dofVals={};for(var t=0;t<e.length;t++)this.dofVals[e[t]]={}};u.prototype.set=function(e,t){if(this.dofVals.hasOwnProperty(e)){this.dofVals[e]={};for(var r=t?t:{},n=Object.keys(r),o=0;o<n.length;o++)this.dofVals[e][n[o]]=r[n[o]]}},u.prototype.add=function(e,t){if(this.dofVals.hasOwnProperty(e))for(var r=t?t:{},n=Object.keys(r),o=0;o<n.length;o++)this.dofVals[e][n[o]]=r[n[o]]},u.prototype.get=function(e,t){if(this.dofVals.hasOwnProperty(e)){var r;return r=void 0!==t?this.dofVals[e][t]:this.dofVals[e],void 0!==r?r:null}return null},u.prototype.getDOFNames=function(){return Object.keys(this.dofVals)},u.prototype.getCopy=function(){for(var e=this.getDOFNames(),t=new u(e),r=0;r<e.length;r++)t.add(e[r],this.get(e[r]));return t},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/PropertiesPose.js","/release_modules/animation-animate/src/timeline")},{_process:5,buffer:1}],22:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(){};u.prototype.combineSamples=function(e,t,r,n){},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/SampleCombiner.js","/release_modules/animation-animate/src/timeline")},{_process:5,buffer:1}],23:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./SampleCombiner"),c=function(e,t,r){u.call(this),this._unityScales={},this._zeroScales={};for(var n=0;n<r.length;n++){var o=r[n];null!=e&&null!=e.get(o)?this._unityScales[o]=e.get(o)[0]:this._unityScales[o]=1,null!=t&&null!=t.get(o)?this._zeroScales[o]=t.get(o)[0]:this._zeroScales[o]=0}};c.prototype=Object.create(u.prototype),c.prototype.constructor=c,c.prototype.combineSamples=function(e,t,r,n){var o=[],i=this._unityScales[e],a=this._zeroScales[e],s=(r[0]-a)/(i-a)+a;isNaN(s)&&(s=0);for(var l=0;l<t.length;l++)o.push(t[l]*s);return o},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/animation-animate/src/timeline/ScaleSampleCombiner.js","/release_modules/node_modules/animation-animate/src/timeline")},{"./SampleCombiner":22,_process:5,buffer:1}],24:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./LayerCombiner"),c=function(){u.call(this),this.sampleCombiners={}};c.prototype=Object.create(u.prototype),c.prototype.constructor=c,c.prototype.setSampleCombiner=function(e,t){this.sampleCombiners[e]=t},c.prototype.combineLayers=function(e,t){if(!e)return null;for(var r=t[0].getCopy(),n=1;n<e.length;n++)for(var o=t[n].getDOFNames(),i=0;i<o.length;i++)this.incrementState(r,e[n],t[n],o[i]);return r},c.prototype.incrementState=function(e,t,r,n){var o=e.getPose().get(n),i=r.getPose().get(n),a=e.getProperties().get(n,u.getSkipLayerProperty(t)),s=this.sampleCombiners[t];if(!a&&o&&i&&s){var l=r.getProperties().get(n);e.getProperties().add(n,l);var h=e.getProperties().get(n),c=s.combineSamples(n,o,i,h);e.getPose().set(n,c)}else;},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/animation-animate/src/timeline/SimpleLayerCombiner.js","/release_modules/node_modules/animation-animate/src/timeline")},{"./LayerCombiner":14,_process:5,buffer:1}],25:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-motion/src/base/MotionValidator"),c=require("./DOFState"),f=require("./BaseMotionGenerator"),d=function(e,t,r,n){n||(n=Object.keys(e.getTracks()));for(var o=0,i=0;i<n.length;i++){var a=e.getTracks()[n[i]].getLength();a>o&&(o=a)}f.call(this,e.getName(),t,n,o),u.valuesExist(e),this._motion=e,this._interpolatorSet=r.getKinematicInfo().getInterpolatorSet()};d.prototype=Object.create(f.prototype),d.prototype.constructor=d,d.prototype.getDOFState=function(e,t){var r=this._currentTime.subtract(this.getStartTime()),n=this.getDurationForDOF(e);if(null!==n){var o=Math.min(r,n),i=this._motion.getTracks()[e].getDataAtTime(o,this._interpolatorSet.getInterpolator(e)),a=null;return this._properties&&(a=this._properties.get(e)),new c(i,a)}return null},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/SimpleMotionGenerator.js","/release_modules/animation-animate/src/timeline")},{"./BaseMotionGenerator":12,"./DOFState":13,_process:5,buffer:1,"ifr-motion/src/base/MotionValidator":82}],26:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/SLog"),c=[],f={queueEvent:function(e,t){null==e&&u.error("Error, null/undefined function queued!\n"+(new Error).stack),c.push({f:e,a:t})},dispatchQueuedEvents:function(){for(var e=0;e<c.length;e++){var t=c[e];t.f.apply(null,t.a)}c.length=0}};e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-animate/src/timeline/TimelineEventDispatcher.js","/release_modules/animation-animate/src/timeline")},{_process:5,buffer:1,"ifr-core/src/SLog":62}],27:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/Time"),c=require("ifr-core/src/SLog"),f={NONE:0,LIMP:1,BRAKE:2,PWM:3,VELOCITY:4,TRAJECTORY:5,TORQUE:6,POS_VEL:7},d=function(){this.ts=null,this.pos=null,this.inc_pos=null,this.vel=null,this.cur=null,this.pwm=null,this.status=null,this.vel_limit=null,this.acc_limit=null,this.cur_limit=null,this.mode=null,this.ref=null,this.ticks=null,this.integrator=null};d.prototype.getTimestamp=function(){return null===this.ts?null:u.createFromTimestamp(this.ts)},d.prototype.isIndexed=function(){return null===this.status?!1:(1&this.status)>0},d.prototype.setFromJson=function(e){for(var t=Object.keys(e),r=0;r<t.length;r++)this.hasOwnProperty(t[r])?this[t[r]]=e[t[r]]:c.info("SingleAxisState: unknown JSON property name: "+t[r]);return this};var p=function(){this.ts=null,this.pelvis=null,this.torso=null,this.neck=null};p.prototype.getTimestamp=function(){return null===this.ts?null:u.createFromTimestamp(this.ts)},p.prototype.setFromJson=function(e){return this.ts=e.ts,this.pelvis=(new d).setFromJson(e.pelvis),this.torso=(new d).setFromJson(e.torso),this.neck=(new d).setFromJson(e.neck),this};var m=function(){this.mode=null,this.value=null,this.vel_limit=null,this.acc_limit=null,this.cur_limit=null},g=function(){this.ts=null,this.pelvis=null,this.torso=null,this.neck=null};g.prototype.setTimestamp=function(e){this.ts=e._timestamp};var y=function(){this.ts=null,this.color=null,this.rate_limit=null};y.prototype.setTimestamp=function(e){this.ts=e._timestamp},y.prototype.setRateLimit=function(e){this.rate_limit=[e,e,e]},e.exports.AxisCommandMode=f,e.exports.SingleAxisState=d,e.exports.AxisState=p,e.exports.SingleAxisCommand=m,e.exports.AxisCommand=g,e.exports.LEDCommand=y}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-body/src/BodyData.js","/release_modules/animation-body/src")},{_process:5,buffer:1,"ifr-core/src/SLog":62,"ifr-core/src/Time":63}],28:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./MotionInterface"),c=require("ifr-motion/src/base/Pose"),f=require("ifr-motion/src/base/CyclicMath"),d=require("ifr-core/src/TimerTools"),p=function(e,t,r,n,o,i){this.clock=e,this.robotInfo=t,this.outputStartTime=null,this.outputMotion=null,this.reactionTime=.02,this.velocityCalcDelta=.02,this.motionInterface=new u(r,i),this.dofNames=this.motionInterface.getMotionDOFNames(),this.enabledArray=[];for(var a=0;a<this.dofNames.length;a++)this.enabledArray.push(void 0!==n?n:!1);if(this.infoListeners=[],this.updateHandle=null,o){var s=this;this.updateHandle=d.setInterval(function(){s.update()},o)}this.cachedTargets=null};p.prototype.getMotionDOFNames=function(){return this.dofNames},p.prototype.isConnected=function(){return this.motionInterface.isConnected()},p.prototype.setEnabled=function(e){for(var t=0;t<this.enabledArray.length;t++)this.enabledArray[t]=e instanceof Array?e[t]:e},p.prototype.addInfoListener=function(e){this.infoListeners.push(e)},p.prototype.handleOutput=function(e,t,r){this.outputStartTime=e,this.outputMotion=t,this.computeTargetsForTime(r,!0)},p.prototype.update=function(){},p.prototype.computeTargetsForTime=function(e,t){if(!t)return this.cachedTargets;if(null!==this.outputMotion){var r=e.subtract(this.outputStartTime),n=new c("target pose",this.dofNames);this.outputMotion.getPoseAtTime(r,this.robotInfo.getKinematicInfo().getInterpolatorSet(),n);var o=new c("previous pose",this.dofNames);this.outputMotion.getPoseAtTime(r-this.velocityCalcDelta,this.robotInfo.getKinematicInfo().getInterpolatorSet(),o);for(var i=[],a=0;a<this.dofNames.length;a++){var s=n.get(this.dofNames[a],0),l=o.get(this.dofNames[a],0),h=f.closestEquivalentRotation(l,s),u=(s-h)/this.velocityCalcDelta;i.push({position:s,velocity:u})}return this.cachedTargets=i,i}return this.cachedTargets=null,null},p.prototype.dispose=function(){this.motionInterface.close(),null!==this.updateHandle&&(d.clearInterval(this.updateHandle),this.updateHandle=null),this.robotInfo=null,this.outputMotion=null},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-body/src/BodyOutput.js","/release_modules/animation-body/src")},{"./MotionInterface":36,_process:5,buffer:1,"ifr-core/src/TimerTools":64,"ifr-motion/src/base/CyclicMath":75,"ifr-motion/src/base/Pose":83}],29:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./BodyData"),c=require("./BodyOutput"),f=require("ifr-core/src/Clock"),d=function(e,t,r,n,o,i,a){c.call(this,e,t,r,n,o,i),this.idleModeSwitchTime=.3,null!=a&&(this.idleModeSwitchTime=a),this.startTime=null,this.initialStates=[],this.lastMovingCommandTime=[],this.movingEpsilon=1e-4};d.prototype=Object.create(c.prototype),d.prototype.constructor=c,d.prototype.update=function(){var e,t=this.clock.currentTime(),r=this.computeTargetsForTime(t.add(this.reactionTime));if(null!==r&&this.motionInterface.isConnected()){if(null===this.startTime){for(this.startTime=t,e=0;e<this.dofNames.length;e++)this.initialStates.push(this.motionInterface.getState(this.dofNames[e]));for(e=0;e<this.dofNames.length;e++)this.lastMovingCommandTime.push(f.currentTime())}var n=1,o=8;if(t.subtract(this.startTime)<o){var i=0;for(e=0;e<this.dofNames.length;e++)Math.abs(this.initialStates[e].pos)>i&&(i=Math.abs(this.initialStates[e].pos));i=Math.max(0,Math.min(Math.PI,i));var a=o*(i/Math.PI);n=t.subtract(this.startTime)/a,n=Math.max(0,Math.min(1,n))}for(e=0;e<this.dofNames.length;e++){var s,l=50;if(1>n?(s=[r[e].velocity*n,r[e].position*n+this.initialStates[e].pos*(1-n)],this.lastMovingCommandTime[e]=f.currentTime()):s=[r[e].velocity,r[e].position],(Math.abs(s[0])>this.movingEpsilon||1>n)&&(this.lastMovingCommandTime[e]=f.currentTime()),this.idleModeSwitchTime>0&&f.currentTime().subtract(this.lastMovingCommandTime[e])>this.idleModeSwitchTime)this.motionInterface.setCommand(this.dofNames[e],this.enabledArray[e]?u.AxisCommandMode.VELOCITY:u.AxisCommandMode.LIMP,0,null,l,null);else{var h=this.enabledArray[e]?u.AxisCommandMode.POS_VEL:u.AxisCommandMode.LIMP;this.motionInterface.setCommand(this.dofNames[e],h,h===u.AxisCommandMode.POS_VEL?s:0,null,l,null)}if(this.infoListeners.length>0)for(var c=this.motionInterface.getState(this.dofNames[e]),d={dofName:this.dofNames[e],timestamp:t,observedPosition:c.pos,targetPosition:r[e].position,observedVelocity:c.vel,commandVelocity:r[e].velocity,refVelocity:c.ref},p=0;p<this.infoListeners.length;p++)this.infoListeners[p](d)}this.motionInterface.sendCommand()}},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-body/src/BodyPosVelComboOutput.js","/release_modules/animation-utilities/node_modules/animation-body/src")},{"./BodyData":27,"./BodyOutput":28,_process:5,buffer:1,"ifr-core/src/Clock":60}],30:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./BodyData"),c=require("./BodyOutput"),f=function(e,t,r,n,o,i){c.call(this,e,t,r,n,o,i),this.startTime=null,this.initialStates=[]};f.prototype=Object.create(c.prototype),f.prototype.constructor=c,f.prototype.update=function(){var e,t=this.clock.currentTime(),r=this.computeTargetsForTime(t.add(this.reactionTime));if(null!==r&&this.motionInterface.isConnected()){if(null===this.startTime)for(this.startTime=t,e=0;e<this.dofNames.length;e++)this.initialStates.push(this.motionInterface.getState(this.dofNames[e]));var n=1,o=8;if(t.subtract(this.startTime)<o){var i=0;for(e=0;e<this.dofNames.length;e++)Math.abs(this.initialStates[e].pos)>i&&(i=Math.abs(this.initialStates[e].pos));i=Math.max(0,Math.min(Math.PI,i));var a=o*(i/Math.PI);n=t.subtract(this.startTime)/a,n=Math.max(0,Math.min(1,n))}for(e=0;e<this.dofNames.length;e++){var s,l=this.enabledArray[e]?u.AxisCommandMode.POS_VEL:u.AxisCommandMode.LIMP,h=50;if(s=1>n?[r[e].velocity*n,r[e].position*n+this.initialStates[e].pos*(1-n)]:[r[e].velocity,r[e].position],this.motionInterface.setCommand(this.dofNames[e],l,l===u.AxisCommandMode.POS_VEL?s:0,null,h,null),this.infoListeners.length>0)for(var c=this.motionInterface.getState(this.dofNames[e]),f={dofName:this.dofNames[e],timestamp:t,observedPosition:c.pos,targetPosition:r[e].position,observedVelocity:c.vel,commandVelocity:r[e].velocity,refVelocity:c.ref},d=0;d<this.infoListeners.length;d++)this.infoListeners[d](f)}this.motionInterface.sendCommand()}},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-body/src/BodyPosVelOutput.js","/release_modules/animation-utilities/node_modules/animation-body/src")},{"./BodyData":27,"./BodyOutput":28,_process:5,buffer:1}],31:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./BodyOutput"),c=function(e,t,r,n,o,i){u.call(this,e,t,r,n,o,i)};c.prototype=Object.create(u.prototype),c.prototype.constructor=u,c.prototype.update=function(){var e=this.clock.currentTime(),t=this.computeTargetsForTime(e.add(this.reactionTime));if(null!==t&&this.motionInterface.isConnected()){for(var r=0;r<this.dofNames.length;r++){var n=t[r].position;this.motionInterface.setCommand(this.dofNames[r],0,n,null,null,null)}this.motionInterface.sendCommand()}},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-body/src/BodyPositionOutput.js","/release_modules/animation-utilities/node_modules/animation-body/src")},{"./BodyOutput":28,_process:5,buffer:1}],32:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./BodyData"),c=require("./BodyOutput"),f=function(e,t,r,n,o,i){c.call(this,e,t,r,n,o,i)};f.prototype=Object.create(c.prototype),f.prototype.constructor=c,f.prototype.update=function(){var e=this.clock.currentTime(),t=this.computeTargetsForTime(e.add(this.reactionTime));if(null!==t&&this.motionInterface.isConnected()){for(var r=0;r<this.dofNames.length;r++){var n=this.enabledArray[r]?u.AxisCommandMode.TRAJECTORY:u.AxisCommandMode.LIMP,o=.3,i=30,a=[t[r].velocity,t[r].position,o,0];if(this.motionInterface.setCommand(this.dofNames[r],n,n===u.AxisCommandMode.TRAJECTORY?a:0,null,i,null),this.infoListeners.length>0)for(var s=this.motionInterface.getState(this.dofNames[r]),l={dofName:this.dofNames[r],timestamp:e,observedPosition:s.pos,targetPosition:t[r].position,observedVelocity:s.vel,commandVelocity:t[r].velocity
},h=0;h<this.infoListeners.length;h++)this.infoListeners[h](l)}this.motionInterface.sendCommand()}},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-body/src/BodyTrajectoryOutput.js","/release_modules/animation-utilities/node_modules/animation-body/src")},{"./BodyData":27,"./BodyOutput":28,_process:5,buffer:1}],33:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./BodyData"),c=require("./BodyOutput"),f=require("ifr-motion/src/feedback/PVController"),d=function(e,t,r,n,o,i){c.call(this,e,t,r,n,o,i),this.feedbackControllers=[];for(var a=0;a<this.dofNames.length;a++)this.feedbackControllers.push(new f)};d.prototype=Object.create(c.prototype),d.prototype.constructor=c,d.prototype.update=function(){var e=this.clock.currentTime(),t=this.computeTargetsForTime(e.add(this.reactionTime));if(null!==t&&this.motionInterface.isConnected()){for(var r=0;r<this.dofNames.length;r++){this.feedbackControllers[r].setTarget(e,t[r].position,t[r].velocity),this.feedbackControllers[r].calculateForTime(e);var n=this.feedbackControllers[r].getCommandVelocity(),o=this.feedbackControllers[r].getCommandAcceleration(),i=this.enabledArray[r]?u.AxisCommandMode.VELOCITY:u.AxisCommandMode.LIMP;this.motionInterface.setCommand(this.dofNames[r],i,n,null,o,null);var a=this.motionInterface.getState(this.dofNames[r]);if(this.feedbackControllers[r].acceptFeedback(e,a.pos,a.vel,a.ref),this.infoListeners.length>0)for(var s={dofName:this.dofNames[r],timestamp:e,observedPosition:a.pos,targetPosition:t[r].position,observedVelocity:a.vel,commandVelocity:n},l=0;l<this.infoListeners.length;l++)this.infoListeners[l](s)}this.motionInterface.sendCommand()}},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-body/src/BodyVelocityOutput.js","/release_modules/animation-utilities/node_modules/animation-body/src")},{"./BodyData":27,"./BodyOutput":28,_process:5,buffer:1,"ifr-motion/src/feedback/PVController":96}],34:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./BodyData"),c=require("ifr-core/src/Clock"),f=function(e,t){this.command=new u.LEDCommand,this.command.color=[0,0,0],this.command.setRateLimit(50),t?this.commandSocket=new WebSocket(e+"/led_command",t):this.commandSocket=new WebSocket(e+"/led_command")};f.prototype.setCommand=function(e,t){for(var r=0;3>r;r++)this.command.color[r]=e[r];return this.command.setRateLimit(t),!0},f.prototype.sendCommand=function(){if(this.commandSocket.readyState===WebSocket.OPEN){this.command.setTimestamp(c.currentTime());var e=JSON.stringify(this.command);return this.commandSocket.send(e),!0}return!1},f.prototype.isConnected=function(){return this.commandSocket.readyState===WebSocket.OPEN},f.prototype.close=function(){this.commandSocket.close()},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-body/src/LEDInterface.js","/release_modules/animation-body/src")},{"./BodyData":27,_process:5,buffer:1,"ifr-core/src/Clock":60}],35:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./LEDInterface"),c=require("ifr-motion/src/base/Pose"),f=require("ifr-core/src/TimerTools"),d=function(e,t,r,n,o,i){if(this.clock=e,this.robotInfo=t,this.outputStartTime=null,this.outputMotion=null,this.reactionTime=.02,this.velocityCalcDelta=.02,this.rateLimit=50,this.ledInterface=new u(r,i),this.dofNames=this.robotInfo.getDOFSet("LED").getDOFs(),this.enabled=void 0!==n?n:!0,this.updateHandle=null,o){var a=this;this.updateHandle=f.setInterval(function(){a.update()},o)}};d.prototype.isConnected=function(){return this.ledInterface.isConnected()},d.prototype.setEnabled=function(e){this.enabled=e},d.prototype.handleOutput=function(e,t,r){this.outputStartTime=e,this.outputMotion=t},d.prototype.update=function(){var e=this.clock.currentTime(),t=this.computeTargetsForTime(e.add(this.reactionTime));if(null!==t&&this.enabled&&this.ledInterface.isConnected()){for(var r=[],n=0;n<this.dofNames.length;n++)r.push(t[n].position);this.ledInterface.setCommand(r,this.rateLimit),this.ledInterface.sendCommand()}},d.prototype.computeTargetsForTime=function(e){if(null!==this.outputMotion){var t=e.subtract(this.outputStartTime),r=new c("target pose",this.dofNames);this.outputMotion.getPoseAtTime(t,this.robotInfo.getKinematicInfo().getInterpolatorSet(),r);var n=new c("previous pose",this.dofNames);this.outputMotion.getPoseAtTime(t-this.velocityCalcDelta,this.robotInfo.getKinematicInfo().getInterpolatorSet(),n);for(var o=[],i=0;i<this.dofNames.length;i++){var a=r.get(this.dofNames[i],0),s=n.get(this.dofNames[i],0),l=(a-s)/this.velocityCalcDelta;o.push({position:a,velocity:l})}return o}return null},d.prototype.dispose=function(){this.ledInterface.close(),null!==this.updateHandle&&(f.clearInterval(this.updateHandle),this.updateHandle=null),this.robotInfo=null,this.outputMotion=null},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-body/src/LEDOutput.js","/release_modules/animation-utilities/node_modules/animation-body/src")},{"./LEDInterface":34,_process:5,buffer:1,"ifr-core/src/TimerTools":64,"ifr-motion/src/base/Pose":83}],36:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./BodyData"),c=require("ifr-core/src/Clock"),f=function(e,t,r,n,o){var i=r||"bottomSection_r",a=n||"middleSection_r",s=o||"topSection_r";this.dofToAxis={},this.dofToAxis[i]="pelvis",this.dofToAxis[a]="torso",this.dofToAxis[s]="neck",this.dofNames=[i,a,s],this.stateMessageCount=0,this.latestAxisState=null,this.command=new u.AxisCommand,this.command.pelvis=new u.SingleAxisCommand,this.command.torso=new u.SingleAxisCommand,this.command.neck=new u.SingleAxisCommand;var l=this;t?this.stateSocket=new WebSocket(e+"/axis_state",t):this.stateSocket=new WebSocket(e+"/axis_state"),this.stateSocket.onmessage=function(e){var t=JSON.parse(e.data);l.latestAxisState=(new u.AxisState).setFromJson(t),l.stateMessageCount++},t?this.commandSocket=new WebSocket(e+"/axis_command",t):this.commandSocket=new WebSocket(e+"/axis_command")};f.prototype.getMotionDOFNames=function(){return this.dofNames},f.prototype.getState=function(e){if(!this.dofToAxis.hasOwnProperty(e))throw new Error("unknown motion DOF name: "+e);return null!==this.latestAxisState?this.latestAxisState[this.dofToAxis[e]]:null},f.prototype.getStateMessageCount=function(){return this.stateMessageCount},f.prototype.setCommand=function(e,t,r,n,o,i){if(!this.dofToAxis.hasOwnProperty(e))throw new Error("unknown motion DOF name: "+e);var a=this.getState(e);if(null!==a){var s=this.command[this.dofToAxis[e]];return s.mode=t,s.value=r instanceof Array?r:[r],s.vel_limit=void 0!==n&&null!==n?n:a.vel_limit,s.acc_limit=void 0!==o&&null!==o?o:a.acc_limit,s.cur_limit=void 0!==i&&null!==i?i:a.cur_limit,!0}return!1},f.prototype.sendCommand=function(){if(this.commandSocket.readyState===WebSocket.OPEN){this.command.setTimestamp(c.currentTime());var e=JSON.stringify(this.command);return this.commandSocket.send(e),!0}return!1},f.prototype.isConnected=function(){return null!==this.latestAxisState&&this.commandSocket.readyState===WebSocket.OPEN},f.prototype.close=function(){this.stateSocket.close(),this.commandSocket.close()},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-body/src/MotionInterface.js","/release_modules/animation-utilities/node_modules/animation-body/src")},{"./BodyData":27,_process:5,buffer:1,"ifr-core/src/Clock":60}],37:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/Time"),c=require("ifr-core/src/FileTools"),f={};f.createLog=function(e){var t="fs";t=require(t);var r=t.createWriteStream(e),n=!0;return function(e){n?n=!1:r.write(",\n"),r.write(JSON.stringify(e))}},f.loadLog=function(e,t){c.loadText(e,function(e,r){if(e)t(e,null);else{var n=null;try{var o="["+r+"]";n=JSON.parse(o);for(var i=0;i<n.length;i++)n[i].timestamp=u.createFromTimestamp(n[i].timestamp._timestamp)}catch(a){t(a,null)}t(null,n)}})},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-body/src/MotionLog.js","/release_modules/animation-utilities/node_modules/animation-body/src")},{_process:5,buffer:1,"ifr-core/src/FileTools":61,"ifr-core/src/Time":63}],38:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./BodyOutput"),c=function(e,t,r,n,o,i,a){u.call(this,e,t,r,o,i,a),this.commandSocket=new WebSocket(n)};c.prototype=Object.create(u.prototype),c.prototype.constructor=c,c.prototype.update=function(){var e=this.clock.currentTime(),t=this.computeTargetsForTime(e.add(this.reactionTime));if(null!==t&&this.commandSocket.readyState===WebSocket.OPEN){for(var r=0;r<this.dofNames.length;r++)t[r].enabled=this.enabledArray[r];var n=JSON.stringify(t);if(this.commandSocket.send(n),this.infoListeners.length>0&&this.motionInterface.isConnected())for(r=0;r<this.dofNames.length;r++)for(var o=this.motionInterface.getState(this.dofNames[r]),i={dofName:this.dofNames[r],timestamp:e,observedPosition:o.pos,targetPosition:t[r].position,observedVelocity:o.vel,commandVelocity:t[r].velocity},a=0;a<this.infoListeners.length;a++)this.infoListeners[a](i)}},c.prototype.isConnected=function(){return this.motionInterface.isConnected()&&this.commandSocket.readyState===WebSocket.OPEN},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-body/src/MotionServiceOutput.js","/release_modules/animation-utilities/node_modules/animation-body/src")},{"./BodyOutput":28,_process:5,buffer:1}],39:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("animation-animate/src/AnimateImpl"),c=require("animation-animate/src/timeline/MotionTimeline"),f=require("animation-animate/src/timeline/SimpleLayerCombiner"),d=require("animation-animate/src/timeline/ScaleSampleCombiner"),p=require("animation-animate/src/timeline/AddSampleCombiner"),m=require("animation-visualize/src/RendererOutput"),g=require("ifr-core/src/Clock"),y=require("ifr-core/src/TimerTools"),v=[],_=[],b=function(e,t,r){var n=y.setInterval(function(){for(var e=0;e<r.length;e++)r[e].update()},t);v.push(e),_.push(n)},w=function(e){var t=v.indexOf(e);t>-1&&(y.clearInterval(_[t]),v.splice(t,1),_.splice(t,1))},x={createTimeline:function(e,t,r){r=void 0!==r?r:20;var n=new f,o=new c("Motion Timeline",e,g,n,u.MODALITY_NAME);o.createLayer("default"),o.createLayer("lookat",[e.getDOFSet("BODY").getDOFs()[0]]),n.setSampleCombiner("lookat",new p),o.createLayer("posture",e.getDOFSet("BODY").plus("EYE_ROOT").plus("OVERLAY_ROOT").getDOFs()),n.setSampleCombiner("posture",new p),o.createLayer("beat",e.getDOFSet("BODY").plus("EYE_ROOT").plus("OVERLAY_ROOT").getDOFs()),n.setSampleCombiner("beat",new p);var i=e.getDOFSet("EYE_DEFORM").getDOFs();o.createLayer("blink",i);var a=new d(e.getKinematicInfo().getDefaultPose().getCopy(),null,i);n.setSampleCombiner("blink",a);var s=new m(g);s.setKinematicInfo(e.getKinematicInfo()),o.addOutput(s);var l=[o,s];return b(o,r,l),t&&t(o),o},connectRenderer:function(e,t){for(var r=e.getOutputs(),n=0;n<r.length;n++)if(r[n]instanceof m){r[n].addRenderer(t);break}},disconnectRenderer:function(e,t){for(var r=e.getOutputs(),n=0;n<r.length;n++)if(r[n]instanceof m){r[n].removeRenderer(t);break}},disposeTimeline:function(e,t){if(w(e),t===!0)for(var r=e.getOutputs(),n=0;n<r.length;n++)void 0!==r[n].dispose&&r[n].dispose()}};e.exports=x}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-macros/src/TimelineBuilder.js","/release_modules/animation-utilities/node_modules/animation-macros/src")},{_process:5,"animation-animate/src/AnimateImpl":7,"animation-animate/src/timeline/AddSampleCombiner":11,"animation-animate/src/timeline/MotionTimeline":20,"animation-animate/src/timeline/ScaleSampleCombiner":23,"animation-animate/src/timeline/SimpleLayerCombiner":24,"animation-visualize/src/RendererOutput":46,buffer:1,"ifr-core/src/Clock":60,"ifr-core/src/TimerTools":64}],40:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=u||{},c={REVISION:"70"};"object"==typeof e&&(e.exports=c),void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:e>0?1:0}),c.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},c.CullFaceNone=0,c.CullFaceBack=1,c.CullFaceFront=2,c.CullFaceFrontBack=3,c.FrontFaceDirectionCW=0,c.FrontFaceDirectionCCW=1,c.BasicShadowMap=0,c.PCFShadowMap=1,c.PCFSoftShadowMap=2,c.FrontSide=0,c.BackSide=1,c.DoubleSide=2,c.NoShading=0,c.FlatShading=1,c.SmoothShading=2,c.NoColors=0,c.FaceColors=1,c.VertexColors=2,c.NoBlending=0,c.NormalBlending=1,c.AdditiveBlending=2,c.SubtractiveBlending=3,c.MultiplyBlending=4,c.CustomBlending=5,c.AddEquation=100,c.SubtractEquation=101,c.ReverseSubtractEquation=102,c.MinEquation=103,c.MaxEquation=104,c.ZeroFactor=200,c.OneFactor=201,c.SrcColorFactor=202,c.OneMinusSrcColorFactor=203,c.SrcAlphaFactor=204,c.OneMinusSrcAlphaFactor=205,c.DstAlphaFactor=206,c.OneMinusDstAlphaFactor=207,c.DstColorFactor=208,c.OneMinusDstColorFactor=209,c.SrcAlphaSaturateFactor=210,c.MultiplyOperation=0,c.MixOperation=1,c.AddOperation=2,c.UVMapping=300,c.CubeReflectionMapping=301,c.CubeRefractionMapping=302,c.EquirectangularReflectionMapping=303,c.EquirectangularRefractionMapping=304,c.SphericalReflectionMapping=305,c.RepeatWrapping=1e3,c.ClampToEdgeWrapping=1001,c.MirroredRepeatWrapping=1002,c.NearestFilter=1003,c.NearestMipMapNearestFilter=1004,c.NearestMipMapLinearFilter=1005,c.LinearFilter=1006,c.LinearMipMapNearestFilter=1007,c.LinearMipMapLinearFilter=1008,c.UnsignedByteType=1009,c.ByteType=1010,c.ShortType=1011,c.UnsignedShortType=1012,c.IntType=1013,c.UnsignedIntType=1014,c.FloatType=1015,c.UnsignedShort4444Type=1016,c.UnsignedShort5551Type=1017,c.UnsignedShort565Type=1018,c.AlphaFormat=1019,c.RGBFormat=1020,c.RGBAFormat=1021,c.LuminanceFormat=1022,c.LuminanceAlphaFormat=1023,c.RGBEFormat=c.RGBAFormat,c.RGB_S3TC_DXT1_Format=2001,c.RGBA_S3TC_DXT1_Format=2002,c.RGBA_S3TC_DXT3_Format=2003,c.RGBA_S3TC_DXT5_Format=2004,c.RGB_PVRTC_4BPPV1_Format=2100,c.RGB_PVRTC_2BPPV1_Format=2101,c.RGBA_PVRTC_4BPPV1_Format=2102,c.RGBA_PVRTC_2BPPV1_Format=2103,c.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},c.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},c.Color=function(e){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(e)},c.Color.prototype={constructor:c.Color,r:1,g:1,b:1,set:function(e){return e instanceof c.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},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,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(e,t,r){if(0===t)this.r=this.g=this.b=r;else{var n=function(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?e+6*(t-e)*r:.5>r?t:2/3>r?e+6*(t-e)*(2/3-r):e},o=.5>=r?r*(1+t):r+t-r*t,i=2*r-o;this.r=n(i,o,e+1/3),this.g=n(i,o,e),this.b=n(i,o,e-1/3)}return this},setStyle:function(e){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(e)){var t=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(e);return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(e)){var t=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(e);return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(e)){var t=/^\#([0-9a-f]{6})$/i.exec(e);return this.setHex(parseInt(t[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(e)){var t=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(e);return this.setHex(parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3],16)),this}return/^(\w+)$/i.test(e)?(this.setHex(c.ColorKeywords[e]),this):void 0},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e){return this.r=e.r*e.r,this.g=e.g*e.g,this.b=e.b*e.b,this},copyLinearToGamma:function(e){return this.r=Math.sqrt(e.r),this.g=Math.sqrt(e.g),this.b=Math.sqrt(e.b),this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;return this.r=e*e,this.g=t*t,this.b=r*r,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){var t,r,n=e||{h:0,s:0,l:0},o=this.r,i=this.g,a=this.b,s=Math.max(o,i,a),l=Math.min(o,i,a),h=(l+s)/2;if(l===s)t=0,r=0;else{var u=s-l;switch(r=.5>=h?u/(s+l):u/(2-s-l),s){case o:t=(i-a)/u+(a>i?6:0);break;case i:t=(a-o)/u+2;break;case a:t=(o-i)/u+4}t/=6}return n.h=t,n.s=r,n.l=h,n},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){var n=this.getHSL();return n.h+=e,n.s+=t,n.l+=r,this.setHSL(n.h,n.s,n.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){return this.r=e[0],this.g=e[1],this.b=e[2],this},toArray:function(){return[this.r,this.g,this.b]},clone:function(){return(new c.Color).setRGB(this.r,this.g,this.b)}},c.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},c.Quaternion=function(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==n?n:1},c.Quaternion.prototype=Object.defineProperties({constructor:c.Quaternion,_x:0,_y:0,_z:0,_w:0,set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,this.onChangeCallback(),this},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(e instanceof c.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(e._x/2),n=Math.cos(e._y/2),o=Math.cos(e._z/2),i=Math.sin(e._x/2),a=Math.sin(e._y/2),s=Math.sin(e._z/2);return"XYZ"===e.order?(this._x=i*n*o+r*a*s,this._y=r*a*o-i*n*s,this._z=r*n*s+i*a*o,this._w=r*n*o-i*a*s):"YXZ"===e.order?(this._x=i*n*o+r*a*s,this._y=r*a*o-i*n*s,this._z=r*n*s-i*a*o,this._w=r*n*o+i*a*s):"ZXY"===e.order?(this._x=i*n*o-r*a*s,this._y=r*a*o+i*n*s,this._z=r*n*s+i*a*o,this._w=r*n*o-i*a*s):"ZYX"===e.order?(this._x=i*n*o-r*a*s,this._y=r*a*o+i*n*s,this._z=r*n*s-i*a*o,this._w=r*n*o+i*a*s):"YZX"===e.order?(this._x=i*n*o+r*a*s,this._y=r*a*o+i*n*s,this._z=r*n*s-i*a*o,this._w=r*n*o-i*a*s):"XZY"===e.order&&(this._x=i*n*o-r*a*s,this._y=r*a*o-i*n*s,this._z=r*n*s+i*a*o,this._w=r*n*o+i*a*s),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,n=Math.sin(r);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,n=r[0],o=r[4],i=r[8],a=r[1],s=r[5],l=r[9],h=r[2],u=r[6],c=r[10],f=n+s+c;return f>0?(t=.5/Math.sqrt(f+1),this._w=.25/t,this._x=(u-l)*t,this._y=(i-h)*t,this._z=(a-o)*t):n>s&&n>c?(t=2*Math.sqrt(1+n-s-c),this._w=(u-l)/t,this._x=.25*t,this._y=(o+a)/t,this._z=(i+h)/t):s>c?(t=2*Math.sqrt(1+s-n-c),this._w=(i-h)/t,this._x=(o+a)/t,this._y=.25*t,this._z=(l+u)/t):(t=2*Math.sqrt(1+c-n-s),this._w=(a-o)/t,this._x=(i+h)/t,this._y=(l+u)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,r=1e-6;return function(n,o){return void 0===e&&(e=new c.Vector3),t=n.dot(o)+1,r>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,o),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._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=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 r=e._x,n=e._y,o=e._z,i=e._w,a=t._x,s=t._y,l=t._z,h=t._w;return this._x=r*h+i*a+n*l-o*s,this._y=n*h+i*s+o*a-r*l,this._z=o*h+i*l+r*s-n*a,this._w=i*h-r*a-n*s-o*l,this.onChangeCallback(),this},multiplyVector3:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,n=this._y,o=this._z,i=this._w,a=i*e._w+r*e._x+n*e._y+o*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=i,this._x=r,this._y=n,this._z=o,this;var s=Math.acos(a),l=Math.sqrt(1-a*a);if(Math.abs(l)<.001)return this._w=.5*(i+this._w),this._x=.5*(r+this._x),this._y=.5*(n+this._y),this._z=.5*(o+this._z),this;var h=Math.sin((1-t)*s)/l,u=Math.sin(t*s)/l;return this._w=i*h+this._w*u,this._x=r*h+this._x*u,this._y=n*h+this._y*u,this._z=o*h+this._z*u,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(){},clone:function(){return new c.Quaternion(this._x,this._y,this._z,this._w)}},{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()},configurable:!0,enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()},configurable:!0,enumerable:!0},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()},configurable:!0,enumerable:!0},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()},configurable:!0,enumerable:!0}}),c.Quaternion.slerp=function(e,t,r,n){return r.copy(e).slerp(t,n)},c.Vector2=function(e,t){this.x=e||0,this.y=t||0},c.Vector2.prototype={constructor:c.Vector2,set:function(e,t){return this.x=e,this.y=t,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 new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},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)},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScalar:function(e){return this.x+=e,this.y+=e,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)},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 this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t}else this.x=0,this.y=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new c.Vector2,t=new c.Vector2),e.set(r,r),t.set(n,n),this.clamp(e,t)}}(),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?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)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,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,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this},clone:function(){return new c.Vector2(this.x,this.y)}},c.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},c.Vector3.prototype={constructor:c.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,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 new 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 new Error("index is out of range: "+e)}},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},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)},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 this.x*=e,this.y*=e,this.z*=e,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 t instanceof c.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new c.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,r){return void 0===e&&(e=new c.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,r)),this}}(),applyMatrix3:function(e){var t=this.x,r=this.y,n=this.z,o=e.elements;return this.x=o[0]*t+o[3]*r+o[6]*n,this.y=o[1]*t+o[4]*r+o[7]*n,this.z=o[2]*t+o[5]*r+o[8]*n,this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*n+o[12],this.y=o[1]*t+o[5]*r+o[9]*n+o[13],this.z=o[2]*t+o[6]*r+o[10]*n+o[14],this},applyProjection:function(e){var t=this.x,r=this.y,n=this.z,o=e.elements,i=1/(o[3]*t+o[7]*r+o[11]*n+o[15]);return this.x=(o[0]*t+o[4]*r+o[8]*n+o[12])*i,this.y=(o[1]*t+o[5]*r+o[9]*n+o[13])*i,this.z=(o[2]*t+o[6]*r+o[10]*n+o[14])*i,this},applyQuaternion:function(e){var t=this.x,r=this.y,n=this.z,o=e.x,i=e.y,a=e.z,s=e.w,l=s*t+i*n-a*r,h=s*r+a*t-o*n,u=s*n+o*r-i*t,c=-o*t-i*r-a*n;return this.x=l*s+c*-o+h*-a-u*-i,this.y=h*s+c*-i+u*-o-l*-a,this.z=u*s+c*-a+l*-i-h*-o,this},project:function(){var e;return function(t){return void 0===e&&(e=new c.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 c.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,r=this.y,n=this.z,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*n,this.y=o[1]*t+o[5]*r+o[9]*n,this.z=o[2]*t+o[6]*r+o[10]*n,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new c.Vector3,t=new c.Vector3),e.set(r,r,r),t.set(n,n,n),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},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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?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){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},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},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 r=this.x,n=this.y,o=this.z;return this.x=n*e.z-o*e.y,this.y=o*e.x-r*e.z,this.z=r*e.y-n*e.x,this},crossVectors:function(e,t){var r=e.x,n=e.y,o=e.z,i=t.x,a=t.y,s=t.z;return this.x=n*s-o*a,this.y=o*i-r*s,this.z=r*a-n*i,this},projectOnVector:function(){var e,t;return function(r){return void 0===e&&(e=new c.Vector3),e.copy(r).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new c.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new c.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/(this.length()*e.length());return Math.acos(c.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,n=this.z-e.z;return t*t+r*r+n*n},setEulerFromRotationMatrix:function(e,t){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(e,t){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),r=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),n=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=r,this.z=n,this},setFromMatrixColumn:function(e,t){var r=4*e,n=t.elements;return this.x=n[r],this.y=n[r+1],this.z=n[r+2],this},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,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this},clone:function(){return new c.Vector3(this.x,this.y,this.z)}},c.Vector4=function(e,t,r,n){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==n?n:1},c.Vector4.prototype={constructor:c.Vector4,set:function(e,t,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,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 new 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 new Error("index is out of range: "+e)}},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},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)},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 this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,o=this.w,i=e.elements;return this.x=i[0]*t+i[4]*r+i[8]*n+i[12]*o,this.y=i[1]*t+i[5]*r+i[9]*n+i[13]*o,this.z=i[2]*t+i[6]*r+i[10]*n+i[14]*o,this.w=i[3]*t+i[7]*r+i[11]*n+i[15]*o,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t,this.w*=t}else this.x=0,this.y=0,this.z=0,this.w=1;return this},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.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,n,o,i=.01,a=.1,s=e.elements,l=s[0],h=s[4],u=s[8],c=s[1],f=s[5],d=s[9],p=s[2],m=s[6],g=s[10];if(Math.abs(h-c)<i&&Math.abs(u-p)<i&&Math.abs(d-m)<i){if(Math.abs(h+c)<a&&Math.abs(u+p)<a&&Math.abs(d+m)<a&&Math.abs(l+f+g-3)<a)return this.set(1,0,0,0),this;t=Math.PI;var y=(l+1)/2,v=(f+1)/2,_=(g+1)/2,b=(h+c)/4,w=(u+p)/4,x=(d+m)/4;return y>v&&y>_?i>y?(r=0,n=.707106781,o=.707106781):(r=Math.sqrt(y),n=b/r,o=w/r):v>_?i>v?(r=.707106781,n=0,o=.707106781):(n=Math.sqrt(v),r=b/n,o=x/n):i>_?(r=.707106781,n=.707106781,o=0):(o=Math.sqrt(_),r=w/o,n=x/o),this.set(r,n,o,t),this}var T=Math.sqrt((m-d)*(m-d)+(u-p)*(u-p)+(c-h)*(c-h));return Math.abs(T)<.001&&(T=1),this.x=(m-d)/T,this.y=(u-p)/T,this.z=(c-h)/T,this.w=Math.acos((l+f+g-1)/2),this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this.w>e.w&&(this.w=e.w),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this.w<e.w&&(this.w=e.w),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this.w<e.w?this.w=e.w:this.w>t.w&&(this.w=t.w),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new c.Vector4,t=new c.Vector4),e.set(r,r,r,r),t.set(n,n,n,n),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?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){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},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},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,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this},clone:function(){return new c.Vector4(this.x,this.y,this.z,this.w)}},c.Euler=function(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._order=n||c.Euler.DefaultOrder},c.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],c.Euler.DefaultOrder="XYZ",c.Euler.prototype=Object.defineProperties({constructor:c.Euler,_x:0,_y:0,_z:0,_order:c.Euler.DefaultOrder,set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._order=n||this._order,this.onChangeCallback(),this},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,r){var n=c.Math.clamp,o=e.elements,i=o[0],a=o[4],s=o[8],l=o[1],h=o[5],u=o[9],f=o[2],d=o[6],p=o[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,h),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,h)):(this._y=Math.atan2(-f,i),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(l,i))):"ZYX"===t?(this._y=Math.asin(-n(f,-1,1)),Math.abs(f)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,i)):(this._x=0,this._z=Math.atan2(-a,h))):"YZX"===t?(this._z=Math.asin(n(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-f,i)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-n(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(d,h),this._y=Math.atan2(s,i)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,r!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,r,n){return void 0===e&&(e=new c.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,n),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new c.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(){return[this._x,this._y,this._z,this._order]},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new c.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new c.Euler(this._x,this._y,this._z,this._order)}},{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()},configurable:!0,enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()},configurable:!0,enumerable:!0},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()},configurable:!0,enumerable:!0},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()},configurable:!0,enumerable:!0}}),c.Line3=function(e,t){this.start=void 0!==e?e:new c.Vector3,this.end=void 0!==t?t:new c.Vector3},c.Line3.prototype={constructor:c.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){var t=e||new c.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new c.Vector3;return t.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 r=t||new c.Vector3;return this.delta(r).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new c.Vector3,t=new c.Vector3;return function(r,n){e.subVectors(r,this.start),t.subVectors(this.end,this.start);var o=t.dot(t),i=t.dot(e),a=i/o;return n&&(a=c.Math.clamp(a,0,1)),a}}(),closestPointToPoint:function(e,t,r){var n=this.closestPointToPointParameter(e,t),o=r||new c.Vector3;return this.delta(o).multiplyScalar(n).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)},clone:function(){return(new c.Line3).copy(this)}},c.Box2=function(e,t){this.min=void 0!==e?e:new c.Vector2(1/0,1/0),this.max=void 0!==t?t:new c.Vector2(-(1/0),-(1/0))},c.Box2.prototype={constructor:c.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new c.Vector2;return function(t,r){var n=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),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},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(e){var t=e||new c.Vector2;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new c.Vector2;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y?!1:!0},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?!0:!1},getParameter:function(e,t){var r=t||new c.Vector2;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y?!1:!0},clampPoint:function(e,t){var r=t||new c.Vector2;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new c.Vector2;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.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)},clone:function(){return(new c.Box2).copy(this)}},c.Box3=function(e,t){this.min=void 0!==e?e:new c.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new c.Vector3(-(1/0),-(1/0),-(1/0))},c.Box3.prototype={constructor:c.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new c.Vector3;return function(t,r){var n=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),setFromObject:function(){var e=new c.Vector3;return function(t){var r=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var n=t.geometry;if(void 0!==n)if(n instanceof c.Geometry)for(var o=n.vertices,i=0,a=o.length;a>i;i++)e.copy(o[i]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e);else if(n instanceof c.BufferGeometry&&void 0!==n.attributes.position)for(var s=n.attributes.position.array,i=0,a=s.length;a>i;i+=3)e.set(s[i],s[i+1],s[i+2]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e)}),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},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(e){var t=e||new c.Vector3;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new c.Vector3;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z?!1:!0},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?!0:!1},getParameter:function(e,t){var r=t||new c.Vector3;return r.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))},isIntersectionBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z?!1:!0},clampPoint:function(e,t){var r=t||new c.Vector3;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new c.Vector3;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),getBoundingSphere:function(){var e=new c.Vector3;return function(t){var r=t||new c.Sphere;return r.center=this.center(),r.radius=.5*this.size(e).length(),r}}(),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},applyMatrix4:function(){var e=[new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3];return function(t){return 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.makeEmpty(),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)},clone:function(){return(new c.Box3).copy(this)}},c.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},c.Matrix3.prototype={constructor:c.Matrix3,set:function(e,t,r,n,o,i,a,s,l){var h=this.elements;return h[0]=e,h[3]=t,h[6]=r,h[1]=n,h[4]=o,h[7]=i,h[2]=a,h[5]=s,h[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e=new c.Vector3;return function(t,r,n){void 0===r&&(r=0),void 0===n&&(n=t.length);for(var o=0,i=r;n>o;o+=3,i+=3)e.x=t[i],e.y=t[i+1],e.z=t[i+2],e.applyMatrix3(this),t[i]=e.x,t[i+1]=e.y,t[i+2]=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],r=e[1],n=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],h=e[8];return t*i*h-t*a*l-r*o*h+r*a*s+n*o*l-n*i*s},getInverse:function(e,t){var r=e.elements,n=this.elements;n[0]=r[10]*r[5]-r[6]*r[9],n[1]=-r[10]*r[1]+r[2]*r[9],n[2]=r[6]*r[1]-r[2]*r[5],n[3]=-r[10]*r[4]+r[6]*r[8],n[4]=r[10]*r[0]-r[2]*r[8],n[5]=-r[6]*r[0]+r[2]*r[4],n[6]=r[9]*r[4]-r[5]*r[8],n[7]=-r[9]*r[0]+r[1]*r[8],n[8]=r[5]*r[0]-r[1]*r[4];var o=r[0]*n[0]+r[1]*n[3]+r[2]*n[6];if(0===o){var i="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(i);return console.warn(i),this.identity(),this}return this.multiplyScalar(1/o),this},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){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},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(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},clone:function(){return(new c.Matrix3).fromArray(this.elements)}},c.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},c.Matrix4.prototype={constructor:c.Matrix4,set:function(e,t,r,n,o,i,a,s,l,h,u,c,f,d,p,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=r,g[12]=n,g[1]=o,g[5]=i,g[9]=a,g[13]=s,g[2]=l,g[6]=h,g[10]=u,g[14]=c,g[3]=f,g[7]=d,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},copyPosition:function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},extractBasis:function(e,t,r){var n=this.elements;return e.set(n[0],n[1],n[2]),t.set(n[4],n[5],n[6]),r.set(n[8],n[9],n[10]),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(){var e=new c.Vector3;return function(t){var r=this.elements,n=t.elements,o=1/e.set(n[0],n[1],n[2]).length(),i=1/e.set(n[4],n[5],n[6]).length(),a=1/e.set(n[8],n[9],n[10]).length();return r[0]=n[0]*o,r[1]=n[1]*o,r[2]=n[2]*o,r[4]=n[4]*i,r[5]=n[5]*i,r[6]=n[6]*i,r[8]=n[8]*a,r[9]=n[9]*a,r[10]=n[10]*a,this}}(),makeRotationFromEuler:function(e){e instanceof c.Euler==!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,n=e.y,o=e.z,i=Math.cos(r),a=Math.sin(r),s=Math.cos(n),l=Math.sin(n),h=Math.cos(o),u=Math.sin(o);if("XYZ"===e.order){var f=i*h,d=i*u,p=a*h,m=a*u;t[0]=s*h,t[4]=-s*u,t[8]=l,t[1]=d+p*l,t[5]=f-m*l,t[9]=-a*s,t[2]=m-f*l,t[6]=p+d*l,t[10]=i*s}else if("YXZ"===e.order){var g=s*h,y=s*u,v=l*h,_=l*u;t[0]=g+_*a,t[4]=v*a-y,t[8]=i*l,t[1]=i*u,t[5]=i*h,t[9]=-a,t[2]=y*a-v,t[6]=_+g*a,t[10]=i*s}else if("ZXY"===e.order){var g=s*h,y=s*u,v=l*h,_=l*u;t[0]=g-_*a,t[4]=-i*u,t[8]=v+y*a,t[1]=y+v*a,t[5]=i*h,t[9]=_-g*a,t[2]=-i*l,t[6]=a,t[10]=i*s}else if("ZYX"===e.order){var f=i*h,d=i*u,p=a*h,m=a*u;t[0]=s*h,t[4]=p*l-d,t[8]=f*l+m,t[1]=s*u,t[5]=m*l+f,t[9]=d*l-p,t[2]=-l,t[6]=a*s,t[10]=i*s}else if("YZX"===e.order){var b=i*s,w=i*l,x=a*s,T=a*l;t[0]=s*h,t[4]=T-b*u,t[8]=x*u+w,t[1]=u,t[5]=i*h,t[9]=-a*h,t[2]=-l*h,t[6]=w*u+x,t[10]=b-T*u}else if("XZY"===e.order){var b=i*s,w=i*l,x=a*s,T=a*l;t[0]=s*h,t[4]=-u,t[8]=l*h,t[1]=b*u+T,t[5]=i*h,t[9]=w*u-x,t[2]=x*u-w,t[6]=a*h,t[10]=T*u+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},makeRotationFromQuaternion:function(e){var t=this.elements,r=e.x,n=e.y,o=e.z,i=e.w,a=r+r,s=n+n,l=o+o,h=r*a,u=r*s,c=r*l,f=n*s,d=n*l,p=o*l,m=i*a,g=i*s,y=i*l;return t[0]=1-(f+p),t[4]=u-y,t[8]=c+g,t[1]=u+y,t[5]=1-(h+p),t[9]=d-m,t[2]=c-g,t[6]=d+m,t[10]=1-(h+f),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e=new c.Vector3,t=new c.Vector3,r=new c.Vector3;return function(n,o,i){var a=this.elements;return r.subVectors(n,o).normalize(),0===r.length()&&(r.z=1),e.crossVectors(i,r).normalize(),0===e.length()&&(r.x+=1e-4,e.crossVectors(i,r).normalize()),t.crossVectors(r,e),a[0]=e.x,a[4]=t.x,a[8]=r.x,a[1]=e.y,a[5]=t.y,a[9]=r.y,a[2]=e.z,a[6]=t.z,a[10]=r.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements,o=this.elements,i=r[0],a=r[4],s=r[8],l=r[12],h=r[1],u=r[5],c=r[9],f=r[13],d=r[2],p=r[6],m=r[10],g=r[14],y=r[3],v=r[7],_=r[11],b=r[15],w=n[0],x=n[4],T=n[8],M=n[12],S=n[1],C=n[5],E=n[9],A=n[13],L=n[2],P=n[6],F=n[10],D=n[14],R=n[3],O=n[7],k=n[11],N=n[15];return o[0]=i*w+a*S+s*L+l*R,o[4]=i*x+a*C+s*P+l*O,o[8]=i*T+a*E+s*F+l*k,o[12]=i*M+a*A+s*D+l*N,o[1]=h*w+u*S+c*L+f*R,o[5]=h*x+u*C+c*P+f*O,o[9]=h*T+u*E+c*F+f*k,o[13]=h*M+u*A+c*D+f*N,o[2]=d*w+p*S+m*L+g*R,o[6]=d*x+p*C+m*P+g*O,o[10]=d*T+p*E+m*F+g*k,o[14]=d*M+p*A+m*D+g*N,o[3]=y*w+v*S+_*L+b*R,o[7]=y*x+v*C+_*P+b*O,o[11]=y*T+v*E+_*F+b*k,o[15]=y*M+v*A+_*D+b*N,this},multiplyToArray:function(e,t,r){var n=this.elements;return this.multiplyMatrices(e,t),r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],r[4]=n[4],r[5]=n[5],r[6]=n[6],r[7]=n[7],r[8]=n[8],r[9]=n[9],r[10]=n[10],r[11]=n[11],r[12]=n[12],r[13]=n[13],r[14]=n[14],r[15]=n[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e=new c.Vector3;return function(t,r,n){void 0===r&&(r=0),void 0===n&&(n=t.length);for(var o=0,i=r;n>o;o+=3,i+=3)e.x=t[i],e.y=t[i+1],e.z=t[i+2],e.applyMatrix4(this),t[i]=e.x,t[i+1]=e.y,t[i+2]=e.z;return t}}(),rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},determinant:function(){var e=this.elements,t=e[0],r=e[4],n=e[8],o=e[12],i=e[1],a=e[5],s=e[9],l=e[13],h=e[2],u=e[6],c=e[10],f=e[14],d=e[3],p=e[7],m=e[11],g=e[15];return d*(+o*s*u-n*l*u-o*a*c+r*l*c+n*a*f-r*s*f)+p*(+t*s*f-t*l*c+o*i*c-n*i*f+n*l*h-o*s*h)+m*(+t*l*u-t*a*f-o*i*u+r*i*f+o*a*h-r*l*h)+g*(-n*a*h-t*s*u+t*a*c+n*i*u-r*i*c+r*s*h)},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){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e},getPosition:function(){var e=new c.Vector3;return function(){console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[14])}}(),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 r=this.elements,n=e.elements,o=n[0],i=n[4],a=n[8],s=n[12],l=n[1],h=n[5],u=n[9],c=n[13],f=n[2],d=n[6],p=n[10],m=n[14],g=n[3],y=n[7],v=n[11],_=n[15];r[0]=u*m*y-c*p*y+c*d*v-h*m*v-u*d*_+h*p*_,r[4]=s*p*y-a*m*y-s*d*v+i*m*v+a*d*_-i*p*_,r[8]=a*c*y-s*u*y+s*h*v-i*c*v-a*h*_+i*u*_,r[12]=s*u*d-a*c*d-s*h*p+i*c*p+a*h*m-i*u*m,r[1]=c*p*g-u*m*g-c*f*v+l*m*v+u*f*_-l*p*_,r[5]=a*m*g-s*p*g+s*f*v-o*m*v-a*f*_+o*p*_,r[9]=s*u*g-a*c*g-s*l*v+o*c*v+a*l*_-o*u*_,r[13]=a*c*f-s*u*f+s*l*p-o*c*p-a*l*m+o*u*m,r[2]=h*m*g-c*d*g+c*f*y-l*m*y-h*f*_+l*d*_,r[6]=s*d*g-i*m*g-s*f*y+o*m*y+i*f*_-o*d*_,r[10]=i*c*g-s*h*g+s*l*y-o*c*y-i*l*_+o*h*_,r[14]=s*h*f-i*c*f-s*l*d+o*c*d+i*l*m-o*h*m,r[3]=u*d*g-h*p*g-u*f*y+l*p*y+h*f*v-l*d*v,r[7]=i*p*g-a*d*g+a*f*y-o*p*y-i*f*v+o*d*v,r[11]=a*h*g-i*u*g-a*l*y+o*u*y+i*l*v-o*h*v,r[15]=i*u*f-a*h*f+a*l*d-o*u*d-i*l*p+o*h*p;var b=o*r[0]+l*r[4]+f*r[8]+g*r[12];if(0==b){var w="Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(w);return console.warn(w),this.identity(),this}return this.multiplyScalar(1/b),this},translate:function(e){console.warn("THREE.Matrix4: .translate() has been removed.")},rotateX:function(e){console.warn("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(e){console.warn("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(e){console.warn("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(e,t){console.warn("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(e){var t=this.elements,r=e.x,n=e.y,o=e.z;return t[0]*=r,t[4]*=n,t[8]*=o,t[1]*=r,t[5]*=n,t[9]*=o,t[2]*=r,t[6]*=n,t[10]*=o,t[3]*=r,t[7]*=n,t[11]*=o,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(r,n)))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),n=Math.sin(t),o=1-r,i=e.x,a=e.y,s=e.z,l=o*i,h=o*a;return this.set(l*i+r,l*a-n*s,l*s+n*a,0,l*a+n*s,h*a+r,h*s-n*i,0,l*s-n*a,h*s+n*i,o*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},compose:function(e,t,r){return this.makeRotationFromQuaternion(t),this.scale(r),this.setPosition(e),this},decompose:function(){var e=new c.Vector3,t=new c.Matrix4;return function(r,n,o){var i=this.elements,a=e.set(i[0],i[1],i[2]).length(),s=e.set(i[4],i[5],i[6]).length(),l=e.set(i[8],i[9],i[10]).length(),h=this.determinant();0>h&&(a=-a),r.x=i[12],r.y=i[13],r.z=i[14],t.elements.set(this.elements);var u=1/a,c=1/s,f=1/l;return t.elements[0]*=u,t.elements[1]*=u,t.elements[2]*=u,t.elements[4]*=c,t.elements[5]*=c,t.elements[6]*=c,t.elements[8]*=f,t.elements[9]*=f,t.elements[10]*=f,n.setFromRotationMatrix(t),o.x=a,o.y=s,o.z=l,this}}(),makeFrustum:function(e,t,r,n,o,i){var a=this.elements,s=2*o/(t-e),l=2*o/(n-r),h=(t+e)/(t-e),u=(n+r)/(n-r),c=-(i+o)/(i-o),f=-2*i*o/(i-o);return a[0]=s,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=c,a[14]=f,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(e,t,r,n){var o=r*Math.tan(c.Math.degToRad(.5*e)),i=-o,a=i*t,s=o*t;return this.makeFrustum(a,s,i,o,r,n)},makeOrthographic:function(e,t,r,n,o,i){var a=this.elements,s=t-e,l=r-n,h=i-o,u=(t+e)/s,c=(r+n)/l,f=(i+o)/h;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2/l,a[9]=0,a[13]=-c,a[2]=0,a[6]=0,a[10]=-2/h,a[14]=-f,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},clone:function(){return(new c.Matrix4).fromArray(this.elements)}},c.Ray=function(e,t){this.origin=void 0!==e?e:new c.Vector3,this.direction=void 0!==t?t:new c.Vector3},c.Ray.prototype={constructor:c.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var r=t||new c.Vector3;return r.copy(this.direction).multiplyScalar(e).add(this.origin)},recast:function(){var e=new c.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var r=t||new c.Vector3;r.subVectors(e,this.origin);var n=r.dot(this.direction);return 0>n?r.copy(this.origin):r.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(){var e=new c.Vector3;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return 0>r?this.origin.distanceTo(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceTo(t))}}(),distanceSqToSegment:function(){var e=new c.Vector3,t=new c.Vector3,r=new c.Vector3;return function(n,o,i,a){e.copy(n).add(o).multiplyScalar(.5),t.copy(o).sub(n).normalize(),r.copy(this.origin).sub(e);var s,l,h,u,c=.5*n.distanceTo(o),f=-this.direction.dot(t),d=r.dot(this.direction),p=-r.dot(t),m=r.lengthSq(),g=Math.abs(1-f*f);if(g>0)if(s=f*p-d,l=f*d-p,u=c*g,s>=0)if(l>=-u)if(u>=l){var y=1/g;s*=y,l*=y,h=s*(s+f*l+2*d)+l*(f*s+l+2*p)+m}else l=c,s=Math.max(0,-(f*l+d)),h=-s*s+l*(l+2*p)+m;else l=-c,s=Math.max(0,-(f*l+d)),h=-s*s+l*(l+2*p)+m;else-u>=l?(s=Math.max(0,-(-f*c+d)),l=s>0?-c:Math.min(Math.max(-c,-p),c),h=-s*s+l*(l+2*p)+m):u>=l?(s=0,l=Math.min(Math.max(-c,-p),c),h=l*(l+2*p)+m):(s=Math.max(0,-(f*c+d)),l=s>0?c:Math.min(Math.max(-c,-p),c),h=-s*s+l*(l+2*p)+m);else l=f>0?-c:c,s=Math.max(0,-(f*l+d)),h=-s*s+l*(l+2*p)+m;return i&&i.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(l).add(e),h}}(),isIntersectionSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},intersectSphere:function(){var e=new c.Vector3;return function(t,r){e.subVectors(t.center,this.origin);var n=e.dot(this.direction),o=e.dot(e)-n*n,i=t.radius*t.radius;if(o>i)return null;var a=Math.sqrt(i-o),s=n-a,l=n+a;return 0>s&&0>l?null:0>s?this.at(l,r):this.at(s,r)}}(),isIntersectionPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var r=e.normal.dot(this.direction);return 0>r*t?!0:!1},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0==t)return 0==e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},isIntersectionBox:function(){var e=new c.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectBox:function(e,t){var r,n,o,i,a,s,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,c=this.origin;return l>=0?(r=(e.min.x-c.x)*l,n=(e.max.x-c.x)*l):(r=(e.max.x-c.x)*l,n=(e.min.x-c.x)*l),h>=0?(o=(e.min.y-c.y)*h,i=(e.max.y-c.y)*h):(o=(e.max.y-c.y)*h,i=(e.min.y-c.y)*h),r>i||o>n?null:((o>r||r!==r)&&(r=o),(n>i||n!==n)&&(n=i),u>=0?(a=(e.min.z-c.z)*u,s=(e.max.z-c.z)*u):(a=(e.max.z-c.z)*u,s=(e.min.z-c.z)*u),r>s||a>n?null:((a>r||r!==r)&&(r=a),(n>s||n!==n)&&(n=s),0>n?null:this.at(r>=0?r:n,t)))},intersectTriangle:function(){var e=new c.Vector3,t=new c.Vector3,r=new c.Vector3,n=new c.Vector3;return function(o,i,a,s,l){t.subVectors(i,o),r.subVectors(a,o),n.crossVectors(t,r);var h,u=this.direction.dot(n);if(u>0){if(s)return null;h=1}else{if(!(0>u))return null;h=-1,u=-u}e.subVectors(this.origin,o);var c=h*this.direction.dot(r.crossVectors(e,r));if(0>c)return null;var f=h*this.direction.dot(t.cross(e));if(0>f)return null;if(c+f>u)return null;var d=-h*e.dot(n);return 0>d?null:this.at(d/u,l)}}(),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)},clone:function(){return(new c.Ray).copy(this)}},c.Sphere=function(e,t){this.center=void 0!==e?e:new c.Vector3,this.radius=void 0!==t?t:0},c.Sphere.prototype={constructor:c.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new c.Box3;return function(t,r){var n=this.center;void 0!==r?n.copy(r):e.setFromPoints(t).center(n);for(var o=0,i=0,a=t.length;a>i;i++)o=Math.max(o,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(o),this}}(),copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},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},clampPoint:function(e,t){var r=this.center.distanceToSquared(e),n=t||new c.Vector3;return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(e){var t=e||new c.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=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},clone:function(){return(new c.Sphere).copy(this)}},c.Frustum=function(e,t,r,n,o,i){this.planes=[void 0!==e?e:new c.Plane,void 0!==t?t:new c.Plane,void 0!==r?r:new c.Plane,void 0!==n?n:new c.Plane,void 0!==o?o:new c.Plane,void 0!==i?i:new c.Plane]},c.Frustum.prototype={constructor:c.Frustum,set:function(e,t,r,n,o,i){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(n),a[4].copy(o),a[5].copy(i),this},copy:function(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements,n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],l=r[5],h=r[6],u=r[7],c=r[8],f=r[9],d=r[10],p=r[11],m=r[12],g=r[13],y=r[14],v=r[15];return t[0].setComponents(a-n,u-s,p-c,v-m).normalize(),t[1].setComponents(a+n,u+s,p+c,v+m).normalize(),t[2].setComponents(a+o,u+l,p+f,v+g).normalize(),t[3].setComponents(a-o,u-l,p-f,v-g).normalize(),t[4].setComponents(a-i,u-h,p-d,v-y).normalize(),t[5].setComponents(a+i,u+h,p+d,v+y).normalize(),this},intersectsObject:function(){var e=new c.Sphere;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,r=e.center,n=-e.radius,o=0;6>o;o++){var i=t[o].distanceToPoint(r);if(n>i)return!1}return!0},intersectsBox:function(){var e=new c.Vector3,t=new c.Vector3;return function(r){for(var n=this.planes,o=0;6>o;o++){var i=n[o];e.x=i.normal.x>0?r.min.x:r.max.x,t.x=i.normal.x>0?r.max.x:r.min.x,e.y=i.normal.y>0?r.min.y:r.max.y,t.y=i.normal.y>0?r.max.y:r.min.y,e.z=i.normal.z>0?r.min.z:r.max.z,t.z=i.normal.z>0?r.max.z:r.min.z;var a=i.distanceToPoint(e),s=i.distanceToPoint(t);if(0>a&&0>s)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0},clone:function(){return(new c.Frustum).copy(this)}},c.Plane=function(e,t){this.normal=void 0!==e?e:new c.Vector3(1,0,0),this.constant=void 0!==t?t:0},c.Plane.prototype={constructor:c.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,n){return this.normal.set(e,t,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new c.Vector3,t=new c.Vector3;return function(r,n,o){var i=e.subVectors(o,n).cross(t.subVectors(r,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,r),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 r=this.distanceToPoint(e),n=t||new c.Vector3;return n.copy(this.normal).multiplyScalar(r)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return 0>t&&r>0||0>r&&t>0},intersectLine:function(){var e=new c.Vector3;return function(t,r){var n=r||new c.Vector3,o=t.delta(e),i=this.normal.dot(o);if(0!=i){var a=-(t.start.dot(this.normal)+this.constant)/i;if(!(0>a||a>1))return n.copy(o).multiplyScalar(a).add(t.start)}else if(0==this.distanceToPoint(t.start))return n.copy(t.start)}}(),coplanarPoint:function(e){var t=e||new c.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new c.Vector3,t=new c.Vector3,r=new c.Matrix3;return function(n,o){var i=o||r.getNormalMatrix(n),a=e.copy(this.normal).applyMatrix3(i),s=this.coplanarPoint(t);return s.applyMatrix4(n),this.setFromNormalAndCoplanarPoint(a,s),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant==this.constant},clone:function(){return(new c.Plane).copy(this)}},c.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),n=0;return function(){for(var o=0;36>o;o++)8==o||13==o||18==o||23==o?r[o]="-":14==o?r[o]="4":(2>=n&&(n=33554432+16777216*Math.random()|0),e=15&n,n>>=4,r[o]=t[19==o?3&e|8:e]);return r.join("")}}(),clamp:function(e,t,r){return t>e?t:e>r?r:e},clampBottom:function(e,t){return t>e?t:e},mapLinear:function(e,t,r,n,o){return n+(e-t)*(o-n)/(r-t)},smoothstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))},smootherstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return Math.floor(this.randFloat(e,t))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e}},c.Spline=function(e){function t(e,t,r,n,o,i,a){var s=.5*(r-e),l=.5*(n-t);return(2*(t-r)+s+l)*a+(-3*(t-r)-2*s-l)*i+s*o+t}this.points=e;var r,n,o,i,a,s,l,h,u,f=[],d={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return r=(this.points.length-1)*e,n=Math.floor(r),o=r-n,f[0]=0===n?n:n-1,f[1]=n,f[2]=n>this.points.length-2?this.points.length-1:n+1,f[3]=n>this.points.length-3?this.points.length-1:n+2,s=this.points[f[0]],l=this.points[f[1]],h=this.points[f[2]],u=this.points[f[3]],i=o*o,a=o*i,d.x=t(s.x,l.x,h.x,u.x,o,i,a),d.y=t(s.y,l.y,h.y,u.y,o,i,a),d.z=t(s.z,l.z,h.z,u.z,o,i,a),d},this.getControlPointsArray=function(){var e,t,r=this.points.length,n=[];for(e=0;r>e;e++)t=this.points[e],n[e]=[t.x,t.y,t.z];return n},this.getLength=function(e){var t,r,n,o,i=0,a=0,s=0,l=new c.Vector3,h=new c.Vector3,u=[],f=0;for(u[0]=0,e||(e=100),n=this.points.length*e,l.copy(this.points[0]),t=1;n>t;t++)r=t/n,o=this.getPoint(r),h.copy(o),f+=h.distanceTo(l),l.copy(o),i=(this.points.length-1)*r,a=Math.floor(i),a!=s&&(u[a]=f,s=a);return u[u.length]=f,{chunks:u,total:f}},this.reparametrizeByArcLength=function(e){var t,r,n,o,i,a,s,l,h=[],u=new c.Vector3,f=this.getLength();for(h.push(u.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(a=f.chunks[t]-f.chunks[t-1],s=Math.ceil(e*a/f.total),o=(t-1)/(this.points.length-1),i=t/(this.points.length-1),r=1;s-1>r;r++)n=o+r*(1/s)*(i-o),l=this.getPoint(n),h.push(u.copy(l).clone());h.push(u.copy(this.points[t]).clone())}this.points=h}},c.Triangle=function(e,t,r){this.a=void 0!==e?e:new c.Vector3,this.b=void 0!==t?t:new c.Vector3,this.c=void 0!==r?r:new c.Vector3},c.Triangle.normal=function(){var e=new c.Vector3;return function(t,r,n,o){var i=o||new c.Vector3;i.subVectors(n,r),e.subVectors(t,r),i.cross(e);var a=i.lengthSq();return a>0?i.multiplyScalar(1/Math.sqrt(a)):i.set(0,0,0)}}(),c.Triangle.barycoordFromPoint=function(){var e=new c.Vector3,t=new c.Vector3,r=new c.Vector3;return function(n,o,i,a,s){e.subVectors(a,o),t.subVectors(i,o),r.subVectors(n,o);var l=e.dot(e),h=e.dot(t),u=e.dot(r),f=t.dot(t),d=t.dot(r),p=l*f-h*h,m=s||new c.Vector3;if(0==p)return m.set(-2,-1,-1);var g=1/p,y=(f*u-h*d)*g,v=(l*d-h*u)*g;return m.set(1-y-v,v,y)}}(),c.Triangle.containsPoint=function(){var e=new c.Vector3;return function(t,r,n,o){var i=c.Triangle.barycoordFromPoint(t,r,n,o,e);return i.x>=0&&i.y>=0&&i.x+i.y<=1}}(),c.Triangle.prototype={constructor:c.Triangle,set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,n){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[n]),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 c.Vector3,t=new c.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new c.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return c.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new c.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return c.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return c.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)},clone:function(){return(new c.Triangle).copy(this)}},c.Clock=function(e){this.autoStart=void 0!==e?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},c.Clock.prototype={constructor:c.Clock,start:function(){this.startTime=void 0!==u.performance&&void 0!==u.performance.now?u.performance.now():Date.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=void 0!==u.performance&&void 0!==u.performance.now?u.performance.now():Date.now();e=.001*(t-this.oldTime),this.oldTime=t,this.elapsedTime+=e}return e}},c.EventDispatcher=function(){},c.EventDispatcher.prototype={constructor:c.EventDispatcher,apply:function(e){e.addEventListener=c.EventDispatcher.prototype.addEventListener,e.hasEventListener=c.EventDispatcher.prototype.hasEventListener,e.removeEventListener=c.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=c.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)?!0:!1},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners,n=r[e];if(void 0!==n){var o=n.indexOf(t);-1!==o&&n.splice(o,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,r=t[e.type];if(void 0!==r){e.target=this;for(var n=[],o=r.length,i=0;o>i;i++)n[i]=r[i];for(var i=0;o>i;i++)n[i].call(this,e)}}}},function(e){e.Raycaster=function(t,r,n,o){this.ray=new e.Ray(t,r),this.near=n||0,this.far=o||1/0,this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var t=function(e,t){return e.distance-t.distance},r=function(e){var t=function(t,r,n,o){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e,t,n,o){if(e.raycast(t,n),o===!0)for(var i=e.children,a=0,s=i.length;s>a;a++)r(i[a],t,n,!0)});e.Raycaster.prototype={constructor:e.Raycaster,precision:1e-4,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.copy(r.position),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(r.position).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e){var t=function(t,r){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e,n){var o=[];return r(e,this,o,n),o.sort(t),o}),intersectObjects:function(e,n){var o=[];if(e instanceof Array==!1)return console.log("THREE.Raycaster.intersectObjects: objects is not an Array."),o;for(var i=0,a=e.length;a>i;i++)r(e[i],this,o,n);return o.sort(t),o}}}(c),c.Object3D=function(){Object.defineProperty(this,"id",{value:c.Object3DIdCount++}),this.uuid=c.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=void 0,this.children=[],this.up=c.Object3D.DefaultUp.clone();var e=new c.Vector3,t=new c.Euler,r=new c.Quaternion,n=new c.Vector3(1,1,1),o=function(){r.setFromEuler(t,!1)},i=function(){t.setFromQuaternion(r,void 0,!1)};t.onChange(o),r.onChange(i),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:n}}),this.rotationAutoUpdate=!0,this.matrix=new c.Matrix4,this.matrixWorld=new c.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.userData={}},c.Object3D.DefaultUp=new c.Vector3(0,1,0),c.Object3D.prototype=Object.defineProperties({constructor:c.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 c.Quaternion;return function(t,r){return e.setFromAxisAngle(t,r),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new c.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new c.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new c.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new c.Vector3;return function(t,r){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(r)),this}}(),translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},translateX:function(){var e=new c.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new c.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new c.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 c.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new c.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add:",e,"can't be added as a child of itself."),this):(e instanceof c.Object3D?(void 0!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add:",e,"is not an instance of THREE.Object3D."),this)},remove:function(e){if(arguments.length>1)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var r=this.children.indexOf(e);-1!==r&&(e.parent=void 0,e.dispatchEvent({type:"removed"}),this.children.splice(r,1))},getChildByName:function(e,t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e,t)},getObjectById:function(e,t){return this.getObjectByProperty("id",e,t)},getObjectByName:function(e,t){return this.getObjectByProperty("name",e,t)},getObjectByProperty:function(e,t,r){if(this[e]===t)return this;for(var n=0,o=this.children.length;o>n;n++){var i=this.children[n],a=i.getObjectByProperty(e,t,r);if(void 0!==a)return a}},getWorldPosition:function(e){var t=e||new c.Vector3;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new c.Vector3,t=new c.Vector3;return function(r){var n=r||new c.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,n,t),n}}(),getWorldRotation:function(){var e=new c.Quaternion;return function(t){var r=t||new c.Euler;return this.getWorldQuaternion(e),r.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new c.Vector3,t=new c.Quaternion;return function(r){var n=r||new c.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,n),n}}(),getWorldDirection:function(){var e=new c.Quaternion;return function(t){var r=t||new c.Vector3;return this.getWorldQuaternion(e),r.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=0,r=this.children.length;r>t;t++)this.children[t].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=0,r=this.children.length;r>t;t++)this.children[t].traverseVisible(e)}},traverseAncestors:function(e){this.parent&&(e(this.parent),this.parent.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||e===!0)&&(void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,r=this.children.length;r>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(){var e={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},t={},r=function(r){if(void 0===e.geometries&&(e.geometries=[]),void 0===t[r.uuid]){var n=r.toJSON();delete n.metadata,t[r.uuid]=n,e.geometries.push(n)}return r.uuid},n={},o=function(t){if(void 0===e.materials&&(e.materials=[]),void 0===n[t.uuid]){var r=t.toJSON();delete r.metadata,n[t.uuid]=r,e.materials.push(r)}return t.uuid},i=function(e){var t=function(t){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e){var t={};if(t.uuid=e.uuid,t.type=e.type,""!==e.name&&(t.name=e.name),"{}"!==JSON.stringify(e.userData)&&(t.userData=e.userData),e.visible!==!0&&(t.visible=e.visible),e instanceof c.PerspectiveCamera?(t.fov=e.fov,t.aspect=e.aspect,t.near=e.near,t.far=e.far):e instanceof c.OrthographicCamera?(t.left=e.left,t.right=e.right,t.top=e.top,t.bottom=e.bottom,t.near=e.near,t.far=e.far):e instanceof c.AmbientLight?t.color=e.color.getHex():e instanceof c.DirectionalLight?(t.color=e.color.getHex(),t.intensity=e.intensity):e instanceof c.PointLight?(t.color=e.color.getHex(),t.intensity=e.intensity,t.distance=e.distance):e instanceof c.SpotLight?(t.color=e.color.getHex(),t.intensity=e.intensity,t.distance=e.distance,t.angle=e.angle,t.exponent=e.exponent):e instanceof c.HemisphereLight?(t.color=e.color.getHex(),t.groundColor=e.groundColor.getHex()):e instanceof c.Mesh?(t.geometry=r(e.geometry),t.material=o(e.material)):e instanceof c.Line?(t.geometry=r(e.geometry),t.material=o(e.material)):e instanceof c.Sprite&&(t.material=o(e.material)),t.matrix=e.matrix.toArray(),e.children.length>0){t.children=[];for(var n=0;n<e.children.length;n++)t.children.push(i(e.children[n]))}return t});return e.object=i(this),e},clone:function(e,t){if(void 0===e&&(e=new c.Object3D),void 0===t&&(t=!0),e.name=this.name,e.up.copy(this.up),e.position.copy(this.position),e.quaternion.copy(this.quaternion),e.scale.copy(this.scale),e.rotationAutoUpdate=this.rotationAutoUpdate,e.matrix.copy(this.matrix),e.matrixWorld.copy(this.matrixWorld),e.matrixAutoUpdate=this.matrixAutoUpdate,e.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate,e.visible=this.visible,e.castShadow=this.castShadow,e.receiveShadow=this.receiveShadow,e.frustumCulled=this.frustumCulled,e.userData=JSON.parse(JSON.stringify(this.userData)),t===!0)for(var r=0;r<this.children.length;r++){var n=this.children[r];e.add(n.clone())}return e}},{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order=e},configurable:!0,enumerable:!0},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(e){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},configurable:!0,enumerable:!0}}),c.EventDispatcher.prototype.apply(c.Object3D.prototype),c.Object3DIdCount=0,c.Face3=function(e,t,r,n,o,i){this.a=e,this.b=t,this.c=r,this.normal=n instanceof c.Vector3?n:new c.Vector3,this.vertexNormals=n instanceof Array?n:[],this.color=o instanceof c.Color?o:new c.Color,this.vertexColors=o instanceof Array?o:[],this.vertexTangents=[],this.materialIndex=void 0!==i?i:0},c.Face3.prototype={constructor:c.Face3,clone:function(){var e=new c.Face3(this.a,this.b,this.c);e.normal.copy(this.normal),e.color.copy(this.color),e.materialIndex=this.materialIndex;for(var t=0,r=this.vertexNormals.length;r>t;t++)e.vertexNormals[t]=this.vertexNormals[t].clone();for(var t=0,r=this.vertexColors.length;r>t;t++)e.vertexColors[t]=this.vertexColors[t].clone();for(var t=0,r=this.vertexTangents.length;r>t;t++)e.vertexTangents[t]=this.vertexTangents[t].clone();return e}},c.Face4=function(e,t,r,n,o,i,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new c.Face3(e,t,r,o,i,a)},c.BufferAttribute=function(e,t){this.array=e,this.itemSize=t,this.needsUpdate=!1},c.BufferAttribute.prototype=Object.defineProperties({constructor:c.BufferAttribute,copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var n=0,o=this.itemSize;o>n;n++)this.array[e+n]=t.array[r+n]},set:function(e){return this.array.set(e),this},setX:function(e,t){return this.array[e*this.itemSize]=t,
this},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,n){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=r,this.array[e+2]=n,this},setXYZW:function(e,t,r,n,o){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=r,this.array[e+2]=n,this.array[e+3]=o,this},clone:function(){return new c.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}},{length:{get:function(){return this.array.length},configurable:!0,enumerable:!0}}),c.Int8Attribute=function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new c.BufferAttribute(e,t)},c.Uint8Attribute=function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new c.BufferAttribute(e,t)},c.Uint8ClampedAttribute=function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new c.BufferAttribute(e,t)},c.Int16Attribute=function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new c.BufferAttribute(e,t)},c.Uint16Attribute=function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new c.BufferAttribute(e,t)},c.Int32Attribute=function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new c.BufferAttribute(e,t)},c.Uint32Attribute=function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new c.BufferAttribute(e,t)},c.Float32Attribute=function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new c.BufferAttribute(e,t)},c.Float64Attribute=function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new c.BufferAttribute(e,t)},c.BufferGeometry=function(){Object.defineProperty(this,"id",{value:c.GeometryIdCount++}),this.uuid=c.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.attributes={},this.attributesKeys=[],this.drawcalls=[],this.offsets=this.drawcalls,this.boundingBox=null,this.boundingSphere=null},c.BufferGeometry.prototype={constructor:c.BufferGeometry,addAttribute:function(e,t){return t instanceof c.BufferAttribute==!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void(this.attributes[e]={array:arguments[1],itemSize:arguments[2]})):(this.attributes[e]=t,void(this.attributesKeys=Object.keys(this.attributes)))},getAttribute:function(e){return this.attributes[e]},addDrawCall:function(e,t,r){this.drawcalls.push({start:e,count:t,index:void 0!==r?r:0})},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var n=(new c.Matrix3).getNormalMatrix(e);n.applyToVector3Array(r.array),r.needsUpdate=!0}},center:function(){},fromGeometry:function(e,t){t=t||{vertexColors:c.NoColors};var r=e.vertices,n=e.faces,o=e.faceVertexUvs,i=t.vertexColors,a=o[0].length>0,s=3==n[0].vertexNormals.length,l=new Float32Array(3*n.length*3);this.addAttribute("position",new c.BufferAttribute(l,3));var h=new Float32Array(3*n.length*3);if(this.addAttribute("normal",new c.BufferAttribute(h,3)),i!==c.NoColors){var u=new Float32Array(3*n.length*3);this.addAttribute("color",new c.BufferAttribute(u,3))}if(a===!0){var f=new Float32Array(3*n.length*2);this.addAttribute("uv",new c.BufferAttribute(f,2))}for(var d=0,p=0,m=0;d<n.length;d++,p+=6,m+=9){var g=n[d],y=r[g.a],v=r[g.b],_=r[g.c];if(l[m]=y.x,l[m+1]=y.y,l[m+2]=y.z,l[m+3]=v.x,l[m+4]=v.y,l[m+5]=v.z,l[m+6]=_.x,l[m+7]=_.y,l[m+8]=_.z,s===!0){var b=g.vertexNormals[0],w=g.vertexNormals[1],x=g.vertexNormals[2];h[m]=b.x,h[m+1]=b.y,h[m+2]=b.z,h[m+3]=w.x,h[m+4]=w.y,h[m+5]=w.z,h[m+6]=x.x,h[m+7]=x.y,h[m+8]=x.z}else{var T=g.normal;h[m]=T.x,h[m+1]=T.y,h[m+2]=T.z,h[m+3]=T.x,h[m+4]=T.y,h[m+5]=T.z,h[m+6]=T.x,h[m+7]=T.y,h[m+8]=T.z}if(i===c.FaceColors){var M=g.color;u[m]=M.r,u[m+1]=M.g,u[m+2]=M.b,u[m+3]=M.r,u[m+4]=M.g,u[m+5]=M.b,u[m+6]=M.r,u[m+7]=M.g,u[m+8]=M.b}else if(i===c.VertexColors){var S=g.vertexColors[0],C=g.vertexColors[1],E=g.vertexColors[2];u[m]=S.r,u[m+1]=S.g,u[m+2]=S.b,u[m+3]=C.r,u[m+4]=C.g,u[m+5]=C.b,u[m+6]=E.r,u[m+7]=E.g,u[m+8]=E.b}if(a===!0){var A=o[0][d][0],L=o[0][d][1],P=o[0][d][2];f[p]=A.x,f[p+1]=A.y,f[p+2]=L.x,f[p+3]=L.y,f[p+4]=P.x,f[p+5]=P.y}}return this.computeBoundingSphere(),this},computeBoundingBox:function(){var e=new c.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new c.Box3);var t=this.attributes.position.array;if(t){var r=this.boundingBox;r.makeEmpty();for(var n=0,o=t.length;o>n;n+=3)e.set(t[n],t[n+1],t[n+2]),r.expandByPoint(e)}(void 0===t||0===t.length)&&(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}(),computeBoundingSphere:function(){var e=new c.Box3,t=new c.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new c.Sphere);var r=this.attributes.position.array;if(r){e.makeEmpty();for(var n=this.boundingSphere.center,o=0,i=r.length;i>o;o+=3)t.set(r[o],r[o+1],r[o+2]),e.expandByPoint(t);e.center(n);for(var a=0,o=0,i=r.length;i>o;o+=3)t.set(r[o],r[o+1],r[o+2]),a=Math.max(a,n.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.attributes;if(e.position){var t=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new c.BufferAttribute(new Float32Array(t.length),3));else for(var r=e.normal.array,n=0,o=r.length;o>n;n++)r[n]=0;var i,a,s,r=e.normal.array,l=new c.Vector3,h=new c.Vector3,u=new c.Vector3,f=new c.Vector3,d=new c.Vector3;if(e.index)for(var p=e.index.array,m=this.offsets.length>0?this.offsets:[{start:0,count:p.length,index:0}],g=0,y=m.length;y>g;++g)for(var v=m[g].start,_=m[g].count,b=m[g].index,n=v,o=v+_;o>n;n+=3)i=3*(b+p[n]),a=3*(b+p[n+1]),s=3*(b+p[n+2]),l.fromArray(t,i),h.fromArray(t,a),u.fromArray(t,s),f.subVectors(u,h),d.subVectors(l,h),f.cross(d),r[i]+=f.x,r[i+1]+=f.y,r[i+2]+=f.z,r[a]+=f.x,r[a+1]+=f.y,r[a+2]+=f.z,r[s]+=f.x,r[s+1]+=f.y,r[s+2]+=f.z;else for(var n=0,o=t.length;o>n;n+=9)l.fromArray(t,n),h.fromArray(t,n+3),u.fromArray(t,n+6),f.subVectors(u,h),d.subVectors(l,h),f.cross(d),r[n]=f.x,r[n+1]=f.y,r[n+2]=f.z,r[n+3]=f.x,r[n+4]=f.y,r[n+5]=f.z,r[n+6]=f.x,r[n+7]=f.y,r[n+8]=f.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},computeTangents:function(){function e(e,t,r){P.fromArray(n,3*e),F.fromArray(n,3*t),D.fromArray(n,3*r),R.fromArray(i,2*e),O.fromArray(i,2*t),k.fromArray(i,2*r),f=F.x-P.x,d=D.x-P.x,p=F.y-P.y,m=D.y-P.y,g=F.z-P.z,y=D.z-P.z,v=O.x-R.x,_=k.x-R.x,b=O.y-R.y,w=k.y-R.y,x=1/(v*w-_*b),N.set((w*f-b*d)*x,(w*p-b*m)*x,(w*g-b*y)*x),B.set((v*d-_*f)*x,(v*m-_*p)*x,(v*y-_*g)*x),l[e].add(N),l[t].add(N),l[r].add(N),h[e].add(B),h[t].add(B),h[r].add(B)}function t(e){q.fromArray(o,3*e),Y.copy(q),H=l[e],W.copy(H),W.sub(q.multiplyScalar(q.dot(H))).normalize(),X.crossVectors(Y,H),j=X.dot(h[e]),G=0>j?-1:1,s[4*e]=W.x,s[4*e+1]=W.y,s[4*e+2]=W.z,s[4*e+3]=G}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)return void console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");var r=this.attributes.index.array,n=this.attributes.position.array,o=this.attributes.normal.array,i=this.attributes.uv.array,a=n.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new c.BufferAttribute(new Float32Array(4*a),4));for(var s=this.attributes.tangent.array,l=[],h=[],u=0;a>u;u++)l[u]=new c.Vector3,h[u]=new c.Vector3;var f,d,p,m,g,y,v,_,b,w,x,T,M,S,C,E,A,L,P=new c.Vector3,F=new c.Vector3,D=new c.Vector3,R=new c.Vector2,O=new c.Vector2,k=new c.Vector2,N=new c.Vector3,B=new c.Vector3;0===this.drawcalls.length&&this.addDrawCall(0,r.length,0);var U=this.drawcalls;for(S=0,C=U.length;C>S;++S){var I=U[S].start,V=U[S].count,z=U[S].index;for(T=I,M=I+V;M>T;T+=3)E=z+r[T],A=z+r[T+1],L=z+r[T+2],e(E,A,L)}var G,H,j,W=new c.Vector3,X=new c.Vector3,q=new c.Vector3,Y=new c.Vector3;for(S=0,C=U.length;C>S;++S){var I=U[S].start,V=U[S].count,z=U[S].index;for(T=I,M=I+V;M>T;T+=3)E=z+r[T],A=z+r[T+1],L=z+r[T+2],t(E),t(A),t(L)}},computeOffsets:function(e){var t=e;void 0===e&&(t=65535);for(var r=(Date.now(),this.attributes.index.array),n=this.attributes.position.array,o=(n.length/3,r.length/3),i=new Uint16Array(r.length),a=0,s=0,l=[{start:0,count:0,index:0}],h=l[0],u=0,c=0,f=new Int32Array(6),d=new Int32Array(n.length),p=new Int32Array(n.length),m=0;m<n.length;m++)d[m]=-1,p[m]=-1;for(var g=0;o>g;g++){c=0;for(var y=0;3>y;y++){var v=r[3*g+y];-1==d[v]?(f[2*y]=v,f[2*y+1]=-1,c++):d[v]<h.index?(f[2*y]=v,f[2*y+1]=-1,u++):(f[2*y]=v,f[2*y+1]=d[v])}var _=s+c;if(_>h.index+t){var b={start:a,count:0,index:s};l.push(b),h=b;for(var w=0;6>w;w+=2){var x=f[w+1];x>-1&&x<h.index&&(f[w+1]=-1)}}for(var w=0;6>w;w+=2){var v=f[w],x=f[w+1];-1===x&&(x=s++),d[v]=x,p[x]=v,i[a++]=x-h.index,h.count++}}return this.reorderBuffers(i,p,s),this.offsets=l,l},merge:function(e,t){if(e instanceof c.BufferGeometry==!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var r=this.attributes;for(var n in r)if(void 0!==e.attributes[n])for(var o=r[n],i=o.array,a=e.attributes[n],s=a.array,l=a.itemSize,h=0,u=l*t;h<s.length;h++,u++)i[u]=s[h];return this},normalizeNormals:function(){for(var e,t,r,n,o=this.attributes.normal.array,i=0,a=o.length;a>i;i+=3)e=o[i],t=o[i+1],r=o[i+2],n=1/Math.sqrt(e*e+t*t+r*r),o[i]*=n,o[i+1]*=n,o[i+2]*=n},reorderBuffers:function(e,t,r){var n={};for(var o in this.attributes)if("index"!=o){var i=this.attributes[o].array;n[o]=new i.constructor(this.attributes[o].itemSize*r)}for(var a=0;r>a;a++){var s=t[a];for(var o in this.attributes)if("index"!=o)for(var l=this.attributes[o].array,h=this.attributes[o].itemSize,u=n[o],c=0;h>c;c++)u[a*h+c]=l[s*h+c]}this.attributes.index.array=e;for(var o in this.attributes)"index"!=o&&(this.attributes[o].array=n[o],this.attributes[o].numItems=this.attributes[o].itemSize*r)},toJSON:function(){var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},t=this.attributes,r=this.offsets,n=this.boundingSphere;for(var o in t){for(var i=t[o],a=[],s=i.array,l=0,h=s.length;h>l;l++)a[l]=s[l];e.data.attributes[o]={itemSize:i.itemSize,type:i.array.constructor.name,array:a}}return r.length>0&&(e.data.offsets=JSON.parse(JSON.stringify(r))),null!==n&&(e.data.boundingSphere={center:n.center.toArray(),radius:n.radius}),e},clone:function(){var e=new c.BufferGeometry;for(var t in this.attributes){var r=this.attributes[t];e.addAttribute(t,r.clone())}for(var n=0,o=this.offsets.length;o>n;n++){var i=this.offsets[n];e.offsets.push({start:i.start,index:i.index,count:i.count})}return e},dispose:function(){this.dispatchEvent({type:"dispose"})}},c.EventDispatcher.prototype.apply(c.BufferGeometry.prototype),c.Geometry=function(){Object.defineProperty(this,"id",{value:c.GeometryIdCount++}),this.uuid=c.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.hasTangents=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.tangentsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},c.Geometry.prototype={constructor:c.Geometry,applyMatrix:function(e){for(var t=(new c.Matrix3).getNormalMatrix(e),r=0,n=this.vertices.length;n>r;r++){var o=this.vertices[r];o.applyMatrix4(e)}for(var r=0,n=this.faces.length;n>r;r++){var i=this.faces[r];i.normal.applyMatrix3(t).normalize();for(var a=0,s=i.vertexNormals.length;s>a;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}this.boundingBox instanceof c.Box3&&this.computeBoundingBox(),this.boundingSphere instanceof c.Sphere&&this.computeBoundingSphere()},fromBufferGeometry:function(e){for(var t=this,r=e.attributes,n=r.position.array,o=void 0!==r.index?r.index.array:void 0,i=void 0!==r.normal?r.normal.array:void 0,a=void 0!==r.color?r.color.array:void 0,s=void 0!==r.uv?r.uv.array:void 0,l=[],h=[],u=0,f=0;u<n.length;u+=3,f+=2)t.vertices.push(new c.Vector3(n[u],n[u+1],n[u+2])),void 0!==i&&l.push(new c.Vector3(i[u],i[u+1],i[u+2])),void 0!==a&&t.colors.push(new c.Color(a[u],a[u+1],a[u+2])),void 0!==s&&h.push(new c.Vector2(s[f],s[f+1]));var d=function(e,r,n){var o=void 0!==i?[l[e].clone(),l[r].clone(),l[n].clone()]:[],u=void 0!==a?[t.colors[e].clone(),t.colors[r].clone(),t.colors[n].clone()]:[];t.faces.push(new c.Face3(e,r,n,o,u)),void 0!==s&&t.faceVertexUvs[0].push([h[e].clone(),h[r].clone(),h[n].clone()])};if(void 0!==o)for(var u=0;u<o.length;u+=3)d(o[u],o[u+1],o[u+2]);else for(var u=0;u<n.length/3;u+=3)d(u,u+1,u+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=new c.Vector3;return e.addVectors(this.boundingBox.min,this.boundingBox.max),e.multiplyScalar(-.5),this.applyMatrix((new c.Matrix4).makeTranslation(e.x,e.y,e.z)),this.computeBoundingBox(),e},computeFaceNormals:function(){for(var e=new c.Vector3,t=new c.Vector3,r=0,n=this.faces.length;n>r;r++){var o=this.faces[r],i=this.vertices[o.a],a=this.vertices[o.b],s=this.vertices[o.c];e.subVectors(s,a),t.subVectors(i,a),e.cross(t),e.normalize(),o.normal.copy(e)}},computeVertexNormals:function(e){var t,r,n,o,i,a;for(a=new Array(this.vertices.length),t=0,r=this.vertices.length;r>t;t++)a[t]=new c.Vector3;if(e){var s,l,h,u=new c.Vector3,f=new c.Vector3;new c.Vector3,new c.Vector3,new c.Vector3;for(n=0,o=this.faces.length;o>n;n++)i=this.faces[n],s=this.vertices[i.a],l=this.vertices[i.b],h=this.vertices[i.c],u.subVectors(h,l),f.subVectors(s,l),u.cross(f),a[i.a].add(u),a[i.b].add(u),a[i.c].add(u)}else for(n=0,o=this.faces.length;o>n;n++)i=this.faces[n],a[i.a].add(i.normal),a[i.b].add(i.normal),a[i.c].add(i.normal);for(t=0,r=this.vertices.length;r>t;t++)a[t].normalize();for(n=0,o=this.faces.length;o>n;n++)i=this.faces[n],i.vertexNormals[0]=a[i.a].clone(),i.vertexNormals[1]=a[i.b].clone(),i.vertexNormals[2]=a[i.c].clone()},computeMorphNormals:function(){var e,t,r,n,o;for(r=0,n=this.faces.length;n>r;r++)for(o=this.faces[r],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 i=new c.Geometry;for(i.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=[];var a,s,l=this.morphNormals[e].faceNormals,h=this.morphNormals[e].vertexNormals;for(r=0,n=this.faces.length;n>r;r++)a=new c.Vector3,s={a:new c.Vector3,b:new c.Vector3,c:new c.Vector3},l.push(a),h.push(s)}var u=this.morphNormals[e];i.vertices=this.morphTargets[e].vertices,i.computeFaceNormals(),i.computeVertexNormals();var a,s;for(r=0,n=this.faces.length;n>r;r++)o=this.faces[r],a=u.faceNormals[r],s=u.vertexNormals[r],a.copy(o.normal),s.a.copy(o.vertexNormals[0]),s.b.copy(o.vertexNormals[1]),s.c.copy(o.vertexNormals[2])}for(r=0,n=this.faces.length;n>r;r++)o=this.faces[r],o.normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeTangents:function(){function e(e,t,r,n,o,i,a){h=e.vertices[t],u=e.vertices[r],f=e.vertices[n],d=l[o],p=l[i],m=l[a],g=u.x-h.x,y=f.x-h.x,v=u.y-h.y,_=f.y-h.y,b=u.z-h.z,w=f.z-h.z,x=p.x-d.x,T=m.x-d.x,M=p.y-d.y,S=m.y-d.y,C=1/(x*S-T*M),D.set((S*g-M*y)*C,(S*v-M*_)*C,(S*b-M*w)*C),R.set((x*y-T*g)*C,(x*_-T*v)*C,(x*w-T*b)*C),P[t].add(D),P[r].add(D),P[n].add(D),F[t].add(R),F[r].add(R),F[n].add(R)}var t,r,n,o,i,a,s,l,h,u,f,d,p,m,g,y,v,_,b,w,x,T,M,S,C,E,A,L,P=[],F=[],D=new c.Vector3,R=new c.Vector3,O=new c.Vector3,k=new c.Vector3,N=new c.Vector3;for(n=0,o=this.vertices.length;o>n;n++)P[n]=new c.Vector3,F[n]=new c.Vector3;for(t=0,r=this.faces.length;r>t;t++)s=this.faces[t],l=this.faceVertexUvs[0][t],e(this,s.a,s.b,s.c,0,1,2);var B=["a","b","c","d"];for(t=0,r=this.faces.length;r>t;t++)for(s=this.faces[t],i=0;i<Math.min(s.vertexNormals.length,3);i++)N.copy(s.vertexNormals[i]),a=s[B[i]],E=P[a],O.copy(E),O.sub(N.multiplyScalar(N.dot(E))).normalize(),k.crossVectors(s.vertexNormals[i],E),A=k.dot(F[a]),L=0>A?-1:1,s.vertexTangents[i]=new c.Vector4(O.x,O.y,O.z,L);this.hasTangents=!0},computeLineDistances:function(){for(var e=0,t=this.vertices,r=0,n=t.length;n>r;r++)r>0&&(e+=t[r].distanceTo(t[r-1])),this.lineDistances[r]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new c.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new c.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e instanceof c.Geometry==!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var n,o=this.vertices.length,i=this.vertices,a=e.vertices,s=this.faces,l=e.faces,h=this.faceVertexUvs[0],u=e.faceVertexUvs[0];void 0===r&&(r=0),void 0!==t&&(n=(new c.Matrix3).getNormalMatrix(t));for(var f=0,d=a.length;d>f;f++){var p=a[f],m=p.clone();void 0!==t&&m.applyMatrix4(t),i.push(m)}for(f=0,d=l.length;d>f;f++){var g,y,v,_=l[f],b=_.vertexNormals,w=_.vertexColors;g=new c.Face3(_.a+o,_.b+o,_.c+o),g.normal.copy(_.normal),void 0!==n&&g.normal.applyMatrix3(n).normalize();for(var x=0,T=b.length;T>x;x++)y=b[x].clone(),void 0!==n&&y.applyMatrix3(n).normalize(),g.vertexNormals.push(y);g.color.copy(_.color);for(var x=0,T=w.length;T>x;x++)v=w[x],g.vertexColors.push(v.clone());g.materialIndex=_.materialIndex+r,s.push(g)}for(f=0,d=u.length;d>f;f++){var M=u[f],S=[];if(void 0!==M){for(var x=0,T=M.length;T>x;x++)S.push(M[x].clone());h.push(S)}}},mergeMesh:function(e){return e instanceof c.Mesh==!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,r,n,o,i,a,s,l={},h=[],u=[],c=4,f=Math.pow(10,c);for(r=0,n=this.vertices.length;n>r;r++)e=this.vertices[r],t=Math.round(e.x*f)+"_"+Math.round(e.y*f)+"_"+Math.round(e.z*f),void 0===l[t]?(l[t]=r,h.push(this.vertices[r]),u[r]=h.length-1):u[r]=u[l[t]];var d=[];for(r=0,n=this.faces.length;n>r;r++){o=this.faces[r],o.a=u[o.a],o.b=u[o.b],o.c=u[o.c],i=[o.a,o.b,o.c];for(var p=-1,m=0;3>m;m++)if(i[m]==i[(m+1)%3]){p=m,d.push(r);break}}for(r=d.length-1;r>=0;r--){var g=d[r];for(this.faces.splice(g,1),a=0,s=this.faceVertexUvs.length;s>a;a++)this.faceVertexUvs[a].splice(g,1)}var y=this.vertices.length-h.length;return this.vertices=h,y},toJSON:function(){function e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==f[t]?f[t]:(f[t]=c.length/3,c.push(e.x,e.y,e.z),f[t])}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==p[t]?p[t]:(p[t]=d.length,d.push(e.getHex()),p[t])}function n(e){var t=e.x.toString()+e.y.toString();return void 0!==g[t]?g[t]:(g[t]=m.length/2,m.push(e.x,e.y),g[t])}var o={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(""!==this.name&&(o.name=this.name),void 0!==this.parameters){var i=this.parameters;for(var a in i)void 0!==i[a]&&(o[a]=i[a]);return o}for(var s=[],l=0;l<this.vertices.length;l++){var h=this.vertices[l];s.push(h.x,h.y,h.z)}for(var u=[],c=[],f={},d=[],p={},m=[],g={},l=0;l<this.faces.length;l++){var y=this.faces[l],v=!1,_=!1,b=void 0!==this.faceVertexUvs[0][l],w=y.normal.length()>0,x=y.vertexNormals.length>0,T=1!==y.color.r||1!==y.color.g||1!==y.color.b,M=y.vertexColors.length>0,S=0;if(S=e(S,0,0),S=e(S,1,v),S=e(S,2,_),S=e(S,3,b),S=e(S,4,w),S=e(S,5,x),S=e(S,6,T),S=e(S,7,M),u.push(S),u.push(y.a,y.b,y.c),b){var C=this.faceVertexUvs[0][l];u.push(n(C[0]),n(C[1]),n(C[2]))}if(w&&u.push(t(y.normal)),x){var E=y.vertexNormals;u.push(t(E[0]),t(E[1]),t(E[2]))}if(T&&u.push(r(y.color)),M){var A=y.vertexColors;u.push(r(A[0]),r(A[1]),r(A[2]))}}return o.data={},o.data.vertices=s,o.data.normals=c,d.length>0&&(o.data.colors=d),m.length>0&&(o.data.uvs=[m]),o.data.faces=u,o},clone:function(){for(var e=new c.Geometry,t=this.vertices,r=0,n=t.length;n>r;r++)e.vertices.push(t[r].clone());for(var o=this.faces,r=0,n=o.length;n>r;r++)e.faces.push(o[r].clone());for(var r=0,n=this.faceVertexUvs.length;n>r;r++){var i=this.faceVertexUvs[r];void 0===e.faceVertexUvs[r]&&(e.faceVertexUvs[r]=[]);for(var a=0,s=i.length;s>a;a++){for(var l=i[a],h=[],u=0,f=l.length;f>u;u++){var d=l[u];h.push(d.clone())}e.faceVertexUvs[r].push(h)}}return e},dispose:function(){this.dispatchEvent({type:"dispose"})}},c.EventDispatcher.prototype.apply(c.Geometry.prototype),c.GeometryIdCount=0,c.Camera=function(){c.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new c.Matrix4,this.projectionMatrix=new c.Matrix4},c.Camera.prototype=Object.create(c.Object3D.prototype),c.Camera.prototype.constructor=c.Camera,c.Camera.prototype.getWorldDirection=function(){var e=new c.Quaternion;return function(t){var r=t||new c.Vector3;return this.getWorldQuaternion(e),r.set(0,0,-1).applyQuaternion(e)}}(),c.Camera.prototype.lookAt=function(){var e=new c.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),c.Camera.prototype.clone=function(e){return void 0===e&&(e=new c.Camera),c.Object3D.prototype.clone.call(this,e),e.matrixWorldInverse.copy(this.matrixWorldInverse),e.projectionMatrix.copy(this.projectionMatrix),e},c.CubeCamera=function(e,t,r){c.Object3D.call(this),this.type="CubeCamera";var n=90,o=1,i=new c.PerspectiveCamera(n,o,e,t);i.up.set(0,-1,0),i.lookAt(new c.Vector3(1,0,0)),this.add(i);var a=new c.PerspectiveCamera(n,o,e,t);a.up.set(0,-1,0),a.lookAt(new c.Vector3(-1,0,0)),this.add(a);var s=new c.PerspectiveCamera(n,o,e,t);s.up.set(0,0,1),s.lookAt(new c.Vector3(0,1,0)),this.add(s);var l=new c.PerspectiveCamera(n,o,e,t);l.up.set(0,0,-1),l.lookAt(new c.Vector3(0,-1,0)),this.add(l);var h=new c.PerspectiveCamera(n,o,e,t);h.up.set(0,-1,0),h.lookAt(new c.Vector3(0,0,1)),this.add(h);var u=new c.PerspectiveCamera(n,o,e,t);u.up.set(0,-1,0),u.lookAt(new c.Vector3(0,0,-1)),this.add(u),this.renderTarget=new c.WebGLRenderTargetCube(r,r,{format:c.RGBFormat,magFilter:c.LinearFilter,minFilter:c.LinearFilter}),this.updateCubeMap=function(e,t){var r=this.renderTarget,n=r.generateMipmaps;r.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,i,r),r.activeCubeFace=1,e.render(t,a,r),r.activeCubeFace=2,e.render(t,s,r),r.activeCubeFace=3,e.render(t,l,r),r.activeCubeFace=4,e.render(t,h,r),r.generateMipmaps=n,r.activeCubeFace=5,e.render(t,u,r)}},c.CubeCamera.prototype=Object.create(c.Object3D.prototype),c.CubeCamera.prototype.constructor=c.CubeCamera,c.OrthographicCamera=function(e,t,r,n,o,i){c.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,this.top=r,this.bottom=n,this.near=void 0!==o?o:.1,this.far=void 0!==i?i:2e3,this.updateProjectionMatrix()},c.OrthographicCamera.prototype=Object.create(c.Camera.prototype),c.OrthographicCamera.prototype.constructor=c.OrthographicCamera,c.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-e,r+e,n+t,n-t,this.near,this.far)},c.OrthographicCamera.prototype.clone=function(){var e=new c.OrthographicCamera;return c.Camera.prototype.clone.call(this,e),e.zoom=this.zoom,e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e.projectionMatrix.copy(this.projectionMatrix),e},c.PerspectiveCamera=function(e,t,r,n){c.Camera.call(this),this.type="PerspectiveCamera",this.zoom=1,this.fov=void 0!==e?e:50,this.aspect=void 0!==t?t:1,this.near=void 0!==r?r:.1,this.far=void 0!==n?n:2e3,this.updateProjectionMatrix()},c.PerspectiveCamera.prototype=Object.create(c.Camera.prototype),c.PerspectiveCamera.prototype.constructor=c.PerspectiveCamera,c.PerspectiveCamera.prototype.setLens=function(e,t){void 0===t&&(t=24),this.fov=2*c.Math.radToDeg(Math.atan(t/(2*e))),this.updateProjectionMatrix()},c.PerspectiveCamera.prototype.setViewOffset=function(e,t,r,n,o,i){this.fullWidth=e,this.fullHeight=t,this.x=r,this.y=n,this.width=o,this.height=i,this.updateProjectionMatrix()},c.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=c.Math.radToDeg(2*Math.atan(Math.tan(.5*c.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var t=this.fullWidth/this.fullHeight,r=Math.tan(c.Math.degToRad(.5*e))*this.near,n=-r,o=t*n,i=t*r,a=Math.abs(i-o),s=Math.abs(r-n);this.projectionMatrix.makeFrustum(o+this.x*a/this.fullWidth,o+(this.x+this.width)*a/this.fullWidth,r-(this.y+this.height)*s/this.fullHeight,r-this.y*s/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(e,this.aspect,this.near,this.far)},c.PerspectiveCamera.prototype.clone=function(){var e=new c.PerspectiveCamera;return c.Camera.prototype.clone.call(this,e),e.zoom=this.zoom,e.fov=this.fov,e.aspect=this.aspect,e.near=this.near,e.far=this.far,e.projectionMatrix.copy(this.projectionMatrix),e},c.Light=function(e){c.Object3D.call(this),this.type="Light",this.color=new c.Color(e)},c.Light.prototype=Object.create(c.Object3D.prototype),c.Light.prototype.constructor=c.Light,c.Light.prototype.clone=function(e){return void 0===e&&(e=new c.Light),c.Object3D.prototype.clone.call(this,e),e.color.copy(this.color),e},c.AmbientLight=function(e){c.Light.call(this,e),this.type="AmbientLight"},c.AmbientLight.prototype=Object.create(c.Light.prototype),c.AmbientLight.prototype.constructor=c.AmbientLight,c.AmbientLight.prototype.clone=function(){var e=new c.AmbientLight;return c.Light.prototype.clone.call(this,e),e},c.AreaLight=function(e,t){c.Light.call(this,e),this.type="AreaLight",this.normal=new c.Vector3(0,-1,0),this.right=new c.Vector3(1,0,0),this.intensity=void 0!==t?t:1,this.width=1,this.height=1,this.constantAttenuation=1.5,this.linearAttenuation=.5,this.quadraticAttenuation=.1},c.AreaLight.prototype=Object.create(c.Light.prototype),c.AreaLight.prototype.constructor=c.AreaLight,c.DirectionalLight=function(e,t){c.Light.call(this,e),this.type="DirectionalLight",this.position.set(0,1,0),this.target=new c.Object3D,this.intensity=void 0!==t?t:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraRight=500,this.shadowCameraTop=500,this.shadowCameraBottom=-500,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowCascade=!1,this.shadowCascadeOffset=new c.Vector3(0,0,-1e3),this.shadowCascadeCount=2,this.shadowCascadeBias=[0,0,0],this.shadowCascadeWidth=[512,512,512],this.shadowCascadeHeight=[512,512,512],this.shadowCascadeNearZ=[-1,.99,.998],this.shadowCascadeFarZ=[.99,.998,1],this.shadowCascadeArray=[],this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},c.DirectionalLight.prototype=Object.create(c.Light.prototype),c.DirectionalLight.prototype.constructor=c.DirectionalLight,c.DirectionalLight.prototype.clone=function(){var e=new c.DirectionalLight;return c.Light.prototype.clone.call(this,e),e.target=this.target.clone(),e.intensity=this.intensity,e.castShadow=this.castShadow,e.onlyShadow=this.onlyShadow,e.shadowCameraNear=this.shadowCameraNear,e.shadowCameraFar=this.shadowCameraFar,e.shadowCameraLeft=this.shadowCameraLeft,e.shadowCameraRight=this.shadowCameraRight,e.shadowCameraTop=this.shadowCameraTop,e.shadowCameraBottom=this.shadowCameraBottom,e.shadowCameraVisible=this.shadowCameraVisible,e.shadowBias=this.shadowBias,e.shadowDarkness=this.shadowDarkness,e.shadowMapWidth=this.shadowMapWidth,e.shadowMapHeight=this.shadowMapHeight,e.shadowCascade=this.shadowCascade,e.shadowCascadeOffset.copy(this.shadowCascadeOffset),e.shadowCascadeCount=this.shadowCascadeCount,e.shadowCascadeBias=this.shadowCascadeBias.slice(0),e.shadowCascadeWidth=this.shadowCascadeWidth.slice(0),e.shadowCascadeHeight=this.shadowCascadeHeight.slice(0),e.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0),e.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0),e},c.HemisphereLight=function(e,t,r){c.Light.call(this,e),this.type="HemisphereLight",this.position.set(0,100,0),this.groundColor=new c.Color(t),this.intensity=void 0!==r?r:1},c.HemisphereLight.prototype=Object.create(c.Light.prototype),c.HemisphereLight.prototype.constructor=c.HemisphereLight,c.HemisphereLight.prototype.clone=function(){var e=new c.HemisphereLight;return c.Light.prototype.clone.call(this,e),e.groundColor.copy(this.groundColor),e.intensity=this.intensity,e},c.PointLight=function(e,t,r){c.Light.call(this,e),this.type="PointLight",this.intensity=void 0!==t?t:1,this.distance=void 0!==r?r:0},c.PointLight.prototype=Object.create(c.Light.prototype),c.PointLight.prototype.constructor=c.PointLight,c.PointLight.prototype.clone=function(){var e=new c.PointLight;return c.Light.prototype.clone.call(this,e),e.intensity=this.intensity,e.distance=this.distance,e},c.SpotLight=function(e,t,r,n,o){c.Light.call(this,e),this.type="SpotLight",this.position.set(0,1,0),this.target=new c.Object3D,this.intensity=void 0!==t?t:1,this.distance=void 0!==r?r:0,this.angle=void 0!==n?n:Math.PI/3,this.exponent=void 0!==o?o:10,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},c.SpotLight.prototype=Object.create(c.Light.prototype),c.SpotLight.prototype.constructor=c.SpotLight,c.SpotLight.prototype.clone=function(){var e=new c.SpotLight;return c.Light.prototype.clone.call(this,e),e.target=this.target.clone(),e.intensity=this.intensity,e.distance=this.distance,e.angle=this.angle,e.exponent=this.exponent,e.castShadow=this.castShadow,e.onlyShadow=this.onlyShadow,e.shadowCameraNear=this.shadowCameraNear,e.shadowCameraFar=this.shadowCameraFar,e.shadowCameraFov=this.shadowCameraFov,e.shadowCameraVisible=this.shadowCameraVisible,e.shadowBias=this.shadowBias,e.shadowDarkness=this.shadowDarkness,e.shadowMapWidth=this.shadowMapWidth,e.shadowMapHeight=this.shadowMapHeight,e},c.Cache=function(){this.files={}},c.Cache.prototype={constructor:c.Cache,add:function(e,t){this.files[e]=t},get:function(e){return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},c.Loader=function(e){this.showStatus=e,
this.statusDomElement=e?c.Loader.prototype.addStatusElement():null,this.imageLoader=new c.ImageLoader,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},c.Loader.prototype={constructor:c.Loader,crossOrigin:void 0,addStatusElement:function(){var e=document.createElement("div");return e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.fontSize="0.8em",e.style.textAlign="left",e.style.background="rgba(0,0,0,0.25)",e.style.color="#fff",e.style.width="120px",e.style.padding="0.5em 0.5em 0.5em 0.5em",e.style.zIndex=1e3,e.innerHTML="Loading ...",e},updateProgress:function(e){var t="Loaded ";t+=e.total?(100*e.loaded/e.total).toFixed(0)+"%":(e.loaded/1024).toFixed(2)+" KB",this.statusDomElement.innerHTML=t},extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t){for(var r=[],n=0;n<e.length;++n)r[n]=this.createMaterial(e[n],t);return r},needsTangents:function(e){for(var t=0,r=e.length;r>t;t++){var n=e[t];if(n instanceof c.ShaderMaterial)return!0}return!1},createMaterial:function(e,t){function r(e){var t=Math.log(e)/Math.LN2;return Math.pow(2,Math.round(t))}function n(e,n,o,a,s,l,h){var u,f=t+o,d=c.Loader.Handlers.get(f);if(null!==d?u=d.load(f):(u=new c.Texture,d=i.imageLoader,d.crossOrigin=i.crossOrigin,d.load(f,function(e){if(c.Math.isPowerOfTwo(e.width)===!1||c.Math.isPowerOfTwo(e.height)===!1){var t=r(e.width),n=r(e.height),o=document.createElement("canvas");o.width=t,o.height=n;var i=o.getContext("2d");i.drawImage(e,0,0,t,n),u.image=o}else u.image=e;u.needsUpdate=!0})),u.sourceFile=o,a&&(u.repeat.set(a[0],a[1]),1!==a[0]&&(u.wrapS=c.RepeatWrapping),1!==a[1]&&(u.wrapT=c.RepeatWrapping)),s&&u.offset.set(s[0],s[1]),l){var p={repeat:c.RepeatWrapping,mirror:c.MirroredRepeatWrapping};void 0!==p[l[0]]&&(u.wrapS=p[l[0]]),void 0!==p[l[1]]&&(u.wrapT=p[l[1]])}h&&(u.anisotropy=h),e[n]=u}function o(e){return(255*e[0]<<16)+(255*e[1]<<8)+255*e[2]}var i=this,a="MeshLambertMaterial",s={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(e.shading){var l=e.shading.toLowerCase();"phong"===l?a="MeshPhongMaterial":"basic"===l&&(a="MeshBasicMaterial")}void 0!==e.blending&&void 0!==c[e.blending]&&(s.blending=c[e.blending]),(void 0!==e.transparent||e.opacity<1)&&(s.transparent=e.transparent),void 0!==e.depthTest&&(s.depthTest=e.depthTest),void 0!==e.depthWrite&&(s.depthWrite=e.depthWrite),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.flipSided&&(s.side=c.BackSide),void 0!==e.doubleSided&&(s.side=c.DoubleSide),void 0!==e.wireframe&&(s.wireframe=e.wireframe),void 0!==e.vertexColors&&("face"===e.vertexColors?s.vertexColors=c.FaceColors:e.vertexColors&&(s.vertexColors=c.VertexColors)),e.colorDiffuse?s.color=o(e.colorDiffuse):e.DbgColor&&(s.color=e.DbgColor),e.colorSpecular&&(s.specular=o(e.colorSpecular)),e.colorAmbient&&(s.ambient=o(e.colorAmbient)),e.colorEmissive&&(s.emissive=o(e.colorEmissive)),e.transparency&&(s.opacity=e.transparency),e.specularCoef&&(s.shininess=e.specularCoef),e.mapDiffuse&&t&&n(s,"map",e.mapDiffuse,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy),e.mapLight&&t&&n(s,"lightMap",e.mapLight,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy),e.mapBump&&t&&n(s,"bumpMap",e.mapBump,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy),e.mapNormal&&t&&n(s,"normalMap",e.mapNormal,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy),e.mapSpecular&&t&&n(s,"specularMap",e.mapSpecular,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy),e.mapAlpha&&t&&n(s,"alphaMap",e.mapAlpha,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy),e.mapBumpScale&&(s.bumpScale=e.mapBumpScale),e.mapNormalFactor&&(s.normalScale=new c.Vector2(e.mapNormalFactor,e.mapNormalFactor));var h=new c[a](s);return void 0!==e.DbgName&&(h.name=e.DbgName),h}},c.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=0,r=this.handlers.length;r>t;t+=2){var n=this.handlers[t],o=this.handlers[t+1];if(n.test(e))return o}return null}},c.XHRLoader=function(e){this.cache=new c.Cache,this.manager=void 0!==e?e:c.DefaultLoadingManager},c.XHRLoader.prototype={constructor:c.XHRLoader,load:function(e,t,r,n){var o=this,i=o.cache.get(e);if(void 0!==i)return void(t&&t(i));var a=new XMLHttpRequest;a.open("GET",e,!0),a.addEventListener("load",function(r){o.cache.add(e,this.response),t&&t(this.response),o.manager.itemEnd(e)},!1),void 0!==r&&a.addEventListener("progress",function(e){r(e)},!1),void 0!==n&&a.addEventListener("error",function(e){n(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(a.responseType=this.responseType),a.send(null),o.manager.itemStart(e)},setResponseType:function(e){this.responseType=e},setCrossOrigin:function(e){this.crossOrigin=e}},c.ImageLoader=function(e){this.cache=new c.Cache,this.manager=void 0!==e?e:c.DefaultLoadingManager},c.ImageLoader.prototype={constructor:c.ImageLoader,load:function(e,t,r,n){var o=this,i=o.cache.get(e);if(void 0!==i)return void t(i);var a=document.createElement("img");return void 0!==t&&a.addEventListener("load",function(r){o.cache.add(e,this),t(this),o.manager.itemEnd(e)},!1),void 0!==r&&a.addEventListener("progress",function(e){r(e)},!1),void 0!==n&&a.addEventListener("error",function(e){n(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),a.src=e,o.manager.itemStart(e),a},setCrossOrigin:function(e){this.crossOrigin=e}},c.JSONLoader=function(e){c.Loader.call(this,e),this.withCredentials=!1},c.JSONLoader.prototype=Object.create(c.Loader.prototype),c.JSONLoader.prototype.constructor=c.JSONLoader,c.JSONLoader.prototype.load=function(e,t,r){r=r&&"string"==typeof r?r:this.extractUrlBase(e),this.onLoadStart(),this.loadAjaxJSON(this,e,t,r)},c.JSONLoader.prototype.loadAjaxJSON=function(e,t,r,n,o){var i=new XMLHttpRequest,a=0;i.onreadystatechange=function(){if(i.readyState===i.DONE)if(200===i.status||0===i.status){if(i.responseText){var s=JSON.parse(i.responseText);if(void 0!==s.metadata&&"scene"===s.metadata.type)return void console.error('THREE.JSONLoader: "'+t+'" seems to be a Scene. Use THREE.SceneLoader instead.');var l=e.parse(s,n);r(l.geometry,l.materials)}else console.error('THREE.JSONLoader: "'+t+'" seems to be unreachable or the file is empty.');e.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load \""+t+'" ('+i.status+")");else i.readyState===i.LOADING?o&&(0===a&&(a=i.getResponseHeader("Content-Length")),o({total:a,loaded:i.responseText.length})):i.readyState===i.HEADERS_RECEIVED&&void 0!==o&&(a=i.getResponseHeader("Content-Length"))},i.open("GET",t,!0),i.withCredentials=this.withCredentials,i.send(null)},c.JSONLoader.prototype.parse=function(e,t){function r(t){function r(e,t){return e&1<<t}var n,o,a,s,l,h,u,f,d,p,m,g,y,v,_,b,w,x,T,M,S,C,E,A,L,P,F,D=e.faces,R=e.vertices,O=e.normals,k=e.colors,N=0;if(void 0!==e.uvs){for(n=0;n<e.uvs.length;n++)e.uvs[n].length&&N++;for(n=0;N>n;n++)i.faceVertexUvs[n]=[]}for(s=0,l=R.length;l>s;)x=new c.Vector3,x.x=R[s++]*t,x.y=R[s++]*t,x.z=R[s++]*t,i.vertices.push(x);for(s=0,l=D.length;l>s;)if(p=D[s++],m=r(p,0),g=r(p,1),y=r(p,3),v=r(p,4),_=r(p,5),b=r(p,6),w=r(p,7),m){if(M=new c.Face3,M.a=D[s],M.b=D[s+1],M.c=D[s+3],S=new c.Face3,S.a=D[s+1],S.b=D[s+2],S.c=D[s+3],s+=4,g&&(d=D[s++],M.materialIndex=d,S.materialIndex=d),a=i.faces.length,y)for(n=0;N>n;n++)for(A=e.uvs[n],i.faceVertexUvs[n][a]=[],i.faceVertexUvs[n][a+1]=[],o=0;4>o;o++)f=D[s++],P=A[2*f],F=A[2*f+1],L=new c.Vector2(P,F),2!==o&&i.faceVertexUvs[n][a].push(L),0!==o&&i.faceVertexUvs[n][a+1].push(L);if(v&&(u=3*D[s++],M.normal.set(O[u++],O[u++],O[u]),S.normal.copy(M.normal)),_)for(n=0;4>n;n++)u=3*D[s++],E=new c.Vector3(O[u++],O[u++],O[u]),2!==n&&M.vertexNormals.push(E),0!==n&&S.vertexNormals.push(E);if(b&&(h=D[s++],C=k[h],M.color.setHex(C),S.color.setHex(C)),w)for(n=0;4>n;n++)h=D[s++],C=k[h],2!==n&&M.vertexColors.push(new c.Color(C)),0!==n&&S.vertexColors.push(new c.Color(C));i.faces.push(M),i.faces.push(S)}else{if(T=new c.Face3,T.a=D[s++],T.b=D[s++],T.c=D[s++],g&&(d=D[s++],T.materialIndex=d),a=i.faces.length,y)for(n=0;N>n;n++)for(A=e.uvs[n],i.faceVertexUvs[n][a]=[],o=0;3>o;o++)f=D[s++],P=A[2*f],F=A[2*f+1],L=new c.Vector2(P,F),i.faceVertexUvs[n][a].push(L);if(v&&(u=3*D[s++],T.normal.set(O[u++],O[u++],O[u])),_)for(n=0;3>n;n++)u=3*D[s++],E=new c.Vector3(O[u++],O[u++],O[u]),T.vertexNormals.push(E);if(b&&(h=D[s++],T.color.setHex(k[h])),w)for(n=0;3>n;n++)h=D[s++],T.vertexColors.push(new c.Color(k[h]));i.faces.push(T)}}function n(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,n=e.skinWeights.length;n>r;r+=t){var o=e.skinWeights[r],a=t>1?e.skinWeights[r+1]:0,s=t>2?e.skinWeights[r+2]:0,l=t>3?e.skinWeights[r+3]:0;i.skinWeights.push(new c.Vector4(o,a,s,l))}if(e.skinIndices)for(var r=0,n=e.skinIndices.length;n>r;r+=t){var h=e.skinIndices[r],u=t>1?e.skinIndices[r+1]:0,f=t>2?e.skinIndices[r+2]:0,d=t>3?e.skinIndices[r+3]:0;i.skinIndices.push(new c.Vector4(h,u,f,d))}i.bones=e.bones,i.bones&&i.bones.length>0&&(i.skinWeights.length!==i.skinIndices.length||i.skinIndices.length!==i.vertices.length)&&console.warn("When skinning, number of vertices ("+i.vertices.length+"), skinIndices ("+i.skinIndices.length+"), and skinWeights ("+i.skinWeights.length+") should match."),i.animation=e.animation,i.animations=e.animations}function o(t){if(void 0!==e.morphTargets){var r,n,o,a,s,l;for(r=0,n=e.morphTargets.length;n>r;r++)for(i.morphTargets[r]={},i.morphTargets[r].name=e.morphTargets[r].name,i.morphTargets[r].vertices=[],s=i.morphTargets[r].vertices,l=e.morphTargets[r].vertices,o=0,a=l.length;a>o;o+=3){var h=new c.Vector3;h.x=l[o]*t,h.y=l[o+1]*t,h.z=l[o+2]*t,s.push(h)}}if(void 0!==e.morphColors){var r,n,u,f,d,p,m;for(r=0,n=e.morphColors.length;n>r;r++)for(i.morphColors[r]={},i.morphColors[r].name=e.morphColors[r].name,i.morphColors[r].colors=[],d=i.morphColors[r].colors,p=e.morphColors[r].colors,u=0,f=p.length;f>u;u+=3)m=new c.Color(16755200),m.setRGB(p[u],p[u+1],p[u+2]),d.push(m)}}var i=new c.Geometry,a=void 0!==e.scale?1/e.scale:1;if(r(a),n(),o(a),i.computeFaceNormals(),i.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:i};var s=this.initMaterials(e.materials,t);return this.needsTangents(s)&&i.computeTangents(),{geometry:i,materials:s}},c.LoadingManager=function(e,t,r){var n=this,o=0,i=0;this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){i++},this.itemEnd=function(e){o++,void 0!==n.onProgress&&n.onProgress(e,o,i),o===i&&void 0!==n.onLoad&&n.onLoad()}},c.DefaultLoadingManager=new c.LoadingManager,c.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:c.DefaultLoadingManager},c.BufferGeometryLoader.prototype={constructor:c.BufferGeometryLoader,load:function(e,t,r,n){var o=this,i=new c.XHRLoader(o.manager);i.setCrossOrigin(this.crossOrigin),i.load(e,function(e){t(o.parse(JSON.parse(e)))},r,n)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=new c.BufferGeometry,r=e.attributes;for(var n in r){var o=r[n],i=new u[o.type](o.array);t.addAttribute(n,new c.BufferAttribute(i,o.itemSize))}var a=e.offsets;void 0!==a&&(t.offsets=JSON.parse(JSON.stringify(a)));var s=e.boundingSphere;if(void 0!==s){var l=new c.Vector3;void 0!==s.center&&l.fromArray(s.center),t.boundingSphere=new c.Sphere(l,s.radius)}return t}},c.MaterialLoader=function(e){this.manager=void 0!==e?e:c.DefaultLoadingManager},c.MaterialLoader.prototype={constructor:c.MaterialLoader,load:function(e,t,r,n){var o=this,i=new c.XHRLoader(o.manager);i.setCrossOrigin(this.crossOrigin),i.load(e,function(e){t(o.parse(JSON.parse(e)))},r,n)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=new c[e.type];if(void 0!==e.color&&t.color.setHex(e.color),void 0!==e.ambient&&t.ambient.setHex(e.ambient),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.materials)for(var r=0,n=e.materials.length;n>r;r++)t.materials.push(this.parse(e.materials[r]));return t}},c.ObjectLoader=function(e){this.manager=void 0!==e?e:c.DefaultLoadingManager},c.ObjectLoader.prototype={constructor:c.ObjectLoader,load:function(e,t,r,n){var o=this,i=new c.XHRLoader(o.manager);i.setCrossOrigin(this.crossOrigin),i.load(e,function(e){t(o.parse(JSON.parse(e)))},r,n)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=this.parseGeometries(e.geometries),r=this.parseMaterials(e.materials),n=this.parseObject(e.object,t,r);return n},parseGeometries:function(e){var t={};if(void 0!==e)for(var r=new c.JSONLoader,n=new c.BufferGeometryLoader,o=0,i=e.length;i>o;o++){var a,s=e[o];switch(s.type){case"PlaneGeometry":a=new c.PlaneGeometry(s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"CubeGeometry":a=new c.BoxGeometry(s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":a=new c.CircleGeometry(s.radius,s.segments);break;case"CylinderGeometry":a=new c.CylinderGeometry(s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded);break;case"SphereGeometry":a=new c.SphereGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"IcosahedronGeometry":a=new c.IcosahedronGeometry(s.radius,s.detail);break;case"TorusGeometry":a=new c.TorusGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":a=new c.TorusKnotGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.p,s.q,s.heightScale);break;case"BufferGeometry":a=n.parse(s.data);break;case"Geometry":a=r.parse(s.data).geometry}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),t[s.uuid]=a}return t},parseMaterials:function(e){var t={};if(void 0!==e)for(var r=new c.MaterialLoader,n=0,o=e.length;o>n;n++){var i=e[n],a=r.parse(i);a.uuid=i.uuid,void 0!==i.name&&(a.name=i.name),t[i.uuid]=a}return t},parseObject:function(){var e=new c.Matrix4;return function(t,r,n){var o;switch(t.type){case"Scene":o=new c.Scene;break;case"PerspectiveCamera":o=new c.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":o=new c.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":o=new c.AmbientLight(t.color);break;case"DirectionalLight":o=new c.DirectionalLight(t.color,t.intensity);break;case"PointLight":o=new c.PointLight(t.color,t.intensity,t.distance);break;case"SpotLight":o=new c.SpotLight(t.color,t.intensity,t.distance,t.angle,t.exponent);break;case"HemisphereLight":o=new c.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":var i=r[t.geometry],a=n[t.material];void 0===i&&console.warn("THREE.ObjectLoader: Undefined geometry",t.geometry),void 0===a&&console.warn("THREE.ObjectLoader: Undefined material",t.material),o=new c.Mesh(i,a);break;case"Line":var i=r[t.geometry],a=n[t.material];void 0===i&&console.warn("THREE.ObjectLoader: Undefined geometry",t.geometry),void 0===a&&console.warn("THREE.ObjectLoader: Undefined material",t.material),o=new c.Line(i,a);break;case"Sprite":var a=n[t.material];void 0===a&&console.warn("THREE.ObjectLoader: Undefined material",t.material),o=new c.Sprite(a);break;case"Group":o=new c.Group;break;default:o=new c.Object3D}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.children)for(var s in t.children)o.add(this.parseObject(t.children[s],r,n));return o}}()},c.TextureLoader=function(e){this.manager=void 0!==e?e:c.DefaultLoadingManager},c.TextureLoader.prototype={constructor:c.TextureLoader,load:function(e,t,r,n){var o=this,i=new c.ImageLoader(o.manager);i.setCrossOrigin(this.crossOrigin),i.load(e,function(e){var r=new c.Texture(e);r.needsUpdate=!0,void 0!==t&&t(r)},r,n)},setCrossOrigin:function(e){this.crossOrigin=e}},c.DataTextureLoader=c.BinaryTextureLoader=function(){this._parser=null},c.BinaryTextureLoader.prototype={constructor:c.BinaryTextureLoader,load:function(e,t,r,n){var o=this,i=new c.DataTexture,a=new c.XHRLoader;return a.setResponseType("arraybuffer"),a.load(e,function(e){var r=o._parser(e);r&&(void 0!==r.image?i.image=r.image:void 0!==r.data&&(i.image.width=r.width,i.image.height=r.height,i.image.data=r.data),i.wrapS=void 0!==r.wrapS?r.wrapS:c.ClampToEdgeWrapping,i.wrapT=void 0!==r.wrapT?r.wrapT:c.ClampToEdgeWrapping,i.magFilter=void 0!==r.magFilter?r.magFilter:c.LinearFilter,i.minFilter=void 0!==r.minFilter?r.minFilter:c.LinearMipMapLinearFilter,i.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(i.format=r.format),void 0!==r.type&&(i.type=r.type),void 0!==r.mipmaps&&(i.mipmaps=r.mipmaps),1===r.mipmapCount&&(i.minFilter=c.LinearFilter),i.needsUpdate=!0,t&&t(i,r))},r,n),i}},c.CompressedTextureLoader=function(){this._parser=null},c.CompressedTextureLoader.prototype={constructor:c.CompressedTextureLoader,load:function(e,t,r){var n=this,o=[],i=new c.CompressedTexture;i.image=o;var a=new c.XHRLoader;if(a.setResponseType("arraybuffer"),e instanceof Array)for(var s=0,l=function(r){a.load(e[r],function(e){var a=n._parser(e,!0);o[r]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps},s+=1,6===s&&(1==a.mipmapCount&&(i.minFilter=c.LinearFilter),i.format=a.format,i.needsUpdate=!0,t&&t(i))})},h=0,u=e.length;u>h;++h)l(h);else a.load(e,function(e){var r=n._parser(e,!0);if(r.isCubemap)for(var a=r.mipmaps.length/r.mipmapCount,s=0;a>s;s++){o[s]={mipmaps:[]};for(var l=0;l<r.mipmapCount;l++)o[s].mipmaps.push(r.mipmaps[s*r.mipmapCount+l]),o[s].format=r.format,o[s].width=r.width,o[s].height=r.height}else i.image.width=r.width,i.image.height=r.height,i.mipmaps=r.mipmaps;1===r.mipmapCount&&(i.minFilter=c.LinearFilter),i.format=r.format,i.needsUpdate=!0,t&&t(i)});return i}},c.Material=function(){Object.defineProperty(this,"id",{value:c.MaterialIdCount++}),this.uuid=c.Math.generateUUID(),this.name="",this.type="Material",this.side=c.FrontSide,this.opacity=1,this.transparent=!1,this.blending=c.NormalBlending,this.blendSrc=c.SrcAlphaFactor,this.blendDst=c.OneMinusSrcAlphaFactor,this.blendEquation=c.AddEquation,this.depthTest=!0,this.depthWrite=!0,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.overdraw=0,this.visible=!0,this.needsUpdate=!0},c.Material.prototype={constructor:c.Material,setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0!==r){if(t in this){var n=this[t];n instanceof c.Color?n.set(r):n instanceof c.Vector3&&r instanceof c.Vector3?n.copy(r):"overdraw"==t?this[t]=Number(r):this[t]=r}}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(){var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};return""!==this.name&&(e.name=this.name),this instanceof c.MeshBasicMaterial?(e.color=this.color.getHex(),this.vertexColors!==c.NoColors&&(e.vertexColors=this.vertexColors),this.blending!==c.NormalBlending&&(e.blending=this.blending),this.side!==c.FrontSide&&(e.side=this.side)):this instanceof c.MeshLambertMaterial?(e.color=this.color.getHex(),e.ambient=this.ambient.getHex(),e.emissive=this.emissive.getHex(),this.vertexColors!==c.NoColors&&(e.vertexColors=this.vertexColors),this.blending!==c.NormalBlending&&(e.blending=this.blending),this.side!==c.FrontSide&&(e.side=this.side)):this instanceof c.MeshPhongMaterial?(e.color=this.color.getHex(),e.ambient=this.ambient.getHex(),e.emissive=this.emissive.getHex(),e.specular=this.specular.getHex(),e.shininess=this.shininess,this.vertexColors!==c.NoColors&&(e.vertexColors=this.vertexColors),this.blending!==c.NormalBlending&&(e.blending=this.blending),this.side!==c.FrontSide&&(e.side=this.side)):this instanceof c.MeshNormalMaterial?(this.shading!==c.FlatShading&&(e.shading=this.shading),this.blending!==c.NormalBlending&&(e.blending=this.blending),this.side!==c.FrontSide&&(e.side=this.side)):this instanceof c.MeshDepthMaterial?(this.blending!==c.NormalBlending&&(e.blending=this.blending),this.side!==c.FrontSide&&(e.side=this.side)):this instanceof c.ShaderMaterial?(e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader):this instanceof c.SpriteMaterial&&(e.color=this.color.getHex()),this.opacity<1&&(e.opacity=this.opacity),this.transparent!==!1&&(e.transparent=this.transparent),this.wireframe!==!1&&(e.wireframe=this.wireframe),e},clone:function(e){return void 0===e&&(e=new c.Material),e.name=this.name,e.side=this.side,e.opacity=this.opacity,e.transparent=this.transparent,e.blending=this.blending,e.blendSrc=this.blendSrc,e.blendDst=this.blendDst,e.blendEquation=this.blendEquation,e.depthTest=this.depthTest,e.depthWrite=this.depthWrite,e.polygonOffset=this.polygonOffset,e.polygonOffsetFactor=this.polygonOffsetFactor,e.polygonOffsetUnits=this.polygonOffsetUnits,e.alphaTest=this.alphaTest,e.overdraw=this.overdraw,e.visible=this.visible,e},dispose:function(){this.dispatchEvent({type:"dispose"})}},c.EventDispatcher.prototype.apply(c.Material.prototype),c.MaterialIdCount=0,c.LineBasicMaterial=function(e){c.Material.call(this),this.type="LineBasicMaterial",this.color=new c.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.vertexColors=c.NoColors,this.fog=!0,this.setValues(e)},c.LineBasicMaterial.prototype=Object.create(c.Material.prototype),c.LineBasicMaterial.prototype.constructor=c.LineBasicMaterial,c.LineBasicMaterial.prototype.clone=function(){var e=new c.LineBasicMaterial;return c.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.linewidth=this.linewidth,e.linecap=this.linecap,e.linejoin=this.linejoin,e.vertexColors=this.vertexColors,e.fog=this.fog,e},c.LineDashedMaterial=function(e){c.Material.call(this),this.type="LineDashedMaterial",this.color=new c.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(e)},c.LineDashedMaterial.prototype=Object.create(c.Material.prototype),c.LineDashedMaterial.prototype.constructor=c.LineDashedMaterial,c.LineDashedMaterial.prototype.clone=function(){var e=new c.LineDashedMaterial;return c.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.linewidth=this.linewidth,e.scale=this.scale,e.dashSize=this.dashSize,e.gapSize=this.gapSize,e.vertexColors=this.vertexColors,e.fog=this.fog,e},c.MeshBasicMaterial=function(e){c.Material.call(this),this.type="MeshBasicMaterial",this.color=new c.Color(16777215),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=c.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=c.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=c.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(e)},c.MeshBasicMaterial.prototype=Object.create(c.Material.prototype),c.MeshBasicMaterial.prototype.constructor=c.MeshBasicMaterial,c.MeshBasicMaterial.prototype.clone=function(){var e=new c.MeshBasicMaterial;return c.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.lightMap=this.lightMap,e.specularMap=this.specularMap,e.alphaMap=this.alphaMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e},c.MeshLambertMaterial=function(e){c.Material.call(this),this.type="MeshLambertMaterial",this.color=new c.Color(16777215),this.ambient=new c.Color(16777215),this.emissive=new c.Color(0),this.wrapAround=!1,this.wrapRGB=new c.Vector3(1,1,1),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=c.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=c.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=c.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},c.MeshLambertMaterial.prototype=Object.create(c.Material.prototype),c.MeshLambertMaterial.prototype.constructor=c.MeshLambertMaterial,c.MeshLambertMaterial.prototype.clone=function(){var e=new c.MeshLambertMaterial;return c.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.ambient.copy(this.ambient),e.emissive.copy(this.emissive),e.wrapAround=this.wrapAround,e.wrapRGB.copy(this.wrapRGB),e.map=this.map,e.lightMap=this.lightMap,e.specularMap=this.specularMap,e.alphaMap=this.alphaMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},c.MeshPhongMaterial=function(e){c.Material.call(this),this.type="MeshPhongMaterial",this.color=new c.Color(16777215),this.ambient=new c.Color(16777215),this.emissive=new c.Color(0),this.specular=new c.Color(1118481),this.shininess=30,this.metal=!1,this.wrapAround=!1,this.wrapRGB=new c.Vector3(1,1,1),this.map=null,this.lightMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new c.Vector2(1,1),this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=c.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=c.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=c.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},c.MeshPhongMaterial.prototype=Object.create(c.Material.prototype),c.MeshPhongMaterial.prototype.constructor=c.MeshPhongMaterial,c.MeshPhongMaterial.prototype.clone=function(){var e=new c.MeshPhongMaterial;return c.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.ambient.copy(this.ambient),e.emissive.copy(this.emissive),e.specular.copy(this.specular),e.shininess=this.shininess,e.metal=this.metal,e.wrapAround=this.wrapAround,e.wrapRGB.copy(this.wrapRGB),e.map=this.map,e.lightMap=this.lightMap,e.bumpMap=this.bumpMap,e.bumpScale=this.bumpScale,e.normalMap=this.normalMap,e.normalScale.copy(this.normalScale),e.specularMap=this.specularMap,e.alphaMap=this.alphaMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},c.MeshDepthMaterial=function(e){c.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},c.MeshDepthMaterial.prototype=Object.create(c.Material.prototype),c.MeshDepthMaterial.prototype.constructor=c.MeshDepthMaterial,c.MeshDepthMaterial.prototype.clone=function(){var e=new c.MeshDepthMaterial;return c.Material.prototype.clone.call(this,e),e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e},c.MeshNormalMaterial=function(e){c.Material.call(this,e),this.type="MeshNormalMaterial",this.shading=c.FlatShading,this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},c.MeshNormalMaterial.prototype=Object.create(c.Material.prototype),c.MeshNormalMaterial.prototype.constructor=c.MeshNormalMaterial,c.MeshNormalMaterial.prototype.clone=function(){var e=new c.MeshNormalMaterial;return c.Material.prototype.clone.call(this,e),e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e},c.MeshFaceMaterial=function(e){this.uuid=c.Math.generateUUID(),this.type="MeshFaceMaterial",this.materials=e instanceof Array?e:[]},c.MeshFaceMaterial.prototype={constructor:c.MeshFaceMaterial,toJSON:function(){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},t=0,r=this.materials.length;r>t;t++)e.materials.push(this.materials[t].toJSON());return e},clone:function(){for(var e=new c.MeshFaceMaterial,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e}},c.PointCloudMaterial=function(e){c.Material.call(this),this.type="PointCloudMaterial",this.color=new c.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=c.NoColors,this.fog=!0,this.setValues(e)},c.PointCloudMaterial.prototype=Object.create(c.Material.prototype),c.PointCloudMaterial.prototype.constructor=c.PointCloudMaterial,c.PointCloudMaterial.prototype.clone=function(){var e=new c.PointCloudMaterial;return c.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.size=this.size,e.sizeAttenuation=this.sizeAttenuation,e.vertexColors=this.vertexColors,e.fog=this.fog,e},c.ParticleBasicMaterial=function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial."),new c.PointCloudMaterial(e)},c.ParticleSystemMaterial=function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial."),new c.PointCloudMaterial(e)},c.ShaderMaterial=function(e){c.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.attributes=null,this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=c.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=c.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.setValues(e)},c.ShaderMaterial.prototype=Object.create(c.Material.prototype),c.ShaderMaterial.prototype.constructor=c.ShaderMaterial,c.ShaderMaterial.prototype.clone=function(){var e=new c.ShaderMaterial;return c.Material.prototype.clone.call(this,e),e.fragmentShader=this.fragmentShader,e.vertexShader=this.vertexShader,e.uniforms=c.UniformsUtils.clone(this.uniforms),e.attributes=this.attributes,e.defines=this.defines,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.fog=this.fog,e.lights=this.lights,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e;
},c.RawShaderMaterial=function(e){c.ShaderMaterial.call(this,e),this.type="RawShaderMaterial"},c.RawShaderMaterial.prototype=Object.create(c.ShaderMaterial.prototype),c.RawShaderMaterial.prototype.constructor=c.RawShaderMaterial,c.RawShaderMaterial.prototype.clone=function(){var e=new c.RawShaderMaterial;return c.ShaderMaterial.prototype.clone.call(this,e),e},c.SpriteMaterial=function(e){c.Material.call(this),this.type="SpriteMaterial",this.color=new c.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(e)},c.SpriteMaterial.prototype=Object.create(c.Material.prototype),c.SpriteMaterial.prototype.constructor=c.SpriteMaterial,c.SpriteMaterial.prototype.clone=function(){var e=new c.SpriteMaterial;return c.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.rotation=this.rotation,e.fog=this.fog,e},c.Texture=function(e,t,r,n,o,i,a,s,l){Object.defineProperty(this,"id",{value:c.TextureIdCount++}),this.uuid=c.Math.generateUUID(),this.name="",this.image=void 0!==e?e:c.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:c.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:c.ClampToEdgeWrapping,this.wrapT=void 0!==n?n:c.ClampToEdgeWrapping,this.magFilter=void 0!==o?o:c.LinearFilter,this.minFilter=void 0!==i?i:c.LinearMipMapLinearFilter,this.anisotropy=void 0!==l?l:1,this.format=void 0!==a?a:c.RGBAFormat,this.type=void 0!==s?s:c.UnsignedByteType,this.offset=new c.Vector2(0,0),this.repeat=new c.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this._needsUpdate=!1,this.onUpdate=null},c.Texture.DEFAULT_IMAGE=void 0,c.Texture.DEFAULT_MAPPING=c.UVMapping,c.Texture.prototype=Object.defineProperties({constructor:c.Texture,clone:function(e){return void 0===e&&(e=new c.Texture),e.image=this.image,e.mipmaps=this.mipmaps.slice(0),e.mapping=this.mapping,e.wrapS=this.wrapS,e.wrapT=this.wrapT,e.magFilter=this.magFilter,e.minFilter=this.minFilter,e.anisotropy=this.anisotropy,e.format=this.format,e.type=this.type,e.offset.copy(this.offset),e.repeat.copy(this.repeat),e.generateMipmaps=this.generateMipmaps,e.premultiplyAlpha=this.premultiplyAlpha,e.flipY=this.flipY,e.unpackAlignment=this.unpackAlignment,e},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},{needsUpdate:{get:function(){return this._needsUpdate},set:function(e){e===!0&&this.update(),this._needsUpdate=e},configurable:!0,enumerable:!0}}),c.EventDispatcher.prototype.apply(c.Texture.prototype),c.TextureIdCount=0,c.CubeTexture=function(e,t,r,n,o,i,a,s,l){t=void 0!==t?t:c.CubeReflectionMapping,c.Texture.call(this,e,t,r,n,o,i,a,s,l),this.images=e},c.CubeTexture.prototype=Object.create(c.Texture.prototype),c.CubeTexture.prototype.constructor=c.CubeTexture,c.CubeTexture.clone=function(e){return void 0===e&&(e=new c.CubeTexture),c.Texture.prototype.clone.call(this,e),e.images=this.images,e},c.CompressedTexture=function(e,t,r,n,o,i,a,s,l,h,u){c.Texture.call(this,null,i,a,s,l,h,n,o,u),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1},c.CompressedTexture.prototype=Object.create(c.Texture.prototype),c.CompressedTexture.prototype.constructor=c.CompressedTexture,c.CompressedTexture.prototype.clone=function(){var e=new c.CompressedTexture;return c.Texture.prototype.clone.call(this,e),e},c.DataTexture=function(e,t,r,n,o,i,a,s,l,h,u){c.Texture.call(this,null,i,a,s,l,h,n,o,u),this.image={data:e,width:t,height:r}},c.DataTexture.prototype=Object.create(c.Texture.prototype),c.DataTexture.prototype.constructor=c.DataTexture,c.DataTexture.prototype.clone=function(){var e=new c.DataTexture;return c.Texture.prototype.clone.call(this,e),e},c.VideoTexture=function(e,t,r,n,o,i,a,s,l){c.Texture.call(this,e,t,r,n,o,i,a,s,l),this.generateMipmaps=!1;var h=this,u=function(e){var t=function(){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(){requestAnimationFrame(u),e.readyState===e.HAVE_ENOUGH_DATA&&(h.needsUpdate=!0)});u()},c.VideoTexture.prototype=Object.create(c.Texture.prototype),c.VideoTexture.prototype.constructor=c.VideoTexture,c.Group=function(){c.Object3D.call(this),this.type="Group"},c.Group.prototype=Object.create(c.Object3D.prototype),c.Group.prototype.constructor=c.Group,c.PointCloud=function(e,t){c.Object3D.call(this),this.type="PointCloud",this.geometry=void 0!==e?e:new c.Geometry,this.material=void 0!==t?t:new c.PointCloudMaterial({color:16777215*Math.random()})},c.PointCloud.prototype=Object.create(c.Object3D.prototype),c.PointCloud.prototype.constructor=c.PointCloud,c.PointCloud.prototype.raycast=function(){var e=new c.Matrix4,t=new c.Ray;return function(r,n){var o=this,i=o.geometry,a=r.params.PointCloud.threshold;if(e.getInverse(this.matrixWorld),t.copy(r.ray).applyMatrix4(e),null===i.boundingBox||t.isIntersectionBox(i.boundingBox)!==!1){var s=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=new c.Vector3,h=function(e,i){var a=t.distanceToPoint(e);if(s>a){var l=t.closestPointToPoint(e);l.applyMatrix4(o.matrixWorld);var h=r.ray.origin.distanceTo(l);n.push({distance:h,distanceToRay:a,point:l.clone(),index:i,face:null,object:o})}};if(i instanceof c.BufferGeometry){var u=i.attributes,f=u.position.array;if(void 0!==u.index){var d=u.index.array,p=i.offsets;if(0===p.length){var m={start:0,count:d.length,index:0};p=[m]}for(var g=0,y=p.length;y>g;++g)for(var v=p[g].start,_=p[g].count,b=p[g].index,w=v,x=v+_;x>w;w++){var T=b+d[w];l.fromArray(f,3*T),h(l,T)}}else for(var M=f.length/3,w=0;M>w;w++)l.set(f[3*w],f[3*w+1],f[3*w+2]),h(l,w)}else for(var S=this.geometry.vertices,w=0;w<S.length;w++)h(S[w],w)}}}(),c.PointCloud.prototype.clone=function(e){return void 0===e&&(e=new c.PointCloud(this.geometry,this.material)),c.Object3D.prototype.clone.call(this,e),e},c.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud."),new c.PointCloud(e,t)},c.Line=function(e,t,r){c.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new c.Geometry,this.material=void 0!==t?t:new c.LineBasicMaterial({color:16777215*Math.random()}),this.mode=void 0!==r?r:c.LineStrip},c.LineStrip=0,c.LinePieces=1,c.Line.prototype=Object.create(c.Object3D.prototype),c.Line.prototype.constructor=c.Line,c.Line.prototype.raycast=function(){var e=new c.Matrix4,t=new c.Ray,r=new c.Sphere;return function(n,o){var i=n.linePrecision,a=i*i,s=this.geometry;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),n.ray.isIntersectionSphere(r)!==!1){e.getInverse(this.matrixWorld),t.copy(n.ray).applyMatrix4(e);var l=new c.Vector3,h=new c.Vector3,u=new c.Vector3,f=new c.Vector3,d=this.mode===c.LineStrip?1:2;if(s instanceof c.BufferGeometry){var p=s.attributes;if(void 0!==p.index){var m=p.index.array,g=p.position.array,y=s.offsets;0===y.length&&(y=[{start:0,count:m.length,index:0}]);for(var v=0;v<y.length;v++)for(var _=y[v].start,b=y[v].count,w=y[v].index,x=_;_+b-1>x;x+=d){var T=w+m[x],M=w+m[x+1];l.fromArray(g,3*T),h.fromArray(g,3*M);var S=t.distanceSqToSegment(l,h,f,u);if(!(S>a)){var C=t.origin.distanceTo(f);C<n.near||C>n.far||o.push({distance:C,point:u.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this})}}}else for(var g=p.position.array,x=0;x<g.length/3-1;x+=d){l.fromArray(g,3*x),h.fromArray(g,3*x+3);var S=t.distanceSqToSegment(l,h,f,u);if(!(S>a)){var C=t.origin.distanceTo(f);C<n.near||C>n.far||o.push({distance:C,point:u.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this})}}}else if(s instanceof c.Geometry)for(var E=s.vertices,A=E.length,x=0;A-1>x;x+=d){var S=t.distanceSqToSegment(E[x],E[x+1],f,u);if(!(S>a)){var C=t.origin.distanceTo(f);C<n.near||C>n.far||o.push({distance:C,point:u.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this})}}}}}(),c.Line.prototype.clone=function(e){return void 0===e&&(e=new c.Line(this.geometry,this.material,this.mode)),c.Object3D.prototype.clone.call(this,e),e},c.Mesh=function(e,t){c.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new c.Geometry,this.material=void 0!==t?t:new c.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},c.Mesh.prototype=Object.create(c.Object3D.prototype),c.Mesh.prototype.constructor=c.Mesh,c.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;t>e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},c.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},c.Mesh.prototype.raycast=function(){var e=new c.Matrix4,t=new c.Ray,r=new c.Sphere,n=new c.Vector3,o=new c.Vector3,i=new c.Vector3;return function(a,s){var l=this.geometry;if(null===l.boundingSphere&&l.computeBoundingSphere(),r.copy(l.boundingSphere),r.applyMatrix4(this.matrixWorld),a.ray.isIntersectionSphere(r)!==!1&&(e.getInverse(this.matrixWorld),t.copy(a.ray).applyMatrix4(e),null===l.boundingBox||t.isIntersectionBox(l.boundingBox)!==!1))if(l instanceof c.BufferGeometry){var h=this.material;if(void 0===h)return;var u,f,d,p=l.attributes,m=a.precision;if(void 0!==p.index){var g=p.index.array,y=p.position.array,v=l.offsets;0===v.length&&(v=[{start:0,count:g.length,index:0}]);for(var _=0,b=v.length;b>_;++_)for(var w=v[_].start,x=v[_].count,T=v[_].index,M=w,S=w+x;S>M;M+=3){if(u=T+g[M],f=T+g[M+1],d=T+g[M+2],n.fromArray(y,3*u),o.fromArray(y,3*f),i.fromArray(y,3*d),h.side===c.BackSide)var C=t.intersectTriangle(i,o,n,!0);else var C=t.intersectTriangle(n,o,i,h.side!==c.DoubleSide);if(null!==C){C.applyMatrix4(this.matrixWorld);var E=a.ray.origin.distanceTo(C);m>E||E<a.near||E>a.far||s.push({distance:E,point:C,face:new c.Face3(u,f,d,c.Triangle.normal(n,o,i)),faceIndex:null,object:this})}}}else for(var y=p.position.array,M=0,A=0,S=y.length;S>M;M+=3,A+=9){if(u=M,f=M+1,d=M+2,n.fromArray(y,A),o.fromArray(y,A+3),i.fromArray(y,A+6),h.side===c.BackSide)var C=t.intersectTriangle(i,o,n,!0);else var C=t.intersectTriangle(n,o,i,h.side!==c.DoubleSide);if(null!==C){C.applyMatrix4(this.matrixWorld);var E=a.ray.origin.distanceTo(C);m>E||E<a.near||E>a.far||s.push({distance:E,point:C,face:new c.Face3(u,f,d,c.Triangle.normal(n,o,i)),faceIndex:null,object:this})}}}else if(l instanceof c.Geometry)for(var u,f,d,L=this.material instanceof c.MeshFaceMaterial,P=L===!0?this.material.materials:null,m=a.precision,F=l.vertices,D=0,R=l.faces.length;R>D;D++){var O=l.faces[D],h=L===!0?P[O.materialIndex]:this.material;if(void 0!==h){if(u=F[O.a],f=F[O.b],d=F[O.c],h.morphTargets===!0){var k=l.morphTargets,N=this.morphTargetInfluences;n.set(0,0,0),o.set(0,0,0),i.set(0,0,0);for(var B=0,U=k.length;U>B;B++){var I=N[B];if(0!==I){var V=k[B].vertices;n.x+=(V[O.a].x-u.x)*I,n.y+=(V[O.a].y-u.y)*I,n.z+=(V[O.a].z-u.z)*I,o.x+=(V[O.b].x-f.x)*I,o.y+=(V[O.b].y-f.y)*I,o.z+=(V[O.b].z-f.z)*I,i.x+=(V[O.c].x-d.x)*I,i.y+=(V[O.c].y-d.y)*I,i.z+=(V[O.c].z-d.z)*I}}n.add(u),o.add(f),i.add(d),u=n,f=o,d=i}if(h.side===c.BackSide)var C=t.intersectTriangle(d,f,u,!0);else var C=t.intersectTriangle(u,f,d,h.side!==c.DoubleSide);if(null!==C){C.applyMatrix4(this.matrixWorld);var E=a.ray.origin.distanceTo(C);m>E||E<a.near||E>a.far||s.push({distance:E,point:C,face:O,faceIndex:D,object:this})}}}}}(),c.Mesh.prototype.clone=function(e,t){return void 0===e&&(e=new c.Mesh(this.geometry,this.material)),c.Object3D.prototype.clone.call(this,e,t),e},c.Bone=function(e){c.Object3D.call(this),this.skin=e},c.Bone.prototype=Object.create(c.Object3D.prototype),c.Bone.prototype.constructor=c.Bone,c.Skeleton=function(e,t,r){if(this.useVertexTexture=void 0!==r?r:!0,this.identityMatrix=new c.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var n;n=this.bones.length>256?64:this.bones.length>64?32:this.bones.length>16?16:8,this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new c.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,c.RGBAFormat,c.FloatType),this.boneTexture.minFilter=c.NearestFilter,this.boneTexture.magFilter=c.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var o=0,i=this.bones.length;i>o;o++)this.boneInverses.push(new c.Matrix4)}},c.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var r=new c.Matrix4;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},c.Skeleton.prototype.pose=function(){for(var e,t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&(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))},c.Skeleton.prototype.update=function(){var e=new c.Matrix4;return function(){for(var t=0,r=this.bones.length;r>t;t++){var n=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(n,this.boneInverses[t]),e.flattenToArrayOffset(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),c.SkinnedMesh=function(e,t,r){c.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new c.Matrix4,this.bindMatrixInverse=new c.Matrix4;var n=[];if(this.geometry&&void 0!==this.geometry.bones){for(var o,i,a,s,l,h=0,u=this.geometry.bones.length;u>h;++h)i=this.geometry.bones[h],a=i.pos,s=i.rotq,l=i.scl,o=new c.Bone(this),n.push(o),o.name=i.name,o.position.set(a[0],a[1],a[2]),o.quaternion.set(s[0],s[1],s[2],s[3]),void 0!==l?o.scale.set(l[0],l[1],l[2]):o.scale.set(1,1,1);for(var h=0,u=this.geometry.bones.length;u>h;++h)i=this.geometry.bones[h],-1!==i.parent?n[i.parent].add(n[h]):this.add(n[h])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new c.Skeleton(n,void 0,r))},c.SkinnedMesh.prototype=Object.create(c.Mesh.prototype),c.SkinnedMesh.prototype.constructor=c.SkinnedMesh,c.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},c.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},c.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof c.Geometry)for(var e=0;e<this.geometry.skinIndices.length;e++){var t=this.geometry.skinWeights[e],r=1/t.lengthManhattan();r!==1/0?t.multiplyScalar(r):t.set(1)}},c.SkinnedMesh.prototype.updateMatrixWorld=function(e){c.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unreckognized bindMode: "+this.bindMode)},c.SkinnedMesh.prototype.clone=function(e){return void 0===e&&(e=new c.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)),c.Mesh.prototype.clone.call(this,e),e},c.MorphAnimMesh=function(e,t){c.Mesh.call(this,e,t),this.type="MorphAnimMesh",this.duration=1e3,this.mirroredLoop=!1,this.time=0,this.lastKeyframe=0,this.currentKeyframe=0,this.direction=1,this.directionBackwards=!1,this.setFrameRange(0,this.geometry.morphTargets.length-1)},c.MorphAnimMesh.prototype=Object.create(c.Mesh.prototype),c.MorphAnimMesh.prototype.constructor=c.MorphAnimMesh,c.MorphAnimMesh.prototype.setFrameRange=function(e,t){this.startKeyframe=e,this.endKeyframe=t,this.length=this.endKeyframe-this.startKeyframe+1},c.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1,this.directionBackwards=!1},c.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1,this.directionBackwards=!0},c.MorphAnimMesh.prototype.parseAnimations=function(){var e=this.geometry;e.animations||(e.animations={});for(var t,r=e.animations,n=/([a-z]+)_?(\d+)/,o=0,i=e.morphTargets.length;i>o;o++){var a=e.morphTargets[o],s=a.name.match(n);if(s&&s.length>1){var l=s[1];s[2];r[l]||(r[l]={start:1/0,end:-(1/0)});var h=r[l];o<h.start&&(h.start=o),o>h.end&&(h.end=o),t||(t=l)}}e.firstAnimation=t},c.MorphAnimMesh.prototype.setAnimationLabel=function(e,t,r){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[e]={start:t,end:r}},c.MorphAnimMesh.prototype.playAnimation=function(e,t){var r=this.geometry.animations[e];r?(this.setFrameRange(r.start,r.end),this.duration=1e3*((r.end-r.start)/t),this.time=0):console.warn("animation["+e+"] undefined")},c.MorphAnimMesh.prototype.updateAnimation=function(e){var t=this.duration/this.length;this.time+=this.direction*e,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var r=this.startKeyframe+c.Math.clamp(Math.floor(this.time/t),0,this.length-1);r!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[r]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=r);var n=this.time%t/t;this.directionBackwards&&(n=1-n),this.morphTargetInfluences[this.currentKeyframe]=n,this.morphTargetInfluences[this.lastKeyframe]=1-n},c.MorphAnimMesh.prototype.interpolateTargets=function(e,t,r){for(var n=this.morphTargetInfluences,o=0,i=n.length;i>o;o++)n[o]=0;e>-1&&(n[e]=1-r),t>-1&&(n[t]=r)},c.MorphAnimMesh.prototype.clone=function(e){return void 0===e&&(e=new c.MorphAnimMesh(this.geometry,this.material)),e.duration=this.duration,e.mirroredLoop=this.mirroredLoop,e.time=this.time,e.lastKeyframe=this.lastKeyframe,e.currentKeyframe=this.currentKeyframe,e.direction=this.direction,e.directionBackwards=this.directionBackwards,c.Mesh.prototype.clone.call(this,e),e},c.LOD=function(){c.Object3D.call(this),this.objects=[]},c.LOD.prototype=Object.create(c.Object3D.prototype),c.LOD.prototype.constructor=c.LOD,c.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=0;r<this.objects.length&&!(t<this.objects[r].distance);r++);this.objects.splice(r,0,{distance:t,object:e}),this.add(e)},c.LOD.prototype.getObjectForDistance=function(e){for(var t=1,r=this.objects.length;r>t&&!(e<this.objects[t].distance);t++);return this.objects[t-1].object},c.LOD.prototype.raycast=function(){var e=new c.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(e);this.getObjectForDistance(n).raycast(t,r)}}(),c.LOD.prototype.update=function(){var e=new c.Vector3,t=new c.Vector3;return function(r){if(this.objects.length>1){e.setFromMatrixPosition(r.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);this.objects[0].object.visible=!0;for(var o=1,i=this.objects.length;i>o&&n>=this.objects[o].distance;o++)this.objects[o-1].object.visible=!1,this.objects[o].object.visible=!0;for(;i>o;o++)this.objects[o].object.visible=!1}}}(),c.LOD.prototype.clone=function(e){void 0===e&&(e=new c.LOD),c.Object3D.prototype.clone.call(this,e);for(var t=0,r=this.objects.length;r>t;t++){var n=this.objects[t].object.clone();n.visible=0===t,e.addLevel(n,this.objects[t].distance)}return e},c.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]),r=new Float32Array([0,0,1,0,1,1,0,1]),n=new c.BufferGeometry;return n.addAttribute("index",new c.BufferAttribute(e,1)),n.addAttribute("position",new c.BufferAttribute(t,3)),n.addAttribute("uv",new c.BufferAttribute(r,2)),function(e){c.Object3D.call(this),this.type="Sprite",this.geometry=n,this.material=void 0!==e?e:new c.SpriteMaterial}}(),c.Sprite.prototype=Object.create(c.Object3D.prototype),c.Sprite.prototype.constructor=c.Sprite,c.Sprite.prototype.raycast=function(){var e=new c.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var n=t.ray.distanceToPoint(e);n>this.scale.x||r.push({distance:n,point:this.position,face:null,object:this})}}(),c.Sprite.prototype.clone=function(e){return void 0===e&&(e=new c.Sprite(this.material)),c.Object3D.prototype.clone.call(this,e),e},c.Particle=c.Sprite,c.LensFlare=function(e,t,r,n,o){c.Object3D.call(this),this.lensFlares=[],this.positionScreen=new c.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,n,o)},c.LensFlare.prototype=Object.create(c.Object3D.prototype),c.LensFlare.prototype.constructor=c.LensFlare,c.LensFlare.prototype.add=function(e,t,r,n,o,i){void 0===t&&(t=-1),void 0===r&&(r=0),void 0===i&&(i=1),void 0===o&&(o=new c.Color(16777215)),void 0===n&&(n=c.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:e,size:t,distance:r,x:0,y:0,z:0,scale:1,rotation:1,opacity:i,color:o,blending:n})},c.LensFlare.prototype.updateLensFlares=function(){var e,t,r=this.lensFlares.length,n=2*-this.positionScreen.x,o=2*-this.positionScreen.y;for(e=0;r>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+n*t.distance,t.y=this.positionScreen.y+o*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},c.Scene=function(){c.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},c.Scene.prototype=Object.create(c.Object3D.prototype),c.Scene.prototype.constructor=c.Scene,c.Scene.prototype.clone=function(e){return void 0===e&&(e=new c.Scene),c.Object3D.prototype.clone.call(this,e),null!==this.fog&&(e.fog=this.fog.clone()),null!==this.overrideMaterial&&(e.overrideMaterial=this.overrideMaterial.clone()),e.autoUpdate=this.autoUpdate,e.matrixAutoUpdate=this.matrixAutoUpdate,e},c.Fog=function(e,t,r){this.name="",this.color=new c.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3},c.Fog.prototype.clone=function(){return new c.Fog(this.color.getHex(),this.near,this.far)},c.FogExp2=function(e,t){this.name="",this.color=new c.Color(e),this.density=void 0!==t?t:25e-5},c.FogExp2.prototype.clone=function(){return new c.FogExp2(this.color.getHex(),this.density)},c.ShaderChunk={},c.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n if ( gl_FragColor.a < ALPHATEST ) discard;\n\n#endif\n",c.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n vLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n vec3 dirVector = normalize( lDirection.xyz );\n\n float dotProduct = dot( transformedNormal, dirVector );\n vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n #endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float lDistance = 1.0;\n if ( pointLightDistance[ i ] > 0.0 )\n lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\n\n lVector = normalize( lVector );\n float dotProduct = dot( transformedNormal, lVector );\n\n vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n\n #endif\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n float lDistance = 1.0;\n if ( spotLightDistance[ i ] > 0.0 )\n lDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\n\n lVector = normalize( lVector );\n\n float dotProduct = dot( transformedNormal, lVector );\n vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n\n #endif\n\n }\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\n vec3 lVector = normalize( lDirection.xyz );\n\n float dotProduct = dot( transformedNormal, lVector );\n\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n #endif\n\n }\n\n#endif\n\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n\n#ifdef DOUBLE_SIDED\n\n vLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n\n#endif",c.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n uniform sampler2D map;\n\n#endif",c.ShaderChunk.default_vertex="#ifdef USE_SKINNING\n\n vec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",c.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n varying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n uniform sampler2D map;\n\n#endif",c.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\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\n #ifdef USE_MORPHNORMALS\n\n vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n #else\n\n vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n #endif\n\n#endif\n",c.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n varying float vFragDepth;\n\n #endif\n\n uniform float logDepthBufFC;\n\n#endif",c.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n\n#endif",c.ShaderChunk.lights_phong_fragment="vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef DOUBLE_SIDED\n\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n vec3 pointDiffuse = vec3( 0.0 );\n vec3 pointSpecular = vec3( 0.0 );\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float lDistance = 1.0;\n if ( pointLightDistance[ i ] > 0.0 )\n lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\n\n lVector = normalize( lVector );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float pointDiffuseWeightFull = max( dotProduct, 0.0 );\n float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float pointDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n pointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\n\n // specular\n\n vec3 pointHalfVector = normalize( lVector + viewPosition );\n float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n vec3 spotDiffuse = vec3( 0.0 );\n vec3 spotSpecular = vec3( 0.0 );\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float lDistance = 1.0;\n if ( spotLightDistance[ i ] > 0.0 )\n lDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\n\n lVector = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float spotDiffuseWeightFull = max( dotProduct, 0.0 );\n float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float spotDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n spotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\n\n // specular\n\n vec3 spotHalfVector = normalize( lVector + viewPosition );\n float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n vec3 dirDiffuse = vec3( 0.0 );\n vec3 dirSpecular = vec3( 0.0 );\n\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n vec3 dirVector = normalize( lDirection.xyz );\n\n // diffuse\n\n float dotProduct = dot( normal, dirVector );\n\n #ifdef WRAP_AROUND\n\n float dirDiffuseWeightFull = max( dotProduct, 0.0 );\n float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n dirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n\n // specular\n\n vec3 dirHalfVector = normalize( dirVector + viewPosition );\n float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n /*\n // fresnel term from skin shader\n const float F0 = 0.128;\n\n float base = 1.0 - dot( viewPosition, dirHalfVector );\n float exponential = pow( base, 5.0 );\n\n float fresnel = exponential + F0 * ( 1.0 - exponential );\n */\n\n /*\n // fresnel term from fresnel shader\n const float mFresnelBias = 0.08;\n const float mFresnelScale = 0.3;\n const float mFresnelPower = 5.0;\n\n float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n */\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n // dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n vec3 hemiDiffuse = vec3( 0.0 );\n vec3 hemiSpecular = vec3( 0.0 );\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\n vec3 lVector = normalize( lDirection.xyz );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n hemiDiffuse += diffuse * hemiColor;\n\n // specular (sky light)\n\n vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n // specular (ground light)\n\n vec3 lVectorGround = -lVector;\n\n vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n float dotProductGround = dot( normal, lVectorGround );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n }\n\n#endif\n\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n\n#if MAX_DIR_LIGHTS > 0\n\n totalDiffuse += dirDiffuse;\n totalSpecular += dirSpecular;\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n totalDiffuse += hemiDiffuse;\n totalSpecular += hemiSpecular;\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n totalDiffuse += pointDiffuse;\n totalSpecular += pointSpecular;\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n totalDiffuse += spotDiffuse;\n totalSpecular += spotSpecular;\n\n#endif\n\n#ifdef METAL\n\n gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n\n#else\n\n gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n\n#endif",
c.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n uniform vec3 fogColor;\n\n #ifdef FOG_EXP2\n\n uniform float fogDensity;\n\n #else\n\n uniform float fogNear;\n uniform float fogFar;\n #endif\n\n#endif",c.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n vec3 morphedNormal = vec3( 0.0 );\n\n morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n morphedNormal += normal;\n\n#endif",c.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n uniform float reflectivity;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n uniform float refractionRatio;\n\n #else\n\n varying vec3 vReflect;\n\n #endif\n\n#endif\n",c.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",c.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n // Per-Pixel Tangent Space Normal Mapping\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\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\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\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 }\n\n#endif\n",c.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n",c.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n uniform sampler2D lightMap;\n\n#endif",c.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n }\n\n#endif",c.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n vWorldPosition = worldPosition.xyz;\n\n#endif",c.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n vec4 texelColor = texture2D( map, vUv );\n\n #ifdef GAMMA_INPUT\n\n texelColor.xyz *= texelColor.xyz;\n\n #endif\n\n gl_FragColor = gl_FragColor * texelColor;\n\n#endif",c.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n vUv2 = uv2;\n\n#endif",c.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n gl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n\n#endif",c.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif\n",c.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n #ifdef GAMMA_INPUT\n\n vColor = color * color;\n\n #else\n\n vColor = color;\n\n #endif\n\n#endif",c.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n #ifdef USE_MORPHTARGETS\n\n vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n #endif\n\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\n#endif\n",c.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n varying vec3 vReflect;\n\n uniform float refractionRatio;\n\n#endif\n",c.ShaderChunk.linear_to_gamma_fragment="#ifdef GAMMA_OUTPUT\n\n gl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n\n#endif",c.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif",c.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\n\nuniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform vec3 wrapRGB;\n\n#endif\n",c.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n varying vec2 vUv;\n uniform vec4 offsetRepeat;\n\n#endif\n",c.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n // http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\n // Transforming Normal Vectors with the Inverse Transformation\n\n vec3 worldNormal = normalize( vec3( vec4( normal, 0.0 ) * viewMatrix ) );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n #else\n\n vec3 reflectVec = vReflect;\n\n #endif\n\n #ifdef DOUBLE_SIDED\n float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #else\n float flipNormal = 1.0;\n #endif\n\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = clamp( flipNormal * reflectVec.y * 0.5 + 0.5, 0.0, 1.0);\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * 0.15915494309189533576888376337251 + 0.5; // reciprocal( 2 PI ) + 0.5\n vec4 envColor = texture2D( envMap, sampleUV );\n \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\n #ifdef GAMMA_INPUT\n\n envColor.xyz *= envColor.xyz;\n\n #endif\n\n #ifdef ENVMAP_BLENDING_MULTIPLY\n\n gl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_MIX )\n\n gl_FragColor.xyz = mix( gl_FragColor.xyz, envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_ADD )\n\n gl_FragColor.xyz += envColor.xyz * specularStrength * reflectivity;\n\n #endif\n\n#endif\n",c.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n uniform sampler2D specularMap;\n\n#endif",c.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n gl_Position.z = log2(max(1e-6, gl_Position.w + 1.0)) * logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n vFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n #endif\n\n#endif",c.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n #ifndef USE_MORPHNORMALS\n\n uniform float morphTargetInfluences[ 8 ];\n\n #else\n\n uniform float morphTargetInfluences[ 4 ];\n\n #endif\n\n#endif",c.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n\n#else\n\n specularStrength = 1.0;\n\n#endif",c.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n #else\n\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n\n #endif\n\n #ifdef FOG_EXP2\n\n const float LOG2 = 1.442695;\n float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\n fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n\n #else\n\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n\n #endif\n \n gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n\n#endif",c.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n\n // Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n\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\n return vec2( dBx, dBy );\n\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm; // normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 );\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n\n }\n\n#endif",c.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\n\n vec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n vec3 objectNormal = morphedNormal;\n\n#else\n\n vec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n objectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",c.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",c.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\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\n#endif",c.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",c.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n gl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n\n#endif",c.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n uniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",c.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n gl_FragColor = gl_FragColor * vec4( vColor, 1.0 );\n\n#endif",c.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n vec3 morphed = vec3( 0.0 );\n morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n #ifndef USE_MORPHNORMALS\n\n morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n #endif\n\n morphed += position;\n\n#endif",c.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n vec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\n worldNormal = normalize( worldNormal );\n\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vReflect = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n#endif\n",c.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n #ifdef SHADOWMAP_DEBUG\n\n vec3 frustumColors[3];\n frustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n frustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n frustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n #endif\n\n #ifdef SHADOWMAP_CASCADE\n\n int inFrustumCount = 0;\n\n #endif\n\n float fDepth;\n vec3 shadowColor = vec3( 1.0 );\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n // if ( something && something ) breaks ATI OpenGL shader compiler\n // if ( all( something, something ) ) using this instead\n\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\n // don't shadow pixels outside of light frustum\n // use just first frustum (for cascades)\n // don't shadow pixels behind far plane of light frustum\n\n #ifdef SHADOWMAP_CASCADE\n\n inFrustumCount += int( inFrustum );\n bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n #else\n\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n #endif\n\n bool frustumTest = all( frustumTestVec );\n\n if ( frustumTest ) {\n\n shadowCoord.z += shadowBias[ i ];\n\n #if defined( SHADOWMAP_TYPE_PCF )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n /*\n // nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n // must enroll loop manually\n\n for ( float y = -1.25; y <= 1.25; y += 1.25 )\n for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n // doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n //vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n shadow += 1.0;\n\n }\n\n shadow /= 9.0;\n\n */\n\n const float shadowDelta = 1.0 / 9.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.25 * xPixelOffset;\n float dy0 = -1.25 * yPixelOffset;\n float dx1 = 1.25 * xPixelOffset;\n float dy1 = 1.25 * yPixelOffset;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.0 * xPixelOffset;\n float dy0 = -1.0 * yPixelOffset;\n float dx1 = 1.0 * xPixelOffset;\n float dy1 = 1.0 * yPixelOffset;\n\n mat3 shadowKernel;\n mat3 depthKernel;\n\n depthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n depthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n depthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n depthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n depthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n depthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n depthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n depthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n depthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n vec3 shadowZ = vec3( shadowCoord.z );\n shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n shadowKernel[0] *= vec3(0.25);\n\n shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n shadowKernel[1] *= vec3(0.25);\n\n shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n shadowKernel[2] *= vec3(0.25);\n\n vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n vec4 shadowValues;\n shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n shadow = dot( shadowValues, vec4( 1.0 ) );\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #else\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n\n // spot with multiple shadows is darker\n\n shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n // spot with multiple shadows has the same color as single shadow spot\n\n // shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n #endif\n\n }\n\n\n #ifdef SHADOWMAP_DEBUG\n\n #ifdef SHADOWMAP_CASCADE\n\n if ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n\n #else\n\n if ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n\n #endif\n\n #endif\n\n }\n\n #ifdef GAMMA_OUTPUT\n\n shadowColor *= shadowColor;\n\n #endif\n\n gl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n\n#endif\n",c.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n #ifdef USE_SKINNING\n\n vec4 worldPosition = modelMatrix * skinned;\n\n #elif defined( USE_MORPHTARGETS )\n\n vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n #endif\n\n#endif\n",c.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n uniform sampler2D shadowMap[ MAX_SHADOWS ];\n uniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n uniform float shadowDarkness[ MAX_SHADOWS ];\n uniform float shadowBias[ MAX_SHADOWS ];\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n float unpackDepth( const in vec4 rgba_depth ) {\n\n const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n float depth = dot( rgba_depth, bit_shift );\n return depth;\n\n }\n\n#endif",c.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n\n #ifdef BONE_TEXTURE\n\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n\n mat4 getBoneMatrix( const in float i ) {\n\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n\n y = dy * ( y + 0.5 );\n\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\n mat4 bone = mat4( v1, v2, v3, v4 );\n\n return bone;\n\n }\n\n #else\n\n uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n mat4 getBoneMatrix( const in float i ) {\n\n mat4 bone = boneGlobalMatrices[ int(i) ];\n return bone;\n\n }\n\n #endif\n\n#endif\n",c.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n uniform float logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n #extension GL_EXT_frag_depth : enable\n varying float vFragDepth;\n\n #endif\n\n#endif",c.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n gl_FragColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",c.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n uniform sampler2D alphaMap;\n\n#endif\n",c.UniformsUtils={merge:function(e){for(var t={},r=0;r<e.length;r++){var n=this.clone(e[r]);for(var o in n)t[o]=n[o]}return t},clone:function(e){var t={};for(var r in e){t[r]={};for(var n in e[r]){var o=e[r][n];o instanceof c.Color||o instanceof c.Vector2||o instanceof c.Vector3||o instanceof c.Vector4||o instanceof c.Matrix4||o instanceof c.Texture?t[r][n]=o.clone():o instanceof Array?t[r][n]=o.slice():t[r][n]=o}}return t}},c.UniformsLib={common:{diffuse:{type:"c",value:new c.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new c.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new c.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new c.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new c.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new c.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}},c.ShaderLib={basic:{uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.shadowmap]),vertexShader:[c.ShaderChunk.map_pars_vertex,c.ShaderChunk.lightmap_pars_vertex,c.ShaderChunk.envmap_pars_vertex,c.ShaderChunk.color_pars_vertex,c.ShaderChunk.morphtarget_pars_vertex,c.ShaderChunk.skinning_pars_vertex,c.ShaderChunk.shadowmap_pars_vertex,c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",c.ShaderChunk.map_vertex,c.ShaderChunk.lightmap_vertex,c.ShaderChunk.color_vertex,c.ShaderChunk.skinbase_vertex," #ifdef USE_ENVMAP",c.ShaderChunk.morphnormal_vertex,c.ShaderChunk.skinnormal_vertex,c.ShaderChunk.defaultnormal_vertex," #endif",c.ShaderChunk.morphtarget_vertex,c.ShaderChunk.skinning_vertex,c.ShaderChunk.default_vertex,c.ShaderChunk.logdepthbuf_vertex,c.ShaderChunk.worldpos_vertex,c.ShaderChunk.envmap_vertex,c.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;",c.ShaderChunk.color_pars_fragment,c.ShaderChunk.map_pars_fragment,c.ShaderChunk.alphamap_pars_fragment,c.ShaderChunk.lightmap_pars_fragment,c.ShaderChunk.envmap_pars_fragment,c.ShaderChunk.fog_pars_fragment,c.ShaderChunk.shadowmap_pars_fragment,c.ShaderChunk.specularmap_pars_fragment,c.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = vec4( diffuse, opacity );",c.ShaderChunk.logdepthbuf_fragment,c.ShaderChunk.map_fragment,c.ShaderChunk.alphamap_fragment,c.ShaderChunk.alphatest_fragment,c.ShaderChunk.specularmap_fragment,c.ShaderChunk.lightmap_fragment,c.ShaderChunk.color_fragment,c.ShaderChunk.envmap_fragment,c.ShaderChunk.shadowmap_fragment,c.ShaderChunk.linear_to_gamma_fragment,c.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.lights,c.UniformsLib.shadowmap,{ambient:{type:"c",value:new c.Color(16777215)},emissive:{type:"c",value:new c.Color(0)},wrapRGB:{type:"v3",value:new c.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;","#endif",c.ShaderChunk.map_pars_vertex,c.ShaderChunk.lightmap_pars_vertex,c.ShaderChunk.envmap_pars_vertex,c.ShaderChunk.lights_lambert_pars_vertex,c.ShaderChunk.color_pars_vertex,c.ShaderChunk.morphtarget_pars_vertex,c.ShaderChunk.skinning_pars_vertex,c.ShaderChunk.shadowmap_pars_vertex,c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",c.ShaderChunk.map_vertex,c.ShaderChunk.lightmap_vertex,c.ShaderChunk.color_vertex,c.ShaderChunk.morphnormal_vertex,c.ShaderChunk.skinbase_vertex,c.ShaderChunk.skinnormal_vertex,c.ShaderChunk.defaultnormal_vertex,c.ShaderChunk.morphtarget_vertex,c.ShaderChunk.skinning_vertex,c.ShaderChunk.default_vertex,c.ShaderChunk.logdepthbuf_vertex,c.ShaderChunk.worldpos_vertex,c.ShaderChunk.envmap_vertex,c.ShaderChunk.lights_lambert_vertex,c.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;","#endif",c.ShaderChunk.color_pars_fragment,c.ShaderChunk.map_pars_fragment,c.ShaderChunk.alphamap_pars_fragment,c.ShaderChunk.lightmap_pars_fragment,c.ShaderChunk.envmap_pars_fragment,c.ShaderChunk.fog_pars_fragment,c.ShaderChunk.shadowmap_pars_fragment,c.ShaderChunk.specularmap_pars_fragment,c.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = vec4( vec3( 1.0 ), opacity );",c.ShaderChunk.logdepthbuf_fragment,c.ShaderChunk.map_fragment,c.ShaderChunk.alphamap_fragment,c.ShaderChunk.alphatest_fragment,c.ShaderChunk.specularmap_fragment," #ifdef DOUBLE_SIDED"," if ( gl_FrontFacing )"," gl_FragColor.xyz *= vLightFront;"," else"," gl_FragColor.xyz *= vLightBack;"," #else"," gl_FragColor.xyz *= vLightFront;"," #endif",c.ShaderChunk.lightmap_fragment,c.ShaderChunk.color_fragment,c.ShaderChunk.envmap_fragment,c.ShaderChunk.shadowmap_fragment,c.ShaderChunk.linear_to_gamma_fragment,c.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.bump,c.UniformsLib.normalmap,c.UniformsLib.fog,c.UniformsLib.lights,c.UniformsLib.shadowmap,{ambient:{type:"c",value:new c.Color(16777215)},emissive:{type:"c",value:new c.Color(0)},specular:{type:"c",value:new c.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new c.Vector3(1,1,1)}}]),vertexShader:["#define PHONG","varying vec3 vViewPosition;","varying vec3 vNormal;",c.ShaderChunk.map_pars_vertex,c.ShaderChunk.lightmap_pars_vertex,c.ShaderChunk.envmap_pars_vertex,c.ShaderChunk.lights_phong_pars_vertex,c.ShaderChunk.color_pars_vertex,c.ShaderChunk.morphtarget_pars_vertex,c.ShaderChunk.skinning_pars_vertex,c.ShaderChunk.shadowmap_pars_vertex,c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",c.ShaderChunk.map_vertex,c.ShaderChunk.lightmap_vertex,c.ShaderChunk.color_vertex,c.ShaderChunk.morphnormal_vertex,c.ShaderChunk.skinbase_vertex,c.ShaderChunk.skinnormal_vertex,c.ShaderChunk.defaultnormal_vertex," vNormal = normalize( transformedNormal );",c.ShaderChunk.morphtarget_vertex,c.ShaderChunk.skinning_vertex,c.ShaderChunk.default_vertex,c.ShaderChunk.logdepthbuf_vertex," vViewPosition = -mvPosition.xyz;",c.ShaderChunk.worldpos_vertex,c.ShaderChunk.envmap_vertex,c.ShaderChunk.lights_phong_vertex,c.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG","uniform vec3 diffuse;","uniform float opacity;","uniform vec3 ambient;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;",c.ShaderChunk.color_pars_fragment,c.ShaderChunk.map_pars_fragment,c.ShaderChunk.alphamap_pars_fragment,c.ShaderChunk.lightmap_pars_fragment,c.ShaderChunk.envmap_pars_fragment,c.ShaderChunk.fog_pars_fragment,c.ShaderChunk.lights_phong_pars_fragment,c.ShaderChunk.shadowmap_pars_fragment,c.ShaderChunk.bumpmap_pars_fragment,c.ShaderChunk.normalmap_pars_fragment,c.ShaderChunk.specularmap_pars_fragment,c.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = vec4( vec3( 1.0 ), opacity );",c.ShaderChunk.logdepthbuf_fragment,c.ShaderChunk.map_fragment,c.ShaderChunk.alphamap_fragment,c.ShaderChunk.alphatest_fragment,c.ShaderChunk.specularmap_fragment,c.ShaderChunk.lights_phong_fragment,c.ShaderChunk.lightmap_fragment,c.ShaderChunk.color_fragment,c.ShaderChunk.envmap_fragment,c.ShaderChunk.shadowmap_fragment,c.ShaderChunk.linear_to_gamma_fragment,c.ShaderChunk.fog_fragment,"}"].join("\n")
},particle_basic:{uniforms:c.UniformsUtils.merge([c.UniformsLib.particle,c.UniformsLib.shadowmap]),vertexShader:["uniform float size;","uniform float scale;",c.ShaderChunk.color_pars_vertex,c.ShaderChunk.shadowmap_pars_vertex,c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",c.ShaderChunk.color_vertex," vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );"," #ifdef USE_SIZEATTENUATION"," gl_PointSize = size * ( scale / length( mvPosition.xyz ) );"," #else"," gl_PointSize = size;"," #endif"," gl_Position = projectionMatrix * mvPosition;",c.ShaderChunk.logdepthbuf_vertex,c.ShaderChunk.worldpos_vertex,c.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;","uniform float opacity;",c.ShaderChunk.color_pars_fragment,c.ShaderChunk.map_particle_pars_fragment,c.ShaderChunk.fog_pars_fragment,c.ShaderChunk.shadowmap_pars_fragment,c.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = vec4( psColor, opacity );",c.ShaderChunk.logdepthbuf_fragment,c.ShaderChunk.map_particle_fragment,c.ShaderChunk.alphatest_fragment,c.ShaderChunk.color_fragment,c.ShaderChunk.shadowmap_fragment,c.ShaderChunk.fog_fragment,"}"].join("\n")},dashed:{uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;","attribute float lineDistance;","varying float vLineDistance;",c.ShaderChunk.color_pars_vertex,c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",c.ShaderChunk.color_vertex," vLineDistance = scale * lineDistance;"," vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );"," gl_Position = projectionMatrix * mvPosition;",c.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform float dashSize;","uniform float totalSize;","varying float vLineDistance;",c.ShaderChunk.color_pars_fragment,c.ShaderChunk.fog_pars_fragment,c.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," if ( mod( vLineDistance, totalSize ) > dashSize ) {"," discard;"," }"," gl_FragColor = vec4( diffuse, opacity );",c.ShaderChunk.logdepthbuf_fragment,c.ShaderChunk.color_fragment,c.ShaderChunk.fog_fragment,"}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[c.ShaderChunk.morphtarget_pars_vertex,c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",c.ShaderChunk.morphtarget_vertex,c.ShaderChunk.default_vertex,c.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",c.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",c.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," float depth = gl_FragDepthEXT / gl_FragCoord.w;"," #else"," float depth = gl_FragCoord.z / gl_FragCoord.w;"," #endif"," float color = 1.0 - smoothstep( mNear, mFar, depth );"," gl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",c.ShaderChunk.morphtarget_pars_vertex,c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vNormal = normalize( normalMatrix * normal );",c.ShaderChunk.morphtarget_vertex,c.ShaderChunk.default_vertex,c.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",c.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",c.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vec4 worldPosition = modelMatrix * vec4( position, 1.0 );"," vWorldPosition = worldPosition.xyz;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",c.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",c.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",c.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vec4 worldPosition = modelMatrix * vec4( position, 1.0 );"," vWorldPosition = worldPosition.xyz;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",c.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",c.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = clamp( tFlip * direction.y * -0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan( direction.z, direction.x ) * 0.15915494309189533576888376337251 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",c.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[c.ShaderChunk.morphtarget_pars_vertex,c.ShaderChunk.skinning_pars_vertex,c.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",c.ShaderChunk.skinbase_vertex,c.ShaderChunk.morphtarget_vertex,c.ShaderChunk.skinning_vertex,c.ShaderChunk.default_vertex,c.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[c.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {"," const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );"," const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );"," vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );"," res -= res.xxyz * bit_mask;"," return res;","}","void main() {",c.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );"," #else"," gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );"," #endif","}"].join("\n")}},c.WebGLRenderer=function(e){function t(e){e.__webglVertexBuffer=Be.createBuffer(),e.__webglColorBuffer=Be.createBuffer(),Ue.info.memory.geometries++}function r(e){e.__webglVertexBuffer=Be.createBuffer(),e.__webglColorBuffer=Be.createBuffer(),e.__webglLineDistanceBuffer=Be.createBuffer(),Ue.info.memory.geometries++}function n(e){e.__webglVertexBuffer=Be.createBuffer(),e.__webglNormalBuffer=Be.createBuffer(),e.__webglTangentBuffer=Be.createBuffer(),e.__webglColorBuffer=Be.createBuffer(),e.__webglUVBuffer=Be.createBuffer(),e.__webglUV2Buffer=Be.createBuffer(),e.__webglSkinIndicesBuffer=Be.createBuffer(),e.__webglSkinWeightsBuffer=Be.createBuffer(),e.__webglFaceBuffer=Be.createBuffer(),e.__webglLineBuffer=Be.createBuffer();var t=e.numMorphTargets;if(t){e.__webglMorphTargetsBuffers=[];for(var r=0,n=t;n>r;r++)e.__webglMorphTargetsBuffers.push(Be.createBuffer())}var o=e.numMorphNormals;if(o){e.__webglMorphNormalsBuffers=[];for(var r=0,n=o;n>r;r++)e.__webglMorphNormalsBuffers.push(Be.createBuffer())}Ue.info.memory.geometries++}function o(e){var t=e.geometry,r=e.material,n=t.vertices.length;if(r.attributes){void 0===t.__webglCustomAttributesList&&(t.__webglCustomAttributesList=[]);for(var o in r.attributes){var i=r.attributes[o];if(!i.__webglInitialized||i.createUniqueBuffers){i.__webglInitialized=!0;var a=1;"v2"===i.type?a=2:"v3"===i.type?a=3:"v4"===i.type?a=4:"c"===i.type&&(a=3),i.size=a,i.array=new Float32Array(n*a),i.buffer=Be.createBuffer(),i.buffer.belongsToAttribute=o,i.needsUpdate=!0}t.__webglCustomAttributesList.push(i)}}}function i(e,t){var r=e.vertices.length;e.__vertexArray=new Float32Array(3*r),e.__colorArray=new Float32Array(3*r),e.__sortArray=[],e.__webglParticleCount=r,o(t)}function a(e,t){var r=e.vertices.length;e.__vertexArray=new Float32Array(3*r),e.__colorArray=new Float32Array(3*r),e.__lineDistanceArray=new Float32Array(1*r),e.__webglLineCount=r,o(t)}function s(e,t){var r=t.geometry,n=e.faces3,o=3*n.length,i=1*n.length,a=3*n.length,s=l(t,e);e.__vertexArray=new Float32Array(3*o),e.__normalArray=new Float32Array(3*o),e.__colorArray=new Float32Array(3*o),e.__uvArray=new Float32Array(2*o),r.faceVertexUvs.length>1&&(e.__uv2Array=new Float32Array(2*o)),r.hasTangents&&(e.__tangentArray=new Float32Array(4*o)),t.geometry.skinWeights.length&&t.geometry.skinIndices.length&&(e.__skinIndexArray=new Float32Array(4*o),e.__skinWeightArray=new Float32Array(4*o));var h=null!==bt.get("OES_element_index_uint")&&i>21845?Uint32Array:Uint16Array;e.__typeArray=h,e.__faceArray=new h(3*i),e.__lineArray=new h(2*a);var u=e.numMorphTargets;if(u){e.__morphTargetsArrays=[];for(var c=0,f=u;f>c;c++)e.__morphTargetsArrays.push(new Float32Array(3*o))}var d=e.numMorphNormals;if(d){e.__morphNormalsArrays=[];for(var c=0,f=d;f>c;c++)e.__morphNormalsArrays.push(new Float32Array(3*o))}if(e.__webglFaceCount=3*i,e.__webglLineCount=2*a,s.attributes){void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]);for(var p in s.attributes){var m=s.attributes[p],g={};for(var y in m)g[y]=m[y];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var v=1;"v2"===g.type?v=2:"v3"===g.type?v=3:"v4"===g.type?v=4:"c"===g.type&&(v=3),g.size=v,g.array=new Float32Array(o*v),g.buffer=Be.createBuffer(),g.buffer.belongsToAttribute=p,m.needsUpdate=!0,g.__original=m}e.__webglCustomAttributesList.push(g)}}e.__inittedArrays=!0}function l(e,t){return e.material instanceof c.MeshFaceMaterial?e.material.materials[t.materialIndex]:e.material}function h(e){return e&&void 0!==e.shading&&e.shading===c.SmoothShading}function u(e,t,r){var n,o,i,a,s,l,h,u,c,f,d,p=e.vertices,m=p.length,g=e.colors,y=g.length,v=e.__vertexArray,_=e.__colorArray,b=(e.__sortArray,e.verticesNeedUpdate),w=(e.elementsNeedUpdate,e.colorsNeedUpdate),x=e.__webglCustomAttributesList;if(b){for(n=0;m>n;n++)i=p[n],a=3*n,v[a]=i.x,v[a+1]=i.y,v[a+2]=i.z;Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglVertexBuffer),Be.bufferData(Be.ARRAY_BUFFER,v,t)}if(w){for(o=0;y>o;o++)s=g[o],a=3*o,_[a]=s.r,_[a+1]=s.g,_[a+2]=s.b;Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglColorBuffer),Be.bufferData(Be.ARRAY_BUFFER,_,t)}if(x)for(l=0,h=x.length;h>l;l++){if(d=x[l],d.needsUpdate&&(void 0===d.boundTo||"vertices"===d.boundTo))if(c=d.value.length,a=0,1===d.size)for(u=0;c>u;u++)d.array[u]=d.value[u];else if(2===d.size)for(u=0;c>u;u++)f=d.value[u],d.array[a]=f.x,d.array[a+1]=f.y,a+=2;else if(3===d.size)if("c"===d.type)for(u=0;c>u;u++)f=d.value[u],d.array[a]=f.r,d.array[a+1]=f.g,d.array[a+2]=f.b,a+=3;else for(u=0;c>u;u++)f=d.value[u],d.array[a]=f.x,d.array[a+1]=f.y,d.array[a+2]=f.z,a+=3;else if(4===d.size)for(u=0;c>u;u++)f=d.value[u],d.array[a]=f.x,d.array[a+1]=f.y,d.array[a+2]=f.z,d.array[a+3]=f.w,a+=4;Be.bindBuffer(Be.ARRAY_BUFFER,d.buffer),Be.bufferData(Be.ARRAY_BUFFER,d.array,t),d.needsUpdate=!1}}function f(e,t){var r,n,o,i,a,s,l,h,u,c,f,d,p=e.vertices,m=e.colors,g=e.lineDistances,y=p.length,v=m.length,_=g.length,b=e.__vertexArray,w=e.__colorArray,x=e.__lineDistanceArray,T=e.verticesNeedUpdate,M=e.colorsNeedUpdate,S=e.lineDistancesNeedUpdate,C=e.__webglCustomAttributesList;if(T){for(r=0;y>r;r++)i=p[r],a=3*r,b[a]=i.x,b[a+1]=i.y,b[a+2]=i.z;Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglVertexBuffer),Be.bufferData(Be.ARRAY_BUFFER,b,t)}if(M){for(n=0;v>n;n++)s=m[n],a=3*n,w[a]=s.r,w[a+1]=s.g,w[a+2]=s.b;Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglColorBuffer),Be.bufferData(Be.ARRAY_BUFFER,w,t)}if(S){for(o=0;_>o;o++)x[o]=g[o];Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglLineDistanceBuffer),Be.bufferData(Be.ARRAY_BUFFER,x,t)}if(C)for(l=0,h=C.length;h>l;l++)if(d=C[l],d.needsUpdate&&(void 0===d.boundTo||"vertices"===d.boundTo)){if(a=0,c=d.value.length,1===d.size)for(u=0;c>u;u++)d.array[u]=d.value[u];else if(2===d.size)for(u=0;c>u;u++)f=d.value[u],d.array[a]=f.x,d.array[a+1]=f.y,a+=2;else if(3===d.size)if("c"===d.type)for(u=0;c>u;u++)f=d.value[u],d.array[a]=f.r,d.array[a+1]=f.g,d.array[a+2]=f.b,a+=3;else for(u=0;c>u;u++)f=d.value[u],d.array[a]=f.x,d.array[a+1]=f.y,d.array[a+2]=f.z,a+=3;else if(4===d.size)for(u=0;c>u;u++)f=d.value[u],d.array[a]=f.x,d.array[a+1]=f.y,d.array[a+2]=f.z,d.array[a+3]=f.w,a+=4;Be.bindBuffer(Be.ARRAY_BUFFER,d.buffer),Be.bufferData(Be.ARRAY_BUFFER,d.array,t),d.needsUpdate=!1}}function d(e,t,r,n,o){if(e.__inittedArrays){var i,a,s,l,u,f,d,p,m,g,y,v,_,b,w,x,T,M,S,C,E,A,L,P,F,D,R,O,k,N,B,U,I,V,z,G,H,j,W,X,q,Y,Q=h(o),K=0,J=0,Z=0,ee=0,te=0,re=0,ne=0,oe=0,ie=0,ae=0,se=0,le=0,he=0,ue=e.__vertexArray,ce=e.__uvArray,fe=e.__uv2Array,de=e.__normalArray,pe=e.__tangentArray,me=e.__colorArray,ge=e.__skinIndexArray,ye=e.__skinWeightArray,ve=e.__morphTargetsArrays,_e=e.__morphNormalsArrays,be=e.__webglCustomAttributesList,we=e.__faceArray,xe=e.__lineArray,Te=t.geometry,Me=Te.verticesNeedUpdate,Se=Te.elementsNeedUpdate,Ce=Te.uvsNeedUpdate,Ee=Te.normalsNeedUpdate,Ae=Te.tangentsNeedUpdate,Le=Te.colorsNeedUpdate,Pe=Te.morphTargetsNeedUpdate,Fe=Te.vertices,De=e.faces3,Re=Te.faces,Oe=Te.faceVertexUvs[0],ke=Te.faceVertexUvs[1],Ne=(Te.colors,Te.skinIndices),Ue=Te.skinWeights,Ie=Te.morphTargets,Ve=Te.morphNormals;if(Me){for(i=0,a=De.length;a>i;i++)l=Re[De[i]],v=Fe[l.a],_=Fe[l.b],b=Fe[l.c],ue[J]=v.x,ue[J+1]=v.y,ue[J+2]=v.z,ue[J+3]=_.x,ue[J+4]=_.y,ue[J+5]=_.z,ue[J+6]=b.x,ue[J+7]=b.y,ue[J+8]=b.z,J+=9;Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglVertexBuffer),Be.bufferData(Be.ARRAY_BUFFER,ue,r)}if(Pe)for(z=0,G=Ie.length;G>z;z++){for(se=0,i=0,a=De.length;a>i;i++)W=De[i],l=Re[W],v=Ie[z].vertices[l.a],_=Ie[z].vertices[l.b],b=Ie[z].vertices[l.c],H=ve[z],H[se]=v.x,H[se+1]=v.y,H[se+2]=v.z,H[se+3]=_.x,H[se+4]=_.y,H[se+5]=_.z,H[se+6]=b.x,H[se+7]=b.y,H[se+8]=b.z,o.morphNormals&&(Q?(X=Ve[z].vertexNormals[W],M=X.a,S=X.b,C=X.c):(M=Ve[z].faceNormals[W],S=M,C=M),j=_e[z],j[se]=M.x,j[se+1]=M.y,j[se+2]=M.z,j[se+3]=S.x,j[se+4]=S.y,j[se+5]=S.z,j[se+6]=C.x,j[se+7]=C.y,j[se+8]=C.z),se+=9;Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[z]),Be.bufferData(Be.ARRAY_BUFFER,ve[z],r),o.morphNormals&&(Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[z]),Be.bufferData(Be.ARRAY_BUFFER,_e[z],r))}if(Ue.length){for(i=0,a=De.length;a>i;i++)l=Re[De[i]],P=Ue[l.a],F=Ue[l.b],D=Ue[l.c],ye[ae]=P.x,ye[ae+1]=P.y,ye[ae+2]=P.z,ye[ae+3]=P.w,ye[ae+4]=F.x,ye[ae+5]=F.y,ye[ae+6]=F.z,ye[ae+7]=F.w,ye[ae+8]=D.x,ye[ae+9]=D.y,ye[ae+10]=D.z,ye[ae+11]=D.w,R=Ne[l.a],O=Ne[l.b],k=Ne[l.c],ge[ae]=R.x,ge[ae+1]=R.y,ge[ae+2]=R.z,ge[ae+3]=R.w,ge[ae+4]=O.x,ge[ae+5]=O.y,ge[ae+6]=O.z,ge[ae+7]=O.w,ge[ae+8]=k.x,ge[ae+9]=k.y,ge[ae+10]=k.z,ge[ae+11]=k.w,ae+=12;ae>0&&(Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),Be.bufferData(Be.ARRAY_BUFFER,ge,r),Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),Be.bufferData(Be.ARRAY_BUFFER,ye,r))}if(Le){for(i=0,a=De.length;a>i;i++)l=Re[De[i]],d=l.vertexColors,p=l.color,3===d.length&&o.vertexColors===c.VertexColors?(E=d[0],A=d[1],L=d[2]):(E=p,A=p,L=p),me[ie]=E.r,me[ie+1]=E.g,me[ie+2]=E.b,me[ie+3]=A.r,me[ie+4]=A.g,me[ie+5]=A.b,me[ie+6]=L.r,me[ie+7]=L.g,me[ie+8]=L.b,ie+=9;ie>0&&(Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglColorBuffer),Be.bufferData(Be.ARRAY_BUFFER,me,r))}if(Ae&&Te.hasTangents){for(i=0,a=De.length;a>i;i++)l=Re[De[i]],m=l.vertexTangents,w=m[0],x=m[1],T=m[2],pe[ne]=w.x,pe[ne+1]=w.y,pe[ne+2]=w.z,pe[ne+3]=w.w,pe[ne+4]=x.x,pe[ne+5]=x.y,pe[ne+6]=x.z,pe[ne+7]=x.w,pe[ne+8]=T.x,pe[ne+9]=T.y,pe[ne+10]=T.z,pe[ne+11]=T.w,ne+=12;Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglTangentBuffer),Be.bufferData(Be.ARRAY_BUFFER,pe,r)}if(Ee){for(i=0,a=De.length;a>i;i++)if(l=Re[De[i]],u=l.vertexNormals,f=l.normal,3===u.length&&Q)for(N=0;3>N;N++)U=u[N],de[re]=U.x,de[re+1]=U.y,de[re+2]=U.z,re+=3;else for(N=0;3>N;N++)de[re]=f.x,de[re+1]=f.y,de[re+2]=f.z,re+=3;Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglNormalBuffer),Be.bufferData(Be.ARRAY_BUFFER,de,r)}if(Ce&&Oe){for(i=0,a=De.length;a>i;i++)if(s=De[i],g=Oe[s],void 0!==g)for(N=0;3>N;N++)I=g[N],ce[Z]=I.x,ce[Z+1]=I.y,Z+=2;Z>0&&(Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglUVBuffer),Be.bufferData(Be.ARRAY_BUFFER,ce,r))}if(Ce&&ke){for(i=0,a=De.length;a>i;i++)if(s=De[i],y=ke[s],void 0!==y)for(N=0;3>N;N++)V=y[N],fe[ee]=V.x,fe[ee+1]=V.y,ee+=2;ee>0&&(Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglUV2Buffer),Be.bufferData(Be.ARRAY_BUFFER,fe,r))}if(Se){for(i=0,a=De.length;a>i;i++)we[te]=K,we[te+1]=K+1,we[te+2]=K+2,te+=3,xe[oe]=K,xe[oe+1]=K+1,xe[oe+2]=K,xe[oe+3]=K+2,xe[oe+4]=K+1,xe[oe+5]=K+2,oe+=6,K+=3;Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),Be.bufferData(Be.ELEMENT_ARRAY_BUFFER,we,r),Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),Be.bufferData(Be.ELEMENT_ARRAY_BUFFER,xe,r)}if(be)for(N=0,B=be.length;B>N;N++)if(Y=be[N],Y.__original.needsUpdate){if(le=0,he=0,1===Y.size){if(void 0===Y.boundTo||"vertices"===Y.boundTo)for(i=0,a=De.length;a>i;i++)l=Re[De[i]],Y.array[le]=Y.value[l.a],Y.array[le+1]=Y.value[l.b],Y.array[le+2]=Y.value[l.c],le+=3;else if("faces"===Y.boundTo)for(i=0,a=De.length;a>i;i++)q=Y.value[De[i]],Y.array[le]=q,Y.array[le+1]=q,Y.array[le+2]=q,le+=3}else if(2===Y.size){if(void 0===Y.boundTo||"vertices"===Y.boundTo)for(i=0,a=De.length;a>i;i++)l=Re[De[i]],v=Y.value[l.a],_=Y.value[l.b],b=Y.value[l.c],Y.array[le]=v.x,Y.array[le+1]=v.y,Y.array[le+2]=_.x,Y.array[le+3]=_.y,Y.array[le+4]=b.x,Y.array[le+5]=b.y,le+=6;else if("faces"===Y.boundTo)for(i=0,a=De.length;a>i;i++)q=Y.value[De[i]],v=q,_=q,b=q,Y.array[le]=v.x,Y.array[le+1]=v.y,Y.array[le+2]=_.x,Y.array[le+3]=_.y,Y.array[le+4]=b.x,Y.array[le+5]=b.y,le+=6}else if(3===Y.size){var ze;if(ze="c"===Y.type?["r","g","b"]:["x","y","z"],void 0===Y.boundTo||"vertices"===Y.boundTo)for(i=0,a=De.length;a>i;i++)l=Re[De[i]],v=Y.value[l.a],_=Y.value[l.b],b=Y.value[l.c],Y.array[le]=v[ze[0]],Y.array[le+1]=v[ze[1]],Y.array[le+2]=v[ze[2]],Y.array[le+3]=_[ze[0]],Y.array[le+4]=_[ze[1]],Y.array[le+5]=_[ze[2]],Y.array[le+6]=b[ze[0]],Y.array[le+7]=b[ze[1]],Y.array[le+8]=b[ze[2]],le+=9;else if("faces"===Y.boundTo)for(i=0,a=De.length;a>i;i++)q=Y.value[De[i]],v=q,_=q,b=q,Y.array[le]=v[ze[0]],Y.array[le+1]=v[ze[1]],Y.array[le+2]=v[ze[2]],Y.array[le+3]=_[ze[0]],Y.array[le+4]=_[ze[1]],Y.array[le+5]=_[ze[2]],Y.array[le+6]=b[ze[0]],Y.array[le+7]=b[ze[1]],Y.array[le+8]=b[ze[2]],le+=9;else if("faceVertices"===Y.boundTo)for(i=0,a=De.length;a>i;i++)q=Y.value[De[i]],v=q[0],_=q[1],b=q[2],Y.array[le]=v[ze[0]],Y.array[le+1]=v[ze[1]],Y.array[le+2]=v[ze[2]],Y.array[le+3]=_[ze[0]],Y.array[le+4]=_[ze[1]],Y.array[le+5]=_[ze[2]],Y.array[le+6]=b[ze[0]],Y.array[le+7]=b[ze[1]],Y.array[le+8]=b[ze[2]],le+=9}else if(4===Y.size)if(void 0===Y.boundTo||"vertices"===Y.boundTo)for(i=0,a=De.length;a>i;i++)l=Re[De[i]],v=Y.value[l.a],_=Y.value[l.b],b=Y.value[l.c],Y.array[le]=v.x,Y.array[le+1]=v.y,Y.array[le+2]=v.z,Y.array[le+3]=v.w,Y.array[le+4]=_.x,Y.array[le+5]=_.y,Y.array[le+6]=_.z,Y.array[le+7]=_.w,Y.array[le+8]=b.x,Y.array[le+9]=b.y,Y.array[le+10]=b.z,Y.array[le+11]=b.w,le+=12;else if("faces"===Y.boundTo)for(i=0,a=De.length;a>i;i++)q=Y.value[De[i]],v=q,_=q,b=q,Y.array[le]=v.x,Y.array[le+1]=v.y,Y.array[le+2]=v.z,Y.array[le+3]=v.w,Y.array[le+4]=_.x,Y.array[le+5]=_.y,Y.array[le+6]=_.z,Y.array[le+7]=_.w,Y.array[le+8]=b.x,Y.array[le+9]=b.y,Y.array[le+10]=b.z,Y.array[le+11]=b.w,le+=12;else if("faceVertices"===Y.boundTo)for(i=0,a=De.length;a>i;i++)q=Y.value[De[i]],v=q[0],_=q[1],b=q[2],Y.array[le]=v.x,Y.array[le+1]=v.y,Y.array[le+2]=v.z,Y.array[le+3]=v.w,Y.array[le+4]=_.x,Y.array[le+5]=_.y,Y.array[le+6]=_.z,Y.array[le+7]=_.w,Y.array[le+8]=b.x,Y.array[le+9]=b.y,Y.array[le+10]=b.z,Y.array[le+11]=b.w,le+=12;Be.bindBuffer(Be.ARRAY_BUFFER,Y.buffer),Be.bufferData(Be.ARRAY_BUFFER,Y.array,r)}n&&(delete e.__inittedArrays,delete e.__colorArray,delete e.__normalArray,delete e.__tangentArray,delete e.__uvArray,delete e.__uv2Array,delete e.__faceArray,delete e.__vertexArray,delete e.__lineArray,delete e.__skinIndexArray,delete e.__skinWeightArray)}}function p(e,t,r,n){for(var o=r.attributes,i=t.attributes,a=t.attributesKeys,s=0,l=a.length;l>s;s++){var h=a[s],u=i[h];if(u>=0){var c=o[h];if(void 0!==c){var f=c.itemSize;Be.bindBuffer(Be.ARRAY_BUFFER,c.buffer),g(u),Be.vertexAttribPointer(u,f,Be.FLOAT,!1,0,n*f*4)}else void 0!==e.defaultAttributeValues&&(2===e.defaultAttributeValues[h].length?Be.vertexAttrib2fv(u,e.defaultAttributeValues[h]):3===e.defaultAttributeValues[h].length&&Be.vertexAttrib3fv(u,e.defaultAttributeValues[h]))}}y()}function m(){for(var e=0,t=ut.length;t>e;e++)ut[e]=0}function g(e){ut[e]=1,0===ct[e]&&(Be.enableVertexAttribArray(e),ct[e]=1)}function y(){for(var e=0,t=ct.length;t>e;e++)ct[e]!==ut[e]&&(Be.disableVertexAttribArray(e),ct[e]=0)}function v(e,t,r){var n=e.program.attributes;if(-1!==r.morphTargetBase&&n.position>=0?(Be.bindBuffer(Be.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[r.morphTargetBase]),g(n.position),Be.vertexAttribPointer(n.position,3,Be.FLOAT,!1,0,0)):n.position>=0&&(Be.bindBuffer(Be.ARRAY_BUFFER,t.__webglVertexBuffer),g(n.position),Be.vertexAttribPointer(n.position,3,Be.FLOAT,!1,0,0)),r.morphTargetForcedOrder.length)for(var o,i=0,a=r.morphTargetForcedOrder,s=r.morphTargetInfluences;i<e.numSupportedMorphTargets&&i<a.length;)o=n["morphTarget"+i],o>=0&&(Be.bindBuffer(Be.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[a[i]]),g(o),Be.vertexAttribPointer(o,3,Be.FLOAT,!1,0,0)),o=n["morphNormal"+i],o>=0&&e.morphNormals&&(Be.bindBuffer(Be.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[a[i]]),g(o),Be.vertexAttribPointer(o,3,Be.FLOAT,!1,0,0)),r.__webglMorphTargetInfluences[i]=s[a[i]],i++;else{for(var l=[],s=r.morphTargetInfluences,h=0,u=s.length;u>h;h++){var c=s[h];l.push([c,h])}l.length>e.numSupportedMorphTargets?(l.sort(w),l.length=e.numSupportedMorphTargets):l.length>e.numSupportedMorphNormals?l.sort(w):0===l.length&&l.push([0,0]);for(var o,i=0,f=e.numSupportedMorphTargets;f>i;i++)if(l[i]){var d=l[i][1];o=n["morphTarget"+i],o>=0&&(Be.bindBuffer(Be.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[d]),g(o),Be.vertexAttribPointer(o,3,Be.FLOAT,!1,0,0)),o=n["morphNormal"+i],o>=0&&e.morphNormals&&(Be.bindBuffer(Be.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[d]),g(o),Be.vertexAttribPointer(o,3,Be.FLOAT,!1,0,0)),r.__webglMorphTargetInfluences[i]=s[d]}else r.__webglMorphTargetInfluences[i]=0}null!==e.program.uniforms.morphTargetInfluences&&Be.uniform1fv(e.program.uniforms.morphTargetInfluences,r.__webglMorphTargetInfluences)}function _(e,t){return e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function b(e,t){return e.z!==t.z?t.z-e.z:e.id-t.id}function w(e,t){return t[0]-e[0]}function x(e){if(e.visible!==!1){if(e instanceof c.Scene||e instanceof c.Group);else if(E(e),e instanceof c.Light)Pe.push(e);else if(e instanceof c.Sprite)ke.push(e);else if(e instanceof c.LensFlare)Ne.push(e);else{var t=Fe[e.id];if(t&&(e.frustumCulled===!1||ft.intersectsObject(e)===!0))for(var r=0,n=t.length;n>r;r++){var o=t[r];C(o),o.render=!0,Ue.sortObjects===!0&&(pt.setFromMatrixPosition(e.matrixWorld),pt.applyProjection(dt),o.z=pt.z)}}for(var r=0,n=e.children.length;n>r;r++)x(e.children[r])}}function T(e,t,r,n,o,i){for(var a,s=0,l=e.length;l>s;s++){var h=e[s],u=h.object,f=h.buffer;if(Z(u,t),i)a=i;else{if(a=h.material,!a)continue;o&&Ue.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst),Ue.setDepthTest(a.depthTest),Ue.setDepthWrite(a.depthWrite),oe(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}Ue.setMaterialFaces(a),f instanceof c.BufferGeometry?Ue.renderBufferDirect(t,r,n,a,f,u):Ue.renderBuffer(t,r,n,a,f,u)}}function M(e,t,r,n,o,i,a){for(var s,l=0,h=e.length;h>l;l++){var u=e[l],c=u.object;if(c.visible){if(a)s=a;else{if(s=u[t],!s)continue;i&&Ue.setBlending(s.blending,s.blendEquation,s.blendSrc,s.blendDst),Ue.setDepthTest(s.depthTest),Ue.setDepthWrite(s.depthWrite),oe(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits)}Ue.renderImmediateObject(r,n,o,s,c)}}}function S(e){var t=e.object,r=t.material;r.transparent?(e.transparent=r,e.opaque=null):(e.opaque=r,e.transparent=null)}function C(e){var t=e.object,r=e.buffer,n=t.geometry,o=t.material;if(o instanceof c.MeshFaceMaterial){var i=n instanceof c.BufferGeometry?0:r.materialIndex;o=o.materials[i],e.material=o,o.transparent?Oe.push(e):Re.push(e)}else o&&(e.material=o,o.transparent?Oe.push(e):Re.push(e))}function E(e){void 0===e.__webglInit&&(e.__webglInit=!0,e._modelViewMatrix=new c.Matrix4,e._normalMatrix=new c.Matrix3,e.addEventListener("removed",It));var n=e.geometry;if(void 0===n||void 0===n.__webglInit&&(n.__webglInit=!0,n.addEventListener("dispose",Vt),n instanceof c.BufferGeometry?Ue.info.memory.geometries++:e instanceof c.Mesh?L(e,n):e instanceof c.Line?void 0===n.__webglVertexBuffer&&(r(n),a(n,e),n.verticesNeedUpdate=!0,n.colorsNeedUpdate=!0,n.lineDistancesNeedUpdate=!0):e instanceof c.PointCloud&&void 0===n.__webglVertexBuffer&&(t(n),i(n,e),n.verticesNeedUpdate=!0,n.colorsNeedUpdate=!0)),void 0===e.__webglActive)if(e.__webglActive=!0,e instanceof c.Mesh){if(n instanceof c.BufferGeometry)P(Fe,n,e);else if(n instanceof c.Geometry)for(var o=Qt[n.id],s=0,l=o.length;l>s;s++)P(Fe,o[s],e)}else e instanceof c.Line||e instanceof c.PointCloud?P(Fe,n,e):(e instanceof c.ImmediateRenderObject||e.immediateRenderCallback)&&F(De,e)}function A(e,t){for(var r,n,o=bt.get("OES_element_index_uint")?4294967296:65535,i={},a=e.morphTargets.length,s=e.morphNormals.length,l={},h=[],u=0,c=e.faces.length;c>u;u++){var f=e.faces[u],d=t?f.materialIndex:0;d in i||(i[d]={hash:d,counter:0}),r=i[d].hash+"_"+i[d].counter,r in l||(n={id:Kt++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:a,numMorphNormals:s},l[r]=n,h.push(n)),l[r].vertices+3>o&&(i[d].counter+=1,r=i[d].hash+"_"+i[d].counter,r in l||(n={id:Kt++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:a,numMorphNormals:s},l[r]=n,h.push(n))),l[r].faces3.push(u),l[r].vertices+=3}return h}function L(e,t){var r=e.material,o=!1;(void 0===Qt[t.id]||t.groupsNeedUpdate===!0)&&(delete Fe[e.id],Qt[t.id]=A(t,r instanceof c.MeshFaceMaterial),t.groupsNeedUpdate=!1);for(var i=Qt[t.id],a=0,l=i.length;l>a;a++){var h=i[a];void 0===h.__webglVertexBuffer?(n(h),s(h,e),t.verticesNeedUpdate=!0,t.morphTargetsNeedUpdate=!0,t.elementsNeedUpdate=!0,t.uvsNeedUpdate=!0,t.normalsNeedUpdate=!0,t.tangentsNeedUpdate=!0,t.colorsNeedUpdate=!0,o=!0):o=!1,(o||void 0===e.__webglActive)&&P(Fe,h,e)}e.__webglActive=!0}function P(e,t,r){var n=r.id;e[n]=e[n]||[],e[n].push({id:n,buffer:t,object:r,material:null,z:0})}function F(e,t){e.push({id:null,object:t,opaque:null,transparent:null,z:0})}function D(e){var t=e.geometry;if(t instanceof c.BufferGeometry)for(var r=t.attributes,n=t.attributesKeys,o=0,i=n.length;i>o;o++){var a=n[o],h=r[a];if(void 0===h.buffer&&(h.buffer=Be.createBuffer(),h.needsUpdate=!0),h.needsUpdate===!0){var p="index"===a?Be.ELEMENT_ARRAY_BUFFER:Be.ARRAY_BUFFER;Be.bindBuffer(p,h.buffer),Be.bufferData(p,h.array,Be.STATIC_DRAW),h.needsUpdate=!1}}else if(e instanceof c.Mesh){t.groupsNeedUpdate===!0&&L(e,t);for(var m=Qt[t.id],o=0,g=m.length;g>o;o++){var y=m[o],v=l(e,y);t.groupsNeedUpdate===!0&&s(y,e);var _=v.attributes&&R(v);(t.verticesNeedUpdate||t.morphTargetsNeedUpdate||t.elementsNeedUpdate||t.uvsNeedUpdate||t.normalsNeedUpdate||t.colorsNeedUpdate||t.tangentsNeedUpdate||_)&&d(y,e,Be.DYNAMIC_DRAW,!t.dynamic,v)}t.verticesNeedUpdate=!1,t.morphTargetsNeedUpdate=!1,t.elementsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.tangentsNeedUpdate=!1,v.attributes&&O(v)}else if(e instanceof c.Line){var v=l(e,t),_=v.attributes&&R(v);(t.verticesNeedUpdate||t.colorsNeedUpdate||t.lineDistancesNeedUpdate||_)&&f(t,Be.DYNAMIC_DRAW),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1,t.lineDistancesNeedUpdate=!1,v.attributes&&O(v)}else if(e instanceof c.PointCloud){var v=l(e,t),_=v.attributes&&R(v);(t.verticesNeedUpdate||t.colorsNeedUpdate||_)&&u(t,Be.DYNAMIC_DRAW,e),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1,v.attributes&&O(v)}}function R(e){for(var t in e.attributes)if(e.attributes[t].needsUpdate)return!0;return!1}function O(e){for(var t in e.attributes)e.attributes[t].needsUpdate=!1}function k(e){e instanceof c.Mesh||e instanceof c.PointCloud||e instanceof c.Line?delete Fe[e.id]:(e instanceof c.ImmediateRenderObject||e.immediateRenderCallback)&&N(De,e),delete e.__webglInit,delete e._modelViewMatrix,delete e._normalMatrix,delete e.__webglActive}function N(e,t){for(var r=e.length-1;r>=0;r--)e[r].object===t&&e.splice(r,1)}function B(e,t,r,n){e.addEventListener("dispose",Ht);var o=Jt[e.type];if(o){var i=c.ShaderLib[o];e.__webglShader={uniforms:c.UniformsUtils.clone(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}}else e.__webglShader={uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};var a=me(t),s=ge(t),l=pe(n),h={precision:be,supportsVertexTextures:Et,map:!!e.map,envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,lightMap:!!e.lightMap,bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,combine:e.combine,vertexColors:e.vertexColors,fog:r,useFog:e.fog,fogExp:r instanceof c.FogExp2,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:Ee,skinning:e.skinning,maxBones:l,useVertexTexture:At&&n&&n.skeleton&&n.skeleton.useVertexTexture,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:Ue.maxMorphTargets,maxMorphNormals:Ue.maxMorphNormals,maxDirLights:a.directional,maxPointLights:a.point,maxSpotLights:a.spot,maxHemiLights:a.hemi,maxShadows:s,shadowMapEnabled:Ue.shadowMapEnabled&&n.receiveShadow&&s>0,shadowMapType:Ue.shadowMapType,shadowMapDebug:Ue.shadowMapDebug,shadowMapCascade:Ue.shadowMapCascade,alphaTest:e.alphaTest,metal:e.metal,wrapAround:e.wrapAround,doubleSided:e.side===c.DoubleSide,flipSided:e.side===c.BackSide},u=[];if(o?u.push(o):(u.push(e.fragmentShader),u.push(e.vertexShader)),void 0!==e.defines)for(var f in e.defines)u.push(f),u.push(e.defines[f]);for(var f in h)u.push(f),u.push(h[f]);for(var d,p=u.join(),m=0,g=Ie.length;g>m;m++){var y=Ie[m];if(y.code===p){d=y,d.usedTimes++;break}}void 0===d&&(d=new c.WebGLProgram(Ue,p,e,h),Ie.push(d),Ue.info.memory.programs=Ie.length),e.program=d;var v=d.attributes;if(e.morphTargets){e.numSupportedMorphTargets=0;for(var _,b="morphTarget",w=0;w<Ue.maxMorphTargets;w++)_=b+w,v[_]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;var _,b="morphNormal";for(w=0;w<Ue.maxMorphNormals;w++)_=b+w,v[_]>=0&&e.numSupportedMorphNormals++}e.uniformsList=[];for(var x in e.__webglShader.uniforms){var T=e.program.uniforms[x];T&&e.uniformsList.push([e.__webglShader.uniforms[x],T])}}function U(e,t,r,n,o){We=0,n.needsUpdate&&(n.program&&Yt(n),B(n,t,r,o),n.needsUpdate=!1),n.morphTargets&&(o.__webglMorphTargetInfluences||(o.__webglMorphTargetInfluences=new Float32Array(Ue.maxMorphTargets)));var i=!1,a=!1,s=!1,l=n.program,h=l.uniforms,u=n.__webglShader.uniforms;if(l.id!==Ve&&(Be.useProgram(l.program),Ve=l.id,i=!0,a=!0,s=!0),n.id!==Ge&&(-1===Ge&&(s=!0),Ge=n.id,a=!0),(i||e!==je)&&(Be.uniformMatrix4fv(h.projectionMatrix,!1,e.projectionMatrix.elements),Ee&&Be.uniform1f(h.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==je&&(je=e),(n instanceof c.ShaderMaterial||n instanceof c.MeshPhongMaterial||n.envMap)&&null!==h.cameraPosition&&(pt.setFromMatrixPosition(e.matrixWorld),Be.uniform3f(h.cameraPosition,pt.x,pt.y,pt.z)),(n instanceof c.MeshPhongMaterial||n instanceof c.MeshLambertMaterial||n instanceof c.MeshBasicMaterial||n instanceof c.ShaderMaterial||n.skinning)&&null!==h.viewMatrix&&Be.uniformMatrix4fv(h.viewMatrix,!1,e.matrixWorldInverse.elements)),n.skinning)if(o.bindMatrix&&null!==h.bindMatrix&&Be.uniformMatrix4fv(h.bindMatrix,!1,o.bindMatrix.elements),o.bindMatrixInverse&&null!==h.bindMatrixInverse&&Be.uniformMatrix4fv(h.bindMatrixInverse,!1,o.bindMatrixInverse.elements),At&&o.skeleton&&o.skeleton.useVertexTexture){if(null!==h.boneTexture){var f=K();Be.uniform1i(h.boneTexture,f),Ue.setTexture(o.skeleton.boneTexture,f)}null!==h.boneTextureWidth&&Be.uniform1i(h.boneTextureWidth,o.skeleton.boneTextureWidth),null!==h.boneTextureHeight&&Be.uniform1i(h.boneTextureHeight,o.skeleton.boneTextureHeight)}else o.skeleton&&o.skeleton.boneMatrices&&null!==h.boneGlobalMatrices&&Be.uniformMatrix4fv(h.boneGlobalMatrices,!1,o.skeleton.boneMatrices);
return a&&(r&&n.fog&&H(u,r),(n instanceof c.MeshPhongMaterial||n instanceof c.MeshLambertMaterial||n.lights)&&(gt&&(s=!0,re(t),gt=!1),s?(X(u,yt),q(u,!0)):q(u,!1)),(n instanceof c.MeshBasicMaterial||n instanceof c.MeshLambertMaterial||n instanceof c.MeshPhongMaterial)&&I(u,n),n instanceof c.LineBasicMaterial?V(u,n):n instanceof c.LineDashedMaterial?(V(u,n),z(u,n)):n instanceof c.PointCloudMaterial?G(u,n):n instanceof c.MeshPhongMaterial?j(u,n):n instanceof c.MeshLambertMaterial?W(u,n):n instanceof c.MeshDepthMaterial?(u.mNear.value=e.near,u.mFar.value=e.far,u.opacity.value=n.opacity):n instanceof c.MeshNormalMaterial&&(u.opacity.value=n.opacity),o.receiveShadow&&!n._shadowPass&&Y(u,t),J(n.uniformsList)),Q(h,o),null!==h.modelMatrix&&Be.uniformMatrix4fv(h.modelMatrix,!1,o.matrixWorld.elements),l}function I(e,t){e.opacity.value=t.opacity,Ue.gammaInput?e.diffuse.value.copyGammaToLinear(t.color):e.diffuse.value=t.color,e.map.value=t.map,e.lightMap.value=t.lightMap,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));var r;if(t.map?r=t.map:t.specularMap?r=t.specularMap:t.normalMap?r=t.normalMap:t.bumpMap?r=t.bumpMap:t.alphaMap&&(r=t.alphaMap),void 0!==r){var n=r.offset,o=r.repeat;e.offsetRepeat.value.set(n.x,n.y,o.x,o.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof c.WebGLRenderTargetCube?1:-1,Ue.gammaInput?e.reflectivity.value=t.reflectivity:e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function V(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function z(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function G(e,t){e.psColor.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size,e.scale.value=ye.height/2,e.map.value=t.map}function H(e,t){e.fogColor.value=t.color,t instanceof c.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof c.FogExp2&&(e.fogDensity.value=t.density)}function j(e,t){e.shininess.value=t.shininess,Ue.gammaInput?(e.ambient.value.copyGammaToLinear(t.ambient),e.emissive.value.copyGammaToLinear(t.emissive),e.specular.value.copyGammaToLinear(t.specular)):(e.ambient.value=t.ambient,e.emissive.value=t.emissive,e.specular.value=t.specular),t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function W(e,t){Ue.gammaInput?(e.ambient.value.copyGammaToLinear(t.ambient),e.emissive.value.copyGammaToLinear(t.emissive)):(e.ambient.value=t.ambient,e.emissive.value=t.emissive),t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function X(e,t){e.ambientLightColor.value=t.ambient,e.directionalLightColor.value=t.directional.colors,e.directionalLightDirection.value=t.directional.positions,e.pointLightColor.value=t.point.colors,e.pointLightPosition.value=t.point.positions,e.pointLightDistance.value=t.point.distances,e.spotLightColor.value=t.spot.colors,e.spotLightPosition.value=t.spot.positions,e.spotLightDistance.value=t.spot.distances,e.spotLightDirection.value=t.spot.directions,e.spotLightAngleCos.value=t.spot.anglesCos,e.spotLightExponent.value=t.spot.exponents,e.hemisphereLightSkyColor.value=t.hemi.skyColors,e.hemisphereLightGroundColor.value=t.hemi.groundColors,e.hemisphereLightDirection.value=t.hemi.positions}function q(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLightColor.needsUpdate=t,e.directionalLightDirection.needsUpdate=t,e.pointLightColor.needsUpdate=t,e.pointLightPosition.needsUpdate=t,e.pointLightDistance.needsUpdate=t,e.spotLightColor.needsUpdate=t,e.spotLightPosition.needsUpdate=t,e.spotLightDistance.needsUpdate=t,e.spotLightDirection.needsUpdate=t,e.spotLightAngleCos.needsUpdate=t,e.spotLightExponent.needsUpdate=t,e.hemisphereLightSkyColor.needsUpdate=t,e.hemisphereLightGroundColor.needsUpdate=t,e.hemisphereLightDirection.needsUpdate=t}function Y(e,t){if(e.shadowMatrix)for(var r=0,n=0,o=t.length;o>n;n++){var i=t[n];i.castShadow&&(i instanceof c.SpotLight||i instanceof c.DirectionalLight&&!i.shadowCascade)&&(e.shadowMap.value[r]=i.shadowMap,e.shadowMapSize.value[r]=i.shadowMapSize,e.shadowMatrix.value[r]=i.shadowMatrix,e.shadowDarkness.value[r]=i.shadowDarkness,e.shadowBias.value[r]=i.shadowBias,r++)}}function Q(e,t){Be.uniformMatrix4fv(e.modelViewMatrix,!1,t._modelViewMatrix.elements),e.normalMatrix&&Be.uniformMatrix3fv(e.normalMatrix,!1,t._normalMatrix.elements)}function K(){var e=We;return e>=Tt&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Tt),We+=1,e}function J(e){for(var t,r,n,o=0,i=e.length;i>o;o++){var a=e[o][0];if(a.needsUpdate!==!1){var s=a.type,l=a.value,h=e[o][1];switch(s){case"1i":Be.uniform1i(h,l);break;case"1f":Be.uniform1f(h,l);break;case"2f":Be.uniform2f(h,l[0],l[1]);break;case"3f":Be.uniform3f(h,l[0],l[1],l[2]);break;case"4f":Be.uniform4f(h,l[0],l[1],l[2],l[3]);break;case"1iv":Be.uniform1iv(h,l);break;case"3iv":Be.uniform3iv(h,l);break;case"1fv":Be.uniform1fv(h,l);break;case"2fv":Be.uniform2fv(h,l);break;case"3fv":Be.uniform3fv(h,l);break;case"4fv":Be.uniform4fv(h,l);break;case"Matrix3fv":Be.uniformMatrix3fv(h,!1,l);break;case"Matrix4fv":Be.uniformMatrix4fv(h,!1,l);break;case"i":Be.uniform1i(h,l);break;case"f":Be.uniform1f(h,l);break;case"v2":Be.uniform2f(h,l.x,l.y);break;case"v3":Be.uniform3f(h,l.x,l.y,l.z);break;case"v4":Be.uniform4f(h,l.x,l.y,l.z,l.w);break;case"c":Be.uniform3f(h,l.r,l.g,l.b);break;case"iv1":Be.uniform1iv(h,l);break;case"iv":Be.uniform3iv(h,l);break;case"fv1":Be.uniform1fv(h,l);break;case"fv":Be.uniform3fv(h,l);break;case"v2v":void 0===a._array&&(a._array=new Float32Array(2*l.length));for(var u=0,f=l.length;f>u;u++)n=2*u,a._array[n]=l[u].x,a._array[n+1]=l[u].y;Be.uniform2fv(h,a._array);break;case"v3v":void 0===a._array&&(a._array=new Float32Array(3*l.length));for(var u=0,f=l.length;f>u;u++)n=3*u,a._array[n]=l[u].x,a._array[n+1]=l[u].y,a._array[n+2]=l[u].z;Be.uniform3fv(h,a._array);break;case"v4v":void 0===a._array&&(a._array=new Float32Array(4*l.length));for(var u=0,f=l.length;f>u;u++)n=4*u,a._array[n]=l[u].x,a._array[n+1]=l[u].y,a._array[n+2]=l[u].z,a._array[n+3]=l[u].w;Be.uniform4fv(h,a._array);break;case"m3":Be.uniformMatrix3fv(h,!1,l.elements);break;case"m3v":void 0===a._array&&(a._array=new Float32Array(9*l.length));for(var u=0,f=l.length;f>u;u++)l[u].flattenToArrayOffset(a._array,9*u);Be.uniformMatrix3fv(h,!1,a._array);break;case"m4":Be.uniformMatrix4fv(h,!1,l.elements);break;case"m4v":void 0===a._array&&(a._array=new Float32Array(16*l.length));for(var u=0,f=l.length;f>u;u++)l[u].flattenToArrayOffset(a._array,16*u);Be.uniformMatrix4fv(h,!1,a._array);break;case"t":if(t=l,r=K(),Be.uniform1i(h,r),!t)continue;t instanceof c.CubeTexture||t.image instanceof Array&&6===t.image.length?se(t,r):t instanceof c.WebGLRenderTargetCube?le(t,r):Ue.setTexture(t,r);break;case"tv":void 0===a._array&&(a._array=[]);for(var u=0,f=a.value.length;f>u;u++)a._array[u]=K();Be.uniform1iv(h,a._array);for(var u=0,f=a.value.length;f>u;u++)t=a.value[u],r=a._array[u],t&&Ue.setTexture(t,r);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+s)}}}}function Z(e,t){e._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld),e._normalMatrix.getNormalMatrix(e._modelViewMatrix)}function ee(e,t,r,n){e[t]=r.r*r.r*n,e[t+1]=r.g*r.g*n,e[t+2]=r.b*r.b*n}function te(e,t,r,n){e[t]=r.r*n,e[t+1]=r.g*n,e[t+2]=r.b*n}function re(e){var t,r,n,o,i,a,s,l,h,u=0,f=0,d=0,p=yt,m=p.directional.colors,g=p.directional.positions,y=p.point.colors,v=p.point.positions,_=p.point.distances,b=p.spot.colors,w=p.spot.positions,x=p.spot.distances,T=p.spot.directions,M=p.spot.anglesCos,S=p.spot.exponents,C=p.hemi.skyColors,E=p.hemi.groundColors,A=p.hemi.positions,L=0,P=0,F=0,D=0,R=0,O=0,k=0,N=0,B=0,U=0,I=0,V=0;for(t=0,r=e.length;r>t;t++)if(n=e[t],!n.onlyShadow)if(o=n.color,s=n.intensity,h=n.distance,n instanceof c.AmbientLight){if(!n.visible)continue;Ue.gammaInput?(u+=o.r*o.r,f+=o.g*o.g,d+=o.b*o.b):(u+=o.r,f+=o.g,d+=o.b)}else if(n instanceof c.DirectionalLight){if(R+=1,!n.visible)continue;mt.setFromMatrixPosition(n.matrixWorld),pt.setFromMatrixPosition(n.target.matrixWorld),mt.sub(pt),mt.normalize(),B=3*L,g[B]=mt.x,g[B+1]=mt.y,g[B+2]=mt.z,Ue.gammaInput?ee(m,B,o,s*s):te(m,B,o,s),L+=1}else if(n instanceof c.PointLight){if(O+=1,!n.visible)continue;U=3*P,Ue.gammaInput?ee(y,U,o,s*s):te(y,U,o,s),pt.setFromMatrixPosition(n.matrixWorld),v[U]=pt.x,v[U+1]=pt.y,v[U+2]=pt.z,_[P]=h,P+=1}else if(n instanceof c.SpotLight){if(k+=1,!n.visible)continue;I=3*F,Ue.gammaInput?ee(b,I,o,s*s):te(b,I,o,s),mt.setFromMatrixPosition(n.matrixWorld),w[I]=mt.x,w[I+1]=mt.y,w[I+2]=mt.z,x[F]=h,pt.setFromMatrixPosition(n.target.matrixWorld),mt.sub(pt),mt.normalize(),T[I]=mt.x,T[I+1]=mt.y,T[I+2]=mt.z,M[F]=Math.cos(n.angle),S[F]=n.exponent,F+=1}else if(n instanceof c.HemisphereLight){if(N+=1,!n.visible)continue;mt.setFromMatrixPosition(n.matrixWorld),mt.normalize(),V=3*D,A[V]=mt.x,A[V+1]=mt.y,A[V+2]=mt.z,i=n.color,a=n.groundColor,Ue.gammaInput?(l=s*s,ee(C,V,i,l),ee(E,V,a,l)):(te(C,V,i,s),te(E,V,a,s)),D+=1}for(t=3*L,r=Math.max(m.length,3*R);r>t;t++)m[t]=0;for(t=3*P,r=Math.max(y.length,3*O);r>t;t++)y[t]=0;for(t=3*F,r=Math.max(b.length,3*k);r>t;t++)b[t]=0;for(t=3*D,r=Math.max(C.length,3*N);r>t;t++)C[t]=0;for(t=3*D,r=Math.max(E.length,3*N);r>t;t++)E[t]=0;p.directional.length=L,p.point.length=P,p.spot.length=F,p.hemi.length=D,p.ambient[0]=u,p.ambient[1]=f,p.ambient[2]=d}function ne(e){e*=_e,e!==nt&&(Be.lineWidth(e),nt=e)}function oe(e,t,r){et!==e&&(e?Be.enable(Be.POLYGON_OFFSET_FILL):Be.disable(Be.POLYGON_OFFSET_FILL),et=e),!e||tt===t&&rt===r||(Be.polygonOffset(t,r),tt=t,rt=r)}function ie(e,t,r){var n;r?(Be.texParameteri(e,Be.TEXTURE_WRAP_S,de(t.wrapS)),Be.texParameteri(e,Be.TEXTURE_WRAP_T,de(t.wrapT)),Be.texParameteri(e,Be.TEXTURE_MAG_FILTER,de(t.magFilter)),Be.texParameteri(e,Be.TEXTURE_MIN_FILTER,de(t.minFilter))):(Be.texParameteri(e,Be.TEXTURE_WRAP_S,Be.CLAMP_TO_EDGE),Be.texParameteri(e,Be.TEXTURE_WRAP_T,Be.CLAMP_TO_EDGE),(t.wrapS!==c.ClampToEdgeWrapping||t.wrapT!==c.ClampToEdgeWrapping)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT is set to THREE.ClampToEdgeWrapping. ( "+t.sourceFile+" )"),Be.texParameteri(e,Be.TEXTURE_MAG_FILTER,fe(t.magFilter)),Be.texParameteri(e,Be.TEXTURE_MIN_FILTER,fe(t.minFilter)),t.minFilter!==c.NearestFilter&&t.minFilter!==c.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter is set to THREE.LinearFilter or THREE.NearestFilter. ( "+t.sourceFile+" )")),n=bt.get("EXT_texture_filter_anisotropic"),n&&t.type!==c.FloatType&&(t.anisotropy>1||t.__oldAnisotropy)&&(Be.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,Ue.getMaxAnisotropy())),t.__oldAnisotropy=t.anisotropy)}function ae(e,t){if(e.width>t||e.height>t){var r=t/Math.max(e.width,e.height),n=document.createElement("canvas");n.width=Math.floor(e.width*r),n.height=Math.floor(e.height*r);var o=n.getContext("2d");return o.drawImage(e,0,0,e.width,e.height,0,0,n.width,n.height),console.log("THREE.WebGLRenderer:",e,"is too big ("+e.width+"x"+e.height+"). Resized to "+n.width+"x"+n.height+"."),n}return e}function se(e,t){if(6===e.image.length)if(e.needsUpdate){e.image.__webglTextureCube||(e.addEventListener("dispose",zt),e.image.__webglTextureCube=Be.createTexture(),Ue.info.memory.textures++),Be.activeTexture(Be.TEXTURE0+t),Be.bindTexture(Be.TEXTURE_CUBE_MAP,e.image.__webglTextureCube),Be.pixelStorei(Be.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var r=e instanceof c.CompressedTexture,n=e.image[0]instanceof c.DataTexture,o=[],i=0;6>i;i++)!Ue.autoScaleCubemaps||r||n?o[i]=n?e.image[i].image:e.image[i]:o[i]=ae(e.image[i],Ct);var a=o[0],s=c.Math.isPowerOfTwo(a.width)&&c.Math.isPowerOfTwo(a.height),l=de(e.format),h=de(e.type);ie(Be.TEXTURE_CUBE_MAP,e,s);for(var i=0;6>i;i++)if(r)for(var u,f=o[i].mipmaps,d=0,p=f.length;p>d;d++)u=f[d],e.format!==c.RGBAFormat&&e.format!==c.RGBFormat?Rt().indexOf(l)>-1?Be.compressedTexImage2D(Be.TEXTURE_CUBE_MAP_POSITIVE_X+i,d,l,u.width,u.height,0,u.data):console.warn("Attempt to load unsupported compressed texture format"):Be.texImage2D(Be.TEXTURE_CUBE_MAP_POSITIVE_X+i,d,l,u.width,u.height,0,l,h,u.data);else n?Be.texImage2D(Be.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,l,o[i].width,o[i].height,0,l,h,o[i].data):Be.texImage2D(Be.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,l,l,h,o[i]);e.generateMipmaps&&s&&Be.generateMipmap(Be.TEXTURE_CUBE_MAP),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()}else Be.activeTexture(Be.TEXTURE0+t),Be.bindTexture(Be.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}function le(e,t){Be.activeTexture(Be.TEXTURE0+t),Be.bindTexture(Be.TEXTURE_CUBE_MAP,e.__webglTexture)}function he(e,t,r){Be.bindFramebuffer(Be.FRAMEBUFFER,e),Be.framebufferTexture2D(Be.FRAMEBUFFER,Be.COLOR_ATTACHMENT0,r,t.__webglTexture,0)}function ue(e,t){Be.bindRenderbuffer(Be.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(Be.renderbufferStorage(Be.RENDERBUFFER,Be.DEPTH_COMPONENT16,t.width,t.height),Be.framebufferRenderbuffer(Be.FRAMEBUFFER,Be.DEPTH_ATTACHMENT,Be.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(Be.renderbufferStorage(Be.RENDERBUFFER,Be.DEPTH_STENCIL,t.width,t.height),Be.framebufferRenderbuffer(Be.FRAMEBUFFER,Be.DEPTH_STENCIL_ATTACHMENT,Be.RENDERBUFFER,e)):Be.renderbufferStorage(Be.RENDERBUFFER,Be.RGBA4,t.width,t.height)}function ce(e){e instanceof c.WebGLRenderTargetCube?(Be.bindTexture(Be.TEXTURE_CUBE_MAP,e.__webglTexture),Be.generateMipmap(Be.TEXTURE_CUBE_MAP),Be.bindTexture(Be.TEXTURE_CUBE_MAP,null)):(Be.bindTexture(Be.TEXTURE_2D,e.__webglTexture),Be.generateMipmap(Be.TEXTURE_2D),Be.bindTexture(Be.TEXTURE_2D,null))}function fe(e){return e===c.NearestFilter||e===c.NearestMipMapNearestFilter||e===c.NearestMipMapLinearFilter?Be.NEAREST:Be.LINEAR}function de(e){var t;if(e===c.RepeatWrapping)return Be.REPEAT;if(e===c.ClampToEdgeWrapping)return Be.CLAMP_TO_EDGE;if(e===c.MirroredRepeatWrapping)return Be.MIRRORED_REPEAT;if(e===c.NearestFilter)return Be.NEAREST;if(e===c.NearestMipMapNearestFilter)return Be.NEAREST_MIPMAP_NEAREST;if(e===c.NearestMipMapLinearFilter)return Be.NEAREST_MIPMAP_LINEAR;if(e===c.LinearFilter)return Be.LINEAR;if(e===c.LinearMipMapNearestFilter)return Be.LINEAR_MIPMAP_NEAREST;if(e===c.LinearMipMapLinearFilter)return Be.LINEAR_MIPMAP_LINEAR;if(e===c.UnsignedByteType)return Be.UNSIGNED_BYTE;if(e===c.UnsignedShort4444Type)return Be.UNSIGNED_SHORT_4_4_4_4;if(e===c.UnsignedShort5551Type)return Be.UNSIGNED_SHORT_5_5_5_1;if(e===c.UnsignedShort565Type)return Be.UNSIGNED_SHORT_5_6_5;if(e===c.ByteType)return Be.BYTE;if(e===c.ShortType)return Be.SHORT;if(e===c.UnsignedShortType)return Be.UNSIGNED_SHORT;if(e===c.IntType)return Be.INT;if(e===c.UnsignedIntType)return Be.UNSIGNED_INT;if(e===c.FloatType)return Be.FLOAT;if(e===c.AlphaFormat)return Be.ALPHA;if(e===c.RGBFormat)return Be.RGB;if(e===c.RGBAFormat)return Be.RGBA;if(e===c.LuminanceFormat)return Be.LUMINANCE;if(e===c.LuminanceAlphaFormat)return Be.LUMINANCE_ALPHA;if(e===c.AddEquation)return Be.FUNC_ADD;if(e===c.SubtractEquation)return Be.FUNC_SUBTRACT;if(e===c.ReverseSubtractEquation)return Be.FUNC_REVERSE_SUBTRACT;if(e===c.ZeroFactor)return Be.ZERO;if(e===c.OneFactor)return Be.ONE;if(e===c.SrcColorFactor)return Be.SRC_COLOR;if(e===c.OneMinusSrcColorFactor)return Be.ONE_MINUS_SRC_COLOR;if(e===c.SrcAlphaFactor)return Be.SRC_ALPHA;if(e===c.OneMinusSrcAlphaFactor)return Be.ONE_MINUS_SRC_ALPHA;if(e===c.DstAlphaFactor)return Be.DST_ALPHA;if(e===c.OneMinusDstAlphaFactor)return Be.ONE_MINUS_DST_ALPHA;if(e===c.DstColorFactor)return Be.DST_COLOR;if(e===c.OneMinusDstColorFactor)return Be.ONE_MINUS_DST_COLOR;if(e===c.SrcAlphaSaturateFactor)return Be.SRC_ALPHA_SATURATE;if(t=bt.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===c.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===c.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===c.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===c.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=bt.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===c.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===c.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===c.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===c.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=bt.get("EXT_blend_minmax"),null!==t){if(e===c.MinEquation)return t.MIN_EXT;if(e===c.MaxEquation)return t.MAX_EXT}return 0}function pe(e){if(At&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var t=Be.getParameter(Be.MAX_VERTEX_UNIFORM_VECTORS),r=Math.floor((t-20)/4),n=r;return void 0!==e&&e instanceof c.SkinnedMesh&&(n=Math.min(e.skeleton.bones.length,n),n<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+n+" (try OpenGL instead of ANGLE)")),n}function me(e){for(var t=0,r=0,n=0,o=0,i=0,a=e.length;a>i;i++){var s=e[i];s.onlyShadow||s.visible===!1||(s instanceof c.DirectionalLight&&t++,s instanceof c.PointLight&&r++,s instanceof c.SpotLight&&n++,s instanceof c.HemisphereLight&&o++)}return{directional:t,point:r,spot:n,hemi:o}}function ge(e){for(var t=0,r=0,n=e.length;n>r;r++){var o=e[r];o.castShadow&&(o instanceof c.SpotLight&&t++,o instanceof c.DirectionalLight&&!o.shadowCascade&&t++)}return t}console.log("THREE.WebGLRenderer",c.REVISION),e=e||{};var ye=void 0!==e.canvas?e.canvas:document.createElement("canvas"),ve=void 0!==e.context?e.context:null,_e=1,be=void 0!==e.precision?e.precision:"highp",we=void 0!==e.alpha?e.alpha:!1,xe=void 0!==e.depth?e.depth:!0,Te=void 0!==e.stencil?e.stencil:!0,Me=void 0!==e.antialias?e.antialias:!1,Se=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,Ce=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,Ee=void 0!==e.logarithmicDepthBuffer?e.logarithmicDepthBuffer:!1,Ae=new c.Color(0),Le=0,Pe=[],Fe={},De=[],Re=[],Oe=[],ke=[],Ne=[];this.domElement=ye,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaInput=!1,this.gammaOutput=!1,this.shadowMapEnabled=!1,this.shadowMapType=c.PCFShadowMap,this.shadowMapCullFace=c.CullFaceFront,this.shadowMapDebug=!1,this.shadowMapCascade=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var Be,Ue=this,Ie=[],Ve=null,ze=null,Ge=-1,He="",je=null,We=0,Xe=-1,qe=-1,Ye=-1,Qe=-1,Ke=-1,Je=-1,Ze=-1,$e=-1,et=null,tt=null,rt=null,nt=null,ot=0,it=0,at=ye.width,st=ye.height,lt=0,ht=0,ut=new Uint8Array(16),ct=new Uint8Array(16),ft=new c.Frustum,dt=new c.Matrix4,pt=(new c.Matrix4,new c.Vector3),mt=new c.Vector3,gt=!0,yt={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};try{var vt={alpha:we,depth:xe,stencil:Te,antialias:Me,premultipliedAlpha:Se,preserveDrawingBuffer:Ce};if(Be=ve||ye.getContext("webgl",vt)||ye.getContext("experimental-webgl",vt),null===Be)throw null!==ye.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";ye.addEventListener("webglcontextlost",function(e){e.preventDefault(),xt(),wt(),Fe={}},!1)}catch(_t){console.error(_t)}void 0===Be.getShaderPrecisionFormat&&(Be.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var bt=new c.WebGLExtensions(Be);bt.get("OES_texture_float"),bt.get("OES_texture_float_linear"),bt.get("OES_standard_derivatives"),Ee&&bt.get("EXT_frag_depth");var wt=function(){Be.clearColor(0,0,0,1),Be.clearDepth(1),Be.clearStencil(0),Be.enable(Be.DEPTH_TEST),Be.depthFunc(Be.LEQUAL),Be.frontFace(Be.CCW),Be.cullFace(Be.BACK),Be.enable(Be.CULL_FACE),Be.enable(Be.BLEND),Be.blendEquation(Be.FUNC_ADD),Be.blendFunc(Be.SRC_ALPHA,Be.ONE_MINUS_SRC_ALPHA),Be.viewport(ot,it,at,st),Be.clearColor(Ae.r,Ae.g,Ae.b,Le)},xt=function(){Ve=null,je=null,Ye=-1,Ze=-1,$e=-1,Xe=-1,qe=-1,He="",Ge=-1,gt=!0;for(var e=0;e<ct.length;e++)ct[e]=0};wt(),this.context=Be;var Tt=Be.getParameter(Be.MAX_TEXTURE_IMAGE_UNITS),Mt=Be.getParameter(Be.MAX_VERTEX_TEXTURE_IMAGE_UNITS),St=Be.getParameter(Be.MAX_TEXTURE_SIZE),Ct=Be.getParameter(Be.MAX_CUBE_MAP_TEXTURE_SIZE),Et=Mt>0,At=Et&&bt.get("OES_texture_float"),Lt=Be.getShaderPrecisionFormat(Be.VERTEX_SHADER,Be.HIGH_FLOAT),Pt=Be.getShaderPrecisionFormat(Be.VERTEX_SHADER,Be.MEDIUM_FLOAT),Ft=(Be.getShaderPrecisionFormat(Be.VERTEX_SHADER,Be.LOW_FLOAT),Be.getShaderPrecisionFormat(Be.FRAGMENT_SHADER,Be.HIGH_FLOAT)),Dt=Be.getShaderPrecisionFormat(Be.FRAGMENT_SHADER,Be.MEDIUM_FLOAT),Rt=(Be.getShaderPrecisionFormat(Be.FRAGMENT_SHADER,Be.LOW_FLOAT),function(){var e;return function(){if(void 0!==e)return e;if(e=[],bt.get("WEBGL_compressed_texture_pvrtc")||bt.get("WEBGL_compressed_texture_s3tc"))for(var t=Be.getParameter(Be.COMPRESSED_TEXTURE_FORMATS),r=0;r<t.length;r++)e.push(t[r]);return e}}()),Ot=Lt.precision>0&&Ft.precision>0,kt=Pt.precision>0&&Dt.precision>0;"highp"!==be||Ot||(kt?(be="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(be="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==be||kt||(be="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var Nt=new c.ShadowMapPlugin(this,Pe,Fe,De),Bt=new c.SpritePlugin(this,ke),Ut=new c.LensFlarePlugin(this,Ne);this.getContext=function(){return Be},this.forceContextLoss=function(){bt.get("WEBGL_lose_context").loseContext()},this.supportsVertexTextures=function(){return Et},this.supportsFloatTextures=function(){return bt.get("OES_texture_float")},this.supportsStandardDerivatives=function(){return bt.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return bt.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return bt.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return bt.get("EXT_blend_minmax")},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=bt.get("EXT_texture_filter_anisotropic");return e=null!==t?Be.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return be},this.getPixelRatio=function(){return _e},this.setPixelRatio=function(e){_e=e},this.setSize=function(e,t,r){ye.width=e*_e,ye.height=t*_e,r!==!1&&(ye.style.width=e+"px",ye.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,r,n){ot=e*_e,it=t*_e,at=r*_e,st=n*_e,Be.viewport(ot,it,at,st)},this.setScissor=function(e,t,r,n){Be.scissor(e*_e,t*_e,r*_e,n*_e)},this.enableScissorTest=function(e){e?Be.enable(Be.SCISSOR_TEST):Be.disable(Be.SCISSOR_TEST)},this.getClearColor=function(){return Ae},this.setClearColor=function(e,t){Ae.set(e),Le=void 0!==t?t:1,Be.clearColor(Ae.r,Ae.g,Ae.b,Le)},this.getClearAlpha=function(){return Le},this.setClearAlpha=function(e){Le=e,Be.clearColor(Ae.r,Ae.g,Ae.b,Le)},this.clear=function(e,t,r){var n=0;(void 0===e||e)&&(n|=Be.COLOR_BUFFER_BIT),(void 0===t||t)&&(n|=Be.DEPTH_BUFFER_BIT),(void 0===r||r)&&(n|=Be.STENCIL_BUFFER_BIT),Be.clear(n)},this.clearColor=function(){Be.clear(Be.COLOR_BUFFER_BIT)},this.clearDepth=function(){Be.clear(Be.DEPTH_BUFFER_BIT)},this.clearStencil=function(){Be.clear(Be.STENCIL_BUFFER_BIT)},this.clearTarget=function(e,t,r,n){this.setRenderTarget(e),this.clear(t,r,n)},this.resetGLState=xt;var It=function(e){var t=function(t){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e){var t=e.target;t.traverse(function(e){e.removeEventListener("remove",It),k(e)})}),Vt=function(e){var t=function(t){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e){var t=e.target;t.removeEventListener("dispose",Vt),Wt(t)}),zt=function(e){var t=function(t){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e){var t=e.target;t.removeEventListener("dispose",zt),Xt(t),Ue.info.memory.textures--}),Gt=function(e){var t=function(t){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e){var t=e.target;t.removeEventListener("dispose",Gt),qt(t),Ue.info.memory.textures--}),Ht=function(e){var t=function(t){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e){var t=e.target;t.removeEventListener("dispose",Ht),Yt(t)}),jt=function(e){for(var t=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"],r=0,n=t.length;n>r;r++){var o=t[r];void 0!==e[o]&&(Be.deleteBuffer(e[o]),delete e[o])}if(void 0!==e.__webglCustomAttributesList){for(var o in e.__webglCustomAttributesList)Be.deleteBuffer(e.__webglCustomAttributesList[o].buffer);delete e.__webglCustomAttributesList}Ue.info.memory.geometries--},Wt=function(e){if(delete e.__webglInit,e instanceof c.BufferGeometry){for(var t in e.attributes){var r=e.attributes[t];void 0!==r.buffer&&(Be.deleteBuffer(r.buffer),delete r.buffer)}Ue.info.memory.geometries--}else{var n=Qt[e.id];if(void 0!==n){for(var o=0,i=n.length;i>o;o++){var a=n[o];if(void 0!==a.numMorphTargets){for(var s=0,l=a.numMorphTargets;l>s;s++)Be.deleteBuffer(a.__webglMorphTargetsBuffers[s]);delete a.__webglMorphTargetsBuffers}if(void 0!==a.numMorphNormals){for(var s=0,l=a.numMorphNormals;l>s;s++)Be.deleteBuffer(a.__webglMorphNormalsBuffers[s]);delete a.__webglMorphNormalsBuffers}jt(a)}delete Qt[e.id]}else jt(e)}He=""},Xt=function(e){if(e.image&&e.image.__webglTextureCube)Be.deleteTexture(e.image.__webglTextureCube),delete e.image.__webglTextureCube;else{if(void 0===e.__webglInit)return;Be.deleteTexture(e.__webglTexture),delete e.__webglTexture,delete e.__webglInit}},qt=function(e){if(e&&void 0!==e.__webglTexture){if(Be.deleteTexture(e.__webglTexture),delete e.__webglTexture,e instanceof c.WebGLRenderTargetCube)for(var t=0;6>t;t++)Be.deleteFramebuffer(e.__webglFramebuffer[t]),Be.deleteRenderbuffer(e.__webglRenderbuffer[t]);else Be.deleteFramebuffer(e.__webglFramebuffer),Be.deleteRenderbuffer(e.__webglRenderbuffer);delete e.__webglFramebuffer,delete e.__webglRenderbuffer}},Yt=function(e){var t=e.program.program;if(void 0!==t){e.program=void 0;var r,n,o,i=!1;for(r=0,n=Ie.length;n>r;r++)if(o=Ie[r],o.program===t){o.usedTimes--,0===o.usedTimes&&(i=!0);break}if(i===!0){var a=[];for(r=0,n=Ie.length;n>r;r++)o=Ie[r],o.program!==t&&a.push(o);Ie=a,Be.deleteProgram(t),Ue.info.memory.programs--}}};this.renderBufferImmediate=function(e,t,r){if(m(),e.hasPositions&&!e.__webglVertexBuffer&&(e.__webglVertexBuffer=Be.createBuffer()),e.hasNormals&&!e.__webglNormalBuffer&&(e.__webglNormalBuffer=Be.createBuffer()),e.hasUvs&&!e.__webglUvBuffer&&(e.__webglUvBuffer=Be.createBuffer()),e.hasColors&&!e.__webglColorBuffer&&(e.__webglColorBuffer=Be.createBuffer()),e.hasPositions&&(Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglVertexBuffer),Be.bufferData(Be.ARRAY_BUFFER,e.positionArray,Be.DYNAMIC_DRAW),g(t.attributes.position),Be.vertexAttribPointer(t.attributes.position,3,Be.FLOAT,!1,0,0)),e.hasNormals){if(Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglNormalBuffer),r.shading===c.FlatShading){var n,o,i,a,s,l,h,u,f,d,p,v,_,b,w=3*e.count;for(b=0;w>b;b+=9)_=e.normalArray,a=_[b],h=_[b+1],d=_[b+2],s=_[b+3],u=_[b+4],p=_[b+5],l=_[b+6],f=_[b+7],v=_[b+8],n=(a+s+l)/3,o=(h+u+f)/3,i=(d+p+v)/3,_[b]=n,_[b+1]=o,_[b+2]=i,_[b+3]=n,_[b+4]=o,_[b+5]=i,_[b+6]=n,_[b+7]=o,_[b+8]=i}Be.bufferData(Be.ARRAY_BUFFER,e.normalArray,Be.DYNAMIC_DRAW),g(t.attributes.normal),Be.vertexAttribPointer(t.attributes.normal,3,Be.FLOAT,!1,0,0)}e.hasUvs&&r.map&&(Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglUvBuffer),Be.bufferData(Be.ARRAY_BUFFER,e.uvArray,Be.DYNAMIC_DRAW),g(t.attributes.uv),Be.vertexAttribPointer(t.attributes.uv,2,Be.FLOAT,!1,0,0)),e.hasColors&&r.vertexColors!==c.NoColors&&(Be.bindBuffer(Be.ARRAY_BUFFER,e.__webglColorBuffer),Be.bufferData(Be.ARRAY_BUFFER,e.colorArray,Be.DYNAMIC_DRAW),g(t.attributes.color),Be.vertexAttribPointer(t.attributes.color,3,Be.FLOAT,!1,0,0)),y(),Be.drawArrays(Be.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,r,n,o,i){if(n.visible!==!1){D(i);var a=U(e,t,r,n,i),s=!1,l=n.wireframe?1:0,h="direct_"+o.id+"_"+a.id+"_"+l;if(h!==He&&(He=h,s=!0),s&&m(),i instanceof c.Mesh){var u=n.wireframe===!0?Be.LINES:Be.TRIANGLES,f=o.attributes.index;if(f){var d,g;f.array instanceof Uint32Array&&bt.get("OES_element_index_uint")?(d=Be.UNSIGNED_INT,g=4):(d=Be.UNSIGNED_SHORT,g=2);var y=o.offsets;if(0===y.length)s&&(p(n,a,o,0),Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,f.buffer)),Be.drawElements(u,f.array.length,d,0),Ue.info.render.calls++,Ue.info.render.vertices+=f.array.length,Ue.info.render.faces+=f.array.length/3;else{s=!0;for(var v=0,_=y.length;_>v;v++){var b=y[v].index;s&&(p(n,a,o,b),Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,f.buffer)),Be.drawElements(u,y[v].count,d,y[v].start*g),Ue.info.render.calls++,Ue.info.render.vertices+=y[v].count,Ue.info.render.faces+=y[v].count/3}}}else{s&&p(n,a,o,0);var w=o.attributes.position;Be.drawArrays(u,0,w.array.length/3),Ue.info.render.calls++,Ue.info.render.vertices+=w.array.length/3,Ue.info.render.faces+=w.array.length/9}}else if(i instanceof c.PointCloud){var u=Be.POINTS,f=o.attributes.index;if(f){var d,g;f.array instanceof Uint32Array&&bt.get("OES_element_index_uint")?(d=Be.UNSIGNED_INT,g=4):(d=Be.UNSIGNED_SHORT,g=2);var y=o.offsets;if(0===y.length)s&&(p(n,a,o,0),Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,f.buffer)),Be.drawElements(u,f.array.length,d,0),Ue.info.render.calls++,Ue.info.render.points+=f.array.length;else{y.length>1&&(s=!0);for(var v=0,_=y.length;_>v;v++){var b=y[v].index;s&&(p(n,a,o,b),Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,f.buffer)),Be.drawElements(u,y[v].count,d,y[v].start*g),Ue.info.render.calls++,Ue.info.render.points+=y[v].count}}}else{s&&p(n,a,o,0);var w=o.attributes.position,y=o.offsets;if(0===y.length)Be.drawArrays(u,0,w.array.length/3),Ue.info.render.calls++,Ue.info.render.points+=w.array.length/3;else for(var v=0,_=y.length;_>v;v++)Be.drawArrays(u,y[v].index,y[v].count),Ue.info.render.calls++,Ue.info.render.points+=y[v].count}}else if(i instanceof c.Line){var u=i.mode===c.LineStrip?Be.LINE_STRIP:Be.LINES;ne(n.linewidth);var f=o.attributes.index;if(f){var d,g;f.array instanceof Uint32Array?(d=Be.UNSIGNED_INT,g=4):(d=Be.UNSIGNED_SHORT,g=2);var y=o.offsets;if(0===y.length)s&&(p(n,a,o,0),Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,f.buffer)),Be.drawElements(u,f.array.length,d,0),Ue.info.render.calls++,Ue.info.render.vertices+=f.array.length;else{y.length>1&&(s=!0);for(var v=0,_=y.length;_>v;v++){var b=y[v].index;s&&(p(n,a,o,b),Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,f.buffer)),Be.drawElements(u,y[v].count,d,y[v].start*g),Ue.info.render.calls++,Ue.info.render.vertices+=y[v].count}}}else{s&&p(n,a,o,0);var w=o.attributes.position,y=o.offsets;if(0===y.length)Be.drawArrays(u,0,w.array.length/3),Ue.info.render.calls++,Ue.info.render.vertices+=w.array.length/3;else for(var v=0,_=y.length;_>v;v++)Be.drawArrays(u,y[v].index,y[v].count),Ue.info.render.calls++,Ue.info.render.vertices+=y[v].count}}}},this.renderBuffer=function(e,t,r,n,o,i){if(n.visible!==!1){D(i);var a=U(e,t,r,n,i),s=a.attributes,l=!1,h=n.wireframe?1:0,u=o.id+"_"+a.id+"_"+h;if(u!==He&&(He=u,l=!0),l&&m(),!n.morphTargets&&s.position>=0?l&&(Be.bindBuffer(Be.ARRAY_BUFFER,o.__webglVertexBuffer),g(s.position),Be.vertexAttribPointer(s.position,3,Be.FLOAT,!1,0,0)):i.morphTargetBase&&v(n,o,i),l){if(o.__webglCustomAttributesList)for(var f=0,d=o.__webglCustomAttributesList.length;d>f;f++){var p=o.__webglCustomAttributesList[f];s[p.buffer.belongsToAttribute]>=0&&(Be.bindBuffer(Be.ARRAY_BUFFER,p.buffer),g(s[p.buffer.belongsToAttribute]),
Be.vertexAttribPointer(s[p.buffer.belongsToAttribute],p.size,Be.FLOAT,!1,0,0))}s.color>=0&&(i.geometry.colors.length>0||i.geometry.faces.length>0?(Be.bindBuffer(Be.ARRAY_BUFFER,o.__webglColorBuffer),g(s.color),Be.vertexAttribPointer(s.color,3,Be.FLOAT,!1,0,0)):void 0!==n.defaultAttributeValues&&Be.vertexAttrib3fv(s.color,n.defaultAttributeValues.color)),s.normal>=0&&(Be.bindBuffer(Be.ARRAY_BUFFER,o.__webglNormalBuffer),g(s.normal),Be.vertexAttribPointer(s.normal,3,Be.FLOAT,!1,0,0)),s.tangent>=0&&(Be.bindBuffer(Be.ARRAY_BUFFER,o.__webglTangentBuffer),g(s.tangent),Be.vertexAttribPointer(s.tangent,4,Be.FLOAT,!1,0,0)),s.uv>=0&&(i.geometry.faceVertexUvs[0]?(Be.bindBuffer(Be.ARRAY_BUFFER,o.__webglUVBuffer),g(s.uv),Be.vertexAttribPointer(s.uv,2,Be.FLOAT,!1,0,0)):void 0!==n.defaultAttributeValues&&Be.vertexAttrib2fv(s.uv,n.defaultAttributeValues.uv)),s.uv2>=0&&(i.geometry.faceVertexUvs[1]?(Be.bindBuffer(Be.ARRAY_BUFFER,o.__webglUV2Buffer),g(s.uv2),Be.vertexAttribPointer(s.uv2,2,Be.FLOAT,!1,0,0)):void 0!==n.defaultAttributeValues&&Be.vertexAttrib2fv(s.uv2,n.defaultAttributeValues.uv2)),n.skinning&&s.skinIndex>=0&&s.skinWeight>=0&&(Be.bindBuffer(Be.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),g(s.skinIndex),Be.vertexAttribPointer(s.skinIndex,4,Be.FLOAT,!1,0,0),Be.bindBuffer(Be.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),g(s.skinWeight),Be.vertexAttribPointer(s.skinWeight,4,Be.FLOAT,!1,0,0)),s.lineDistance>=0&&(Be.bindBuffer(Be.ARRAY_BUFFER,o.__webglLineDistanceBuffer),g(s.lineDistance),Be.vertexAttribPointer(s.lineDistance,1,Be.FLOAT,!1,0,0))}if(y(),i instanceof c.Mesh){var _=o.__typeArray===Uint32Array?Be.UNSIGNED_INT:Be.UNSIGNED_SHORT;n.wireframe?(ne(n.wireframeLinewidth),l&&Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),Be.drawElements(Be.LINES,o.__webglLineCount,_,0)):(l&&Be.bindBuffer(Be.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),Be.drawElements(Be.TRIANGLES,o.__webglFaceCount,_,0)),Ue.info.render.calls++,Ue.info.render.vertices+=o.__webglFaceCount,Ue.info.render.faces+=o.__webglFaceCount/3}else if(i instanceof c.Line){var b=i.mode===c.LineStrip?Be.LINE_STRIP:Be.LINES;ne(n.linewidth),Be.drawArrays(b,0,o.__webglLineCount),Ue.info.render.calls++}else i instanceof c.PointCloud&&(Be.drawArrays(Be.POINTS,0,o.__webglParticleCount),Ue.info.render.calls++,Ue.info.render.points+=o.__webglParticleCount)}},this.render=function(e,t,r,n){if(t instanceof c.Camera==!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=e.fog;He="",Ge=-1,je=null,gt=!0,e.autoUpdate===!0&&e.updateMatrixWorld(),void 0===t.parent&&t.updateMatrixWorld(),e.traverse(function(e){e instanceof c.SkinnedMesh&&e.skeleton.update()}),t.matrixWorldInverse.getInverse(t.matrixWorld),dt.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ft.setFromMatrix(dt),Pe.length=0,Re.length=0,Oe.length=0,ke.length=0,Ne.length=0,x(e),Ue.sortObjects===!0&&(Re.sort(_),Oe.sort(b)),Nt.render(e,t),Ue.info.render.calls=0,Ue.info.render.vertices=0,Ue.info.render.faces=0,Ue.info.render.points=0,this.setRenderTarget(r),(this.autoClear||n)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);for(var i=0,a=De.length;a>i;i++){var s=De[i],l=s.object;l.visible&&(Z(l,t),S(s))}if(e.overrideMaterial){var h=e.overrideMaterial;this.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst),this.setDepthTest(h.depthTest),this.setDepthWrite(h.depthWrite),oe(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits),T(Re,t,Pe,o,!0,h),T(Oe,t,Pe,o,!0,h),M(De,"",t,Pe,o,!1,h)}else{var h=null;this.setBlending(c.NoBlending),T(Re,t,Pe,o,!1,h),M(De,"opaque",t,Pe,o,!1,h),T(Oe,t,Pe,o,!0,h),M(De,"transparent",t,Pe,o,!0,h)}Bt.render(e,t),Ut.render(e,t,lt,ht),r&&r.generateMipmaps&&r.minFilter!==c.NearestFilter&&r.minFilter!==c.LinearFilter&&ce(r),this.setDepthTest(!0),this.setDepthWrite(!0)},this.renderImmediateObject=function(e,t,r,n,o){var i=U(e,t,r,n,o);He="",Ue.setMaterialFaces(n),o.immediateRenderCallback?o.immediateRenderCallback(i,Be,ft):o.render(function(e){Ue.renderBufferImmediate(e,i,n)})};var Qt={},Kt=0,Jt={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(e,t){e===c.CullFaceNone?Be.disable(Be.CULL_FACE):(t===c.FrontFaceDirectionCW?Be.frontFace(Be.CW):Be.frontFace(Be.CCW),e===c.CullFaceBack?Be.cullFace(Be.BACK):e===c.CullFaceFront?Be.cullFace(Be.FRONT):Be.cullFace(Be.FRONT_AND_BACK),Be.enable(Be.CULL_FACE))},this.setMaterialFaces=function(e){var t=e.side===c.DoubleSide,r=e.side===c.BackSide;Xe!==t&&(t?Be.disable(Be.CULL_FACE):Be.enable(Be.CULL_FACE),Xe=t),qe!==r&&(r?Be.frontFace(Be.CW):Be.frontFace(Be.CCW),qe=r)},this.setDepthTest=function(e){Ze!==e&&(e?Be.enable(Be.DEPTH_TEST):Be.disable(Be.DEPTH_TEST),Ze=e)},this.setDepthWrite=function(e){$e!==e&&(Be.depthMask(e),$e=e)},this.setBlending=function(e,t,r,n){e!==Ye&&(e===c.NoBlending?Be.disable(Be.BLEND):e===c.AdditiveBlending?(Be.enable(Be.BLEND),Be.blendEquation(Be.FUNC_ADD),Be.blendFunc(Be.SRC_ALPHA,Be.ONE)):e===c.SubtractiveBlending?(Be.enable(Be.BLEND),Be.blendEquation(Be.FUNC_ADD),Be.blendFunc(Be.ZERO,Be.ONE_MINUS_SRC_COLOR)):e===c.MultiplyBlending?(Be.enable(Be.BLEND),Be.blendEquation(Be.FUNC_ADD),Be.blendFunc(Be.ZERO,Be.SRC_COLOR)):e===c.CustomBlending?Be.enable(Be.BLEND):(Be.enable(Be.BLEND),Be.blendEquationSeparate(Be.FUNC_ADD,Be.FUNC_ADD),Be.blendFuncSeparate(Be.SRC_ALPHA,Be.ONE_MINUS_SRC_ALPHA,Be.ONE,Be.ONE_MINUS_SRC_ALPHA)),Ye=e),e===c.CustomBlending?(t!==Qe&&(Be.blendEquation(de(t)),Qe=t),(r!==Ke||n!==Je)&&(Be.blendFunc(de(r),de(n)),Ke=r,Je=n)):(Qe=null,Ke=null,Je=null)},this.uploadTexture=function(e){void 0===e.__webglInit&&(e.__webglInit=!0,e.addEventListener("dispose",zt),e.__webglTexture=Be.createTexture(),Ue.info.memory.textures++),Be.bindTexture(Be.TEXTURE_2D,e.__webglTexture),Be.pixelStorei(Be.UNPACK_FLIP_Y_WEBGL,e.flipY),Be.pixelStorei(Be.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Be.pixelStorei(Be.UNPACK_ALIGNMENT,e.unpackAlignment),e.image=ae(e.image,St);var t=e.image,r=c.Math.isPowerOfTwo(t.width)&&c.Math.isPowerOfTwo(t.height),n=de(e.format),o=de(e.type);ie(Be.TEXTURE_2D,e,r);var i,a=e.mipmaps;if(e instanceof c.DataTexture)if(a.length>0&&r){for(var s=0,l=a.length;l>s;s++)i=a[s],Be.texImage2D(Be.TEXTURE_2D,s,n,i.width,i.height,0,n,o,i.data);e.generateMipmaps=!1}else Be.texImage2D(Be.TEXTURE_2D,0,n,t.width,t.height,0,n,o,t.data);else if(e instanceof c.CompressedTexture)for(var s=0,l=a.length;l>s;s++)i=a[s],e.format!==c.RGBAFormat&&e.format!==c.RGBFormat?Rt().indexOf(n)>-1?Be.compressedTexImage2D(Be.TEXTURE_2D,s,n,i.width,i.height,0,i.data):console.warn("Attempt to load unsupported compressed texture format"):Be.texImage2D(Be.TEXTURE_2D,s,n,i.width,i.height,0,n,o,i.data);else if(a.length>0&&r){for(var s=0,l=a.length;l>s;s++)i=a[s],Be.texImage2D(Be.TEXTURE_2D,s,n,n,o,i);e.generateMipmaps=!1}else Be.texImage2D(Be.TEXTURE_2D,0,n,n,o,e.image);e.generateMipmaps&&r&&Be.generateMipmap(Be.TEXTURE_2D),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()},this.setTexture=function(e,t){Be.activeTexture(Be.TEXTURE0+t),e.needsUpdate?Ue.uploadTexture(e):Be.bindTexture(Be.TEXTURE_2D,e.__webglTexture)},this.setRenderTarget=function(e){var t=e instanceof c.WebGLRenderTargetCube;if(e&&void 0===e.__webglFramebuffer){void 0===e.depthBuffer&&(e.depthBuffer=!0),void 0===e.stencilBuffer&&(e.stencilBuffer=!0),e.addEventListener("dispose",Gt),e.__webglTexture=Be.createTexture(),Ue.info.memory.textures++;var r=c.Math.isPowerOfTwo(e.width)&&c.Math.isPowerOfTwo(e.height),n=de(e.format),o=de(e.type);if(t){e.__webglFramebuffer=[],e.__webglRenderbuffer=[],Be.bindTexture(Be.TEXTURE_CUBE_MAP,e.__webglTexture),ie(Be.TEXTURE_CUBE_MAP,e,r);for(var i=0;6>i;i++)e.__webglFramebuffer[i]=Be.createFramebuffer(),e.__webglRenderbuffer[i]=Be.createRenderbuffer(),Be.texImage2D(Be.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,n,e.width,e.height,0,n,o,null),he(e.__webglFramebuffer[i],e,Be.TEXTURE_CUBE_MAP_POSITIVE_X+i),ue(e.__webglRenderbuffer[i],e);r&&Be.generateMipmap(Be.TEXTURE_CUBE_MAP)}else e.__webglFramebuffer=Be.createFramebuffer(),e.shareDepthFrom?e.__webglRenderbuffer=e.shareDepthFrom.__webglRenderbuffer:e.__webglRenderbuffer=Be.createRenderbuffer(),Be.bindTexture(Be.TEXTURE_2D,e.__webglTexture),ie(Be.TEXTURE_2D,e,r),Be.texImage2D(Be.TEXTURE_2D,0,n,e.width,e.height,0,n,o,null),he(e.__webglFramebuffer,e,Be.TEXTURE_2D),e.shareDepthFrom?e.depthBuffer&&!e.stencilBuffer?Be.framebufferRenderbuffer(Be.FRAMEBUFFER,Be.DEPTH_ATTACHMENT,Be.RENDERBUFFER,e.__webglRenderbuffer):e.depthBuffer&&e.stencilBuffer&&Be.framebufferRenderbuffer(Be.FRAMEBUFFER,Be.DEPTH_STENCIL_ATTACHMENT,Be.RENDERBUFFER,e.__webglRenderbuffer):ue(e.__webglRenderbuffer,e),r&&Be.generateMipmap(Be.TEXTURE_2D);t?Be.bindTexture(Be.TEXTURE_CUBE_MAP,null):Be.bindTexture(Be.TEXTURE_2D,null),Be.bindRenderbuffer(Be.RENDERBUFFER,null),Be.bindFramebuffer(Be.FRAMEBUFFER,null)}var a,s,l,h,u;e?(a=t?e.__webglFramebuffer[e.activeCubeFace]:e.__webglFramebuffer,s=e.width,l=e.height,h=0,u=0):(a=null,s=at,l=st,h=ot,u=it),a!==ze&&(Be.bindFramebuffer(Be.FRAMEBUFFER,a),Be.viewport(h,u,s,l),ze=a),lt=s,ht=l},this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},c.WebGLRenderTarget=function(e,t,r){this.width=e,this.height=t,r=r||{},this.wrapS=void 0!==r.wrapS?r.wrapS:c.ClampToEdgeWrapping,this.wrapT=void 0!==r.wrapT?r.wrapT:c.ClampToEdgeWrapping,this.magFilter=void 0!==r.magFilter?r.magFilter:c.LinearFilter,this.minFilter=void 0!==r.minFilter?r.minFilter:c.LinearMipMapLinearFilter,this.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,this.offset=new c.Vector2(0,0),this.repeat=new c.Vector2(1,1),this.format=void 0!==r.format?r.format:c.RGBAFormat,this.type=void 0!==r.type?r.type:c.UnsignedByteType,this.depthBuffer=void 0!==r.depthBuffer?r.depthBuffer:!0,this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0,this.generateMipmaps=!0,this.shareDepthFrom=null},c.WebGLRenderTarget.prototype={constructor:c.WebGLRenderTarget,setSize:function(e,t){this.width=e,this.height=t},clone:function(){var e=new c.WebGLRenderTarget(this.width,this.height);return e.wrapS=this.wrapS,e.wrapT=this.wrapT,e.magFilter=this.magFilter,e.minFilter=this.minFilter,e.anisotropy=this.anisotropy,e.offset.copy(this.offset),e.repeat.copy(this.repeat),e.format=this.format,e.type=this.type,e.depthBuffer=this.depthBuffer,e.stencilBuffer=this.stencilBuffer,e.generateMipmaps=this.generateMipmaps,e.shareDepthFrom=this.shareDepthFrom,e},dispose:function(){this.dispatchEvent({type:"dispose"})}},c.EventDispatcher.prototype.apply(c.WebGLRenderTarget.prototype),c.WebGLRenderTargetCube=function(e,t,r){c.WebGLRenderTarget.call(this,e,t,r),this.activeCubeFace=0},c.WebGLRenderTargetCube.prototype=Object.create(c.WebGLRenderTarget.prototype),c.WebGLRenderTargetCube.prototype.constructor=c.WebGLRenderTargetCube,c.WebGLExtensions=function(e){var t={};this.get=function(r){if(void 0!==t[r])return t[r];var n;switch(r){case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(r)}return null===n&&console.log("THREE.WebGLRenderer: "+r+" extension not supported."),t[r]=n,n}},c.WebGLProgram=function(){var e=0,t=function(e){var t,r,n=[];for(var o in e)t=e[o],t!==!1&&(r="#define "+o+" "+t,n.push(r));return n.join("\n")},r=function(e,t,r){for(var n={},o=0,i=r.length;i>o;o++){var a=r[o];n[a]=e.getUniformLocation(t,a)}return n},n=function(e,t,r){for(var n={},o=0,i=r.length;i>o;o++){var a=r[o];n[a]=e.getAttribLocation(t,a)}return n};return function(o,i,a,s){var l=o,h=l.context,u=a.defines,f=a.__webglShader.uniforms,d=a.attributes,p=a.__webglShader.vertexShader,m=a.__webglShader.fragmentShader,g=a.index0AttributeName;void 0===g&&s.morphTargets===!0&&(g="position");var y="SHADOWMAP_TYPE_BASIC";s.shadowMapType===c.PCFShadowMap?y="SHADOWMAP_TYPE_PCF":s.shadowMapType===c.PCFSoftShadowMap&&(y="SHADOWMAP_TYPE_PCF_SOFT");var v="ENVMAP_TYPE_CUBE",_="ENVMAP_MODE_REFLECTION",b="ENVMAP_BLENDING_MULTIPLY";if(s.envMap){switch(a.envMap.mapping){case c.CubeReflectionMapping:case c.CubeRefractionMapping:v="ENVMAP_TYPE_CUBE";break;case c.EquirectangularReflectionMapping:case c.EquirectangularRefractionMapping:v="ENVMAP_TYPE_EQUIREC";break;case c.SphericalReflectionMapping:v="ENVMAP_TYPE_SPHERE"}switch(a.envMap.mapping){case c.CubeRefractionMapping:case c.EquirectangularRefractionMapping:_="ENVMAP_MODE_REFRACTION"}switch(a.combine){case c.MultiplyOperation:b="ENVMAP_BLENDING_MULTIPLY";break;case c.MixOperation:b="ENVMAP_BLENDING_MIX";break;case c.AddOperation:b="ENVMAP_BLENDING_ADD"}}var w,x,T=t(u),M=h.createProgram();a instanceof c.RawShaderMaterial?(w="",x=""):(w=["precision "+s.precision+" float;","precision "+s.precision+" int;",T,s.supportsVertexTextures?"#define VERTEX_TEXTURES":"",l.gammaInput?"#define GAMMA_INPUT":"",l.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,"#define MAX_SPOT_LIGHTS "+s.maxSpotLights,"#define MAX_HEMI_LIGHTS "+s.maxHemiLights,"#define MAX_SHADOWS "+s.maxShadows,"#define MAX_BONES "+s.maxBones,s.map?"#define USE_MAP":"",s.envMap?"#define USE_ENVMAP":"",s.envMap?"#define "+_:"",s.lightMap?"#define USE_LIGHTMAP":"",s.bumpMap?"#define USE_BUMPMAP":"",s.normalMap?"#define USE_NORMALMAP":"",s.specularMap?"#define USE_SPECULARMAP":"",s.alphaMap?"#define USE_ALPHAMAP":"",s.vertexColors?"#define USE_COLOR":"",s.skinning?"#define USE_SKINNING":"",s.useVertexTexture?"#define BONE_TEXTURE":"",s.morphTargets?"#define USE_MORPHTARGETS":"",s.morphNormals?"#define USE_MORPHNORMALS":"",s.wrapAround?"#define WRAP_AROUND":"",s.doubleSided?"#define DOUBLE_SIDED":"",s.flipSided?"#define FLIP_SIDED":"",s.shadowMapEnabled?"#define USE_SHADOWMAP":"",s.shadowMapEnabled?"#define "+y:"",s.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",s.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",s.sizeAttenuation?"#define USE_SIZEATTENUATION":"",s.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","attribute vec2 uv2;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",""].join("\n"),x=["precision "+s.precision+" float;","precision "+s.precision+" int;",s.bumpMap||s.normalMap?"#extension GL_OES_standard_derivatives : enable":"",T,"#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,"#define MAX_SPOT_LIGHTS "+s.maxSpotLights,"#define MAX_HEMI_LIGHTS "+s.maxHemiLights,"#define MAX_SHADOWS "+s.maxShadows,s.alphaTest?"#define ALPHATEST "+s.alphaTest:"",l.gammaInput?"#define GAMMA_INPUT":"",l.gammaOutput?"#define GAMMA_OUTPUT":"",s.useFog&&s.fog?"#define USE_FOG":"",s.useFog&&s.fogExp?"#define FOG_EXP2":"",s.map?"#define USE_MAP":"",s.envMap?"#define USE_ENVMAP":"",s.envMap?"#define "+v:"",s.envMap?"#define "+_:"",s.envMap?"#define "+b:"",s.lightMap?"#define USE_LIGHTMAP":"",s.bumpMap?"#define USE_BUMPMAP":"",s.normalMap?"#define USE_NORMALMAP":"",s.specularMap?"#define USE_SPECULARMAP":"",s.alphaMap?"#define USE_ALPHAMAP":"",s.vertexColors?"#define USE_COLOR":"",s.metal?"#define METAL":"",s.wrapAround?"#define WRAP_AROUND":"",s.doubleSided?"#define DOUBLE_SIDED":"",s.flipSided?"#define FLIP_SIDED":"",s.shadowMapEnabled?"#define USE_SHADOWMAP":"",s.shadowMapEnabled?"#define "+y:"",s.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",s.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",s.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"));var S=new c.WebGLShader(h,h.VERTEX_SHADER,w+p),C=new c.WebGLShader(h,h.FRAGMENT_SHADER,x+m);h.attachShader(M,S),h.attachShader(M,C),void 0!==g&&h.bindAttribLocation(M,0,g),h.linkProgram(M),h.getProgramParameter(M,h.LINK_STATUS)===!1&&(console.error("THREE.WebGLProgram: Could not initialise shader."),console.error("gl.VALIDATE_STATUS",h.getProgramParameter(M,h.VALIDATE_STATUS)),console.error("gl.getError()",h.getError())),""!==h.getProgramInfoLog(M)&&console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",h.getProgramInfoLog(M)),h.deleteShader(S),h.deleteShader(C);var E=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];s.useVertexTexture?(E.push("boneTexture"),E.push("boneTextureWidth"),E.push("boneTextureHeight")):E.push("boneGlobalMatrices"),s.logarithmicDepthBuffer&&E.push("logDepthBufFC");for(var A in f)E.push(A);this.uniforms=r(h,M,E),E=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var L=0;L<s.maxMorphTargets;L++)E.push("morphTarget"+L);for(var L=0;L<s.maxMorphNormals;L++)E.push("morphNormal"+L);for(var P in d)E.push(P);return this.attributes=n(h,M,E),this.attributesKeys=Object.keys(this.attributes),this.id=e++,this.code=i,this.usedTimes=1,this.program=M,this.vertexShader=S,this.fragmentShader=C,this}}(),c.WebGLShader=function(){var e=function(e){for(var t=e.split("\n"),r=0;r<t.length;r++)t[r]=r+1+": "+t[r];return t.join("\n")};return function(t,r,n){var o=t.createShader(r);return t.shaderSource(o,n),t.compileShader(o),t.getShaderParameter(o,t.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(o)&&(console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t.getShaderInfoLog(o)),console.warn(e(n))),o}}(),c.LensFlarePlugin=function(e,t){function r(t){var r=f.createProgram(),n=f.createShader(f.FRAGMENT_SHADER),o=f.createShader(f.VERTEX_SHADER),i="precision "+e.getPrecision()+" float;\n";return f.shaderSource(n,i+t.fragmentShader),f.shaderSource(o,i+t.vertexShader),f.compileShader(n),f.compileShader(o),f.attachShader(r,n),f.attachShader(r,o),f.linkProgram(r),r}var n,o,i,a,s,l,h,u,f=e.context,d=function(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),t=new Uint16Array([0,1,2,0,2,3]);n=f.createBuffer(),o=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,n),f.bufferData(f.ARRAY_BUFFER,e,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.bufferData(f.ELEMENT_ARRAY_BUFFER,t,f.STATIC_DRAW),h=f.createTexture(),u=f.createTexture(),f.bindTexture(f.TEXTURE_2D,h),f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),f.bindTexture(f.TEXTURE_2D,u),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),l=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;var c;c=l?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},i=r(c),a={vertex:f.getAttribLocation(i,"position"),uv:f.getAttribLocation(i,"uv")},s={renderType:f.getUniformLocation(i,"renderType"),map:f.getUniformLocation(i,"map"),occlusionMap:f.getUniformLocation(i,"occlusionMap"),opacity:f.getUniformLocation(i,"opacity"),color:f.getUniformLocation(i,"color"),scale:f.getUniformLocation(i,"scale"),rotation:f.getUniformLocation(i,"rotation"),screenPosition:f.getUniformLocation(i,"screenPosition")}};this.render=function(r,p,m,g){if(0!==t.length){var y=new c.Vector3,v=g/m,_=.5*m,b=.5*g,w=16/g,x=new c.Vector2(w*v,w),T=new c.Vector3(1,1,0),M=new c.Vector2(1,1);void 0===i&&d(),f.useProgram(i),f.enableVertexAttribArray(a.vertex),f.enableVertexAttribArray(a.uv),f.uniform1i(s.occlusionMap,0),f.uniform1i(s.map,1),f.bindBuffer(f.ARRAY_BUFFER,n),f.vertexAttribPointer(a.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(a.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.disable(f.CULL_FACE),f.depthMask(!1);for(var S=0,C=t.length;C>S;S++){w=16/g,x.set(w*v,w);var E=t[S];if(y.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]),y.applyMatrix4(p.matrixWorldInverse),y.applyProjection(p.projectionMatrix),T.copy(y),M.x=T.x*_+_,M.y=T.y*b+b,l||M.x>0&&M.x<m&&M.y>0&&M.y<g){f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,h),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGB,M.x-8,M.y-8,16,16,0),f.uniform1i(s.renderType,0),f.uniform2f(s.scale,x.x,x.y),f.uniform3f(s.screenPosition,T.x,T.y,T.z),f.disable(f.BLEND),f.enable(f.DEPTH_TEST),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),f.activeTexture(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,u),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGBA,M.x-8,M.y-8,16,16,0),f.uniform1i(s.renderType,1),f.disable(f.DEPTH_TEST),f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,h),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),E.positionScreen.copy(T),E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares(),f.uniform1i(s.renderType,2),f.enable(f.BLEND);for(var A=0,L=E.lensFlares.length;L>A;A++){var P=E.lensFlares[A];P.opacity>.001&&P.scale>.001&&(T.x=P.x,T.y=P.y,T.z=P.z,w=P.size*P.scale/g,x.x=w*v,x.y=w,f.uniform3f(s.screenPosition,T.x,T.y,T.z),f.uniform2f(s.scale,x.x,x.y),f.uniform1f(s.rotation,P.rotation),f.uniform1f(s.opacity,P.opacity),f.uniform3f(s.color,P.color.r,P.color.g,P.color.b),e.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),e.setTexture(P.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}f.enable(f.CULL_FACE),f.enable(f.DEPTH_TEST),f.depthMask(!0),e.resetGLState()}}},c.ShadowMapPlugin=function(e,t,r,n){function o(e,t,n){if(t.visible){var i=r[t.id];if(i&&t.castShadow&&(t.frustumCulled===!1||m.intersectsObject(t)===!0))for(var a=0,s=i.length;s>a;a++){var l=i[a];t._modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),b.push(l)}for(var a=0,s=t.children.length;s>a;a++)o(e,t.children[a],n)}}function i(e,t){var r=new c.DirectionalLight;r.isVirtual=!0,r.onlyShadow=!0,r.castShadow=!0,r.shadowCameraNear=e.shadowCameraNear,r.shadowCameraFar=e.shadowCameraFar,r.shadowCameraLeft=e.shadowCameraLeft,r.shadowCameraRight=e.shadowCameraRight,r.shadowCameraBottom=e.shadowCameraBottom,r.shadowCameraTop=e.shadowCameraTop,r.shadowCameraVisible=e.shadowCameraVisible,r.shadowDarkness=e.shadowDarkness,r.shadowBias=e.shadowCascadeBias[t],r.shadowMapWidth=e.shadowCascadeWidth[t],r.shadowMapHeight=e.shadowCascadeHeight[t],r.pointsWorld=[],r.pointsFrustum=[];for(var n=r.pointsWorld,o=r.pointsFrustum,i=0;8>i;i++)n[i]=new c.Vector3,o[i]=new c.Vector3;var a=e.shadowCascadeNearZ[t],s=e.shadowCascadeFarZ[t];return o[0].set(-1,-1,a),o[1].set(1,-1,a),o[2].set(-1,1,a),o[3].set(1,1,a),o[4].set(-1,-1,s),o[5].set(1,-1,s),o[6].set(-1,1,s),o[7].set(1,1,s),r}function a(e,t){var r=e.shadowCascadeArray[t];r.position.copy(e.position),r.target.position.copy(e.target.position),r.lookAt(r.target),r.shadowCameraVisible=e.shadowCameraVisible,r.shadowDarkness=e.shadowDarkness,r.shadowBias=e.shadowCascadeBias[t];var n=e.shadowCascadeNearZ[t],o=e.shadowCascadeFarZ[t],i=r.pointsFrustum;i[0].z=n,i[1].z=n,i[2].z=n,i[3].z=n,i[4].z=o,i[5].z=o,i[6].z=o,i[7].z=o}function s(e,t){var r=t.shadowCamera,n=t.pointsFrustum,o=t.pointsWorld;y.set(1/0,1/0,1/0),v.set(-(1/0),-(1/0),-(1/0));for(var i=0;8>i;i++){var a=o[i];a.copy(n[i]),a.unproject(e),a.applyMatrix4(r.matrixWorldInverse),a.x<y.x&&(y.x=a.x),a.x>v.x&&(v.x=a.x),a.y<y.y&&(y.y=a.y),a.y>v.y&&(v.y=a.y),a.z<y.z&&(y.z=a.z),a.z>v.z&&(v.z=a.z)}r.left=y.x,r.right=v.x,r.top=v.y,r.bottom=y.y,r.updateProjectionMatrix()}function l(e){return e.material instanceof c.MeshFaceMaterial?e.material.materials[0]:e.material}var h,u,f,d,p=e.context,m=new c.Frustum,g=new c.Matrix4,y=new c.Vector3,v=new c.Vector3,_=new c.Vector3,b=[],w=c.ShaderLib.depthRGBA,x=c.UniformsUtils.clone(w.uniforms);h=new c.ShaderMaterial({uniforms:x,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader}),u=new c.ShaderMaterial({uniforms:x,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:!0}),f=new c.ShaderMaterial({uniforms:x,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,skinning:!0}),d=new c.ShaderMaterial({uniforms:x,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:!0,skinning:!0}),h._shadowPass=!0,u._shadowPass=!0,f._shadowPass=!0,d._shadowPass=!0,this.render=function(r,y){if(e.shadowMapEnabled!==!1){var v,w,x,T,M,S,C,E,A,L,P,F,D,R=[],O=0,k=null;for(p.clearColor(1,1,1,1),p.disable(p.BLEND),p.enable(p.CULL_FACE),p.frontFace(p.CCW),e.shadowMapCullFace===c.CullFaceFront?p.cullFace(p.FRONT):p.cullFace(p.BACK),e.setDepthTest(!0),v=0,w=t.length;w>v;v++)if(D=t[v],D.castShadow)if(D instanceof c.DirectionalLight&&D.shadowCascade)for(M=0;M<D.shadowCascadeCount;M++){var N;if(D.shadowCascadeArray[M])N=D.shadowCascadeArray[M];else{N=i(D,M),N.originalCamera=y;var B=new c.Gyroscope;B.position.copy(D.shadowCascadeOffset),B.add(N),B.add(N.target),y.add(B),D.shadowCascadeArray[M]=N,console.log("Created virtualLight",N)}a(D,M),R[O]=N,O++}else R[O]=D,O++;for(v=0,w=R.length;w>v;v++){if(D=R[v],!D.shadowMap){var U=c.LinearFilter;e.shadowMapType===c.PCFSoftShadowMap&&(U=c.NearestFilter);var I={minFilter:U,magFilter:U,format:c.RGBAFormat};D.shadowMap=new c.WebGLRenderTarget(D.shadowMapWidth,D.shadowMapHeight,I),D.shadowMapSize=new c.Vector2(D.shadowMapWidth,D.shadowMapHeight),D.shadowMatrix=new c.Matrix4}if(!D.shadowCamera){if(D instanceof c.SpotLight)D.shadowCamera=new c.PerspectiveCamera(D.shadowCameraFov,D.shadowMapWidth/D.shadowMapHeight,D.shadowCameraNear,D.shadowCameraFar);else{if(!(D instanceof c.DirectionalLight)){console.error("Unsupported light type for shadow");continue}D.shadowCamera=new c.OrthographicCamera(D.shadowCameraLeft,D.shadowCameraRight,D.shadowCameraTop,D.shadowCameraBottom,D.shadowCameraNear,D.shadowCameraFar)}r.add(D.shadowCamera),r.autoUpdate===!0&&r.updateMatrixWorld()}D.shadowCameraVisible&&!D.cameraHelper&&(D.cameraHelper=new c.CameraHelper(D.shadowCamera),r.add(D.cameraHelper)),D.isVirtual&&N.originalCamera==y&&s(y,D),S=D.shadowMap,C=D.shadowMatrix,E=D.shadowCamera,E.position.setFromMatrixPosition(D.matrixWorld),_.setFromMatrixPosition(D.target.matrixWorld),E.lookAt(_),E.updateMatrixWorld(),E.matrixWorldInverse.getInverse(E.matrixWorld),D.cameraHelper&&(D.cameraHelper.visible=D.shadowCameraVisible),D.shadowCameraVisible&&D.cameraHelper.update(),C.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),C.multiply(E.projectionMatrix),C.multiply(E.matrixWorldInverse),g.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse),m.setFromMatrix(g),e.setRenderTarget(S),e.clear(),b.length=0,o(r,r,E);var V,z,G;for(x=0,T=b.length;T>x;x++)P=b[x],F=P.object,A=P.buffer,V=l(F),z=void 0!==F.geometry.morphTargets&&F.geometry.morphTargets.length>0&&V.morphTargets,G=F instanceof c.SkinnedMesh&&V.skinning,L=F.customDepthMaterial?F.customDepthMaterial:G?z?d:f:z?u:h,e.setMaterialFaces(V),A instanceof c.BufferGeometry?e.renderBufferDirect(E,t,k,L,A,F):e.renderBuffer(E,t,k,L,A,F);for(x=0,T=n.length;T>x;x++)P=n[x],F=P.object,F.visible&&F.castShadow&&(F._modelViewMatrix.multiplyMatrices(E.matrixWorldInverse,F.matrixWorld),e.renderImmediateObject(E,t,k,h,F))}var H=e.getClearColor(),j=e.getClearAlpha();p.clearColor(H.r,H.g,H.b,j),p.enable(p.BLEND),e.shadowMapCullFace===c.CullFaceFront&&p.cullFace(p.BACK),e.resetGLState()}}},c.SpritePlugin=function(e,t){
function r(){var t=u.createProgram(),r=u.createShader(u.VERTEX_SHADER),n=u.createShader(u.FRAGMENT_SHADER);return u.shaderSource(r,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),u.shaderSource(n,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),u.compileShader(r),u.compileShader(n),u.attachShader(t,r),u.attachShader(t,n),u.linkProgram(t),t}function n(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}var o,i,a,s,l,h,u=e.context,f=new c.Vector3,d=new c.Quaternion,p=new c.Vector3,m=function(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);o=u.createBuffer(),i=u.createBuffer(),u.bindBuffer(u.ARRAY_BUFFER,o),u.bufferData(u.ARRAY_BUFFER,e,u.STATIC_DRAW),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,i),u.bufferData(u.ELEMENT_ARRAY_BUFFER,t,u.STATIC_DRAW),a=r(),s={position:u.getAttribLocation(a,"position"),uv:u.getAttribLocation(a,"uv")},l={uvOffset:u.getUniformLocation(a,"uvOffset"),uvScale:u.getUniformLocation(a,"uvScale"),rotation:u.getUniformLocation(a,"rotation"),scale:u.getUniformLocation(a,"scale"),color:u.getUniformLocation(a,"color"),map:u.getUniformLocation(a,"map"),opacity:u.getUniformLocation(a,"opacity"),modelViewMatrix:u.getUniformLocation(a,"modelViewMatrix"),projectionMatrix:u.getUniformLocation(a,"projectionMatrix"),fogType:u.getUniformLocation(a,"fogType"),fogDensity:u.getUniformLocation(a,"fogDensity"),fogNear:u.getUniformLocation(a,"fogNear"),fogFar:u.getUniformLocation(a,"fogFar"),fogColor:u.getUniformLocation(a,"fogColor"),alphaTest:u.getUniformLocation(a,"alphaTest")};var n=document.createElement("canvas");n.width=8,n.height=8;var f=n.getContext("2d");f.fillStyle="white",f.fillRect(0,0,8,8),h=new c.Texture(n),h.needsUpdate=!0};this.render=function(r,g){if(0!==t.length){void 0===a&&m(),u.useProgram(a),u.enableVertexAttribArray(s.position),u.enableVertexAttribArray(s.uv),u.disable(u.CULL_FACE),u.enable(u.BLEND),u.bindBuffer(u.ARRAY_BUFFER,o),u.vertexAttribPointer(s.position,2,u.FLOAT,!1,16,0),u.vertexAttribPointer(s.uv,2,u.FLOAT,!1,16,8),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,i),u.uniformMatrix4fv(l.projectionMatrix,!1,g.projectionMatrix.elements),u.activeTexture(u.TEXTURE0),u.uniform1i(l.map,0);var y=0,v=0,_=r.fog;_?(u.uniform3f(l.fogColor,_.color.r,_.color.g,_.color.b),_ instanceof c.Fog?(u.uniform1f(l.fogNear,_.near),u.uniform1f(l.fogFar,_.far),u.uniform1i(l.fogType,1),y=1,v=1):_ instanceof c.FogExp2&&(u.uniform1f(l.fogDensity,_.density),u.uniform1i(l.fogType,2),y=2,v=2)):(u.uniform1i(l.fogType,0),y=0,v=0);for(var b=0,w=t.length;w>b;b++){var x=t[b];x._modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,x.matrixWorld),x.z=-x._modelViewMatrix.elements[14]}t.sort(n);for(var T=[],b=0,w=t.length;w>b;b++){var x=t[b],M=x.material;u.uniform1f(l.alphaTest,M.alphaTest),u.uniformMatrix4fv(l.modelViewMatrix,!1,x._modelViewMatrix.elements),x.matrixWorld.decompose(f,d,p),T[0]=p.x,T[1]=p.y;var S=0;r.fog&&M.fog&&(S=v),y!==S&&(u.uniform1i(l.fogType,S),y=S),null!==M.map?(u.uniform2f(l.uvOffset,M.map.offset.x,M.map.offset.y),u.uniform2f(l.uvScale,M.map.repeat.x,M.map.repeat.y)):(u.uniform2f(l.uvOffset,0,0),u.uniform2f(l.uvScale,1,1)),u.uniform1f(l.opacity,M.opacity),u.uniform3f(l.color,M.color.r,M.color.g,M.color.b),u.uniform1f(l.rotation,M.rotation),u.uniform2fv(l.scale,T),e.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst),e.setDepthTest(M.depthTest),e.setDepthWrite(M.depthWrite),M.map&&M.map.image&&M.map.image.width?e.setTexture(M.map,0):e.setTexture(h,0),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0)}u.enable(u.CULL_FACE),e.resetGLState()}}},c.GeometryUtils={merge:function(e,t,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var n;t instanceof c.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,t=t.geometry),e.merge(t,n,r)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},c.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,r,n){var o=new c.ImageLoader;o.crossOrigin=this.crossOrigin;var i=new c.Texture(void 0,t);return o.load(e,function(e){i.image=e,i.needsUpdate=!0,r&&r(i)},void 0,function(e){n&&n(e)}),i.sourceFile=e,i},loadTextureCube:function(e,t,r,n){var o=[],i=new c.ImageLoader;i.crossOrigin=this.crossOrigin;var a=new c.CubeTexture(o,t);a.flipY=!1;for(var s=0,l=function(t){i.load(e[t],function(e){a.images[t]=e,s+=1,6===s&&(a.needsUpdate=!0,r&&r(a))},void 0,n)},h=0,u=e.length;u>h;++h)l(h);return a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(e,t){var r=function(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]},n=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},o=function(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return[e[0]/t,e[1]/t,e[2]/t]};t=1|t;var i=e.width,a=e.height,s=document.createElement("canvas");s.width=i,s.height=a;var l=s.getContext("2d");l.drawImage(e,0,0);for(var h=l.getImageData(0,0,i,a).data,u=l.createImageData(i,a),c=u.data,f=0;i>f;f++)for(var d=0;a>d;d++){var p=0>d-1?0:d-1,m=d+1>a-1?a-1:d+1,g=0>f-1?0:f-1,y=f+1>i-1?i-1:f+1,v=[],_=[0,0,h[4*(d*i+f)]/255*t];v.push([-1,0,h[4*(d*i+g)]/255*t]),v.push([-1,-1,h[4*(p*i+g)]/255*t]),v.push([0,-1,h[4*(p*i+f)]/255*t]),v.push([1,-1,h[4*(p*i+y)]/255*t]),v.push([1,0,h[4*(d*i+y)]/255*t]),v.push([1,1,h[4*(m*i+y)]/255*t]),v.push([0,1,h[4*(m*i+f)]/255*t]),v.push([-1,1,h[4*(m*i+g)]/255*t]);for(var b=[],w=v.length,x=0;w>x;x++){var T=v[x],M=v[(x+1)%w];T=n(T,_),M=n(M,_),b.push(o(r(T,M)))}for(var S=[0,0,0],x=0;x<b.length;x++)S[0]+=b[x][0],S[1]+=b[x][1],S[2]+=b[x][2];S[0]/=b.length,S[1]/=b.length,S[2]/=b.length;var C=4*(d*i+f);c[C]=(S[0]+1)/2*255|0,c[C+1]=(S[1]+1)/2*255|0,c[C+2]=255*S[2]|0,c[C+3]=255}return l.putImageData(u,0,0),s},generateDataTexture:function(e,t,r){for(var n=e*t,o=new Uint8Array(3*n),i=Math.floor(255*r.r),a=Math.floor(255*r.g),s=Math.floor(255*r.b),l=0;n>l;l++)o[3*l]=i,o[3*l+1]=a,o[3*l+2]=s;var h=new c.DataTexture(o,e,t,c.RGBFormat);return h.needsUpdate=!0,h}},c.SceneUtils={createMultiMaterialObject:function(e,t){for(var r=new c.Object3D,n=0,o=t.length;o>n;n++)r.add(new c.Mesh(e,t[n]));return r},detach:function(e,t,r){e.applyMatrix(t.matrixWorld),t.remove(e),r.add(e)},attach:function(e,t,r){var n=new c.Matrix4;n.getInverse(r.matrixWorld),e.applyMatrix(n),t.remove(e),r.add(e)}},c.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face][this.weight][this.style]}catch(e){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing."}},loadFace:function(e){var t=e.familyName.toLowerCase(),r=this;r.faces[t]=r.faces[t]||{},r.faces[t][e.cssFontWeight]=r.faces[t][e.cssFontWeight]||{},r.faces[t][e.cssFontWeight][e.cssFontStyle]=e;r.faces[t][e.cssFontWeight][e.cssFontStyle]=e;return e},drawText:function(e){var t,r=this.getFace(),n=this.size/r.resolution,o=0,i=String(e).split(""),a=i.length,s=[];for(t=0;a>t;t++){var l=new c.Path,h=this.extractGlyphPoints(i[t],r,n,o,l);o+=h.offset,s.push(h.path)}var u=o/2;return{paths:s,offset:u}},extractGlyphPoints:function(e,t,r,n,o){var i,a,s,l,h,u,f,d,p,m,g,y,v,_,b,w,x,T,M,S=[],C=t.glyphs[e]||t.glyphs["?"];if(C){if(C.o)for(l=C._cachedOutline||(C._cachedOutline=C.o.split(" ")),u=l.length,f=r,d=r,i=0;u>i;)switch(h=l[i++]){case"m":p=l[i++]*f+n,m=l[i++]*d,o.moveTo(p,m);break;case"l":p=l[i++]*f+n,m=l[i++]*d,o.lineTo(p,m);break;case"q":if(g=l[i++]*f+n,y=l[i++]*d,b=l[i++]*f+n,w=l[i++]*d,o.quadraticCurveTo(b,w,g,y),M=S[S.length-1])for(v=M.x,_=M.y,a=1,s=this.divisions;s>=a;a++){var E=a/s;c.Shape.Utils.b2(E,v,b,g),c.Shape.Utils.b2(E,_,w,y)}break;case"b":if(g=l[i++]*f+n,y=l[i++]*d,b=l[i++]*f+n,w=l[i++]*d,x=l[i++]*f+n,T=l[i++]*d,o.bezierCurveTo(b,w,x,T,g,y),M=S[S.length-1])for(v=M.x,_=M.y,a=1,s=this.divisions;s>=a;a++){var E=a/s;c.Shape.Utils.b3(E,v,b,x,g),c.Shape.Utils.b3(E,_,w,T,y)}}return{offset:C.ha*r,path:o}}}},c.FontUtils.generateShapes=function(e,t){t=t||{};var r=void 0!==t.size?t.size:100,n=void 0!==t.curveSegments?t.curveSegments:4,o=void 0!==t.font?t.font:"helvetiker",i=void 0!==t.weight?t.weight:"normal",a=void 0!==t.style?t.style:"normal";c.FontUtils.size=r,c.FontUtils.divisions=n,c.FontUtils.face=o,c.FontUtils.weight=i,c.FontUtils.style=a;for(var s=c.FontUtils.drawText(e),l=s.paths,h=[],u=0,f=l.length;f>u;u++)Array.prototype.push.apply(h,l[u].toShapes());return h},function(e){var t=1e-10,r=function(e,t){var r=e.length;if(3>r)return null;var i,a,s,l=[],h=[],u=[];if(n(e)>0)for(a=0;r>a;a++)h[a]=a;else for(a=0;r>a;a++)h[a]=r-1-a;var c=r,f=2*c;for(a=c-1;c>2;){if(f--<=0)return console.log("Warning, unable to triangulate polygon!"),t?u:l;if(i=a,i>=c&&(i=0),a=i+1,a>=c&&(a=0),s=a+1,s>=c&&(s=0),o(e,i,a,s,c,h)){var d,p,m,g,y;for(d=h[i],p=h[a],m=h[s],l.push([e[d],e[p],e[m]]),u.push([h[i],h[a],h[s]]),g=a,y=a+1;c>y;g++,y++)h[g]=h[y];c--,f=2*c}}return t?u:l},n=function(e){for(var t=e.length,r=0,n=t-1,o=0;t>o;n=o++)r+=e[n].x*e[o].y-e[o].x*e[n].y;return.5*r},o=function(e,r,n,o,i,a){var s,l,h,u,c,f,d,p,m;if(l=e[a[r]].x,h=e[a[r]].y,u=e[a[n]].x,c=e[a[n]].y,f=e[a[o]].x,d=e[a[o]].y,t>(u-l)*(d-h)-(c-h)*(f-l))return!1;var g,y,v,_,b,w,x,T,M,S,C,E,A,L,P;for(g=f-u,y=d-c,v=l-f,_=h-d,b=u-l,w=c-h,s=0;i>s;s++)if(p=e[a[s]].x,m=e[a[s]].y,!(p===l&&m===h||p===u&&m===c||p===f&&m===d)&&(x=p-l,T=m-h,M=p-u,S=m-c,C=p-f,E=m-d,P=g*S-y*M,A=b*T-w*x,L=v*E-_*C,P>=-t&&L>=-t&&A>=-t))return!1;return!0};return e.Triangulate=r,e.Triangulate.area=n,e}(c.FontUtils),u._typeface_js={faces:c.FontUtils.faces,loadFace:c.FontUtils.loadFace},c.typeface_js=u._typeface_js,c.Audio=function(e){c.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},c.Audio.prototype=Object.create(c.Object3D.prototype),c.Audio.prototype.constructor=c.Audio,c.Audio.prototype.load=function(e){var t=this,r=new XMLHttpRequest;return r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(e){t.context.decodeAudioData(this.response,function(e){t.source.buffer=e,t.source.connect(t.panner),t.source.start(0)})},r.send(),this},c.Audio.prototype.setLoop=function(e){this.source.loop=e},c.Audio.prototype.setRefDistance=function(e){this.panner.refDistance=e},c.Audio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},c.Audio.prototype.updateMatrixWorld=function(){var e=new c.Vector3;return function(t){c.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),c.AudioListener=function(){c.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext)},c.AudioListener.prototype=Object.create(c.Object3D.prototype),c.AudioListener.prototype.constructor=c.AudioListener,c.AudioListener.prototype.updateMatrixWorld=function(){var e=new c.Vector3,t=new c.Quaternion,r=new c.Vector3,n=new c.Vector3,o=new c.Vector3,i=new c.Vector3;return function(a){c.Object3D.prototype.updateMatrixWorld.call(this,a);var s=this.context.listener,l=this.up;this.matrixWorld.decompose(e,t,r),n.set(0,0,-1).applyQuaternion(t),o.subVectors(e,i),s.setPosition(e.x,e.y,e.z),s.setOrientation(n.x,n.y,n.z,l.x,l.y,l.z),s.setVelocity(o.x,o.y,o.z),i.copy(e)}}(),c.Curve=function(){},c.Curve.prototype.getPoint=function(e){return console.log("Warning, getPoint() not implemented!"),null},c.Curve.prototype.getPointAt=function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},c.Curve.prototype.getPoints=function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPoint(t/e));return r},c.Curve.prototype.getSpacedPoints=function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPointAt(t/e));return r},c.Curve.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},c.Curve.prototype.getLengths=function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length==e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,n=[],o=this.getPoint(0),i=0;for(n.push(0),r=1;e>=r;r++)t=this.getPoint(r/e),i+=t.distanceTo(o),n.push(i),o=t;return this.cacheArcLengths=n,n},c.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},c.Curve.prototype.getUtoTmapping=function(e,t){var r,n=this.getLengths(),o=0,i=n.length;r=t?t:e*n[i-1];for(var a,s=0,l=i-1;l>=s;)if(o=Math.floor(s+(l-s)/2),a=n[o]-r,0>a)s=o+1;else{if(!(a>0)){l=o;break}l=o-1}if(o=l,n[o]==r){var h=o/(i-1);return h}var u=n[o],c=n[o+1],f=c-u,d=(r-u)/f,h=(o+d)/(i-1);return h},c.Curve.prototype.getTangent=function(e){var t=1e-4,r=e-t,n=e+t;0>r&&(r=0),n>1&&(n=1);var o=this.getPoint(r),i=this.getPoint(n),a=i.clone().sub(o);return a.normalize()},c.Curve.prototype.getTangentAt=function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},c.Curve.Utils={tangentQuadraticBezier:function(e,t,r,n){return 2*(1-e)*(r-t)+2*e*(n-r)},tangentCubicBezier:function(e,t,r,n,o){return-3*t*(1-e)*(1-e)+3*r*(1-e)*(1-e)-6*e*r*(1-e)+6*e*n*(1-e)-3*e*e*n+3*e*e*o},tangentSpline:function(e,t,r,n,o){var i=6*e*e-6*e,a=3*e*e-4*e+1,s=-6*e*e+6*e,l=3*e*e-2*e;return i+a+s+l},interpolate:function(e,t,r,n,o){var i=.5*(r-e),a=.5*(n-t),s=o*o,l=o*s;return(2*t-2*r+i+a)*l+(-3*t+3*r-2*i-a)*s+i*o+t}},c.Curve.create=function(e,t){return e.prototype=Object.create(c.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},c.CurvePath=function(){this.curves=[],this.bends=[],this.autoClose=!1},c.CurvePath.prototype=Object.create(c.Curve.prototype),c.CurvePath.prototype.constructor=c.CurvePath,c.CurvePath.prototype.add=function(e){this.curves.push(e)},c.CurvePath.prototype.checkConnection=function(){},c.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new c.LineCurve(t,e))},c.CurvePath.prototype.getPoint=function(e){for(var t,r,n=e*this.getLength(),o=this.getCurveLengths(),i=0;i<o.length;){if(o[i]>=n){t=o[i]-n,r=this.curves[i];var a=1-t/r.getLength();return r.getPointAt(a)}i++}return null},c.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},c.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var e,t=[],r=0,n=this.curves.length;for(e=0;n>e;e++)r+=this.curves[e].getLength(),t.push(r);return this.cacheLengths=t,t},c.CurvePath.prototype.getBoundingBox=function(){var e,t,r,n,o,i,a=this.getPoints();e=t=Number.NEGATIVE_INFINITY,n=o=Number.POSITIVE_INFINITY;var s,l,h,u,f=a[0]instanceof c.Vector3;for(u=f?new c.Vector3:new c.Vector2,l=0,h=a.length;h>l;l++)s=a[l],s.x>e?e=s.x:s.x<n&&(n=s.x),s.y>t?t=s.y:s.y<o&&(o=s.y),f&&(s.z>r?r=s.z:s.z<i&&(i=s.z)),u.add(s);var d={minX:n,minY:o,maxX:e,maxY:t};return f&&(d.maxZ=r,d.minZ=i),d},c.CurvePath.prototype.createPointsGeometry=function(e){var t=this.getPoints(e,!0);return this.createGeometry(t)},c.CurvePath.prototype.createSpacedPointsGeometry=function(e){var t=this.getSpacedPoints(e,!0);return this.createGeometry(t)},c.CurvePath.prototype.createGeometry=function(e){for(var t=new c.Geometry,r=0;r<e.length;r++)t.vertices.push(new c.Vector3(e[r].x,e[r].y,e[r].z||0));return t},c.CurvePath.prototype.addWrapPath=function(e){this.bends.push(e)},c.CurvePath.prototype.getTransformedPoints=function(e,t){var r,n,o=this.getPoints(e);for(t||(t=this.bends),r=0,n=t.length;n>r;r++)o=this.getWrapPoints(o,t[r]);return o},c.CurvePath.prototype.getTransformedSpacedPoints=function(e,t){var r,n,o=this.getSpacedPoints(e);for(t||(t=this.bends),r=0,n=t.length;n>r;r++)o=this.getWrapPoints(o,t[r]);return o},c.CurvePath.prototype.getWrapPoints=function(e,t){var r,n,o,i,a,s,l=this.getBoundingBox();for(r=0,n=e.length;n>r;r++){o=e[r],i=o.x,a=o.y,s=i/l.maxX,s=t.getUtoTmapping(s,i);var h=t.getPoint(s),u=t.getTangent(s);u.set(-u.y,u.x).multiplyScalar(a),o.x=h.x+u.x,o.y=h.y+u.y}return e},c.Gyroscope=function(){c.Object3D.call(this)},c.Gyroscope.prototype=Object.create(c.Object3D.prototype),c.Gyroscope.prototype.constructor=c.Gyroscope,c.Gyroscope.prototype.updateMatrixWorld=function(){var e=new c.Vector3,t=new c.Quaternion,r=new c.Vector3,n=new c.Vector3,o=new c.Quaternion,i=new c.Vector3;return function(a){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||a)&&(this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(n,o,i),this.matrix.decompose(e,t,r),this.matrixWorld.compose(n,t,i)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0);for(var s=0,l=this.children.length;l>s;s++)this.children[s].updateMatrixWorld(a)}}(),c.Path=function(e){c.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},c.Path.prototype=Object.create(c.CurvePath.prototype),c.Path.prototype.constructor=c.Path,c.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"},c.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;r>t;t++)this.lineTo(e[t].x,e[t].y)},c.Path.prototype.moveTo=function(e,t){var r=Array.prototype.slice.call(arguments);this.actions.push({action:c.PathActions.MOVE_TO,args:r})},c.Path.prototype.lineTo=function(e,t){var r=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args,o=n[n.length-2],i=n[n.length-1],a=new c.LineCurve(new c.Vector2(o,i),new c.Vector2(e,t));this.curves.push(a),this.actions.push({action:c.PathActions.LINE_TO,args:r})},c.Path.prototype.quadraticCurveTo=function(e,t,r,n){var o=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args,a=i[i.length-2],s=i[i.length-1],l=new c.QuadraticBezierCurve(new c.Vector2(a,s),new c.Vector2(e,t),new c.Vector2(r,n));this.curves.push(l),this.actions.push({action:c.PathActions.QUADRATIC_CURVE_TO,args:o})},c.Path.prototype.bezierCurveTo=function(e,t,r,n,o,i){var a=Array.prototype.slice.call(arguments),s=this.actions[this.actions.length-1].args,l=s[s.length-2],h=s[s.length-1],u=new c.CubicBezierCurve(new c.Vector2(l,h),new c.Vector2(e,t),new c.Vector2(r,n),new c.Vector2(o,i));this.curves.push(u),this.actions.push({action:c.PathActions.BEZIER_CURVE_TO,args:a})},c.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,n=r[r.length-2],o=r[r.length-1],i=[new c.Vector2(n,o)];Array.prototype.push.apply(i,e);var a=new c.SplineCurve(i);this.curves.push(a),this.actions.push({action:c.PathActions.CSPLINE_THRU,args:t})},c.Path.prototype.arc=function(e,t,r,n,o,i){var a=this.actions[this.actions.length-1].args,s=a[a.length-2],l=a[a.length-1];this.absarc(e+s,t+l,r,n,o,i)},c.Path.prototype.absarc=function(e,t,r,n,o,i){this.absellipse(e,t,r,r,n,o,i)},c.Path.prototype.ellipse=function(e,t,r,n,o,i,a){var s=this.actions[this.actions.length-1].args,l=s[s.length-2],h=s[s.length-1];this.absellipse(e+l,t+h,r,n,o,i,a)},c.Path.prototype.absellipse=function(e,t,r,n,o,i,a){var s=Array.prototype.slice.call(arguments),l=new c.EllipseCurve(e,t,r,n,o,i,a);this.curves.push(l);var h=l.getPoint(1);s.push(h.x),s.push(h.y),this.actions.push({action:c.PathActions.ELLIPSE,args:s})},c.Path.prototype.getSpacedPoints=function(e,t){e||(e=40);for(var r=[],n=0;e>n;n++)r.push(this.getPoint(n/e));return r},c.Path.prototype.getPoints=function(e,t){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(e,t);e=e||12;var r,n,o,i,a,s,l,h,u,f,d,p,m,g,y,v,_,b,w=[];for(r=0,n=this.actions.length;n>r;r++)switch(o=this.actions[r],i=o.action,a=o.args,i){case c.PathActions.MOVE_TO:w.push(new c.Vector2(a[0],a[1]));break;case c.PathActions.LINE_TO:w.push(new c.Vector2(a[0],a[1]));break;case c.PathActions.QUADRATIC_CURVE_TO:for(s=a[2],l=a[3],f=a[0],d=a[1],w.length>0?(g=w[w.length-1],p=g.x,m=g.y):(g=this.actions[r-1].args,p=g[g.length-2],m=g[g.length-1]),y=1;e>=y;y++)v=y/e,_=c.Shape.Utils.b2(v,p,f,s),b=c.Shape.Utils.b2(v,m,d,l),w.push(new c.Vector2(_,b));break;case c.PathActions.BEZIER_CURVE_TO:for(s=a[4],l=a[5],f=a[0],d=a[1],h=a[2],u=a[3],w.length>0?(g=w[w.length-1],p=g.x,m=g.y):(g=this.actions[r-1].args,p=g[g.length-2],m=g[g.length-1]),y=1;e>=y;y++)v=y/e,_=c.Shape.Utils.b3(v,p,f,h,s),b=c.Shape.Utils.b3(v,m,d,u,l),w.push(new c.Vector2(_,b));break;case c.PathActions.CSPLINE_THRU:g=this.actions[r-1].args;var x=new c.Vector2(g[g.length-2],g[g.length-1]),T=[x],M=e*a[0].length;T=T.concat(a[0]);var S=new c.SplineCurve(T);for(y=1;M>=y;y++)w.push(S.getPointAt(y/M));break;case c.PathActions.ARC:var C,E=a[0],A=a[1],L=a[2],P=a[3],F=a[4],D=!!a[5],R=F-P,O=2*e;for(y=1;O>=y;y++)v=y/O,D||(v=1-v),C=P+v*R,_=E+L*Math.cos(C),b=A+L*Math.sin(C),w.push(new c.Vector2(_,b));break;case c.PathActions.ELLIPSE:var C,E=a[0],A=a[1],k=a[2],N=a[3],P=a[4],F=a[5],D=!!a[6],R=F-P,O=2*e;for(y=1;O>=y;y++)v=y/O,D||(v=1-v),C=P+v*R,_=E+k*Math.cos(C),b=A+N*Math.sin(C),w.push(new c.Vector2(_,b))}var B=w[w.length-1],U=1e-10;return Math.abs(B.x-w[0].x)<U&&Math.abs(B.y-w[0].y)<U&&w.splice(w.length-1,1),t&&w.push(w[0]),w},c.Path.prototype.toShapes=function(e,t){function r(e){var t,r,n,o,i,a=[],s=new c.Path;for(t=0,r=e.length;r>t;t++)n=e[t],i=n.args,o=n.action,o==c.PathActions.MOVE_TO&&0!=s.actions.length&&(a.push(s),s=new c.Path),s[o].apply(s,i);return 0!=s.actions.length&&a.push(s),a}function n(e){for(var t=[],r=0,n=e.length;n>r;r++){var o=e[r],i=new c.Shape;i.actions=o.actions,i.curves=o.curves,t.push(i)}return t}function o(e,t){for(var r=1e-10,n=t.length,o=!1,i=n-1,a=0;n>a;i=a++){var s=t[i],l=t[a],h=l.x-s.x,u=l.y-s.y;if(Math.abs(u)>r){if(0>u&&(s=t[a],h=-h,l=t[i],u=-u),e.y<s.y||e.y>l.y)continue;if(e.y==s.y){if(e.x==s.x)return!0}else{var c=u*(e.x-s.x)-h*(e.y-s.y);if(0==c)return!0;if(0>c)continue;o=!o}}else{if(e.y!=s.y)continue;if(l.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=l.x)return!0}}return o}var i=r(this.actions);if(0==i.length)return[];if(t===!0)return n(i);var a,s,l,h=[];if(1==i.length)return s=i[0],l=new c.Shape,l.actions=s.actions,l.curves=s.curves,h.push(l),h;var u=!c.Shape.Utils.isClockWise(i[0].getPoints());u=e?!u:u;var f,d=[],p=[],m=[],g=0;p[g]=void 0,m[g]=[];var y,v;for(y=0,v=i.length;v>y;y++)s=i[y],f=s.getPoints(),a=c.Shape.Utils.isClockWise(f),a=e?!a:a,a?(!u&&p[g]&&g++,p[g]={s:new c.Shape,p:f},p[g].s.actions=s.actions,p[g].s.curves=s.curves,u&&g++,m[g]=[]):m[g].push({h:s,p:f[0]});if(!p[0])return n(i);if(p.length>1){for(var _=!1,b=[],w=0,x=p.length;x>w;w++)d[w]=[];for(var w=0,x=p.length;x>w;w++)for(var T=(p[w],m[w]),M=0;M<T.length;M++){for(var S=T[M],C=!0,E=0;E<p.length;E++)o(S.p,p[E].p)&&(w!=E&&b.push({froms:w,tos:E,hole:M}),C?(C=!1,d[E].push(S)):_=!0);C&&d[w].push(S)}b.length>0&&(_||(m=d))}var A,L,P;for(y=0,v=p.length;v>y;y++)for(l=p[y].s,h.push(l),A=m[y],L=0,P=A.length;P>L;L++)l.holes.push(A[L].h);return h},c.Shape=function(){c.Path.apply(this,arguments),this.holes=[]},c.Shape.prototype=Object.create(c.Path.prototype),c.Shape.prototype.constructor=c.Shape,c.Shape.prototype.extrude=function(e){var t=new c.ExtrudeGeometry(this,e);return t},c.Shape.prototype.makeGeometry=function(e){var t=new c.ShapeGeometry(this,e);return t},c.Shape.prototype.getPointsHoles=function(e){var t,r=this.holes.length,n=[];for(t=0;r>t;t++)n[t]=this.holes[t].getTransformedPoints(e,this.bends);return n},c.Shape.prototype.getSpacedPointsHoles=function(e){var t,r=this.holes.length,n=[];for(t=0;r>t;t++)n[t]=this.holes[t].getTransformedSpacedPoints(e,this.bends);return n},c.Shape.prototype.extractAllPoints=function(e){return{shape:this.getTransformedPoints(e),holes:this.getPointsHoles(e)}},c.Shape.prototype.extractPoints=function(e){return this.useSpacedPoints?this.extractAllSpacedPoints(e):this.extractAllPoints(e)},c.Shape.prototype.extractAllSpacedPoints=function(e){return{shape:this.getTransformedSpacedPoints(e),holes:this.getSpacedPointsHoles(e)}},c.Shape.Utils={triangulateShape:function(e,t){function r(e,t,r){return e.x!=t.x?e.x<t.x?e.x<=r.x&&r.x<=t.x:t.x<=r.x&&r.x<=e.x:e.y<t.y?e.y<=r.y&&r.y<=t.y:t.y<=r.y&&r.y<=e.y}function n(e,t,n,o,i){var a=1e-10,s=t.x-e.x,l=t.y-e.y,h=o.x-n.x,u=o.y-n.y,c=e.x-n.x,f=e.y-n.y,d=l*h-s*u,p=l*c-s*f;if(Math.abs(d)>a){var m;if(d>0){if(0>p||p>d)return[];if(m=u*c-h*f,0>m||m>d)return[]}else{if(p>0||d>p)return[];if(m=u*c-h*f,m>0||d>m)return[]}if(0==m)return!i||0!=p&&p!=d?[e]:[];if(m==d)return!i||0!=p&&p!=d?[t]:[];if(0==p)return[n];if(p==d)return[o];var g=m/d;return[{x:e.x+g*s,y:e.y+g*l}]}if(0!=p||u*c!=h*f)return[];var y=0==s&&0==l,v=0==h&&0==u;if(y&&v)return e.x!=n.x||e.y!=n.y?[]:[e];if(y)return r(n,o,e)?[e]:[];if(v)return r(e,t,n)?[n]:[];var _,b,w,x,T,M,S,C;return 0!=s?(e.x<t.x?(_=e,w=e.x,b=t,x=t.x):(_=t,w=t.x,b=e,x=e.x),n.x<o.x?(T=n,S=n.x,M=o,C=o.x):(T=o,S=o.x,M=n,C=n.x)):(e.y<t.y?(_=e,w=e.y,b=t,x=t.y):(_=t,w=t.y,b=e,x=e.y),n.y<o.y?(T=n,S=n.y,M=o,C=o.y):(T=o,S=o.y,M=n,C=n.y)),S>=w?S>x?[]:x==S?i?[]:[T]:C>=x?[T,b]:[T,M]:w>C?[]:w==C?i?[]:[_]:C>=x?[_,b]:[_,M]}function o(e,t,r,n){var o=1e-10,i=t.x-e.x,a=t.y-e.y,s=r.x-e.x,l=r.y-e.y,h=n.x-e.x,u=n.y-e.y,c=i*l-a*s,f=i*u-a*h;if(Math.abs(c)>o){var d=h*l-u*s;return c>0?f>=0&&d>=0:f>=0||d>=0}return f>0}function i(e,t){function r(e,t){var r=v.length-1,n=e-1;0>n&&(n=r);var i=e+1;i>r&&(i=0);var a=o(v[e],v[n],v[i],s[t]);if(!a)return!1;var l=s.length-1,h=t-1;0>h&&(h=l);var u=t+1;return u>l&&(u=0),a=o(s[t],s[h],s[u],v[e]),a?!0:!1}function i(e,t){var r,o,i;for(r=0;r<v.length;r++)if(o=r+1,o%=v.length,i=n(e,t,v[r],v[o],!0),i.length>0)return!0;return!1}function a(e,r){var o,i,a,s,l;for(o=0;o<_.length;o++)for(i=t[_[o]],a=0;a<i.length;a++)if(s=a+1,s%=i.length,l=n(e,r,i[a],i[s],!0),l.length>0)return!0;return!1}for(var s,l,h,u,c,f,d,p,m,g,y,v=e.concat(),_=[],b=[],w=0,x=t.length;x>w;w++)_.push(w);for(var T=0,M=2*_.length;_.length>0;){if(M--,0>M){console.log("Infinite Loop! Holes left:"+_.length+", Probably Hole outside Shape!");break}for(h=T;h<v.length;h++){u=v[h],l=-1;for(var w=0;w<_.length;w++)if(f=_[w],d=u.x+":"+u.y+":"+f,void 0===b[d]){s=t[f];for(var S=0;S<s.length;S++)if(c=s[S],r(h,S)&&!i(u,c)&&!a(u,c)){l=S,_.splice(w,1),p=v.slice(0,h+1),m=v.slice(h),g=s.slice(l),y=s.slice(0,l+1),v=p.concat(g).concat(y).concat(m),T=h;break}if(l>=0)break;b[d]=!0}if(l>=0)break}}return v}for(var a,s,l,h,u,f,d={},p=e.concat(),m=0,g=t.length;g>m;m++)Array.prototype.push.apply(p,t[m]);for(a=0,s=p.length;s>a;a++)u=p[a].x+":"+p[a].y,void 0!==d[u]&&console.log("Duplicate point",u),d[u]=a;var y=i(e,t),v=c.FontUtils.Triangulate(y,!1);for(a=0,s=v.length;s>a;a++)for(h=v[a],l=0;3>l;l++)u=h[l].x+":"+h[l].y,f=d[u],void 0!==f&&(h[l]=f);return v.concat()},isClockWise:function(e){return c.FontUtils.Triangulate.area(e)<0},b2p0:function(e,t){var r=1-e;return r*r*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,r,n){return this.b2p0(e,t)+this.b2p1(e,r)+this.b2p2(e,n)},b3p0:function(e,t){var r=1-e;return r*r*r*t},b3p1:function(e,t){var r=1-e;return 3*r*r*e*t},b3p2:function(e,t){var r=1-e;return 3*r*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,r,n,o){return this.b3p0(e,t)+this.b3p1(e,r)+this.b3p2(e,n)+this.b3p3(e,o)}},c.LineCurve=function(e,t){this.v1=e,this.v2=t},c.LineCurve.prototype=Object.create(c.Curve.prototype),c.LineCurve.prototype.constructor=c.LineCurve,c.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},c.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},c.LineCurve.prototype.getTangent=function(e){var t=this.v2.clone().sub(this.v1);return t.normalize()},c.QuadraticBezierCurve=function(e,t,r){this.v0=e,this.v1=t,this.v2=r},c.QuadraticBezierCurve.prototype=Object.create(c.Curve.prototype),c.QuadraticBezierCurve.prototype.constructor=c.QuadraticBezierCurve,c.QuadraticBezierCurve.prototype.getPoint=function(e){var t=new c.Vector2;return t.x=c.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),t.y=c.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),t},c.QuadraticBezierCurve.prototype.getTangent=function(e){var t=new c.Vector2;return t.x=c.Curve.Utils.tangentQuadraticBezier(e,this.v0.x,this.v1.x,this.v2.x),t.y=c.Curve.Utils.tangentQuadraticBezier(e,this.v0.y,this.v1.y,this.v2.y),t.normalize()},c.CubicBezierCurve=function(e,t,r,n){this.v0=e,this.v1=t,this.v2=r,this.v3=n},c.CubicBezierCurve.prototype=Object.create(c.Curve.prototype),c.CubicBezierCurve.prototype.constructor=c.CubicBezierCurve,c.CubicBezierCurve.prototype.getPoint=function(e){var t,r;return t=c.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),r=c.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new c.Vector2(t,r)},c.CubicBezierCurve.prototype.getTangent=function(e){var t,r;t=c.Curve.Utils.tangentCubicBezier(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),r=c.Curve.Utils.tangentCubicBezier(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y);var n=new c.Vector2(t,r);return n.normalize(),n},c.SplineCurve=function(e){this.points=void 0==e?[]:e},c.SplineCurve.prototype=Object.create(c.Curve.prototype),c.SplineCurve.prototype.constructor=c.SplineCurve,c.SplineCurve.prototype.getPoint=function(e){var t=this.points,r=(t.length-1)*e,n=Math.floor(r),o=r-n,i=t[0==n?n:n-1],a=t[n],s=t[n>t.length-2?t.length-1:n+1],l=t[n>t.length-3?t.length-1:n+2],h=new c.Vector2;return h.x=c.Curve.Utils.interpolate(i.x,a.x,s.x,l.x,o),h.y=c.Curve.Utils.interpolate(i.y,a.y,s.y,l.y,o),h},c.EllipseCurve=function(e,t,r,n,o,i,a){this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=n,this.aStartAngle=o,this.aEndAngle=i,this.aClockwise=a},c.EllipseCurve.prototype=Object.create(c.Curve.prototype),c.EllipseCurve.prototype.constructor=c.EllipseCurve,c.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;0>t&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI);var r;r=this.aClockwise===!0?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t;var n=new c.Vector2;return n.x=this.aX+this.xRadius*Math.cos(r),n.y=this.aY+this.yRadius*Math.sin(r),n},c.ArcCurve=function(e,t,r,n,o,i){c.EllipseCurve.call(this,e,t,r,r,n,o,i)},c.ArcCurve.prototype=Object.create(c.EllipseCurve.prototype),c.ArcCurve.prototype.constructor=c.ArcCurve,
c.LineCurve3=c.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new c.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),c.QuadraticBezierCurve3=c.Curve.create(function(e,t,r){this.v0=e,this.v1=t,this.v2=r},function(e){var t=new c.Vector3;return t.x=c.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),t.y=c.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),t.z=c.Shape.Utils.b2(e,this.v0.z,this.v1.z,this.v2.z),t}),c.CubicBezierCurve3=c.Curve.create(function(e,t,r,n){this.v0=e,this.v1=t,this.v2=r,this.v3=n},function(e){var t=new c.Vector3;return t.x=c.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t.y=c.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t.z=c.Shape.Utils.b3(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z),t}),c.SplineCurve3=c.Curve.create(function(e){this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-1)*e,n=Math.floor(r),o=r-n,i=t[0==n?n:n-1],a=t[n],s=t[n>t.length-2?t.length-1:n+1],l=t[n>t.length-3?t.length-1:n+2],h=new c.Vector3;return h.x=c.Curve.Utils.interpolate(i.x,a.x,s.x,l.x,o),h.y=c.Curve.Utils.interpolate(i.y,a.y,s.y,l.y,o),h.z=c.Curve.Utils.interpolate(i.z,a.z,s.z,l.z,o),h}),c.ClosedSplineCurve3=c.Curve.create(function(e){this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-0)*e,n=Math.floor(r),o=r-n;n+=n>0?0:(Math.floor(Math.abs(n)/t.length)+1)*t.length;var i=t[(n-1)%t.length],a=t[n%t.length],s=t[(n+1)%t.length],l=t[(n+2)%t.length],h=new c.Vector3;return h.x=c.Curve.Utils.interpolate(i.x,a.x,s.x,l.x,o),h.y=c.Curve.Utils.interpolate(i.y,a.y,s.y,l.y,o),h.z=c.Curve.Utils.interpolate(i.z,a.z,s.z,l.z,o),h}),c.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){console.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){console.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){console.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(e){if(e.initialized===!0)return e;for(var t=0;t<e.hierarchy.length;t++){for(var r=0;r<e.hierarchy[t].keys.length;r++)if(e.hierarchy[t].keys[r].time<0&&(e.hierarchy[t].keys[r].time=0),void 0!==e.hierarchy[t].keys[r].rot&&!(e.hierarchy[t].keys[r].rot instanceof c.Quaternion)){var n=e.hierarchy[t].keys[r].rot;e.hierarchy[t].keys[r].rot=(new c.Quaternion).fromArray(n)}if(e.hierarchy[t].keys.length&&void 0!==e.hierarchy[t].keys[0].morphTargets){for(var o={},r=0;r<e.hierarchy[t].keys.length;r++)for(var i=0;i<e.hierarchy[t].keys[r].morphTargets.length;i++){var a=e.hierarchy[t].keys[r].morphTargets[i];o[a]=-1}e.hierarchy[t].usedMorphTargets=o;for(var r=0;r<e.hierarchy[t].keys.length;r++){var s={};for(var a in o){for(var i=0;i<e.hierarchy[t].keys[r].morphTargets.length;i++)if(e.hierarchy[t].keys[r].morphTargets[i]===a){s[a]=e.hierarchy[t].keys[r].morphTargetsInfluences[i];break}i===e.hierarchy[t].keys[r].morphTargets.length&&(s[a]=0)}e.hierarchy[t].keys[r].morphTargetsInfluences=s}}for(var r=1;r<e.hierarchy[t].keys.length;r++)e.hierarchy[t].keys[r].time===e.hierarchy[t].keys[r-1].time&&(e.hierarchy[t].keys.splice(r,1),r--);for(var r=0;r<e.hierarchy[t].keys.length;r++)e.hierarchy[t].keys[r].index=r}return e.initialized=!0,e},parse:function(e){var t=function(e){var t=function(t,r){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e,r){r.push(e);for(var n=0;n<e.children.length;n++)t(e.children[n],r)}),r=[];if(e instanceof c.SkinnedMesh)for(var n=0;n<e.skeleton.bones.length;n++)r.push(e.skeleton.bones[n]);else t(e,r);return r},play:function(e){-1===this.animations.indexOf(e)&&this.animations.push(e)},stop:function(e){var t=this.animations.indexOf(e);-1!==t&&this.animations.splice(t,1)},update:function(e){for(var t=0;t<this.animations.length;t++)this.animations[t].resetBlendWeights();for(var t=0;t<this.animations.length;t++)this.animations[t].update(e)}},c.Animation=function(e,t){this.root=e,this.data=c.AnimationHandler.init(t),this.hierarchy=c.AnimationHandler.parse(e),this.currentTime=0,this.timeScale=1,this.isPlaying=!1,this.loop=!0,this.weight=0,this.interpolationType=c.AnimationHandler.LINEAR},c.Animation.prototype.keyTypes=["pos","rot","scl"],c.Animation.prototype.play=function(e,t){this.currentTime=void 0!==e?e:0,this.weight=void 0!==t?t:1,this.isPlaying=!0,this.reset(),c.AnimationHandler.play(this)},c.Animation.prototype.stop=function(){this.isPlaying=!1,c.AnimationHandler.stop(this)},c.Animation.prototype.reset=function(){for(var e=0,t=this.hierarchy.length;t>e;e++){var r=this.hierarchy[e];void 0===r.animationCache&&(r.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}}),void 0===r.animationCache.animations[this.data.name]&&(r.animationCache.animations[this.data.name]={},r.animationCache.animations[this.data.name].prevKey={pos:0,rot:0,scl:0},r.animationCache.animations[this.data.name].nextKey={pos:0,rot:0,scl:0},r.animationCache.animations[this.data.name].originalMatrix=r.matrix);for(var n=r.animationCache.animations[this.data.name],o=0;3>o;o++){for(var i=this.keyTypes[o],a=this.data.hierarchy[e].keys[0],s=this.getNextKeyWith(i,e,1);s.time<this.currentTime&&s.index>a.index;)a=s,s=this.getNextKeyWith(i,e,s.index+1);n.prevKey[i]=a,n.nextKey[i]=s}}},c.Animation.prototype.resetBlendWeights=function(){for(var e=0,t=this.hierarchy.length;t>e;e++){var r=this.hierarchy[e];void 0!==r.animationCache&&(r.animationCache.blending.positionWeight=0,r.animationCache.blending.quaternionWeight=0,r.animationCache.blending.scaleWeight=0)}},c.Animation.prototype.update=function(){var e=[],t=new c.Vector3,r=new c.Vector3,n=new c.Quaternion,o=function(e,t){var r,n,o,a,s,l,h,u,c,f=[],d=[];return r=(e.length-1)*t,n=Math.floor(r),o=r-n,f[0]=0===n?n:n-1,f[1]=n,f[2]=n>e.length-2?n:n+1,f[3]=n>e.length-3?n:n+2,l=e[f[0]],h=e[f[1]],u=e[f[2]],c=e[f[3]],a=o*o,s=o*a,d[0]=i(l[0],h[0],u[0],c[0],o,a,s),d[1]=i(l[1],h[1],u[1],c[1],o,a,s),d[2]=i(l[2],h[2],u[2],c[2],o,a,s),d},i=function(e,t,r,n,o,i,a){var s=.5*(r-e),l=.5*(n-t);return(2*(t-r)+s+l)*a+(-3*(t-r)-2*s-l)*i+s*o+t};return function(i){if(this.isPlaying!==!1&&(this.currentTime+=i*this.timeScale,0!==this.weight)){var a=this.data.length;(this.currentTime>a||this.currentTime<0)&&(this.loop?(this.currentTime%=a,this.currentTime<0&&(this.currentTime+=a),this.reset()):this.stop());for(var s=0,l=this.hierarchy.length;l>s;s++)for(var h=this.hierarchy[s],u=h.animationCache.animations[this.data.name],f=h.animationCache.blending,d=0;3>d;d++){var p=this.keyTypes[d],m=u.prevKey[p],g=u.nextKey[p];if(this.timeScale>0&&g.time<=this.currentTime||this.timeScale<0&&m.time>=this.currentTime){for(m=this.data.hierarchy[s].keys[0],g=this.getNextKeyWith(p,s,1);g.time<this.currentTime&&g.index>m.index;)m=g,g=this.getNextKeyWith(p,s,g.index+1);u.prevKey[p]=m,u.nextKey[p]=g}var y=(this.currentTime-m.time)/(g.time-m.time),v=m[p],_=g[p];if(0>y&&(y=0),y>1&&(y=1),"pos"===p){if(this.interpolationType===c.AnimationHandler.LINEAR){r.x=v[0]+(_[0]-v[0])*y,r.y=v[1]+(_[1]-v[1])*y,r.z=v[2]+(_[2]-v[2])*y;var b=this.weight/(this.weight+f.positionWeight);h.position.lerp(r,b),f.positionWeight+=this.weight}else if(this.interpolationType===c.AnimationHandler.CATMULLROM||this.interpolationType===c.AnimationHandler.CATMULLROM_FORWARD){e[0]=this.getPrevKeyWith("pos",s,m.index-1).pos,e[1]=v,e[2]=_,e[3]=this.getNextKeyWith("pos",s,g.index+1).pos,y=.33*y+.33;var w=o(e,y),b=this.weight/(this.weight+f.positionWeight);f.positionWeight+=this.weight;var x=h.position;if(x.x=x.x+(w[0]-x.x)*b,x.y=x.y+(w[1]-x.y)*b,x.z=x.z+(w[2]-x.z)*b,this.interpolationType===c.AnimationHandler.CATMULLROM_FORWARD){var T=o(e,1.01*y);t.set(T[0],T[1],T[2]),t.sub(x),t.y=0,t.normalize();var M=Math.atan2(t.x,t.z);h.rotation.set(0,M,0)}}}else if("rot"===p)if(c.Quaternion.slerp(v,_,n,y),0===f.quaternionWeight)h.quaternion.copy(n),f.quaternionWeight=this.weight;else{var b=this.weight/(this.weight+f.quaternionWeight);c.Quaternion.slerp(h.quaternion,n,h.quaternion,b),f.quaternionWeight+=this.weight}else if("scl"===p){r.x=v[0]+(_[0]-v[0])*y,r.y=v[1]+(_[1]-v[1])*y,r.z=v[2]+(_[2]-v[2])*y;var b=this.weight/(this.weight+f.scaleWeight);h.scale.lerp(r,b),f.scaleWeight+=this.weight}}return!0}}}(),c.Animation.prototype.getNextKeyWith=function(e,t,r){var n=this.data.hierarchy[t].keys;for(this.interpolationType===c.AnimationHandler.CATMULLROM||this.interpolationType===c.AnimationHandler.CATMULLROM_FORWARD?r=r<n.length-1?r:n.length-1:r%=n.length;r<n.length;r++)if(void 0!==n[r][e])return n[r];return this.data.hierarchy[t].keys[0]},c.Animation.prototype.getPrevKeyWith=function(e,t,r){var n=this.data.hierarchy[t].keys;for(r=this.interpolationType===c.AnimationHandler.CATMULLROM||this.interpolationType===c.AnimationHandler.CATMULLROM_FORWARD?r>0?r:0:r>=0?r:r+n.length;r>=0;r--)if(void 0!==n[r][e])return n[r];return this.data.hierarchy[t].keys[n.length-1]},c.KeyFrameAnimation=function(e){this.root=e.node,this.data=c.AnimationHandler.init(e),this.hierarchy=c.AnimationHandler.parse(this.root),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.isPaused=!0,this.loop=!0;for(var t=0,r=this.hierarchy.length;r>t;t++){var n=this.data.hierarchy[t].keys,o=this.data.hierarchy[t].sids,i=this.hierarchy[t];if(n.length&&o){for(var a=0;a<o.length;a++){var s=o[a],l=this.getNextKeyWith(s,t,0);l&&l.apply(s)}i.matrixAutoUpdate=!1,this.data.hierarchy[t].node.updateMatrix(),i.matrixWorldNeedsUpdate=!0}}},c.KeyFrameAnimation.prototype.play=function(e){if(this.currentTime=void 0!==e?e:0,this.isPlaying===!1){this.isPlaying=!0;var t,r,n,o=this.hierarchy.length;for(t=0;o>t;t++){r=this.hierarchy[t],n=this.data.hierarchy[t],void 0===n.animationCache&&(n.animationCache={},n.animationCache.prevKey=null,n.animationCache.nextKey=null,n.animationCache.originalMatrix=r.matrix);var i=this.data.hierarchy[t].keys;i.length&&(n.animationCache.prevKey=i[0],n.animationCache.nextKey=i[1],this.startTime=Math.min(i[0].time,this.startTime),this.endTime=Math.max(i[i.length-1].time,this.endTime))}this.update(0)}this.isPaused=!1,c.AnimationHandler.play(this)},c.KeyFrameAnimation.prototype.stop=function(){this.isPlaying=!1,this.isPaused=!1,c.AnimationHandler.stop(this);for(var e=0;e<this.data.hierarchy.length;e++){var t=this.hierarchy[e],r=this.data.hierarchy[e];if(void 0!==r.animationCache){var n=r.animationCache.originalMatrix;n.copy(t.matrix),t.matrix=n,delete r.animationCache}}},c.KeyFrameAnimation.prototype.update=function(e){if(this.isPlaying!==!1){this.currentTime+=e*this.timeScale;var t=this.data.length;this.loop===!0&&this.currentTime>t&&(this.currentTime%=t),this.currentTime=Math.min(this.currentTime,t);for(var r=0,n=this.hierarchy.length;n>r;r++){var o=this.hierarchy[r],i=this.data.hierarchy[r],a=i.keys,s=i.animationCache;if(a.length){var l=s.prevKey,h=s.nextKey;if(h.time<=this.currentTime){for(;h.time<this.currentTime&&h.index>l.index;)l=h,h=a[l.index+1];s.prevKey=l,s.nextKey=h}h.time>=this.currentTime?l.interpolate(h,this.currentTime):l.interpolate(h,h.time),this.data.hierarchy[r].node.updateMatrix(),o.matrixWorldNeedsUpdate=!0}}}},c.KeyFrameAnimation.prototype.getNextKeyWith=function(e,t,r){var n=this.data.hierarchy[t].keys;for(r%=n.length;r<n.length;r++)if(n[r].hasTarget(e))return n[r];return n[0]},c.KeyFrameAnimation.prototype.getPrevKeyWith=function(e,t,r){var n=this.data.hierarchy[t].keys;for(r=r>=0?r:r+n.length;r>=0;r--)if(n[r].hasTarget(e))return n[r];return n[n.length-1]},c.MorphAnimation=function(e){this.mesh=e,this.frames=e.morphTargetInfluences.length,this.currentTime=0,this.duration=1e3,this.loop=!0,this.lastFrame=0,this.currentFrame=0,this.isPlaying=!1},c.MorphAnimation.prototype={constructor:c.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(e){if(this.isPlaying!==!1){this.currentTime+=e,this.loop===!0&&this.currentTime>this.duration&&(this.currentTime%=this.duration),this.currentTime=Math.min(this.currentTime,this.duration);var t=this.duration/this.frames,r=Math.floor(this.currentTime/t);r!=this.currentFrame&&(this.mesh.morphTargetInfluences[this.lastFrame]=0,this.mesh.morphTargetInfluences[this.currentFrame]=1,this.mesh.morphTargetInfluences[r]=0,this.lastFrame=this.currentFrame,this.currentFrame=r),this.mesh.morphTargetInfluences[r]=this.currentTime%t/t,this.mesh.morphTargetInfluences[this.lastFrame]=1-this.mesh.morphTargetInfluences[r]}}},c.BoxGeometry=function(e,t,r,n,o,i){function a(e,t,r,n,o,i,a,l){var h,u,f,d=s.widthSegments,p=s.heightSegments,m=o/2,g=i/2,y=s.vertices.length;"x"===e&&"y"===t||"y"===e&&"x"===t?h="z":"x"===e&&"z"===t||"z"===e&&"x"===t?(h="y",p=s.depthSegments):("z"===e&&"y"===t||"y"===e&&"z"===t)&&(h="x",d=s.depthSegments);var v=d+1,_=p+1,b=o/d,w=i/p,x=new c.Vector3;for(x[h]=a>0?1:-1,f=0;_>f;f++)for(u=0;v>u;u++){var T=new c.Vector3;T[e]=(u*b-m)*r,T[t]=(f*w-g)*n,T[h]=a,s.vertices.push(T)}for(f=0;p>f;f++)for(u=0;d>u;u++){var M=u+v*f,S=u+v*(f+1),C=u+1+v*(f+1),E=u+1+v*f,A=new c.Vector2(u/d,1-f/p),L=new c.Vector2(u/d,1-(f+1)/p),P=new c.Vector2((u+1)/d,1-(f+1)/p),F=new c.Vector2((u+1)/d,1-f/p),D=new c.Face3(M+y,S+y,E+y);D.normal.copy(x),D.vertexNormals.push(x.clone(),x.clone(),x.clone()),D.materialIndex=l,s.faces.push(D),s.faceVertexUvs[0].push([A,L,F]),D=new c.Face3(S+y,C+y,E+y),D.normal.copy(x),D.vertexNormals.push(x.clone(),x.clone(),x.clone()),D.materialIndex=l,s.faces.push(D),s.faceVertexUvs[0].push([L.clone(),P,F.clone()])}}c.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:o,depthSegments:i},this.widthSegments=n||1,this.heightSegments=o||1,this.depthSegments=i||1;var s=this,l=e/2,h=t/2,u=r/2;a("z","y",-1,-1,r,t,l,0),a("z","y",1,-1,r,t,-l,1),a("x","z",1,1,e,r,h,2),a("x","z",1,-1,e,r,-h,3),a("x","y",1,-1,e,t,u,4),a("x","y",-1,-1,e,t,-u,5),this.mergeVertices()},c.BoxGeometry.prototype=Object.create(c.Geometry.prototype),c.BoxGeometry.prototype.constructor=c.BoxGeometry,c.CircleGeometry=function(e,t,r,n){c.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},e=e||50,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var o,i=[],a=new c.Vector3,s=new c.Vector2(.5,.5);for(this.vertices.push(a),i.push(s),o=0;t>=o;o++){var l=new c.Vector3,h=r+o/t*n;l.x=e*Math.cos(h),l.y=e*Math.sin(h),this.vertices.push(l),i.push(new c.Vector2((l.x/e+1)/2,(l.y/e+1)/2))}var u=new c.Vector3(0,0,1);for(o=1;t>=o;o++)this.faces.push(new c.Face3(o,o+1,0,[u.clone(),u.clone(),u.clone()])),this.faceVertexUvs[0].push([i[o].clone(),i[o+1].clone(),s.clone()]);this.computeFaceNormals(),this.boundingSphere=new c.Sphere(new c.Vector3,e)},c.CircleGeometry.prototype=Object.create(c.Geometry.prototype),c.CircleGeometry.prototype.constructor=c.CircleGeometry,c.CubeGeometry=function(e,t,r,n,o,i){return console.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry."),new c.BoxGeometry(e,t,r,n,o,i)},c.CylinderGeometry=function(e,t,r,n,o,i,a,s){c.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:o,openEnded:i,thetaStart:a,thetaLength:s},e=void 0!==e?e:20,t=void 0!==t?t:20,r=void 0!==r?r:100,n=n||8,o=o||1,i=void 0!==i?i:!1,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var l,h,u=r/2,f=[],d=[];for(h=0;o>=h;h++){var p=[],m=[],g=h/o,y=g*(t-e)+e;for(l=0;n>=l;l++){var v=l/n,_=new c.Vector3;_.x=y*Math.sin(v*s+a),_.y=-g*r+u,_.z=y*Math.cos(v*s+a),this.vertices.push(_),p.push(this.vertices.length-1),m.push(new c.Vector2(v,1-g))}f.push(p),d.push(m)}var b,w,x=(t-e)/r;for(l=0;n>l;l++)for(0!==e?(b=this.vertices[f[0][l]].clone(),w=this.vertices[f[0][l+1]].clone()):(b=this.vertices[f[1][l]].clone(),w=this.vertices[f[1][l+1]].clone()),b.setY(Math.sqrt(b.x*b.x+b.z*b.z)*x).normalize(),w.setY(Math.sqrt(w.x*w.x+w.z*w.z)*x).normalize(),h=0;o>h;h++){var T=f[h][l],M=f[h+1][l],S=f[h+1][l+1],C=f[h][l+1],E=b.clone(),A=b.clone(),L=w.clone(),P=w.clone(),F=d[h][l].clone(),D=d[h+1][l].clone(),R=d[h+1][l+1].clone(),O=d[h][l+1].clone();this.faces.push(new c.Face3(T,M,C,[E,A,P])),this.faceVertexUvs[0].push([F,D,O]),this.faces.push(new c.Face3(M,S,C,[A.clone(),L,P.clone()])),this.faceVertexUvs[0].push([D.clone(),R,O.clone()])}if(i===!1&&e>0)for(this.vertices.push(new c.Vector3(0,u,0)),l=0;n>l;l++){var T=f[0][l],M=f[0][l+1],S=this.vertices.length-1,E=new c.Vector3(0,1,0),A=new c.Vector3(0,1,0),L=new c.Vector3(0,1,0),F=d[0][l].clone(),D=d[0][l+1].clone(),R=new c.Vector2(D.x,0);this.faces.push(new c.Face3(T,M,S,[E,A,L])),this.faceVertexUvs[0].push([F,D,R])}if(i===!1&&t>0)for(this.vertices.push(new c.Vector3(0,-u,0)),l=0;n>l;l++){var T=f[o][l+1],M=f[o][l],S=this.vertices.length-1,E=new c.Vector3(0,-1,0),A=new c.Vector3(0,-1,0),L=new c.Vector3(0,-1,0),F=d[o][l+1].clone(),D=d[o][l].clone(),R=new c.Vector2(D.x,1);this.faces.push(new c.Face3(T,M,S,[E,A,L])),this.faceVertexUvs[0].push([F,D,R])}this.computeFaceNormals()},c.CylinderGeometry.prototype=Object.create(c.Geometry.prototype),c.CylinderGeometry.prototype.constructor=c.CylinderGeometry,c.ExtrudeGeometry=function(e,t){return"undefined"==typeof e?void(e=[]):(c.Geometry.call(this),this.type="ExtrudeGeometry",e=e instanceof Array?e:[e],this.addShapeList(e,t),void this.computeFaceNormals())},c.ExtrudeGeometry.prototype=Object.create(c.Geometry.prototype),c.ExtrudeGeometry.prototype.constructor=c.ExtrudeGeometry,c.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var r=e.length,n=0;r>n;n++){var o=e[n];this.addShape(o,t)}},c.ExtrudeGeometry.prototype.addShape=function(e,t){function r(e,t,r){return t||console.log("die"),t.clone().multiplyScalar(r).add(e)}function n(e,t,r){var n,o,i=1e-10,a=1,s=e.x-t.x,l=e.y-t.y,h=r.x-e.x,u=r.y-e.y,f=s*s+l*l,d=s*u-l*h;if(Math.abs(d)>i){var p=Math.sqrt(f),m=Math.sqrt(h*h+u*u),g=t.x-l/p,y=t.y+s/p,v=r.x-u/m,_=r.y+h/m,b=((v-g)*u-(_-y)*h)/(s*u-l*h);n=g+s*b-e.x,o=y+l*b-e.y;var w=n*n+o*o;if(2>=w)return new c.Vector2(n,o);a=Math.sqrt(w/2)}else{var x=!1;s>i?h>i&&(x=!0):-i>s?-i>h&&(x=!0):Math.sign(l)==Math.sign(u)&&(x=!0),x?(n=-l,o=s,a=Math.sqrt(f)):(n=s,o=l,a=Math.sqrt(f/2))}return new c.Vector2(n/a,o/a)}function o(){if(b){var e=0,t=W*e;for(Y=0;X>Y;Y++)j=B[Y],l(j[2]+t,j[1]+t,j[0]+t);for(e=x+2*_,t=W*e,Y=0;X>Y;Y++)j=B[Y],l(j[0]+t,j[1]+t,j[2]+t)}else{for(Y=0;X>Y;Y++)j=B[Y],l(j[2],j[1],j[0]);for(Y=0;X>Y;Y++)j=B[Y],l(j[0]+W*x,j[1]+W*x,j[2]+W*x)}}function i(){var e=0;for(a(U,e),e+=U.length,L=0,P=k.length;P>L;L++)A=k[L],a(A,e),e+=A.length}function a(e,t){var r,n;for(Y=e.length;--Y>=0;){r=Y,n=Y-1,0>n&&(n=e.length-1);var o=0,i=x+2*_;for(o=0;i>o;o++){var a=W*o,s=W*(o+1),l=t+r+a,u=t+n+a,c=t+n+s,f=t+r+s;h(l,u,c,f,e,o,i,r,n)}}}function s(e,t,r){F.vertices.push(new c.Vector3(e,t,r))}function l(e,t,r){e+=D,t+=D,r+=D,F.faces.push(new c.Face3(e,t,r,null,null,S));var n=E.generateTopUV(F,e,t,r);F.faceVertexUvs[0].push(n)}function h(e,t,r,n,o,i,a,s,l){e+=D,t+=D,r+=D,n+=D,F.faces.push(new c.Face3(e,t,n,null,null,C)),F.faces.push(new c.Face3(t,r,n,null,null,C));var h=E.generateSideWallUV(F,e,t,r,n);F.faceVertexUvs[0].push([h[0],h[1],h[3]]),F.faceVertexUvs[0].push([h[1],h[2],h[3]])}var u,f,d,p,m,g=void 0!==t.amount?t.amount:100,y=void 0!==t.bevelThickness?t.bevelThickness:6,v=void 0!==t.bevelSize?t.bevelSize:y-2,_=void 0!==t.bevelSegments?t.bevelSegments:3,b=void 0!==t.bevelEnabled?t.bevelEnabled:!0,w=void 0!==t.curveSegments?t.curveSegments:12,x=void 0!==t.steps?t.steps:1,T=t.extrudePath,M=!1,S=t.material,C=t.extrudeMaterial,E=void 0!==t.UVGenerator?t.UVGenerator:c.ExtrudeGeometry.WorldUVGenerator;T&&(u=T.getSpacedPoints(x),M=!0,b=!1,f=void 0!==t.frames?t.frames:new c.TubeGeometry.FrenetFrames(T,x,!1),d=new c.Vector3,p=new c.Vector3,m=new c.Vector3),b||(_=0,y=0,v=0);var A,L,P,F=this,D=this.vertices.length,R=e.extractPoints(w),O=R.shape,k=R.holes,N=!c.Shape.Utils.isClockWise(O);if(N){for(O=O.reverse(),L=0,P=k.length;P>L;L++)A=k[L],c.Shape.Utils.isClockWise(A)&&(k[L]=A.reverse());N=!1}var B=c.Shape.Utils.triangulateShape(O,k),U=O;for(L=0,P=k.length;P>L;L++)A=k[L],O=O.concat(A);for(var I,V,z,G,H,j,W=O.length,X=B.length,q=(U.length,180/Math.PI,[]),Y=0,Q=U.length,K=Q-1,J=Y+1;Q>Y;Y++,K++,J++){K===Q&&(K=0),J===Q&&(J=0);U[Y],U[K],U[J];q[Y]=n(U[Y],U[K],U[J])}var Z,ee=[],te=q.concat();for(L=0,P=k.length;P>L;L++){for(A=k[L],Z=[],Y=0,Q=A.length,K=Q-1,J=Y+1;Q>Y;Y++,K++,J++)K===Q&&(K=0),J===Q&&(J=0),Z[Y]=n(A[Y],A[K],A[J]);ee.push(Z),te=te.concat(Z)}for(I=0;_>I;I++){for(z=I/_,G=y*(1-z),V=v*Math.sin(z*Math.PI/2),Y=0,Q=U.length;Q>Y;Y++)H=r(U[Y],q[Y],V),s(H.x,H.y,-G);for(L=0,P=k.length;P>L;L++)for(A=k[L],Z=ee[L],Y=0,Q=A.length;Q>Y;Y++)H=r(A[Y],Z[Y],V),s(H.x,H.y,-G)}for(V=v,Y=0;W>Y;Y++)H=b?r(O[Y],te[Y],V):O[Y],M?(p.copy(f.normals[0]).multiplyScalar(H.x),d.copy(f.binormals[0]).multiplyScalar(H.y),m.copy(u[0]).add(p).add(d),s(m.x,m.y,m.z)):s(H.x,H.y,0);var re;for(re=1;x>=re;re++)for(Y=0;W>Y;Y++)H=b?r(O[Y],te[Y],V):O[Y],M?(p.copy(f.normals[re]).multiplyScalar(H.x),d.copy(f.binormals[re]).multiplyScalar(H.y),m.copy(u[re]).add(p).add(d),s(m.x,m.y,m.z)):s(H.x,H.y,g/x*re);for(I=_-1;I>=0;I--){for(z=I/_,G=y*(1-z),V=v*Math.sin(z*Math.PI/2),Y=0,Q=U.length;Q>Y;Y++)H=r(U[Y],q[Y],V),s(H.x,H.y,g+G);for(L=0,P=k.length;P>L;L++)for(A=k[L],Z=ee[L],Y=0,Q=A.length;Q>Y;Y++)H=r(A[Y],Z[Y],V),M?s(H.x,H.y+u[x-1].y,u[x-1].x+G):s(H.x,H.y,g+G)}o(),i()},c.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,r,n){var o=e.vertices,i=o[t],a=o[r],s=o[n];return[new c.Vector2(i.x,i.y),new c.Vector2(a.x,a.y),new c.Vector2(s.x,s.y)]},generateSideWallUV:function(e,t,r,n,o){var i=e.vertices,a=i[t],s=i[r],l=i[n],h=i[o];return Math.abs(a.y-s.y)<.01?[new c.Vector2(a.x,1-a.z),new c.Vector2(s.x,1-s.z),new c.Vector2(l.x,1-l.z),new c.Vector2(h.x,1-h.z)]:[new c.Vector2(a.y,1-a.z),new c.Vector2(s.y,1-s.z),new c.Vector2(l.y,1-l.z),new c.Vector2(h.y,1-h.z)]}},c.ShapeGeometry=function(e,t){c.Geometry.call(this),this.type="ShapeGeometry",e instanceof Array==!1&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},c.ShapeGeometry.prototype=Object.create(c.Geometry.prototype),c.ShapeGeometry.prototype.constructor=c.ShapeGeometry,c.ShapeGeometry.prototype.addShapeList=function(e,t){for(var r=0,n=e.length;n>r;r++)this.addShape(e[r],t);return this},c.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var r,n,o,i=void 0!==t.curveSegments?t.curveSegments:12,a=t.material,s=void 0===t.UVGenerator?c.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,l=this.vertices.length,h=e.extractPoints(i),u=h.shape,f=h.holes,d=!c.Shape.Utils.isClockWise(u);if(d){for(u=u.reverse(),r=0,n=f.length;n>r;r++)o=f[r],c.Shape.Utils.isClockWise(o)&&(f[r]=o.reverse());d=!1}var p=c.Shape.Utils.triangulateShape(u,f),m=u;for(r=0,n=f.length;n>r;r++)o=f[r],u=u.concat(o);var g,y,v=u.length,_=p.length;m.length;for(r=0;v>r;r++)g=u[r],this.vertices.push(new c.Vector3(g.x,g.y,0));for(r=0;_>r;r++){y=p[r];var b=y[0]+l,w=y[1]+l,x=y[2]+l;this.faces.push(new c.Face3(b,w,x,null,null,a)),this.faceVertexUvs[0].push(s.generateTopUV(this,b,w,x))}},c.LatheGeometry=function(e,t,r,n){c.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=t||12,r=r||0,n=n||2*Math.PI;for(var o=1/(e.length-1),i=1/t,a=0,s=t;s>=a;a++)for(var l=r+a*i*n,h=Math.cos(l),u=Math.sin(l),f=0,d=e.length;d>f;f++){var p=e[f],m=new c.Vector3;m.x=h*p.x-u*p.y,m.y=u*p.x+h*p.y,m.z=p.z,this.vertices.push(m)}for(var g=e.length,a=0,s=t;s>a;a++)for(var f=0,d=e.length-1;d>f;f++){var y=f+g*a,v=y,_=y+g,h=y+1+g,b=y+1,w=a*i,x=f*o,T=w+i,M=x+o;this.faces.push(new c.Face3(v,_,b)),this.faceVertexUvs[0].push([new c.Vector2(w,x),new c.Vector2(T,x),new c.Vector2(w,M)]),this.faces.push(new c.Face3(_,h,b)),this.faceVertexUvs[0].push([new c.Vector2(T,x),new c.Vector2(T,M),new c.Vector2(w,M)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},c.LatheGeometry.prototype=Object.create(c.Geometry.prototype),c.LatheGeometry.prototype.constructor=c.LatheGeometry,c.PlaneGeometry=function(e,t,r,n){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint."),c.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new c.PlaneBufferGeometry(e,t,r,n))},c.PlaneGeometry.prototype=Object.create(c.Geometry.prototype),c.PlaneGeometry.prototype.constructor=c.PlaneGeometry,c.PlaneBufferGeometry=function(e,t,r,n){c.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};for(var o=e/2,i=t/2,a=r||1,s=n||1,l=a+1,h=s+1,u=e/a,f=t/s,d=new Float32Array(l*h*3),p=new Float32Array(l*h*3),m=new Float32Array(l*h*2),g=0,y=0,v=0;h>v;v++)for(var _=v*f-i,b=0;l>b;b++){var w=b*u-o;d[g]=w,d[g+1]=-_,p[g+2]=1,m[y]=b/a,m[y+1]=1-v/s,g+=3,y+=2}g=0;for(var x=new(d.length/3>65535?Uint32Array:Uint16Array)(a*s*6),v=0;s>v;v++)for(var b=0;a>b;b++){var T=b+l*v,M=b+l*(v+1),S=b+1+l*(v+1),C=b+1+l*v;x[g]=T,x[g+1]=M,x[g+2]=C,x[g+3]=M,x[g+4]=S,x[g+5]=C,g+=6}this.addAttribute("index",new c.BufferAttribute(x,1)),this.addAttribute("position",new c.BufferAttribute(d,3)),this.addAttribute("normal",new c.BufferAttribute(p,3)),this.addAttribute("uv",new c.BufferAttribute(m,2))},c.PlaneBufferGeometry.prototype=Object.create(c.BufferGeometry.prototype),c.PlaneBufferGeometry.prototype.constructor=c.PlaneBufferGeometry,c.RingGeometry=function(e,t,r,n,o,i){c.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:o,thetaLength:i},e=e||0,t=t||50,o=void 0!==o?o:0,i=void 0!==i?i:2*Math.PI,r=void 0!==r?Math.max(3,r):8,n=void 0!==n?Math.max(1,n):8;var a,s,l=[],h=e,u=(t-e)/n;for(a=0;n+1>a;a++){for(s=0;r+1>s;s++){var f=new c.Vector3,d=o+s/r*i;f.x=h*Math.cos(d),f.y=h*Math.sin(d),this.vertices.push(f),l.push(new c.Vector2((f.x/t+1)/2,(f.y/t+1)/2))}h+=u}var p=new c.Vector3(0,0,1);for(a=0;n>a;a++){var m=a*(r+1);for(s=0;r>s;s++){var d=s+m,g=d,y=d+r+1,v=d+r+2;this.faces.push(new c.Face3(g,y,v,[p.clone(),p.clone(),p.clone()])),this.faceVertexUvs[0].push([l[g].clone(),l[y].clone(),l[v].clone()]),g=d,y=d+r+2,v=d+1,this.faces.push(new c.Face3(g,y,v,[p.clone(),p.clone(),p.clone()])),this.faceVertexUvs[0].push([l[g].clone(),l[y].clone(),l[v].clone()])}}this.computeFaceNormals(),this.boundingSphere=new c.Sphere(new c.Vector3,h)},c.RingGeometry.prototype=Object.create(c.Geometry.prototype),c.RingGeometry.prototype.constructor=c.RingGeometry,c.SphereGeometry=function(e,t,r,n,o,i,a){c.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:o,thetaStart:i,thetaLength:a},e=e||50,t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6),n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,i=void 0!==i?i:0,a=void 0!==a?a:Math.PI;var s,l,h=[],u=[];for(l=0;r>=l;l++){var f=[],d=[];for(s=0;t>=s;s++){var p=s/t,m=l/r,g=new c.Vector3;g.x=-e*Math.cos(n+p*o)*Math.sin(i+m*a),g.y=e*Math.cos(i+m*a),g.z=e*Math.sin(n+p*o)*Math.sin(i+m*a),this.vertices.push(g),f.push(this.vertices.length-1),d.push(new c.Vector2(p,1-m))}h.push(f),u.push(d)}for(l=0;r>l;l++)for(s=0;t>s;s++){var y=h[l][s+1],v=h[l][s],_=h[l+1][s],b=h[l+1][s+1],w=this.vertices[y].clone().normalize(),x=this.vertices[v].clone().normalize(),T=this.vertices[_].clone().normalize(),M=this.vertices[b].clone().normalize(),S=u[l][s+1].clone(),C=u[l][s].clone(),E=u[l+1][s].clone(),A=u[l+1][s+1].clone();Math.abs(this.vertices[y].y)===e?(S.x=(S.x+C.x)/2,this.faces.push(new c.Face3(y,_,b,[w,T,M])),this.faceVertexUvs[0].push([S,E,A])):Math.abs(this.vertices[_].y)===e?(E.x=(E.x+A.x)/2,this.faces.push(new c.Face3(y,v,_,[w,x,T])),this.faceVertexUvs[0].push([S,C,E])):(this.faces.push(new c.Face3(y,v,b,[w,x,M])),this.faceVertexUvs[0].push([S,C,A]),this.faces.push(new c.Face3(v,_,b,[x.clone(),T,M.clone()])),this.faceVertexUvs[0].push([C.clone(),E,A.clone()]))}this.computeFaceNormals(),this.boundingSphere=new c.Sphere(new c.Vector3,e)},c.SphereGeometry.prototype=Object.create(c.Geometry.prototype),c.SphereGeometry.prototype.constructor=c.SphereGeometry,c.TextGeometry=function(e,t){t=t||{};var r=c.FontUtils.generateShapes(e,t);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),c.ExtrudeGeometry.call(this,r,t),this.type="TextGeometry"},c.TextGeometry.prototype=Object.create(c.ExtrudeGeometry.prototype),c.TextGeometry.prototype.constructor=c.TextGeometry,c.TorusGeometry=function(e,t,r,n,o){c.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:o},e=e||100,t=t||40,r=r||8,n=n||6,o=o||2*Math.PI;for(var i=new c.Vector3,a=[],s=[],l=0;r>=l;l++)for(var h=0;n>=h;h++){var u=h/n*o,f=l/r*Math.PI*2;i.x=e*Math.cos(u),i.y=e*Math.sin(u);var d=new c.Vector3;d.x=(e+t*Math.cos(f))*Math.cos(u),d.y=(e+t*Math.cos(f))*Math.sin(u),d.z=t*Math.sin(f),this.vertices.push(d),a.push(new c.Vector2(h/n,l/r)),s.push(d.clone().sub(i).normalize())}for(var l=1;r>=l;l++)for(var h=1;n>=h;h++){var p=(n+1)*l+h-1,m=(n+1)*(l-1)+h-1,g=(n+1)*(l-1)+h,y=(n+1)*l+h,v=new c.Face3(p,m,y,[s[p].clone(),s[m].clone(),s[y].clone()]);this.faces.push(v),this.faceVertexUvs[0].push([a[p].clone(),a[m].clone(),a[y].clone()]),v=new c.Face3(m,g,y,[s[m].clone(),s[g].clone(),s[y].clone()]),this.faces.push(v),this.faceVertexUvs[0].push([a[m].clone(),a[g].clone(),a[y].clone()])}this.computeFaceNormals()},c.TorusGeometry.prototype=Object.create(c.Geometry.prototype),c.TorusGeometry.prototype.constructor=c.TorusGeometry,c.TorusKnotGeometry=function(e,t,r,n,o,i,a){function s(e,t,r,n,o){var i=Math.cos(e),a=Math.sin(e),s=t/r*e,l=Math.cos(s),h=n*(2+l)*.5*i,u=n*(2+l)*a*.5,f=o*n*Math.sin(s)*.5;return new c.Vector3(h,u,f)}c.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,p:o,q:i,heightScale:a},e=e||100,t=t||40,r=r||64,n=n||8,o=o||2,i=i||3,a=a||1;for(var l=new Array(r),h=new c.Vector3,u=new c.Vector3,f=new c.Vector3,d=0;r>d;++d){l[d]=new Array(n);var p=d/r*2*o*Math.PI,m=s(p,i,o,e,a),g=s(p+.01,i,o,e,a);h.subVectors(g,m),u.addVectors(g,m),f.crossVectors(h,u),u.crossVectors(f,h),f.normalize(),u.normalize();for(var y=0;n>y;++y){var v=y/n*2*Math.PI,_=-t*Math.cos(v),b=t*Math.sin(v),w=new c.Vector3;w.x=m.x+_*u.x+b*f.x,w.y=m.y+_*u.y+b*f.y,w.z=m.z+_*u.z+b*f.z,l[d][y]=this.vertices.push(w)-1}}for(var d=0;r>d;++d)for(var y=0;n>y;++y){var x=(d+1)%r,T=(y+1)%n,M=l[d][y],S=l[x][y],C=l[x][T],E=l[d][T],A=new c.Vector2(d/r,y/n),L=new c.Vector2((d+1)/r,y/n),P=new c.Vector2((d+1)/r,(y+1)/n),F=new c.Vector2(d/r,(y+1)/n);this.faces.push(new c.Face3(M,S,E)),this.faceVertexUvs[0].push([A,L,F]),this.faces.push(new c.Face3(S,C,E)),this.faceVertexUvs[0].push([L.clone(),P,F.clone()])}this.computeFaceNormals(),this.computeVertexNormals()},c.TorusKnotGeometry.prototype=Object.create(c.Geometry.prototype),c.TorusKnotGeometry.prototype.constructor=c.TorusKnotGeometry,c.TubeGeometry=function(e,t,r,n,o,i){function a(e,t,r){return P.vertices.push(new c.Vector3(e,t,r))-1}c.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:r,radialSegments:n,closed:o},t=t||64,r=r||1,n=n||8,o=o||!1,i=i||c.TubeGeometry.NoTaper;var s,l,h,u,f,d,p,m,g,y,v,_,b,w,x,T,M,S,C,E,A,L=[],P=this,F=t+1,D=new c.Vector3,R=new c.TubeGeometry.FrenetFrames(e,t,o),O=R.tangents,k=R.normals,N=R.binormals;for(this.tangents=O,this.normals=k,this.binormals=N,y=0;F>y;y++)for(L[y]=[],u=y/(F-1),g=e.getPointAt(u),s=O[y],l=k[y],h=N[y],d=r*i(u),v=0;n>v;v++)f=v/n*2*Math.PI,p=-d*Math.cos(f),m=d*Math.sin(f),D.copy(g),D.x+=p*l.x+m*h.x,D.y+=p*l.y+m*h.y,D.z+=p*l.z+m*h.z,L[y][v]=a(D.x,D.y,D.z);for(y=0;t>y;y++)for(v=0;n>v;v++)_=o?(y+1)%t:y+1,b=(v+1)%n,w=L[y][v],x=L[_][v],T=L[_][b],M=L[y][b],S=new c.Vector2(y/t,v/n),C=new c.Vector2((y+1)/t,v/n),E=new c.Vector2((y+1)/t,(v+1)/n),A=new c.Vector2(y/t,(v+1)/n),this.faces.push(new c.Face3(w,x,M)),this.faceVertexUvs[0].push([S,C,A]),this.faces.push(new c.Face3(x,T,M)),this.faceVertexUvs[0].push([C.clone(),E,A.clone()]);this.computeFaceNormals(),
this.computeVertexNormals()},c.TubeGeometry.prototype=Object.create(c.Geometry.prototype),c.TubeGeometry.prototype.constructor=c.TubeGeometry,c.TubeGeometry.NoTaper=function(e){return 1},c.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},c.TubeGeometry.FrenetFrames=function(e,t,r){function n(){p[0]=new c.Vector3,m[0]=new c.Vector3,i=Number.MAX_VALUE,a=Math.abs(d[0].x),s=Math.abs(d[0].y),l=Math.abs(d[0].z),i>=a&&(i=a,f.set(1,0,0)),i>=s&&(i=s,f.set(0,1,0)),i>=l&&f.set(0,0,1),g.crossVectors(d[0],f).normalize(),p[0].crossVectors(d[0],g),m[0].crossVectors(d[0],p[0])}var o,i,a,s,l,h,u,f=(new c.Vector3,new c.Vector3),d=(new c.Vector3,[]),p=[],m=[],g=new c.Vector3,y=new c.Matrix4,v=t+1,_=1e-4;for(this.tangents=d,this.normals=p,this.binormals=m,h=0;v>h;h++)u=h/(v-1),d[h]=e.getTangentAt(u),d[h].normalize();for(n(),h=1;v>h;h++)p[h]=p[h-1].clone(),m[h]=m[h-1].clone(),g.crossVectors(d[h-1],d[h]),g.length()>_&&(g.normalize(),o=Math.acos(c.Math.clamp(d[h-1].dot(d[h]),-1,1)),p[h].applyMatrix4(y.makeRotationAxis(g,o))),m[h].crossVectors(d[h],p[h]);if(r)for(o=Math.acos(c.Math.clamp(p[0].dot(p[v-1]),-1,1)),o/=v-1,d[0].dot(g.crossVectors(p[0],p[v-1]))>0&&(o=-o),h=1;v>h;h++)p[h].applyMatrix4(y.makeRotationAxis(d[h],o*h)),m[h].crossVectors(d[h],p[h])},c.PolyhedronGeometry=function(e,t,r,n){function o(e){var t=e.normalize().clone();t.index=u.vertices.push(t)-1;var r=s(e)/2/Math.PI+.5,n=l(e)/Math.PI+.5;return t.uv=new c.Vector2(r,1-n),t}function i(e,t,r){var n=new c.Face3(e.index,t.index,r.index,[e.clone(),t.clone(),r.clone()]);u.faces.push(n),b.copy(e).add(t).add(r).divideScalar(3);var o=s(b);u.faceVertexUvs[0].push([h(e.uv,e,o),h(t.uv,t,o),h(r.uv,r,o)])}function a(e,t){for(var r=Math.pow(2,t),n=(Math.pow(4,t),o(u.vertices[e.a])),a=o(u.vertices[e.b]),s=o(u.vertices[e.c]),l=[],h=0;r>=h;h++){l[h]=[];for(var c=o(n.clone().lerp(s,h/r)),f=o(a.clone().lerp(s,h/r)),d=r-h,p=0;d>=p;p++)0==p&&h==r?l[h][p]=c:l[h][p]=o(c.clone().lerp(f,p/d))}for(var h=0;r>h;h++)for(var p=0;2*(r-h)-1>p;p++){var m=Math.floor(p/2);p%2==0?i(l[h][m+1],l[h+1][m],l[h][m]):i(l[h][m+1],l[h+1][m+1],l[h+1][m])}}function s(e){return Math.atan2(e.z,-e.x)}function l(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function h(e,t,r){return 0>r&&1===e.x&&(e=new c.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new c.Vector2(r/2/Math.PI+.5,e.y)),e.clone()}c.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n},r=r||1,n=n||0;for(var u=this,f=0,d=e.length;d>f;f+=3)o(new c.Vector3(e[f],e[f+1],e[f+2]));for(var p=this.vertices,m=[],f=0,g=0,d=t.length;d>f;f+=3,g++){var y=p[t[f]],v=p[t[f+1]],_=p[t[f+2]];m[g]=new c.Face3(y.index,v.index,_.index,[y.clone(),v.clone(),_.clone()])}for(var b=new c.Vector3,f=0,d=m.length;d>f;f++)a(m[f],n);for(var f=0,d=this.faceVertexUvs[0].length;d>f;f++){var w=this.faceVertexUvs[0][f],x=w[0].x,T=w[1].x,M=w[2].x,S=Math.max(x,Math.max(T,M)),C=Math.min(x,Math.min(T,M));S>.9&&.1>C&&(.2>x&&(w[0].x+=1),.2>T&&(w[1].x+=1),.2>M&&(w[2].x+=1))}for(var f=0,d=this.vertices.length;d>f;f++)this.vertices[f].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new c.Sphere(new c.Vector3,r)},c.PolyhedronGeometry.prototype=Object.create(c.Geometry.prototype),c.PolyhedronGeometry.prototype.constructor=c.PolyhedronGeometry,c.DodecahedronGeometry=function(e,t){this.parameters={radius:e,detail:t};var r=(1+Math.sqrt(5))/2,n=1/r,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],i=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];c.PolyhedronGeometry.call(this,o,i,e,t)},c.DodecahedronGeometry.prototype=Object.create(c.Geometry.prototype),c.DodecahedronGeometry.prototype.constructor=c.DodecahedronGeometry,c.IcosahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];c.PolyhedronGeometry.call(this,n,o,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},c.IcosahedronGeometry.prototype=Object.create(c.Geometry.prototype),c.IcosahedronGeometry.prototype.constructor=c.IcosahedronGeometry,c.OctahedronGeometry=function(e,t){this.parameters={radius:e,detail:t};var r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],n=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];c.PolyhedronGeometry.call(this,r,n,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},c.OctahedronGeometry.prototype=Object.create(c.Geometry.prototype),c.OctahedronGeometry.prototype.constructor=c.OctahedronGeometry,c.TetrahedronGeometry=function(e,t){var r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],n=[2,1,0,0,3,2,1,3,0,2,3,1];c.PolyhedronGeometry.call(this,r,n,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},c.TetrahedronGeometry.prototype=Object.create(c.Geometry.prototype),c.TetrahedronGeometry.prototype.constructor=c.TetrahedronGeometry,c.ParametricGeometry=function(e,t,r){c.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var n,o,i,a,s,l=this.vertices,h=this.faces,u=this.faceVertexUvs[0],f=t+1;for(n=0;r>=n;n++)for(s=n/r,o=0;t>=o;o++)a=o/t,i=e(a,s),l.push(i);var d,p,m,g,y,v,_,b;for(n=0;r>n;n++)for(o=0;t>o;o++)d=n*f+o,p=n*f+o+1,m=(n+1)*f+o+1,g=(n+1)*f+o,y=new c.Vector2(o/t,n/r),v=new c.Vector2((o+1)/t,n/r),_=new c.Vector2((o+1)/t,(n+1)/r),b=new c.Vector2(o/t,(n+1)/r),h.push(new c.Face3(d,p,g)),u.push([y,v,b]),h.push(new c.Face3(p,m,g)),u.push([v.clone(),_,b.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},c.ParametricGeometry.prototype=Object.create(c.Geometry.prototype),c.ParametricGeometry.prototype.constructor=c.ParametricGeometry,c.AxisHelper=function(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),n=new c.BufferGeometry;n.addAttribute("position",new c.BufferAttribute(t,3)),n.addAttribute("color",new c.BufferAttribute(r,3));var o=new c.LineBasicMaterial({vertexColors:c.VertexColors});c.Line.call(this,n,o,c.LinePieces)},c.AxisHelper.prototype=Object.create(c.Line.prototype),c.AxisHelper.prototype.constructor=c.AxisHelper,c.ArrowHelper=function(){var e=new c.Geometry;e.vertices.push(new c.Vector3(0,0,0),new c.Vector3(0,1,0));var t=new c.CylinderGeometry(0,.5,1,5,1);return t.applyMatrix((new c.Matrix4).makeTranslation(0,-.5,0)),function(r,n,o,i,a,s){c.Object3D.call(this),void 0===i&&(i=16776960),void 0===o&&(o=1),void 0===a&&(a=.2*o),void 0===s&&(s=.2*a),this.position.copy(n),this.line=new c.Line(e,new c.LineBasicMaterial({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new c.Mesh(t,new c.MeshBasicMaterial({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(o,a,s)}}(),c.ArrowHelper.prototype=Object.create(c.Object3D.prototype),c.ArrowHelper.prototype.constructor=c.ArrowHelper,c.ArrowHelper.prototype.setDirection=function(){var e,t=new c.Vector3;return function(r){r.y>.99999?this.quaternion.set(0,0,0,1):r.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(r.z,0,-r.x).normalize(),e=Math.acos(r.y),this.quaternion.setFromAxisAngle(t,e))}}(),c.ArrowHelper.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),this.line.scale.set(1,e-t,1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},c.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},c.BoxHelper=function(e){var t=new c.BufferGeometry;t.addAttribute("position",new c.BufferAttribute(new Float32Array(72),3)),c.Line.call(this,t,new c.LineBasicMaterial({color:16776960}),c.LinePieces),void 0!==e&&this.update(e)},c.BoxHelper.prototype=Object.create(c.Line.prototype),c.BoxHelper.prototype.constructor=c.BoxHelper,c.BoxHelper.prototype.update=function(e){var t=e.geometry;null===t.boundingBox&&t.computeBoundingBox();var r=t.boundingBox.min,n=t.boundingBox.max,o=this.geometry.attributes.position.array;o[0]=n.x,o[1]=n.y,o[2]=n.z,o[3]=r.x,o[4]=n.y,o[5]=n.z,o[6]=r.x,o[7]=n.y,o[8]=n.z,o[9]=r.x,o[10]=r.y,o[11]=n.z,o[12]=r.x,o[13]=r.y,o[14]=n.z,o[15]=n.x,o[16]=r.y,o[17]=n.z,o[18]=n.x,o[19]=r.y,o[20]=n.z,o[21]=n.x,o[22]=n.y,o[23]=n.z,o[24]=n.x,o[25]=n.y,o[26]=r.z,o[27]=r.x,o[28]=n.y,o[29]=r.z,o[30]=r.x,o[31]=n.y,o[32]=r.z,o[33]=r.x,o[34]=r.y,o[35]=r.z,o[36]=r.x,o[37]=r.y,o[38]=r.z,o[39]=n.x,o[40]=r.y,o[41]=r.z,o[42]=n.x,o[43]=r.y,o[44]=r.z,o[45]=n.x,o[46]=n.y,o[47]=r.z,o[48]=n.x,o[49]=n.y,o[50]=n.z,o[51]=n.x,o[52]=n.y,o[53]=r.z,o[54]=r.x,o[55]=n.y,o[56]=n.z,o[57]=r.x,o[58]=n.y,o[59]=r.z,o[60]=r.x,o[61]=r.y,o[62]=n.z,o[63]=r.x,o[64]=r.y,o[65]=r.z,o[66]=n.x,o[67]=r.y,o[68]=n.z,o[69]=n.x,o[70]=r.y,o[71]=r.z,this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeBoundingSphere(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},c.BoundingBoxHelper=function(e,t){var r=void 0!==t?t:8947848;this.object=e,this.box=new c.Box3,c.Mesh.call(this,new c.BoxGeometry(1,1,1),new c.MeshBasicMaterial({color:r,wireframe:!0}))},c.BoundingBoxHelper.prototype=Object.create(c.Mesh.prototype),c.BoundingBoxHelper.prototype.constructor=c.BoundingBoxHelper,c.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},c.CameraHelper=function(e){function t(e,t,n){r(e,n),r(t,n)}function r(e,t){n.vertices.push(new c.Vector3),n.colors.push(new c.Color(t)),void 0===i[e]&&(i[e]=[]),i[e].push(n.vertices.length-1)}var n=new c.Geometry,o=new c.LineBasicMaterial({color:16777215,vertexColors:c.FaceColors}),i={},a=16755200,s=16711680,l=43775,h=16777215,u=3355443;t("n1","n2",a),t("n2","n4",a),t("n4","n3",a),t("n3","n1",a),t("f1","f2",a),t("f2","f4",a),t("f4","f3",a),t("f3","f1",a),t("n1","f1",a),t("n2","f2",a),t("n3","f3",a),t("n4","f4",a),t("p","n1",s),t("p","n2",s),t("p","n3",s),t("p","n4",s),t("u1","u2",l),t("u2","u3",l),t("u3","u1",l),t("c","t",h),t("p","c",u),t("cn1","cn2",u),t("cn3","cn4",u),t("cf1","cf2",u),t("cf3","cf4",u),c.Line.call(this,n,o,c.LinePieces),this.camera=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=i,this.update()},c.CameraHelper.prototype=Object.create(c.Line.prototype),c.CameraHelper.prototype.constructor=c.CameraHelper,c.CameraHelper.prototype.update=function(){var e,t,r=new c.Vector3,n=new c.Camera,o=function(o,i,a,s){r.set(i,a,s).unproject(n);var l=t[o];if(void 0!==l)for(var h=0,u=l.length;u>h;h++)e.vertices[l[h]].copy(r)};return function(){e=this.geometry,t=this.pointMap;var r=1,i=1;n.projectionMatrix.copy(this.camera.projectionMatrix),o("c",0,0,-1),o("t",0,0,1),o("n1",-r,-i,-1),o("n2",r,-i,-1),o("n3",-r,i,-1),o("n4",r,i,-1),o("f1",-r,-i,1),o("f2",r,-i,1),o("f3",-r,i,1),o("f4",r,i,1),o("u1",.7*r,1.1*i,-1),o("u2",.7*-r,1.1*i,-1),o("u3",0,2*i,-1),o("cf1",-r,0,1),o("cf2",r,0,1),o("cf3",0,-i,1),o("cf4",0,i,1),o("cn1",-r,0,-1),o("cn2",r,0,-1),o("cn3",0,-i,-1),o("cn4",0,i,-1),e.verticesNeedUpdate=!0}}(),c.DirectionalLightHelper=function(e,t){c.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var r=new c.Geometry;r.vertices.push(new c.Vector3(-t,t,0),new c.Vector3(t,t,0),new c.Vector3(t,-t,0),new c.Vector3(-t,-t,0),new c.Vector3(-t,t,0));var n=new c.LineBasicMaterial({fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new c.Line(r,n),this.add(this.lightPlane),r=new c.Geometry,r.vertices.push(new c.Vector3,new c.Vector3),n=new c.LineBasicMaterial({fog:!1}),n.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new c.Line(r,n),this.add(this.targetLine),this.update()},c.DirectionalLightHelper.prototype=Object.create(c.Object3D.prototype),c.DirectionalLightHelper.prototype.constructor=c.DirectionalLightHelper,c.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},c.DirectionalLightHelper.prototype.update=function(){var e=new c.Vector3,t=new c.Vector3,r=new c.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(t,e),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),c.EdgesHelper=function(e,t){var r=void 0!==t?t:16777215,n=[0,0],o={},i=function(e,t){return e-t},a=["a","b","c"],s=new c.BufferGeometry,l=e.geometry.clone();l.mergeVertices(),l.computeFaceNormals();for(var h=l.vertices,u=l.faces,f=0,d=0,p=u.length;p>d;d++)for(var m=u[d],g=0;3>g;g++){n[0]=m[a[g]],n[1]=m[a[(g+1)%3]],n.sort(i);var y=n.toString();void 0===o[y]?(o[y]={vert1:n[0],vert2:n[1],face1:d,face2:void 0},f++):o[y].face2=d}var v=new Float32Array(2*f*3),_=0;for(var y in o){var b=o[y];if(void 0===b.face2||u[b.face1].normal.dot(u[b.face2].normal)<.9999){var w=h[b.vert1];v[_++]=w.x,v[_++]=w.y,v[_++]=w.z,w=h[b.vert2],v[_++]=w.x,v[_++]=w.y,v[_++]=w.z}}s.addAttribute("position",new c.BufferAttribute(v,3)),c.Line.call(this,s,new c.LineBasicMaterial({color:r}),c.LinePieces),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},c.EdgesHelper.prototype=Object.create(c.Line.prototype),c.EdgesHelper.prototype.constructor=c.EdgesHelper,c.FaceNormalsHelper=function(e,t,r,n){this.object=e,this.size=void 0!==t?t:1;for(var o=void 0!==r?r:16776960,i=void 0!==n?n:1,a=new c.Geometry,s=this.object.geometry.faces,l=0,h=s.length;h>l;l++)a.vertices.push(new c.Vector3,new c.Vector3);c.Line.call(this,a,new c.LineBasicMaterial({color:o,linewidth:i}),c.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new c.Matrix3,this.update()},c.FaceNormalsHelper.prototype=Object.create(c.Line.prototype),c.FaceNormalsHelper.prototype.constructor=c.FaceNormalsHelper,c.FaceNormalsHelper.prototype.update=function(){var e=this.geometry.vertices,t=this.object,r=t.geometry.vertices,n=t.geometry.faces,o=t.matrixWorld;t.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(o);for(var i=0,a=0,s=n.length;s>i;i++,a+=2){var l=n[i];e[a].copy(r[l.a]).add(r[l.b]).add(r[l.c]).divideScalar(3).applyMatrix4(o),e[a+1].copy(l.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(e[a])}return this.geometry.verticesNeedUpdate=!0,this},c.GridHelper=function(e,t){var r=new c.Geometry,n=new c.LineBasicMaterial({vertexColors:c.VertexColors});this.color1=new c.Color(4473924),this.color2=new c.Color(8947848);for(var o=-e;e>=o;o+=t){r.vertices.push(new c.Vector3(-e,0,o),new c.Vector3(e,0,o),new c.Vector3(o,0,-e),new c.Vector3(o,0,e));var i=0===o?this.color1:this.color2;r.colors.push(i,i,i,i)}c.Line.call(this,r,n,c.LinePieces)},c.GridHelper.prototype=Object.create(c.Line.prototype),c.GridHelper.prototype.constructor=c.GridHelper,c.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},c.HemisphereLightHelper=function(e,t,r,n){c.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new c.Color,new c.Color];var o=new c.SphereGeometry(t,4,2);o.applyMatrix((new c.Matrix4).makeRotationX(-Math.PI/2));for(var i=0,a=8;a>i;i++)o.faces[i].color=this.colors[4>i?0:1];var s=new c.MeshBasicMaterial({vertexColors:c.FaceColors,wireframe:!0});this.lightSphere=new c.Mesh(o,s),this.add(this.lightSphere),this.update()},c.HemisphereLightHelper.prototype=Object.create(c.Object3D.prototype),c.HemisphereLightHelper.prototype.constructor=c.HemisphereLightHelper,c.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},c.HemisphereLightHelper.prototype.update=function(){var e=new c.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),c.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var r=new c.SphereGeometry(t,4,2),n=new c.MeshBasicMaterial({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),c.Mesh.call(this,r,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},c.PointLightHelper.prototype=Object.create(c.Mesh.prototype),c.PointLightHelper.prototype.constructor=c.PointLightHelper,c.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},c.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},c.SkeletonHelper=function(e){this.bones=this.getBoneList(e);for(var t=new c.Geometry,r=0;r<this.bones.length;r++){var n=this.bones[r];n.parent instanceof c.Bone&&(t.vertices.push(new c.Vector3),t.vertices.push(new c.Vector3),t.colors.push(new c.Color(0,0,1)),t.colors.push(new c.Color(0,1,0)))}var o=new c.LineBasicMaterial({vertexColors:c.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});c.Line.call(this,t,o,c.LinePieces),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()},c.SkeletonHelper.prototype=Object.create(c.Line.prototype),c.SkeletonHelper.prototype.constructor=c.SkeletonHelper,c.SkeletonHelper.prototype.getBoneList=function(e){var t=[];e instanceof c.Bone&&t.push(e);for(var r=0;r<e.children.length;r++)t.push.apply(t,this.getBoneList(e.children[r]));return t},c.SkeletonHelper.prototype.update=function(){for(var e=this.geometry,t=(new c.Matrix4).getInverse(this.root.matrixWorld),r=new c.Matrix4,n=0,o=0;o<this.bones.length;o++){var i=this.bones[o];i.parent instanceof c.Bone&&(r.multiplyMatrices(t,i.matrixWorld),e.vertices[n].setFromMatrixPosition(r),r.multiplyMatrices(t,i.parent.matrixWorld),e.vertices[n+1].setFromMatrixPosition(r),n+=2)}e.verticesNeedUpdate=!0,e.computeBoundingSphere()},c.SpotLightHelper=function(e){c.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;var t=new c.CylinderGeometry(0,1,1,8,1,!0);t.applyMatrix((new c.Matrix4).makeTranslation(0,-.5,0)),t.applyMatrix((new c.Matrix4).makeRotationX(-Math.PI/2));var r=new c.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new c.Mesh(t,r),this.add(this.cone),this.update()},c.SpotLightHelper.prototype=Object.create(c.Object3D.prototype),c.SpotLightHelper.prototype.constructor=c.SpotLightHelper,c.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},c.SpotLightHelper.prototype.update=function(){var e=new c.Vector3,t=new c.Vector3;return function(){var r=this.light.distance?this.light.distance:1e4,n=r*Math.tan(this.light.angle);this.cone.scale.set(n,n,r),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),c.VertexNormalsHelper=function(e,t,r,n){this.object=e,this.size=void 0!==t?t:1;for(var o=void 0!==r?r:16711680,i=void 0!==n?n:1,a=new c.Geometry,s=(e.geometry.vertices,e.geometry.faces),l=0,h=s.length;h>l;l++)for(var u=s[l],f=0,d=u.vertexNormals.length;d>f;f++)a.vertices.push(new c.Vector3,new c.Vector3);c.Line.call(this,a,new c.LineBasicMaterial({color:o,linewidth:i}),c.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new c.Matrix3,this.update()},c.VertexNormalsHelper.prototype=Object.create(c.Line.prototype),c.VertexNormalsHelper.prototype.constructor=c.VertexNormalsHelper,c.VertexNormalsHelper.prototype.update=function(e){var t=new c.Vector3;return function(e){var r=["a","b","c","d"];this.object.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var n=this.geometry.vertices,o=this.object.geometry.vertices,i=this.object.geometry.faces,a=this.object.matrixWorld,s=0,l=0,h=i.length;h>l;l++)for(var u=i[l],c=0,f=u.vertexNormals.length;f>c;c++){var d=u[r[c]],p=o[d],m=u.vertexNormals[c];n[s].copy(p).applyMatrix4(a),t.copy(m).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size),t.add(n[s]),s+=1,n[s].copy(t),s+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),c.VertexTangentsHelper=function(e,t,r,n){this.object=e,this.size=void 0!==t?t:1;for(var o=void 0!==r?r:255,i=void 0!==n?n:1,a=new c.Geometry,s=(e.geometry.vertices,e.geometry.faces),l=0,h=s.length;h>l;l++)for(var u=s[l],f=0,d=u.vertexTangents.length;d>f;f++)a.vertices.push(new c.Vector3),a.vertices.push(new c.Vector3);c.Line.call(this,a,new c.LineBasicMaterial({color:o,linewidth:i}),c.LinePieces),this.matrixAutoUpdate=!1,this.update()},c.VertexTangentsHelper.prototype=Object.create(c.Line.prototype),c.VertexTangentsHelper.prototype.constructor=c.VertexTangentsHelper,c.VertexTangentsHelper.prototype.update=function(e){var t=new c.Vector3;return function(e){var r=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var n=this.geometry.vertices,o=this.object.geometry.vertices,i=this.object.geometry.faces,a=this.object.matrixWorld,s=0,l=0,h=i.length;h>l;l++)for(var u=i[l],c=0,f=u.vertexTangents.length;f>c;c++){var d=u[r[c]],p=o[d],m=u.vertexTangents[c];n[s].copy(p).applyMatrix4(a),t.copy(m).transformDirection(a).multiplyScalar(this.size),t.add(n[s]),s+=1,n[s].copy(t),s+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),c.WireframeHelper=function(e,t){var r=void 0!==t?t:16777215,n=[0,0],o={},i=function(e,t){return e-t},a=["a","b","c"],s=new c.BufferGeometry;if(e.geometry instanceof c.Geometry){for(var l=e.geometry.vertices,h=e.geometry.faces,u=0,f=new Uint32Array(6*h.length),d=0,p=h.length;p>d;d++)for(var m=h[d],g=0;3>g;g++){n[0]=m[a[g]],n[1]=m[a[(g+1)%3]],n.sort(i);var y=n.toString();void 0===o[y]&&(f[2*u]=n[0],f[2*u+1]=n[1],o[y]=!0,u++)}for(var v=new Float32Array(2*u*3),d=0,p=u;p>d;d++)for(var g=0;2>g;g++){var _=l[f[2*d+g]],b=6*d+3*g;v[b+0]=_.x,v[b+1]=_.y,v[b+2]=_.z}s.addAttribute("position",new c.BufferAttribute(v,3))}else if(e.geometry instanceof c.BufferGeometry)if(void 0!==e.geometry.attributes.index){var l=e.geometry.attributes.position.array,w=e.geometry.attributes.index.array,x=e.geometry.drawcalls,u=0;0===x.length&&(x=[{count:w.length,index:0,start:0}]);for(var f=new Uint32Array(2*w.length),T=0,M=x.length;M>T;++T)for(var S=x[T].start,C=x[T].count,b=x[T].index,d=S,E=S+C;E>d;d+=3)for(var g=0;3>g;g++){n[0]=b+w[d+g],n[1]=b+w[d+(g+1)%3],n.sort(i);var y=n.toString();void 0===o[y]&&(f[2*u]=n[0],f[2*u+1]=n[1],o[y]=!0,u++)}for(var v=new Float32Array(2*u*3),d=0,p=u;p>d;d++)for(var g=0;2>g;g++){var b=6*d+3*g,A=3*f[2*d+g];v[b+0]=l[A],v[b+1]=l[A+1],v[b+2]=l[A+2]}s.addAttribute("position",new c.BufferAttribute(v,3))}else{for(var l=e.geometry.attributes.position.array,u=l.length/3,L=u/3,v=new Float32Array(2*u*3),d=0,p=L;p>d;d++)for(var g=0;3>g;g++){var b=18*d+6*g,P=9*d+3*g;v[b+0]=l[P],v[b+1]=l[P+1],v[b+2]=l[P+2];var A=9*d+3*((g+1)%3);v[b+3]=l[A],v[b+4]=l[A+1],v[b+5]=l[A+2]}s.addAttribute("position",new c.BufferAttribute(v,3))}c.Line.call(this,s,new c.LineBasicMaterial({color:r}),c.LinePieces),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},c.WireframeHelper.prototype=Object.create(c.Line.prototype),c.WireframeHelper.prototype.constructor=c.WireframeHelper,c.ImmediateRenderObject=function(){c.Object3D.call(this),this.render=function(e){}},c.ImmediateRenderObject.prototype=Object.create(c.Object3D.prototype),c.ImmediateRenderObject.prototype.constructor=c.ImmediateRenderObject,c.MorphBlendMesh=function(e,t){c.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length,n="__default",o=0,i=r-1,a=r/1;this.createAnimation(n,o,i,a),this.setAnimationWeight(n,1)},c.MorphBlendMesh.prototype=Object.create(c.Mesh.prototype),c.MorphBlendMesh.prototype.constructor=c.MorphBlendMesh,c.MorphBlendMesh.prototype.createAnimation=function(e,t,r,n){var o={startFrame:t,endFrame:r,length:r-t+1,fps:n,duration:(r-t)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=o,this.animationsList.push(o)},c.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,r=/([a-z]+)_?(\d+)/,n={},o=this.geometry,i=0,a=o.morphTargets.length;a>i;i++){var s=o.morphTargets[i],l=s.name.match(r);if(l&&l.length>1){var h=l[1];l[2];n[h]||(n[h]={start:1/0,end:-(1/0)});var u=n[h];i<u.start&&(u.start=i),i>u.end&&(u.end=i),t||(t=h)}}for(var h in n){var u=n[h];this.createAnimation(h,u.start,u.end,e)}this.firstAnimation=t},c.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},c.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},c.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var r=this.animationsMap[e];r&&(r.fps=t,r.duration=(r.end-r.start)/r.fps)},c.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var r=this.animationsMap[e];r&&(r.duration=t,r.fps=(r.end-r.start)/r.duration)},c.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var r=this.animationsMap[e];r&&(r.weight=t)},c.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var r=this.animationsMap[e];r&&(r.time=t)},c.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,r=this.animationsMap[e];return r&&(t=r.time),t},c.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,r=this.animationsMap[e];return r&&(t=r.duration),t},c.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("animation["+e+"] undefined")},c.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},c.MorphBlendMesh.prototype.update=function(e){for(var t=0,r=this.animationsList.length;r>t;t++){var n=this.animationsList[t];if(n.active){var o=n.duration/n.length;n.time+=n.direction*e,n.mirroredLoop?(n.time>n.duration||n.time<0)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),n.time<0&&(n.time=0,n.directionBackwards=!1)):(n.time=n.time%n.duration,n.time<0&&(n.time+=n.duration));var i=n.startFrame+c.Math.clamp(Math.floor(n.time/o),0,n.length-1),a=n.weight;i!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*a,this.morphTargetInfluences[i]=0,n.lastFrame=n.currentFrame,n.currentFrame=i);var s=n.time%o/o;n.directionBackwards&&(s=1-s),this.morphTargetInfluences[n.currentFrame]=s*a,this.morphTargetInfluences[n.lastFrame]=(1-s)*a}}},"undefined"!=typeof exports?("undefined"!=typeof e&&e.exports&&(exports=e.exports=c),exports.THREE=c):this.THREE=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/three/three.js","/release_modules/animation-utilities/node_modules/three")},{_process:5,buffer:1}],41:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){e.exports.JiboConfig=require("geometry-info/src/JiboConfig"),e.exports.RobotInfo=require("geometry-info/src/RobotInfo"),e.exports.EyeKinematicsHelper=require("geometry-info/src/EyeKinematicsHelper"),e.exports.animate=require("animation-animate/src/AnimateImpl"),e.exports.visualize=require("animation-visualize/src/VisualizeImpl"),e.exports.TimelineBuilder=require("animation-macros/src/TimelineBuilder"),e.exports.Time=require("ifr-core/src/Time"),e.exports.Clock=require("ifr-core/src/Clock"),e.exports.slog=require("ifr-core/src/SLog"),e.exports.MotionInterface=require("animation-body/src/MotionInterface"),e.exports.body={BodyVelocityOutput:require("animation-body/src/BodyVelocityOutput"),BodyTrajectoryOutput:require("animation-body/src/BodyTrajectoryOutput"),BodyPositionOutput:require("animation-body/src/BodyPositionOutput"),BodyPosVelOutput:require("animation-body/src/BodyPosVelOutput"),BodyPosVelComboOutput:require("animation-body/src/BodyPosVelComboOutput"),MotionServiceOutput:require("animation-body/src/MotionServiceOutput"),MotionLog:require("animation-body/src/MotionLog")},e.exports.LEDOutput=require("animation-body/src/LEDOutput"),e.exports.MouseCoordinateWrangler=require("ifr-visualizer/src/MouseCoordinateWrangler"),e.exports.MouseTargetPositioner=require("ifr-visualizer/src/MouseTargetPositioner"),e.exports.TrajectoryControllerSim=require("ifr-motion/src/feedback/TrajectoryControllerSim"),e.exports.PosVelControllerSim=require("ifr-motion/src/feedback/PosVelControllerSim"),e.exports.THREE=require("three"),e.exports.slog.setPrintChannels(["ERROR","ACCEL_PLANNER","CALIBRATION","MODEL_LOADING","RENDER_PLUGIN"])}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/src/main.js","/release_modules/animation-utilities/src")},{_process:5,"animation-animate/src/AnimateImpl":7,"animation-body/src/BodyPosVelComboOutput":29,"animation-body/src/BodyPosVelOutput":30,"animation-body/src/BodyPositionOutput":31,"animation-body/src/BodyTrajectoryOutput":32,"animation-body/src/BodyVelocityOutput":33,"animation-body/src/LEDOutput":35,"animation-body/src/MotionInterface":36,"animation-body/src/MotionLog":37,"animation-body/src/MotionServiceOutput":38,"animation-macros/src/TimelineBuilder":39,"animation-visualize/src/VisualizeImpl":47,buffer:1,"geometry-info/src/EyeKinematicsHelper":49,"geometry-info/src/JiboConfig":51,"geometry-info/src/RobotInfo":53,"ifr-core/src/Clock":60,"ifr-core/src/SLog":62,"ifr-core/src/Time":63,"ifr-motion/src/feedback/PosVelControllerSim":97,"ifr-motion/src/feedback/TrajectoryControllerSim":98,"ifr-visualizer/src/MouseCoordinateWrangler":116,"ifr-visualizer/src/MouseTargetPositioner":117,three:40}],42:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c=require("./RenderPlugin"),f=function(){c.call(this,"DefaultEyeLighting"),this._mainLightBasePosition=new u.Vector3(0,.03,.09),this._mainLightXScale=2,this._mainLightYScale=2.7,this._ledEffectAmount=.2};f.prototype=Object.create(c.prototype),f.prototype.constructor=f,f.prototype.install=function(e,t){if(null!=t){var r=new u.AmbientLight(3158064);t.add(r),this._registerObjectForScene(t,"ambientLight",r);var n=new u.DirectionalLight(0,1);n.position.set(0,-2,0),t.add(n),this._registerObjectForScene(t,"ledLight",n);var o=new u.PointLight(10526880,1.2,1);o.position.copy(this._mainLightBasePosition),this._registerObjectForScene(t,"mainLight",o),t.add(o),this._markMaterialsForUpdate(t)}},f.prototype.update=function(e,t,r){if(null!=t){var n=this._getObjectForScene(t,"ledLight");if(null!=n){var o=r.lightring_redChannelBn_r,i=r.lightring_greenChannelBn_r,a=r.lightring_blueChannelBn_r;null!=o&&null!=i&&null!=a&&n.color.setRGB(o*this._ledEffectAmount,i*this._ledEffectAmount,a*this._ledEffectAmount)}var s=this._getObjectForScene(t,"mainLight");if(null!=s){var l=r.eyeSubRootBn_t,h=r.eyeSubRootBn_t_2;if(null!=l&&null!=h){l=this._mainLightBasePosition.x+l*this._mainLightXScale,h=this._mainLightBasePosition.y+h*this._mainLightYScale;var u=this._mainLightBasePosition.z;s.position.set(l,h,u)}}}},f.prototype.uninstall=function(e,t){if(null!=t){for(var r=["ambientLight","ledLight","mainLight"],n=0;n<r.length;n++){
var o=this._getObjectForScene(t,r[n]);null!=o&&t.remove(o)}this._clearObjectForScene(t)}},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-visualize/src/DefaultEyeLighting.js","/release_modules/animation-visualize/src")},{"./RenderPlugin":45,_process:5,buffer:1,three:40}],43:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-geometry/src/loaders/ArticulatedModelLoader"),c=require("ifr-motion/src/loaders/KinematicsLoader"),f=require("ifr-motion/src/dofs/TextureControl"),d=require("three"),p=function(e){this._config=e,this._textureLoader=null,this._modelRoot=null,this._modelControlGroup=null,this.loadSucceeded=!1,this.loadMessage=""};p.prototype.setTextureLoader=function(e){this._textureLoader=e},p.prototype.load=function(e){var t=this,r=new u;r.modelLoader.defaultMaterial.side=d.DoubleSide,r.load("body model",t._config.getBodyGeometryURL(),t._config.getBodySkeletonURL(),function(){var n=r.getResult();if(n.success){t._modelRoot=n.modelRoot;var o=new c,i=o.getModelControlFactory(f.Factory.prototype._controlType);t._textureLoader&&i.setSharedImageLoader(t._textureLoader),o.load(t._config.getBodyKinematicsURL(),function(){var r=o.getResult();r.success?(t._modelControlGroup=r.modelControlGroup,t._modelControlGroup.attachToModel(t._modelRoot),t.loadSucceeded=!0):(t.loadSucceeded=!1,t.loadMessage="kinematics load failed with message: "+r.message+", URL = "+r.url),e&&e()})}else t.loadSucceeded=!1,t.loadMessage=""+n.message+", model URL = "+n.modelUrl+", skeleton URL = "+n.skeletonUrl,e&&e()})},p.prototype.getModelRoot=function(){return this._modelRoot},p.prototype.getModelControlGroup=function(){return this._modelControlGroup},p.prototype.constructFaceScreenRenderTarget=function(e){var t=new d.WebGLRenderTarget(800,450);t.minFilter=d.LinearFilter;var r=this.getModelRoot().getObjectByName(e.faceScreenMeshName,!0);return r.material.map=t,t},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-visualize/src/JiboBody.js","/release_modules/animation-visualize/src")},{_process:5,buffer:1,"ifr-geometry/src/loaders/ArticulatedModelLoader":68,"ifr-motion/src/dofs/TextureControl":93,"ifr-motion/src/loaders/KinematicsLoader":100,three:40}],44:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-geometry/src/loaders/ArticulatedModelLoader"),c=require("ifr-motion/src/loaders/KinematicsLoader"),f=require("ifr-motion/src/dofs/TextureControl"),d=require("three"),p=function(e){this._config=e,this._textureLoader=null,this._modelRoot=null,this._modelControlGroup=null,this.loadSucceeded=!1,this.loadMessage=""};p.prototype.setTextureLoader=function(e){this._textureLoader=e},p.prototype.load=function(e){var t=this,r=new u;r.load("eye model",t._config.getEyeGeometryURL(),t._config.getEyeSkeletonURL(),function(){var n=r.getResult();if(n.success){t._modelRoot=n.modelRoot;for(var o=0,i=.01,a=0;a<t._modelRoot.children.length;a++){var s=t._modelRoot.children[a];s instanceof d.SkinnedMesh&&(s.material.transparent=!0,s.frustumCulled=!1,s.position.z=o,o+=i)}var l=new c,h=l.getModelControlFactory(f.Factory.prototype._controlType);t._textureLoader&&h.setSharedImageLoader(t._textureLoader),l.load(t._config.getEyeKinematicsURL(),function(){var r=l.getResult();if(r.success){t._modelControlGroup=r.modelControlGroup,t._modelControlGroup.attachToModel(t._modelRoot);for(var n=0;n<t._modelControlGroup.getControlList().length;n++)"TEXTURE"===t._modelControlGroup.getControlList()[n].getControlType()&&t._modelControlGroup.getControlList()[n].setDefaultNormalURL(t._config.getDefaultNormalMap());t.loadSucceeded=!0}else t.loadSucceeded=!1,t.loadMessage="kinematics load failed with message: "+r.message+", URL = "+r.url;e&&e()})}else t.loadSucceeded=!1,t.loadMessage=""+n.message+", model URL = "+n.modelUrl+", skeleton URL = "+n.skeletonUrl,e&&e()})},p.prototype.getModelRoot=function(){return this._modelRoot},p.prototype.getModelControlGroup=function(){return this._modelControlGroup},p.prototype.constructCamera=function(e){var t=new d.OrthographicCamera(-e.faceScreenWidth/2,e.faceScreenWidth/2,e.faceScreenHeight/2,-e.faceScreenHeight/2,-20,20);return t.position.set(0,0,5),t.updateMatrixWorld(!0),t},p.prototype.constructScene=function(){var e=new d.Scene;return e.add(this.getModelRoot()),e},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-visualize/src/JiboEye.js","/release_modules/animation-visualize/src")},{_process:5,buffer:1,"ifr-geometry/src/loaders/ArticulatedModelLoader":68,"ifr-motion/src/dofs/TextureControl":93,"ifr-motion/src/loaders/KinematicsLoader":100,three:40}],45:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c=require("ifr-core/src/SLog"),f="RENDER_PLUGIN",d=function(e){this._name=e,this._installed_cache=null},p=function(e){this._scene=e,this._objects={}};d.prototype._getObjectForScene=function(e,t){if(null==this._installed_cache)return null;for(var r=null,n=0;n<this._installed_cache.length;n++)if(e===this._installed_cache[n]._scene){r=this._installed_cache[n];break}return null===r?null:r._objects.hasOwnProperty(t)?r._objects[t]:null},d.prototype._clearObjectForScene=function(e,t){if(null!=this._installed_cache)for(var r=0;r<this._installed_cache.length;r++)if(e===this._installed_cache[r]._scene){if(null==t)this._installed_cache.splice(r,1);else{var n=this._installed_cache[r];delete n._objects[t]}break}},d.prototype._registerObjectForScene=function(e,t,r){null==this._installed_cache&&(this._installed_cache=[]);for(var n=null,o=0;o<this._installed_cache.length;o++)if(e===this._installed_cache[o]._scene){n=this._installed_cache[o];break}null===n&&(n=new p(e),this._installed_cache.push(n)),n._objects.hasOwnProperty(t)&&c(f,'Error, RenderPlugin registering object "'+t+'" but one is already registered'),n._objects[t]=r},d.prototype._markMaterialsForUpdate=function(e){e.traverse(function(e){e instanceof u.Mesh&&null!=e.material&&(e.material.needsUpdate=!0)})},d.prototype.install=function(e,t){},d.prototype.update=function(e,t,r){},d.prototype.uninstall=function(e,t){},d.prototype.getName=function(){return this._name},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-visualize/src/RenderPlugin.js","/release_modules/animation-visualize/src")},{_process:5,buffer:1,"ifr-core/src/SLog":62,three:40}],46:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e){this.clock=e,this.kinematicInfo=null,this.renderers=[],this.outputStartTime=null,this.outputMotion=null};u.prototype.setKinematicInfo=function(e){this.kinematicInfo=e},u.prototype.addRenderer=function(e){this.renderers.push(e)},u.prototype.removeRenderer=function(e){var t=this.renderers.indexOf(e);t>-1&&this.renderers.splice(t,1)},u.prototype.getRenderers=function(){return this.renderers.slice(0)},u.prototype.handleOutput=function(e,t,r){this.outputStartTime=e,this.outputMotion=t},u.prototype.update=function(){if(null!==this.kinematicInfo&&null!==this.outputMotion){for(var e=this.clock.currentTime(),t=e.subtract(this.outputStartTime),r=this.outputMotion.getPoseAtTime(t,this.kinematicInfo.getInterpolatorSet()),n={},o=r.getDOFNames(),i=0;i<o.length;i++){var a=r.get(o[i],0);n[o[i]]=a}for(var s=0;s<this.renderers.length;s++)this.renderers[s].display(n)}},u.prototype.dispose=function(){for(var e=0;e<this.renderers.length;e++)this.renderers[e].dispose();this.renderers=[],this.kinematicInfo=null,this.outputMotion=null},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/animation-visualize/src/RendererOutput.js","/release_modules/node_modules/animation-visualize/src")},{_process:5,buffer:1}],47:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("geometry-info/src/SceneInfo"),c=require("./JiboBody"),f=require("./JiboEye"),d=require("ifr-visualizer/src/BasicScene"),p=require("ifr-geometry/src/loaders/CachedImageLoader"),m=require("three"),g=require("./DefaultEyeLighting"),y=require("ifr-core/src/SLog"),v="MODEL_LOADING",_=function(e,t,r,n,o,i){this.robotInfo=e,this.scene=t,this.modelControlGroups=o,this.textureLoader=i,this.grid=null,this.renderPlugins={},this.bodyScene=r,this.eyeScene=n,this.display(this.robotInfo.getDefaultDOFValues()),null!==this.scene.getContainer()&&this.scene.play()};_.prototype.display=function(e){var t;for(t=0;t<this.modelControlGroups.length;t++)this.modelControlGroups[t].updateFromDOFValues(e);var r=Object.keys(this.renderPlugins);for(t=0;t<r.length;t++)this.renderPlugins[r[t]].update(this.bodyScene,this.eyeScene,e)},_.prototype.loadTexture=function(e){this.textureLoader.loadImage(e)},_.prototype.setBackgroundColor=function(e,t,r,n){n||(n=1),this.scene.getRenderer().setClearColor(new m.Color(e,t,r),n)},_.prototype.setCamera=function(e,t,r){var n=e,o=t?t:new m.Vector3,i=r?r:45;this.scene.getCamera().position.copy(n),this.scene.getTrackballControls().target.copy(o),this.scene.getCamera().fov=i,this.scene.getCamera().updateProjectionMatrix()},_.prototype.setGrid=function(e,t,r){null!==this.grid&&this.scene.getScene().remove(this.grid),this.grid=new m.GridHelper(t*e,e),this.grid.quaternion.setFromAxisAngle(new m.Vector3(1,0,0),Math.PI/2),this.grid.setColors(r,r),this.scene.getScene().add(this.grid)},_.prototype.detachFromContainer=function(){this.scene.detachFromContainer()},_.prototype.attachToContainer=function(e){null!==this.scene.getContainer()&&this.detachFromContainer(),this.scene.attachToContainer(e),null!==this.scene.getContainer()&&this.scene.play()},_.prototype.dispose=function(){null!==this.scene&&(this.scene.dispose(),this.scene=null),this.robotInfo=null,this.modelControlGroups=[],this.textureLoader=null,this.grid=null},_.prototype.removeCameraControls=function(){this.scene.removeTrackballControls()},_.prototype.installRenderPlugin=function(e){var t=e.getName();this.renderPlugins.hasOwnProperty(t)&&this.renderPlugins[t].uninstall(this.bodyScene,this.eyeScene),e.install(this.bodyScene,this.eyeScene),this.renderPlugins[t]=e},_.prototype.removeRenderPlugin=function(e){this.renderPlugins.hasOwnProperty(e)&&(this.renderPlugins[e].uninstall(this.bodyScene,this.eyeScene),delete this.renderPlugins[e])},_.prototype.getInstalledRenderPluginNames=function(){return Object.keys(this.renderPlugins)};var b={createRobotRenderer:function(e,t,r,n){var o=e.getConfig(),i=null,a=[],s=new p,l=null,h=new u;h.load(o.getSceneInfoURL(),function(){if(h.loadSucceeded){var u=new f(o);u.load(function(){if(u.loadSucceeded)if(a.push(u.getModelControlGroup()),r===b.DisplayType.EYE)i=new d(t,!1,!1,new m.Color(0,0,0)),i._camera=u.constructCamera(h),i._scene=u.constructScene(),l=new _(e,i,null,i._scene,a,s),l.installRenderPlugin(new g),n&&n(l);else{var f=new c(o);f.load(function(){if(f.loadSucceeded){a.push(f.getModelControlGroup()),i=new d(t,!1,!1,new m.Color(0,0,.3)),i.getCamera().up=new m.Vector3(0,0,1),i.installTrackballControls(),i.getDirectionalLight().intensity=.5,i.getDirectionalLight().position.set(1,-1,1);var r=new m.DirectionalLight(16777215,.5);r.position.set(1,1,1),i.getScene().add(r);var o=new m.DirectionalLight(16777215,.5);o.position.set(-1,0,1),i.getScene().add(o);var c=f.getModelRoot();i.getScene().add(c);var p=u.constructScene(),b=u.constructCamera(h),w=f.constructFaceScreenRenderTarget(h);i.addRenderCallback(function(){i.getRenderer().render(p,b,w)}),l=new _(e,i,i._scene,p,a,s),l.setCamera(new m.Vector3(.5,0,.37),new m.Vector3(0,0,.17),45),l.installRenderPlugin(new g),n&&n(l)}else y(v,"JiboBody load error: "+f.loadMessage),n&&n(null)})}else y(v,"JiboEye load error: "+u.loadMessage),n&&n(null)})}else y(v,"SceneInfo load error: "+h.loadMessage),n&&n(null)})},getEye:function(){return null}},w={BODY:"BODY",EYE:"EYE"};b.DisplayType=w,e.exports=b}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/animation-visualize/src/VisualizeImpl.js","/release_modules/animation-utilities/node_modules/animation-visualize/src")},{"./DefaultEyeLighting":42,"./JiboBody":43,"./JiboEye":44,_process:5,buffer:1,"geometry-info/src/SceneInfo":54,"ifr-core/src/SLog":62,"ifr-geometry/src/loaders/CachedImageLoader":69,"ifr-visualizer/src/BasicScene":114,three:40}],48:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/FileTools"),c=require("ifr-core/src/SLog"),f="MODEL_LOADING",d=function(e){var t=function(t,r){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e,t){var r={};if(null!=e)for(var n=0;n<e.length;n++)r[e[n]]=!0;this.plus=function(e){var n;n="string"==typeof e?t[e]:e;var o=this.getDOFs(),i=n.getDOFs();if(null!=n)for(var a=0;a<i.length;a++)r.hasOwnProperty(i[a])||o.push(i[a]);return new d(o,t)},this.minus=function(e){var r;r="string"==typeof e?t[e]:e;var n=[],o=this.getDOFs();if(null!=r)for(var i=0;i<o.length;i++)r.hasDOF(o[i])||n.push(o[i]);else n=o;return new d(n,t)},this.getDOFs=function(){return Object.keys(r)},this.hasDOF=function(e){return r.hasOwnProperty(e)}});d.load=function(e,t){u.loadJSON(e,function(e,r){if(null===e){var n=d.createDOFSetsFromJSON(r);t&&t(n,null)}else t&&t(null,e)})},d.createDOFSetsFromJSON=function(e){var t;"DOFSets"!==e.header.fileType&&c(f,"DOFSet doesn't know how to parse file with type "+e.header.fileType);var r=e.content.DOFSets,n=Object.keys(r),o={};for(t=0;t<n.length;t++)o[n[t]]=new d(r[n[t]],o);if(e.content.hasOwnProperty("CompoundSets")){var i=e.content.CompoundSets,a=Object.keys(i);for(t=0;t<a.length;t++){for(var s=i[a[t]],l=new d(null,o),h=0;h<s.length;h++){var u=s[h];o.hasOwnProperty(u)?l=l.plus(o[u]):c(f,"Error, compound DOFSet "+a[t]+" requested basic set "+u+" but it is not present in file")}o[a[t]]=l}}return o},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/geometry-info/src/DOFSet.js","/release_modules/geometry-info/src")},{_process:5,buffer:1,"ifr-core/src/FileTools":61,"ifr-core/src/SLog":62}],49:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-motion/src/dofs/TranslationControl"),c={};c.verticesForDOFValues=function(e,t){for(var r=t.getKinematicInfo().getEyeControlGroup(),n={},o=r.getControlList(),i=0;i<o.length;i++){var a=o[i];a instanceof u&&(n[a._skeletonFrameName]=a.computeFromDOFValues(e))}return n},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/geometry-info/src/EyeKinematicsHelper.js","/release_modules/animation-utilities/node_modules/geometry-info/src")},{_process:5,buffer:1,"ifr-motion/src/dofs/TranslationControl":94}],50:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t,r){this.eyeScreenWidth=e,this.eyeScreenHeight=t,this.eyeScreenBillboardMeshName=r};u.prototype.getWidth=function(){return this.eyeScreenWidth},u.prototype.getHeight=function(){return this.eyeScreenHeight},u.prototype.getEyeScreenBillboardMeshName=function(){return this.eyeScreenBillboardMeshName},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/geometry-info/src/EyeScreenInfo.js","/release_modules/geometry-info/src")},{_process:5,buffer:1}],51:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t){var r=null;r=void 0!==require.resolve?require.resolve("geometry-config/package.json").slice(0,-12):"undefined"!=typeof ___resolve?___resolve("geometry-config/package.json").slice(0,-12):"undefined"!=typeof ___dirname?___dirname+"/node_modules/geometry-config/":"../node_modules/geometry-config/";var n=void 0!==t?t:"P1.0",o=r+n+"/",i=o+"jibo_body.geom",a=o+"jibo_body.skel",s=o+"jibo_body.kin",l=o+"jibo_joined.geom",h=o+"jibo_joined.skel",u=o+"jibo_joined.kin",c=o+"jibo_eye.geom",f=o+"jibo_eye.skel",d=o+"jibo_eye.kin",p=o+"jibo.jscene",m=o+"jibo.dofgroups",g=o+"jibo.lim",y=o+"defaultNormalMap.png";this.getRobotURL=function(){return o},this.getBodyGeometryURL=function(){return i},this.getBodySkeletonURL=function(){return a},this.getBodyKinematicsURL=function(){return s},this.getFullGeometryURL=function(){return l},this.getFullSkeletonURL=function(){return h},this.getFullKinematicsURL=function(){return u},this.getEyeGeometryURL=function(){return c},this.getEyeSkeletonURL=function(){return f},this.getEyeKinematicsURL=function(){return d},this.getSceneInfoURL=function(){return p},this.getDOFGroupsURL=function(){return m},this.getLimitsURL=function(){return g},this.getDefaultNormalMap=function(){return y}};e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/geometry-info/src/JiboConfig.js","/release_modules/animation-utilities/node_modules/geometry-info/src")},{_process:5,buffer:1}],52:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-motion/src/loaders/KinematicsLoader"),c=require("ifr-motion/src/loaders/AnimationLoader"),f=require("ifr-motion/src/loaders/LimitsLoader"),d=require("ifr-geometry/src/loaders/SkeletonLoader"),p=require("./SceneInfo"),m=(require("ifr-motion/src/dofs/TextureControl"),require("ifr-motion/src/dofs/KinematicGroup")),g=require("ifr-motion/src/base/InterpolatorSet"),y=require("ifr-motion/src/base/SeriesAlignedAxesTargetSelector"),v=require("ifr-motion/src/dofs/ModelControlGroup"),_=require("ifr-motion/src/base/DOFGlobalAlignment"),b=require("./EyeScreenInfo"),w=require("ifr-motion/src/base/Pose"),x=require("./DOFSet"),T=require("ifr-core/src/SLog"),M="MODEL_LOADING",S=function(e){this._config=e,this._bodyControlGroup=null,this._eyeControlGroup=null,this._fullControlGroup=null,this._bodyDOFNames=[],this._eyeDOFNames=[],this._dofNames=[],this._interpolatorSet=new g,this._bodyKinematicGroup=null,this._fullKinematicGroup=null,this._defaultAnimation=null,this._defaultPose=null,this.loadSucceeded=!1,this.loadMessage="",this._eyeScreenInfo=null,this._dofSets=null,this._dofGlobalAlignment=null};S.prototype.load=function(e){var t=this,r=[],n=null,o=!1,i=null,a=null,s=null,l=function(e,t){if(r.indexOf(e)>=0)throw new Error("JiboKinematicInfo:Cannot queue 2 loads with the same identifier ("+e+")");return r.push(e),function(){var o=r.indexOf(e);-1===o?T(M,'JiboKinematicInfo:Error, callback "'+e+'" called but not currently pending.'):r.splice(o,1),t&&t.apply(this,arguments),0===r.length&&n()}};n=function(){if(o)t.loadSucceeded=!1;else{t.loadSucceeded=!0,t._dofNames=t._bodyDOFNames.concat(t._eyeDOFNames),t._bodyKinematicGroup=new m(t._bodyControlGroup.getCopy(),i);var r=t._eyeControlGroup.getControlList().concat(t._bodyControlGroup.getControlList());t._fullControlGroup=new v,t._fullControlGroup.setControlList(r),t._fullKinematicGroup=new m(t._fullControlGroup.getCopy(),a),t._defaultPose=new w("default pose",t._dofNames),t._defaultAnimation.getPoseAtTime(t._defaultAnimation.getDuration()/2,t._interpolatorSet,t._defaultPose);for(var n=0;n<t._dofNames.length;n++)if(null===t._defaultPose.get(t._dofNames[n],0)){t.loadMessage="default animation has no value for DOF: "+t._dofNames[n],t.loadSucceeded=!1;break}t._dofGlobalAlignment=new _(t._fullKinematicGroup,{middleSection_r:new y("middleSection_r",["bottomSection_r"],[1]),topSection_r:new y("topSection_r",["middleSection_r","bottomSection_r"],[1,1])});for(var l=Object.keys(s),h=0;h<l.length;h++){var u=t._fullControlGroup.getDOFInfo(l[h]);u.setLimitData(s[l[h]])}}e&&e()};var h=new u,g=l("Ensure All Loads Queued",null);h.load(t._config.getBodyKinematicsURL(),l("Body Kinematics",function(){var e=h.getResult();e.success?(t._bodyControlGroup=e.modelControlGroup,t._bodyDOFNames=t._bodyControlGroup.getDOFNames(),t._interpolatorSet.addModelControlGroup(t._bodyControlGroup)):(o=!0,t.loadMessage="body kinematics load failed with message: "+e.message+", URL = "+e.url)})),h.load(t._config.getEyeKinematicsURL(),l("Eye Kinematics",function(){var e=h.getResult();e.success?(t._eyeControlGroup=e.modelControlGroup,t._eyeDOFNames=t._eyeControlGroup.getDOFNames(),t._interpolatorSet.addModelControlGroup(t._eyeControlGroup)):(o=!0,t.loadMessage="eye kinematics load failed with message: "+e.message+", URL = "+e.url)}));var S=new d;S.load(t._config.getBodySkeletonURL(),l("Body Skeleton",function(){var e=S.getResult();e.success?i=e.skeletonRoot:(o=!0,t.loadMessage="body skeleton load failed with message: "+e.message+", URL = "+e.url)}));var C=new d;C.load(t._config.getFullSkeletonURL(),l("Full Skeleton",function(){var e=C.getResult();e.success?a=e.skeletonRoot:(o=!0,t.loadMessage="full skeleton load failed with message: "+e.message+", URL = "+e.url)}));var E=new c;E.load(t._config.getRobotURL()+"jibo_default.anim",l("Default Animation",function(){var e=E.getResult();e.success?t._defaultAnimation=e.motion:(o=!0,t.loadMessage="default animation load failed with message: "+e.message+", URL = "+e.url)}));var A=new p;A.load(t._config.getSceneInfoURL(),l("Scene Info",function(){A.loadSucceeded?t._eyeScreenInfo=new b(A.faceScreenWidth,A.faceScreenHeight,A.faceScreenMeshName):(o=!0,t.loadMessage="scene info failed with load message: "+A.loadMessage+", URL = "+t._config.getSceneInfoURL())})),x.load(t._config.getDOFGroupsURL(),l("DOF Groups",function(e,r){null!=e?t._dofSets=e:(o=!0,t.loadMessage="DOF Groups failed with load message: "+r+", URL = "+t._config.getDOFGroupsURL())}));var L=new f;L.load(t._config.getLimitsURL(),l("Limits",function(){var e=L.getResult();e.success?s=e.dofLimits:(o=!0,t.loadMessage="limits data load failed with message: "+e.message+", URL = "+e.url)})),g()},S.prototype.getBodyControlGroup=function(){return this._bodyControlGroup},S.prototype.getEyeControlGroup=function(){return this._eyeControlGroup},S.prototype.getFullControlGroup=function(){return this._fullControlGroup},S.prototype.getBodyDOFNames=function(){return this._bodyDOFNames},S.prototype.getEyeDOFNames=function(){return this._eyeDOFNames},S.prototype.getDOFNames=function(){return this._dofNames},S.prototype.getFullKinematicGroup=function(){return this._fullKinematicGroup},S.prototype.getBodyKinematicGroup=function(){return this._bodyKinematicGroup},S.prototype.getInterpolatorSet=function(){return this._interpolatorSet},S.prototype.getDefaultPose=function(){return this._defaultPose},S.prototype.getEyeScreenInfo=function(){return this._eyeScreenInfo},S.prototype.getDOFSets=function(){return this._dofSets},S.prototype.getDOFGlobalAlignment=function(){return this._dofGlobalAlignment},e.exports=S}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/geometry-info/src/JiboKinematicInfo.js","/release_modules/geometry-info/src")},{"./DOFSet":48,"./EyeScreenInfo":50,"./SceneInfo":54,_process:5,buffer:1,"ifr-core/src/SLog":62,"ifr-geometry/src/loaders/SkeletonLoader":71,"ifr-motion/src/base/DOFGlobalAlignment":76,"ifr-motion/src/base/InterpolatorSet":77,"ifr-motion/src/base/Pose":83,"ifr-motion/src/base/SeriesAlignedAxesTargetSelector":84,"ifr-motion/src/dofs/KinematicGroup":88,"ifr-motion/src/dofs/ModelControlGroup":91,"ifr-motion/src/dofs/TextureControl":93,"ifr-motion/src/loaders/AnimationLoader":99,"ifr-motion/src/loaders/KinematicsLoader":100,"ifr-motion/src/loaders/LimitsLoader":101}],53:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./JiboConfig"),c=require("./JiboKinematicInfo"),f=(require("ifr-motion/src/dofs/DOFInfo"),require("ifr-core/src/SLog")),d="MODEL_LOADING",p=function(e,t){this._jiboConfig=e,this._kinematicInfo=t};p.createInfo=function(e,t){(void 0===e||null===e)&&(e=new u);var r=new c(e);r.load(function(){r.loadSucceeded?t(new p(e,r)):(f(d,"RobotInfo creation failed: "+r.loadMessage),t(null))})},p.prototype.getKinematicInfo=function(){return this._kinematicInfo},p.prototype.getConfig=function(){return this._jiboConfig},p.prototype.getBodyDOFNames=function(){return this._kinematicInfo.getBodyDOFNames()},p.prototype.getEyeDOFNames=function(){return this._kinematicInfo.getEyeDOFNames()},p.prototype.getDOFNames=function(){return this._kinematicInfo.getDOFNames()},p.prototype.getEyeScreenInfo=function(){return this._kinematicInfo.getEyeScreenInfo()},p.prototype.getDOFInfo=function(e){return this._kinematicInfo.getFullControlGroup().getDOFInfo(e)},p.prototype.getDefaultDOFValues=function(){for(var e={},t=this._kinematicInfo.getDefaultPose(),r=this.getDOFNames(),n=0;n<r.length;n++){var o=r[n];e[o]=t.get(o,0)}return e},p.prototype.getDOFSetNames=function(){return Object.keys(this._kinematicInfo.getDOFSets())},p.prototype.getDOFSet=function(e){return this._kinematicInfo.getDOFSets()[e]},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/geometry-info/src/RobotInfo.js","/release_modules/animation-utilities/node_modules/geometry-info/src")},{"./JiboConfig":51,"./JiboKinematicInfo":52,_process:5,buffer:1,"ifr-core/src/SLog":62,"ifr-motion/src/dofs/DOFInfo":87}],54:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/FileTools"),c=function(){this.faceScreenMeshName=null,this.faceScreenWidth=null,this.faceScreenHeight=null,this.loadURL=null,this.loadSucceeded=!1,this.loadMessage=""};c.prototype.load=function(e,t){this.loadURL=e;var r=this;u.loadJSON(e,function(e,n){null===e?(r.parseData(n),t&&t()):(r.loadSucceeded=!1,r.loadMessage=e,t&&t())})},c.prototype.parseData=function(e){return"SceneInfo"!==e.header.fileType?(this.loadSucceeded=!1,void(this.loadMessage="don't know how to handle file type: "+e.header.fileType)):(this.faceScreenMeshName=e.content.faceScreenMeshName,this.faceScreenWidth=e.content.faceScreenInternalBounds[0],this.faceScreenHeight=e.content.faceScreenInternalBounds[1],void(this.loadSucceeded=!0))},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/geometry-info/src/SceneInfo.js","/release_modules/geometry-info/src")},{_process:5,buffer:1,"ifr-core/src/FileTools":61}],55:[function(require,t,exports){(function(r,n,o,i,a,s,l,h,u){!function(r,n){"object"==typeof exports?t.exports=n():"function"==typeof e&&e.amd?e(n):r.IPv6=n(r)}(this,function(e){function t(e){var t=e.toLowerCase(),r=t.split(":"),n=r.length,o=8;""===r[0]&&""===r[1]&&""===r[2]?(r.shift(),r.shift()):""===r[0]&&""===r[1]?r.shift():""===r[n-1]&&""===r[n-2]&&r.pop(),n=r.length,-1!==r[n-1].indexOf(".")&&(o=7);var i;for(i=0;n>i&&""!==r[i];i++);if(o>i){for(r.splice(i,1,"0000");r.length<o;)r.splice(i,0,"0000");n=r.length}for(var a,s=0;o>s;s++){a=r[s].split("");for(var l=0;3>l&&("0"===a[0]&&a.length>1);l++)a.splice(0,1);r[s]=a.join("")}var h=-1,u=0,c=0,f=-1,d=!1;for(s=0;o>s;s++)d?"0"===r[s]?c+=1:(d=!1,c>u&&(h=f,u=c)):"0"===r[s]&&(d=!0,f=s,c=1);c>u&&(h=f,u=c),u>1&&r.splice(h,u,""),n=r.length;var p="";for(""===r[0]&&(p=":"),s=0;n>s&&(p+=r[s],s!==n-1);s++)p+=":";return""===r[n-1]&&(p+=":"),p}function r(){return e.IPv6===this&&(e.IPv6=n),this}var n=e&&e.IPv6;return{best:t,noConflict:r}})}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-core/node_modules/URIjs/src/IPv6.js","/release_modules/ifr-core/node_modules/URIjs/src")},{_process:5,buffer:1}],56:[function(require,t,exports){(function(r,n,o,i,a,s,l,h,u){!function(r,n){"object"==typeof exports?t.exports=n():"function"==typeof e&&e.amd?e(n):r.SecondLevelDomains=n(r)}(this,function(e){var t=e&&e.SecondLevelDomains,r={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ","do":" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ","in":" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",
kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch "},has:function(e){var t=e.lastIndexOf(".");if(0>=t||t>=e.length-1)return!1;var n=e.lastIndexOf(".",t-1);if(0>=n||n>=t-1)return!1;var o=r.list[e.slice(t+1)];return o?o.indexOf(" "+e.slice(n+1,t)+" ")>=0:!1},is:function(e){var t=e.lastIndexOf(".");if(0>=t||t>=e.length-1)return!1;var n=e.lastIndexOf(".",t-1);if(n>=0)return!1;var o=r.list[e.slice(t+1)];return o?o.indexOf(" "+e.slice(0,t)+" ")>=0:!1},get:function(e){var t=e.lastIndexOf(".");if(0>=t||t>=e.length-1)return null;var n=e.lastIndexOf(".",t-1);if(0>=n||n>=t-1)return null;var o=r.list[e.slice(t+1)];return o?o.indexOf(" "+e.slice(n+1,t)+" ")<0?null:e.slice(n+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return r})}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-core/node_modules/URIjs/src/SecondLevelDomains.js","/release_modules/ifr-core/node_modules/URIjs/src")},{_process:5,buffer:1}],57:[function(require,t,exports){(function(r,n,o,i,a,s,l,h,u){!function(r,n){"object"==typeof exports?t.exports=n(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"==typeof e&&e.amd?e(["./punycode","./IPv6","./SecondLevelDomains"],n):r.URI=n(r.punycode,r.IPv6,r.SecondLevelDomains,r)}(this,function(e,t,r,n){function o(e,t){if(!(this instanceof o))return new o(e,t);if(void 0===e){if(arguments.length)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}return this.href(e),void 0!==t?this.absoluteTo(t):this}function i(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function a(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function s(e){return"Array"===a(e)}function l(e,t){var r,n,o={};if(s(t))for(r=0,n=t.length;n>r;r++)o[t[r]]=!0;else o[t]=!0;for(r=0,n=e.length;n>r;r++)void 0!==o[e[r]]&&(e.splice(r,1),n--,r--);return e}function h(e,t){var r,n;if(s(t)){for(r=0,n=t.length;n>r;r++)if(!h(e,t[r]))return!1;return!0}var o=a(t);for(r=0,n=e.length;n>r;r++)if("RegExp"===o){if("string"==typeof e[r]&&e[r].match(t))return!0}else if(e[r]===t)return!0;return!1}function u(e,t){if(!s(e)||!s(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var r=0,n=e.length;n>r;r++)if(e[r]!==t[r])return!1;return!0}function c(e){return escape(e)}function f(e){return encodeURIComponent(e).replace(/[!'()*]/g,c).replace(/\*/g,"%2A")}function d(e){return function(t,r){return void 0===t?this._parts[e]||"":(this._parts[e]=t||null,this.build(!r),this)}}function p(e,t){return function(r,n){return void 0===r?this._parts[e]||"":(null!==r&&(r+="",r.charAt(0)===t&&(r=r.substring(1))),this._parts[e]=r,this.build(!n),this)}}var m=n&&n.URI;o.version="1.15.0";var g=o.prototype,y=Object.prototype.hasOwnProperty;o._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,duplicateQueryParameters:o.duplicateQueryParameters,escapeQuerySpace:o.escapeQuerySpace}},o.duplicateQueryParameters=!1,o.escapeQuerySpace=!0,o.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,o.idn_expression=/[^a-z0-9\.-]/i,o.punycode_expression=/(xn--)/i,o.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,o.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))/gi,o.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\xab\xbb\u201c\u201d\u201e\u2018\u2019]+$/},o.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},o.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/,o.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},o.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return o.domAttributes[t]}},o.encode=f,o.decode=decodeURIComponent,o.iso8859=function(){o.encode=escape,o.decode=unescape},o.unicode=function(){o.encode=f,o.decode=decodeURIComponent},o.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},o.encodeQuery=function(e,t){var r=o.encode(e+"");return void 0===t&&(t=o.escapeQuerySpace),t?r.replace(/%20/g,"+"):r},o.decodeQuery=function(e,t){e+="",void 0===t&&(t=o.escapeQuerySpace);try{return o.decode(t?e.replace(/\+/g,"%20"):e)}catch(r){return e}};var v,_={encode:"encode",decode:"decode"},b=function(e,t){return function(r){try{return o[t](r+"").replace(o.characters[e][t].expression,function(r){return o.characters[e][t].map[r]})}catch(n){return r}}};for(v in _)o[v+"PathSegment"]=b("pathname",_[v]),o[v+"UrnPathSegment"]=b("urnpath",_[v]);var w=function(e,t,r){return function(n){var i;i=r?function(e){return o[t](o[r](e))}:o[t];for(var a=(n+"").split(e),s=0,l=a.length;l>s;s++)a[s]=i(a[s]);return a.join(e)}};o.decodePath=w("/","decodePathSegment"),o.decodeUrnPath=w(":","decodeUrnPathSegment"),o.recodePath=w("/","encodePathSegment","decode"),o.recodeUrnPath=w(":","encodeUrnPathSegment","decode"),o.encodeReserved=b("reserved","encode"),o.parse=function(e,t){var r;return t||(t={}),r=e.indexOf("#"),r>-1&&(t.fragment=e.substring(r+1)||null,e=e.substring(0,r)),r=e.indexOf("?"),r>-1&&(t.query=e.substring(r+1)||null,e=e.substring(0,r)),"//"===e.substring(0,2)?(t.protocol=null,e=e.substring(2),e=o.parseAuthority(e,t)):(r=e.indexOf(":"),r>-1&&(t.protocol=e.substring(0,r)||null,t.protocol&&!t.protocol.match(o.protocol_expression)?t.protocol=void 0:"//"===e.substring(r+1,r+3)?(e=e.substring(r+3),e=o.parseAuthority(e,t)):(e=e.substring(r+1),t.urn=!0))),t.path=e,t},o.parseHost=function(e,t){var r,n,o=e.indexOf("/");if(-1===o&&(o=e.length),"["===e.charAt(0))r=e.indexOf("]"),t.hostname=e.substring(1,r)||null,t.port=e.substring(r+2,o)||null,"/"===t.port&&(t.port=null);else{var i=e.indexOf(":"),a=e.indexOf("/"),s=e.indexOf(":",i+1);-1!==s&&(-1===a||a>s)?(t.hostname=e.substring(0,o)||null,t.port=null):(n=e.substring(0,o).split(":"),t.hostname=n[0]||null,t.port=n[1]||null)}return t.hostname&&"/"!==e.substring(o).charAt(0)&&(o++,e="/"+e),e.substring(o)||"/"},o.parseAuthority=function(e,t){return e=o.parseUserinfo(e,t),o.parseHost(e,t)},o.parseUserinfo=function(e,t){var r,n=e.indexOf("/"),i=e.lastIndexOf("@",n>-1?n:e.length-1);return i>-1&&(-1===n||n>i)?(r=e.substring(0,i).split(":"),t.username=r[0]?o.decode(r[0]):null,r.shift(),t.password=r[0]?o.decode(r.join(":")):null,e=e.substring(i+1)):(t.username=null,t.password=null),e},o.parseQuery=function(e,t){if(!e)return{};if(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!e)return{};for(var r,n,i,a={},s=e.split("&"),l=s.length,h=0;l>h;h++)r=s[h].split("="),n=o.decodeQuery(r.shift(),t),i=r.length?o.decodeQuery(r.join("="),t):null,y.call(a,n)?("string"==typeof a[n]&&(a[n]=[a[n]]),a[n].push(i)):a[n]=i;return a},o.build=function(e){var t="";return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//"),t+=o.buildAuthority(e)||"","string"==typeof e.path&&("/"!==e.path.charAt(0)&&"string"==typeof e.hostname&&(t+="/"),t+=e.path),"string"==typeof e.query&&e.query&&(t+="?"+e.query),"string"==typeof e.fragment&&e.fragment&&(t+="#"+e.fragment),t},o.buildHost=function(e){var t="";return e.hostname?(t+=o.ip6_expression.test(e.hostname)?"["+e.hostname+"]":e.hostname,e.port&&(t+=":"+e.port),t):""},o.buildAuthority=function(e){return o.buildUserinfo(e)+o.buildHost(e)},o.buildUserinfo=function(e){var t="";return e.username&&(t+=o.encode(e.username),e.password&&(t+=":"+o.encode(e.password)),t+="@"),t},o.buildQuery=function(e,t,r){var n,i,a,l,h="";for(i in e)if(y.call(e,i)&&i)if(s(e[i]))for(n={},a=0,l=e[i].length;l>a;a++)void 0!==e[i][a]&&void 0===n[e[i][a]+""]&&(h+="&"+o.buildQueryParameter(i,e[i][a],r),t!==!0&&(n[e[i][a]+""]=!0));else void 0!==e[i]&&(h+="&"+o.buildQueryParameter(i,e[i],r));return h.substring(1)},o.buildQueryParameter=function(e,t,r){return o.encodeQuery(e,r)+(null!==t?"="+o.encodeQuery(t,r):"")},o.addQuery=function(e,t,r){if("object"==typeof t)for(var n in t)y.call(t,n)&&o.addQuery(e,n,t[n]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===e[t])return void(e[t]=r);"string"==typeof e[t]&&(e[t]=[e[t]]),s(r)||(r=[r]),e[t]=(e[t]||[]).concat(r)}},o.removeQuery=function(e,t,r){var n,i,a;if(s(t))for(n=0,i=t.length;i>n;n++)e[t[n]]=void 0;else if("object"==typeof t)for(a in t)y.call(t,a)&&o.removeQuery(e,a,t[a]);else{if("string"!=typeof t)throw new TypeError("URI.removeQuery() accepts an object, string as the first parameter");void 0!==r?e[t]===r?e[t]=void 0:s(e[t])&&(e[t]=l(e[t],r)):e[t]=void 0}},o.hasQuery=function(e,t,r,n){if("object"==typeof t){for(var i in t)if(y.call(t,i)&&!o.hasQuery(e,i,t[i]))return!1;return!0}if("string"!=typeof t)throw new TypeError("URI.hasQuery() accepts an object, string as the name parameter");switch(a(r)){case"Undefined":return t in e;case"Boolean":var l=Boolean(s(e[t])?e[t].length:e[t]);return r===l;case"Function":return!!r(e[t],t,e);case"Array":if(!s(e[t]))return!1;var c=n?h:u;return c(e[t],r);case"RegExp":return s(e[t])?n?h(e[t],r):!1:Boolean(e[t]&&e[t].match(r));case"Number":r=String(r);case"String":return s(e[t])?n?h(e[t],r):!1:e[t]===r;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},o.commonPath=function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r)){r--;break}return 1>r?e.charAt(0)===t.charAt(0)&&"/"===e.charAt(0)?"/":"":(("/"!==e.charAt(r)||"/"!==t.charAt(r))&&(r=e.substring(0,r).lastIndexOf("/")),e.substring(0,r+1))},o.withinString=function(e,t,r){r||(r={});var n=r.start||o.findUri.start,i=r.end||o.findUri.end,a=r.trim||o.findUri.trim,s=/[a-z0-9-]=["']?$/i;for(n.lastIndex=0;;){var l=n.exec(e);if(!l)break;var h=l.index;if(r.ignoreHtml){var u=e.slice(Math.max(h-3,0),h);if(u&&s.test(u))continue}var c=h+e.slice(h).search(i),f=e.slice(h,c).replace(a,"");if(!r.ignore||!r.ignore.test(f)){c=h+f.length;var d=t(f,h,c,e);e=e.slice(0,h)+d+e.slice(c),n.lastIndex=h+d.length}}return n.lastIndex=0,e},o.ensureValidHostname=function(t){if(t.match(o.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-] and Punycode.js is not available');if(e.toASCII(t).match(o.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]')}},o.noConflict=function(e){if(e){var t={URI:this.noConflict()};return n.URITemplate&&"function"==typeof n.URITemplate.noConflict&&(t.URITemplate=n.URITemplate.noConflict()),n.IPv6&&"function"==typeof n.IPv6.noConflict&&(t.IPv6=n.IPv6.noConflict()),n.SecondLevelDomains&&"function"==typeof n.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=n.SecondLevelDomains.noConflict()),t}return n.URI===this&&(n.URI=m),this},g.build=function(e){return e===!0?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=o.build(this._parts),this._deferred_build=!1),this},g.clone=function(){return new o(this)},g.valueOf=g.toString=function(){return this.build(!1)._string},g.protocol=d("protocol"),g.username=d("username"),g.password=d("password"),g.hostname=d("hostname"),g.port=d("port"),g.query=p("query","?"),g.fragment=p("fragment","#"),g.search=function(e,t){var r=this.query(e,t);return"string"==typeof r&&r.length?"?"+r:r},g.hash=function(e,t){var r=this.fragment(e,t);return"string"==typeof r&&r.length?"#"+r:r},g.pathname=function(e,t){if(void 0===e||e===!0){var r=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?o.decodeUrnPath:o.decodePath)(r):r}return this._parts.urn?this._parts.path=e?o.recodeUrnPath(e):"":this._parts.path=e?o.recodePath(e):"/",this.build(!t),this},g.path=g.pathname,g.href=function(e,t){var r;if(void 0===e)return this.toString();this._string="",this._parts=o._parts();var n=e instanceof o,i="object"==typeof e&&(e.hostname||e.path||e.pathname);if(e.nodeName){var a=o.getDomAttribute(e);e=e[a]||"",i=!1}if(!n&&i&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=o.parse(String(e),this._parts);else{if(!n&&!i)throw new TypeError("invalid input");var s=n?e._parts:e;for(r in s)y.call(this._parts,r)&&(this._parts[r]=s[r])}return this.build(!t),this},g.is=function(e){var t=!1,n=!1,i=!1,a=!1,s=!1,l=!1,h=!1,u=!this._parts.urn;switch(this._parts.hostname&&(u=!1,n=o.ip4_expression.test(this._parts.hostname),i=o.ip6_expression.test(this._parts.hostname),t=n||i,a=!t,s=a&&r&&r.has(this._parts.hostname),l=a&&o.idn_expression.test(this._parts.hostname),h=a&&o.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return u;case"absolute":return!u;case"domain":case"name":return a;case"sld":return s;case"ip":return t;case"ip4":case"ipv4":case"inet4":return n;case"ip6":case"ipv6":case"inet6":return i;case"idn":return l;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return h}return null};var x=g.protocol,T=g.port,M=g.hostname;g.protocol=function(e,t){if(void 0!==e&&e&&(e=e.replace(/:(\/\/)?$/,""),!e.match(o.protocol_expression)))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return x.call(this,e,t)},g.scheme=g.protocol,g.port=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e&&(0===e&&(e=null),e&&(e+="",":"===e.charAt(0)&&(e=e.substring(1)),e.match(/[^0-9]/))))throw new TypeError('Port "'+e+'" contains characters other than [0-9]');return T.call(this,e,t)},g.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var r={};o.parseHost(e,r),e=r.hostname}return M.call(this,e,t)},g.host=function(e,t){return this._parts.urn?void 0===e?"":this:void 0===e?this._parts.hostname?o.buildHost(this._parts):"":(o.parseHost(e,this._parts),this.build(!t),this)},g.authority=function(e,t){return this._parts.urn?void 0===e?"":this:void 0===e?this._parts.hostname?o.buildAuthority(this._parts):"":(o.parseAuthority(e,this._parts),this.build(!t),this)},g.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.username)return"";var r=o.buildUserinfo(this._parts);return r.substring(0,r.length-1)}return"@"!==e[e.length-1]&&(e+="@"),o.parseUserinfo(e,this._parts),this.build(!t),this},g.resource=function(e,t){var r;return void 0===e?this.path()+this.search()+this.hash():(r=o.parse(e),this._parts.path=r.path,this._parts.query=r.query,this._parts.fragment=r.fragment,this.build(!t),this)},g.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var n=this._parts.hostname.length-this.domain().length,a=this._parts.hostname.substring(0,n),s=new RegExp("^"+i(a));return e&&"."!==e.charAt(e.length-1)&&(e+="."),e&&o.ensureValidHostname(e),this._parts.hostname=this._parts.hostname.replace(s,e),this.build(!t),this},g.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(r&&r.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(t).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}if(!e)throw new TypeError("cannot set domain empty");if(o.ensureValidHostname(e),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var a=new RegExp(i(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(a,e)}return this.build(!t),this},g.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.lastIndexOf("."),o=this._parts.hostname.substring(n+1);return t!==!0&&r&&r.list[o.toLowerCase()]?r.get(this._parts.hostname)||o:o}var a;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!r||!r.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');a=new RegExp(i(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(a,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");a=new RegExp(i(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(a,e)}return this.build(!t),this},g.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||e===!0){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return e?o.decodePath(n):n}var a=this._parts.path.length-this.filename().length,s=this._parts.path.substring(0,a),l=new RegExp("^"+i(s));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=o.recodePath(e),this._parts.path=this._parts.path.replace(l,e),this.build(!t),this},g.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||e===!0){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return e?o.decodePathSegment(n):n}var a=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(a=!0);var s=new RegExp(i(this.filename())+"$");return e=o.recodePath(e),this._parts.path=this._parts.path.replace(s,e),a?this.normalizePath(t):this.build(!t),this},g.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||e===!0){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,a=this.filename(),s=a.lastIndexOf(".");return-1===s?"":(r=a.substring(s+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",e?o.decodePathSegment(n):n)}"."===e.charAt(0)&&(e=e.substring(1));var l,h=this.suffix();if(h)l=e?new RegExp(i(h)+"$"):new RegExp(i("."+h)+"$");else{if(!e)return this;this._parts.path+="."+o.recodePath(e)}return l&&(e=o.recodePath(e),this._parts.path=this._parts.path.replace(l,e)),this.build(!t),this},g.segment=function(e,t,r){var n=this._parts.urn?":":"/",o=this.path(),i="/"===o.substring(0,1),a=o.split(n);if(void 0!==e&&"number"!=typeof e&&(r=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(i&&a.shift(),0>e&&(e=Math.max(a.length+e,0)),void 0===t)return void 0===e?a:a[e];if(null===e||void 0===a[e])if(s(t)){a=[];for(var l=0,h=t.length;h>l;l++)(t[l].length||a.length&&a[a.length-1].length)&&(a.length&&!a[a.length-1].length&&a.pop(),a.push(t[l]))}else(t||"string"==typeof t)&&(""===a[a.length-1]?a[a.length-1]=t:a.push(t));else t?a[e]=t:a.splice(e,1);return i&&a.unshift(""),this.path(a.join(n),r)},g.segmentCoded=function(e,t,r){var n,i,a;if("number"!=typeof e&&(r=t,t=e,e=void 0),void 0===t){if(n=this.segment(e,t,r),s(n))for(i=0,a=n.length;a>i;i++)n[i]=o.decode(n[i]);else n=void 0!==n?o.decode(n):void 0;return n}if(s(t))for(i=0,a=t.length;a>i;i++)t[i]=o.decode(t[i]);else t="string"==typeof t||t instanceof String?o.encode(t):t;return this.segment(e,t,r)};var S=g.query;return g.query=function(e,t){if(e===!0)return o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var r=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace),n=e.call(this,r);return this._parts.query=o.buildQuery(n||r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=o.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):S.call(this,e,t)},g.setQuery=function(e,t,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof e||e instanceof String)n[e]=void 0!==t?t:null;else{if("object"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var i in e)y.call(e,i)&&(n[i]=e[i])}return this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},g.addQuery=function(e,t,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.addQuery(n,e,void 0===t?null:t),this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},g.removeQuery=function(e,t,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.removeQuery(n,e,t),this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},g.hasQuery=function(e,t,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.hasQuery(n,e,t,r)},g.setSearch=g.setQuery,g.addSearch=g.addQuery,g.removeSearch=g.removeQuery,g.hasSearch=g.hasQuery,g.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},g.normalizeProtocol=function(e){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},g.normalizeHostname=function(r){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!r)),this},g.normalizePort=function(e){return"string"==typeof this._parts.protocol&&this._parts.port===o.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},g.normalizePath=function(e){var t=this._parts.path;if(!t)return this;if(this._parts.urn)return this._parts.path=o.recodeUrnPath(this._parts.path),this.build(!e),this;if("/"===this._parts.path)return this;var r,n,i,a="";for("/"!==t.charAt(0)&&(r=!0,t="/"+t),t=t.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),r&&(a=t.substring(1).match(/^(\.\.\/)+/)||"",a&&(a=a[0]));;){if(n=t.indexOf("/.."),-1===n)break;0!==n?(i=t.substring(0,n).lastIndexOf("/"),-1===i&&(i=n),t=t.substring(0,i)+t.substring(n+3)):t=t.substring(3)}return r&&this.is("relative")&&(t=a+t.substring(1)),t=o.recodePath(t),this._parts.path=t,this.build(!e),this},g.normalizePathname=g.normalizePath,g.normalizeQuery=function(e){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(o.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!e)),this},g.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},g.normalizeSearch=g.normalizeQuery,g.normalizeHash=g.normalizeFragment,g.iso8859=function(){var e=o.encode,t=o.decode;o.encode=escape,o.decode=decodeURIComponent;try{this.normalize()}finally{o.encode=e,o.decode=t}return this},g.unicode=function(){var e=o.encode,t=o.decode;o.encode=f,o.decode=unescape;try{this.normalize()}finally{o.encode=e,o.decode=t}return this},g.readable=function(){var t=this.clone();t.username("").password("").normalize();var r="";if(t._parts.protocol&&(r+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&e?(r+=e.toUnicode(t._parts.hostname),t._parts.port&&(r+=":"+t._parts.port)):r+=t.host()),t._parts.hostname&&t._parts.path&&"/"!==t._parts.path.charAt(0)&&(r+="/"),r+=t.path(!0),t._parts.query){for(var n="",i=0,a=t._parts.query.split("&"),s=a.length;s>i;i++){var l=(a[i]||"").split("=");n+="&"+o.decodeQuery(l[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==l[1]&&(n+="="+o.decodeQuery(l[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}r+="?"+n.substring(1)}return r+=o.decodeQuery(t.hash(),!0)},g.absoluteTo=function(e){var t,r,n,i=this.clone(),a=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e instanceof o||(e=new o(e)),i._parts.protocol||(i._parts.protocol=e._parts.protocol),this._parts.hostname)return i;for(r=0;n=a[r];r++)i._parts[n]=e._parts[n];return i._parts.path?".."===i._parts.path.substring(-2)&&(i._parts.path+="/"):(i._parts.path=e._parts.path,i._parts.query||(i._parts.query=e._parts.query)),"/"!==i.path().charAt(0)&&(t=e.directory(),t=t?t:0===e.path().indexOf("/")?"/":"",i._parts.path=(t?t+"/":"")+i._parts.path,i.normalizePath()),i.build(),i},g.relativeTo=function(e){var t,r,n,i,a,s=this.clone().normalize();if(s._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new o(e).normalize(),t=s._parts,r=e._parts,i=s.path(),a=e.path(),"/"!==i.charAt(0))throw new Error("URI is already relative");if("/"!==a.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(t.protocol===r.protocol&&(t.protocol=null),t.username!==r.username||t.password!==r.password)return s.build();if(null!==t.protocol||null!==t.username||null!==t.password)return s.build();if(t.hostname!==r.hostname||t.port!==r.port)return s.build();
if(t.hostname=null,t.port=null,i===a)return t.path="",s.build();if(n=o.commonPath(s.path(),e.path()),!n)return s.build();var l=r.path.substring(n.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=l+t.path.substring(n.length),s.build()},g.equals=function(e){var t,r,n,i=this.clone(),a=new o(e),l={},h={},c={};if(i.normalize(),a.normalize(),i.toString()===a.toString())return!0;if(t=i.query(),r=a.query(),i.query(""),a.query(""),i.toString()!==a.toString())return!1;if(t.length!==r.length)return!1;l=o.parseQuery(t,this._parts.escapeQuerySpace),h=o.parseQuery(r,this._parts.escapeQuerySpace);for(n in l)if(y.call(l,n)){if(s(l[n])){if(!u(l[n],h[n]))return!1}else if(l[n]!==h[n])return!1;c[n]=!0}for(n in h)if(y.call(h,n)&&!c[n])return!1;return!0},g.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},g.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},o})}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-core/node_modules/URIjs/src/URI.js","/release_modules/ifr-core/node_modules/URIjs/src")},{"./IPv6":55,"./SecondLevelDomains":56,"./punycode":58,_process:5,buffer:1}],58:[function(require,t,exports){(function(r,n,o,i,a,s,l,h,u){!function(r){function o(e){throw RangeError(R[e])}function i(e,t){for(var r=e.length;r--;)e[r]=t(e[r]);return e}function a(e,t){return i(e.split(D),t).join(".")}function s(e){for(var t,r,n=[],o=0,i=e.length;i>o;)t=e.charCodeAt(o++),t>=55296&&56319>=t&&i>o?(r=e.charCodeAt(o++),56320==(64512&r)?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),o--)):n.push(t);return n}function l(e){return i(e,function(e){var t="";return e>65535&&(e-=65536,t+=N(e>>>10&1023|55296),e=56320|1023&e),t+=N(e)}).join("")}function h(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:x}function u(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function c(e,t,r){var n=0;for(e=r?k(e/C):e>>1,e+=k(e/t);e>O*M>>1;n+=x)e=k(e/O);return k(n+(O+1)*e/(e+S))}function f(e){var t,r,n,i,a,s,u,f,d,p,m=[],g=e.length,y=0,v=A,_=E;for(r=e.lastIndexOf(L),0>r&&(r=0),n=0;r>n;++n)e.charCodeAt(n)>=128&&o("not-basic"),m.push(e.charCodeAt(n));for(i=r>0?r+1:0;g>i;){for(a=y,s=1,u=x;i>=g&&o("invalid-input"),f=h(e.charCodeAt(i++)),(f>=x||f>k((w-y)/s))&&o("overflow"),y+=f*s,d=_>=u?T:u>=_+M?M:u-_,!(d>f);u+=x)p=x-d,s>k(w/p)&&o("overflow"),s*=p;t=m.length+1,_=c(y-a,t,0==a),k(y/t)>w-v&&o("overflow"),v+=k(y/t),y%=t,m.splice(y++,0,v)}return l(m)}function d(e){var t,r,n,i,a,l,h,f,d,p,m,g,y,v,_,b=[];for(e=s(e),g=e.length,t=A,r=0,a=E,l=0;g>l;++l)m=e[l],128>m&&b.push(N(m));for(n=i=b.length,i&&b.push(L);g>n;){for(h=w,l=0;g>l;++l)m=e[l],m>=t&&h>m&&(h=m);for(y=n+1,h-t>k((w-r)/y)&&o("overflow"),r+=(h-t)*y,t=h,l=0;g>l;++l)if(m=e[l],t>m&&++r>w&&o("overflow"),m==t){for(f=r,d=x;p=a>=d?T:d>=a+M?M:d-a,!(p>f);d+=x)_=f-p,v=x-p,b.push(N(u(p+_%v,0))),f=k(_/v);b.push(N(u(f,0))),a=c(r,y,n==i),r=0,++n}++r,++t}return b.join("")}function p(e){return a(e,function(e){return P.test(e)?f(e.slice(4).toLowerCase()):e})}function m(e){return a(e,function(e){return F.test(e)?"xn--"+d(e):e})}var g="object"==typeof exports&&exports,y="object"==typeof t&&t&&t.exports==g&&t,v="object"==typeof n&&n;(v.global===v||v.window===v)&&(r=v);var _,b,w=2147483647,x=36,T=1,M=26,S=38,C=700,E=72,A=128,L="-",P=/^xn--/,F=/[^ -~]/,D=/\x2E|\u3002|\uFF0E|\uFF61/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=x-T,k=Math.floor,N=String.fromCharCode;if(_={version:"1.2.3",ucs2:{decode:s,encode:l},decode:f,encode:d,toASCII:m,toUnicode:p},"function"==typeof e&&"object"==typeof e.amd&&e.amd)e(function(){return _});else if(g&&!g.nodeType)if(y)y.exports=_;else for(b in _)_.hasOwnProperty(b)&&(g[b]=_[b]);else r.punycode=_}(this)}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-core/node_modules/URIjs/src/punycode.js","/release_modules/ifr-core/node_modules/URIjs/src")},{_process:5,buffer:1}],59:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./SLog"),c=null,f={},d=!1;f.init=function(e){null===c?c=e:u.warn("Warning, Bakery initialized multiple times!")};var p=function(e){return c},m=function(){d||(u.info("Bakery values requested by Bakery never initialized"),d=!0)};f.getFloat=function(e,t,r,n,o){var i=p(o);return null!==i?i.getFloat(e,t,r,n,o):(m(),n)},f.getBoolean=function(e,t,r){var n=p(r);return null!==n?n.getBoolean(e,t,r):(m(),t)},f.makeButton=function(e,t,r){var n=p(r);null!==n?n.makeButton(e,t,r):m()},f.showText=function(e,t,r){var n=p(r);null!==n?n.showText(e,t,r):m()},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-core/src/Bakery.js","/release_modules/node_modules/ifr-core/src")},{"./SLog":62,_process:5,buffer:1}],60:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./Time"),c={};c.currentTime=function(){var e,t;"undefined"!=typeof window&&"undefined"!=typeof window.performance?(e=window.performance.now(),t=window.performance.timing.navigationStart):(e=0,t=Date.now());var r=Math.floor(e),n=e-r,o=r+t,i=Math.floor(o/1e3);o-=1e3*i;var a=o+n;return a=Math.round(1e3*a),1e6===a&&(a=0,i+=1),new u(i,a)},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/ifr-core/src/Clock.js","/release_modules/animation-utilities/node_modules/ifr-core/src")},{"./Time":63,_process:5,buffer:1}],61:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("URIjs"),c={};c.loadText=function(e,t){var r=new u(e);if(r.addQuery(""+(new Date).getTime()),"undefined"!=typeof XMLHttpRequest){var n=new XMLHttpRequest;n.open("GET",r.toString(),!0),n.addEventListener("load",function(e){t&&(200===n.status||0===n.status?t(null,n.responseText):t("FileTools: XMLHttpRequest failed with status: "+n.statusText,null))},!1),n.addEventListener("error",function(e){t&&t("FileTools: XMLHttpRequest error event with status: "+n.statusText,null)},!1),n.send(null)}else if("http"===r.protocol()){var o="http";o=require(o);var i={host:r.hostname(),port:r.port()?parseInt(r.port()):80,path:r.resource(),method:"GET"},a=o.request(i,function(e){200===e.statusCode?(e.setEncoding("utf8"),e.on("data",function(e){t&&t(null,e)})):t&&t("FileTools: http request failed with status code: "+e.statusCode,null)});a.on("error",function(e){t&&t(e.message,null)}),a.end()}else if("file"===r.protocol()||""===r.protocol()){var s="fs";s=require(s),s.readFile(r.path(),"utf8",t)}else t&&t("FileTools: no XMLHttpRequest available, and no fallback support for protocol: "+r.protocol(),null)},c.loadJSON=function(e,t){c.loadText(e,function(e,r){if(t)if(e)t(e,null);else{var n=null,o=!1,i="";try{n=JSON.parse(r)}catch(a){o=!0,i=a}o?t("FileTools: JSON parse error: "+i,null):t(null,n)}})},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-core/src/FileTools.js","/release_modules/node_modules/ifr-core/src")},{URIjs:57,_process:5,buffer:1}],62:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t){},c=function(e,t){console.log(e+" : "+t)},f=u,d={ERROR:c},p=function(e,t){d.hasOwnProperty(e)?d[e](e,t):f(e,t)};p.BaseChannels={INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},p.info=function(e){p(p.BaseChannels.INFO,e)},p.warn=function(e){p(p.BaseChannels.WARN,e)},p.error=function(e){p(p.BaseChannels.ERROR,e)},p.setDefaultDelegate=function(e){f=null==e?u:e},p.setChannelDelegate=function(e,t){null==t?d[e]=u:d[e]=t},p.clearChannelDelegate=function(e){if(null==e)for(var t=Object.keys(d),r=0;r<t.length;r++)delete d[t[r]];else delete d[e]},p.setPrintChannels=function(e){if(p.setDefaultDelegate(null),p.clearChannelDelegate(null),null!=e)for(var t=0;t<e.length;t++)p.setChannelDelegate(e[t],c)},p.setPrintAll=function(){p.setDefaultDelegate(c),p.clearChannelDelegate(null)},p.setPrintNone=function(){p.setDefaultDelegate(u),p.clearChannelDelegate(null)},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/ifr-core/src/SLog.js","/release_modules/animation-utilities/node_modules/ifr-core/src")},{_process:5,buffer:1}],63:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t){this._timestamp=[e,t];var r=function(e){var t=e[0]===+e[0]&&e[1]===+e[1]&&e[0]>=0&&e[1]>=0&&e[1]<1e6&&e[0]===Math.round(e[0])&&e[1]===Math.round(e[1]);return t||((e[0]!==+e[0]||e[1]!==+e[1])&&console.log("InvalidTime: At least one element of timestamp is not a number"),(e[0]<0||e[1]<0)&&console.log("InvalidTime: At least one element of timestamp is negative"),e[1]>=1e6&&console.log("InvalidTime: Microseconds portion is over one second"),(e[0]!==Math.round(e[0])||e[1]!==Math.round(e[1]))&&console.log("InvalidTime: At least one element is not an integer")),t};if(!r(this._timestamp))throw new Error("new Time() given invalid time values: (INVALID "+this._timestamp[0]+", "+this._timestamp[1]+")")};u.createFromTimestamp=function(e){if(!Array.isArray(e))throw new Error("new Time() given invalid Timestamp: (INVALID: not array)");return new u(e[0],e[1])},u.prototype.subtract=function(e){var t,r,n;this.isGreaterOrEqual(e)?(t=this._timestamp,r=e._timestamp,n=1):(t=e._timestamp,r=this._timestamp,n=-1);var o=t[1]-r[1],i=t[0]-r[0];0>o&&(o+=1e6,i-=1);var a=n*(i+o/1e6);return Math.round(1e6*a)/1e6},u.prototype.add=function(e){var t,r;if(0>e){var n=Math.floor(-e),o=-e-n;if(t=this._timestamp[0]-n,r=this._timestamp[1]-1e6*o,0>r&&(r+=1e6,t-=1),0>t)throw console.log("Error, "+this.toString()+"+"+e+" is a negative timestamp! (not allowed)"),new Error("Error, "+this.toString()+"+"+e+" is a negative timestamp! (not allowed)")}else{var i=Math.floor(e),a=e-i;t=this._timestamp[0]+i,r=this._timestamp[1]+1e6*a,r>=1e6&&(r-=1e6,t+=1)}return r=Math.round(r),new u(t,r)},u.prototype.isGreater=function(e){return this._timestamp[0]>e._timestamp[0]?!0:this._timestamp[0]===e._timestamp[0]?this._timestamp[1]>e._timestamp[1]:!1},u.prototype.isGreaterOrEqual=function(e){return this._timestamp[0]>e._timestamp[0]?!0:this._timestamp[0]===e._timestamp[0]?this._timestamp[1]>=e._timestamp[1]:!1},u.prototype.equals=function(e){return this._timestamp[0]===e._timestamp[0]&&this._timestamp[1]===e._timestamp[1]},u.prototype.toString=function(){for(var e=""+this._timestamp[1];e.length<6;)e="0"+e;return this._timestamp[0]+"."+e},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/ifr-core/src/Time.js","/release_modules/animation-utilities/node_modules/ifr-core/src")},{_process:5,buffer:1}],64:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t){var r=setInterval(e,t);this.stop=function(){clearInterval(r)}},c="var timerHandles = {};\nself.onmessage = function(event)\n{\n var command = event.data.command;\n var callbackID = event.data.callbackID;\n var callbackInterval = event.data.callbackInterval;\n var timerHandle = null;\n\n if (command === 'start')\n {\n timerHandle = setInterval(function()\n {\n self.postMessage({callbackID: callbackID});\n }, callbackInterval);\n timerHandles[callbackID] = timerHandle;\n }\n else if (command === 'stop')\n {\n timerHandle = timerHandles[callbackID];\n if (timerHandle !== undefined && timerHandle !== null)\n {\n clearInterval(timerHandle);\n }\n }\n};\n",f=function(){var e=new Blob([c],{type:"text/javascript"}),t=URL.createObjectURL(e),r=new Worker(t),n={},o=0;this.createTimer=function(e,t){var i=o;n[i]=e,o++,r.postMessage({command:"start",callbackID:i,callbackInterval:t});var a={};return a.stop=function(){n[i]=null,r.postMessage({command:"stop",callbackID:i})},a},r.onmessage=function(e){var t=e.data.callbackID,r=n[t];r&&r()}},d=null,p={};p.setInterval=function(e,t){return 1e3>t&&"undefined"!=typeof Worker?(null===d&&(d=new f),d.createTimer(e,t)):new u(e,t)},p.clearInterval=function(e){e&&e.stop()},p.WebWorkerTimerFactory=f,e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-core/src/TimerTools.js","/release_modules/node_modules/ifr-core/src")},{_process:5,buffer:1}],65:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c=function(e,t,r){this.name=e||"",this.position=t||new u.Vector3,this.orientation=r||new u.Quaternion};c.prototype.setFromJson=function(e){return this.name=e.name,this.position.copy(c.vector3FromJson(e.xyzTranslation)),this.orientation.copy(c.quaternionFromJson(e.wxyzRotation)),this},c.prototype.toMatrix4=function(){return(new u.Matrix4).compose(this.position,this.orientation,new u.Vector3(1,1,1))},c.vector3FromJson=function(e){return(new u.Vector3).fromArray(e)},c.quaternionFromJson=function(e){var t=e,r=new u.Quaternion(t[1],t[2],t[3],t[0]);return r.inverse(),r},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-geometry/src/BasicFrame.js","/release_modules/ifr-geometry/src")},{_process:5,buffer:1,three:40}],66:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("three"),function(){this.name=null,this.skeletonFrameName=null,this.mesh=null,this.boneFrameNames=null,this.bones=null});e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-geometry/src/BasicMesh.js","/release_modules/ifr-geometry/src")},{_process:5,buffer:1,three:40}],67:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c={};c.convertDirectionLocalToWorld=function(){var e=null;return function(t,r,n){return null===e&&(e=new u.Quaternion),(void 0===n||null===n)&&(n=new u.Vector3),t.getWorldQuaternion(e),n.copy(r).applyQuaternion(e)}}(),c.findOrthogonal=function(e,t){(void 0===t||null===t)&&(t=new u.Vector3);var r=Math.abs(e.x),n=Math.abs(e.y),o=Math.abs(e.z);return r>=n&&r>=o?t.set(e.y,-e.x,0):t.set(0,e.z,-e.y),t},c.quatFromAxisAngle=function(){var e=null;return function(t,r,n){return null===e&&(e=new u.Vector3),null===n&&(n=new u.Quaternion),e.copy(t).normalize(),n.setFromAxisAngle(e,r)}}(),c.toString=function(e){return"("+e.x+", "+e.y+", "+e.z+")"},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-geometry/src/ExtraMath.js","/release_modules/node_modules/ifr-geometry/src")},{_process:5,buffer:1,three:40}],68:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./ModelLoader"),c=require("./SkeletonLoader"),f=require("three"),d=function(){this.modelUrl=null,this.skeletonUrl=null,this.success=!1,this.message="",this.modelResult=null,this.skeletonResult=null,this.modelRoot=null},p=function(e,t){this.modelLoader=e||new u,this.skeletonLoader=t||new c,this._result=null};p.prototype.getResult=function(){return this._result},p.prototype.load=function(e,t,r,n){if(r){var o=this;this.skeletonLoader.load(r,function(){var i=o.skeletonLoader.getResult();if(i.success)o._loadModel(e,t,i,n);else{var a=new d;a.modelUrl=t,a.skeletonUrl=r,a.skeletonResult=i,a.success=!1,a.message="skeleton load failed with message: "+i.message,o._result=a,n()}})}else this._loadModel(e,t,null,n)},p.prototype._loadModel=function(e,t,r,n){var o=this;this.modelLoader.load(t,function(){o._result=new d,o._result.modelUrl=t,o._result.skeletonUrl=r?r.url:null,o._result.skeletonResult=r;var i=o.modelLoader.getResult();if(o._result.modelResult=i,!i.success)return o._result.success=!1,o._result.message="model load failed with message: "+i.message,void n();var a=new f.Object3D;a.name=e||"";var s;if(r){var l=r.skeletonRoot;for(a.add(l),s=0;s<i.meshes.length;s++){var h=i.meshes[s];if(h.bones){for(var u=0;u<h.bones.length;u++){var c=l.getObjectByName(h.boneFrameNames[u],!0);if(!c)return o._result.success=!1,o._result.message="unable to find skeleton frame: "+h.boneFrameNames[u]+" required to attach bone "+u+" of mesh: "+h.name,void n();c.add(h.bones[u])}h.mesh.material.skinning=!0,a.add(h.mesh)}else{if(!h.skeletonFrameName)return o._result.success=!1,o._result.message="unable to attach mesh: "+h.name+" - no skeleton frame or skinning data specified",void n();var p=l.getObjectByName(h.skeletonFrameName,!0);if(!p)return o._result.success=!1,o._result.message="unable to find skeleton frame: "+h.skeletonFrameName+" required to attach mesh: "+h.name,void n();p.add(h.mesh)}}}else for(s=0;s<i.meshes.length;s++)a.add(i.meshes[s].mesh);o._result.success=!0,o._result.modelRoot=a,n()})},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-geometry/src/loaders/ArticulatedModelLoader.js","/release_modules/node_modules/ifr-geometry/src/loaders")},{"./ModelLoader":70,"./SkeletonLoader":71,_process:5,buffer:1,three:40}],69:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c=function(){this.url=null,this.success=!1,this.image=null},f=function(){this._loader=new u.ImageLoader,this._result=null};f.prototype.getResult=function(){return this._result},f.prototype.loadImage=function(e,t){var r=this;this._loader.load(e,function(n){var o=new c;o.url=e,o.success=!0,o.image=n,r._result=o,t&&t()},void 0,function(n){var o=new c;o.url=e,o.success=!1,r._result=o,t&&t()})},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-geometry/src/loaders/CachedImageLoader.js","/release_modules/node_modules/ifr-geometry/src/loaders")},{_process:5,buffer:1,three:40}],70:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("../BasicMesh"),c=require("../BasicFrame"),f=require("ifr-core/src/FileTools"),d=require("three"),p=function(){this.url=null,this.success=!1,this.message="",this.meshes=null},m=function(e){this.defaultMaterial=e,this.defaultMaterial||(this.defaultMaterial=new d.MeshPhongMaterial),this.baseTextureURL=null,this._result=null};m.prototype.getResult=function(){return this._result},m.prototype.load=function(e,t){var r=this;f.loadJSON(e,function(n,o){if(null===n)r.parseData(o,e),t&&t();else{var i=new p;i.url=e,i.success=!1,i.message=n,r._result=i,t&&t()}})},m.prototype.parseData=function(e,t){if(this._result=new p,this._result.url=t,"Meshes"!==e.header.fileType)return this._result.success=!1,void(this._result.message="don't know how to handle file type: "+e.header.fileType);var r=t.substring(0,t.lastIndexOf("/")+1);this._result.meshes=[];for(var n=0;n<e.content.meshes.length;n++){var o=e.content.meshes[n],i=new u;i.name=o.name,i.skeletonFrameName=o.skeletonFrameName;var a=new d.BufferGeometry,s=new Float32Array(o.position);if(a.addAttribute("position",new d.BufferAttribute(s,3)),o.normal){var l=new Float32Array(o.normal);a.addAttribute("normal",new d.BufferAttribute(l,3))}if(o.textureCoordinates){var h=new Float32Array(o.textureCoordinates);a.addAttribute("uv",new d.BufferAttribute(h,2))}if(o.triangles){var f=new Uint32Array(o.triangles);a.addAttribute("index",new d.BufferAttribute(f,3))}if(o.color){for(var m=new Float32Array(o.color.length/4*3),g=0;g<o.color.length/4;g++)m[3*g]=o.color[4*g],m[3*g+1]=o.color[4*g+1],m[3*g+2]=o.color[4*g+2];a.addAttribute("color",new d.BufferAttribute(m,3))}var y=this.defaultMaterial.clone();if(y.vertexColors=o.color?d.VertexColors:d.NoColors,o.material){var v=o.material;if(v.ambient&&(y.ambient=new d.Color(v.ambient[0],v.ambient[1],v.ambient[2])),v.diffuse&&(y.color=new d.Color(v.diffuse[0],v.diffuse[1],v.diffuse[2])),v.specular&&(y.specular=new d.Color(v.specular[0],v.specular[1],v.specular[2])),v.emissive&&(y.emissive=new d.Color(v.emissive[0],v.emissive[1],v.emissive[2])),v.shininess&&(y.shininess=v.shininess),v.texture){var _=this.baseTextureURL?this.baseTextureURL+v.texture:r+v.texture,b=d.ImageUtils.loadTexture(_);b.minFilter=d.LinearFilter,y.map=b}}if(o.skin){i.mesh=new d.SkinnedMesh(a,y),i.mesh.name=o.name;var w=o.skin;i.boneFrameNames=w.skeletonTotalInfluences;var x=i.boneFrameNames.length,T=(new c).setFromJson(w.skinBindFrame),M=T.toMatrix4();i.bones=[];for(var S=[],C=0;x>C;C++){var E=(new c).setFromJson(w.skinBindInverses[C]);S.push(E.toMatrix4());var A=new d.Bone(i.mesh);i.bones.push(A)}var L=new d.Skeleton(i.bones,S,!1);i.mesh.bindMode="detached",i.mesh.bind(L,M);var P=s.length/3,F=new Float32Array(w.skeletonWeightsByVertex),D=new Float32Array(w.skeletonInfluencesByVertex);if(F.length!==4*P)return this._result.success=!1,void(this._result.message="expected "+4*P+" skeleton weights for mesh "+i.name+", but got: "+F.length);if(D.length!==4*P)return this._result.success=!1,void(this._result.message="expected "+4*P+" skeleton influences for mesh "+i.name+", but got: "+D.length);a.addAttribute("skinWeight",new d.BufferAttribute(F,4)),a.addAttribute("skinIndex",new d.BufferAttribute(D,4))}else i.mesh=new d.Mesh(a,y),i.mesh.name=o.name;this._result.meshes.push(i)}this._result.success=!0},e.exports=m}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-geometry/src/loaders/ModelLoader.js","/release_modules/ifr-geometry/src/loaders")},{"../BasicFrame":65,"../BasicMesh":66,_process:5,buffer:1,"ifr-core/src/FileTools":61,three:40}],71:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("../BasicFrame"),c=require("ifr-core/src/FileTools"),f=require("three"),d=function(){this.url=null,this.success=!1,this.message="",this.skeletonRoot=null},p=function(){this._result=null};p.prototype.getResult=function(){return this._result},p.prototype.load=function(e,t){var r=this;c.loadJSON(e,function(n,o){if(null===n)r.parseData(o,e),t&&t();else{var i=new d;i.url=e,i.success=!1,i.message=n,r._result=i,t&&t()}})},p.prototype.parseData=function(e,t){return this._result=new d,this._result.url=t,"Skeleton"!==e.header.fileType?(this._result.success=!1,void(this._result.message="don't know how to handle file type: "+e.header.fileType)):(this._result.skeletonRoot=this._parseSkeleton(e.content),void(this._result.success=!0))},p.prototype._parseSkeleton=function(e){var t=new f.Object3D,r=(new u).setFromJson(e);if(t.name=r.name,t.position.copy(r.position),t.quaternion.copy(r.orientation),e.children)for(var n=0;n<e.children.length;n++)t.add(this._parseSkeleton(e.children[n]));return t},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-geometry/src/loaders/SkeletonLoader.js","/release_modules/node_modules/ifr-geometry/src/loaders")},{"../BasicFrame":65,_process:5,buffer:1,"ifr-core/src/FileTools":61,three:40}],72:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/SLog"),c="ACCEL_PLANNER",f=function(e,t,r,n,o,i,a){this._initialVelocity=e,this._targetVelocity=t,this._acceleration=r,this._accelerateTime=n,this._decelerateTime=o,this._totalTime=i,this._distance=a};f.prototype.displacementAtTime=function(e){var t=0;if(e>0){var r=Math.min(e,this._accelerateTime);t+=(this._initialVelocity+this._acceleration*r/2)*r,e-=r}if(e>0){var n=Math.min(e,this._decelerateTime);t+=(this._initialVelocity+this._acceleration*this._accelerateTime-this._acceleration*n/2)*n,e-=n}return e>0&&(t+=this._targetVelocity*e),t},f.prototype.velocityAtTime=function(e){var t=this._initialVelocity;if(e>0){var r=Math.min(e,this._accelerateTime);t+=this._acceleration*r,e-=r}if(e>0){var n=Math.min(e,this._decelerateTime);t-=this._acceleration*n,e-=n}return t},f.prototype.isConsistent=function(){if(isNaN(this._accelerateTime)||isNaN(this._decelerateTime))return u(c,"Plan has NaN times! accelerationTime:"+this._accelerateTime+" decelerationTime:"+this._decelerateTime),!1;if(!isFinite(this._accelerateTime)||!isFinite(this._decelerateTime))return u(c,"Plan has non-finite times! accelerationTime:"+this._accelerateTime+" decelerationTime:"+this._decelerateTime),!1;if(isNaN(this._acceleration))return u(c,"Plan has NaN acceleration!: "+this._acceleration),!1;if(!isFinite(this._acceleration))return u(c,"Plan has non-finite acceleration!: "+this._acceleration),!1;var e=this._accelerateTime+this._decelerateTime,t=this._distance+this._targetVelocity*e,r=(this._initialVelocity+this._acceleration*this._accelerateTime/2)*this._accelerateTime+(this._initialVelocity+this._acceleration*this._accelerateTime-this._acceleration*this._decelerateTime/2)*this._decelerateTime,n=this._initialVelocity+this._acceleration*this._accelerateTime-this._acceleration*this._decelerateTime;return this._accelerateTime<0||this._decelerateTime<0?(u(c,"Plan has negative times! accelerationTime:"+this._accelerateTime+" decelerationTime:"+this._decelerateTime),!1):Math.abs(this._accelerateTime+this._decelerateTime-this._totalTime)>1e-7?(u(c,"Plan time segments are not equal to target time! segments:"+(this._accelerateTime+this._decelerateTime)+" target:"+this._totalTime),!1):Math.abs(r-t)>1e-6?(u(c,"Plan has incorrect integral! ourDisplacement:"+r+" pDelta:"+t),!1):Math.abs(n-this._targetVelocity)>1e-7?(u(c,"Plan has incorrect final velocity resultV:"+n+" pDelta:"+this._targetVelocity),!1):!0},f.prototype.getTotalTime=function(){return this._totalTime};var d=function(){};d.prototype.computeWithFixedTime=function(e,t,r,n){if(1e-10>n)return u(c,"Asked for fixed time plan with time of "+n+", returning null"),null;var o,i,a=(t-e)*n/2+r,s=Math.pow((e-t)*n/2-r,2)-Math.pow(n,2)*(t*e/2-Math.pow(e,2)/4-Math.pow(t,2)/4);if(0>s){if(!(s>-1e-10))return u(c,"Inconsistent CWFT Plan for vCurrent:"+e+", vTarget:"+t+", pDelta:"+r+", totalTime:"+n+", tsqrt:"+s),null;s=0}var l=Math.sqrt(s),h=Math.pow(n,2)/2,d=1;.5*n*(e-t)>r&&(d=-1);var p=(a+d*l)/h;if(0===p?(o=n,i=0):Math.abs(p)<1e-10?(p=0,o=n,i=0):(o=n/2+(t-e)/(2*p),i=n/2+(e-t)/(2*p)),0>o){if(!(o>-1e-10))return u(c,"Inconsistent CWFTaT1 Plan for vCurrent:"+e+", vTarget:"+t+", pDelta:"+r+", totalTime:"+n+", aChoiceT1:"+o),null;o=0}if(0>i){if(!(i>-1e-10))return u(c,"Inconsistent CWFTaT2 Plan for vCurrent:"+e+", vTarget:"+t+", pDelta:"+r+", totalTime:"+n+", aChoiceT2:"+i),null;i=0}var m=new f(e,t,p,o,i,n,r);return m},d.prototype.computeWithFixedAccel=function(e,t,r,n){if(1e-10>n)return u(c,"Asked for fixed acceleration plan with acceleration of "+n+", returning null"),null;var o=n,i=1;(e-t)*Math.abs(t-e)/(2*n)>r&&(o=-n,i=-1);var a=2*t-2*e,s=2*Math.pow(e-t,2)+4*o*r;if(0>s){if(!(s>-1e-10))return u(c,"Inconsistent CWFA Plan for vCurrent:"+e+", vTarget:"+t+", pDelta:"+r+", acceleration:"+n+", tsqrt:"+s),null;s=0}var l=Math.sqrt(s),h=2*o,d=(a+i*l)/h,p=e/o+d-t/o;if(0>d){if(!(d>-1e-10))return u(c,"Inconsistent CWFAt1 Plan for vCurrent:"+e+", vTarget:"+t+", pDelta:"+r+", acceleration:"+n+", t1Choice:"+d),null;d=0}if(0>p){if(!(p>-1e-10))return u(c,"Inconsistent CWFAt2 Plan for vCurrent:"+e+", vTarget:"+t+", pDelta:"+r+", acceleration:"+n+", t2Choice:"+p),null;p=0}return new f(e,t,o,d,p,d+p,r)},d.prototype.computeWithZeroAccel=function(e){var t=new f(e,e,0,1,0,1,0);return t},d.prototype.computeWithMaxAccel=function(e,t,r,n,o){if(1e-6>n)return this.computeWithZeroAccel(e);var i=this.computeWithFixedTime(e,t,r,o);if(Math.abs(i._acceleration)<=n)return i;var a=this.computeWithFixedAccel(e,t,r,n);return a},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/base/AccelPlanner.js","/release_modules/ifr-motion/src/base")},{_process:5,buffer:1,"ifr-core/src/SLog":62}],73:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./Motion"),c=require("./MotionEvent"),f=function(e,t){var r={};r.motion=e,t=t||[],r.events=t,r.speed=1,r.inPoint=0,r.outPoint=e.getDuration(),this.getMotion=function(){return r.motion},this.getEventCount=function(){return r.events.length},this.getEvent=function(e){return r.events[e]},this.getEvents=function(){return r.events},this.setClipBounds=function(e,t){null!==e&&void 0!==e?r.inPoint=e:r.inPoint=0,null!==t&&void 0!==t?r.outPoint=t:r.outPoint=this.getSourceMotionDuration()},this.getSourceMotionDuration=function(){return e.getDuration()},this.getDuration=function(){var e=r.outPoint-r.inPoint;return e/r.speed},this.getSpeed=function(){return r.speed},this.setSpeed=function(n){if(0>=n)throw new Error("invalid speed: "+n);if(n!==r.speed)if(r.speed=n,1===r.speed)r.motion=e,r.events=t;else{for(var o=new u(e.getName()),i=Object.keys(e.getTracks()),a=0;a<i.length;a++){for(var s=e.getTracks()[i[a]].clone(),l=s.getMotionData().timestampList,h=0;h<l.length;h++)l[h]=l[h]/n;s.length=s.length/n,o.addTrack(s)}r.motion=o;for(var f=[],d=0;d<t.length;d++){var p=t[d].getTimestamp()/n,m=t[d].getEventName(),g=t[d].getPayload();f.push(new c(p,m,g))}r.events=f}}};e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/base/AnnotatedMotion.js","/release_modules/node_modules/ifr-motion/src/base")},{"./Motion":79,"./MotionEvent":80,_process:5,buffer:1}],74:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./CyclicMath"),c=function(e){this._dofName=e};c.prototype.closestEquivalentRotation=function(e,t){return u.closestEquivalentRotation(t.get(this._dofName,0),e.get(this._dofName,0))},c.prototype.getDOFName=function(){return this._dofName},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/base/CyclicDOFTargetSelector.js","/release_modules/ifr-motion/src/base")},{"./CyclicMath":75,_process:5,buffer:1}],75:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(){};u.closestEquivalentRotation=function(e,t){
var r=t-e,n=Math.floor((r+Math.PI)/(2*Math.PI)),o=e+n*Math.PI*2;return o},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/base/CyclicMath.js","/release_modules/ifr-motion/src/base")},{_process:5,buffer:1}],76:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./CyclicDOFTargetSelector"),c=(require("../dofs/DOFInfo"),function(e,t){var r,n={},o={},i=e.getDOFNames(),a={},s=function(e,t){var r=a[e],n=a[t];return null!=r&&null!=n?r-n:0};for(r=0;r<i.length;r++){var l=0,h=e.getModelControlGroup().getControlForDOF(i[r]);if(null!=h&&("ROTATION"===h.getControlType()||"TRANSLATION"===h.getControlType())){var c=h.getTransformName(),f=e.getTransform(c);if(null!=f)for(;null!=f.parent;)l++,f=f.parent}a[i[r]]=l}for(r=0;r<i.length;r++){var d=i[r];e.getModelControlGroup().getDOFInfo(d).isCyclic()&&(t&&t.hasOwnProperty(d)?n[d]=t[d]:n[d]=new u(d),o[d]=new u(d))}this.sortDOFsByDepth=function(e){return e.sort(s)},this.getGlobalTargetSelector=function(e){return n[e]},this.getLocalTargetSelector=function(e){return o[e]},this.refineToGloballyClosestTargetPose=function(e,t,r){null==r&&(r=e.getDOFNames());for(var n=this.sortDOFsByDepth(r.slice(0)),o=0;o<n.length;o++){var i=this.getGlobalTargetSelector(n[o]);if(i){var a=i.closestEquivalentRotation(e,t);t.set(n[o],a,0)}}},this.refineToLocallyClosestTargetPose=function(e,t,r){null==r&&(r=e.getDOFNames());for(var n=0;n<r.length;n++){var o=this.getLocalTargetSelector(r[n]);if(o){var i=o.closestEquivalentRotation(e,t);t.set(r[n],i,0)}}}});e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/base/DOFGlobalAlignment.js","/release_modules/node_modules/ifr-motion/src/base")},{"../dofs/DOFInfo":87,"./CyclicDOFTargetSelector":74,_process:5,buffer:1}],77:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./Interpolators"),c=require("../dofs/TextureControl"),f=function(){this.interpolatorSet={}};f.prototype.addInterpolator=function(e,t){this.interpolatorSet[e]=t},f.prototype.getInterpolator=function(e){var t=this.interpolatorSet[e];return void 0!==t?t:null},f.prototype.addModelControlGroup=function(e){for(var t=e.getControlList(),r=0;r<t.length;r++)for(var n=t[r],o=n.getDOFNames(),i=0;i<o.length;i++)n instanceof c?this.addInterpolator(o[i],new u.DOFSampleInterpolator(new u.StepInterpolator)):this.addInterpolator(o[i],new u.DOFSampleInterpolator(new u.LinearInterpolator))},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/base/InterpolatorSet.js","/release_modules/node_modules/ifr-motion/src/base")},{"../dofs/TextureControl":93,"./Interpolators":78,_process:5,buffer:1}],78:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u={};u.BaseInterpolator=function(){},u.BaseInterpolator.prototype.interpolate=function(e,t,r){return e},u.StepInterpolator=function(e){u.BaseInterpolator.call(this),this.alphaThreshold=void 0!==e?e:1},u.StepInterpolator.prototype=Object.create(u.BaseInterpolator.prototype),u.StepInterpolator.prototype.constructor=u.StepInterpolator,u.StepInterpolator.prototype.interpolate=function(e,t,r){return r<this.alphaThreshold?e:t},u.LinearInterpolator=function(){u.BaseInterpolator.call(this)},u.LinearInterpolator.prototype=Object.create(u.BaseInterpolator.prototype),u.LinearInterpolator.prototype.constructor=u.LinearInterpolator,u.LinearInterpolator.prototype.interpolate=function(e,t,r){return(1-r)*e+r*t},u.DOFSampleInterpolator=function(e,t){u.BaseInterpolator.call(this),this.positionInterpolator=e,this.derivativeInterpolator=void 0!==t?t:new u.LinearInterpolator},u.DOFSampleInterpolator.prototype=Object.create(u.BaseInterpolator.prototype),u.DOFSampleInterpolator.prototype.constructor=u.DOFSampleInterpolator,u.DOFSampleInterpolator.prototype.interpolate=function(e,t,r){e instanceof Array||(e=[e]),t instanceof Array||(t=[t]);for(var n=[],o=Math.min(e.length,t.length),i=0;o>i;i++)0===i?n.push(this.positionInterpolator.interpolate(e[i],t[i],r)):n.push(this.derivativeInterpolator.interpolate(e[i],t[i],r));return n},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/base/Interpolators.js","/release_modules/ifr-motion/src/base")},{_process:5,buffer:1}],79:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./Pose"),c=require("./MotionTrack"),f=require("./TimestampedBuffer"),d=function(e){this.name=e,this.length=0,this.tracks={}};d.prototype.getName=function(){return this.name},d.prototype.getDuration=function(){return this.length},d.prototype.getTracks=function(){return this.tracks},d.prototype.addTrack=function(e){this.tracks[e.getName()]=e,e.getLength()>this.length&&(this.length=e.getLength())},d.prototype.getPoseAtTime=function(e,t,r){if((void 0===r||null===r)&&(r=new u(this.getName()+" pose sample",Object.keys(this.tracks))),"number"!=typeof e)throw new Error("getPoseAtTime expects time as a number value in seconds");for(var n=r.getDOFNames(),o=0;o<n.length;o++){var i=n[o];if(this.tracks.hasOwnProperty(i)){var a=t.getInterpolator(i);if(null===a)throw new Error("no interpolator provided for DOF name: "+i);var s=this.tracks[i].getDataAtTime(e,a);null!==s&&r.set(i,s)}}return r},d.createFromPose=function(e,t,r,n){var o=new d(e);null==n&&(n=t.getDOFNames());for(var i=0;i<n.length;i++){var a=n[i],s=t.get(a),l=new f;l.append(0,s),o.addTrack(new c(a,l,r))}return o},d.createFromPoses=function(e,t,r,n,o){var i=new d(e);null==o&&(o=t[0].getDOFNames());for(var a=0;a<o.length;a++){for(var s=o[a],l=new f,h=0;h<r.length;h++){var u=t[h].get(s);l.append(r[h],u)}i.addTrack(new c(s,l,n))}return i},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/base/Motion.js","/release_modules/node_modules/ifr-motion/src/base")},{"./MotionTrack":81,"./Pose":83,"./TimestampedBuffer":85,_process:5,buffer:1}],80:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t,r){this.getTimestamp=function(){return e},this.getEventName=function(){return t},this.getPayload=function(){return r}};e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/base/MotionEvent.js","/release_modules/ifr-motion/src/base")},{_process:5,buffer:1}],81:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t,r){this.name=e,this.motionData=t,this.length=r};u.prototype.clone=function(){return new u(this.name,this.motionData.clone(),this.length)},u.prototype.getName=function(){return this.name},u.prototype.getLength=function(){return this.length},u.prototype.getMotionData=function(){return this.motionData},u.prototype.getDataAtTime=function(e,t){if(0===this.motionData.size())return null;var r=this.motionData.getLeftIndexForTime(e),n=r+1;r=Math.max(r,0),n=Math.min(n,this.motionData.size()-1);var o,i=this.motionData.getTimestamp(r),a=this.motionData.getTimestamp(n);o=i===a?0:(e-i)/(a-i);var s=this.motionData.getData(r),l=this.motionData.getData(n);return t.interpolate(s,l,o)},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/base/MotionTrack.js","/release_modules/node_modules/ifr-motion/src/base")},{_process:5,buffer:1}],82:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){require("./Motion"),require("./MotionTrack");var u={};u.valuesExist=function(e,t){var r,n=e.getTracks();r=null==t?Object.keys(n):t;for(var o=0;o<r.length;o++){var i=n[r[o]].getMotionData();if(null==i)throw new Error("Error, motion ("+e.getName()+") has null/undefined track ("+r[o]+").");for(var a=0;a<i.size();a++){var s=i.getData(a);if(null==s||Array.isArray(s)&&s.length<1)throw new Error("Error, motion ("+e.getName()+") has null/undefined/empty keys ("+r[o]+").")}}},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/base/MotionValidator.js","/release_modules/node_modules/ifr-motion/src/base")},{"./Motion":79,"./MotionTrack":81,_process:5,buffer:1}],83:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t){if(this.name=e,this.dofNames=void 0!==t?t:null,this.dofVals={},null!==this.dofNames)for(var r=0;r<this.dofNames.length;r++)this.dofVals[this.dofNames[r]]=[]};u.prototype.setPose=function(e){null===this.dofNames&&(this.dofNames=e.dofNames.slice(0));for(var t=0;t<this.dofNames.length;t++){var r=this.dofNames[t];e.dofVals.hasOwnProperty(r)&&(this.dofVals[r]=e.dofVals[r].slice(0))}},u.prototype.getPose=function(e){e.setPose(this)},u.prototype.set=function(e,t,r){if(this.dofVals.hasOwnProperty(e))if(void 0!==r)this.dofVals[e][r]=t;else{if(!(t instanceof Array))throw new Error("expected DOF value to be position-derivative array, but got: "+t);this.dofVals[e]=t}},u.prototype.get=function(e,t){if(this.dofVals.hasOwnProperty(e)){var r;return r=void 0!==t?this.dofVals[e][t]:this.dofVals[e],void 0!==r?r:null}return null},u.prototype.getName=function(){return this.name},u.prototype.getDOFNames=function(){return this.dofNames},u.prototype.clear=function(){if(null!==this.dofNames)for(var e=0;e<this.dofNames.length;e++)this.dofVals[this.dofNames[e]]=[]},u.prototype.getCopy=function(e){var t=new u(null!=e?e:this.name);return t.setPose(this),t},u.computeBinary=function(e,t,r,n,o){var i,a;if(null==o||null==o.dofNames)for(null==o&&(o=new u(e.getName()+" x "+t.getName())),o.dofNames=[],i=0;i<e.dofNames.length;i++)a=this.dofNames[i],t.dofVals.hasOwnProperty(a)&&(o.dofNames.push(a),o.set(a,r(a,e.dofVals[a],t.dofVals[a])));else for(i=0;i<o.dofNames.length;i++)a=o.dofNames[i],e.dofVals.hasOwnProperty(a)&&t.dofVals.hasOwnProperty(a)?o.set(a,r(a,e.dofVals[a],t.dofVals[a])):n&&o.set(a,[]);return o},u.computeUnary=function(e,t,r,n){var o,i;for((null==n||null==n.dofNames)&&(null==n?n=new u(e.getName(),e.dofNames):n.setPose(e)),o=0;o<n.dofNames.length;o++)i=n.dofNames[o],e.dofVals.hasOwnProperty(i)?n.set(i,t(i,e.dofVals[i])):r&&n.set(i,[]);return n},u._subtractOperator=function(e,t,r){var n=[],o=t.length>0?t[0]:0,i=r.length>0?r[0]:0;n[0]=o-i;for(var a=1;a<t.length&&a<r.length;)n.push(t[a]-r[a]),a++;return n},u._advanceByVelocityOperator=function(e,t,r){var n=[];if(t.length>0){null==r&&(r=1);var o=0;t.length>=2&&(o=t[1]),n[0]=o*r+t[0];for(var i=1;i<t.length;i++)n.push(t[i])}return n},u.subtract=function(e,t,r,n){return u.computeBinary(e,t,u._subtractOperator,r,n)},u.advanceByTime=function(e,t,r,n){return null==n?u.computeUnary(e,u._advanceByVelocityOperator,t,r):u.computeUnary(e,function(e,t){return u._advanceByVelocityOperator(e,t,n)},t,r)},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/base/Pose.js","/release_modules/node_modules/ifr-motion/src/base")},{_process:5,buffer:1}],84:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./CyclicDOFTargetSelector"),c=require("./CyclicMath"),f=function(e,t,r){u.call(this,e),this._alignedParents=t,this._parentDirections=r};f.prototype=Object.create(u.prototype),f.prototype.constructor=f,f.prototype.closestEquivalentRotation=function(e,t){for(var r=0,n=0;n<this._alignedParents.length;n++){var o=e.get(this._alignedParents[n],0),i=t.get(this._alignedParents[n],0),a=i-o;r+=this._parentDirections[n]*a}var s=t.get(this.getDOFName(),0),l=e.get(this.getDOFName(),0),h=l-r;return c.closestEquivalentRotation(s,h)},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/base/SeriesAlignedAxesTargetSelector.js","/release_modules/node_modules/ifr-motion/src/base")},{"./CyclicDOFTargetSelector":74,"./CyclicMath":75,_process:5,buffer:1}],85:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(){this.timestampList=[],this.dataList=[],this._lastReturnedLeftIndex=0};u.prototype.clone=function(){var e=new u;return e.timestampList=this.timestampList.slice(0),e.dataList=this.dataList.slice(0),e._lastReturnedLeftIndex=this._lastReturnedLeftIndex,e},u.prototype.size=function(){return this.timestampList.length},u.prototype.getStartTime=function(){return this.timestampList[0]},u.prototype.getEndTime=function(){return this.timestampList[this.timestampList.length-1]},u.prototype.append=function(e,t){if(this.size()>0&&e<this.getEndTime())throw new Error("new timestamp "+e+" is out of sequence with previous timestamp "+this.getEndTime());this.timestampList.push(e),this.dataList.push(t)},u.prototype.getTimestamp=function(e){return this.timestampList[e]},u.prototype.getData=function(e){return this.dataList[e]},u.prototype.remove=function(e){return this.timestampList.splice(e,1),this.dataList.splice(e,1)[0]},u.prototype.getDataForTime=function(e){var t=this.getLeftIndexForTime(e);return t>-1?this.dataList[t]:null},u.prototype.getDataForRange=function(e,t,r,n){for(var o=null,i=this.getLeftIndexForTime(e),a=this.getLeftIndexForTime(r)+1,s=i;a>=s;s++)if(s>=0&&s<this.size()){var l=this.getTimestamp(s),h=l>e||l===e&&t,u=r>l||l===r&&n;h&&u&&(null===o&&(o=[]),o.push(this.getData(s)))}return o},u.prototype.insert=function(e,t){var r=this.getLeftIndexForTime(e);if(r>=0&&this.timestampList[r]===e)this.dataList[r]=t;else{var n=r+1;this.timestampList.splice(n,0,e),this.dataList.splice(n,0,t)}},u.prototype.getLeftIndexForTime=function(e){if(0===this.size()||e<this.getStartTime())return-1;if(e>=this.getEndTime())return this.size()-1;if(this._lastReturnedLeftIndex<this.size()-1&&this.timestampList[this._lastReturnedLeftIndex]<=e&&this.timestampList[this._lastReturnedLeftIndex+1]>e)return this._lastReturnedLeftIndex;if(this._lastReturnedLeftIndex++,this._lastReturnedLeftIndex<this.size()-1&&this.timestampList[this._lastReturnedLeftIndex]<=e&&this.timestampList[this._lastReturnedLeftIndex+1]>e)return this._lastReturnedLeftIndex;for(var t,r=0,n=this.size()-1;n!==r+1;)t=Math.floor((r+n)/2),this.timestampList[t]<=e?r=t:n=t;return this._lastReturnedLeftIndex=r,r},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/base/TimestampedBuffer.js","/release_modules/node_modules/ifr-motion/src/base")},{_process:5,buffer:1}],86:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){function u(e,t,r){for(var n=0;n<this._meshes.length;n++)this._billboardMode?this._meshes[n].material.emissive.setRGB(e,t,r):this._meshes[n].material.color.setRGB(e,t,r)}var c=require("./ModelControl"),f=require("./ModelControlFactory"),d=require("three"),p=function(){c.call(this),this._meshNames=null,this._ledNames=null,this._meshes=[],this._billboardMode=!0};p.prototype=Object.create(c.prototype),p.prototype.constructor=p,p.prototype._controlType="COLOR",p.prototype.setFromJson=function(e){c.prototype.setFromJson.call(this,e),this._dofNames.push(e.redDOFName),this._dofNames.push(e.greenDOFName),this._dofNames.push(e.blueDOFName),this._meshNames=e.meshNames,e.ledNames&&(this._ledNames=e.ledNames)},p.prototype.attachToModel=function(e){if(this._meshes.length=0,null==e)return!1;for(var t=0;t<this._meshNames.length;t++){if(!e.hasOwnProperty(this._meshNames[t]))return!1;this._meshes.push(e[this._meshNames[t]])}return!0},p.prototype.setBillboardMode=function(e){if(e!==this._billboardMode){if(this._meshes.length>0){var t=new d.Color(0,0,0),r=new d.Color(0,0,0);e?r.copy(this._meshes[0].material.color):t.copy(this._meshes[0].material.emissive);for(var n=0;n<this._meshes.length;n++)this._meshes[n].material.emissive.copy(r),this._meshes[n].material.color.copy(t)}this._billboardMode=e}},p.prototype.updateFromDOFValues=function(e){var t,r=[];for(t=0;t<this._dofNames.length;t++){if(!e.hasOwnProperty(this._dofNames[t]))return!1;r.push(e[this._dofNames[t]])}return this._meshes.length>0?(u.call(this,r[0],r[1],r[2]),!0):!1},p.prototype.updateFromPose=function(e){var t,r=[];for(t=0;t<this._dofNames.length;t++){var n=e.get(this._dofNames[t],0);if(null==n)return!1;r.push(n)}return this._meshes.length>0?(u.call(this,r[0],r[1],r[2]),!0):!1},p.prototype.getCopy=function(e){return e||(e=new p),c.prototype.getCopy.call(this,e),e._meshNames=this._meshNames?this._meshNames.slice(0):null,e._ledNames=this._ledNames?this._ledNames.slice(0):null,e},p.Factory=function(){},p.Factory.prototype=Object.create(f.prototype),p.Factory.prototype.constructor=p.Factory,p.Factory.prototype._controlType=p.prototype._controlType,p.Factory.prototype._controlConstructor=p,e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/dofs/ColorControl.js","/release_modules/ifr-motion/src/dofs")},{"./ModelControl":89,"./ModelControlFactory":90,_process:5,buffer:1,three:40}],87:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t){this._dofName=e,this._controlType=null,this._isMetric=!1,this._isCyclic=!1,this._min=void 0,this._max=void 0,this._limitData={},this.setFromModelControl(t)};u.prototype.setFromModelControl=function(e){if(this._controlType=e.getControlType(),this._isMetric="TEXTURE"!==this._controlType,this._isCyclic="ROTATION"===this._controlType&&e.isCyclic(),"ROTATION"===this._controlType)this._min=this._isCyclic?-Math.PI:e.getMin(),this._max=this._isCyclic?Math.PI:e.getMax();else if("TRANSLATION"===this._controlType){var t=e.getDOFNames().indexOf(this._dofName);t>-1&&(this._min=e._minList[t],this._max=e._maxList[t])}else"COLOR"===this._controlType&&(this._min=0,this._max=1)},u.prototype.getDOFName=function(){return this._dofName},u.prototype.getControlType=function(){return this._controlType},u.prototype.isMetric=function(){return this._isMetric},u.prototype.isCyclic=function(){return this._isCyclic},u.prototype.getMin=function(){return this._min},u.prototype.getMax=function(){return this._max},u.prototype.setLimitData=function(e){for(var t=Object.keys(e),r=0;r<t.length;r++)this._limitData[t[r]]=e[t[r]]},u.prototype.getLimit=function(e){return this._limitData[e]},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/dofs/DOFInfo.js","/release_modules/node_modules/ifr-motion/src/dofs")},{_process:5,buffer:1}],88:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t){this._modelControlGroup=e,this._hierarchyRoot=t,this._modelMap=null};u.prototype.getCopy=function(e,t){var r=this._hierarchyRoot?this._hierarchyRoot.clone():null,n=this._modelControlGroup?this._modelControlGroup.getCopy():null;return n.attachToModelAndPrune(r),new u(n,r)},u.prototype.getPose=function(e){},u.prototype.setFromPose=function(e){this._modelControlGroup.updateFromPose(e)},u.prototype.getDOFNames=function(){return this._modelControlGroup.getDOFNames()},u.prototype.getModelControlGroup=function(){return this._modelControlGroup},u.prototype.getRoot=function(){return this._hierarchyRoot},u.generateTransformMap=function(e){for(var t={},r=[e];r.length>0;){var n=r.shift();if(n.name&&(t[n.name]=n),n.children)for(var o=0;o<n.children.length;o++)r.push(n.children[o])}return t},u.prototype.getModelMap=function(){return this._modelMap||(this._modelMap=u.generateTransformMap(this._hierarchyRoot)),this._modelMap},u.prototype.getTransform=function(e){return this._modelMap||(this._modelMap=u.generateTransformMap(this._hierarchyRoot)),this._modelMap[e]},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/dofs/KinematicGroup.js","/release_modules/node_modules/ifr-motion/src/dofs")},{_process:5,buffer:1}],89:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(){this._controlNames=[],this._dofNames=[]};u.prototype._controlType=null,u.prototype.setFromJson=function(e){e.controlName&&this._controlNames.push(e.controlName)},u.prototype.getControlType=function(){return this._controlType},u.prototype.getControlNames=function(){return this._controlNames},u.prototype.getDOFNames=function(){return this._dofNames},u.prototype.getDescriptiveName=function(){if(0===this._controlNames.length)return null;if(1===this._controlNames.length)return this._controlNames[0];for(var e=this._controlNames[0],t=1;t<this._controlNames.length;t++)e=e+", "+this._controlNames[t];return"MultiControl<"+e+">"},u.prototype.attachToModel=function(e){return!1},u.prototype.attachToControlGroup=function(e){},u.prototype.updateFromDOFValues=function(e){return!1},u.prototype.updateFromPose=function(e){return!1},u.prototype.getCopy=function(e){e||(e=new u),e._controlNames=this._controlNames?this._controlNames.slice(0):null,e._dofNames=this._dofNames?this._dofNames.slice(0):null,e._controlType=this._controlType},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/dofs/ModelControl.js","/release_modules/ifr-motion/src/dofs")},{_process:5,buffer:1}],90:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("./ModelControl"),function(){this._controlType=null,this._controlConstructor=null});u.prototype.getControlType=function(){return this._controlType},u.prototype.constructFromJson=function(e){if(e.controlType!==this._controlType)return console.warn("ModelControlFactory<"+this._controlType+">: don't know how to construct for control type: "+e.controlType),null;var t=new this._controlConstructor;return t.setFromJson(e),t},u.prototype.postProcessControlList=function(e){return e},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/dofs/ModelControlFactory.js","/release_modules/ifr-motion/src/dofs")},{"./ModelControl":89,_process:5,buffer:1}],91:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("./ModelControl"),require("./ModelControlFactory"),require("three"),require("./KinematicGroup")),c=require("./DOFInfo"),f=function(){this._controlList=[],this._dofNames=[],this._dofNameToControlMap={},this._dofInfos={}};f.prototype.setControlList=function(e){var t;for(this._controlList=e,this._dofNames=[],this._dofNameToControlMap={},this._dofInfos={},t=0;t<this._controlList.length;t++)for(var r=this._controlList[t],n=r.getDOFNames(),o=0;o<n.length;o++)this._dofNames.push(n[o]),this._dofNameToControlMap[n[o]]=r,this._dofInfos[n[o]]=new c(n[o],r);for(t=0;t<this._controlList.length;t++)this._controlList[t].attachToControlGroup(this)},f.prototype.getControlList=function(){return this._controlList},f.prototype.getDOFNames=function(){return this._dofNames},f.prototype.getControlForDOF=function(e){return this._dofNameToControlMap[e]},f.prototype.getDOFInfo=function(e){return this._dofInfos[e]},f.prototype.attachToModel=function(e){for(var t=u.generateTransformMap(e),r=!0,n=0;n<this._controlList.length;n++){var o=this._controlList[n].attachToModel(t);o||(r=!1,console.warn("failed to attach model control: "+this._controlList[n].getDescriptiveName()))}return r},f.prototype.attachToModelAndPrune=function(e){var t=u.generateTransformMap(e);this.setControlList(this._controlList.filter(function(e){return e.attachToModel(t)}))},f.prototype.updateFromDOFValues=function(e){for(var t=!0,r=0;r<this._controlList.length;r++){var n=this._controlList[r].updateFromDOFValues(e);n||(t=!1)}return t},f.prototype.updateFromPose=function(e){for(var t=!0,r=0;r<this._controlList.length;r++){var n=this._controlList[r].updateFromPose(e);n||(t=!1)}return t},f.prototype.getPose=function(e){},f.prototype.getCopy=function(){if(null==this._controlList)return new f;for(var e=[this._controlList.length],t=0;t<this._controlList.length;t++)e[t]=this._controlList[t].getCopy(null);var r=new f;return r.setControlList(e),r},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/dofs/ModelControlGroup.js","/release_modules/node_modules/ifr-motion/src/dofs")},{"./DOFInfo":87,"./KinematicGroup":88,"./ModelControl":89,"./ModelControlFactory":90,_process:5,buffer:1,three:40}],92:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){function u(e){var t=(new p.Quaternion).setFromAxisAngle(this._rotationalAxis,e);this._skeletonFrame.quaternion.multiplyQuaternions(this._initialRotation,t)}var c=require("./ModelControl"),f=require("./ModelControlFactory"),d=require("ifr-geometry/src/BasicFrame"),p=require("three"),m=function(){c.call(this),this._skeletonFrameName=null,this._rotationalAxis=new p.Vector3,this._initialRotation=new p.Quaternion,this._min=null,this._max=null,this._isCyclic=!1,this._skeletonFrame=null};m.prototype=Object.create(c.prototype),m.prototype.constructor=m,m.prototype._controlType="ROTATION",m.prototype.setFromJson=function(e){c.prototype.setFromJson.call(this,e),this._dofNames.push(e.dofName),this._skeletonFrameName=e.skeletonFrameName,this._rotationalAxis.copy(d.vector3FromJson(e.xyzRotationAxis)),this._initialRotation.copy(d.quaternionFromJson(e.wxyzQuatInitialRotation)),this._min=e.min,this._max=e.max,this._isCyclic=e.isCyclic|!1},m.prototype.attachToModel=function(e){return this._skeletonFrame=null,null!=e&&e.hasOwnProperty(this._skeletonFrameName)?(this._skeletonFrame=e[this._skeletonFrameName],!0):!1},m.prototype.updateFromDOFValues=function(e){if(this._skeletonFrame&&e.hasOwnProperty(this._dofNames[0])){var t=e[this._dofNames[0]];return u.call(this,t),!0}return!1},m.prototype.updateFromPose=function(e){var t=e.get(this._dofNames[0],0);return this._skeletonFrame&&null!=t?(u.call(this,t),!0):!1},m.prototype.getRotationalAxis=function(e){return null==e&&(e=new p.Vector3),e.copy(this._rotationalAxis)},m.prototype.getInitialRotation=function(e){return null==e&&(e=new p.Quaternion),e.copy(this._initialRotation)},m.prototype.getMin=function(){return this._min},m.prototype.getMax=function(){return this._max},m.prototype.isCyclic=function(){return this._isCyclic},m.prototype.getCopy=function(e){return e||(e=new m),c.prototype.getCopy.call(this,e),e._skeletonFrameName=this._skeletonFrameName,e._rotationalAxis=this._rotationalAxis?this._rotationalAxis.clone():null,e._initialRotation=this._initialRotation?this._initialRotation.clone():null,e._min=this._min,e._max=this._max,e._isCyclic=this._isCyclic,e},m.prototype.getTransformName=function(){return this._skeletonFrameName},m.Factory=function(){},m.Factory.prototype=Object.create(f.prototype),m.Factory.prototype.constructor=m.Factory,m.Factory.prototype._controlType=m.prototype._controlType,m.Factory.prototype._controlConstructor=m,e.exports=m}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/dofs/RotationControl.js","/release_modules/ifr-motion/src/dofs")},{"./ModelControl":89,"./ModelControlFactory":90,_process:5,buffer:1,"ifr-geometry/src/BasicFrame":65,three:40}],93:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){function u(){null==this._mesh.material._specular_disabled&&(this._mesh.material._specular_disabled=new g.Color(this._mesh.material.specular)),this._billboardMode?(this._mesh.material.ambient.setRGB(0,0,0),this._mesh.material.specular.setRGB(0,0,0)):(this._mesh.material.ambient.setRGB(1,1,1),this._mesh.material.specular.set(this._mesh.material._specular_disabled))}function c(e){null!==this._colorControl&&this._colorControl.setBillboardMode(e),e!==this._billboardMode&&(null!==this._meshes&&(e?(this._mesh.material.ambient.setRGB(0,0,0),this._mesh.material.specular.setRGB(0,0,0)):(this._mesh.material.ambient.setRGB(1,1,1),this._mesh.material.specular.set(this._mesh.material._specular_disabled))),this._billboardMode=e)}function f(e){if("string"==typeof e)return c.call(this,!0),this.setTextureFromURL(e),!0;if("object"!=typeof e)return"number"==typeof e?(y.error("TextureControl for DOF "+this._dofNames[0]+": numerical values (image indices) are no longer supported, use full image URL instead"),!1):!1;var t=e.textureURL,r=e.useNormals,n=e.normalURL;null==r&&(r=null==n?!1:!0),r===!0&&null==n&&(n=this._defaultNormalURL),r===!0&&this.setNormalFromURL(n),c.call(this,!r),null==t?y.error("Value for DOF "+this._dofNames[0]+' is object, but did not contain field "textureURL"'):this.setTextureFromURL(t)}var d=require("./ModelControl"),p=require("./ModelControlFactory"),m=require("ifr-geometry/src/loaders/CachedImageLoader"),g=require("three"),y=require("ifr-core/src/SLog"),v=function(){d.call(this),this._meshName=null,this._mesh=null,this._texture=new g.Texture,this._texture.minFilter=g.LinearFilter,this._normal=new g.Texture,this._blankTexture=new g.DataTexture(new Uint8Array(16),2,2),this._blankTexture.minFilter=g.LinearFilter,this._imageLoader=null,this._defaultNormalURL=null,this._colorControl=null,this._billboardMode=!0};v.prototype=Object.create(d.prototype),v.prototype.constructor=v,v.prototype._controlType="TEXTURE",v.prototype.setFromJson=function(e){d.prototype.setFromJson.call(this,e),this._dofNames.push(e.dofName),this._meshName=e.meshName},v.prototype.setImageLoader=function(e){this._imageLoader=e},v.prototype.setDefaultNormalURL=function(e){this._defaultNormalURL=e},v.prototype.attachToModel=function(e){return this._mesh=null,null!=e&&e.hasOwnProperty(this._meshName)?(this._mesh=e[this._meshName],u.call(this),!0):!1},d.prototype.attachToControlGroup=function(e){var t=e.getControlList();this._colorControl=null;for(var r=0;r<t.length;r++){if("COLOR"===t[r].getControlType())for(var n=t[r]._meshNames,o=0;o<n.length;o++)if(n[o]===this._meshName){
this._colorControl=t[r];break}if(null!==this._colorControl)break}},v.prototype.updateFromDOFValues=function(e){if(this._mesh&&e.hasOwnProperty(this._dofNames[0])){var t=e[this._dofNames[0]];return f.call(this,t)}return!1},v.prototype.updateFromPose=function(e){var t=e.get(this._dofNames[0],0);return this._mesh&&null!=t?f.call(this,t):!1},v.prototype.setTextureFromURL=function(e){if(this._mesh&&this._texture.sourceFile!==e){this._texture.sourceFile=e,this._blankTexture.needsUpdate=!0,this._mesh.material.map=this._blankTexture;var t=this;this._imageLoader.loadImage(e,function(){var e=t._imageLoader.getResult();e.success&&e.url===t._texture.sourceFile?(t._texture.image=e.image,t._texture.needsUpdate=!0,t._mesh.material.map=t._texture):e.success||y.error("TextureControl for DOF "+t._dofNames[0]+": image load failed, URL = "+e.url)})}},v.prototype.setNormalFromURL=function(e){if(this._mesh&&this._normal.sourceFile!==e){this._normal.sourceFile=e;var t=this;this._imageLoader.loadImage(e,function(){var e=t._imageLoader.getResult();e.success&&e.url===t._normal.sourceFile?(t._normal.image=e.image,t._normal.needsUpdate=!0,null==t._mesh.material.normalMap&&(t._mesh.material.needsUpdate=!0),t._mesh.material.normalMap=t._normal):e.success||y.error("TextureControl for DOF "+t._dofNames[0]+": normal load failed, URL = "+e.url)})}},v.prototype.getCopy=function(e){return e||(e=new v),d.prototype.getCopy.call(this,e),e._meshName=this._meshName,e._texture=this._texture?this._texture.clone():null,e._imageLoader=this._imageLoader,e._defaultNormalURL=this._defaultNormalURL,e},v.Factory=function(){this._sharedImageLoader=new m},v.Factory.prototype=Object.create(p.prototype),v.Factory.prototype.constructor=v.Factory,v.Factory.prototype._controlType=v.prototype._controlType,v.Factory.prototype._controlConstructor=v,v.Factory.prototype.setSharedImageLoader=function(e){this._sharedImageLoader=e},v.Factory.prototype.constructFromJson=function(e){var t=p.prototype.constructFromJson.call(this,e);return t&&t.setImageLoader(this._sharedImageLoader),t},e.exports=v}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/dofs/TextureControl.js","/release_modules/node_modules/ifr-motion/src/dofs")},{"./ModelControl":89,"./ModelControlFactory":90,_process:5,buffer:1,"ifr-core/src/SLog":62,"ifr-geometry/src/loaders/CachedImageLoader":69,three:40}],94:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){function u(e){for(var t=(new p.Vector3).copy(this._initialPosition),r=new p.Vector3,n=0;n<e.length;n++){var o=p.Math.clamp(e[n],this._minList[n],this._maxList[n]);r.copy(this._translationalDirectionList[n]).multiplyScalar(o),t.add(r)}return t}var c=require("./ModelControl"),f=require("./ModelControlFactory"),d=require("ifr-geometry/src/BasicFrame"),p=require("three"),m=function(){c.call(this),this._skeletonFrameName=null,this._initialPosition=new p.Vector3,this._translationalDirectionList=[],this._minList=[],this._maxList=[],this._skeletonFrame=null};m.prototype=Object.create(c.prototype),m.prototype.constructor=m,m.prototype._controlType="TRANSLATION",m.prototype.setFromJson=function(e){c.prototype.setFromJson.call(this,e),this._dofNames.push(e.dofName),this._skeletonFrameName=e.skeletonFrameName,this._initialPosition.copy(d.vector3FromJson(e.xyzInitialPosition)),this._translationalDirectionList.push(d.vector3FromJson(e.xyzTranslationDirection)),this._minList.push(e.min),this._maxList.push(e.max)},m.prototype.appendControl=function(e){this._controlNames=this._controlNames.concat(e._controlNames),this._dofNames=this._dofNames.concat(e._dofNames),this._translationalDirectionList=this._translationalDirectionList.concat(e._translationalDirectionList),this._minList=this._minList.concat(e._minList),this._maxList=this._maxList.concat(e._maxList)},m.prototype.attachToModel=function(e){return this._skeletonFrame=null,null!=e&&e.hasOwnProperty(this._skeletonFrameName)?(this._skeletonFrame=e[this._skeletonFrameName],!0):!1},m.prototype.computeFromDOFValues=function(e){for(var t=[],r=0;r<this._dofNames.length;r++){if(!e.hasOwnProperty(this._dofNames[r]))return null;t.push(e[this._dofNames[r]])}return u.call(this,t)},m.prototype.updateFromDOFValues=function(e){var t=this.computeFromDOFValues(e);return null!=t&&null!=this._skeletonFrame?(this._skeletonFrame.position.copy(t),!0):!1},m.prototype.computeFromPose=function(e){for(var t=[],r=0;r<this._dofNames.length;r++){var n=e.get(this._dofNames[r],0);if(null==n)return null;t.push(n)}return u.call(this,t)},m.prototype.updateFromPose=function(e){var t=this.computeFromPose(e);return null!=t&&null!=this._skeletonFrame?(this._skeletonFrame.position.copy(t),!0):!1},m.prototype.getCopy=function(e){if(e||(e=new m),c.prototype.getCopy.call(this,e),e._skeletonFrameName=this._skeletonFrameName,e._initialPosition=this._initialPosition?this._initialPosition.clone():null,e._translationalDirectionList=this._translationalDirectionList?this._translationalDirectionList.slice(0):null,e._translationalDirectionList)for(var t=0;t<e._translationalDirectionList.length;t++)e[t]=e[t]?e[t].clone():null;return e._minList=this._minList?this._minList.slice(0):this._minList,e._maxList=this._maxList?this._maxList.slice(0):this._maxList,e},m.prototype.getTransformName=function(){return this._skeletonFrameName},m.Factory=function(){},m.Factory.prototype=Object.create(f.prototype),m.Factory.prototype.constructor=m.Factory,m.Factory.prototype._controlType=m.prototype._controlType,m.Factory.prototype._controlConstructor=m,m.Factory.prototype.postProcessControlList=function(e){for(var t={},r=[],n=0;n<e.length;n++){var o=e[n];if(o instanceof m)if(t.hasOwnProperty(o._skeletonFrameName)){var i=t[o._skeletonFrameName];i.appendControl(o)}else t[o._skeletonFrameName]=o,r.push(o);else r.push(o)}return r},e.exports=m}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/dofs/TranslationControl.js","/release_modules/node_modules/ifr-motion/src/dofs")},{"./ModelControl":89,"./ModelControlFactory":90,_process:5,buffer:1,"ifr-geometry/src/BasicFrame":65,three:40}],95:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("ifr-core/src/Clock"),require("ifr-core/src/Bakery")),c=require("../base/CyclicMath"),f=function(){this._targetTime=null,this._targetPosition=null,this._targetVelocity=null,this._lastObservationTime=null,this._lastObservedPosition=null,this._lastObservedVelocity=null,this._lastReportedTargetVelocity=null,this._commandVelocity=0,this._commandAcceleration=1,this._lastError=0,this._window="FeedbackController"};f.prototype.setTarget=function(e,t,r){this._targetTime=e,this._targetPosition=t,this._targetVelocity=r},f.prototype.acceptFeedback=function(e,t,r,n){this._lastObservationTime=e,this._lastObservedPosition=t,this._lastObservedVelocity=r,this._lastReportedTargetVelocity=n},f.prototype.calculateForTime=function(e){if(null!==this._lastObservationTime&&null!==this._targetTime){var t=e.subtract(this._targetTime),r=this._targetPosition+this._targetVelocity*t,n=u.getFloat("P Gain",0,10,2,this._window),o=u.getFloat("D Gain",0,10,0,this._window),i=this.predictedPosition(e);i=c.closestEquivalentRotation(i,r);var a=r-i,s=a-this._lastError,l=n*a+o*s;this._lastError=a;var h=u.getFloat("P Gain Vel Cap",0,100,100,this._window);l=Math.max(-h,Math.min(h,l)),this._commandVelocity=l,this._commandAcceleration=u.getFloat("Advertise Accel Limit",0,50,30,this._window)}},f.prototype.predictedPosition=function(e){return this._lastObservedPosition},f.prototype.getCommandVelocity=function(){return this._commandVelocity},f.prototype.getCommandAcceleration=function(){return this._commandAcceleration},f.prototype.noteCommandSent=function(e,t,r){},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/feedback/PController.js","/release_modules/ifr-motion/src/feedback")},{"../base/CyclicMath":75,_process:5,buffer:1,"ifr-core/src/Bakery":59,"ifr-core/src/Clock":60}],96:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/Bakery"),c=require("./PController"),f=function(){c.call(this),this._commandVelocityPVC=0};f.prototype=Object.create(c.prototype),f.prototype.constructor=f,f.prototype.calculateForTime=function(e){null!==this._lastObservationTime&&null!==this._targetTime&&(c.prototype.calculateForTime.call(this,e),u.getBoolean("Use Velocity",!0,this._window)?this._commandVelocityPVC=this._commandVelocity+this._targetVelocity:this._commandVelocityPVC=this._commandVelocity)},f.prototype.getCommandVelocity=function(){return this._commandVelocityPVC},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/feedback/PVController.js","/release_modules/node_modules/ifr-motion/src/feedback")},{"./PController":95,_process:5,buffer:1,"ifr-core/src/Bakery":59}],97:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./TrajectoryControllerSim"),c=function(e,t,r){u.call(this,e,t,r)};c.prototype=Object.create(u.prototype),c.prototype.constructor=c,c.prototype.updateCommand=function(e,t,r,n,o){var i=.1;u.prototype.updateCommand.call(this,e,t,i,r,n,o)},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/ifr-motion/src/feedback/PosVelControllerSim.js","/release_modules/animation-utilities/node_modules/ifr-motion/src/feedback")},{"./TrajectoryControllerSim":98,_process:5,buffer:1}],98:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("../base/AccelPlanner"),c=(require("ifr-core/src/Time"),require("ifr-core/src/Clock")),f=require("../base/CyclicMath"),d=require("ifr-core/src/SLog"),p=function(e,t,r){null==e&&(e=0),null==t&&(t=0),null==r&&(r=c.currentTime()),this._planner=new u,this._plan=this._planner.computeWithZeroAccel(t),this._planStartTime=r,this._planStartPosition=e};p.prototype.updateCommand=function(e,t,r,n,o,i){null==i&&(i=c.currentTime());var a=i.subtract(this._planStartTime),s=this._plan.displacementAtTime(a)+this._planStartPosition,l=this._plan.velocityAtTime(a);e=f.closestEquivalentRotation(e,s),this._plan=this._planner.computeWithMaxAccel(l,t,e-s,n,r),this._plan.isConsistent()||(d.error("Inconsistent plan with inputs: \n currentVelocity:"+l+" \n targetVelocity:"+t+" \n pDelta:"+(e-s)+" \n maxAcceleration:"+n+" \n maxVelocity:"+o),this.plan=this._planner.computeWithMaxAccel(0,0,0,1,1)),this._planStartTime=i,this._planStartPosition=s},p.prototype.getPosition=function(e){null==e&&(e=c.currentTime());var t=e.subtract(this._planStartTime),r=this._plan.displacementAtTime(t)+this._planStartPosition;return r},p.prototype.getVelocity=function(e){null==e&&(e=c.currentTime());var t=e.subtract(this._planStartTime),r=this._plan.velocityAtTime(t);return r},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/ifr-motion/src/feedback/TrajectoryControllerSim.js","/release_modules/animation-utilities/node_modules/ifr-motion/src/feedback")},{"../base/AccelPlanner":72,"../base/CyclicMath":75,_process:5,buffer:1,"ifr-core/src/Clock":60,"ifr-core/src/SLog":62,"ifr-core/src/Time":63}],99:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("../base/TimestampedBuffer"),c=require("../base/MotionTrack"),f=require("../base/Motion"),d=require("../base/MotionEvent"),p=require("ifr-core/src/FileTools"),m=require("ifr-core/src/SLog"),g="MODEL_LOADING",y=function(){this.url=null,this.success=!1,this.message="",this.motion=null,this.defaultDOFNames=null,this.enumMaps=null,this.events=null},v=function(){this._result=null,this.flattenEnums=!0,this.resolvePaths=!0};v.prototype.getResult=function(){return this._result},v.prototype.load=function(e,t){var r=this;p.loadJSON(e,function(n,o){if(null===n)r.parseData(o,e),t&&t();else{var i=new y;i.url=e,i.success=!1,i.message=n,r._result=i,t&&t()}})},v.prototype.parseData=function(e,t){if(this._result=new y,this._result.url=t,"DOFAnimation"!==e.header.fileType&&"Animation"!==e.header.fileType)return this._result.success=!1,void(this._result.message="don't know how to handle file type: "+e.header.fileType);for(var r=e.content,n=new f(r.name),o=0;o<r.channels.length;o++){var i=r.channels[o],a=new u;a.timestampList=i.times,a.dataList=i.values;var s=new c(i.dofName,a,i.length);n.addTrack(s)}if(this._result.motion=n,r.defaultDOFs&&(this._result.defaultDOFNames=r.defaultDOFs),r.enumMaps){this._result.enumMaps={};for(var l=0;l<r.enumMaps.length;l++){var h=r.enumMaps[l];this._result.enumMaps[h.dofName]=h.values}this.flattenEnums&&_(this._result.motion,this._result.enumMaps)}if(this.resolvePaths&&b(this._result.motion,t),r.events){this._result.events=[];for(var p=0;p<r.events.length;p++){var v=r.events[p];if(void 0===v.time||null===v.time)m(g,"AnimationLoader: skipping event with null or undefined time property");else if(v.time<0||v.time>n.getDuration())m(g,"AnimationLoader: skipping event with time property: "+v.time+" outside of animation bounds, animation duration = "+n.getDuration());else if(void 0===v.eventName||null===v.eventName||""===v.eventName)m(g,"AnimationLoader: skipping event with empty, null, or undefined eventName property");else if("string"!=typeof v.eventName)m(g,"AnimationLoader: skipping event with non-string eventName property: "+v.eventName);else{var w=void 0!==v.payload?v.payload:null;this._result.events.push(new d(v.time,v.eventName,w))}}this._result.events.sort(function(e,t){return e.getTimestamp()-t.getTimestamp()})}this._result.success=!0};var _=function(e,t){for(var r=e.getTracks(),n=Object.keys(r),o=0;o<n.length;o++){var i=n[o];if(t.hasOwnProperty(i))for(var a=r[i].getMotionData().dataList,s=t[i],l=0;l<a.length;l++){var h=a[l];if(h instanceof Array&&(h=h[0]),"number"==typeof h){var u=Math.round(h);a[l]=[s[u]],s.hasOwnProperty(u)||m(g,"AnimationLoader: no enum value specified for key: "+u+", DOF = "+i)}else m(g,"AnimationLoader: DOF "+i+" has an enum map, but found non-numerical value: "+h)}}},b=function(e,t){var r="",n=t.lastIndexOf("/"),o=t.lastIndexOf("\\");if(-1!==n||-1!==o){var i=Math.max(n,o);r=t.substring(0,i+1)}for(var a=e.getTracks(),s=Object.keys(a),l=0;l<s.length;l++){var h=s[l],u=a[h].getMotionData().dataList,c=[],f=u[0];if(f instanceof Array&&(f=f[0]),"string"==typeof f||"object"==typeof f)for(var d=0;d<u.length;d++){var p=u[d];p instanceof Array&&(p=p[0]),"string"==typeof p?u[d]=[r+p]:"object"==typeof p?c.indexOf(p)<0&&("string"==typeof p.textureURL?(p.textureURL=r+p.textureURL,"string"==typeof p.normalURL&&(p.normalURL=r+p.normalURL),c.push(p)):m(g,"AnimationLoader: DOF "+h+" had object-valued samples, but at least one ("+d+') is missing "textureURL" field')):m(g,"AnimationLoader: DOF "+h+" had string-valued samples, but also found non-string value: "+p)}}};e.exports=v}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/loaders/AnimationLoader.js","/release_modules/node_modules/ifr-motion/src/loaders")},{"../base/Motion":79,"../base/MotionEvent":80,"../base/MotionTrack":81,"../base/TimestampedBuffer":85,_process:5,buffer:1,"ifr-core/src/FileTools":61,"ifr-core/src/SLog":62}],100:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("../dofs/ModelControl"),require("../dofs/ModelControlGroup")),c=(require("../dofs/ModelControlFactory"),require("../dofs/RotationControl")),f=require("../dofs/TranslationControl"),d=require("../dofs/TextureControl"),p=require("../dofs/ColorControl"),m=require("ifr-core/src/FileTools"),g=(require("three"),function(){this.url=null,this.success=!1,this.message="",this.modelControlGroup=null}),y=function(){this._result=null,this._modelControlFactoryMap={},this.addModelControlFactory(new c.Factory),this.addModelControlFactory(new f.Factory),this.addModelControlFactory(new d.Factory),this.addModelControlFactory(new p.Factory)};y.prototype.addModelControlFactory=function(e){this._modelControlFactoryMap[e.getControlType()]=e},y.prototype.getModelControlFactory=function(e){return this._modelControlFactoryMap[e]},y.prototype.getResult=function(){return this._result},y.prototype.load=function(e,t){var r=this;m.loadJSON(e,function(n,o){if(null===n)r.parseData(o,e),t&&t();else{var i=new g;i.url=e,i.success=!1,i.message=n,r._result=i,t&&t()}})},y.prototype.parseData=function(e,t){if(this._result=new g,this._result.url=t,"Kinematics"!==e.header.fileType)return this._result.success=!1,void(this._result.message="don't know how to handle file type: "+e.header.fileType);for(var r=[],n=0;n<e.content.controls.length;n++){var o=e.content.controls[n];if(!this._modelControlFactoryMap.hasOwnProperty(o.controlType))return this._result.success=!1,void(this._result.message="no factory installed for control type: "+o.controlType+", control name = "+o.controlName);var i=this._modelControlFactoryMap[o.controlType],a=i.constructFromJson(o);if(null===a)return this._result.success=!1,void(this._result.message="factory construction failed, control type = "+o.controlType+", control name = "+o.controlName);r.push(a)}for(var s=Object.keys(this._modelControlFactoryMap),l=0;l<s.length;l++)r=this._modelControlFactoryMap[s[l]].postProcessControlList(r);this._result.modelControlGroup=new u,this._result.modelControlGroup.setControlList(r),this._result.success=!0},e.exports=y}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/loaders/KinematicsLoader.js","/release_modules/node_modules/ifr-motion/src/loaders")},{"../dofs/ColorControl":86,"../dofs/ModelControl":89,"../dofs/ModelControlFactory":90,"../dofs/ModelControlGroup":91,"../dofs/RotationControl":92,"../dofs/TextureControl":93,"../dofs/TranslationControl":94,_process:5,buffer:1,"ifr-core/src/FileTools":61,three:40}],101:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/FileTools"),c=require("ifr-core/src/SLog"),f="MODEL_LOADING",d=function(){this.url=null,this.success=!1,this.message="",this.dofLimits=null},p=function(){this._result=null};p.prototype.getResult=function(){return this._result},p.prototype.load=function(e,t){var r=this;u.loadJSON(e,function(n,o){if(null===n)r.parseData(o,e),t&&t();else{var i=new d;i.url=e,i.success=!1,i.message=n,r._result=i,t&&t()}})},p.prototype.parseData=function(e,t){if(this._result=new d,this._result.url=t,"Limits"!==e.header.fileType)return this._result.success=!1,void(this._result.message="don't know how to handle file type: "+e.header.fileType);var r={},n=e.content.dofLimits;if(n)for(var o=0;o<n.length;o++){var i=n[o].dofName,a=n[o].limits;void 0===i||null===i?c(f,"LimitsLoader: skipping limit data with null or undefined dofName property"):void 0===a||null===a?c(f,"LimitsLoader: skipping limit data with null or undefined limits property"):r[i]=a}this._result.dofLimits=r,this._result.success=!0},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/loaders/LimitsLoader.js","/release_modules/node_modules/ifr-motion/src/loaders")},{_process:5,buffer:1,"ifr-core/src/FileTools":61,"ifr-core/src/SLog":62}],102:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("../base/Pose"),c=function(e,t){var r=[];this._lookatNodes=e;for(var n=0;n<this._lookatNodes.length;n++){var o=t.getCopy(this._lookatNodes[n].getDOFs(),!0);this._lookatNodes[n].connectToGroup(o);for(var i=o.getDOFNames(),a=0;a<i.length;a++)r.indexOf(i[a])<0&&r.push(i[a])}this._internalPose=new u("LookPose",r)};c.prototype.generatePose=function(e,t,r){e!==t&&t.setPose(e),this._internalPose.setPose(e);for(var n=0;n<this._lookatNodes.length;n++)this._lookatNodes[n].getPose(this._internalPose,this._internalPose,r);t.setPose(this._internalPose)},c.prototype.getDOFs=function(){for(var e=[],t=0;t<this._lookatNodes.length;t++)e=e.concat(this._lookatNodes[t].getDOFs());return e},c.prototype.getStateDOFs=function(){return this._internalPose.getDOFNames()},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/lookat/Lookat.js","/release_modules/node_modules/ifr-motion/src/lookat")},{"../base/Pose":83,_process:5,buffer:1}],103:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(e,t){this._name=e,this._controlledDOFName=t,this._kinematicGroup=null};u.prototype.connectToGroup=function(e){this._kinematicGroup=e},u.prototype.valToPointAtTarget=function(e,t){},u.prototype.getName=function(){return this._name},u.prototype.getControlledDOFName=function(){return this._controlledDOFName},u.prototype.errorRatio=function(e){},u.prototype.suggestForwardTarget=function(e){},e.exports=u}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/lookat/LookatDOF.js","/release_modules/ifr-motion/src/lookat")},{_process:5,buffer:1}],104:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./OcularStabilizationTracker"),c=require("./PoseOffsetFilter"),f=require("../base/Pose"),d=require("ifr-core/src/SLog"),p=require("three"),m=(require("ifr-geometry/src/ExtraMath"),require("./LookatNode")),g={POINT_TARGET:"POINT_TARGET",POINT_FORWARD:"POINT_FORWARD",POINT_AUTO:"POINT_AUTO"},y=function(e,t,r,n){this._lookatNode=e,this._stabilization=new u(e,t),this._filter=new c(e.getDOFs()),this._filter.setRejectDeltaThreshold(.4),null!=r&&this._filter.setAcceleration(r),this._lastUpdateTime=null,this._optimalPose=new f("LMN Optimal",e.getDOFs()),this._tempPose=new f("LMN Temp",e.getDOFs()),this._stabilizationTarget=new p.Vector3,this._poseForStabilizationTarget=new f("Pose For ST",e.getDOFs()),this._dofAligner=t,this._stabilizationMode=n};y.LookStabilizationMode=g,y.prototype.connectToGroup=function(e){this._lookatNode.connectToGroup(e)},y.prototype.update=function(e,t,r,n){if(null!==this._lastUpdateTime&&n.equals(this._lastUpdateTime))return void this._filter.getValue(t);var o;o=null===this._lastUpdateTime?e:this._optimalPose;var i=new m.PointNodeReport;if(this._lookatNode.getPose(e,this._optimalPose,r,o,i),this._stabilizationMode===g.POINT_FORWARD||this._stabilizationMode===g.POINT_AUTO&&(i._targetStability<.2||!i._pointSucceeded)?(this._stabilizationMode===g.POINT_AUTO&&d.info("Stabilization AUTO mode for "+this.getName()+" falling back to FORWARD with stability "+i._targetStability+", pointSuccess="+i._pointSucceeded),this._lookatNode.suggestForwardTarget(e,this._stabilizationTarget),this._lookatNode.getPose(e,this._poseForStabilizationTarget,this._stabilizationTarget,o)):(this._stabilizationTarget.copy(r),this._poseForStabilizationTarget.setPose(this._optimalPose)),null===this._lastUpdateTime)this._stabilization.reset(),this._stabilization.computeStabilizationDelta(e,this._poseForStabilizationTarget,this._stabilizationTarget),this._tempPose.setPose(e),this._stabilization.decomposeVelocity(e,this._tempPose,this._stabilizationTarget,this._filter.getRejectDeltaThreshold()),this._filter.resetToPose(this._tempPose);else{this._filter.getTarget(this._tempPose),this._dofAligner.refineToLocallyClosestTargetPose(this._tempPose,this._optimalPose);var a=this._stabilization.computeStabilizationDelta(e,this._poseForStabilizationTarget,this._stabilizationTarget);this._filter.applyUnfilteredOffset(a),this._filter.setTarget(this._optimalPose),this._filter.updateByTime(n.subtract(this._lastUpdateTime))}null!=t&&this._filter.getValue(t),this._lastUpdateTime=n},y.prototype.getOptimalPose=function(e,t,r){var n;n=null===this._lastUpdateTime?e:this._optimalPose,this._lookatNode.getPose(e,t,r,n)},y.prototype.getPose=function(e){null===this._lastUpdateTime&&d.error('LookatMotionNode asked "getPose()" before initialization'),this._filter.getValue(e)},y.prototype.getDistanceRemaining=function(){return this._filter.getValue(this._tempPose),this._lookatNode.distanceAsRatio(this._tempPose,this._optimalPose)},y.prototype.getDOFs=function(){return this._lookatNode.getDOFs()},y.prototype.reset=function(){this._lastUpdateTime=null},y.prototype.getName=function(){return this._lookatNode.getName()},e.exports=y}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/lookat/LookatMotionNode.js","/release_modules/node_modules/ifr-motion/src/lookat")},{"../base/Pose":83,"./LookatNode":105,"./OcularStabilizationTracker":107,"./PoseOffsetFilter":110,_process:5,buffer:1,"ifr-core/src/SLog":62,"ifr-geometry/src/ExtraMath":67,three:40}],105:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){function u(e,t,r){var n=e._angleToAxis/(Math.PI/2),o=Math.min(5*e._distanceToTarget,1);null===t._targetStability?t._targetStability=n*o:t._targetStability*=n*o,r||(t._pointSucceeded=!1)}var c=require("./PointADOF"),f=require("ifr-core/src/SLog"),d="LOOKAT",p=function(){this._targetStability=null,this._pointSucceeded=!0},m=function(e,t){this._name=e,this._lookatDOFs=t,this._kinematicGroup=null};m.PointNodeReport=p,m.prototype.connectToGroup=function(e){this._kinematicGroup=e;for(var t=0;t<this._lookatDOFs.length;t++)this._lookatDOFs[t].connectToGroup(this._kinematicGroup)},m.prototype.getPose=function(e,t,r,n,o){t!==e&&t.setPose(e),null==n&&(n=e);var i=!1;this._kinematicGroup.setFromPose(e),this._kinematicGroup.getRoot().updateMatrixWorld(!0);for(var a=null,s=0;s<this._lookatDOFs.length;s++){o&&(a=new c.PointReport);var l=this._lookatDOFs[s].valToPointAtTarget(r,a);a&&u(a,o,null!=l),null!=l?t.set(this._lookatDOFs[s].getControlledDOFName(),l,0):(f(d,"LookatNode "+this._name+" using last value due to uncomputable value for target ("+r.x+", "+r.y+", "+r.z+")"),t.set(this._lookatDOFs[s].getControlledDOFName(),n.get(this._lookatDOFs[s].getControlledDOFName(),0),0),i=!0),s<this._lookatDOFs.length-1&&(this._kinematicGroup.setFromPose(t),this._kinematicGroup.getRoot().updateMatrixWorld(!0))}return!i},m.prototype.getDOFs=function(){for(var e=[],t=0;t<this._lookatDOFs.length;t++)e.push(this._lookatDOFs[t].getControlledDOFName());return e},m.prototype.distanceAsRatio=function(e,t){for(var r=0,n=0;n<this._lookatDOFs.length;n++){var o=this._lookatDOFs[n],i=o.getControlledDOFName(),a=e.get(i,0),s=t.get(i,0),l=o.errorRatio(a-s);l>r&&(r=l)}return r},m.prototype.getName=function(){return this._name},m.prototype.suggestForwardTarget=function(e,t){return this._kinematicGroup.setFromPose(e),this._kinematicGroup.getRoot().updateMatrixWorld(!0),this._lookatDOFs[0].suggestForwardTarget(t)},e.exports=m}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/lookat/LookatNode.js","/release_modules/node_modules/ifr-motion/src/lookat")},{"./PointADOF":109,_process:5,buffer:1,"ifr-core/src/SLog":62}],106:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("../base/Pose"),c=function(e,t){var r,n,o=[];for(this._lookatNodes=e,r=0;r<this._lookatNodes.length;r++){var i=t.getCopy(this._lookatNodes[r].getDOFs(),!0);this._lookatNodes[r].connectToGroup(i);var a=i.getDOFNames();for(n=0;n<a.length;n++)o.indexOf(a[n])<0&&o.push(a[n])}for(this._internalPose=new u("LookPose",o),this._dofToLookatNodeMap={},this._lookatNodeToDOFsMap={},r=0;r<this._lookatNodes.length;r++){var s=this._lookatNodes[r],l=this._lookatNodes[r].getDOFs();if(this._lookatNodeToDOFsMap.hasOwnProperty(s.getName()))throw new Error("Error, multiple lookat nodes named "+s.getName());for(this._lookatNodeToDOFsMap[s.getName()]=l,n=0;n<l.length;n++){var h=l[n];if(this._dofToLookatNodeMap.hasOwnProperty(h))throw new Error("Error, multiple lookat nodes use DOF "+h+": "+this._dofToLookatNodeMap[h].getName()+" and "+s.getName());this._dofToLookatNodeMap[h]=s}}};c.prototype.generatePose=function(e,t,r,n){e!==t&&t.setPose(e),this._internalPose.setPose(e);for(var o=0;o<this._lookatNodes.length;o++)this._lookatNodes[o].update(this._internalPose,this._internalPose,r,n);t.setPose(this._internalPose)},c.prototype.generatePoseIncremental=function(e,t,r,n,o){if(e!==t&&t.setPose(e),this._dofToLookatNodeMap.hasOwnProperty(o)){var i=this._dofToLookatNodeMap[o];i.update(e,t,r,n)}},c.prototype.getPose=function(e){for(var t=0;t<this._lookatNodes.length;t++)for(var r=this._lookatNodes[t],n=this._lookatNodeToDOFsMap[r.getName()],o=0;o<n.length;o++)if(null!==e.get(n[o])){r.getPose(e);break}},c.prototype.getOptimalPose=function(e,t,r){e!==t&&t.setPose(e),this._internalPose.setPose(e);for(var n=0;n<this._lookatNodes.length;n++)this._lookatNodes[n].getOptimalPose(this._internalPose,this._internalPose,r);t.setPose(this._internalPose)},c.prototype.getDistanceRemaining=function(e){var t,r,n=0;if(null==e)for(t=0;t<this._lookatNodes.length;t++)r=this._lookatNodes[t].getDistanceRemaining(),r>n&&(n=r);else{var o={};for(t=0;t<e.length;t++){var i=e[t];if(this._dofToLookatNodeMap.hasOwnProperty(i)){var a=this._dofToLookatNodeMap[i];o[a.getName()]!==!0&&(r=a.getDistanceRemaining(),r>n&&(n=r),o[a.getName()]=!0)}}}return n},c.prototype.getDOFs=function(){for(var e=[],t=0;t<this._lookatNodes.length;t++)e=e.concat(this._lookatNodes[t].getDOFs());return e},c.prototype.getStateDOFs=function(){return this._internalPose.getDOFNames()},c.prototype.reset=function(){for(var e=0;e<this._lookatNodes.length;e++)this._lookatNodes[e].reset()},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/lookat/MotionLookat.js","/release_modules/node_modules/ifr-motion/src/lookat")},{"../base/Pose":83,_process:5,buffer:1}],107:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/SLog"),c=require("../base/Pose"),f=require("three"),d=(require("ifr-geometry/src/ExtraMath"),require("./LookatNode")),p=function(e,t){var r=!1,n=new f.Vector3,o=e.getDOFs(),i=new c(e.getName()+" Last Optimal",o),a=new c(e.getName()+" Stepped Pose",o),s=new c(e.getName()+" OST Delta",o),l=new c(e.getName()+" Temp Last Pose Optimal",o),h=null;
this.computeStabilizationDelta=function(l,h,u){if(r){var f=new d.PointNodeReport;if(e.getPose(l,a,n,null,f),f._pointSucceeded)null!=t&&t.refineToLocallyClosestTargetPose(i,a),c.subtract(a,i,!0,s);else for(var p=0;p<s.getDOFNames();p++)s.set(s.getDOFNames()[p],0,0)}else{s.clear();for(var m=0;m<o.length;m++)s.set(o[m],0,0)}return n.copy(u),null==h?e.getPose(l,i,u):i.setPose(h),r=!0,s},this.decomposeVelocity=function(r,n,o,i){null==i&&(i=0),null===h&&(h=new c(e.getName()+" Decomp Last Pose")),c.advanceByTime(r,!0,h,-0.02),e.getPose(r,a,o),e.getPose(h,l,o),null!=t&&t.refineToLocallyClosestTargetPose(l,a),c.subtract(a,l,!0,s);for(var f=s.getDOFNames(),d=0;d<f.length;d++){var p=f[d],m=r.get(p,1),g=s.get(p,0);0!==i&&Math.abs(g)>i&&(u.error("Clamping OST application of unfiltered offset of "+s+" to "+p+" as it is greater than "+i),g=0>g?-i:i);var y=50*g;n.set(p,m-y,1)}},this.reset=function(){r=!1}};e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/lookat/OcularStabilizationTracker.js","/release_modules/ifr-motion/src/lookat")},{"../base/Pose":83,"./LookatNode":105,_process:5,buffer:1,"ifr-core/src/SLog":62,"ifr-geometry/src/ExtraMath":67,three:40}],108:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("../dofs/RotationControl"),require("three"),require("./PointADOF")),c=require("./LookatDOF"),f=function(e,t,r,n,o,i,a,s){c.call(this,e,t),this._control=null,this._forwardDir=n,this._centralTransformName=r,this._internalDistance=i,this._planeNormal=o,this._controlledTransform=null,this._centralTransform=null,this._dofMin=a,this._dofMax=s};f.prototype=Object.create(c.prototype),f.prototype.constructor=f,f.prototype.connectToGroup=function(e){c.prototype.connectToGroup.call(this,e),this._kinematicGroup?(this._control=this._kinematicGroup.getModelControlGroup().getControlForDOF(this._controlledDOFName),this._controlledTransform=this._kinematicGroup.getTransform(this._control.getTransformName()),this._centralTransform=this._kinematicGroup.getTransform(this._centralTransformName)):(this._control=null,this._controlledTransform=null,this._centralTransform=null)},f.prototype.valToPointAtTarget=function(e,t){var r=u.planeIntersectFromRear(this._centralTransform,e,null,this._forwardDir,this._planeNormal,this._internalDistance,t);return Math.max(Math.min(r,this._dofMax),this._dofMin)},f.prototype.errorRatio=function(e){return Math.abs(e/(this._dofMax-this._dofMin))},f.prototype.suggestForwardTarget=function(e){return null==this._centralTransform?null:(e.copy(this._forwardDir),e.multiplyScalar(10),this._centralTransform.localToWorld(e),e)},e.exports=f}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/lookat/PlaneDisplacementLookatDOF.js","/release_modules/node_modules/ifr-motion/src/lookat")},{"../dofs/RotationControl":92,"./LookatDOF":103,"./PointADOF":109,_process:5,buffer:1,three:40}],109:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("../dofs/RotationControl"),require("three")),c=require("ifr-core/src/SLog"),f="LOOKAT",d=.001,p=d*d,m=null,g=function(){this._angleToAxis=null,this._distanceToTarget=null},y={name:"PointADOF"};y.PointReport=g,y.setVisHelper=function(e){m=e};var v=function(e){return e=Math.abs(e%Math.PI),e=Math.abs(Math.PI/2-e),e=Math.PI/2-e},_=function(e,t){var r=(new u.Vector3).copy(e),n=r.angleTo(t),o=r.multiplyScalar(-1).angleTo(t);return o>=n?n>.1&&v(e.w)>d?(c(f,"Error, computed axis ("+r.x+", "+r.y+", "+r.z+") not so close ("+n+") to references axis ("+t.x+", "+t.y+", "+t.z+"), angle = "+e.w),null):e.w:o>.1&&v(e.w)>d?(c(f,"Error, computed axis ("+r.x+", "+r.y+", "+r.z+") not so close ("+n+") to references axis ("+t.x+", "+t.y+", "+t.z+"), angle = "+e.w),null):-e.w};y.getRelativeAngle=function(e,t,r,n,o,i){null==r&&(r=new u.Vector3(0,0,0));var a=e.worldToLocal((new u.Vector3).copy(t)),s=(new u.Vector3).copy(a).sub(r);i&&(i._angleToAxis=v(s.angleTo(o)),i._distanceToTarget=s.length());var l=(new u.Vector3).copy(n).projectOnPlane(o),h=(new u.Vector3).copy(s).projectOnPlane(o);if(l.lengthSq()<p)return c(f,"Error getting relative angle, forward too close to plane normal ("+o.x+", "+o.y+", "+o.z+") too close to axis ("+o.x+", "+o.y+", "+o.z+")"),null;if(h.lengthSq()<p)return c(f,"Error getting relative angle, target dir too close to plane normal ("+o.x+", "+o.y+", "+o.z+") too close to axis ("+h.x+", "+h.y+", "+h.z+")"),null;h.normalize(),l.normalize();var d=(new u.Quaternion).setFromUnitVectors(l,h),g=(new u.Vector4).setAxisAngleFromQuaternion(d),y=_(g,o);return null!==m&&m.shouldDraw(this)&&(m.drawRayLocal(this,"RelativeAngle:Forward",e,r,n,new u.Color(1,0,0)),m.drawLineLocal(this,"RelativeAngle:Target",e,r,(new u.Vector3).copy(r).add(s),new u.Color(.6,.6,0)),m.drawLineLocal(this,"RelativeAngle:FlatTarget",e,r,(new u.Vector3).copy(r).add(h),new u.Color(0,1,1)),m.drawRayLocal(this,"RelativeAngle:AxisOfRotation",e,r,o,new u.Color(.5,1,0)),m.drawPlaneLocal(this,"RelativeAngle:PlaneOfRotation",e,r,o,new u.Color(1,0,1))),y},y.planeIntersectFromRear=function(e,t,r,n,o,i,a){null==r&&(r=new u.Vector3(0,0,0));var s=(new u.Vector3).copy(n).normalize().multiplyScalar(-i).add(r),l=y.getRelativeAngle(e,t,s,n,o,a);if(null!=l){var h;if(h=l>=Math.PI/2?Number.POSITIVE_INFINITY:l<=-Math.PI/2?Number.NEGATIVE_INFINITY:Math.tan(l)*i,null!==m&&m.shouldDraw(this)){var d=e.worldToLocal((new u.Vector3).copy(t));m.drawLineLocal(this,"PlaneIntersectFromRear:InternalToTarget",e,s,d,new u.Color(1,1,0))}return h}return c(f,"Plane intersect error, could not get angle"),null},y.pointDOF=function(e,t,r,n,o){var i=t.worldToLocal((new u.Vector3).copy(n)),a=(new u.Quaternion).copy(t.quaternion);i.applyQuaternion(a);var s=e.getInitialRotation(new u.Quaternion),l=e.getRotationalAxis(new u.Vector3);l.applyQuaternion(s);var h=(new u.Vector3).copy(r).applyQuaternion(s);o&&(o._angleToAxis=v(i.angleTo(l)),o._distanceToTarget=i.length());var d=(new u.Vector3).copy(h).projectOnPlane(l),g=(new u.Vector3).copy(i).projectOnPlane(l);if(d.lengthSq()<p||g.lengthSq()<p)return c(f,"Error pointing DOF, Forward length:"+d.length()+" local length:"+g.length()),null;d.normalize(),g.normalize();var y=(new u.Quaternion).setFromUnitVectors(d,g),b=(new u.Vector4).setAxisAngleFromQuaternion(y),w=_(b,l);if(null!==m&&m.shouldDraw(this)){m.drawRayLocal(this,"PointAt:CurForwardDir",t,null,r,new u.Color(1,0,0));var x=e.getRotationalAxis(new u.Vector3);m.drawRayLocal(this,"PointAt:AxisOfRotation",t,null,x,new u.Color(1,1,0)),m.drawPlaneLocal(this,"PointAt:PlaneOfRotation",t,null,x,new u.Color(1,0,1));var T=(new u.Vector3).copy(r);T.applyQuaternion(s),T.applyQuaternion((new u.Quaternion).copy(a).inverse()),m.drawRayLocal(this,"PointAt:InitForwardDir",t,null,T,new u.Color(0,1,1));var M=(new u.Quaternion).setFromAxisAngle(l,w),S=(new u.Vector3).copy(h).applyQuaternion(M);S.applyQuaternion((new u.Quaternion).copy(a).inverse()),m.drawRayLocal(this,"PointAt:FlatTargetVec",t,null,S,new u.Color(0,1,1))}return w},y.pointDOFToIntersectConeWithPoint=function(e,t,r,n,o,i,a,s){var l=t.worldToLocal((new u.Vector3).copy(o)),h=(new u.Quaternion).copy(t.quaternion);l.applyQuaternion(h);var p=e.getInitialRotation(new u.Quaternion),g=e.getRotationalAxis(new u.Vector3),y=(new u.Vector3).copy(g).applyQuaternion(p);if(r.angleTo(g)>Math.PI/2&&(r=(new u.Vector3).copy(r).multiplyScalar(-1)),0!==n){var b=(new u.Vector3).copy(y);b.multiplyScalar(n/b.length()),l.sub(b)}if(0!==i){var w=(new u.Vector3).crossVectors(y,l).normalize();l.applyAxisAngle(w,i)}if(null!==m&&m.shouldDraw(this)){var x=(new u.Vector3).copy(g).setLength(n);m.drawRayLocal(this,"Plane:Normal",t,x,r,new u.Color(1,1,1));var T=(new u.Vector3).copy(g).setLength(n);m.drawConeLocal(this,"Plane:Surface",t,T,r,i,new u.Color(1,0,1))}var M=(new u.Vector3).copy(r).applyQuaternion(p),S=y.angleTo(M);if(d>S)return c(f,"Error, plane normal ("+r.x+", "+r.y+", "+r.z+") too close to axis ("+g.x+", "+g.y+", "+g.z+")"),null;var C=Math.PI/2-y.angleTo(l),E=Math.tan(C),A=Math.tan(S),L=null;if(L=a?Math.PI/2*Math.max(-1,Math.min(1,E/A)):Math.asin(Math.max(-1,Math.min(1,E/A))),s&&(s._angleToAxis=v(l.angleTo(y)),s._distanceToTarget=l.length()),v(l.angleTo(y))<d)return c(f,"Error, Lookat Target local:("+l.x+", "+l.y+", "+l.z+"), world:("+o.x+", "+o.y+", "+o.z+") too close to rotated axis ("+y.x+", "+y.y+", "+y.z+")"),null;var P=(new u.Vector3).crossVectors(y,l).normalize(),F=(new u.Vector3).copy(M).projectOnPlane(y).normalize(),D=(new u.Quaternion).setFromUnitVectors(F,P),R=(new u.Vector4).setAxisAngleFromQuaternion(D),O=_(R,y),k=-(L- -Math.PI/2)+-Math.PI/2,N=O+L,B=O+k;return[N,B]},e.exports=y}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/lookat/PointADOF.js","/release_modules/ifr-motion/src/lookat")},{"../dofs/RotationControl":92,_process:5,buffer:1,"ifr-core/src/SLog":62,three:40}],110:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("ifr-core/src/SLog"),c=require("../base/AccelPlanner"),f=require("../base/Pose"),d="LOOKAT",p=function(e){var t=new f("POF Target",e),r=new f("POF Filtered",e),n=new c,o=.5,i=0,a=1e-5;this.updateByTime=function(e){var i,s,l,h,c,f,p=r.getDOFNames(),m=0;for(i=0;i<p.length;i++){s=p[i],l=r.get(s,0),h=r.get(s,1),c=t.get(s,0),f=n.computeWithFixedAccel(h,0,c-l,o);var g;f&&f.isConsistent()?g=f.getTotalTime():(u(d,"PoseOffsetFilter(tt) for "+s+" got invalid plan, using backup time of 10! (currentVel:"+h+", target:"+c+", currentPos:"+l+", acceLimit:"+o+")"),g=10),g>m&&(m=g)}for(i=0;i<p.length;i++)if(s=p[i],l=r.get(s,0),h=r.get(s,1),c=t.get(s,0),m>a)if(f=n.computeWithFixedTime(h,0,c-l,m),f&&f.isConsistent()){var y=f.displacementAtTime(e),v=f.velocityAtTime(e);r.set(s,[l+y,v])}else u(d,"PoseOffsetFilter(dp) for "+s+" got invalid plan, using backup filter! (currentVel:"+h+", target:"+c+", currentPos:"+l+", transitionTime:"+m+")"),r.set(s,[.99*l+.01*c,.96*h])},this.resetToTarget=function(){r.setPose(t)},this.resetToPose=function(e){r.setPose(e),t.setPose(e)},this.setTarget=function(e){t.setPose(e)},this.getTarget=function(e){e.setPose(t)},this.getValue=function(e){for(var t=r.getDOFNames(),n=0;n<t.length;n++){var o=t[n];e.set(o,r.get(o,0),0)}},this.getPreOffsetVelocities=function(e){for(var t=r.getDOFNames(),n=0;n<t.length;n++){var o=t[n];e.set(o,r.get(o,1),1)}},this.setRejectDeltaThreshold=function(e){i=e},this.getRejectDeltaThreshold=function(){return i},this.setAcceleration=function(e){o=e},this.applyUnfilteredOffset=function(e){for(var t=e.getDOFNames(),n=0;n<t.length;n++){var o=t[n],a=e.get(o,0);0!==i&&Math.abs(a)>i&&(u(d,"Clamping application of unfiltered offset of "+a+" to "+o+" as it is greater than "+i),a=0>a?-i:i);var s=r.get(o,0);null!==s&&(s+=a),r.set(o,s,0)}}};e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-motion/src/lookat/PoseOffsetFilter.js","/release_modules/ifr-motion/src/lookat")},{"../base/AccelPlanner":72,"../base/Pose":83,_process:5,buffer:1,"ifr-core/src/SLog":62}],111:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("../dofs/RotationControl"),require("three")),c=require("./PointADOF"),f=require("./LookatDOF"),d=function(e,t,r){f.call(this,e,t),this._control=null,this._forwardDir=r,this._transform=null,this._axis=null};d.prototype=Object.create(f.prototype),d.prototype.constructor=d,d.prototype.connectToGroup=function(e){f.prototype.connectToGroup.call(this,e),this._kinematicGroup?(this._control=this._kinematicGroup.getModelControlGroup().getControlForDOF(this._controlledDOFName),this._transform=this._kinematicGroup.getTransform(this._control.getTransformName()),this._axis=new u.Vector3,this._control.getRotationalAxis(this._axis)):(this._transform=null,this._control=null,this._axis=null)},d.prototype.valToPointAtTarget=function(e,t){return c.pointDOF(this._control,this._transform,this._forwardDir,e,t)},d.prototype.errorRatio=function(e){return this._control.isCyclic()?Math.abs(e/(2*Math.PI)):Math.abs(e/(this._control.getMax()-this._control.getMin()))},d.prototype.suggestForwardTarget=function(e){return null==this._transform?null:(e.copy(this._forwardDir),e.multiplyScalar(10),this._transform.localToWorld(e),e)},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/lookat/RotationalLookatDOF.js","/release_modules/node_modules/ifr-motion/src/lookat")},{"../dofs/RotationControl":92,"./LookatDOF":103,"./PointADOF":109,_process:5,buffer:1,three:40}],112:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=(require("../dofs/RotationControl"),require("three")),c=require("./PointADOF"),f=require("./LookatDOF"),d=require("ifr-geometry/src/ExtraMath"),p=function(e,t,r,n,o){f.call(this,e,t),this._control=null,this._planeNormal=r,this._distanceAlongDOFAxisToPlane=n,this._angleAbovePlane=o,this._transform=null};p.prototype=Object.create(f.prototype),p.prototype.constructor=p,p.prototype.connectToGroup=function(e){f.prototype.connectToGroup.call(this,e),e?(this._control=this._kinematicGroup.getModelControlGroup().getControlForDOF(this._controlledDOFName),this._transform=this._kinematicGroup.getTransform(this._control.getTransformName())):(this._transform=null,this._control=null)},p.prototype.valToPointAtTarget=function(e,t){var r=c.pointDOFToIntersectConeWithPoint(this._control,this._transform,this._planeNormal,this._distanceAlongDOFAxisToPlane,e,this._angleAbovePlane,!0,t);return r&&r.length>0?r[0]:void 0},p.prototype.errorRatio=function(e){return this._control.isCyclic()?Math.abs(e/(2*Math.PI)):Math.abs(e/(this._control.getMax()-this._control.getMin()))},p.prototype.suggestForwardTarget=function(e){if(null==this._transform)return null;var t=new u.Vector3;this._control.getRotationalAxis(t);var r=new u.Vector3;d.findOrthogonal(this._planeNormal,r);var n=new u.Vector3;n.crossVectors(r,this._planeNormal);var o=new u.Quaternion;return d.quatFromAxisAngle(n,this._angleAbovePlane,o),r.applyQuaternion(o),t.setLength(this._distanceAlongDOFAxisToPlane),r.setLength(10),e.copy(r),e.add(t),this._transform.localToWorld(r),e},e.exports=p}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-motion/src/lookat/RotationalPlaneAlignmentLookatDOF.js","/release_modules/node_modules/ifr-motion/src/lookat")},{"../dofs/RotationControl":92,"./LookatDOF":103,"./PointADOF":109,_process:5,buffer:1,"ifr-geometry/src/ExtraMath":67,three:40}],113:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=function(){var e=Date.now(),t=e,r=0,n=1/0,o=0,i=0,a=1/0,s=0,l=0,h=0,u=document.createElement("div");u.id="stats",u.addEventListener("mousedown",function(e){e.preventDefault(),v(++h%2)},!1),u.style.cssText="width:80px;opacity:0.9;cursor:pointer";var c=document.createElement("div");c.id="fps",c.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#002",u.appendChild(c);var f=document.createElement("div");f.id="fpsText",f.style.cssText="color:#0ff;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px",f.innerHTML="FPS",c.appendChild(f);var d=document.createElement("div");for(d.id="fpsGraph",d.style.cssText="position:relative;width:74px;height:30px;background-color:#0ff",c.appendChild(d);74>d.children.length;){var p=document.createElement("span");p.style.cssText="width:1px;height:30px;float:left;background-color:#113",d.appendChild(p)}var m=document.createElement("div");m.id="ms",m.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#020;display:none",u.appendChild(m);var g=document.createElement("div");g.id="msText",g.style.cssText="color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px",g.innerHTML="MS",m.appendChild(g);var y=document.createElement("div");for(y.id="msGraph",y.style.cssText="position:relative;width:74px;height:30px;background-color:#0f0",m.appendChild(y);74>y.children.length;)p=document.createElement("span"),p.style.cssText="width:1px;height:30px;float:left;background-color:#131",y.appendChild(p);var v=function(e){switch(h=e){case 0:c.style.display="block",m.style.display="none";break;case 1:c.style.display="none",m.style.display="block"}};return{REVISION:12,domElement:u,setMode:v,begin:function(){e=Date.now()},end:function(){var h=Date.now();r=h-e,n=Math.min(n,r),o=Math.max(o,r),g.textContent=r+" MS ("+n+"-"+o+")";var u=Math.min(30,30-30*(r/200));return y.appendChild(y.firstChild).style.height=u+"px",l++,h>t+1e3&&(i=Math.round(1e3*l/(h-t)),a=Math.min(a,i),s=Math.max(s,i),f.textContent=i+" FPS ("+a+"-"+s+")",u=Math.min(30,30-30*(i/100)),d.appendChild(d.firstChild).style.height=u+"px",t=h,l=0),h},update:function(){e=this.end()}}};"object"==typeof e&&(e.exports=u)}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-visualizer/node_modules/stats-js/build/stats.min.js","/release_modules/ifr-visualizer/node_modules/stats-js/build")},{_process:5,buffer:1}],114:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("./TrackballControls"),c=require("three"),f=require("stats-js"),d=function(e,t,r,n){if(this._container=void 0!==e?e:null,this._container){var o=this._container.getBoundingClientRect();this._width=o.width,this._height=o.height}else this._width=100,this._height=100;this._camera=new c.PerspectiveCamera(60,this._width/this._height,.1,1e3),this._camera.position.z=20,this._scene=new c.Scene,this._ambientLight=new c.AmbientLight(4210752),this._scene.add(this._ambientLight),this._directionalLight=new c.DirectionalLight(16777215,.5),this._directionalLight.position.set(-1,1,1),this._scene.add(this._directionalLight),this._renderer=new c.WebGLRenderer({antialias:!0}),this._renderer.setSize(this._width,this._height),n&&this._renderer.setClearColor(n),this._container&&this._container.appendChild(this._renderer.domElement),this._renderCallbacks=[],this._postRenderCallbacks=[],this._controls=null,t&&this.installTrackballControls(),this._stats=null,r&&this.installStats();var i=this;this._doPlay=function(){i.play()}};d.prototype.installTrackballControls=function(){null===this._controls&&(this._controls=new u(this._camera,this._container),this._controls.rotateSpeed=1,this._controls.zoomSpeed=1.2,this._controls.panSpeed=1,this._controls.noZoom=!1,this._controls.noPan=!1,this._controls.staticMoving=!0,this._controls.dynamicDampingFactor=.3,this._controls.keys=[65,83,68])},d.prototype.removeTrackballControls=function(){null!==this._controls&&(this._controls.dispose(),this._controls=null)},d.prototype.installStats=function(){this._stats=new f,this._stats.domElement.style.position="absolute",this._stats.domElement.style.top="0px",this._stats.domElement.style.zIndex=100,this._container&&this._container.appendChild(this._stats.domElement)},d.prototype.handleResize=function(){if(this._container){var e=this._container.getBoundingClientRect();(e.width!==this._width||e.height!==this._height)&&(this._width=e.width,this._height=e.height,this._camera.aspect=this._width/this._height,this._camera.updateProjectionMatrix(),this._renderer.setSize(this._width,this._height),null!==this._controls&&this._controls.handleResize())}},d.prototype.detachFromContainer=function(){this.stop(),this._container&&(this._container.removeChild(this._renderer.domElement),this._controls&&this._controls.detachFromContainer(),this._stats&&this._container.removeChild(this._stats.domElement),this._container=null)},d.prototype.attachToContainer=function(e){if(this._container&&this.detachFromContainer(),this._container=void 0!==e?e:null,this._container){var t=this._container.getBoundingClientRect();this._width=t.width,this._height=t.height,this._camera.aspect=this._width/this._height,this._camera.updateProjectionMatrix(),this._renderer.setSize(this._width,this._height),this._renderer.domElement=document.adoptNode(this._renderer.domElement),this._container.appendChild(this._renderer.domElement),this._controls&&this._controls.attachToContainer(this._container),this._stats&&(this._stats.domElement=document.adoptNode(this._stats.domElement),this._container.appendChild(this._stats.domElement))}},d.prototype.dispose=function(){this.detachFromContainer(),this._camera=null,this._scene=null,this._ambientLight=null,this._directionalLight=null,this._renderer=null,this._renderCallbacks=null,this._postRenderCallbacks=null,this._controls=null,this._stats=null},d.prototype.getContainer=function(){return this._container},d.prototype.getCamera=function(){return this._camera},d.prototype.getScene=function(){return this._scene},d.prototype.getAmbientLight=function(){return this._ambientLight},d.prototype.getDirectionalLight=function(){return this._directionalLight},d.prototype.getRenderer=function(){return this._renderer},d.prototype.getTrackballControls=function(){return this._controls},d.prototype.getStats=function(){return this._stats},d.prototype.addRenderCallback=function(e){this._renderCallbacks.push(e)},d.prototype.removeRenderCallback=function(e){var t=this._renderCallbacks.indexOf(e);t>-1&&this._renderCallbacks.splice(t,1)},d.prototype.addPostRenderCallback=function(e){this._postRenderCallbacks.push(e)},d.prototype.removePostRenderCallback=function(e){var t=this._postRenderCallbacks.indexOf(e);t>-1&&this._postRenderCallbacks.splice(t,1)},d.prototype.render=function(){this.handleResize(),null!==this._controls&&this._controls.update();for(var e=0;e<this._renderCallbacks.length;e++)this._renderCallbacks[e]();for(this._renderer.render(this._scene,this._camera),e=0;e<this._postRenderCallbacks.length;e++)this._postRenderCallbacks[e]();null!==this._stats&&this._stats.update()},d.prototype.play=function(){this._requestHandle=window.requestAnimationFrame(this._doPlay),this.render()},d.prototype.stop=function(){void 0!==this._requestHandle&&window.cancelAnimationFrame(this._requestHandle)},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/node_modules/ifr-visualizer/src/BasicScene.js","/release_modules/node_modules/ifr-visualizer/src")},{"./TrackballControls":118,_process:5,buffer:1,"stats-js":113,three:40}],115:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c=function(e,t){(void 0===t||null===t)&&(t=100),this.maxLines=t,this.numTempLines=0,this.unusedVec=new u.Vector3(1e6,1e6,1e6),this.unusedColor=new u.Color(1,1,1),this.lineMaterial=new u.LineBasicMaterial({vertexColors:u.VertexColors}),this.lineGeometry=new u.Geometry;for(var r=0;r<this.maxLines;r++)this.lineGeometry.vertices.push((new u.Vector3).copy(this.unusedVec)),this.lineGeometry.vertices.push((new u.Vector3).copy(this.unusedVec)),this.lineGeometry.colors.push((new u.Color).copy(this.unusedColor)),this.lineGeometry.colors.push((new u.Color).copy(this.unusedColor));this.line=new u.Line(this.lineGeometry,this.lineMaterial,u.LinePieces),this.line.frustumCulled=!1,this.lineMaterial.linewidth=1,this.postRenderCallbackInstalled=null,this.addedToScene=null,void 0!==e&&this.addToScene(e)};c.prototype.addToScene=function(e){e.getScene().add(this.line),this.postRenderCallbackInstalled=this.postRenderCleanup.bind(this),this.addedToScene=e,e.addPostRenderCallback(this.postRenderCallbackInstalled)},c.prototype.removeFromScene=function(){null!=this.addedToScene&&(this.addedToScene.getScene().remove(this.line),this.addedToScene.removePostRenderCallback(this.postRenderCallbackInstalled),this.addedToScene=null,this.postRenderCallbackInstalled=null)},c.prototype.drawOnce=function(e,t,r){this.numTempLines<this.maxLines&&(this.lineGeometry.vertices[2*this.numTempLines].copy(e),this.lineGeometry.vertices[2*this.numTempLines+1].copy(t),this.lineGeometry.verticesNeedUpdate=!0,void 0!==r&&(this.lineGeometry.colors[2*this.numTempLines].copy(r),this.lineGeometry.colors[2*this.numTempLines+1].copy(r),this.lineGeometry.colorsNeedUpdate=!0),this.numTempLines++)},c.prototype.setLineWidth=function(e){return this.lineMaterial.linewidth=e,this},c.prototype.postRenderCleanup=function(){if(this.numTempLines>0){for(var e=0;e<this.numTempLines;e++)this.lineGeometry.vertices[2*e].copy(this.unusedVec),this.lineGeometry.vertices[2*e+1].copy(this.unusedVec),this.lineGeometry.colors[2*e].copy(this.unusedColor),this.lineGeometry.colors[2*e+1].copy(this.unusedColor);this.lineGeometry.verticesNeedUpdate=!0,this.lineGeometry.colorsNeedUpdate=!0,this.numTempLines=0}},e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-visualizer/src/GLLinePool.js","/release_modules/ifr-visualizer/src")},{_process:5,buffer:1,three:40}],116:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c=require("ifr-core/src/SLog"),f="MOUSE_COORD_WRANGLER",d={};d.getOffsetRect=function(e){var t=e.getBoundingClientRect(),r=document.body,n=document.documentElement,o=window.pageYOffset||n.scrollTop||r.scrollTop,i=window.pageXOffset||n.scrollLeft||r.scrollLeft,a=n.clientTop||r.clientTop||0,s=n.clientLeft||r.clientLeft||0,l=t.top+o-a,h=t.left+i-s;return{top:Math.round(l),left:Math.round(h),width:Math.round(t.width),height:Math.round(t.height)}},d.getLocalCoordinates=function(e,t){var r=d.getOffsetRect(t);return{x:e.pageX-r.left,y:e.pageY-r.top}},d.getLocalCoordinatesNDC=function(e,t){var r=d.getOffsetRect(t);return{x:(e.pageX-r.left)/r.width,y:1-(e.pageY-r.top)/r.height}},d.getLocalCoordinatesNDCCentered=function(e,t){var r=d.getOffsetRect(t);return{x:(e.pageX-r.left)/r.width*2-1,y:2*(1-(e.pageY-r.top)/r.height)-1}},d.unprojectScreenToPlane=function(e,t,r,n,o){var i=new u.Vector3(e,t,0),a=new u.Vector3(e,t,1);i.unproject(r),a.unproject(r);var s=a.sub(i),l=i;s.normalize();var h=(new u.Vector3).copy(n).sub(l),d=s.dot(o);if(Math.abs(d)<1e-4)return void c(f,"un-project error, no intersection");var p=h.dot(o)/s.dot(o);return 0>p?void c(f,"error, intersection behind camera"):l.add(s.multiplyScalar(p))},d.unprojectEventToPlane=function(e,t,r,n,o){var i=d.getLocalCoordinatesNDCCentered(e,t);return void 0===n&&(n=new u.Vector3(0,0,0)),void 0===o&&(o=new u.Vector3(0,1,0)),d.unprojectScreenToPlane(i.x,i.y,r,n,o)},e.exports=d}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/ifr-visualizer/src/MouseCoordinateWrangler.js","/release_modules/animation-utilities/node_modules/ifr-visualizer/src")},{_process:5,buffer:1,"ifr-core/src/SLog":62,three:40}],117:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c=require("./MouseCoordinateWrangler"),f=require("./ViewportTargetPositioner"),d=(require("./GLLinePool"),require("ifr-core/src/SLog")),p="UI_TARGET",m=function(e,t,r,n,o,i){null==r&&(r=new u.Vector3(0,0,0)),null==n&&(n=new u.Vector3(0,0,0)),null==o&&(o=new u.Vector3(0,1,0)),null==i&&(i=["default"]);var a=[],s=new Map,l=null,h=!0,m=null,g=null,y=null,v=null,_=function(t){t.preventDefault(),t.stopPropagation();var r=c.getLocalCoordinatesNDCCentered(t,e);if(null!=l){var n=s.get(l);null!=n&&(g(t)?n.moveToNDCPoint(r.x,r.y,!0):y(t)&&n.moveToNDCPoint(r.x,r.y,!1))}},b=function(e){m(e)&&_(e)},w=!0,x=function(e){var t=function(t){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(t){w?(document.removeEventListener("mousemove",b,h),document.removeEventListener("mouseup",x,h)):(e.removeEventListener("mousemove",b,h),e.removeEventListener("mouseup",x,h),e.removeEventListener("mouseleave",x,h))});e.addEventListener("mousedown",function(t){m(t)&&(_(t),w?(document.addEventListener("mousemove",b,h),document.addEventListener("mouseup",x,h)):(e.addEventListener("mousemove",b,h),e.addEventListener("mouseup",x,h),e.addEventListener("mouseleave",x,h)))},h),this.setMouseFilters=function(e,t,r){m=null!=e?e:function(e){return!e.altKey&&!e.metaKey&&!e.ctrlKey},g=null!=t?t:function(e){return e.shiftKey},y=null!=r?r:function(e){return!e.shiftKey}},this.addPositionChangedCallback=function(e){var t=a.indexOf(e);0>t&&a.push(e)},this.removePositionChangedCallback=function(e){var t=a.indexOf(e);t>-1&&a.splice(t,1)},this.notifyPositionChangedCallbacks=function(e,t){for(var r=0;r<a.length;r++)a[r](e,t)},this.addTargetPositioner=function(e,i){if(s.has(e))d(p,"Not adding MouseTargetPositioner target "+e+", already have target with that name");else{null==i&&(i=r);var a=new f(e,t,i,n,o);a.addPositionChangedCallback(this.notifyPositionChangedCallbacks),null!==v&&a.installRendererIntoScene(v),s.set(e,a),null===l?(l=e,a.setHighlighted(!0)):a.setHighlighted(!1)}},this.removeTargetPositioner=function(e){if(s.has(e)){var t=s.get(e);null!==v&&t.removeRendererFromScene(v),t.removePositionChangedCallback(this.notifyPositionChangedCallbacks),s["delete"](e),l===e&&(l=null)}},this.getTargetPositionerNames=function(){return Array.from(s.keys())},this.selectTarget=function(e){if(null!=l){var t=s.get(l);null!=t&&t.setHighlighted(!1)}if(null!=e){var r=s.get(e);null!=r&&r.setHighlighted(!0)}l=e},this.installRendererIntoScene=function(e){if(null!==v)throw new Error("Remove MTP renderer from existing scene before installing in another!");var t=!0,r=!1,n=void 0;try{for(var o,i=s.values()[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;a.installRendererIntoScene(e)}}catch(l){r=!0,n=l}finally{try{!t&&i["return"]&&i["return"]()}finally{if(r)throw n}}v=e},this.removeRendererFromScene=function(e){var t=!0,r=!1,n=void 0;try{for(var o,i=s.values()[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;a.removeRendererFromScene(e)}}catch(l){r=!0,n=l}finally{try{!t&&i["return"]&&i["return"]()}finally{if(r)throw n}}v=null},this.setMouseFilters();var T=!0,M=!1,S=void 0;try{for(var C,E=i[Symbol.iterator]();!(T=(C=E.next()).done);T=!0){var A=C.value;this.addTargetPositioner(A)}}catch(L){M=!0,S=L}finally{try{!T&&E["return"]&&E["return"]()}finally{if(M)throw S}}};e.exports=m}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/animation-utilities/node_modules/ifr-visualizer/src/MouseTargetPositioner.js","/release_modules/animation-utilities/node_modules/ifr-visualizer/src")},{"./GLLinePool":115,"./MouseCoordinateWrangler":116,"./ViewportTargetPositioner":119,_process:5,buffer:1,"ifr-core/src/SLog":62,three:40}],118:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c=function(e,t){function r(e){d.enabled!==!1&&(window.removeEventListener("keydown",r),v=y,y===p.NONE&&(e.keyCode!==d.keys[p.ROTATE]||d.noRotate?e.keyCode!==d.keys[p.ZOOM]||d.noZoom?e.keyCode!==d.keys[p.PAN]||d.noPan||(y=p.PAN):y=p.ZOOM:y=p.ROTATE));
}function n(e){d.enabled!==!1&&(y=v,window.addEventListener("keydown",r,!1))}function o(e){d.enabled!==!1&&(e.preventDefault(),e.stopPropagation(),y===p.NONE&&(y=e.button,0===e.button&&e.shiftKey&&(y=p.PAN)),y!==p.ROTATE||d.noRotate?y!==p.ZOOM||d.noZoom?y!==p.PAN||d.noPan||(C.copy(F(e.pageX,e.pageY)),E.copy(C)):(x.copy(F(e.pageX,e.pageY)),T.copy(x)):(b.copy(D(e.pageX,e.pageY)),w.copy(b)),document.addEventListener("mousemove",i,!1),document.addEventListener("mouseup",a,!1),d.dispatchEvent(L))}function i(e){d.enabled!==!1&&(e.preventDefault(),e.stopPropagation(),y!==p.ROTATE||d.noRotate?y!==p.ZOOM||d.noZoom?y!==p.PAN||d.noPan||E.copy(F(e.pageX,e.pageY)):T.copy(F(e.pageX,e.pageY)):w.copy(D(e.pageX,e.pageY)))}function a(e){d.enabled!==!1&&(e.preventDefault(),e.stopPropagation(),y=p.NONE,document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",a),d.dispatchEvent(P))}function s(e){if(d.enabled!==!1){e.preventDefault(),e.stopPropagation();var t=0;e.wheelDelta?t=e.wheelDelta/40:e.detail&&(t=-e.detail/3),x.y+=.01*t,d.dispatchEvent(L),d.dispatchEvent(P)}}function l(e){if(d.enabled!==!1){switch(e.touches.length){case 1:y=p.TOUCH_ROTATE,b.copy(D(e.touches[0].pageX,e.touches[0].pageY)),w.copy(b);break;case 2:y=p.TOUCH_ZOOM_PAN;var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;S=M=Math.sqrt(t*t+r*r);var n=(e.touches[0].pageX+e.touches[1].pageX)/2,o=(e.touches[0].pageY+e.touches[1].pageY)/2;C.copy(F(n,o)),E.copy(C);break;default:y=p.NONE}d.dispatchEvent(L)}}function h(e){if(d.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:w.copy(D(e.touches[0].pageX,e.touches[0].pageY));break;case 2:var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;S=Math.sqrt(t*t+r*r);var n=(e.touches[0].pageX+e.touches[1].pageX)/2,o=(e.touches[0].pageY+e.touches[1].pageY)/2;E.copy(F(n,o));break;default:y=p.NONE}}function c(e){if(d.enabled!==!1){switch(e.touches.length){case 1:w.copy(D(e.touches[0].pageX,e.touches[0].pageY)),b.copy(w);break;case 2:M=S=0;var t=(e.touches[0].pageX+e.touches[1].pageX)/2,r=(e.touches[0].pageY+e.touches[1].pageY)/2;E.copy(F(t,r)),C.copy(E)}y=p.NONE,d.dispatchEvent(P)}}function f(e){e.preventDefault()}var d=this,p={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=e,this.domElement=null,this.enabled=!1,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.noRoll=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new u.Vector3;var m=1e-6,g=new u.Vector3,y=p.NONE,v=p.NONE,_=new u.Vector3,b=new u.Vector3,w=new u.Vector3,x=new u.Vector2,T=new u.Vector2,M=0,S=0,C=new u.Vector2,E=new u.Vector2;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var A={type:"change"},L={type:"start"},P={type:"end"};this.handleResize=function(){if(d.enabled!==!1)if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}},this.handleEvent=function(e){"function"==typeof this[e.type]&&this[e.type](e)};var F=function(){var e=new u.Vector2;return function(t,r){return e.set((t-d.screen.left)/d.screen.width,(r-d.screen.top)/d.screen.height),e}}(),D=function(){var e=new u.Vector3,t=new u.Vector3,r=new u.Vector3;return function(n,o){r.set((n-.5*d.screen.width-d.screen.left)/(.5*d.screen.width),(.5*d.screen.height+d.screen.top-o)/(.5*d.screen.height),0);var i=r.length();return d.noRoll?i<Math.SQRT1_2?r.z=Math.sqrt(1-i*i):r.z=.5/i:i>1?r.normalize():r.z=Math.sqrt(1-i*i),_.copy(d.object.position).sub(d.target),e.copy(d.object.up).setLength(r.y),e.add(t.copy(d.object.up).cross(_).setLength(r.x)),e.add(_.setLength(r.z)),e}}();this.rotateCamera=function(){var e=new u.Vector3,t=new u.Quaternion;return function(){var r=Math.acos(b.dot(w)/b.length()/w.length());r&&(e.crossVectors(b,w).normalize(),r*=d.rotateSpeed,t.setFromAxisAngle(e,-r),_.applyQuaternion(t),d.object.up.applyQuaternion(t),w.applyQuaternion(t),d.staticMoving?b.copy(w):(t.setFromAxisAngle(e,r*(d.dynamicDampingFactor-1)),b.applyQuaternion(t)))}}(),this.zoomCamera=function(){if(y===p.TOUCH_ZOOM_PAN){var e=M/S;M=S,_.multiplyScalar(e)}else{var e=1+(T.y-x.y)*d.zoomSpeed;1!==e&&e>0&&(_.multiplyScalar(e),d.staticMoving?x.copy(T):x.y+=(T.y-x.y)*this.dynamicDampingFactor)}},this.panCamera=function(){var e=new u.Vector2,t=new u.Vector3,r=new u.Vector3;return function(){e.copy(E).sub(C),e.lengthSq()&&(e.multiplyScalar(_.length()*d.panSpeed),r.copy(_).cross(d.object.up).setLength(e.x),r.add(t.copy(d.object.up).setLength(e.y)),d.object.position.add(r),d.target.add(r),d.staticMoving?C.copy(E):C.add(e.subVectors(E,C).multiplyScalar(d.dynamicDampingFactor)))}}(),this.checkDistances=function(){d.noZoom&&d.noPan||(_.lengthSq()>d.maxDistance*d.maxDistance&&d.object.position.addVectors(d.target,_.setLength(d.maxDistance)),_.lengthSq()<d.minDistance*d.minDistance&&d.object.position.addVectors(d.target,_.setLength(d.minDistance)))},this.update=function(){_.subVectors(d.object.position,d.target),d.noRotate||d.rotateCamera(),d.noZoom||d.zoomCamera(),d.noPan||d.panCamera(),d.object.position.addVectors(d.target,_),d.checkDistances(),d.object.lookAt(d.target),g.distanceToSquared(d.object.position)>m&&(d.dispatchEvent(A),g.copy(d.object.position))},this.reset=function(){y=p.NONE,v=p.NONE,d.target.copy(d.target0),d.object.position.copy(d.position0),d.object.up.copy(d.up0),_.subVectors(d.object.position,d.target),d.object.lookAt(d.target),d.dispatchEvent(A),g.copy(d.object.position)},this.detachFromContainer=function(){d.domElement&&(d.domElement.removeEventListener("contextmenu",f,!1),d.domElement.removeEventListener("mousedown",o,!1),d.domElement.removeEventListener("mousewheel",s,!1),d.domElement.removeEventListener("DOMMouseScroll",s,!1),d.domElement.removeEventListener("touchstart",l,!1),d.domElement.removeEventListener("touchend",c,!1),d.domElement.removeEventListener("touchmove",h,!1)),window.removeEventListener("keydown",r,!1),window.removeEventListener("keyup",n,!1),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",a),y=p.NONE,d.enabled=!1,d.domElement=null},this.dispose=function(){d.detachFromContainer()},this.destroy=function(){d.dispose()},this.attachToContainer=function(e){d.domElement&&d.detachFromContainer(),d.domElement=void 0!==e?e:document,d.domElement&&(d.domElement.addEventListener("contextmenu",f,!1),d.domElement.addEventListener("mousedown",o,!1),d.domElement.addEventListener("mousewheel",s,!1),d.domElement.addEventListener("DOMMouseScroll",s,!1),d.domElement.addEventListener("touchstart",l,!1),d.domElement.addEventListener("touchend",c,!1),d.domElement.addEventListener("touchmove",h,!1),window.addEventListener("keydown",r,!1),window.addEventListener("keyup",n,!1),d.enabled=!0,d.handleResize(),d.update())},this.attachToContainer(t)};c.prototype=Object.create(u.EventDispatcher.prototype),e.exports=c}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-visualizer/src/TrackballControls.js","/release_modules/ifr-visualizer/src")},{_process:5,buffer:1,three:40}],119:[function(require,e,exports){(function(t,r,n,o,i,a,s,l,h){var u=require("three"),c=require("./MouseCoordinateWrangler"),f=require("./GLLinePool"),d=require("ifr-core/src/SLog"),p="UI_TARGET",m=function(e,t,r,n,o){this._name=e,this._camera=t,this._initialPosition=r,null==this._initialPosition&&(this._initialPosition=new u.Vector3(0,0,0)),this._pointOnGroundPlane=n,null==this._pointOnGroundPlane&&(this._pointOnGroundPlane=new u.Vector3(0,0,0)),this._groundPlaneNormal=o,null==this._groundPlaneNormal&&(this._groundPlaneNormal=new u.Vector3(0,1,0)),this._lastPosition=(new u.Vector3).copy(this._initialPosition),this._positionChangedListeners=[],this._linePool=null,this._renderCallback=null,this._isHighlighted=!0};m.prototype.moveToNDCPoint=function(e,t,r){var n;if(r){var o=c.unprojectScreenToPlane(e,t,this._camera,this._pointOnGroundPlane,this._groundPlaneNormal);null!=o?n=(new u.Vector3).copy(this._lastPosition).projectOnVector(this._groundPlaneNormal).add(o):d(p,"ViewportTargetPositioner: ground point not computed, not moving target point")}else{var i=new u.Vector3(0,0,-1),a=i.applyMatrix4(this._camera.matrixWorld),s=a.sub(this._camera.position);s.projectOnPlane(this._groundPlaneNormal);var l=this._lastPosition;s.lengthSq()<.001?(d(p,"ViewportTargetPositioner: degenerate angle, not moving target point"),n=void 0):(s.normalize(),n=c.unprojectScreenToPlane(e,t,this._camera,l,s))}void 0!==n&&(this._lastPosition.copy(n),this._notifyPositionChangedCallbacks(n))},m.prototype.installRendererIntoScene=function(e){if(null!=this._linePool||null!=this._renderCallback)throw new Error("Remove VTP renderer from existing scene before installing in another!");this._linePool=new f(e,10);var t=this;this._renderCallback=function(){var e;t._isHighlighted?(t._linePool.setLineWidth(2),e=1):(t._linePool.setLineWidth(.5),e=.5);var r=t._lastPosition,n=.05;t._linePool.drawOnce((new u.Vector3).copy(r).add(new u.Vector3(n,0,0)),(new u.Vector3).copy(r).sub(new u.Vector3(n,0,0)),new u.Color(1*e,0,0)),t._linePool.drawOnce((new u.Vector3).copy(r).add(new u.Vector3(0,n,0)),(new u.Vector3).copy(r).sub(new u.Vector3(0,n,0)),new u.Color(0,1*e,0)),t._linePool.drawOnce((new u.Vector3).copy(r).add(new u.Vector3(0,0,n)),(new u.Vector3).copy(r).sub(new u.Vector3(0,0,n)),new u.Color(.2*e,.2*e,1*e));var o=(new u.Vector3).copy(r).projectOnPlane(t._groundPlaneNormal);t._linePool.drawOnce((new u.Vector3).copy(o).add(new u.Vector3(n,n,0)),(new u.Vector3).copy(o).sub(new u.Vector3(n,n,0)),new u.Color(1*e,0,1*e)),t._linePool.drawOnce((new u.Vector3).copy(o).add(new u.Vector3(n,-n,0)),(new u.Vector3).copy(o).sub(new u.Vector3(n,-n,0)),new u.Color(1*e,0,1*e)),t._linePool.drawOnce(o,r,new u.Color(1*e,0,1*e))},e.addRenderCallback(this._renderCallback)},m.prototype.removeRendererFromScene=function(e){null!=this._linePool&&this._linePool.removeFromScene(e),null!=this._renderCallback&&e.removeRenderCallback(this._renderCallback),this._linePool=null,this._renderCallback=null},m.prototype.getPosition=function(e){return null==e&&(e=new u.Vector3),e.copy(this._lastPosition),e},m.prototype.addPositionChangedCallback=function(e){var t=this._positionChangedListeners.indexOf(e);0>t&&this._positionChangedListeners.push(e)},m.prototype.removePositionChangedCallback=function(e){var t=this._positionChangedListeners.indexOf(e);t>-1&&this._positionChangedListeners.splice(t,1)},m.prototype._notifyPositionChangedCallbacks=function(e){for(var t=0;t<this._positionChangedListeners.length;t++)this._positionChangedListeners[t](e,this._name)},m.prototype.setHighlighted=function(e){this._isHighlighted=e},m.prototype.getName=function(){return this._name},e.exports=m}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/release_modules/ifr-visualizer/src/ViewportTargetPositioner.js","/release_modules/ifr-visualizer/src")},{"./GLLinePool":115,"./MouseCoordinateWrangler":116,_process:5,buffer:1,"ifr-core/src/SLog":62,three:40}]},{},[41])(41)});