!function(e){var t={};function i(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t,a){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(a,n,function(t){return e[t]}.bind(null,n));return a},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=3842)}([function(e,t,i){"use strict";e.exports=i(79)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e){return e&&e.__esModule?e:{default:e}}(i(1008));t.default=a.default},function(e,t,i){"use strict";t.__esModule=!0;var a=o(i(1003)),n=o(i(101)),r=o(i(464));function o(e){return e&&e.__esModule?e:{default:e}}var s=(0,a.default)(function(e,t){return!(0,n.default)(e,t)});t.default=(0,r.default)(s,"pure",!0,!0)},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t){e.exports=function(e){for(var t=1;t=0;s--)(n=e[s])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o}function u(e,t){return function(i,a){t(i,a,e)}}function f(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,i,a){return new(i||(i=Promise))(function(n,r){function o(e){try{u(a.next(e))}catch(e){r(e)}}function s(e){try{u(a.throw(e))}catch(e){r(e)}}function u(e){e.done?n(e.value):new i(function(t){t(e.value)}).then(o,s)}u((a=a.apply(e,t||[])).next())})}function c(e,t){var i,a,n,r,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,a&&(n=a[2&r[0]?"return":r[0]?"throw":"next"])&&!(n=n.call(a,r[1])).done)return n;switch(a=0,n&&(r=[0,n.value]),r[0]){case 0:case 1:n=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,a=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===r[0]||2===r[0])){o=0;continue}if(3===r[0]&&(!n||r[1]>n[0]&&r[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}}}function p(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var a,n,r=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(a=r.next()).done;)o.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return o}function m(){for(var e=[],t=0;t1||s(e,t)})})}function s(e,t){try{!function(e){e.value instanceof v?Promise.resolve(e.value.v).then(u,f):l(r[0][2],e)}(n[e](t))}catch(e){l(r[0][3],e)}}function u(e){s("next",e)}function f(e){s("throw",e)}function l(e,t){e(t),r.shift(),r.length&&s(r[0][0],r[0][1])}}function g(e){var t,i;return t={},a("next"),a("throw",function(e){throw e}),a("return"),t[Symbol.iterator]=function(){return this},t;function a(a,n){e[a]&&(t[a]=function(t){return(i=!i)?{value:v(e[a](t)),done:"return"===a}:n?n(t):t})}}function y(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator];return t?t.call(e):d(e)}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function x(e){return e&&e.__esModule?e:{default:e}}},function(e,t,i){!function(e){"use strict";function t(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i>=4,i[n]=t[19===n?3&e|8:e]);return i.join("")}}(),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,i,a,n){return a+(e-t)*(n-a)/(i-t)},lerp:function(e,t,i){return(1-i)*e+i*t},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*lt.DEG2RAD},radToDeg:function(e){return e*lt.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}};function ct(e,t){this.x=e||0,this.y=t||0}function ht(e,t,i,a,n,r,o,s,u,f){Object.defineProperty(this,"id",{value:pt()}),this.uuid=lt.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==e?e:ht.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:ht.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:ce,this.wrapT=void 0!==a?a:ce,this.magFilter=void 0!==n?n:be,this.minFilter=void 0!==r?r:ye,this.anisotropy=void 0!==u?u:1,this.format=void 0!==o?o:De,this.type=void 0!==s?s:_e,this.offset=new ct(0,0),this.repeat=new ct(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==f?f:tt,this.version=0,this.onUpdate=null}ct.prototype={constructor:ct,isVector2:!0,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},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)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(i,a){return void 0===e&&(e=new ct,t=new ct),e.set(i,i),t.set(a,a),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i)},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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},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,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var i=Math.cos(t),a=Math.sin(t),n=this.x-e.x,r=this.y-e.y;return this.x=n*i-r*a+e.x,this.y=n*a+r*i+e.y,this}},ht.DEFAULT_IMAGE=void 0,ht.DEFAULT_MAPPING=300,ht.prototype={constructor:ht,isTexture:!0,set needsUpdate(e){!0===e&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var t={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var i=this.image;void 0===i.uuid&&(i.uuid=lt.generateUUID()),void 0===e.images[i.uuid]&&(e.images[i.uuid]={uuid:i.uuid,url:function(e){var t;return void 0!==e.toDataURL?t=e:((t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}(i)}),t.image=i.uuid}return e.textures[this.uuid]=t,t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300===this.mapping){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case le:e.x=e.x-Math.floor(e.x);break;case ce:e.x=e.x<0?0:1;break;case he:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case le:e.y=e.y-Math.floor(e.y);break;case ce:e.y=e.y<0?0:1;break;case he:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},Object.assign(ht.prototype,t.prototype);var dt=0;function pt(){return dt++}function mt(e,t,i,a){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==a?a:1}function vt(e,t,i){this.uuid=lt.generateUUID(),this.width=e,this.height=t,this.scissor=new mt(0,0,e,t),this.scissorTest=!1,this.viewport=new mt(0,0,e,t),void 0===(i=i||{}).minFilter&&(i.minFilter=be),this.texture=new ht(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function bt(e,t,i){vt.call(this,e,t,i),this.activeCubeFace=0,this.activeMipMapLevel=0}function gt(e,t,i,a){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==a?a:1}function yt(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}function wt(){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.")}function _t(e,t,i,a,n,r,o,s,u,f){e=void 0!==e?e:[],t=void 0!==t?t:ie,ht.call(this,e,t,i,a,n,r,o,s,u,f),this.flipY=!1}mt.prototype={constructor:mt,isVector4:!0,set:function(e,t,i,a){return this.x=e,this.y=t,this.z=i,this.w=a,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},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)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,i=this.y,a=this.z,n=this.w,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*a+r[12]*n,this.y=r[1]*t+r[5]*i+r[9]*a+r[13]*n,this.z=r[2]*t+r[6]*i+r[10]*a+r[14]*n,this.w=r[3]*t+r[7]*i+r[11]*a+r[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(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,i,a,n,r=e.elements,o=r[0],s=r[4],u=r[8],f=r[1],l=r[5],c=r[9],h=r[2],d=r[6],p=r[10];if(Math.abs(s-f)<.01&&Math.abs(u-h)<.01&&Math.abs(c-d)<.01){if(Math.abs(s+f)<.1&&Math.abs(u+h)<.1&&Math.abs(c+d)<.1&&Math.abs(o+l+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,v=(l+1)/2,b=(p+1)/2,g=(s+f)/4,y=(u+h)/4,w=(c+d)/4;return m>v&&m>b?m<.01?(i=0,a=.707106781,n=.707106781):(i=Math.sqrt(m),a=g/i,n=y/i):v>b?v<.01?(i=.707106781,a=0,n=.707106781):(a=Math.sqrt(v),i=g/a,n=w/a):b<.01?(i=.707106781,a=.707106781,n=0):(n=Math.sqrt(b),i=y/n,a=w/n),this.set(i,a,n,t),this}var _=Math.sqrt((d-c)*(d-c)+(u-h)*(u-h)+(f-s)*(f-s));return Math.abs(_)<.001&&(_=1),this.x=(d-c)/_,this.y=(u-h)/_,this.z=(f-s)/_,this.w=Math.acos((o+l+p-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(i,a){return void 0===e&&(e=new mt,t=new mt),e.set(i,i,i,i),t.set(a,a,a,a),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){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},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,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},Object.assign(vt.prototype,t.prototype,{isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),bt.prototype=Object.create(vt.prototype),bt.prototype.constructor=bt,bt.prototype.isWebGLRenderTargetCube=!0,gt.prototype={constructor:gt,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,i,a){return this._x=e,this._y=t,this._z=i,this._w=a,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!1===(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=Math.cos(e._x/2),a=Math.cos(e._y/2),n=Math.cos(e._z/2),r=Math.sin(e._x/2),o=Math.sin(e._y/2),s=Math.sin(e._z/2),u=e.order;return"XYZ"===u?(this._x=r*a*n+i*o*s,this._y=i*o*n-r*a*s,this._z=i*a*s+r*o*n,this._w=i*a*n-r*o*s):"YXZ"===u?(this._x=r*a*n+i*o*s,this._y=i*o*n-r*a*s,this._z=i*a*s-r*o*n,this._w=i*a*n+r*o*s):"ZXY"===u?(this._x=r*a*n-i*o*s,this._y=i*o*n+r*a*s,this._z=i*a*s+r*o*n,this._w=i*a*n-r*o*s):"ZYX"===u?(this._x=r*a*n-i*o*s,this._y=i*o*n+r*a*s,this._z=i*a*s-r*o*n,this._w=i*a*n+r*o*s):"YZX"===u?(this._x=r*a*n+i*o*s,this._y=i*o*n+r*a*s,this._z=i*a*s-r*o*n,this._w=i*a*n-r*o*s):"XZY"===u&&(this._x=r*a*n-i*o*s,this._y=i*o*n-r*a*s,this._z=i*a*s+r*o*n,this._w=i*a*n+r*o*s),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,a=Math.sin(i);return this._x=e.x*a,this._y=e.y*a,this._z=e.z*a,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,a=i[0],n=i[4],r=i[8],o=i[1],s=i[5],u=i[9],f=i[2],l=i[6],c=i[10],h=a+s+c;return h>0?(t=.5/Math.sqrt(h+1),this._w=.25/t,this._x=(l-u)*t,this._y=(r-f)*t,this._z=(o-n)*t):a>s&&a>c?(t=2*Math.sqrt(1+a-s-c),this._w=(l-u)/t,this._x=.25*t,this._y=(n+o)/t,this._z=(r+f)/t):s>c?(t=2*Math.sqrt(1+s-a-c),this._w=(r-f)/t,this._x=(n+o)/t,this._y=.25*t,this._z=(u+l)/t):(t=2*Math.sqrt(1+c-a-s),this._w=(o-n)/t,this._x=(r+f)/t,this._y=(u+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t;return function(i,a){return void 0===e&&(e=new yt),(t=i.dot(a)+1)<1e-6?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,a),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(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)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var i=e._x,a=e._y,n=e._z,r=e._w,o=t._x,s=t._y,u=t._z,f=t._w;return this._x=i*f+r*o+a*u-n*s,this._y=a*f+r*s+n*o-i*u,this._z=n*f+r*u+i*s-a*o,this._w=r*f-i*o-a*s-n*u,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,a=this._y,n=this._z,r=this._w,o=r*e._w+i*e._x+a*e._y+n*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=r,this._x=i,this._y=a,this._z=n,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(r+this._w),this._x=.5*(i+this._x),this._y=.5*(a+this._y),this._z=.5*(n+this._z),this;var u=Math.atan2(s,o),f=Math.sin((1-t)*u)/s,l=Math.sin(t*u)/s;return this._w=r*f+this._w*l,this._x=i*f+this._x*l,this._y=a*f+this._y*l,this._z=n*f+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(gt,{slerp:function(e,t,i,a){return i.copy(e).slerp(t,a)},slerpFlat:function(e,t,i,a,n,r,o){var s=i[a+0],u=i[a+1],f=i[a+2],l=i[a+3],c=n[r+0],h=n[r+1],d=n[r+2],p=n[r+3];if(l!==p||s!==c||u!==h||f!==d){var m=1-o,v=s*c+u*h+f*d+l*p,b=v>=0?1:-1,g=1-v*v;if(g>Number.EPSILON){var y=Math.sqrt(g),w=Math.atan2(y,v*b);m=Math.sin(m*w)/y,o=Math.sin(o*w)/y}var _=o*b;if(s=s*m+c*_,u=u*m+h*_,f=f*m+d*_,l=l*m+p*_,m===1-o){var x=1/Math.sqrt(s*s+u*u+f*f+l*l);s*=x,u*=x,f*=x,l*=x}}e[t]=s,e[t+1]=u,e[t+2]=f,e[t+3]=l}}),yt.prototype={constructor:yt,isVector3:!0,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},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)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return!1===(t&&t.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new gt),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e;return function(t,i){return void 0===e&&(e=new gt),this.applyQuaternion(e.setFromAxisAngle(t,i))}}(),applyMatrix3:function(e){var t=this.x,i=this.y,a=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*a,this.y=n[1]*t+n[4]*i+n[7]*a,this.z=n[2]*t+n[5]*i+n[8]*a,this},applyMatrix4:function(e){var t=this.x,i=this.y,a=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*a+n[12],this.y=n[1]*t+n[5]*i+n[9]*a+n[13],this.z=n[2]*t+n[6]*i+n[10]*a+n[14],this},applyProjection:function(e){var t=this.x,i=this.y,a=this.z,n=e.elements,r=1/(n[3]*t+n[7]*i+n[11]*a+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*a+n[12])*r,this.y=(n[1]*t+n[5]*i+n[9]*a+n[13])*r,this.z=(n[2]*t+n[6]*i+n[10]*a+n[14])*r,this},applyQuaternion:function(e){var t=this.x,i=this.y,a=this.z,n=e.x,r=e.y,o=e.z,s=e.w,u=s*t+r*a-o*i,f=s*i+o*t-n*a,l=s*a+n*i-r*t,c=-n*t-r*i-o*a;return this.x=u*s+c*-n+f*-o-l*-r,this.y=f*s+c*-r+l*-n-u*-o,this.z=l*s+c*-o+u*-r-f*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new wt),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new wt),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,i=this.y,a=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*a,this.y=n[1]*t+n[5]*i+n[9]*a,this.z=n[2]*t+n[6]*i+n[10]*a,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(i,a){return void 0===e&&(e=new yt,t=new yt),e.set(i,i,i),t.set(a,a,a),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i)},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){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},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 i=this.x,a=this.y,n=this.z;return this.x=a*e.z-n*e.y,this.y=n*e.x-i*e.z,this.z=i*e.y-a*e.x,this},crossVectors:function(e,t){var i=e.x,a=e.y,n=e.z,r=t.x,o=t.y,s=t.z;return this.x=a*s-n*o,this.y=n*r-i*s,this.z=i*o-a*r,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new yt),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new yt),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(lt.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,a=this.z-e.z;return t*t+i*i+a*a},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),a=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=a,this},setFromMatrixColumn:function(e,t){if("number"==typeof e){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var i=e;e=t,t=i}return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},wt.prototype={constructor:wt,isMatrix4:!0,set:function(e,t,i,a,n,r,o,s,u,f,l,c,h,d,p,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=a,v[1]=n,v[5]=r,v[9]=o,v[13]=s,v[2]=u,v[6]=f,v[10]=l,v[14]=c,v[3]=h,v[7]=d,v[11]=p,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new wt).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new yt);var i=this.elements,a=t.elements,n=1/e.setFromMatrixColumn(t,0).length(),r=1/e.setFromMatrixColumn(t,1).length(),o=1/e.setFromMatrixColumn(t,2).length();return i[0]=a[0]*n,i[1]=a[1]*n,i[2]=a[2]*n,i[4]=a[4]*r,i[5]=a[5]*r,i[6]=a[6]*r,i[8]=a[8]*o,i[9]=a[9]*o,i[10]=a[10]*o,this}}(),makeRotationFromEuler:function(e){!1===(e&&e.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,a=e.y,n=e.z,r=Math.cos(i),o=Math.sin(i),s=Math.cos(a),u=Math.sin(a),f=Math.cos(n),l=Math.sin(n);if("XYZ"===e.order){var c=r*f,h=r*l,d=o*f,p=o*l;t[0]=s*f,t[4]=-s*l,t[8]=u,t[1]=h+d*u,t[5]=c-p*u,t[9]=-o*s,t[2]=p-c*u,t[6]=d+h*u,t[10]=r*s}else if("YXZ"===e.order){var m=s*f,v=s*l,b=u*f,g=u*l;t[0]=m+g*o,t[4]=b*o-v,t[8]=r*u,t[1]=r*l,t[5]=r*f,t[9]=-o,t[2]=v*o-b,t[6]=g+m*o,t[10]=r*s}else if("ZXY"===e.order){var m=s*f,v=s*l,b=u*f,g=u*l;t[0]=m-g*o,t[4]=-r*l,t[8]=b+v*o,t[1]=v+b*o,t[5]=r*f,t[9]=g-m*o,t[2]=-r*u,t[6]=o,t[10]=r*s}else if("ZYX"===e.order){var c=r*f,h=r*l,d=o*f,p=o*l;t[0]=s*f,t[4]=d*u-h,t[8]=c*u+p,t[1]=s*l,t[5]=p*u+c,t[9]=h*u-d,t[2]=-u,t[6]=o*s,t[10]=r*s}else if("YZX"===e.order){var y=r*s,w=r*u,_=o*s,x=o*u;t[0]=s*f,t[4]=x-y*l,t[8]=_*l+w,t[1]=l,t[5]=r*f,t[9]=-o*f,t[2]=-u*f,t[6]=w*l+_,t[10]=y-x*l}else if("XZY"===e.order){var y=r*s,w=r*u,_=o*s,x=o*u;t[0]=s*f,t[4]=-l,t[8]=u*f,t[1]=y*l+x,t[5]=r*f,t[9]=w*l-_,t[2]=_*l-w,t[6]=o*f,t[10]=x*l+y}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,i=e.x,a=e.y,n=e.z,r=e.w,o=i+i,s=a+a,u=n+n,f=i*o,l=i*s,c=i*u,h=a*s,d=a*u,p=n*u,m=r*o,v=r*s,b=r*u;return t[0]=1-(h+p),t[4]=l-b,t[8]=c+v,t[1]=l+b,t[5]=1-(f+p),t[9]=d-m,t[2]=c-v,t[6]=d+m,t[10]=1-(f+h),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,t,i;return function(a,n,r){void 0===e&&(e=new yt,t=new yt,i=new yt);var o=this.elements;return i.subVectors(a,n).normalize(),0===i.lengthSq()&&(i.z=1),e.crossVectors(r,i).normalize(),0===e.lengthSq()&&(i.z+=1e-4,e.crossVectors(r,i).normalize()),t.crossVectors(i,e),o[0]=e.x,o[4]=t.x,o[8]=i.x,o[1]=e.y,o[5]=t.y,o[9]=i.y,o[2]=e.z,o[6]=t.z,o[10]=i.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)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,a=t.elements,n=this.elements,r=i[0],o=i[4],s=i[8],u=i[12],f=i[1],l=i[5],c=i[9],h=i[13],d=i[2],p=i[6],m=i[10],v=i[14],b=i[3],g=i[7],y=i[11],w=i[15],_=a[0],x=a[4],k=a[8],E=a[12],M=a[1],S=a[5],T=a[9],A=a[13],C=a[2],L=a[6],I=a[10],P=a[14],O=a[3],R=a[7],D=a[11],N=a[15];return n[0]=r*_+o*M+s*C+u*O,n[4]=r*x+o*S+s*L+u*R,n[8]=r*k+o*T+s*I+u*D,n[12]=r*E+o*A+s*P+u*N,n[1]=f*_+l*M+c*C+h*O,n[5]=f*x+l*S+c*L+h*R,n[9]=f*k+l*T+c*I+h*D,n[13]=f*E+l*A+c*P+h*N,n[2]=d*_+p*M+m*C+v*O,n[6]=d*x+p*S+m*L+v*R,n[10]=d*k+p*T+m*I+v*D,n[14]=d*E+p*A+m*P+v*N,n[3]=b*_+g*M+y*C+w*O,n[7]=b*x+g*S+y*L+w*R,n[11]=b*k+g*T+y*I+w*D,n[15]=b*E+g*A+y*P+w*N,this},multiplyToArray:function(e,t,i){var a=this.elements;return this.multiplyMatrices(e,t),i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3],i[4]=a[4],i[5]=a[5],i[6]=a[6],i[7]=a[7],i[8]=a[8],i[9]=a[9],i[10]=a[10],i[11]=a[11],i[12]=a[12],i[13]=a[13],i[14]=a[14],i[15]=a[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},applyToVector3Array:function(){var e;return function(t,i,a){void 0===e&&(e=new yt),void 0===i&&(i=0),void 0===a&&(a=t.length);for(var n=0,r=i;n0)return e;var n=t*i,r=Mt[n];if(void 0===r&&(r=new Float32Array(n),Mt[n]=r),0!==t){a.toArray(r,0);for(var o=1,s=0;o!==t;++o)s+=i,e[o].toArray(r,s)}return r}function At(e,t){var i=St[t];void 0===i&&(i=new Int32Array(t),St[t]=i);for(var a=0;a!==t;++a)i[a]=e.allocTextureUnit();return i}function Ct(e,t){e.uniform1f(this.addr,t)}function Lt(e,t){e.uniform1i(this.addr,t)}function It(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function Pt(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function Ot(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function Rt(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function Dt(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)}function Nt(e,t){e.uniformMatrix4fv(this.addr,!1,t.elements||t)}function Ft(e,t,i){var a=i.allocTextureUnit();e.uniform1i(this.addr,a),i.setTexture2D(t||xt,a)}function jt(e,t,i){var a=i.allocTextureUnit();e.uniform1i(this.addr,a),i.setTextureCube(t||kt,a)}function Bt(e,t){e.uniform2iv(this.addr,t)}function zt(e,t){e.uniform3iv(this.addr,t)}function Ut(e,t){e.uniform4iv(this.addr,t)}function Ht(e,t){e.uniform1fv(this.addr,t)}function Yt(e,t){e.uniform1iv(this.addr,t)}function Gt(e,t){e.uniform2fv(this.addr,Tt(t,this.size,2))}function Vt(e,t){e.uniform3fv(this.addr,Tt(t,this.size,3))}function Wt(e,t){e.uniform4fv(this.addr,Tt(t,this.size,4))}function qt(e,t){e.uniformMatrix2fv(this.addr,!1,Tt(t,this.size,4))}function Xt(e,t){e.uniformMatrix3fv(this.addr,!1,Tt(t,this.size,9))}function Kt(e,t){e.uniformMatrix4fv(this.addr,!1,Tt(t,this.size,16))}function Zt(e,t,i){var a=t.length,n=At(i,a);e.uniform1iv(this.addr,n);for(var r=0;r!==a;++r)i.setTexture2D(t[r]||xt,n[r])}function Qt(e,t,i){var a=t.length,n=At(i,a);e.uniform1iv(this.addr,n);for(var r=0;r!==a;++r)i.setTextureCube(t[r]||kt,n[r])}function Jt(e,t,i){this.id=e,this.addr=i,this.setValue=function(e){switch(e){case 5126:return Ct;case 35664:return It;case 35665:return Pt;case 35666:return Ot;case 35674:return Rt;case 35675:return Dt;case 35676:return Nt;case 35678:return Ft;case 35680:return jt;case 5124:case 35670:return Lt;case 35667:case 35671:return Bt;case 35668:case 35672:return zt;case 35669:case 35673:return Ut}}(t.type)}function $t(e,t,i){this.id=e,this.addr=i,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Ht;case 35664:return Gt;case 35665:return Vt;case 35666:return Wt;case 35674:return qt;case 35675:return Xt;case 35676:return Kt;case 35678:return Zt;case 35680:return Qt;case 5124:case 35670:return Yt;case 35667:case 35671:return Bt;case 35668:case 35672:return zt;case 35669:case 35673:return Ut}}(t.type)}function ei(e){this.id=e,Et.call(this)}ei.prototype.setValue=function(e,t){for(var i=this.seq,a=0,n=i.length;a!==n;++a){var r=i[a];r.setValue(e,t[r.id])}};var ti=/([\w\d_]+)(\])?(\[|\.)?/g;function ii(e,t){e.seq.push(t),e.map[t.id]=t}function ai(e,t,i){var a=e.name,n=a.length;for(ti.lastIndex=0;;){var r=ti.exec(a),o=ti.lastIndex,s=r[1],u="]"===r[2],f=r[3];if(u&&(s|=0),void 0===f||"["===f&&o+2===n){ii(i,void 0===f?new Jt(s,e,t):new $t(s,e,t));break}var l=i.map,c=l[s];void 0===c&&(c=new ei(s),ii(i,c)),i=c}}function ni(e,t,i){Et.call(this),this.renderer=i;for(var a=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=0;n!==a;++n){var r=e.getActiveUniform(t,n),o=r.name,s=e.getUniformLocation(t,o);ai(r,s,this)}}ni.prototype.setValue=function(e,t,i){var a=this.map[t];void 0!==a&&a.setValue(e,i,this.renderer)},ni.prototype.set=function(e,t,i){var a=this.map[i];void 0!==a&&a.setValue(e,t[i],this.renderer)},ni.prototype.setOptional=function(e,t,i){var a=t[i];void 0!==a&&this.setValue(e,i,a)},ni.upload=function(e,t,i,a){for(var n=0,r=t.length;n!==r;++n){var o=t[n],s=i[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,a)}},ni.seqWithValue=function(e,t){for(var i=[],a=0,n=e.length;a!==n;++a){var r=e[a];r.id in t&&i.push(r)}return i};var ri={merge:function(e){for(var t={},i=0;i 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#include \n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\t#include \n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t \tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include \n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n}\n",normal_frag:"uniform float opacity;\nvarying vec3 vNormal;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include \n}\n",normal_vert:"varying vec3 vNormal;\n#include \n#include \n#include \n#include \nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"};function si(e,t,i){return void 0===t&&void 0===i?this.set(e):this.setRGB(e,t,i)}si.prototype={constructor:si,isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=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,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(){function e(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}return function(t,i,a){if(t=lt.euclideanModulo(t,1),i=lt.clamp(i,0,1),a=lt.clamp(a,0,1),0===i)this.r=this.g=this.b=a;else{var n=a<=.5?a*(1+i):a+i-a*i,r=2*a-n;this.r=e(r,n,t+1/3),this.g=e(r,n,t),this.b=e(r,n,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var a,n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(a=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,t(a[5]),this;if(a=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,t(a[5]),this;break;case"hsl":case"hsla":if(a=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r)){var o=parseFloat(a[1])/360,s=parseInt(a[2],10)/100,u=parseInt(a[3],10)/100;return t(a[5]),this.setHSL(o,s,u)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){var f=i[1],l=f.length;if(3===l)return this.r=parseInt(f.charAt(0)+f.charAt(0),16)/255,this.g=parseInt(f.charAt(1)+f.charAt(1),16)/255,this.b=parseInt(f.charAt(2)+f.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(f.charAt(0)+f.charAt(1),16)/255,this.g=parseInt(f.charAt(2)+f.charAt(3),16)/255,this.b=parseInt(f.charAt(4)+f.charAt(5),16)/255,this}if(e&&e.length>0){var f=ui[e];void 0!==f?this.setHex(f):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var i=t>0?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,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,i,a=e||{h:0,s:0,l:0},n=this.r,r=this.g,o=this.b,s=Math.max(n,r,o),u=Math.min(n,r,o),f=(u+s)/2;if(u===s)t=0,i=0;else{var l=s-u;switch(i=f<=.5?l/(s+u):l/(2-s-u),s){case n:t=(r-o)/l+(r.001&&C.scale>.001&&(_.x=C.x,_.y=C.y,_.z=C.z,y=C.size*C.scale/p.w,w.x=y*v,w.y=y,l.uniform3f(s.screenPosition,_.x,_.y,_.z),l.uniform2f(s.scale,w.x,w.y),l.uniform1f(s.rotation,C.rotation),l.uniform1f(s.opacity,C.opacity),l.uniform3f(s.color,C.color.r,C.color.g,C.color.b),c.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),e.setTexture2D(C.texture,1),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0))}}}c.enable(l.CULL_FACE),c.enable(l.DEPTH_TEST),c.setDepthWrite(!0),e.resetGLState()}}}function di(e,t){var i,a,n,r,o,s,u=e.context,f=e.state,l=new yt,c=new gt,h=new yt;function d(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),f=new Uint16Array([0,1,2,0,2,3]);i=u.createBuffer(),a=u.createBuffer(),u.bindBuffer(u.ARRAY_BUFFER,i),u.bufferData(u.ARRAY_BUFFER,t,u.STATIC_DRAW),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,a),u.bufferData(u.ELEMENT_ARRAY_BUFFER,f,u.STATIC_DRAW),n=function(){var t=u.createProgram(),i=u.createShader(u.VERTEX_SHADER),a=u.createShader(u.FRAGMENT_SHADER);return u.shaderSource(i,["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(a,["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;","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(i),u.compileShader(a),u.attachShader(t,i),u.attachShader(t,a),u.linkProgram(t),t}(),r={position:u.getAttribLocation(n,"position"),uv:u.getAttribLocation(n,"uv")},o={uvOffset:u.getUniformLocation(n,"uvOffset"),uvScale:u.getUniformLocation(n,"uvScale"),rotation:u.getUniformLocation(n,"rotation"),scale:u.getUniformLocation(n,"scale"),color:u.getUniformLocation(n,"color"),map:u.getUniformLocation(n,"map"),opacity:u.getUniformLocation(n,"opacity"),modelViewMatrix:u.getUniformLocation(n,"modelViewMatrix"),projectionMatrix:u.getUniformLocation(n,"projectionMatrix"),fogType:u.getUniformLocation(n,"fogType"),fogDensity:u.getUniformLocation(n,"fogDensity"),fogNear:u.getUniformLocation(n,"fogNear"),fogFar:u.getUniformLocation(n,"fogFar"),fogColor:u.getUniformLocation(n,"fogColor"),alphaTest:u.getUniformLocation(n,"alphaTest")};var l=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");l.width=8,l.height=8;var c=l.getContext("2d");c.fillStyle="white",c.fillRect(0,0,8,8),(s=new ht(l)).needsUpdate=!0}function p(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(m,v){if(0!==t.length){void 0===n&&d(),u.useProgram(n),f.initAttributes(),f.enableAttribute(r.position),f.enableAttribute(r.uv),f.disableUnusedAttributes(),f.disable(u.CULL_FACE),f.enable(u.BLEND),u.bindBuffer(u.ARRAY_BUFFER,i),u.vertexAttribPointer(r.position,2,u.FLOAT,!1,16,0),u.vertexAttribPointer(r.uv,2,u.FLOAT,!1,16,8),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,a),u.uniformMatrix4fv(o.projectionMatrix,!1,v.projectionMatrix.elements),f.activeTexture(u.TEXTURE0),u.uniform1i(o.map,0);var b=0,g=0,y=m.fog;y?(u.uniform3f(o.fogColor,y.color.r,y.color.g,y.color.b),y&&y.isFog?(u.uniform1f(o.fogNear,y.near),u.uniform1f(o.fogFar,y.far),u.uniform1i(o.fogType,1),b=1,g=1):y&&y.isFogExp2&&(u.uniform1f(o.fogDensity,y.density),u.uniform1i(o.fogType,2),b=2,g=2)):(u.uniform1i(o.fogType,0),b=0,g=0);for(var w=0,_=t.length;w<_;w++){var x=t[w];x.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,x.matrixWorld),x.z=-x.modelViewMatrix.elements[14]}t.sort(p);for(var k=[],w=0,_=t.length;w<_;w++){var x=t[w],E=x.material;if(!1!==E.visible){u.uniform1f(o.alphaTest,E.alphaTest),u.uniformMatrix4fv(o.modelViewMatrix,!1,x.modelViewMatrix.elements),x.matrixWorld.decompose(l,c,h),k[0]=h.x,k[1]=h.y;var M=0;m.fog&&E.fog&&(M=g),b!==M&&(u.uniform1i(o.fogType,M),b=M),null!==E.map?(u.uniform2f(o.uvOffset,E.map.offset.x,E.map.offset.y),u.uniform2f(o.uvScale,E.map.repeat.x,E.map.repeat.y)):(u.uniform2f(o.uvOffset,0,0),u.uniform2f(o.uvScale,1,1)),u.uniform1f(o.opacity,E.opacity),u.uniform3f(o.color,E.color.r,E.color.g,E.color.b),u.uniform1f(o.rotation,E.rotation),u.uniform2fv(o.scale,k),f.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),f.setDepthTest(E.depthTest),f.setDepthWrite(E.depthWrite),E.map?e.setTexture2D(E.map,0):e.setTexture2D(s,0),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0)}}f.enable(u.CULL_FACE),e.resetGLState()}}}function pi(){Object.defineProperty(this,"id",{value:vi()}),this.uuid=lt.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=g,this.side=f,this.shading=d,this.vertexColors=p,this.opacity=1,this.transparent=!1,this.blendSrc=O,this.blendDst=R,this.blendEquation=E,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Y,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}li.physical={uniforms:ri.merge([li.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:oi.meshphysical_vert,fragmentShader:oi.meshphysical_frag},ci.prototype={constructor:ci,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;tthis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){var i=t||new ct;return i.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){var i=t||new ct;return i.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new ct;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.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)}},pi.prototype={constructor:pi,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){!0===e&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var i=e[t];if(void 0!==i){var a=this[t];void 0!==a?a&&a.isColor?a.set(i):a&&a.isVector3&&i&&i.isVector3?a.copy(i):this[t]="overdraw"===t?Number(i):i:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e;t&&(e={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};function a(e){var t=[];for(var i in e){var a=e[i];delete a.metadata,t.push(a)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,i.reflectivity=this.reflectivity),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==g&&(i.blending=this.blending),this.shading!==d&&(i.shading=this.shading),this.side!==f&&(i.side=this.side),this.vertexColors!==p&&(i.vertexColors=this.vertexColors),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),i.skinning=this.skinning,i.morphTargets=this.morphTargets,t){var n=a(e.textures),r=a(e.images);n.length>0&&(i.textures=n),r.length>0&&(i.images=r)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.shading=e.shading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,i=null;if(null!==t){var a=t.length;i=new Array(a);for(var n=0;n!==a;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(pi.prototype,t.prototype);var mi=0;function vi(){return mi++}function bi(e){pi.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function gi(e){pi.call(this),this.type="MeshDepthMaterial",this.depthPacking=ut,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}function yi(e,t){this.min=void 0!==e?e:new yt(1/0,1/0,1/0),this.max=void 0!==t?t:new yt(-1/0,-1/0,-1/0)}function wi(e,t){this.center=void 0!==e?e:new yt,this.radius=void 0!==t?t:0}function _i(){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.")}function xi(e,t){this.normal=void 0!==e?e:new yt(1,0,0),this.constant=void 0!==t?t:0}function ki(e,t,i,a,n,r){this.planes=[void 0!==e?e:new xi,void 0!==t?t:new xi,void 0!==i?i:new xi,void 0!==a?a:new xi,void 0!==n?n:new xi,void 0!==r?r:new xi]}function Ei(e,t,i,a){var n=e.context,r=e.state,o=new ki,u=new wt,h=t.shadows,d=new ct,p=new ct(a.maxTextureSize,a.maxTextureSize),m=new yt,v=new yt,b=[],g=1,y=2,w=1+(g|y),_=new Array(w),x=new Array(w),k={},E=[new yt(1,0,0),new yt(-1,0,0),new yt(0,0,1),new yt(0,0,-1),new yt(0,1,0),new yt(0,-1,0)],M=[new yt(0,1,0),new yt(0,1,0),new yt(0,1,0),new yt(0,1,0),new yt(0,0,1),new yt(0,0,-1)],S=[new mt,new mt,new mt,new mt,new mt,new mt],T=new gi;T.depthPacking=ft,T.clipping=!0;for(var A=li.distanceRGBA,C=ri.clone(A.uniforms),L=0;L!==w;++L){var I=0!=(L&g),P=0!=(L&y),O=T.clone();O.morphTargets=I,O.skinning=P,_[L]=O;var R=new bi({defines:{USE_SHADOWMAP:""},uniforms:C,vertexShader:A.vertexShader,fragmentShader:A.fragmentShader,morphTargets:I,skinning:P,clipping:!0});x[L]=R}var D=this;function N(t,i,a,n){var r=t.geometry,o=null,s=_,u=t.customDepthMaterial;if(a&&(s=x,u=t.customDistanceMaterial),u)o=u;else{var h=!1;i.morphTargets&&(r&&r.isBufferGeometry?h=r.morphAttributes&&r.morphAttributes.position&&r.morphAttributes.position.length>0:r&&r.isGeometry&&(h=r.morphTargets&&r.morphTargets.length>0));var d=t.isSkinnedMesh&&i.skinning,p=0;h&&(p|=g),d&&(p|=y),o=s[p]}if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var m=o.uuid,v=i.uuid,b=k[m];void 0===b&&(b={},k[m]=b);var w=b[v];void 0===w&&(w=o.clone(),b[v]=w),o=w}o.visible=i.visible,o.wireframe=i.wireframe;var E=i.side;return D.renderSingleSided&&E==c&&(E=f),D.renderReverseSided&&(E===f?E=l:E===l&&(E=f)),o.side=E,o.clipShadows=i.clipShadows,o.clippingPlanes=i.clippingPlanes,o.wireframeLinewidth=i.wireframeLinewidth,o.linewidth=i.linewidth,a&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(n),o}function F(e,t,i){if(!1!==e.visible){var a=0!=(e.layers.mask&t.layers.mask);if(a&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!1===e.frustumCulled||!0===o.intersectsObject(e))){var n=e.material;!0===n.visible&&(e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),b.push(e))}for(var r=e.children,s=0,u=r.length;sn&&(n=f),l>r&&(r=l),c>o&&(o=c)}this.min.set(t,i,a),this.max.set(n,r,o)},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){var i=t||new yt;return i.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new yt),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=e.constant&&i>=e.constant},clampPoint:function(e,t){var i=t||new yt;return i.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new yt;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),getBoundingSphere:function(){var e=new yt;return function(t){var i=t||new wi;return this.getCenter(i.center),i.radius=.5*this.getSize(e).length(),i}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new yt,new yt,new yt,new yt,new yt,new yt,new yt,new yt];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},wi.prototype={constructor:wi,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new yi;return function(t,i){var a=this.center;void 0!==i?a.copy(i):e.setFromPoints(t).getCenter(a);for(var n=0,r=0,o=t.length;rthis.radius*this.radius&&(a.sub(this.center).normalize(),a.multiplyScalar(this.radius).add(this.center)),a},getBoundingBox:function(e){var t=e||new yi;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}},_i.prototype={constructor:_i,isMatrix3:!0,set:function(e,t,i,a,n,r,o,s,u){var f=this.elements;return f[0]=e,f[1]=a,f[2]=o,f[3]=t,f[4]=n,f[5]=s,f[6]=i,f[7]=r,f[8]=u,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(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},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToVector3Array:function(){var e;return function(t,i,a){void 0===e&&(e=new yt),void 0===i&&(i=0),void 0===a&&(a=t.length);for(var n=0,r=i;n1?void 0:a.copy(n).multiplyScalar(o).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){var t=e||new yt;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new yt,t=new _i;return function(i,a){var n=this.coplanarPoint(e).applyMatrix4(i),r=a||t.getNormalMatrix(i),o=this.normal.applyMatrix3(r).normalize();return this.constant=-n.dot(o),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}},ki.prototype={constructor:ki,set:function(e,t,i,a,n,r){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(a),o[4].copy(n),o[5].copy(r),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,i=0;i<6;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,a=i[0],n=i[1],r=i[2],o=i[3],s=i[4],u=i[5],f=i[6],l=i[7],c=i[8],h=i[9],d=i[10],p=i[11],m=i[12],v=i[13],b=i[14],g=i[15];return t[0].setComponents(o-a,l-s,p-c,g-m).normalize(),t[1].setComponents(o+a,l+s,p+c,g+m).normalize(),t[2].setComponents(o+n,l+u,p+h,g+v).normalize(),t[3].setComponents(o-n,l-u,p-h,g-v).normalize(),t[4].setComponents(o-r,l-f,p-d,g-b).normalize(),t[5].setComponents(o+r,l+f,p+d,g+b).normalize(),this},intersectsObject:function(){var e=new wi;return function(t){var i=t.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),e.copy(i.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new wi;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,i=e.center,a=-e.radius,n=0;n<6;n++){var r=t[n].distanceToPoint(i);if(r0?i.min.x:i.max.x,t.x=r.normal.x>0?i.max.x:i.min.x,e.y=r.normal.y>0?i.min.y:i.max.y,t.y=r.normal.y>0?i.max.y:i.min.y,e.z=r.normal.z>0?i.min.z:i.max.z,t.z=r.normal.z>0?i.max.z:i.min.z;var o=r.distanceToPoint(e),s=r.distanceToPoint(t);if(o<0&&s<0)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}},Mi.prototype={constructor:Mi,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var i=t||new yt;return i.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new yt;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var i=t||new yt;i.subVectors(e,this.origin);var a=i.dot(this.direction);return a<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new yt;return function(t){var i=e.subVectors(t,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(i).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new yt,t=new yt,i=new yt;return function(a,n,r,o){e.copy(a).add(n).multiplyScalar(.5),t.copy(n).sub(a).normalize(),i.copy(this.origin).sub(e);var s,u,f,l,c=.5*a.distanceTo(n),h=-this.direction.dot(t),d=i.dot(this.direction),p=-i.dot(t),m=i.lengthSq(),v=Math.abs(1-h*h);if(v>0)if(u=h*d-p,l=c*v,(s=h*p-d)>=0)if(u>=-l)if(u<=l){var b=1/v;f=(s*=b)*(s+h*(u*=b)+2*d)+u*(h*s+u+2*p)+m}else u=c,s=Math.max(0,-(h*u+d)),f=-s*s+u*(u+2*p)+m;else u=-c,s=Math.max(0,-(h*u+d)),f=-s*s+u*(u+2*p)+m;else u<=-l?(s=Math.max(0,-(-h*c+d)),u=s>0?-c:Math.min(Math.max(-c,-p),c),f=-s*s+u*(u+2*p)+m):u<=l?(s=0,u=Math.min(Math.max(-c,-p),c),f=u*(u+2*p)+m):(s=Math.max(0,-(h*c+d)),u=s>0?c:Math.min(Math.max(-c,-p),c),f=-s*s+u*(u+2*p)+m);else u=h>0?-c:c,s=Math.max(0,-(h*u+d)),f=-s*s+u*(u+2*p)+m;return r&&r.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(t).multiplyScalar(u).add(e),f}}(),intersectSphere:function(){var e=new yt;return function(t,i){e.subVectors(t.center,this.origin);var a=e.dot(this.direction),n=e.dot(e)-a*a,r=t.radius*t.radius;if(n>r)return null;var o=Math.sqrt(r-n),s=a-o,u=a+o;return s<0&&u<0?null:s<0?this.at(u,i):this.at(s,i)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var i=e.normal.dot(this.direction);return i*t<0},intersectBox:function(e,t){var i,a,n,r,o,s,u=1/this.direction.x,f=1/this.direction.y,l=1/this.direction.z,c=this.origin;return u>=0?(i=(e.min.x-c.x)*u,a=(e.max.x-c.x)*u):(i=(e.max.x-c.x)*u,a=(e.min.x-c.x)*u),f>=0?(n=(e.min.y-c.y)*f,r=(e.max.y-c.y)*f):(n=(e.max.y-c.y)*f,r=(e.min.y-c.y)*f),i>r||n>a?null:((n>i||i!=i)&&(i=n),(r=0?(o=(e.min.z-c.z)*l,s=(e.max.z-c.z)*l):(o=(e.max.z-c.z)*l,s=(e.min.z-c.z)*l),i>s||o>a?null:((o>i||i!=i)&&(i=o),(s=0?i:a,t)))},intersectsBox:function(){var e=new yt;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new yt,t=new yt,i=new yt,a=new yt;return function(n,r,o,s,u){t.subVectors(r,n),i.subVectors(o,n),a.crossVectors(t,i);var f,l=this.direction.dot(a);if(l>0){if(s)return null;f=1}else{if(!(l<0))return null;f=-1,l=-l}e.subVectors(this.origin,n);var c=f*this.direction.dot(i.crossVectors(e,i));if(c<0)return null;var h=f*this.direction.dot(t.cross(e));if(h<0)return null;if(c+h>l)return null;var d=-f*e.dot(a);return d<0?null:this.at(d/l,u)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},Si.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Si.DefaultOrder="XYZ",Si.prototype={constructor:Si,isEuler:!0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,i,a){return this._x=e,this._y=t,this._z=i,this._order=a||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,i){var a=lt.clamp,n=e.elements,r=n[0],o=n[4],s=n[8],u=n[1],f=n[5],l=n[9],c=n[2],h=n[6],d=n[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(a(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(h,f),this._z=0)):"YXZ"===t?(this._x=Math.asin(-a(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(u,f)):(this._y=Math.atan2(-c,r),this._z=0)):"ZXY"===t?(this._x=Math.asin(a(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-o,f)):(this._y=0,this._z=Math.atan2(u,r))):"ZYX"===t?(this._y=Math.asin(-a(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(h,d),this._z=Math.atan2(u,r)):(this._x=0,this._z=Math.atan2(-o,f))):"YZX"===t?(this._z=Math.asin(a(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(-l,f),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-a(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(h,f),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,i,a){return void 0===e&&(e=new wt),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,i,a)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new gt;return function(t){return e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new yt(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Ti.prototype={constructor:Ti,set:function(e){this.mask=1<1){for(var t=0;t1)for(var t=0;t0){a.children=[];for(var n=0;n0&&(i.geometries=r),o.length>0&&(i.materials=o),s.length>0&&(i.textures=s),u.length>0&&(i.images=u)}return i.object=a,i;function f(e){var t=[];for(var i in e){var a=e[i];delete a.metadata,t.push(a)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var i=0;i0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)}}(),Pi.barycoordFromPoint=function(){var e=new yt,t=new yt,i=new yt;return function(a,n,r,o,s){e.subVectors(o,n),t.subVectors(r,n),i.subVectors(a,n);var u=e.dot(e),f=e.dot(t),l=e.dot(i),c=t.dot(t),h=t.dot(i),d=u*c-f*f,p=s||new yt;if(0===d)return p.set(-2,-1,-1);var m=1/d,v=(c*l-f*h)*m,b=(u*h-f*l)*m;return p.set(1-v-b,b,v)}}(),Pi.containsPoint=function(){var e=new yt;return function(t,i,a,n){var r=Pi.barycoordFromPoint(t,i,a,n,e);return r.x>=0&&r.y>=0&&r.x+r.y<=1}}(),Pi.prototype={constructor:Pi,set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,a){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[a]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new yt,t=new yt;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 yt;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return Pi.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new xi;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return Pi.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return Pi.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,i,a;return function(n,r){void 0===e&&(e=new xi,t=[new Ii,new Ii,new Ii],i=new yt,a=new yt);var o=r||new yt,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(n,i),!0===this.containsPoint(i))o.copy(i);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var u=0;u0)for(var h=0;h0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,i;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,i,a,n;for(i=0,a=this.faces.length;i0&&(e+=t[i].distanceTo(t[i-1])),this.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new yi),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new wi),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if(!1!==(e&&e.isGeometry)){var a,n=this.vertices.length,r=this.vertices,o=e.vertices,s=this.faces,u=e.faces,f=this.faceVertexUvs[0],l=e.faceVertexUvs[0],c=this.colors,h=e.colors;void 0===i&&(i=0),void 0!==t&&(a=(new _i).getNormalMatrix(t));for(var d=0,p=o.length;d=0;i--){var p=h[i];for(this.faces.splice(p,1),o=0,s=this.faceVertexUvs.length;o0,v=d.vertexNormals.length>0,b=1!==d.color.r||1!==d.color.g||1!==d.color.b,g=d.vertexColors.length>0,y=0;if(y=k(y=k(y=k(y=k(y=k(y=k(y=k(y=k(y,0,0),1,!0),2,!1),3,p),4,m),5,v),6,b),7,g),o.push(y),o.push(d.a,d.b,d.c),o.push(d.materialIndex),p){var w=this.faceVertexUvs[0][n];o.push(S(w[0]),S(w[1]),S(w[2]))}if(m&&o.push(E(d.normal)),v){var _=d.vertexNormals;o.push(E(_[0]),E(_[1]),E(_[2]))}if(b&&o.push(M(d.color)),g){var x=d.vertexColors;o.push(M(x[0]),M(x[1]),M(x[2]))}}function k(e,t,i){return i?e|1<0&&(e.data.colors=f),c.length>0&&(e.data.uvs=[c]),e.data.faces=o,e},clone:function(){return(new Bi).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var t=e.vertices,i=0,a=t.length;i65535?Uint32Array:Uint16Array)(u),l=new Float32Array(3*s),c=new Float32Array(3*s),h=new Float32Array(2*s),d=0,p=0,m=0,v=0,b=0;function g(e,t,i,a,n,r,s,u,g,y,w){for(var _=r/g,x=s/y,k=r/2,E=s/2,M=u/2,S=g+1,T=y+1,A=0,C=0,L=new yt,I=0;I0?1:-1,c[d]=L.x,c[d+1]=L.y,c[d+2]=L.z,h[p]=O/g,h[p+1]=1-I/y,d+=3,p+=2,A+=1}for(I=0;I65535?Uint32Array:Uint16Array)(o*s*6),b=0;b0,o=n[1]&&n[1].length>0,s=e.morphTargets,u=s.length;if(u>0){t=[];for(var f=0;f0){l=[];for(var f=0;f0){var i=new Float32Array(3*e.normals.length);this.addAttribute("normal",new Di(i,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var a=new Float32Array(3*e.colors.length);this.addAttribute("color",new Di(a,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var n=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new Di(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var r=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new Di(r,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var o=e.vertices.length>65535?Uint32Array:Uint16Array,s=new o(3*e.indices.length);this.setIndex(new Di(s,1).copyIndicesArray(e.indices))}for(var u in this.groups=e.groups,e.morphTargets){for(var f=[],l=e.morphTargets[u],c=0,h=l.length;c0){var m=new ji(4*e.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var v=new ji(4*e.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new yi);var e=this.attributes.position.array;void 0!==e?this.boundingBox.setFromArray(e):this.boundingBox.makeEmpty(),(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.',this)},computeBoundingSphere:function(){var e=new yi,t=new yt;return function(){null===this.boundingSphere&&(this.boundingSphere=new wi);var i=this.attributes.position;if(i){var a=i.array,n=this.boundingSphere.center;e.setFromArray(a),e.getCenter(n);for(var r=0,o=0,s=a.length;o0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var u=this.boundingSphere;return null!==u&&(e.data.boundingSphere={center:u.center.toArray(),radius:u.radius}),e},clone:function(){return(new Yi).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var i=e.attributes;for(var a in i){var n=i[a];this.addAttribute(a,n.clone())}for(var r=e.groups,o=0,s=r.length;o0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,i=e.length;tt.far?null:{distance:u,point:v.clone(),object:e}}function y(e,t,i,o,s,u,l,c){a.fromArray(o,3*u),n.fromArray(o,3*l),r.fromArray(o,3*c);var p=g(e,t,i,a,n,r,m);return p&&(s&&(f.fromArray(s,2*u),h.fromArray(s,2*l),d.fromArray(s,2*c),p.uv=b(m,a,n,r,f,h,d)),p.face=new Oi(u,l,c,Pi.normal(a,n,r)),p.faceIndex=u),p}return function(l,c){var p,v,w=this.geometry,_=this.material,x=this.matrixWorld;if(void 0!==_&&(null===w.boundingSphere&&w.computeBoundingSphere(),i.copy(w.boundingSphere),i.applyMatrix4(x),!1!==l.ray.intersectsSphere(i)&&(e.getInverse(x),t.copy(l.ray).applyMatrix4(e),null===w.boundingBox||!1!==t.intersectsBox(w.boundingBox))))if(w&&w.isBufferGeometry){var k,E,M,S=w.index,T=w.attributes,A=T.position.array;if(void 0!==T.uv&&(p=T.uv.array),null!==S)for(var C=S.array,L=0,I=C.length;L0&&(p=B);for(var z=0,U=j.length;z/g,function(e,t){var i=oi[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return ia(i)})}function aa(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,i,a){for(var n="",r=parseInt(t);r0?e.gammaFactor:1,g=function(e,t,i){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ea).join("\n")}(r,a,e.extensions),y=function(e){var t=[];for(var i in e){var a=e[i];!1!==a&&t.push("#define "+i+" "+a)}return t.join("\n")}(o),w=n.createProgram();i.isRawShaderMaterial?(m=[y,"\n"].filter(ea).join("\n"),v=[g,y,"\n"].filter(ea).join("\n")):(m=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,y,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+b,"#define MAX_BONES "+a.maxBones,a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+a.numClippingPlanes,a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+c:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","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;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ea).join("\n"),v=[g,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,y,a.alphaTest?"#define ALPHATEST "+a.alphaTest:"","#define GAMMA_FACTOR "+b,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+h:"",a.envMap?"#define "+d:"",a.envMap?"#define "+p:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+a.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(a.numClippingPlanes-a.numClipIntersection),a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+c:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==Q?"#define TONE_MAPPING":"",a.toneMapping!==Q?oi.tonemapping_pars_fragment:"",a.toneMapping!==Q?function(e,t){var i;switch(t){case J:i="Linear";break;case $:i="Reinhard";break;case ee:i="Uncharted2";break;case te:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",a.toneMapping):"",a.outputEncoding||a.mapEncoding||a.envMapEncoding||a.emissiveMapEncoding?oi.encodings_pars_fragment:"",a.mapEncoding?$i("mapTexelToLinear",a.mapEncoding):"",a.envMapEncoding?$i("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?$i("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?function(e,t){var i=Ji(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}("linearToOutputTexel",a.outputEncoding):"",a.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(ea).join("\n")),f=ta(f=ia(f),a),l=ta(l=ia(l),a),i.isShaderMaterial||(f=aa(f),l=aa(l));var _=m+f,x=v+l,k=Zi(n,n.VERTEX_SHADER,_),E=Zi(n,n.FRAGMENT_SHADER,x);n.attachShader(w,k),n.attachShader(w,E),void 0!==i.index0AttributeName?n.bindAttribLocation(w,0,i.index0AttributeName):!0===a.morphTargets&&n.bindAttribLocation(w,0,"position"),n.linkProgram(w);var M,S,T=n.getProgramInfoLog(w),A=n.getShaderInfoLog(k),C=n.getShaderInfoLog(E),L=!0,I=!0;return!1===n.getProgramParameter(w,n.LINK_STATUS)?(L=!1,console.error("THREE.WebGLProgram: shader error: ",n.getError(),"gl.VALIDATE_STATUS",n.getProgramParameter(w,n.VALIDATE_STATUS),"gl.getProgramInfoLog",T,A,C)):""!==T?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",T):""!==A&&""!==C||(I=!1),I&&(this.diagnostics={runnable:L,material:i,programLog:T,vertexShader:{log:A,prefix:m},fragmentShader:{log:C,prefix:v}}),n.deleteShader(k),n.deleteShader(E),this.getUniforms=function(){return void 0===M&&(M=new ni(n,w,e)),M},this.getAttributes=function(){return void 0===S&&(S=function(e,t,i){for(var a={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),r=0;r0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===c,flipSided:i.side===l,depthPacking:void 0!==i.depthPacking&&i.depthPacking};return b},this.getProgramCode=function(e,t){var i=[];if(t.shaderID?i.push(t.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var a in e.defines)i.push(a),i.push(e.defines[a]);for(var r=0;r65535?Uint32Array:Uint16Array)(r),1);return n(m,e.ELEMENT_ARRAY_BUFFER),a.wireframe=m,m},update:function(t){var i=a.get(t);t.geometry.isGeometry&&i.updateFromObject(t);var r=i.index,o=i.attributes;for(var s in null!==r&&n(r,e.ELEMENT_ARRAY_BUFFER),o)n(o[s],e.ARRAY_BUFFER);var u=i.morphAttributes;for(var s in u)for(var f=u[s],l=0,c=f.length;lt||e.height>t){var i=t/Math.max(e.width,e.height),a=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");a.width=Math.floor(e.width*i),a.height=Math.floor(e.height*i);var n=a.getContext("2d");return n.drawImage(e,0,0,e.width,e.height,0,0,a.width,a.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+a.width+"x"+a.height,e),a}return e}function l(e){return lt.isPowerOfTwo(e.width)&<.isPowerOfTwo(e.height)}function c(t){return t===pe||t===me||t===ve?e.NEAREST:e.LINEAR}function h(t){var i=t.target;i.removeEventListener("dispose",h),function(t){var i=a.get(t);if(t.image&&i.__image__webglTextureCube)e.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;e.deleteTexture(i.__webglTexture)}a.delete(t)}(i),s.textures--}function d(t){var i=t.target;i.removeEventListener("dispose",d),function(t){var i=a.get(t),n=a.get(t.texture);if(t){if(void 0!==n.__webglTexture&&e.deleteTexture(n.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t&&t.isWebGLRenderTargetCube)for(var r=0;r<6;r++)e.deleteFramebuffer(i.__webglFramebuffer[r]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[r]);else e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer);a.delete(t.texture),a.delete(t)}}(i),s.textures--}function p(t,o){var c=a.get(t);if(t.version>0&&c.__version!==t.version){var d=t.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==d.complete)return void function(t,a,o){void 0===t.__webglInit&&(t.__webglInit=!0,a.addEventListener("dispose",h),t.__webglTexture=e.createTexture(),s.textures++),i.activeTexture(e.TEXTURE0+o),i.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment);var c=f(a.image,n.maxTextureSize);(function(e){return e.wrapS!==ce||e.wrapT!==ce||e.minFilter!==pe&&e.minFilter!==be})(a)&&!1===l(c)&&(c=function(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");t.width=lt.nearestPowerOfTwo(e.width),t.height=lt.nearestPowerOfTwo(e.height);var i=t.getContext("2d");return i.drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}(c));var d=l(c),p=r(a.format),v=r(a.type);m(e.TEXTURE_2D,a,d);var b,g=a.mipmaps;if(a&&a.isDepthTexture){var y=e.DEPTH_COMPONENT;if(a.type===Te){if(!u)throw new Error("Float Depth Texture only supported in WebGL2.0");y=e.DEPTH_COMPONENT32F}else u&&(y=e.DEPTH_COMPONENT16);a.format===ze&&(y=e.DEPTH_STENCIL),i.texImage2D(e.TEXTURE_2D,0,y,c.width,c.height,0,p,v,null)}else if(a&&a.isDataTexture)if(g.length>0&&d){for(var w=0,_=g.length;w<_;w++)b=g[w],i.texImage2D(e.TEXTURE_2D,w,p,b.width,b.height,0,p,v,b.data);a.generateMipmaps=!1}else i.texImage2D(e.TEXTURE_2D,0,p,c.width,c.height,0,p,v,c.data);else if(a&&a.isCompressedTexture)for(var w=0,_=g.length;w<_;w++)b=g[w],a.format!==De&&a.format!==Re?i.getCompressedTextureFormats().indexOf(p)>-1?i.compressedTexImage2D(e.TEXTURE_2D,w,p,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(e.TEXTURE_2D,w,p,b.width,b.height,0,p,v,b.data);else if(g.length>0&&d){for(var w=0,_=g.length;w<_;w++)b=g[w],i.texImage2D(e.TEXTURE_2D,w,p,p,v,b);a.generateMipmaps=!1}else i.texImage2D(e.TEXTURE_2D,0,p,p,v,c);a.generateMipmaps&&d&&e.generateMipmap(e.TEXTURE_2D),t.__version=a.version,a.onUpdate&&a.onUpdate(a)}(c,t,o);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t)}}i.activeTexture(e.TEXTURE0+o),i.bindTexture(e.TEXTURE_2D,c.__webglTexture)}function m(i,o,s){var u;if(s?(e.texParameteri(i,e.TEXTURE_WRAP_S,r(o.wrapS)),e.texParameteri(i,e.TEXTURE_WRAP_T,r(o.wrapT)),e.texParameteri(i,e.TEXTURE_MAG_FILTER,r(o.magFilter)),e.texParameteri(i,e.TEXTURE_MIN_FILTER,r(o.minFilter))):(e.texParameteri(i,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(i,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),o.wrapS===ce&&o.wrapT===ce||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",o),e.texParameteri(i,e.TEXTURE_MAG_FILTER,c(o.magFilter)),e.texParameteri(i,e.TEXTURE_MIN_FILTER,c(o.minFilter)),o.minFilter!==pe&&o.minFilter!==be&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",o)),u=t.get("EXT_texture_filter_anisotropic")){if(o.type===Te&&null===t.get("OES_texture_float_linear"))return;if(o.type===Ae&&null===t.get("OES_texture_half_float_linear"))return;(o.anisotropy>1||a.get(o).__currentAnisotropy)&&(e.texParameterf(i,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,n.getMaxAnisotropy())),a.get(o).__currentAnisotropy=o.anisotropy)}}function v(t,n,o,s){var u=r(n.texture.format),f=r(n.texture.type);i.texImage2D(s,0,u,n.width,n.height,0,u,f,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,o,s,a.get(n.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function b(t,i){e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer&&!i.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):i.depthBuffer&&i.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,i.width,i.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}function g(t){var i=a.get(t),n=t&&t.isWebGLRenderTargetCube;if(t.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");a.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),p(i.depthTexture,0);var n=a.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===Be)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,n,0);else{if(i.depthTexture.format!==ze)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,n,0)}}(i.__webglFramebuffer,t)}else if(n){i.__webglDepthbuffer=[];for(var r=0;r<6;r++)e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]=e.createRenderbuffer(),b(i.__webglDepthbuffer[r],t)}else e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),b(i.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}this.setTexture2D=p,this.setTextureCube=function(t,o){var u=a.get(t);if(6===t.image.length)if(t.version>0&&u.__version!==t.version){u.__image__webglTextureCube||(t.addEventListener("dispose",h),u.__image__webglTextureCube=e.createTexture(),s.textures++),i.activeTexture(e.TEXTURE0+o),i.bindTexture(e.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var c=t&&t.isCompressedTexture,d=t.image[0]&&t.image[0].isDataTexture,p=[],v=0;v<6;v++)p[v]=c||d?d?t.image[v].image:t.image[v]:f(t.image[v],n.maxCubemapSize);var b=p[0],g=l(b),y=r(t.format),w=r(t.type);m(e.TEXTURE_CUBE_MAP,t,g);for(var v=0;v<6;v++)if(c)for(var _,x=p[v].mipmaps,k=0,E=x.length;k-1?i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+v,k,y,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+v,k,y,_.width,_.height,0,y,w,_.data);else d?i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,y,p[v].width,p[v].height,0,y,w,p[v].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,y,y,w,p[v]);t.generateMipmaps&&g&&e.generateMipmap(e.TEXTURE_CUBE_MAP),u.__version=t.version,t.onUpdate&&t.onUpdate(t)}else i.activeTexture(e.TEXTURE0+o),i.bindTexture(e.TEXTURE_CUBE_MAP,u.__image__webglTextureCube)},this.setTextureCubeDynamic=function(t,n){i.activeTexture(e.TEXTURE0+n),i.bindTexture(e.TEXTURE_CUBE_MAP,a.get(t).__webglTexture)},this.setupRenderTarget=function(t){var n=a.get(t),r=a.get(t.texture);t.addEventListener("dispose",d),r.__webglTexture=e.createTexture(),s.textures++;var o=t&&t.isWebGLRenderTargetCube,u=l(t);if(o){n.__webglFramebuffer=[];for(var f=0;f<6;f++)n.__webglFramebuffer[f]=e.createFramebuffer()}else n.__webglFramebuffer=e.createFramebuffer();if(o){i.bindTexture(e.TEXTURE_CUBE_MAP,r.__webglTexture),m(e.TEXTURE_CUBE_MAP,t.texture,u);for(var f=0;f<6;f++)v(n.__webglFramebuffer[f],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+f);t.texture.generateMipmaps&&u&&e.generateMipmap(e.TEXTURE_CUBE_MAP),i.bindTexture(e.TEXTURE_CUBE_MAP,null)}else i.bindTexture(e.TEXTURE_2D,r.__webglTexture),m(e.TEXTURE_2D,t.texture,u),v(n.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),t.texture.generateMipmaps&&u&&e.generateMipmap(e.TEXTURE_2D),i.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&g(t)},this.updateRenderTargetMipmap=function(t){var n=t.texture;if(n.generateMipmaps&&l(t)&&n.minFilter!==pe&&n.minFilter!==be){var r=t&&t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,o=a.get(n).__webglTexture;i.bindTexture(r,o),e.generateMipmap(r),i.bindTexture(r,null)}}}function fa(e){console.log("THREE.WebGLRenderer",i);var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),s=void 0!==e.context?e.context:null,u=void 0!==e.alpha&&e.alpha,f=void 0===e.depth||e.depth,d=void 0===e.stencil||e.stencil,m=void 0!==e.antialias&&e.antialias,v=void 0===e.premultipliedAlpha||e.premultipliedAlpha,k=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,X=[],K=[],Z=-1,Q=[],$=-1,ee=new Float32Array(8),te=[],ie=[];this.domElement=t,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=J,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var ae,ne=this,re=null,oe=null,se=null,ue=-1,fe="",de=null,we=new mt,je=null,Ze=new mt,Qe=0,tt=new si(0),it=0,at=t.width,nt=t.height,rt=1,ot=new mt(0,0,at,nt),st=!1,ut=new mt(0,0,at,nt),ft=new ki,lt=new function(){var e=this,t=null,i=0,a=!1,n=!1,r=new xi,o=new _i,s={value:null,needsUpdate:!1};function u(){s.value!==t&&(s.value=t,s.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function f(t,i,a,n){var u=null!==t?t.length:0,f=null;if(0!==u){if(f=s.value,!0!==n||null===f){var l=a+4*u,c=i.matrixWorldInverse;o.getNormalMatrix(c),(null===f||f.length0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var r=void 0!==i.precision?i.precision:"highp",o=n(r);o!==r&&(console.warn("THREE.WebGLRenderer:",r,"not supported, using",o,"instead."),r=o);var s=!0===i.logarithmicDepthBuffer&&!!t.get("EXT_frag_depth"),u=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),f=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=e.getParameter(e.MAX_TEXTURE_SIZE),c=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),h=e.getParameter(e.MAX_VERTEX_ATTRIBS),d=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),p=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=f>0,b=!!t.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==a)return a;var i=t.get("EXT_texture_filter_anisotropic");return a=null!==i?e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:n,precision:r,logarithmicDepthBuffer:s,maxTextures:u,maxVertexTextures:f,maxTextureSize:l,maxCubemapSize:c,maxAttributes:h,maxVertexUniforms:d,maxVaryings:p,maxFragmentUniforms:m,vertexTextures:v,floatFragmentTextures:b,floatVertexTextures:v&&b}}(ae,kt,e),Mt=new function(e,t,i){var o=new function(){var t=!1,i=new mt,a=null,n=new mt;return{setMask:function(i){a===i||t||(e.colorMask(i,i,i,i),a=i)},setLocked:function(e){t=e},setClear:function(t,a,r,o){i.set(t,a,r,o),!1===n.equals(i)&&(e.clearColor(t,a,r,o),n.copy(i))},reset:function(){t=!1,a=null,n.set(0,0,0,1)}}},s=new function(){var t=!1,i=null,a=null,n=null;return{setTest:function(t){t?Z(e.DEPTH_TEST):Q(e.DEPTH_TEST)},setMask:function(a){i===a||t||(e.depthMask(a),i=a)},setFunc:function(t){if(a!==t){if(t)switch(t){case z:e.depthFunc(e.NEVER);break;case U:e.depthFunc(e.ALWAYS);break;case H:e.depthFunc(e.LESS);break;case Y:e.depthFunc(e.LEQUAL);break;case G:e.depthFunc(e.EQUAL);break;case V:e.depthFunc(e.GEQUAL);break;case W:e.depthFunc(e.GREATER);break;case q:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);a=t}},setLocked:function(e){t=e},setClear:function(t){n!==t&&(e.clearDepth(t),n=t)},reset:function(){t=!1,i=null,a=null,n=null}}},u=new function(){var t=!1,i=null,a=null,n=null,r=null,o=null,s=null,u=null,f=null;return{setTest:function(t){t?Z(e.STENCIL_TEST):Q(e.STENCIL_TEST)},setMask:function(a){i===a||t||(e.stencilMask(a),i=a)},setFunc:function(t,i,o){a===t&&n===i&&r===o||(e.stencilFunc(t,i,o),a=t,n=i,r=o)},setOp:function(t,i,a){o===t&&s===i&&u===a||(e.stencilOp(t,i,a),o=t,s=i,u=a)},setLocked:function(e){t=e},setClear:function(t){f!==t&&(e.clearStencil(t),f=t)},reset:function(){t=!1,i=null,a=null,n=null,r=null,o=null,s=null,u=null,f=null}}},f=e.getParameter(e.MAX_VERTEX_ATTRIBS),l=new Uint8Array(f),c=new Uint8Array(f),h=new Uint8Array(f),d={},p=null,m=null,v=null,k=null,E=null,M=null,S=null,T=null,A=!1,C=null,L=null,I=null,P=null,O=null,R=null,D=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),N=null,F={},j=new mt,B=new mt;function X(t,i,a){var n=new Uint8Array(4),r=e.createTexture();e.bindTexture(t,r),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var o=0;o=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var l=0;l=0&&e.numSupportedMorphNormals++}var c=a.__webglShader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(a.numClippingPlanes=lt.numPlanes,a.numIntersection=lt.numIntersection,c.clippingPlanes=lt.uniform),a.fog=t,a.lightsHash=gt.hash,e.lights&&(c.ambientLightColor.value=gt.ambient,c.directionalLights.value=gt.directional,c.spotLights.value=gt.spot,c.pointLights.value=gt.point,c.hemisphereLights.value=gt.hemi,c.directionalShadowMap.value=gt.directionalShadowMap,c.directionalShadowMatrix.value=gt.directionalShadowMatrix,c.spotShadowMap.value=gt.spotShadowMap,c.spotShadowMatrix.value=gt.spotShadowMatrix,c.pointShadowMap.value=gt.pointShadowMap,c.pointShadowMatrix.value=gt.pointShadowMatrix);var h=a.program.getUniforms(),d=ni.seqWithValue(h.seq,c);a.uniformsList=d}(i,t,a),i.needsUpdate=!1);var o=!1,s=!1,u=!1,f=n.program,l=f.getUniforms(),c=n.__webglShader.uniforms;if(f.id!==re&&(ae.useProgram(f.program),re=f.id,o=!0,s=!0,u=!0),i.id!==ue&&(ue=i.id,s=!0),o||e!==de){if(l.set(ae,e,"projectionMatrix"),Et.logarithmicDepthBuffer&&l.setValue(ae,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==de&&(de=e,s=!0,u=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var h=l.map.cameraPosition;void 0!==h&&h.setValue(ae,bt.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&l.setValue(ae,"viewMatrix",e.matrixWorldInverse),l.set(ae,ne,"toneMappingExposure"),l.set(ae,ne,"toneMappingWhitePoint")}if(i.skinning){l.setOptional(ae,a,"bindMatrix"),l.setOptional(ae,a,"bindMatrixInverse");var d=a.skeleton;d&&(Et.floatVertexTextures&&d.useVertexTexture?(l.set(ae,d,"boneTexture"),l.set(ae,d,"boneTextureWidth"),l.set(ae,d,"boneTextureHeight")):l.setOptional(ae,d,"boneMatrices"))}return s&&(i.lights&&function(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}(c,u),t&&i.fog&&function(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(c,t),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshDepthMaterial)&&function(e,t){var i;if(e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap),void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var a=i.offset,n=i.repeat;e.offsetRepeat.value.set(a.x,a.y,n.x,n.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}(c,i),i.isLineBasicMaterial?ii(c,i):i.isLineDashedMaterial?(ii(c,i),function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(c,i)):i.isPointsMaterial?function(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*rt,e.scale.value=.5*nt,e.map.value=t.map,null!==t.map){var i=t.map.offset,a=t.map.repeat;e.offsetRepeat.value.set(i.x,i.y,a.x,a.y)}}(c,i):i.isMeshLambertMaterial?function(e,t){t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(c,i):i.isMeshPhongMaterial?function(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),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)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(c,i):i.isMeshPhysicalMaterial?function(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,ai(e,t)}(c,i):i.isMeshStandardMaterial?ai(c,i):i.isMeshDepthMaterial?i.displacementMap&&(c.displacementMap.value=i.displacementMap,c.displacementScale.value=i.displacementScale,c.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&(c.opacity.value=i.opacity),ni.upload(ae,n.uniformsList,c,ne)),l.set(ae,a,"modelViewMatrix"),l.set(ae,a,"normalMatrix"),l.setValue(ae,"modelMatrix",a.matrixWorld),f}function ii(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function ai(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),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)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function oi(e){var t;if(e===le)return ae.REPEAT;if(e===ce)return ae.CLAMP_TO_EDGE;if(e===he)return ae.MIRRORED_REPEAT;if(e===pe)return ae.NEAREST;if(e===me)return ae.NEAREST_MIPMAP_NEAREST;if(e===ve)return ae.NEAREST_MIPMAP_LINEAR;if(e===be)return ae.LINEAR;if(e===ge)return ae.LINEAR_MIPMAP_NEAREST;if(e===ye)return ae.LINEAR_MIPMAP_LINEAR;if(e===_e)return ae.UNSIGNED_BYTE;if(e===Ce)return ae.UNSIGNED_SHORT_4_4_4_4;if(e===Le)return ae.UNSIGNED_SHORT_5_5_5_1;if(e===Ie)return ae.UNSIGNED_SHORT_5_6_5;if(e===xe)return ae.BYTE;if(e===ke)return ae.SHORT;if(e===Ee)return ae.UNSIGNED_SHORT;if(e===Me)return ae.INT;if(e===Se)return ae.UNSIGNED_INT;if(e===Te)return ae.FLOAT;if(e===Ae&&null!==(t=kt.get("OES_texture_half_float")))return t.HALF_FLOAT_OES;if(e===Oe)return ae.ALPHA;if(e===Re)return ae.RGB;if(e===De)return ae.RGBA;if(e===Ne)return ae.LUMINANCE;if(e===Fe)return ae.LUMINANCE_ALPHA;if(e===Be)return ae.DEPTH_COMPONENT;if(e===ze)return ae.DEPTH_STENCIL;if(e===E)return ae.FUNC_ADD;if(e===M)return ae.FUNC_SUBTRACT;if(e===S)return ae.FUNC_REVERSE_SUBTRACT;if(e===C)return ae.ZERO;if(e===L)return ae.ONE;if(e===I)return ae.SRC_COLOR;if(e===P)return ae.ONE_MINUS_SRC_COLOR;if(e===O)return ae.SRC_ALPHA;if(e===R)return ae.ONE_MINUS_SRC_ALPHA;if(e===D)return ae.DST_ALPHA;if(e===N)return ae.ONE_MINUS_DST_ALPHA;if(e===F)return ae.DST_COLOR;if(e===j)return ae.ONE_MINUS_DST_COLOR;if(e===B)return ae.SRC_ALPHA_SATURATE;if((e===Ue||e===He||e===Ye||e===Ge)&&null!==(t=kt.get("WEBGL_compressed_texture_s3tc"))){if(e===Ue)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===He)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Ye)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Ge)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===Ve||e===We||e===qe||e===Xe)&&null!==(t=kt.get("WEBGL_compressed_texture_pvrtc"))){if(e===Ve)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===We)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===qe)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===Xe)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===Ke&&null!==(t=kt.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===T||e===A)&&null!==(t=kt.get("EXT_blend_minmax"))){if(e===T)return t.MIN_EXT;if(e===A)return t.MAX_EXT}return e===Pe&&null!==(t=kt.get("WEBGL_depth_texture"))?t.UNSIGNED_INT_24_8_WEBGL:0}this.getContext=function(){return ae},this.getContextAttributes=function(){return ae.getContextAttributes()},this.forceContextLoss=function(){kt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Et.getMaxAnisotropy()},this.getPrecision=function(){return Et.precision},this.getPixelRatio=function(){return rt},this.setPixelRatio=function(e){void 0!==e&&(rt=e,this.setSize(ut.z,ut.w,!1))},this.getSize=function(){return{width:at,height:nt}},this.setSize=function(e,i,a){at=e,nt=i,t.width=e*rt,t.height=i*rt,!1!==a&&(t.style.width=e+"px",t.style.height=i+"px"),this.setViewport(0,0,e,i)},this.setViewport=function(e,t,i,a){Mt.viewport(ut.set(e,t,i,a))},this.setScissor=function(e,t,i,a){Mt.scissor(ot.set(e,t,i,a))},this.setScissorTest=function(e){Mt.setScissorTest(st=e)},this.getClearColor=function(){return tt},this.setClearColor=function(e,t){tt.set(e),it=void 0!==t?t:1,Bt(tt.r,tt.g,tt.b,it)},this.getClearAlpha=function(){return it},this.setClearAlpha=function(e){it=e,Bt(tt.r,tt.g,tt.b,it)},this.clear=function(e,t,i){var a=0;(void 0===e||e)&&(a|=ae.COLOR_BUFFER_BIT),(void 0===t||t)&&(a|=ae.DEPTH_BUFFER_BIT),(void 0===i||i)&&(a|=ae.STENCIL_BUFFER_BIT),ae.clear(a)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(e,t,i,a){this.setRenderTarget(e),this.clear(t,i,a)},this.resetGLState=Ut,this.dispose=function(){Q=[],$=-1,K=[],Z=-1,t.removeEventListener("webglcontextlost",Vt,!1)},this.renderBufferImmediate=function(e,t,i){Mt.initAttributes();var a=St.get(e);e.hasPositions&&!a.position&&(a.position=ae.createBuffer()),e.hasNormals&&!a.normal&&(a.normal=ae.createBuffer()),e.hasUvs&&!a.uv&&(a.uv=ae.createBuffer()),e.hasColors&&!a.color&&(a.color=ae.createBuffer());var n=t.getAttributes();if(e.hasPositions&&(ae.bindBuffer(ae.ARRAY_BUFFER,a.position),ae.bufferData(ae.ARRAY_BUFFER,e.positionArray,ae.DYNAMIC_DRAW),Mt.enableAttribute(n.position),ae.vertexAttribPointer(n.position,3,ae.FLOAT,!1,0,0)),e.hasNormals){if(ae.bindBuffer(ae.ARRAY_BUFFER,a.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&i.shading===h)for(var r=0,o=3*e.count;r8&&(l.length=8);for(var p=i.morphAttributes,c=0,h=l.length;c=0){var l=r[u];if(void 0!==l){var c=ae.FLOAT,h=l.array,d=l.normalized;h instanceof Float32Array?c=ae.FLOAT:h instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):h instanceof Uint16Array?c=ae.UNSIGNED_SHORT:h instanceof Int16Array?c=ae.SHORT:h instanceof Uint32Array?c=ae.UNSIGNED_INT:h instanceof Int32Array?c=ae.INT:h instanceof Int8Array?c=ae.BYTE:h instanceof Uint8Array&&(c=ae.UNSIGNED_BYTE);var p=l.itemSize,m=At.getAttributeBuffer(l);if(l.isInterleavedBufferAttribute){var v=l.data,b=v.stride,g=l.offset;v&&v.isInstancedInterleavedBuffer?(Mt.enableAttributeAndDivisor(f,v.meshPerAttribute,n),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):Mt.enableAttribute(f),ae.bindBuffer(ae.ARRAY_BUFFER,m),ae.vertexAttribPointer(f,p,c,d,b*v.array.BYTES_PER_ELEMENT,(a*b+g)*v.array.BYTES_PER_ELEMENT)}else l.isInstancedBufferAttribute?(Mt.enableAttributeAndDivisor(f,l.meshPerAttribute,n),void 0===i.maxInstancedCount&&(i.maxInstancedCount=l.meshPerAttribute*l.count)):Mt.enableAttribute(f),ae.bindBuffer(ae.ARRAY_BUFFER,m),ae.vertexAttribPointer(f,p,c,d,0,a*p*l.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var y=s[u];if(void 0!==y)switch(y.length){case 2:ae.vertexAttrib2fv(f,y);break;case 3:ae.vertexAttrib3fv(f,y);break;case 4:ae.vertexAttrib4fv(f,y);break;default:ae.vertexAttrib1fv(f,y)}}}}Mt.disableUnusedAttributes()}}(a,o,i),null!==m&&ae.bindBuffer(ae.ELEMENT_ARRAY_BUFFER,At.getAttributeBuffer(m)));var w=0;null!==m?w=m.count:void 0!==g&&(w=g.count);var _=i.drawRange.start*y,x=i.drawRange.count*y,k=null!==r?r.start*y:0,E=null!==r?r.count*y:1/0,M=Math.max(_,k),S=Math.min(w,_+x,k+E)-1,T=Math.max(0,S-M+1);if(0!==T){if(n.isMesh)if(!0===a.wireframe)Mt.setLineWidth(a.wireframeLinewidth*jt()),b.setMode(ae.LINES);else switch(n.drawMode){case Je:b.setMode(ae.TRIANGLES);break;case $e:b.setMode(ae.TRIANGLE_STRIP);break;case et:b.setMode(ae.TRIANGLE_FAN)}else if(n.isLine){var A=a.linewidth;void 0===A&&(A=1),Mt.setLineWidth(A*jt()),n.isLineSegments?b.setMode(ae.LINES):b.setMode(ae.LINE_STRIP)}else n.isPoints&&b.setMode(ae.POINTS);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&b.renderInstances(i,M,T):b.render(M,T)}},this.render=function(e,t,i,a){if(void 0===t||!0===t.isCamera){fe="",ue=-1,de=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),vt.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ft.setFromMatrix(vt),X.length=0,Z=-1,$=-1,te.length=0,ie.length=0,dt=this.localClippingEnabled,ht=lt.init(this.clippingPlanes,dt,t),function e(t,i){if(!1!==t.visible){var a=0!=(t.layers.mask&i.layers.mask);if(a)if(t.isLight)X.push(t);else if(t.isSprite)!1!==t.frustumCulled&&!0!==function(e){return pt.center.set(0,0,0),pt.radius=.7071067811865476,pt.applyMatrix4(e.matrixWorld),Jt(pt)}(t)||te.push(t);else if(t.isLensFlare)ie.push(t);else if(t.isImmediateRenderObject)!0===ne.sortObjects&&(bt.setFromMatrixPosition(t.matrixWorld),bt.applyProjection(vt)),Qt(t,null,t.material,bt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!1===t.frustumCulled||!0===function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),pt.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),Jt(pt)}(t))){var n=t.material;if(!0===n.visible){!0===ne.sortObjects&&(bt.setFromMatrixPosition(t.matrixWorld),bt.applyProjection(vt));var r=At.update(t);if(n.isMultiMaterial)for(var o=r.groups,s=n.materials,u=0,f=o.length;u=Et.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Et.maxTextures),Qe+=1,e},this.setTexture2D=function(){var e=!1;return function(t,i){t&&t.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),Tt.setTexture2D(t,i)}}(),this.setTexture=function(){var e=!1;return function(t,i){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),Tt.setTexture2D(t,i)}}(),this.setTextureCube=function(){var e=!1;return function(t,i){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?Tt.setTextureCube(t,i):Tt.setTextureCubeDynamic(t,i)}}(),this.getCurrentRenderTarget=function(){return oe},this.setRenderTarget=function(e){oe=e,e&&void 0===St.get(e).__webglFramebuffer&&Tt.setupRenderTarget(e);var t,i=e&&e.isWebGLRenderTargetCube;if(e){var a=St.get(e);t=i?a.__webglFramebuffer[e.activeCubeFace]:a.__webglFramebuffer,we.copy(e.scissor),je=e.scissorTest,Ze.copy(e.viewport)}else t=null,we.copy(ot).multiplyScalar(rt),je=st,Ze.copy(ut).multiplyScalar(rt);if(se!==t&&(ae.bindFramebuffer(ae.FRAMEBUFFER,t),se=t),Mt.scissor(we),Mt.setScissorTest(je),Mt.viewport(Ze),i){var n=St.get(e.texture);ae.framebufferTexture2D(ae.FRAMEBUFFER,ae.COLOR_ATTACHMENT0,ae.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,n.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,i,a,n,r){if(!1!==(e&&e.isWebGLRenderTarget)){var o=St.get(e).__webglFramebuffer;if(o){var s=!1;o!==se&&(ae.bindFramebuffer(ae.FRAMEBUFFER,o),s=!0);try{var u=e.texture,f=u.format,l=u.type;if(f!==De&&oi(f)!==ae.getParameter(ae.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===_e||oi(l)===ae.getParameter(ae.IMPLEMENTATION_COLOR_READ_TYPE)||l===Te&&(kt.get("OES_texture_float")||kt.get("WEBGL_color_buffer_float"))||l===Ae&&kt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");ae.checkFramebufferStatus(ae.FRAMEBUFFER)===ae.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-a&&i>=0&&i<=e.height-n&&ae.readPixels(t,i,a,n,oi(f),oi(l),r):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&ae.bindFramebuffer(ae.FRAMEBUFFER,se)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function la(e,t){this.name="",this.color=new si(e),this.density=void 0!==t?t:25e-5}function ca(e,t,i){this.name="",this.color=new si(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3}function ha(){Ai.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function da(e,t,i,a,n){Ai.call(this),this.lensFlares=[],this.positionScreen=new yt,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,i,a,n)}function pa(e){pi.call(this),this.type="SpriteMaterial",this.color=new si(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function ma(e){Ai.call(this),this.type="Sprite",this.material=void 0!==e?e:new pa}function va(){Ai.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ba(e,t,i,a,n,r,o,s,u,f,l,c){ht.call(this,null,r,o,s,u,f,a,n,l,c),this.image={data:e,width:t,height:i},this.magFilter=void 0!==u?u:pe,this.minFilter=void 0!==f?f:pe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function ga(e,t,i){if(this.useVertexTexture=void 0===i||i,this.identityMatrix=new wt,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var a=Math.sqrt(4*this.bones.length);a=lt.nextPowerOfTwo(Math.ceil(a)),a=Math.max(a,4),this.boneTextureWidth=a,this.boneTextureHeight=a,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new ba(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,De,Te)}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 n=0,r=this.bones.length;n=e.HAVE_CURRENT_DATA&&(f.needsUpdate=!0)}()}function Aa(e,t,i,a,n,r,o,s,u,f,l,c){ht.call(this,null,r,o,s,u,f,a,n,l,c),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Ca(e,t,i,a,n,r,o,s,u){ht.call(this,e,t,i,a,n,r,o,s,u),this.needsUpdate=!0}function La(e,t,i,a,n,r,o,s,u,f){if((f=void 0!==f?f:Be)!==Be&&f!==ze)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");ht.call(this,null,a,n,r,o,s,f,i,u),this.image={width:e,height:t},this.type=void 0!==i?i:Ee,this.magFilter=void 0!==o?o:pe,this.minFilter=void 0!==s?s:pe,this.flipY=!1,this.generateMipmaps=!1}function Ia(e){Yi.call(this);var t=[0,0],i={};function a(e,t){return e-t}var n=["a","b","c"];if(e&&e.isGeometry){for(var r=e.vertices,o=e.faces,s=0,u=new Uint32Array(6*o.length),f=0,l=o.length;f65535?Fi:Ni)(m,1)),this.addAttribute("position",ji(u,3)),this.addAttribute("uv",ji(f,2)),this.computeVertexNormals()}function Oa(e,t,i){Bi.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:i},this.fromBufferGeometry(new Pa(e,t,i)),this.mergeVertices()}function Ra(e,t,i,a){Yi.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:a},i=i||1;var n=[],r=[];function o(e,t,i,a){var n,r,o=Math.pow(2,a),u=[];for(n=0;n<=o;n++){u[n]=[];var f=e.clone().lerp(i,n/o),l=t.clone().lerp(i,n/o),c=o-n;for(r=0;r<=c;r++)u[n][r]=0===r&&n===o?f:f.clone().lerp(l,r/c)}for(n=0;n.9&&o<.1&&(t<.2&&(r[e+0]+=1),i<.2&&(r[e+2]+=1),a<.2&&(r[e+4]+=1))}}()}(),this.addAttribute("position",ji(n,3)),this.addAttribute("normal",ji(n.slice(),3)),this.addAttribute("uv",ji(r,2)),this.normalizeNormals(),this.boundingSphere=new wi(new yt,i)}function Da(e,t){Ra.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Na(e,t){Bi.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Da(e,t)),this.mergeVertices()}function Fa(e,t){Ra.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ja(e,t){Bi.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Fa(e,t)),this.mergeVertices()}function Ba(e,t){var i=(1+Math.sqrt(5))/2,a=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1];Ra.call(this,a,[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],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function za(e,t){Bi.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ba(e,t)),this.mergeVertices()}function Ua(e,t){var i=(1+Math.sqrt(5))/2,a=1/i,n=[-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,-a,-i,0,-a,i,0,a,-i,0,a,i,-a,-i,0,-a,i,0,a,-i,0,a,i,0,-i,0,-a,i,0,-a,-i,0,a,i,0,a];Ra.call(this,n,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ha(e,t){Bi.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ua(e,t)),this.mergeVertices()}function Ya(e,t,i,a){Bi.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:a},this.fromBufferGeometry(new Ra(e,t,i,a)),this.mergeVertices()}function Ga(e,t,i,a,n){Yi.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:a,closed:n},t=t||64,i=i||1,a=a||8,n=n||!1;var r=e.computeFrenetFrames(t,n);this.tangents=r.tangents,this.normals=r.normals,this.binormals=r.binormals;var o,s,u=new yt,f=new yt,l=new ct,c=[],h=[],d=[],p=[];function m(n){var o=e.getPointAt(n/t),l=r.normals[n],d=r.binormals[n];for(s=0;s<=a;s++){var p=s/a*Math.PI*2,m=Math.sin(p),v=-Math.cos(p);f.x=v*l.x+m*d.x,f.y=v*l.y+m*d.y,f.z=v*l.z+m*d.z,f.normalize(),h.push(f.x,f.y,f.z),u.x=o.x+i*f.x,u.y=o.y+i*f.y,u.z=o.z+i*f.z,c.push(u.x,u.y,u.z)}}!function(){for(o=0;o65535?Fi:Ni)(p,1)),this.addAttribute("position",ji(c,3)),this.addAttribute("normal",ji(h,3)),this.addAttribute("uv",ji(d,2))}function Va(e,t,i,a,n,r){Bi.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:a,closed:n},void 0!==r&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Ga(e,t,i,a,n);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Wa(e,t,i,a,n,r){Yi.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:a,p:n,q:r},e=e||100,t=t||40,i=Math.floor(i)||64,a=Math.floor(a)||8,n=n||2,r=r||3;var o,s,u=(a+1)*(i+1),f=a*i*2*3,l=new Di(new(f>65535?Uint32Array:Uint16Array)(f),1),c=new Di(new Float32Array(3*u),3),h=new Di(new Float32Array(3*u),3),d=new Di(new Float32Array(2*u),2),p=0,m=0,v=new yt,b=new yt,g=new ct,y=new yt,w=new yt,_=new yt,x=new yt,k=new yt;for(o=0;o<=i;++o){var E=o/i*n*Math.PI*2;for(P(E,n,r,e,y),P(E+.01,n,r,e,w),x.subVectors(w,y),k.addVectors(w,y),_.crossVectors(x,k),k.crossVectors(_,x),_.normalize(),k.normalize(),s=0;s<=a;++s){var M=s/a*Math.PI*2,S=-t*Math.cos(M),T=t*Math.sin(M);v.x=y.x+(S*k.x+T*_.x),v.y=y.y+(S*k.y+T*_.y),v.z=y.z+(S*k.z+T*_.z),c.setXYZ(p,v.x,v.y,v.z),b.subVectors(v,y).normalize(),h.setXYZ(p,b.x,b.y,b.z),g.x=o/i,g.y=s/a,d.setXY(p,g.x,g.y),p++}}for(s=1;s<=i;s++)for(o=1;o<=a;o++){var A=(a+1)*(s-1)+(o-1),C=(a+1)*s+(o-1),L=(a+1)*s+o,I=(a+1)*(s-1)+o;l.setX(m,A),m++,l.setX(m,C),m++,l.setX(m,I),m++,l.setX(m,C),m++,l.setX(m,L),m++,l.setX(m,I),m++}function P(e,t,i,a,n){var r=Math.cos(e),o=Math.sin(e),s=i/t*e,u=Math.cos(s);n.x=a*(2+u)*.5*r,n.y=a*(2+u)*o*.5,n.z=a*Math.sin(s)*.5}this.setIndex(l),this.addAttribute("position",c),this.addAttribute("normal",h),this.addAttribute("uv",d)}function qa(e,t,i,a,n,r,o){Bi.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:a,p:n,q:r},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Wa(e,t,i,a,n,r)),this.mergeVertices()}function Xa(e,t,i,a,n){Yi.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:a,arc:n},e=e||100,t=t||40,i=Math.floor(i)||8,a=Math.floor(a)||6,n=n||2*Math.PI;var r,o,s=(i+1)*(a+1),u=i*a*2*3,f=new(u>65535?Uint32Array:Uint16Array)(u),l=new Float32Array(3*s),c=new Float32Array(3*s),h=new Float32Array(2*s),d=0,p=0,m=0,v=new yt,b=new yt,g=new yt;for(r=0;r<=i;r++)for(o=0;o<=a;o++){var y=o/a*n,w=r/i*Math.PI*2;b.x=(e+t*Math.cos(w))*Math.cos(y),b.y=(e+t*Math.cos(w))*Math.sin(y),b.z=t*Math.sin(w),l[d]=b.x,l[d+1]=b.y,l[d+2]=b.z,v.x=e*Math.cos(y),v.y=e*Math.sin(y),g.subVectors(b,v).normalize(),c[d]=g.x,c[d+1]=g.y,c[d+2]=g.z,h[p]=o/a,h[p+1]=r/i,d+=3,p+=2}for(r=1;r<=i;r++)for(o=1;o<=a;o++){var _=(a+1)*r+o-1,x=(a+1)*(r-1)+o-1,k=(a+1)*(r-1)+o,E=(a+1)*r+o;f[m]=_,f[m+1]=x,f[m+2]=E,f[m+3]=x,f[m+4]=k,f[m+5]=E,m+=6}this.setIndex(new Di(f,1)),this.addAttribute("position",new Di(l,3)),this.addAttribute("normal",new Di(c,3)),this.addAttribute("uv",new Di(h,2))}function Ka(e,t,i,a,n){Bi.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:a,arc:n},this.fromBufferGeometry(new Xa(e,t,i,a,n))}la.prototype.isFogExp2=!0,la.prototype.clone=function(){return new la(this.color.getHex(),this.density)},la.prototype.toJSON=function(e){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},ca.prototype.isFog=!0,ca.prototype.clone=function(){return new ca(this.color.getHex(),this.near,this.far)},ca.prototype.toJSON=function(e){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ha.prototype=Object.create(Ai.prototype),ha.prototype.constructor=ha,ha.prototype.copy=function(e,t){return Ai.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},ha.prototype.toJSON=function(e){var t=Ai.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},da.prototype=Object.assign(Object.create(Ai.prototype),{constructor:da,isLensFlare:!0,copy:function(e){Ai.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,i=e.lensFlares.length;tn||i.push({distance:Math.sqrt(a),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),va.prototype=Object.assign(Object.create(Ai.prototype),{constructor:va,copy:function(e){Ai.prototype.copy.call(this,e,!1);for(var t=e.levels,i=0,a=t.length;i1){e.setFromMatrixPosition(i.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);a[0].object.visible=!0;for(var r=1,o=a.length;r=a[r].distance;r++)a[r-1].object.visible=!1,a[r].object.visible=!0;for(;ro)){h.applyMatrix4(this.matrixWorld);var k=a.ray.origin.distanceTo(h);ka.far||n.push({distance:k,point:c.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}else for(var g=0,y=v.length/3-1;go)){h.applyMatrix4(this.matrixWorld);var k=a.ray.origin.distanceTo(h);ka.far||n.push({distance:k,point:c.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}}else if(s&&s.isGeometry)for(var E=s.vertices,M=E.length,g=0;go)){h.applyMatrix4(this.matrixWorld);var k=a.ray.origin.distanceTo(h);ka.far||n.push({distance:k,point:c.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ka.prototype=Object.assign(Object.create(xa.prototype),{constructor:ka,isLineSegments:!0}),Ea.prototype=Object.create(pi.prototype),Ea.prototype.constructor=Ea,Ea.prototype.isPointsMaterial=!0,Ea.prototype.copy=function(e){return pi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},Ma.prototype=Object.assign(Object.create(Ai.prototype),{constructor:Ma,isPoints:!0,raycast:function(){var e=new wt,t=new Mi,i=new wi;return function(a,n){var r=this,o=this.geometry,s=this.matrixWorld,u=a.params.Points.threshold;if(null===o.boundingSphere&&o.computeBoundingSphere(),i.copy(o.boundingSphere),i.applyMatrix4(s),!1!==a.ray.intersectsSphere(i)){e.getInverse(s),t.copy(a.ray).applyMatrix4(e);var f=u/((this.scale.x+this.scale.y+this.scale.z)/3),l=f*f,c=new yt;if(o&&o.isBufferGeometry){var h=o.index,d=o.attributes,p=d.position.array;if(null!==h)for(var m=h.array,v=0,b=m.length;va.far)return;n.push({distance:f,distanceToRay:Math.sqrt(o),point:u.clone(),index:i,face:null,object:r})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Sa.prototype=Object.assign(Object.create(Ai.prototype),{constructor:Sa}),Ta.prototype=Object.create(ht.prototype),Ta.prototype.constructor=Ta,Aa.prototype=Object.create(ht.prototype),Aa.prototype.constructor=Aa,Aa.prototype.isCompressedTexture=!0,Ca.prototype=Object.create(ht.prototype),Ca.prototype.constructor=Ca,La.prototype=Object.create(ht.prototype),La.prototype.constructor=La,La.prototype.isDepthTexture=!0,Ia.prototype=Object.create(Yi.prototype),Ia.prototype.constructor=Ia,Pa.prototype=Object.create(Yi.prototype),Pa.prototype.constructor=Pa,Oa.prototype=Object.create(Bi.prototype),Oa.prototype.constructor=Oa,Ra.prototype=Object.create(Yi.prototype),Ra.prototype.constructor=Ra,Da.prototype=Object.create(Ra.prototype),Da.prototype.constructor=Da,Na.prototype=Object.create(Bi.prototype),Na.prototype.constructor=Na,Fa.prototype=Object.create(Ra.prototype),Fa.prototype.constructor=Fa,ja.prototype=Object.create(Bi.prototype),ja.prototype.constructor=ja,Ba.prototype=Object.create(Ra.prototype),Ba.prototype.constructor=Ba,za.prototype=Object.create(Bi.prototype),za.prototype.constructor=za,Ua.prototype=Object.create(Ra.prototype),Ua.prototype.constructor=Ua,Ha.prototype=Object.create(Bi.prototype),Ha.prototype.constructor=Ha,Ya.prototype=Object.create(Bi.prototype),Ya.prototype.constructor=Ya,Ga.prototype=Object.create(Yi.prototype),Ga.prototype.constructor=Ga,Va.prototype=Object.create(Bi.prototype),Va.prototype.constructor=Va,Wa.prototype=Object.create(Yi.prototype),Wa.prototype.constructor=Wa,qa.prototype=Object.create(Bi.prototype),qa.prototype.constructor=qa,Xa.prototype=Object.create(Yi.prototype),Xa.prototype.constructor=Xa,Ka.prototype=Object.create(Bi.prototype),Ka.prototype.constructor=Ka;var Za={area:function(e){for(var t=e.length,i=0,a=t-1,n=0;n=-Number.EPSILON&&x>=-Number.EPSILON&&_>=-Number.EPSILON))return!1;return!0}return function(t,i){var a=t.length;if(a<3)return null;var n,r,o,s=[],u=[],f=[];if(Za.area(t)>0)for(r=0;r2;){if(c--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?f:s;if(l<=(n=r)&&(n=0),l<=(r=n+1)&&(r=0),l<=(o=r+1)&&(o=0),e(t,n,r,o,l,u)){var h,d,p,m,v;for(h=u[n],d=u[r],p=u[o],s.push([t[h],t[d],t[p]]),f.push([u[n],u[r],u[o]]),m=r,v=r+1;v2&&e[t-1].equals(e[0])&&e.pop()}function a(e,t,i){return e.x!==t.x?e.xNumber.EPSILON){var p;if(h>0){if(d<0||d>h)return[];if((p=f*l-u*c)<0||p>h)return[]}else{if(d>0||d0||pk?[]:g===k?r?[]:[v]:y<=k?[v,b]:[v,_])}function r(e,t,i,a){var n=t.x-e.x,r=t.y-e.y,o=i.x-e.x,s=i.y-e.y,u=a.x-e.x,f=a.y-e.y,l=n*s-r*o,c=n*f-r*u;if(Math.abs(l)>Number.EPSILON){var h=u*s-f*o;return l>0?c>=0&&h>=0:c>=0||h>=0}return c>0}i(e),t.forEach(i);for(var o,s,u,f,l,c,h={},d=e.concat(),p=0,m=t.length;pn&&(s=0);var u=r(a[e],a[o],a[s],i[t]);if(!u)return!1;var f=i.length-1,l=t-1;l<0&&(l=f);var c=t+1;return c>f&&(c=0),!!(u=r(i[t],i[l],i[c],a[e]))}function s(e,t){var i,r;for(i=0;i0)return!0;return!1}var u=[];function f(e,i){var a,r,o,s;for(a=0;a0)return!0;return!1}for(var l,c,h,d,p,m,v,b,g,y,w=[],_=0,x=t.length;_0;){if(--E<0){console.log("Infinite Loop! Holes left:"+u.length+", Probably Hole outside Shape!");break}for(c=k;c=0)break;w[m]=!0}if(l>=0)break}}return a}(e,t),b=Za.triangulate(v,!1);for(o=0,s=b.length;o0)&&k.push(E,M,T),(m!==i-1||s65535?Fi:Ni)(k,1)),this.addAttribute("position",f),this.addAttribute("normal",l),this.addAttribute("uv",c),this.boundingSphere=new wi(new yt,e)}function en(e,t,i,a,n,r,o){Bi.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:a,phiLength:n,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new $a(e,t,i,a,n,r,o))}function tn(e,t,i,a,n,r){Yi.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:a,thetaStart:n,thetaLength:r},e=e||20,t=t||50,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI,i=void 0!==i?Math.max(3,i):8,a=void 0!==a?Math.max(1,a):1;var o,s,u,f=(i+1)*(a+1),l=i*a*2*3,c=new Di(new(l>65535?Uint32Array:Uint16Array)(l),1),h=new Di(new Float32Array(3*f),3),d=new Di(new Float32Array(3*f),3),p=new Di(new Float32Array(2*f),2),m=0,v=0,b=e,g=(t-e)/a,y=new yt,w=new ct;for(s=0;s<=a;s++){for(u=0;u<=i;u++)o=n+u/i*r,y.x=b*Math.cos(o),y.y=b*Math.sin(o),h.setXYZ(m,y.x,y.y,y.z),d.setXYZ(m,0,0,1),w.x=(y.x/t+1)/2,w.y=(y.y/t+1)/2,p.setXY(m,w.x,w.y),m++;b+=g}for(s=0;s65535?Uint32Array:Uint16Array)(u),1),l=new Di(new Float32Array(3*s),3),c=new Di(new Float32Array(2*s),2),h=0,d=0,p=1/t,m=new yt,v=new ct;for(r=0;r<=t;r++){var b=i+r*p*a,g=Math.sin(b),y=Math.cos(b);for(o=0;o<=e.length-1;o++)m.x=e[o].x*g,m.y=e[o].y,m.z=e[o].x*y,l.setXYZ(h,m.x,m.y,m.z),v.x=r/t,v.y=o/(e.length-1),c.setXY(h,v.x,v.y),h++}for(r=0;r0&&f++,t>0&&f++);var l=function(){var e=(a+1)*(n+1);return!1===r&&(e+=(a+1)*f+a*f),e}(),c=function(){var e=a*n*2*3;return!1===r&&(e+=a*f*3),e}(),h=new Di(new(c>65535?Uint32Array:Uint16Array)(c),1),d=new Di(new Float32Array(3*l),3),p=new Di(new Float32Array(3*l),3),m=new Di(new Float32Array(2*l),2),v=0,b=0,g=[],y=i/2,w=0;function _(i){var n,r,f,l=new ct,c=new yt,g=0,_=!0===i?e:t,x=!0===i?1:-1;for(r=v,n=1;n<=a;n++)d.setXYZ(v,0,y*x,0),p.setXYZ(v,0,x,0),l.x=.5,l.y=.5,m.setXY(v,l.x,l.y),v++;for(f=v,n=0;n<=a;n++){var k=n/a,E=k*s+o,M=Math.cos(E),S=Math.sin(E);c.x=_*S,c.y=y*x,c.z=_*M,d.setXYZ(v,c.x,c.y,c.z),p.setXYZ(v,0,x,0),l.x=.5*M+.5,l.y=.5*S*x+.5,m.setXY(v,l.x,l.y),v++}for(n=0;n0&&_(!0),t>0&&_(!1)),this.setIndex(h),this.addAttribute("position",d),this.addAttribute("normal",p),this.addAttribute("uv",m)}function ln(e,t,i,a,n,r,o,s){Bi.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:a,heightSegments:n,openEnded:r,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new fn(e,t,i,a,n,r,o,s)),this.mergeVertices()}function cn(e,t,i,a,n,r,o){ln.call(this,0,e,t,i,a,n,r,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:a,openEnded:n,thetaStart:r,thetaLength:o}}function hn(e,t,i,a,n,r,o){fn.call(this,0,e,t,i,a,n,r,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:a,openEnded:n,thetaStart:r,thetaLength:o}}function dn(e,t,i,a){Yi.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:a},e=e||50,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI;var n=t+2,r=new Float32Array(3*n),o=new Float32Array(3*n),s=new Float32Array(2*n);o[2]=1,s[0]=.5,s[1]=.5;for(var u=0,f=3,l=2;u<=t;u++,f+=3,l+=2){var c=i+u/t*a;r[f]=e*Math.cos(c),r[f+1]=e*Math.sin(c),o[f+2]=1,s[l]=(r[f]/e+1)/2,s[l+1]=(r[f+1]/e+1)/2}for(var h=[],f=1;f<=t;f++)h.push(f,f+1,0);this.setIndex(new Di(new Uint16Array(h),1)),this.addAttribute("position",new Di(r,3)),this.addAttribute("normal",new Di(o,3)),this.addAttribute("uv",new Di(s,2)),this.boundingSphere=new wi(new yt,e)}function pn(e,t,i,a){Bi.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new dn(e,t,i,a))}function mn(e,t,i,a,n,r){Bi.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:a,heightSegments:n,depthSegments:r},this.fromBufferGeometry(new Vi(e,t,i,a,n,r)),this.mergeVertices()}Qa.prototype=Object.create(Bi.prototype),Qa.prototype.constructor=Qa,Qa.prototype.addShapeList=function(e,t){for(var i=e.length,a=0;aNumber.EPSILON){var h=Math.sqrt(l),d=Math.sqrt(u*u+f*f),p=t.x-s/h,m=t.y+o/h,v=i.x-f/d,b=i.y+u/d,g=((v-p)*f-(b-m)*u)/(o*f-s*u);a=p+o*g-e.x,n=m+s*g-e.y;var y=a*a+n*n;if(y<=2)return new ct(a,n);r=Math.sqrt(y/2)}else{var w=!1;o>Number.EPSILON?u>Number.EPSILON&&(w=!0):o<-Number.EPSILON?u<-Number.EPSILON&&(w=!0):Math.sign(s)===Math.sign(f)&&(w=!0),w?(a=-s,n=o,r=Math.sqrt(l)):(a=o,n=s,r=Math.sqrt(l/2))}return new ct(a/r,n/r)}for(var j=[],B=0,z=T.length,U=z-1,H=B+1;B=0;C--){for(I=C/d,P=c*Math.cos(I*Math.PI/2),L=h*Math.sin(I*Math.PI/2),B=0,z=T.length;B=0;){i=B,(a=B-1)<0&&(a=e.length-1);var n=0,r=v+2*d;for(n=0;n0||0===e.search(/^data\:image\/jpeg/);n.format=a?Re:De,n.image=i,n.needsUpdate=!0,void 0!==t&&t(n)},i,a),n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setPath:function(e){return this.path=e,this}}),Fn.prototype=Object.assign(Object.create(Ai.prototype),{constructor:Fn,isLight:!0,copy:function(e){return Ai.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=Ai.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),jn.prototype=Object.assign(Object.create(Fn.prototype),{constructor:jn,isHemisphereLight:!0,copy:function(e){return Fn.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Bn.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),zn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:zn,isSpotLightShadow:!0,update:function(e){var t=2*lt.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,a=e.distance||500,n=this.camera;t===n.fov&&i===n.aspect&&a===n.far||(n.fov=t,n.aspect=i,n.far=a,n.updateProjectionMatrix())}}),Un.prototype=Object.assign(Object.create(Fn.prototype),{constructor:Un,isSpotLight:!0,copy:function(e){return Fn.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Hn.prototype=Object.assign(Object.create(Fn.prototype),{constructor:Hn,isPointLight:!0,copy:function(e){return Fn.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Yn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Yn}),Gn.prototype=Object.assign(Object.create(Fn.prototype),{constructor:Gn,isDirectionalLight:!0,copy:function(e){return Fn.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Vn.prototype=Object.assign(Object.create(Fn.prototype),{constructor:Vn,isAmbientLight:!0});var Wn,qn={arraySlice:function(e,t,i){return qn.isTypedArray(e)?new e.constructor(e.subarray(t,i)):e.slice(t,i)},convertArray:function(e,t,i){return!e||!i&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,i=new Array(t),a=0;a!==t;++a)i[a]=a;return i.sort(function(t,i){return e[t]-e[i]}),i},sortedArray:function(e,t,i){for(var a=e.length,n=new e.constructor(a),r=0,o=0;o!==a;++r)for(var s=i[r]*t,u=0;u!==t;++u)n[o++]=e[s+u];return n},flattenJSON:function(e,t,i,a){for(var n=1,r=e[0];void 0!==r&&void 0===r[a];)r=e[n++];if(void 0!==r){var o=r[a];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=r[a])&&(t.push(r.time),i.push.apply(i,o)),r=e[n++]}while(void 0!==r);else if(void 0!==o.toArray)do{void 0!==(o=r[a])&&(t.push(r.time),o.toArray(i,i.length)),r=e[n++]}while(void 0!==r);else do{void 0!==(o=r[a])&&(t.push(r.time),i.push(o)),r=e[n++]}while(void 0!==r)}}};function Xn(e,t,i,a){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==a?a:new t.constructor(i),this.sampleValues=t,this.valueSize=i}function Kn(e,t,i,a){Xn.call(this,e,t,i,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Zn(e,t,i,a){Xn.call(this,e,t,i,a)}function Qn(e,t,i,a){Xn.call(this,e,t,i,a)}function Jn(e,t,i,a){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=qn.convertArray(t,this.TimeBufferType),this.values=qn.convertArray(i,this.ValueBufferType),this.setInterpolation(a||this.DefaultInterpolation),this.validate(),this.optimize()}function $n(e,t,i,a){Jn.call(this,e,t,i,a)}function er(e,t,i,a){Xn.call(this,e,t,i,a)}function tr(e,t,i,a){Jn.call(this,e,t,i,a)}function ir(e,t,i,a){Jn.call(this,e,t,i,a)}function ar(e,t,i,a){Jn.call(this,e,t,i,a)}function nr(e,t,i){Jn.call(this,e,t,i)}function rr(e,t,i,a){Jn.call(this,e,t,i,a)}function or(e,t,i,a){Jn.apply(this,arguments)}function sr(e,t,i){this.name=e,this.tracks=i,this.duration=void 0!==t?t:-1,this.uuid=lt.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function ur(e){this.manager=void 0!==e?e:Cn,this.textures={}}function fr(e){this.manager=void 0!==e?e:Cn}function lr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function cr(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Cn,this.withCredentials=!1}function hr(e){this.manager=void 0!==e?e:Cn,this.texturePath=""}function dr(){}function pr(e,t){this.v1=e,this.v2=t}function mr(){this.curves=[],this.autoClose=!1}function vr(e,t,i,a,n,r,o,s){this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=a,this.aStartAngle=n,this.aEndAngle=r,this.aClockwise=o,this.aRotation=s||0}Xn.prototype={constructor:Xn,evaluate:function(e){var t=this.parameterPositions,i=this._cachedIndex,a=t[i],n=t[i-1];e:{t:{var r;i:{a:if(!(e=n)break e;var s=t[1];e=n)break t}r=i,i=0}for(;i>>1;et;)--r;if(++r,0!==n||r!==a){n>=r&&(r=Math.max(r,1),n=r-1);var o=this.getValueSize();this.times=qn.arraySlice(i,n,r),this.values=qn.arraySlice(this.values,n*o,r*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("invalid value size in track",this),e=!1);var i=this.times,a=this.values,n=i.length;0===n&&(console.error("track is empty",this),e=!1);for(var r=null,o=0;o!==n;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,o,s),e=!1;break}if(null!==r&&r>s){console.error("out of order keys",this,o,s,r),e=!1;break}r=s}if(void 0!==a&&qn.isTypedArray(a))for(var o=0,u=a.length;o!==u;++o){var f=a[o];if(isNaN(f)){console.error("value is not a valid number",this,o,f),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,i=this.getValueSize(),a=2302===this.getInterpolation(),n=1,r=e.length-1,o=1;o0){e[n]=e[r];for(var m=r*i,v=n*i,d=0;d!==i;++d)t[v+d]=t[m+d];++n}return n!==e.length&&(this.times=qn.arraySlice(e,0,n),this.values=qn.arraySlice(t,0,n*i)),this}},$n.prototype=Object.assign(Object.create(Wn),{constructor:$n,ValueTypeName:"vector"}),er.prototype=Object.assign(Object.create(Xn.prototype),{constructor:er,interpolate_:function(e,t,i,a){for(var n=this.resultBuffer,r=this.sampleValues,o=this.valueSize,s=e*o,u=(i-t)/(a-t),f=s+o;s!==f;s+=4)gt.slerpFlat(n,0,r,s-o,r,s,u);return n}}),tr.prototype=Object.assign(Object.create(Wn),{constructor:tr,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new er(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),ir.prototype=Object.assign(Object.create(Wn),{constructor:ir,ValueTypeName:"number"}),ar.prototype=Object.assign(Object.create(Wn),{constructor:ar,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),nr.prototype=Object.assign(Object.create(Wn),{constructor:nr,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),rr.prototype=Object.assign(Object.create(Wn),{constructor:rr,ValueTypeName:"color"}),or.prototype=Wn,Wn.constructor=or,Object.assign(or,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=or._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var i=[],a=[];qn.flattenJSON(e.keys,i,a,"value"),e.times=i,e.values=a}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,i=e.constructor;if(void 0!==i.toJSON)t=i.toJSON(e);else{t={name:e.name,times:qn.convertArray(e.times,Array),values:qn.convertArray(e.values,Array)};var a=e.getInterpolation();a!==e.DefaultInterpolation&&(t.interpolation=a)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ir;case"vector":case"vector2":case"vector3":case"vector4":return $n;case"color":return rr;case"quaternion":return tr;case"bool":case"boolean":return nr;case"string":return ar}throw new Error("Unsupported typeName: "+e)}}),sr.prototype={constructor:sr,resetDuration:function(){for(var e=this.tracks,t=0,i=0,a=e.length;i!==a;++i){var n=this.tracks[i];t=Math.max(t,n.times[n.times.length-1])}this.duration=t},trim:function(){for(var e=0;e1){var f=u[1],l=a[f];l||(a[f]=l=[]),l.push(s)}}var c=[];for(var f in a)c.push(sr.CreateFromMorphTargetSequence(f,a[f],t,i));return c},parseAnimation:function(e,t){if(!e)return console.error(" no animation in JSONLoader data"),null;for(var i=function(e,t,i,a,n){if(0!==i.length){var r=[],o=[];qn.flattenJSON(i,r,o,a),0!==r.length&&n.push(new e(t,r,o))}},a=[],n=e.name||"default",r=e.length||-1,o=e.fps||30,s=e.hierarchy||[],u=0;u1?e.skinWeights[a+1]:0,s=t>2?e.skinWeights[a+2]:0,u=t>3?e.skinWeights[a+3]:0;i.skinWeights.push(new mt(r,o,s,u))}if(e.skinIndices)for(var a=0,n=e.skinIndices.length;a1?e.skinIndices[a+1]:0,c=t>2?e.skinIndices[a+2]:0,h=t>3?e.skinIndices[a+3]:0;i.skinIndices.push(new mt(f,l,c,h))}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.")}(),function(t){if(void 0!==e.morphTargets)for(var a=0,n=e.morphTargets.length;a0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var l=i.faces,c=e.morphColors[0].colors,a=0,n=l.length;a0&&(i.animations=t)}(),i.computeFaceNormals(),i.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:i};var n=lr.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:i,materials:n}}}),Object.assign(hr.prototype,{load:function(e,t,i,a){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var n=this,r=new Ln(n.manager);r.load(e,function(e){n.parse(JSON.parse(e),t)},i,a)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var i=this.parseGeometries(e.geometries),a=this.parseImages(e.images,function(){void 0!==t&&t(o)}),n=this.parseTextures(e.textures,a),r=this.parseMaterials(e.materials,n),o=this.parseObject(e.object,i,r);return e.animations&&(o.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(o),o},parseGeometries:function(e){var t={};if(void 0!==e)for(var i=new cr,a=new fr,n=0,r=e.length;n0){var r=new An(t),o=new Rn(r);o.setCrossOrigin(this.crossOrigin);for(var s=0,u=e.length;s0?new wa(s,u):new Gi(s,u);break;case"LOD":n=new va;break;case"Line":n=new xa(r(t.geometry),o(t.material),t.mode);break;case"LineSegments":n=new ka(r(t.geometry),o(t.material));break;case"PointCloud":case"Points":n=new Ma(r(t.geometry),o(t.material));break;case"Sprite":n=new ma(o(t.material));break;case"Group":n=new Sa;break;default:n=new Ai}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.children)for(var f in t.children)n.add(this.parseObject(t.children[f],i,a));if("LOD"===t.type)for(var l=t.levels,c=0;c0)){u=n;break}u=n-1}if(a[n=u]===i){var f=n/(r-1);return f}var l=a[n],c=a[n+1],h=c-l,d=(i-l)/h,f=(n+d)/(r-1);return f},getTangent:function(e){var t=e-1e-4,i=e+1e-4;t<0&&(t=0),i>1&&(i=1);var a=this.getPoint(t),n=this.getPoint(i),r=n.clone().sub(a);return r.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var i,a,n,r=new yt,o=[],s=[],u=[],f=new yt,l=new wt;for(i=0;i<=e;i++)a=i/e,o[i]=this.getTangentAt(a),o[i].normalize();s[0]=new yt,u[0]=new yt;var c=Number.MAX_VALUE,h=Math.abs(o[0].x),d=Math.abs(o[0].y),p=Math.abs(o[0].z);for(h<=c&&(c=h,r.set(1,0,0)),d<=c&&(c=d,r.set(0,1,0)),p<=c&&r.set(0,0,1),f.crossVectors(o[0],r).normalize(),s[0].crossVectors(o[0],f),u[0].crossVectors(o[0],s[0]),i=1;i<=e;i++)s[i]=s[i-1].clone(),u[i]=u[i-1].clone(),f.crossVectors(o[i-1],o[i]),f.length()>Number.EPSILON&&(f.normalize(),n=Math.acos(lt.clamp(o[i-1].dot(o[i]),-1,1)),s[i].applyMatrix4(l.makeRotationAxis(f,n))),u[i].crossVectors(o[i],s[i]);if(!0===t)for(n=Math.acos(lt.clamp(s[0].dot(s[e]),-1,1)),n/=e,o[0].dot(f.crossVectors(s[0],s[e]))>0&&(n=-n),i=1;i<=e;i++)s[i].applyMatrix4(l.makeRotationAxis(o[i],n*i)),u[i].crossVectors(o[i],s[i]);return{tangents:o,normals:s,binormals:u}}},dr.create=function(e,t){return e.prototype=Object.create(dr.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},pr.prototype=Object.create(dr.prototype),pr.prototype.constructor=pr,pr.prototype.isLineCurve=!0,pr.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},pr.prototype.getPointAt=function(e){return this.getPoint(e)},pr.prototype.getTangent=function(e){var t=this.v2.clone().sub(this.v1);return t.normalize()},mr.prototype=Object.assign(Object.create(dr.prototype),{constructor:mr,add:function(e){this.curves.push(e)},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 pr(t,e))},getPoint:function(e){for(var t=e*this.getLength(),i=this.getCurveLengths(),a=0;a=t){var n=i[a]-t,r=this.curves[a],o=r.getLength(),s=0===o?0:1-n/o;return r.getPointAt(s)}a++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,i=0,a=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(e){var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){for(var t=new Bi,i=0,a=e.length;it;)i-=t;it.length-2?t.length-1:a+1],u=t[a>t.length-3?t.length-1:a+2],f=br.interpolate;return new ct(f(r.x,o.x,s.x,u.x,n),f(r.y,o.y,s.y,u.y,n))},yr.prototype=Object.create(dr.prototype),yr.prototype.constructor=yr,yr.prototype.getPoint=function(e){var t=Za.b3;return new ct(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},yr.prototype.getTangent=function(e){var t=br.tangentCubicBezier;return new ct(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},wr.prototype=Object.create(dr.prototype),wr.prototype.constructor=wr,wr.prototype.getPoint=function(e){var t=Za.b2;return new ct(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y))},wr.prototype.getTangent=function(e){var t=br.tangentQuadraticBezier;return new ct(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y)).normalize()};var _r,xr=Object.assign(Object.create(mr.prototype),{fromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,i=e.length;t0){var f=u.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(u);var l=u.getPoint(1);this.currentPoint.copy(l)}});function kr(){Er.apply(this,arguments),this.holes=[]}function Er(e){mr.call(this),this.currentPoint=new ct,e&&this.fromPoints(e)}function Mr(){this.subPaths=[],this.currentPath=null}function Sr(e){this.data=e}function Tr(e){this.manager=void 0!==e?e:Cn}function Ar(){return void 0===_r&&(_r=new(window.AudioContext||window.webkitAudioContext)),_r}function Cr(e){this.manager=void 0!==e?e:Cn}function Lr(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Xi,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Xi,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Ir(e,t,i){Ai.call(this),this.type="CubeCamera";var a=new Xi(90,1,e,t);a.up.set(0,-1,0),a.lookAt(new yt(1,0,0)),this.add(a);var n=new Xi(90,1,e,t);n.up.set(0,-1,0),n.lookAt(new yt(-1,0,0)),this.add(n);var r=new Xi(90,1,e,t);r.up.set(0,0,1),r.lookAt(new yt(0,1,0)),this.add(r);var o=new Xi(90,1,e,t);o.up.set(0,0,-1),o.lookAt(new yt(0,-1,0)),this.add(o);var s=new Xi(90,1,e,t);s.up.set(0,-1,0),s.lookAt(new yt(0,0,1)),this.add(s);var u=new Xi(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new yt(0,0,-1)),this.add(u);var f={format:Re,magFilter:be,minFilter:be};this.renderTarget=new bt(i,i,f),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,f=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,e.render(t,a,i),i.activeCubeFace=1,e.render(t,n,i),i.activeCubeFace=2,e.render(t,r,i),i.activeCubeFace=3,e.render(t,o,i),i.activeCubeFace=4,e.render(t,s,i),i.texture.generateMipmaps=f,i.activeCubeFace=5,e.render(t,u,i),e.setRenderTarget(null)}}function Pr(){Ai.call(this),this.type="AudioListener",this.context=Ar(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Or(e){Ai.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Rr(e){Or.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Dr(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Nr(e,t,i){this.binding=e,this.valueSize=i;var a,n=Float64Array;switch(t){case"quaternion":a=this._slerp;break;case"string":case"bool":n=Array,a=this._select;break;default:a=this._lerp}this.buffer=new n(4*i),this._mixBufferRegion=a,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Fr(e,t,i){this.path=t,this.parsedPath=i||Fr.parseTrackName(t),this.node=Fr.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function jr(e){this.uuid=lt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var i=0,a=arguments.length;i!==a;++i)t[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function Br(e,t,i){this._mixer=e,this._clip=t,this._localRoot=i||null;for(var a=t.tracks,n=a.length,r=new Array(n),o={endingStart:Qe,endingEnd:Qe},s=0;s!==n;++s){var u=a[s].createInterpolant(null);r[s]=u,u.settings=o}this._interpolantSettings=o,this._interpolants=r,this._propertyBindings=new Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ze,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function zr(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Ur(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Hr(){Yi.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Yr(e,t,i,a){this.uuid=lt.generateUUID(),this.data=e,this.itemSize=t,this.offset=i,this.normalized=!0===a}function Gr(e,t){this.uuid=lt.generateUUID(),this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Vr(e,t,i){Gr.call(this,e,t),this.meshPerAttribute=i||1}function Wr(e,t,i){Di.call(this,e,t),this.meshPerAttribute=i||1}function qr(e,t,i,a){this.ray=new Mi(e,t),this.near=i||0,this.far=a||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Xr(e,t){return e.distance-t.distance}function Kr(e,t,i,a){if(!1!==e.visible&&(e.raycast(t,i),!0===a))for(var n=e.children,r=0,o=n.length;rNumber.EPSILON){if(f<0&&(o=t[r],u=-u,s=t[n],f=-f),e.ys.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var l=f*(e.x-o.x)-u*(e.y-o.y);if(0===l)return!0;if(l<0)continue;a=!a}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return a}var n=Za.isClockWise,r=this.subPaths;if(0===r.length)return[];if(!0===t)return i(r);var o,s,u,f=[];if(1===r.length)return s=r[0],(u=new kr).curves=s.curves,f.push(u),f;var l=!n(r[0].getPoints());l=e?!l:l;var c,h,d=[],p=[],m=[],v=0;p[v]=void 0,m[v]=[];for(var b=0,g=r.length;b1){for(var y=!1,w=[],_=0,x=p.length;_0&&(y||(m=d))}for(var b=0,A=p.length;b0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var r=0;r!==n;++r)e[t+r]=e[i+r]},_slerp:function(e,t,i,a,n){gt.slerpFlat(e,t,e,t,e,i,a)},_lerp:function(e,t,i,a,n){for(var r=1-a,o=0;o!==n;++o){var s=t+o;e[s]=e[s]*r+e[i+o]*a}}},Fr.prototype={constructor:Fr,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,i=t.objectName,a=t.propertyName,n=t.propertyIndex;if(e||(e=Fr.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(i){var r=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var o=0;o=i){var c=i++,h=t[c];a[h.uuid]=l,t[l]=h,a[f]=c,t[c]=u;for(var d=0,p=r;d!==p;++d){var m=n[d],v=m[c],b=m[l];m[l]=v,m[c]=b}}}this.nCachedObjects_=i},uncache:function(e){for(var t=this._objects,i=t.length,a=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,o=r.length,s=0,u=arguments.length;s!==u;++s){var f=arguments[s],l=f.uuid,c=n[l];if(void 0!==c)if(delete n[l],c0)for(var u=this._interpolants,f=this._propertyBindings,l=0,c=u.length;l!==c;++l)u[l].evaluate(o),f[l].accumulate(a,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var a=i.evaluate(e)[0];t*=a,e>i.parameterPositions[1]&&(this.stopFading(),0===a&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var a=i.evaluate(e)[0];t*=a,e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var i=this._clip.duration,a=this.loop,n=this._loopCount;if(2200===a){-1===n&&(this.loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=i)t=i;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var r=2202===a;if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),t>=i||t<0){var o=Math.floor(t/i);t-=i*o,n+=Math.abs(o);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var u=e<0;this._setEndings(u,!u,r)}else this._setEndings(!1,!1,r);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(r&&1==(1&n))return this.time=t,i-t}return this.time=t,t},_setEndings:function(e,t,i){var a=this._interpolantSettings;i?(a.endingStart=2401,a.endingEnd=2401):(a.endingStart=e?this.zeroSlopeAtStart?2401:Qe:2402,a.endingEnd=t?this.zeroSlopeAtEnd?2401:Qe:2402)},_scheduleFading:function(e,t,i){var a=this._mixer,n=a.time,r=this._weightInterpolant;null===r&&(r=a._lendControlInterpolant(),this._weightInterpolant=r);var o=r.parameterPositions,s=r.sampleValues;return o[0]=n,s[0]=t,o[1]=n+e,s[1]=i,this}},Object.assign(zr.prototype,t.prototype,{clipAction:function(e,t){var i=t||this._root,a=i.uuid,n="string"==typeof e?sr.findByName(i,e):e,r=null!==n?n.uuid:e,o=this._actionsByClip[r],s=null;if(void 0!==o){var u=o.actionByRoot[a];if(void 0!==u)return u;s=o.knownActions[0],null===n&&(n=s._clip)}if(null===n)return null;var f=new Br(this,n,t);return this._bindAction(f,s),this._addInactiveAction(f,r,a),f},existingAction:function(e,t){var i=t||this._root,a=i.uuid,n="string"==typeof e?sr.findByName(i,e):e,r=n?n.uuid:e,o=this._actionsByClip[r];return void 0!==o&&o.actionByRoot[a]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,i=this._bindings,a=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var n=0;n!==t;++n)e[n].reset();for(var n=0;n!==a;++n)i[n].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,i=this._nActiveActions,a=this.time+=e,n=Math.sign(e),r=this._accuIndex^=1,o=0;o!==i;++o){var s=t[o];s.enabled&&s._update(a,e,n,r)}for(var u=this._bindings,f=this._nActiveBindings,o=0;o!==f;++o)u[o].apply(r);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,i=e.uuid,a=this._actionsByClip,n=a[i];if(void 0!==n){for(var r=n.knownActions,o=0,s=r.length;o!==s;++o){var u=r[o];this._deactivateAction(u);var f=u._cacheIndex,l=t[t.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,l._cacheIndex=f,t[f]=l,t.pop(),this._removeInactiveBindingsForAction(u)}delete a[i]}},uncacheRoot:function(e){var t=e.uuid,i=this._actionsByClip;for(var a in i){var n=i[a].actionByRoot,r=n[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var o=this._bindingsByRootAndName,s=o[t];if(void 0!==s)for(var u in s){var f=s[u];f.restoreOriginalState(),this._removeInactiveBinding(f)}},uncacheAction:function(e,t){var i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Object.assign(zr.prototype,{_bindAction:function(e,t){var i=e._localRoot||this._root,a=e._clip.tracks,n=a.length,r=e._propertyBindings,o=e._interpolants,s=i.uuid,u=this._bindingsByRootAndName,f=u[s];void 0===f&&(f={},u[s]=f);for(var l=0;l!==n;++l){var c=a[l],h=c.name,d=f[h];if(void 0!==d)r[l]=d;else{if(void 0!==(d=r[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,h));continue}var p=t&&t._propertyBindings[l].binding.parsedPath;++(d=new Nr(Fr.create(i,h,p),c.ValueTypeName,c.getValueSize())).referenceCount,this._addInactiveBinding(d,s,h),r[l]=d}o[l].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,a=this._actionsByClip[i];this._bindAction(e,a&&a.knownActions[0]),this._addInactiveAction(e,i,t)}for(var n=e._propertyBindings,r=0,o=n.length;r!==o;++r){var s=n[r];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,a=t.length;i!==a;++i){var n=t[i];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t1){var f=u[1];a[f]||(a[f]={start:1/0,end:-1/0});var l=a[f];rl.end&&(l.end=r),t||(t=f)}}for(var f in a){var l=a[f];this.createAnimation(f,l.start,l.end,e)}this.firstAnimation=t},Jr.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},Jr.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},Jr.prototype.setAnimationFPS=function(e,t){var i=this.animationsMap[e];i&&(i.fps=t,i.duration=(i.end-i.start)/i.fps)},Jr.prototype.setAnimationDuration=function(e,t){var i=this.animationsMap[e];i&&(i.duration=t,i.fps=(i.end-i.start)/i.duration)},Jr.prototype.setAnimationWeight=function(e,t){var i=this.animationsMap[e];i&&(i.weight=t)},Jr.prototype.setAnimationTime=function(e,t){var i=this.animationsMap[e];i&&(i.time=t)},Jr.prototype.getAnimationTime=function(e){var t=0,i=this.animationsMap[e];return i&&(t=i.time),t},Jr.prototype.getAnimationDuration=function(e){var t=-1,i=this.animationsMap[e];return i&&(t=i.duration),t},Jr.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},Jr.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},Jr.prototype.update=function(e){for(var t=0,i=this.animationsList.length;ta.duration||a.time<0)&&(a.direction*=-1,a.time>a.duration&&(a.time=a.duration,a.directionBackwards=!0),a.time<0&&(a.time=0,a.directionBackwards=!1)):(a.time=a.time%a.duration,a.time<0&&(a.time+=a.duration));var r=a.start+lt.clamp(Math.floor(a.time/n),0,a.length-1),o=a.weight;r!==a.currentFrame&&(this.morphTargetInfluences[a.lastFrame]=0,this.morphTargetInfluences[a.currentFrame]=1*o,this.morphTargetInfluences[r]=0,a.lastFrame=a.currentFrame,a.currentFrame=r);var s=a.time%n/n;a.directionBackwards&&(s=1-s),a.currentFrame!==a.lastFrame?(this.morphTargetInfluences[a.currentFrame]=s*o,this.morphTargetInfluences[a.lastFrame]=(1-s)*o):this.morphTargetInfluences[a.currentFrame]=o}}},$r.prototype=Object.create(Ai.prototype),$r.prototype.constructor=$r,$r.prototype.isImmediateRenderObject=!0,eo.prototype=Object.create(ka.prototype),eo.prototype.constructor=eo,eo.prototype.update=function(){var e=new yt,t=new yt,i=new _i;return function(){var a=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var n=this.object.matrixWorld,r=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,u=o.faces,f=0,l=0,c=u.length;l.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(i.z,0,-i.x).normalize(),e=Math.acos(i.y),this.quaternion.setFromAxisAngle(t,e))}}(),po.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},po.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},mo.prototype=Object.create(ka.prototype),mo.prototype.constructor=mo;var vo=function(){var e=new yt,t=new n,i=new n,a=new n;function n(){}return n.prototype.init=function(e,t,i,a){this.c0=e,this.c1=i,this.c2=-3*e+3*t-2*i-a,this.c3=2*e-2*t+i+a},n.prototype.initNonuniformCatmullRom=function(e,t,i,a,n,r,o){var s=(t-e)/n-(i-e)/(n+r)+(i-t)/r,u=(i-t)/r-(a-t)/(r+o)+(a-i)/o;s*=r,u*=r,this.init(t,i,s,u)},n.prototype.initCatmullRom=function(e,t,i,a,n){this.init(t,i,n*(i-e),n*(a-t))},n.prototype.calc=function(e){var t=e*e,i=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*i},dr.create(function(e){this.points=e||[],this.closed=!1},function(n){var r,o,s,u,f,l,c,h,d=this.points;if((u=d.length)<2&&console.log("duh, you need at least 2 points"),r=(u-(this.closed?0:1))*n,o=Math.floor(r),s=r-o,this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/d.length)+1)*d.length:0===s&&o===u-1&&(o=u-2,s=1),this.closed||o>0?f=d[(o-1)%u]:(e.subVectors(d[0],d[1]).add(d[0]),f=e),l=d[o%u],c=d[(o+1)%u],this.closed||o+2t.length-2?t.length-1:a+1],u=t[a>t.length-3?t.length-1:a+2],f=br.interpolate;return new yt(f(r.x,o.x,s.x,u.x,n),f(r.y,o.y,s.y,u.y,n),f(r.z,o.z,s.z,u.z,n))}),yo=dr.create(function(e,t,i,a){this.v0=e,this.v1=t,this.v2=i,this.v3=a},function(e){var t=Za.b3;return new yt(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),wo=dr.create(function(e,t,i){this.v0=e,this.v1=t,this.v2=i},function(e){var t=Za.b2;return new yt(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y),t(e,this.v0.z,this.v1.z,this.v2.z))}),_o=dr.create(function(e,t){this.v1=e,this.v2=t},function(e){if(1===e)return this.v2.clone();var t=new yt;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t});function xo(e,t,i,a,n,r){vr.call(this,e,t,i,i,a,n,r)}xo.prototype=Object.create(vr.prototype),xo.prototype.constructor=xo;var ko={createMultiMaterialObject:function(e,t){for(var i=new Sa,a=0,n=t.length;athis.points.length-2?this.points.length-1:i+1,l[3]=i>this.points.length-3?this.points.length-1:i+2,o=this.points[l[0]],s=this.points[l[1]],u=this.points[l[2]],f=this.points[l[3]],r=a*(n=a*a),c.x=h(o.x,s.x,u.x,f.x,a,n,r),c.y=h(o.y,s.y,u.y,f.y,a,n,r),c.z=h(o.z,s.z,u.z,f.z,a,n,r),c},this.getControlPointsArray=function(){var e,t,i=this.points.length,a=[];for(e=0;e=0?Math.floor(t):Math.ceil(t)),i}function oe(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function se(e){return ue(e)?366:365}function ue(e){return e%4==0&&e%100!=0||e%400==0}function fe(e){var t;e._a&&-2===e._pf.overflow&&(t=e._a[f]<0||e._a[f]>11?f:e._a[l]<1||e._a[l]>oe(e._a[u],e._a[f])?l:e._a[c]<0||e._a[c]>23?c:e._a[h]<0||e._a[h]>59?h:e._a[d]<0||e._a[d]>59?d:e._a[p]<0||e._a[p]>999?p:-1,e._pf._overflowDayOfYear&&(tl)&&(t=l),e._pf.overflow=t)}function le(e){e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function ce(e){return null==e._isValid&&(e._isValid=!isNaN(e._d.getTime())&&e._pf.overflow<0&&!e._pf.empty&&!e._pf.invalidMonth&&!e._pf.nullInput&&!e._pf.invalidFormat&&!e._pf.userInvalidated,e._strict&&(e._isValid=e._isValid&&0===e._pf.charsLeftOver&&0===e._pf.unusedTokens.length)),e._isValid}function he(e){return e?e.toLowerCase().replace("_","-"):e}function de(e){var t,a,n,o,s=0,u=function(e){if(!m[e]&&v)try{i(1826)("./"+e)}catch(e){}return m[e]};if(!e)return r.fn._lang;if(!ee(e)){if(a=u(e))return a;e=[e]}for(;s0;){if(a=u(o.slice(0,t).join("-")))return a;if(n&&n.length>=t&&te(o,n,!0)>=t-1)break;t--}s++}return r.fn._lang}function pe(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function me(e,t){return e.isValid()?(t=ve(t,e.lang()),z[t]||(z[t]=function(e){var t,i,a=e.match(w);for(t=0,i=a.length;t=0&&_.test(e);)e=e.replace(_,a),_.lastIndex=0,i-=1;return e}function be(e,t){switch(e){case"DDDD":return E;case"YYYY":case"GGGG":case"gggg":return M;case"YYYYY":case"GGGGG":case"ggggg":return S;case"S":case"SS":case"SSS":case"DDD":return k;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return A;case"a":case"A":return de(t._l)._meridiemParse;case"X":return I;case"Z":case"ZZ":return C;case"T":return L;case"SSSS":return T;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"ww":case"W":case"WW":case"e":case"E":return x;default:return new RegExp(function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}(function(e){return e.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,i,a,n){return t||i||a||n})}(e.replace("\\",""))))}}function ge(e){var t=((C.exec(e)||[])[0]+"").match(D)||["-",0,0],i=60*t[1]+re(t[2]);return"+"===t[0]?-i:i}function ye(e,t,i){var a,n=i._a;switch(e){case"M":case"MM":null!=t&&(n[f]=re(t)-1);break;case"MMM":case"MMMM":null!=(a=de(i._l).monthsParse(t))?n[f]=a:i._pf.invalidMonth=t;break;case"D":case"DD":null!=t&&(n[l]=re(t));break;case"DDD":case"DDDD":null!=t&&(i._dayOfYear=re(t));break;case"YY":n[u]=re(t)+(re(t)>68?1900:2e3);break;case"YYYY":case"YYYYY":n[u]=re(t);break;case"a":case"A":i._isPm=de(i._l).isPM(t);break;case"H":case"HH":case"h":case"hh":n[c]=re(t);break;case"m":case"mm":n[h]=re(t);break;case"s":case"ss":n[d]=re(t);break;case"S":case"SS":case"SSS":case"SSSS":n[p]=re(1e3*("0."+t));break;case"X":i._d=new Date(1e3*parseFloat(t));break;case"Z":case"ZZ":i._useUTC=!0,i._tzm=ge(t);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":e=e.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":e=e.substr(0,2),t&&(i._w=i._w||{},i._w[e]=t)}}function we(e){var t,i,a,n,o,s,d,p,m,v,b=[];if(!e._d){for(a=function(e){var t=new Date;return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}(e),e._w&&null==e._a[l]&&null==e._a[f]&&(o=function(t){return t?t.length<3?parseInt(t,10)>68?"19"+t:"20"+t:t:null==e._a[u]?r().weekYear():e._a[u]},null!=(s=e._w).GG||null!=s.W||null!=s.E?d=Se(o(s.GG),s.W||1,s.E,4,1):(p=de(e._l),m=null!=s.d?Ee(s.d,p):null!=s.e?parseInt(s.e,10)+p._week.dow:0,v=parseInt(s.w,10)||1,null!=s.d&&mse(n)&&(e._pf._overflowDayOfYear=!0),i=ke(n,0,e._dayOfYear),e._a[f]=i.getUTCMonth(),e._a[l]=i.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=b[t]=a[t];for(;t<7;t++)e._a[t]=b[t]=null==e._a[t]?2===t?1:0:e._a[t];b[c]+=re((e._tzm||0)/60),b[h]+=re((e._tzm||0)%60),e._d=(e._useUTC?ke:function(e,t,i,a,n,r,o){var s=new Date(e,t,i,a,n,r,o);e<1970&&s.setFullYear(e);return s}).apply(null,b)}}function _e(e){e._a=[],e._pf.empty=!0;var t,i,a,n,r,o=de(e._l),s=""+e._i,u=s.length,f=0;for(a=ve(e._f,o).match(w)||[],t=0;t0&&e._pf.unusedInput.push(r),s=s.slice(s.indexOf(i)+i.length),f+=i.length),Y[n]?(i?e._pf.empty=!1:e._pf.unusedTokens.push(n),ye(n,i,e)):e._strict&&!i&&e._pf.unusedTokens.push(n);e._pf.charsLeftOver=u-f,s.length>0&&e._pf.unusedInput.push(s),e._isPm&&e._a[c]<12&&(e._a[c]+=12),!1===e._isPm&&12===e._a[c]&&(e._a[c]=0),we(e),fe(e)}function xe(e){var t=e._i,i=b.exec(t);t===n?e._d=new Date:i?e._d=new Date(+i[1]):"string"==typeof t?function(e){var t,i=e._i,a=P.exec(i);if(a){for(e._pf.iso=!0,t=4;t>0;t--)if(a[t]){e._f=O[t-1]+(a[6]||" ");break}for(t=0;t<4;t++)if(R[t][1].exec(i)){e._f+=R[t][0];break}C.exec(i)&&(e._f+="Z"),_e(e)}else e._d=new Date(i)}(e):ee(t)?(e._a=t.slice(0),we(e)):function(e){return"[object Date]"===Object.prototype.toString.call(e)||e instanceof Date}(t)?e._d=new Date(+t):"object"==typeof t?function(e){var t;e._d||(t=ae(e._i),e._a=[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond],we(e))}(e):e._d=new Date(t)}function ke(e){var t=new Date(Date.UTC.apply(null,arguments));return e<1970&&t.setUTCFullYear(e),t}function Ee(e,t){if("string"==typeof e)if(isNaN(e)){if("number"!=typeof(e=t.weekdaysParse(e)))return null}else e=parseInt(e,10);return e}function Me(e,t,i){var a,n=i-t,o=i-e.day();return o>n&&(o-=7),oa?7:0))+1)>0?e:e-1,dayOfYear:r>0?r:se(e-1)+r}}function Te(e){var t=e._i,i=e._f;return void 0===e._pf&&le(e),null===t?r.invalid({nullInput:!0}):("string"==typeof t&&(e._i=t=de().preparse(t)),r.isMoment(t)?(e=Z({},t))._d=new Date(+t._d):i?ee(i)?function(e){var t,i,a,n,r;if(0===e._f.length)return e._pf.invalidFormat=!0,void(e._d=new Date(NaN));for(n=0;n11?i?"pm":"PM":i?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var i=this._calendar[e];return"function"==typeof i?i.apply(t):i},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,i,a){var n=this._relativeTime[i];return"function"==typeof n?n(e,t,i,a):n.replace(/%d/i,e)},pastFuture:function(e,t){var i=this._relativeTime[e>0?"future":"past"];return"function"==typeof i?i(t):i.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return Me(e,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),(r=function(e,t,i,a){return"boolean"==typeof i&&(a=i,i=n),Te({_i:e,_f:t,_l:i,_strict:a,_isUTC:!1})}).utc=function(e,t,i,a){return"boolean"==typeof i&&(a=i,i=n),Te({_useUTC:!0,_isUTC:!0,_l:i,_i:e,_f:t,_strict:a}).utc()},r.unix=function(e){return r(1e3*e)},r.duration=function(e,t){var i,a,n,o=r.isDuration(e),s="number"==typeof e,u=o?e._input:s?{}:e,f=null;return s?t?u[t]=e:u.milliseconds=e:(f=g.exec(e))?(i="-"===f[1]?-1:1,u={y:0,d:re(f[l])*i,h:re(f[c])*i,m:re(f[h])*i,s:re(f[d])*i,ms:re(f[p])*i}):(f=y.exec(e))&&(i="-"===f[1]?-1:1,u={y:(n=function(e){var t=e&&parseFloat(e.replace(",","."));return(isNaN(t)?0:t)*i})(f[2]),M:n(f[3]),d:n(f[4]),h:n(f[5]),m:n(f[6]),s:n(f[7]),w:n(f[8])}),a=new K(u),o&&e.hasOwnProperty("_lang")&&(a._lang=e._lang),a},r.version="2.4.0",r.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",r.updateOffset=function(){},r.lang=function(e,t){return e?(t?function(e,t){t.abbr=e,m[e]||(m[e]=new q),m[e].set(t),m[e]}(he(e),t):null===t?(!function(e){delete m[e]}(e),e="en"):m[e]||de(e),(r.duration.fn._lang=r.fn._lang=de(e))._abbr):r.fn._lang._abbr},r.langData=function(e){return e&&e._lang&&e._lang._abbr&&(e=e._lang._abbr),de(e)},r.isMoment=function(e){return e instanceof X},r.isDuration=function(e){return e instanceof K},o=G.length-1;o>=0;--o)ne(G[o]);function Ae(e,t){r.fn[e]=r.fn[e+"s"]=function(e){var i=this._isUTC?"UTC":"";return null!=e?(this._d["set"+i+t](e),r.updateOffset(this),this):this._d["get"+i+t]()}}for(r.normalizeUnits=function(e){return ie(e)},r.invalid=function(e){var t=r.utc(NaN);return null!=e?Z(t._pf,e):t._pf.userInvalidated=!0,t},r.parseZone=function(e){return r(e).parseZone()},Z(r.fn=X.prototype,{clone:function(){return r(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return me(r(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return ce(this)},isDSTShifted:function(){return!!this._a&&(this.isValid()&&te(this._a,(this._isUTC?r.utc(this._a):r(this._a)).toArray())>0)},parsingFlags:function(){return Z({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(e){var t=me(this,e||r.defaultFormat);return this.lang().postformat(t)},add:function(e,t){return $(this,"string"==typeof e?r.duration(+t,e):r.duration(e,t),1),this},subtract:function(e,t){return $(this,"string"==typeof e?r.duration(+t,e):r.duration(e,t),-1),this},diff:function(e,t,i){var a,n,o=this._isUTC?r(e).zone(this._offset||0):r(e).local(),s=6e4*(this.zone()-o.zone());return"year"===(t=ie(t))||"month"===t?(a=432e5*(this.daysInMonth()+o.daysInMonth()),n=12*(this.year()-o.year())+(this.month()-o.month()),n+=(this-r(this).startOf("month")-(o-r(o).startOf("month")))/a,n-=6e4*(this.zone()-r(this).startOf("month").zone()-(o.zone()-r(o).startOf("month").zone()))/a,"year"===t&&(n/=12)):(a=this-o,n="second"===t?a/1e3:"minute"===t?a/6e4:"hour"===t?a/36e5:"day"===t?(a-s)/864e5:"week"===t?(a-s)/6048e5:a),i?n:Q(n)},from:function(e,t){return r.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!t)},fromNow:function(e){return this.from(r(),e)},calendar:function(){var e=this.diff(r().zone(this.zone()).startOf("day"),"days",!0),t=e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(t,this))},isLeapYear:function(){return ue(this.year())},isDST:function(){return this.zone()+r(e).startOf(t)},isBefore:function(e,t){return t=void 0!==t?t:"millisecond",+this.clone().startOf(t)<+r(e).startOf(t)},isSame:function(e,t){return t=void 0!==t?t:"millisecond",+this.clone().startOf(t)==+r(e).startOf(t)},min:function(e){return(e=r.apply(null,arguments))this?this:e},zone:function(e){var t=this._offset||0;return null==e?this._isUTC?t:this._d.getTimezoneOffset():("string"==typeof e&&(e=ge(e)),Math.abs(e)<16&&(e*=60),this._offset=e,this._isUTC=!0,t!==e&&$(this,r.duration(t-e,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(e){return e=e?r(e).zone():0,(this.zone()-e)%60==0},daysInMonth:function(){return oe(this.year(),this.month())},dayOfYear:function(e){var t=s((r(this).startOf("day")-r(this).startOf("year"))/864e5)+1;return null==e?t:this.add("d",e-t)},weekYear:function(e){var t=Me(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==e?t:this.add("y",e-t)},isoWeekYear:function(e){var t=Me(this,1,4).year;return null==e?t:this.add("y",e-t)},week:function(e){var t=this.lang().week(this);return null==e?t:this.add("d",7*(e-t))},isoWeek:function(e){var t=Me(this,1,4).week;return null==e?t:this.add("d",7*(e-t))},weekday:function(e){var t=(this.day()+7-this.lang()._week.dow)%7;return null==e?t:this.add("d",e-t)},isoWeekday:function(e){return null==e?this.day()||7:this.day(this.day()%7?e:e-7)},get:function(e){return this[e=ie(e)]()},set:function(e,t){return"function"==typeof this[e=ie(e)]&&this[e](t),this},lang:function(e){return e===n?this._lang:(this._lang=de(e),this)}}),o=0;o0,f[4]=i,function(e,t,i,a,n){return n.relativeTime(t||1,!!i,e,a)}.apply({},f)}(t,!e,this.lang());return e&&(i=this.lang().pastFuture(t,i)),this.lang().postformat(i)},add:function(e,t){var i=r.duration(e,t);return this._milliseconds+=i._milliseconds,this._days+=i._days,this._months+=i._months,this._bubble(),this},subtract:function(e,t){var i=r.duration(e,t);return this._milliseconds-=i._milliseconds,this._days-=i._days,this._months-=i._months,this._bubble(),this},get:function(e){return this[(e=ie(e)).toLowerCase()+"s"]()},as:function(e){return this["as"+(e=ie(e)).charAt(0).toUpperCase()+e.slice(1)+"s"]()},lang:r.fn.lang,toIsoString:function(){var e=Math.abs(this.years()),t=Math.abs(this.months()),i=Math.abs(this.days()),a=Math.abs(this.hours()),n=Math.abs(this.minutes()),r=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(e?e+"Y":"")+(t?t+"M":"")+(i?i+"D":"")+(a||n||r?"T":"")+(a?a+"H":"")+(n?n+"M":"")+(r?r+"S":""):"P0D"}}),F)F.hasOwnProperty(o)&&(Le(o,F[o]),Ce(o.toLowerCase()));function Ie(e){var t=!1,i=r;"undefined"==typeof ender&&(this.moment=e?function(){return!t&&console&&console.warn&&(t=!0,console.warn("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.")),i.apply(null,arguments)}:r)}Le("Weeks",6048e5),r.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},r.lang("en",{ordinal:function(e){var t=e%10;return e+(1===re(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),v?(e.exports=r,Ie(!0)):(a=function(e,t,i){return!0!==i.config().noGlobal&&Ie(i.config().noGlobal===n),r}.call(t,i,t,e))===n||(e.exports=a)}).call(this)}).call(this,i(29)(e))},function(e,t){e.exports=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,i):{};a.get||a.set?Object.defineProperty(t,i,a):t[i]=e[i]}return t.default=e,t}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=i(193),n=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r="[DEFAULT]",o=[],s=function(){function e(e,t,i){this.firebase_=i,this.isDeleted_=!1,this.services_={},this.name_=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled||!1,this.options_=a.deepCopy(e),this.INTERNAL={getUid:function(){return null},getToken:function(){return Promise.resolve(null)},addAuthTokenListener:function(e){o.push(e),setTimeout(function(){return e(null)},0)},removeAuthTokenListener:function(e){o=o.filter(function(t){return t!==e})}}}return Object.defineProperty(e.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed_(),this._automaticDataCollectionEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),e.prototype.delete=function(){var e=this;return new Promise(function(t){e.checkDestroyed_(),t()}).then(function(){e.firebase_.INTERNAL.removeApp(e.name_);var t=[];return Object.keys(e.services_).forEach(function(i){Object.keys(e.services_[i]).forEach(function(a){t.push(e.services_[i][a])})}),Promise.all(t.map(function(e){return e.INTERNAL.delete()}))}).then(function(){e.isDeleted_=!0,e.services_={}})},e.prototype._getService=function(e,t){if(void 0===t&&(t=r),this.checkDestroyed_(),this.services_[e]||(this.services_[e]={}),!this.services_[e][t]){var i=t!==r?t:void 0,a=this.firebase_.INTERNAL.factories[e](this,this.extendApp.bind(this),i);this.services_[e][t]=a}return this.services_[e][t]},e.prototype.extendApp=function(e){var t=this;a.deepExtend(this,e),e.INTERNAL&&e.INTERNAL.addAuthTokenListener&&(o.forEach(function(e){t.INTERNAL.addAuthTokenListener(e)}),o=[])},e.prototype.checkDestroyed_=function(){this.isDeleted_&&u("app-deleted",{name:this.name_})},e}();function u(e,t){throw f.create(e,t)}s.prototype.name&&s.prototype.options||s.prototype.delete||console.log("dc");var f=new a.ErrorFactory("app","Firebase",{"no-app":"No Firebase App '{$name}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$name}","duplicate-app":"Firebase App named '{$name}' already exists","app-deleted":"Firebase App named '{$name}' already deleted","duplicate-service":"Firebase service named '{$name}' already registered","sa-not-supported":"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain","invalid-app-argument":"firebase.{$name}() takes either no argument or a Firebase App instance."}),l=function e(){var t={},i={},o={},f={__esModule:!0,initializeApp:function(e,i){if(void 0===i&&(i={}),"object"!=typeof i||null===i){var a=i;i={name:a}}var o=i;void 0===o.name&&(o.name=r);var l=o.name;"string"==typeof l&&l||u("bad-app-name",{name:l+""}),n(t,l)&&u("duplicate-app",{name:l});var c=new s(e,o,f);return t[l]=c,h(c,"create"),c},app:l,apps:null,Promise:Promise,SDK_VERSION:"5.5.0",INTERNAL:{registerService:function(e,t,n,r,h){i[e]&&u("duplicate-service",{name:e}),i[e]=t,r&&(o[e]=r,c().forEach(function(e){r("create",e)}));var d=function(t){return void 0===t&&(t=l()),"function"!=typeof t[e]&&u("invalid-app-argument",{name:e}),t[e]()};return void 0!==n&&a.deepExtend(d,n),f[e]=d,s.prototype[e]=function(){for(var t=[],i=0;i>>0;if(""+i!==t||4294967295===i)return NaN;t=i}return t<0?M(e)+t:t}function T(){return!0}function A(e,t,i){return(0===e||void 0!==i&&e<=-i)&&(void 0===t||void 0!==i&&t>=i)}function C(e,t){return I(e,t,0)}function L(e,t){return I(e,t,t)}function I(e,t,i){return void 0===e?i:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var P=0,O=1,R=2,D="function"==typeof Symbol&&Symbol.iterator,N="@@iterator",F=D||N;function j(e){this.next=e}function B(e,t,i,a){var n=0===e?t:1===e?i:[t,i];return a?a.value=n:a={value:n,done:!1},a}function z(){return{value:void 0,done:!0}}function U(e){return!!G(e)}function H(e){return e&&"function"==typeof e.next}function Y(e){var t=G(e);return t&&t.call(e)}function G(e){var t=e&&(D&&e[D]||e[N]);if("function"==typeof t)return t}function V(e){return e&&"number"==typeof e.length}function W(e){return null===e||void 0===e?re():o(e)?e.toSeq():function(e){var t=ue(e)||"object"==typeof e&&new te(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}(e)}function q(e){return null===e||void 0===e?re().toKeyedSeq():o(e)?s(e)?e.toSeq():e.fromEntrySeq():oe(e)}function X(e){return null===e||void 0===e?re():o(e)?s(e)?e.entrySeq():e.toIndexedSeq():se(e)}function K(e){return(null===e||void 0===e?re():o(e)?s(e)?e.entrySeq():e:se(e)).toSetSeq()}j.prototype.toString=function(){return"[Iterator]"},j.KEYS=P,j.VALUES=O,j.ENTRIES=R,j.prototype.inspect=j.prototype.toSource=function(){return this.toString()},j.prototype[F]=function(){return this},t(W,i),W.of=function(){return W(arguments)},W.prototype.toSeq=function(){return this},W.prototype.toString=function(){return this.__toString("Seq {","}")},W.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},W.prototype.__iterate=function(e,t){return fe(this,e,t,!0)},W.prototype.__iterator=function(e,t){return le(this,e,t,!0)},t(q,W),q.prototype.toKeyedSeq=function(){return this},t(X,W),X.of=function(){return X(arguments)},X.prototype.toIndexedSeq=function(){return this},X.prototype.toString=function(){return this.__toString("Seq [","]")},X.prototype.__iterate=function(e,t){return fe(this,e,t,!1)},X.prototype.__iterator=function(e,t){return le(this,e,t,!1)},t(K,W),K.of=function(){return K(arguments)},K.prototype.toSetSeq=function(){return this},W.isSeq=ne,W.Keyed=q,W.Set=K,W.Indexed=X;var Z,Q,J,$="@@__IMMUTABLE_SEQ__@@";function ee(e){this._array=e,this.size=e.length}function te(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function ie(e){this._iterable=e,this.size=e.length||e.size}function ae(e){this._iterator=e,this._iteratorCache=[]}function ne(e){return!(!e||!e[$])}function re(){return Z||(Z=new ee([]))}function oe(e){var t=Array.isArray(e)?new ee(e).fromEntrySeq():H(e)?new ae(e).fromEntrySeq():U(e)?new ie(e).fromEntrySeq():"object"==typeof e?new te(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function se(e){var t=ue(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function ue(e){return V(e)?new ee(e):H(e)?new ae(e):U(e)?new ie(e):void 0}function fe(e,t,i,a){var n=e._cache;if(n){for(var r=n.length-1,o=0;o<=r;o++){var s=n[i?r-o:o];if(!1===t(s[1],a?s[0]:o,e))return o+1}return o}return e.__iterateUncached(t,i)}function le(e,t,i,a){var n=e._cache;if(n){var r=n.length-1,o=0;return new j(function(){var e=n[i?r-o:o];return o++>r?{value:void 0,done:!0}:B(t,a?e[0]:o-1,e[1])})}return e.__iteratorUncached(t,i)}function ce(e,t){return t?function e(t,i,a,n){return Array.isArray(i)?t.call(n,a,X(i).map(function(a,n){return e(t,a,n,i)})):de(i)?t.call(n,a,q(i).map(function(a,n){return e(t,a,n,i)})):i}(t,e,"",{"":e}):he(e)}function he(e){return Array.isArray(e)?X(e).map(he).toList():de(e)?q(e).map(he).toMap():e}function de(e){return e&&(e.constructor===Object||void 0===e.constructor)}function pe(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function me(e,t){if(e===t)return!0;if(!o(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||s(e)!==s(t)||u(e)!==u(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var i=!f(e);if(l(e)){var a=e.entries();return t.every(function(e,t){var n=a.next().value;return n&&pe(n[1],e)&&(i||pe(n[0],t))})&&a.next().done}var n=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{n=!0;var r=e;e=t,t=r}var c=!0,h=t.__iterate(function(t,a){if(i?!e.has(t):n?!pe(t,e.get(a,g)):!pe(e.get(a,g),t))return c=!1,!1});return c&&e.size===h}function ve(e,t){if(!(this instanceof ve))return new ve(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(Q)return Q;Q=this}}function be(e,t){if(!e)throw new Error(t)}function ge(e,t,i){if(!(this instanceof ge))return new ge(e,t,i);if(be(0!==i,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),i=void 0===i?1:Math.abs(i),ta?{value:void 0,done:!0}:B(e,n,i[t?a-n++:n++])})},t(te,q),te.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},te.prototype.has=function(e){return this._object.hasOwnProperty(e)},te.prototype.__iterate=function(e,t){for(var i=this._object,a=this._keys,n=a.length-1,r=0;r<=n;r++){var o=a[t?n-r:r];if(!1===e(i[o],o,this))return r+1}return r},te.prototype.__iterator=function(e,t){var i=this._object,a=this._keys,n=a.length-1,r=0;return new j(function(){var o=a[t?n-r:r];return r++>n?{value:void 0,done:!0}:B(e,o,i[o])})},te.prototype[p]=!0,t(ie,X),ie.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var i=this._iterable,a=Y(i),n=0;if(H(a))for(var r;!(r=a.next()).done&&!1!==e(r.value,n++,this););return n},ie.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var i=this._iterable,a=Y(i);if(!H(a))return new j(z);var n=0;return new j(function(){var t=a.next();return t.done?t:B(e,n++,t.value)})},t(ae,X),ae.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var i,a=this._iterator,n=this._iteratorCache,r=0;r=a.length){var t=i.next();if(t.done)return t;a[n]=t.value}return B(e,n,a[n++])})},t(ve,X),ve.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},ve.prototype.get=function(e,t){return this.has(e)?this._value:t},ve.prototype.includes=function(e){return pe(this._value,e)},ve.prototype.slice=function(e,t){var i=this.size;return A(e,t,i)?this:new ve(this._value,L(t,i)-C(e,i))},ve.prototype.reverse=function(){return this},ve.prototype.indexOf=function(e){return pe(this._value,e)?0:-1},ve.prototype.lastIndexOf=function(e){return pe(this._value,e)?this.size:-1},ve.prototype.__iterate=function(e,t){for(var i=0;i=0&&t=0&&ii?{value:void 0,done:!0}:B(e,r++,o)})},ge.prototype.equals=function(e){return e instanceof ge?this._start===e._start&&this._end===e._end&&this._step===e._step:me(this,e)},t(ye,i),t(we,ye),t(_e,ye),t(xe,ye),ye.Keyed=we,ye.Indexed=_e,ye.Set=xe;var ke="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var i=65535&(e|=0),a=65535&(t|=0);return i*a+((e>>>16)*a+i*(t>>>16)<<16>>>0)|0};function Ee(e){return e>>>1&1073741824|3221225471&e}function Me(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!=e||e===1/0)return 0;var i=0|e;for(i!==e&&(i^=4294967295*e);e>4294967295;)i^=e/=4294967295;return Ee(i)}if("string"===t)return e.length>Oe?function(e){var t=Ne[e];return void 0===t&&(t=Se(e),De===Re&&(De=0,Ne={}),De++,Ne[e]=t),t}(e):Se(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return function(e){var t;if(Le&&void 0!==(t=Te.get(e)))return t;if(void 0!==(t=e[Pe]))return t;if(!Ce){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Pe]))return t;if(void 0!==(t=function(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e)))return t}if(t=++Ie,1073741824&Ie&&(Ie=0),Le)Te.set(e,t);else{if(void 0!==Ae&&!1===Ae(e))throw new Error("Non-extensible objects are not allowed as keys.");if(Ce)Object.defineProperty(e,Pe,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[Pe]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Pe]=t}}return t}(e);if("function"==typeof e.toString)return Se(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function Se(e){for(var t=0,i=0;i=t.length)throw new Error("Missing value for key: "+t[i]);e.set(t[i],t[i+1])}})},je.prototype.toString=function(){return this.__toString("Map {","}")},je.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},je.prototype.set=function(e,t){return $e(this,e,t)},je.prototype.setIn=function(e,t){return this.updateIn(e,g,function(){return t})},je.prototype.remove=function(e){return $e(this,e,g)},je.prototype.deleteIn=function(e){return this.updateIn(e,function(){return g})},je.prototype.update=function(e,t,i){return 1===arguments.length?e(this):this.updateIn([e],t,i)},je.prototype.updateIn=function(e,t,i){i||(i=t,t=void 0);var a=function e(t,i,a,n){var r=t===g,o=i.next();if(o.done){var s=r?a:t,u=n(s);return u===s?t:u}be(r||t&&t.set,"invalid keyPath");var f=o.value,l=r?g:t.get(f,g),c=e(l,i,a,n);return c===l?t:c===g?t.remove(f):(r?Je():t).set(f,c)}(this,ii(e),t,i);return a===g?void 0:a},je.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Je()},je.prototype.merge=function(){return at(this,void 0,arguments)},je.prototype.mergeWith=function(t){var i=e.call(arguments,1);return at(this,t,i)},je.prototype.mergeIn=function(t){var i=e.call(arguments,1);return this.updateIn(t,Je(),function(e){return"function"==typeof e.merge?e.merge.apply(e,i):i[i.length-1]})},je.prototype.mergeDeep=function(){return at(this,nt,arguments)},je.prototype.mergeDeepWith=function(t){var i=e.call(arguments,1);return at(this,rt(t),i)},je.prototype.mergeDeepIn=function(t){var i=e.call(arguments,1);return this.updateIn(t,Je(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,i):i[i.length-1]})},je.prototype.sort=function(e){return Ct(Vt(this,e))},je.prototype.sortBy=function(e,t){return Ct(Vt(this,t,e))},je.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},je.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new k)},je.prototype.asImmutable=function(){return this.__ensureOwner()},je.prototype.wasAltered=function(){return this.__altered},je.prototype.__iterator=function(e,t){return new Xe(this,e,t)},je.prototype.__iterate=function(e,t){var i=this,a=0;return this._root&&this._root.iterate(function(t){return a++,e(t[1],t[0],i)},t),a},je.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Qe(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},je.isMap=Be;var ze,Ue="@@__IMMUTABLE_MAP__@@",He=je.prototype;function Ye(e,t){this.ownerID=e,this.entries=t}function Ge(e,t,i){this.ownerID=e,this.bitmap=t,this.nodes=i}function Ve(e,t,i){this.ownerID=e,this.count=t,this.nodes=i}function We(e,t,i){this.ownerID=e,this.keyHash=t,this.entries=i}function qe(e,t,i){this.ownerID=e,this.keyHash=t,this.entry=i}function Xe(e,t,i){this._type=t,this._reverse=i,this._stack=e._root&&Ze(e._root)}function Ke(e,t){return B(e,t[0],t[1])}function Ze(e,t){return{node:e,index:0,__prev:t}}function Qe(e,t,i,a){var n=Object.create(He);return n.size=e,n._root=t,n.__ownerID=i,n.__hash=a,n.__altered=!1,n}function Je(){return ze||(ze=Qe(0))}function $e(e,t,i){var a,n;if(e._root){var r=_(y),o=_(w);if(a=et(e._root,e.__ownerID,0,void 0,t,i,r,o),!o.value)return e;n=e.size+(r.value?i===g?-1:1:0)}else{if(i===g)return e;n=1,a=new Ye(e.__ownerID,[[t,i]])}return e.__ownerID?(e.size=n,e._root=a,e.__hash=void 0,e.__altered=!0,e):a?Qe(n,a):Je()}function et(e,t,i,a,n,r,o,s){return e?e.update(t,i,a,n,r,o,s):r===g?e:(x(s),x(o),new qe(t,a,[n,r]))}function tt(e){return e.constructor===qe||e.constructor===We}function it(e,t,i,a,n){if(e.keyHash===a)return new We(t,a,[e.entry,n]);var r,o=(0===i?e.keyHash:e.keyHash>>>i)&b,s=(0===i?a:a>>>i)&b,u=o===s?[it(e,t,i+m,a,n)]:(r=new qe(t,a,n),o>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function ut(e,t,i,a){var n=a?e:E(e);return n[t]=i,n}He[Ue]=!0,He.delete=He.remove,He.removeIn=He.deleteIn,Ye.prototype.get=function(e,t,i,a){for(var n=this.entries,r=0,o=n.length;r=ft)return function(e,t,i,a){e||(e=new k);for(var n=new qe(e,Me(i),[i,a]),r=0;r>>e)&b),r=this.bitmap;return 0==(r&n)?a:this.nodes[st(r&n-1)].get(e+m,t,i,a)},Ge.prototype.update=function(e,t,i,a,n,r,o){void 0===i&&(i=Me(a));var s=(0===t?i:i>>>t)&b,u=1<=lt)return function(e,t,i,a,n){for(var r=0,o=new Array(v),s=0;0!==i;s++,i>>>=1)o[s]=1&i?t[r++]:void 0;return o[a]=n,new Ve(e,r+1,o)}(e,h,f,s,p);if(l&&!p&&2===h.length&&tt(h[1^c]))return h[1^c];if(l&&p&&1===h.length&&tt(p))return p;var y=e&&e===this.ownerID,w=l?p?f:f^u:f|u,_=l?p?ut(h,c,p,y):function(e,t,i){var a=e.length-1;if(i&&t===a)return e.pop(),e;for(var n=new Array(a),r=0,o=0;o>>e)&b,r=this.nodes[n];return r?r.get(e+m,t,i,a):a},Ve.prototype.update=function(e,t,i,a,n,r,o){void 0===i&&(i=Me(a));var s=(0===t?i:i>>>t)&b,u=n===g,f=this.nodes,l=f[s];if(u&&!l)return this;var c=et(l,e,t+m,i,a,n,r,o);if(c===l)return this;var h=this.count;if(l){if(!c&&--h0&&a=0&&e=e.size||t<0)return e.withMutations(function(e){t<0?St(e,t).set(0,i):St(e,0,t+1).set(t,i)});t+=e._origin;var a=e._tail,n=e._root,r=_(w);return t>=At(e._capacity)?a=kt(a,e.__ownerID,0,t,i,r):n=kt(n,e.__ownerID,e._level,t,i,r),r.value?e.__ownerID?(e._root=n,e._tail=a,e.__hash=void 0,e.__altered=!0,e):_t(e._origin,e._capacity,e._level,n,a):e}(this,e,t)},ht.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},ht.prototype.insert=function(e,t){return this.splice(e,0,t)},ht.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=m,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):xt()},ht.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations(function(i){St(i,0,t+e.length);for(var a=0;a>>t&b;if(a>=this.array.length)return new vt([],e);var n,r=0===a;if(t>0){var o=this.array[a];if((n=o&&o.removeBefore(e,t-m,i))===o&&r)return this}if(r&&!n)return this;var s=Et(this,e);if(!r)for(var u=0;u>>t&b;if(n>=this.array.length)return this;if(t>0){var r=this.array[n];if((a=r&&r.removeAfter(e,t-m,i))===r&&n===this.array.length-1)return this}var o=Et(this,e);return o.array.splice(n+1),a&&(o.array[n]=a),o};var bt,gt,yt={};function wt(e,t){var i=e._origin,a=e._capacity,n=At(a),r=e._tail;return o(e._root,e._level,0);function o(e,s,u){return 0===s?function(e,o){var s=o===n?r&&r.array:e&&e.array,u=o>i?0:i-o,f=a-o;return f>v&&(f=v),function(){if(u===f)return yt;var e=t?--f:u++;return s&&s[e]}}(e,u):function(e,n,r){var s,u=e&&e.array,f=r>i?0:i-r>>n,l=1+(a-r>>n);return l>v&&(l=v),function(){for(;;){if(s){var e=s();if(e!==yt)return e;s=null}if(f===l)return yt;var i=t?--l:f++;s=o(u&&u[i],n-m,r+(i<>>i&b,u=e&&s0){var f=e&&e.array[s],l=kt(f,t,i-m,a,n,r);return l===f?e:((o=Et(e,t)).array[s]=l,o)}return u&&e.array[s]===n?e:(x(r),o=Et(e,t),void 0===n&&s===o.array.length-1?o.array.pop():o.array[s]=n,o)}function Et(e,t){return t&&e&&t===e.ownerID?e:new vt(e?e.array.slice():[],t)}function Mt(e,t){if(t>=At(e._capacity))return e._tail;if(t<1<0;)i=i.array[t>>>a&b],a-=m;return i}}function St(e,t,i){void 0!==t&&(t|=0),void 0!==i&&(i|=0);var a=e.__ownerID||new k,n=e._origin,r=e._capacity,o=n+t,s=void 0===i?r:i<0?r+i:n+i;if(o===n&&s===r)return e;if(o>=s)return e.clear();for(var u=e._level,f=e._root,l=0;o+l<0;)f=new vt(f&&f.array.length?[void 0,f]:[],a),l+=1<<(u+=m);l&&(o+=l,n+=l,s+=l,r+=l);for(var c=At(r),h=At(s);h>=1<c?new vt([],a):d;if(d&&h>c&&om;g-=m){var y=c>>>g&b;v=v.array[y]=Et(v.array[y],a)}v.array[c>>>m&b]=d}if(s=h)o-=h,s-=h,u=m,f=null,p=p&&p.removeBefore(a,0,o);else if(o>n||h>>u&b;if(w!==h>>>u&b)break;w&&(l+=(1<n&&(f=f.removeBefore(a,u,o-l)),f&&hr&&(r=f.size),o(u)||(f=f.map(function(e){return ce(e)})),a.push(f)}return r>e.size&&(e=e.setSize(r)),ot(e,t,a)}function At(e){return e>>m<=v&&o.size>=2*r.size?(n=o.filter(function(e,t){return void 0!==e&&s!==t}),a=n.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(a.__ownerID=n.__ownerID=e.__ownerID)):(a=r.remove(t),n=s===o.size-1?o.pop():o.set(s,void 0))}else if(u){if(i===o.get(s)[1])return e;a=r,n=o.set(s,[t,i])}else a=r.set(t,o.size),n=o.set(o.size,[t,i]);return e.__ownerID?(e.size=a.size,e._map=a,e._list=n,e.__hash=void 0,e):It(a,n)}function Rt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function Dt(e){this._iter=e,this.size=e.size}function Nt(e){this._iter=e,this.size=e.size}function Ft(e){this._iter=e,this.size=e.size}function jt(e){var t=$t(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=ei,t.__iterateUncached=function(t,i){var a=this;return e.__iterate(function(e,i){return!1!==t(i,e,a)},i)},t.__iteratorUncached=function(t,i){if(t===R){var a=e.__iterator(t,i);return new j(function(){var e=a.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===O?P:O,i)},t}function Bt(e,t,i){var a=$t(e);return a.size=e.size,a.has=function(t){return e.has(t)},a.get=function(a,n){var r=e.get(a,g);return r===g?n:t.call(i,r,a,e)},a.__iterateUncached=function(a,n){var r=this;return e.__iterate(function(e,n,o){return!1!==a(t.call(i,e,n,o),n,r)},n)},a.__iteratorUncached=function(a,n){var r=e.__iterator(R,n);return new j(function(){var n=r.next();if(n.done)return n;var o=n.value,s=o[0];return B(a,s,t.call(i,o[1],s,e),n)})},a}function zt(e,t){var i=$t(e);return i._iter=e,i.size=e.size,i.reverse=function(){return e},e.flip&&(i.flip=function(){var t=jt(e);return t.reverse=function(){return e.flip()},t}),i.get=function(i,a){return e.get(t?i:-1-i,a)},i.has=function(i){return e.has(t?i:-1-i)},i.includes=function(t){return e.includes(t)},i.cacheResult=ei,i.__iterate=function(t,i){var a=this;return e.__iterate(function(e,i){return t(e,i,a)},!i)},i.__iterator=function(t,i){return e.__iterator(t,!i)},i}function Ut(e,t,i,a){var n=$t(e);return a&&(n.has=function(a){var n=e.get(a,g);return n!==g&&!!t.call(i,n,a,e)},n.get=function(a,n){var r=e.get(a,g);return r!==g&&t.call(i,r,a,e)?r:n}),n.__iterateUncached=function(n,r){var o=this,s=0;return e.__iterate(function(e,r,u){if(t.call(i,e,r,u))return s++,n(e,a?r:s-1,o)},r),s},n.__iteratorUncached=function(n,r){var o=e.__iterator(R,r),s=0;return new j(function(){for(;;){var r=o.next();if(r.done)return r;var u=r.value,f=u[0],l=u[1];if(t.call(i,l,f,e))return B(n,a?f:s++,l,r)}})},n}function Ht(e,t,i,a){var n=e.size;if(void 0!==t&&(t|=0),void 0!==i&&(i===1/0?i=n:i|=0),A(t,i,n))return e;var r=C(t,n),o=L(i,n);if(r!=r||o!=o)return Ht(e.toSeq().cacheResult(),t,i,a);var s,u=o-r;u==u&&(s=u<0?0:u);var f=$t(e);return f.size=0===s?s:e.size&&s||void 0,!a&&ne(e)&&s>=0&&(f.get=function(t,i){return(t=S(this,t))>=0&&ts)return{value:void 0,done:!0};var e=n.next();return a||t===O?e:B(t,u-1,t===P?void 0:e.value[1],e)})},f}function Yt(e,t,i,a){var n=$t(e);return n.__iterateUncached=function(n,r){var o=this;if(r)return this.cacheResult().__iterate(n,r);var s=!0,u=0;return e.__iterate(function(e,r,f){if(!s||!(s=t.call(i,e,r,f)))return u++,n(e,a?r:u-1,o)}),u},n.__iteratorUncached=function(n,r){var o=this;if(r)return this.cacheResult().__iterator(n,r);var s=e.__iterator(R,r),u=!0,f=0;return new j(function(){var e,r,l;do{if((e=s.next()).done)return a||n===O?e:B(n,f++,n===P?void 0:e.value[1],e);var c=e.value;r=c[0],l=c[1],u&&(u=t.call(i,l,r,o))}while(u);return n===R?e:B(n,r,l,e)})},n}function Gt(e,t,i){var a=$t(e);return a.__iterateUncached=function(a,n){var r=0,s=!1;return function e(u,f){var l=this;u.__iterate(function(n,u){return(!t||f0}function Xt(e,t,a){var n=$t(e);return n.size=new ee(a).map(function(e){return e.size}).min(),n.__iterate=function(e,t){for(var i,a=this.__iterator(O,t),n=0;!(i=a.next()).done&&!1!==e(i.value,n++,this););return n},n.__iteratorUncached=function(e,n){var r=a.map(function(e){return e=i(e),Y(n?e.reverse():e)}),o=0,s=!1;return new j(function(){var i;return s||(i=r.map(function(e){return e.next()}),s=i.some(function(e){return e.done})),s?{value:void 0,done:!0}:B(e,o++,t.apply(null,i.map(function(e){return e.value})))})},n}function Kt(e,t){return ne(e)?t:e.constructor(t)}function Zt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Qt(e){return Fe(e.size),M(e)}function Jt(e){return s(e)?a:u(e)?n:r}function $t(e){return Object.create((s(e)?q:u(e)?X:K).prototype)}function ei(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):W.prototype.cacheResult.call(this)}function ti(e,t){return e>t?1:e=0;i--)t={value:arguments[i],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Si(e,t)},_i.prototype.pushAll=function(e){if(0===(e=n(e)).size)return this;Fe(e.size);var t=this.size,i=this._head;return e.reverse().forEach(function(e){t++,i={value:e,next:i}}),this.__ownerID?(this.size=t,this._head=i,this.__hash=void 0,this.__altered=!0,this):Si(t,i)},_i.prototype.pop=function(){return this.slice(1)},_i.prototype.unshift=function(){return this.push.apply(this,arguments)},_i.prototype.unshiftAll=function(e){return this.pushAll(e)},_i.prototype.shift=function(){return this.pop.apply(this,arguments)},_i.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Ti()},_i.prototype.slice=function(e,t){if(A(e,t,this.size))return this;var i=C(e,this.size),a=L(t,this.size);if(a!==this.size)return _e.prototype.slice.call(this,e,t);for(var n=this.size-i,r=this._head;i--;)r=r.next;return this.__ownerID?(this.size=n,this._head=r,this.__hash=void 0,this.__altered=!0,this):Si(n,r)},_i.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Si(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},_i.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var i=0,a=this._head;a&&!1!==e(a.value,i++,this);)a=a.next;return i},_i.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var i=0,a=this._head;return new j(function(){if(a){var t=a.value;return a=a.next,B(e,i++,t)}return{value:void 0,done:!0}})},_i.isStack=xi;var ki,Ei="@@__IMMUTABLE_STACK__@@",Mi=_i.prototype;function Si(e,t,i,a){var n=Object.create(Mi);return n.size=e,n._head=t,n.__ownerID=i,n.__hash=a,n.__altered=!1,n}function Ti(){return ki||(ki=Si(0))}function Ai(e,t){var i=function(i){e.prototype[i]=t[i]};return Object.keys(t).forEach(i),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(i),e}Mi[Ei]=!0,Mi.withMutations=He.withMutations,Mi.asMutable=He.asMutable,Mi.asImmutable=He.asImmutable,Mi.wasAltered=He.wasAltered,i.Iterator=j,Ai(i,{toArray:function(){Fe(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,i){e[i]=t}),e},toIndexedSeq:function(){return new Dt(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new Rt(this,!0)},toMap:function(){return je(this.toKeyedSeq())},toObject:function(){Fe(this.size);var e={};return this.__iterate(function(t,i){e[i]=t}),e},toOrderedMap:function(){return Ct(this.toKeyedSeq())},toOrderedSet:function(){return mi(s(this)?this.valueSeq():this)},toSet:function(){return si(s(this)?this.valueSeq():this)},toSetSeq:function(){return new Nt(this)},toSeq:function(){return u(this)?this.toIndexedSeq():s(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return _i(s(this)?this.valueSeq():this)},toList:function(){return ht(s(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){var t=e.call(arguments,0);return Kt(this,function(e,t){var i=s(e),n=[e].concat(t).map(function(e){return o(e)?i&&(e=a(e)):e=i?oe(e):se(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===n.length)return e;if(1===n.length){var r=n[0];if(r===e||i&&s(r)||u(e)&&u(r))return r}var f=new ee(n);return i?f=f.toKeyedSeq():u(e)||(f=f.toSetSeq()),(f=f.flatten(!0)).size=n.reduce(function(e,t){if(void 0!==e){var i=t.size;if(void 0!==i)return e+i}},0),f}(this,t))},includes:function(e){return this.some(function(t){return pe(t,e)})},entries:function(){return this.__iterator(R)},every:function(e,t){Fe(this.size);var i=!0;return this.__iterate(function(a,n,r){if(!e.call(t,a,n,r))return i=!1,!1}),i},filter:function(e,t){return Kt(this,Ut(this,e,t,!0))},find:function(e,t,i){var a=this.findEntry(e,t);return a?a[1]:i},forEach:function(e,t){return Fe(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Fe(this.size),e=void 0!==e?""+e:",";var t="",i=!0;return this.__iterate(function(a){i?i=!1:t+=e,t+=null!==a&&void 0!==a?a.toString():""}),t},keys:function(){return this.__iterator(P)},map:function(e,t){return Kt(this,Bt(this,e,t))},reduce:function(e,t,i){var a,n;return Fe(this.size),arguments.length<2?n=!0:a=t,this.__iterate(function(t,r,o){n?(n=!1,a=t):a=e.call(i,a,t,r,o)}),a},reduceRight:function(e,t,i){var a=this.toKeyedSeq().reverse();return a.reduce.apply(a,arguments)},reverse:function(){return Kt(this,zt(this,!0))},slice:function(e,t){return Kt(this,Ht(this,e,t,!0))},some:function(e,t){return!this.every(Oi(e),t)},sort:function(e){return Kt(this,Vt(this,e))},values:function(){return this.__iterator(O)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return M(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,i){var a=je().asMutable();return e.__iterate(function(n,r){a.update(t.call(i,n,r,e),0,function(e){return e+1})}),a.asImmutable()}(this,e,t)},equals:function(e){return me(this,e)},entrySeq:function(){var e=this;if(e._cache)return new ee(e._cache);var t=e.toSeq().map(Pi).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Oi(e),t)},findEntry:function(e,t,i){var a=i;return this.__iterate(function(i,n,r){if(e.call(t,i,n,r))return a=[n,i],!1}),a},findKey:function(e,t){var i=this.findEntry(e,t);return i&&i[0]},findLast:function(e,t,i){return this.toKeyedSeq().reverse().find(e,t,i)},findLastEntry:function(e,t,i){return this.toKeyedSeq().reverse().findEntry(e,t,i)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(T)},flatMap:function(e,t){return Kt(this,function(e,t,i){var a=Jt(e);return e.toSeq().map(function(n,r){return a(t.call(i,n,r,e))}).flatten(!0)}(this,e,t))},flatten:function(e){return Kt(this,Gt(this,e,!0))},fromEntrySeq:function(){return new Ft(this)},get:function(e,t){return this.find(function(t,i){return pe(i,e)},void 0,t)},getIn:function(e,t){for(var i,a=this,n=ii(e);!(i=n.next()).done;){var r=i.value;if((a=a&&a.get?a.get(r,g):g)===g)return t}return a},groupBy:function(e,t){return function(e,t,i){var a=s(e),n=(l(e)?Ct():je()).asMutable();e.__iterate(function(r,o){n.update(t.call(i,r,o,e),function(e){return(e=e||[]).push(a?[o,r]:r),e})});var r=Jt(e);return n.map(function(t){return Kt(e,r(t))})}(this,e,t)},has:function(e){return this.get(e,g)!==g},hasIn:function(e){return this.getIn(e,g)!==g},isSubset:function(e){return e="function"==typeof e.includes?e:i(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:i(e)).isSubset(this)},keyOf:function(e){return this.findKey(function(t){return pe(t,e)})},keySeq:function(){return this.toSeq().map(Ii).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Wt(this,e)},maxBy:function(e,t){return Wt(this,t,e)},min:function(e){return Wt(this,e?Ri(e):Fi)},minBy:function(e,t){return Wt(this,t?Ri(t):Fi,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Kt(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Kt(this,Yt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Oi(e),t)},sortBy:function(e,t){return Kt(this,Vt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Kt(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Kt(this,function(e,t,i){var a=$t(e);return a.__iterateUncached=function(a,n){var r=this;if(n)return this.cacheResult().__iterate(a,n);var o=0;return e.__iterate(function(e,n,s){return t.call(i,e,n,s)&&++o&&a(e,n,r)}),o},a.__iteratorUncached=function(a,n){var r=this;if(n)return this.cacheResult().__iterator(a,n);var o=e.__iterator(R,n),s=!0;return new j(function(){if(!s)return{value:void 0,done:!0};var e=o.next();if(e.done)return e;var n=e.value,u=n[0],f=n[1];return t.call(i,f,u,r)?a===R?e:B(a,u,f,e):(s=!1,{value:void 0,done:!0})})},a}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Oi(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(e){if(e.size===1/0)return 0;var t=l(e),i=s(e),a=t?1:0;return function(e,t){return t=ke(t,3432918353),t=ke(t<<15|t>>>-15,461845907),t=ke(t<<13|t>>>-13,5),t=ke((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=Ee((t=ke(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(i?t?function(e,t){a=31*a+ji(Me(e),Me(t))|0}:function(e,t){a=a+ji(Me(e),Me(t))|0}:t?function(e){a=31*a+Me(e)|0}:function(e){a=a+Me(e)|0}),a)}(this))}});var Ci=i.prototype;Ci[c]=!0,Ci[F]=Ci.values,Ci.__toJS=Ci.toArray,Ci.__toStringMapper=Di,Ci.inspect=Ci.toSource=function(){return this.toString()},Ci.chain=Ci.flatMap,Ci.contains=Ci.includes,Ai(a,{flip:function(){return Kt(this,jt(this))},mapEntries:function(e,t){var i=this,a=0;return Kt(this,this.toSeq().map(function(n,r){return e.call(t,[r,n],a++,i)}).fromEntrySeq())},mapKeys:function(e,t){var i=this;return Kt(this,this.toSeq().flip().map(function(a,n){return e.call(t,a,n,i)}).flip())}});var Li=a.prototype;function Ii(e,t){return t}function Pi(e,t){return[t,e]}function Oi(e){return function(){return!e.apply(this,arguments)}}function Ri(e){return function(){return-e.apply(this,arguments)}}function Di(e){return"string"==typeof e?JSON.stringify(e):String(e)}function Ni(){return E(arguments)}function Fi(e,t){return et?-1:0}function ji(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}return Li[h]=!0,Li[F]=Ci.entries,Li.__toJS=Ci.toObject,Li.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+Di(e)},Ai(n,{toKeyedSeq:function(){return new Rt(this,!1)},filter:function(e,t){return Kt(this,Ut(this,e,t,!1))},findIndex:function(e,t){var i=this.findEntry(e,t);return i?i[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Kt(this,zt(this,!1))},slice:function(e,t){return Kt(this,Ht(this,e,t,!1))},splice:function(e,t){var i=arguments.length;if(t=Math.max(0|t,0),0===i||2===i&&!t)return this;e=C(e,e<0?this.count():this.size);var a=this.slice(0,e);return Kt(this,1===i?a:a.concat(E(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var i=this.findLastEntry(e,t);return i?i[0]:-1},first:function(){return this.get(0)},flatten:function(e){return Kt(this,Gt(this,e,!1))},get:function(e,t){return(e=S(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,i){return i===e},void 0,t)},has:function(e){return(e=S(this,e))>=0&&(void 0!==this.size?this.size===1/0||e0&&t-1 in e)}m.fn=m.prototype={jquery:"2.2.4",constructor:m,selector:"",length:0,toArray:function(){return s.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:s.call(this)},pushStack:function(e){var t=m.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e){return m.each(this,e)},map:function(e){return this.pushStack(m.map(this,function(t,i){return e.call(t,i,t)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,i=+e+(e<0?t:0);return this.pushStack(i>=0&&i=0},isPlainObject:function(e){var t;if("object"!==m.type(e)||e.nodeType||m.isWindow(e))return!1;if(e.constructor&&!d.call(e,"constructor")&&!d.call(e.constructor.prototype||{},"isPrototypeOf"))return!1;for(t in e);return void 0===t||d.call(e,t)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[h.call(e)]||"object":typeof e},globalEval:function(e){var t,i=eval;(e=m.trim(e))&&(1===e.indexOf("use strict")?((t=o.createElement("script")).text=e,o.head.appendChild(t).parentNode.removeChild(t)):i(e))},camelCase:function(e){return e.replace(b,"ms-").replace(g,y)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var i,a=0;if(w(e))for(i=e.length;a+~]|"+F+")"+F+"*"),V=new RegExp("="+F+"*([^\\]'\"]*?)"+F+"*\\]","g"),W=new RegExp(z),q=new RegExp("^"+j+"$"),X={ID:new RegExp("^#("+j+")"),CLASS:new RegExp("^\\.("+j+")"),TAG:new RegExp("^("+j+"|[*])"),ATTR:new RegExp("^"+B),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+N+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},K=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,ee=/'|\\/g,te=new RegExp("\\\\([\\da-f]{1,6}"+F+"?|("+F+")|.)","ig"),ie=function(e,t,i){var a="0x"+t-65536;return a!=a||i?t:a<0?String.fromCharCode(a+65536):String.fromCharCode(a>>10|55296,1023&a|56320)},ae=function(){h()};try{O.apply(L=R.call(_.childNodes),_.childNodes),L[_.childNodes.length].nodeType}catch(e){O={apply:L.length?function(e,t){P.apply(e,R.call(t))}:function(e,t){for(var i=e.length,a=0;e[i++]=t[a++];);e.length=i-1}}}function ne(e,t,a,n){var r,s,f,l,c,p,b,g,x=t&&t.ownerDocument,k=t?t.nodeType:9;if(a=a||[],"string"!=typeof e||!e||1!==k&&9!==k&&11!==k)return a;if(!n&&((t?t.ownerDocument||t:_)!==d&&h(t),t=t||d,m)){if(11!==k&&(p=J.exec(e)))if(r=p[1]){if(9===k){if(!(f=t.getElementById(r)))return a;if(f.id===r)return a.push(f),a}else if(x&&(f=x.getElementById(r))&&y(t,f)&&f.id===r)return a.push(f),a}else{if(p[2])return O.apply(a,t.getElementsByTagName(e)),a;if((r=p[3])&&i.getElementsByClassName&&t.getElementsByClassName)return O.apply(a,t.getElementsByClassName(r)),a}if(i.qsa&&!S[e+" "]&&(!v||!v.test(e))){if(1!==k)x=t,g=e;else if("object"!==t.nodeName.toLowerCase()){for((l=t.getAttribute("id"))?l=l.replace(ee,"\\$&"):t.setAttribute("id",l=w),s=(b=o(e)).length,c=q.test(l)?"#"+l:"[id='"+l+"']";s--;)b[s]=c+" "+me(b[s]);g=b.join(","),x=$.test(e)&&de(t.parentNode)||t}if(g)try{return O.apply(a,x.querySelectorAll(g)),a}catch(e){}finally{l===w&&t.removeAttribute("id")}}}return u(e.replace(H,"$1"),t,a,n)}function re(){var e=[];return function t(i,n){return e.push(i+" ")>a.cacheLength&&delete t[e.shift()],t[i+" "]=n}}function oe(e){return e[w]=!0,e}function se(e){var t=d.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ue(e,t){for(var i=e.split("|"),n=i.length;n--;)a.attrHandle[i[n]]=t}function fe(e,t){var i=t&&e,a=i&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||A)-(~e.sourceIndex||A);if(a)return a;if(i)for(;i=i.nextSibling;)if(i===t)return-1;return e?1:-1}function le(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function ce(e){return function(t){var i=t.nodeName.toLowerCase();return("input"===i||"button"===i)&&t.type===e}}function he(e){return oe(function(t){return t=+t,oe(function(i,a){for(var n,r=e([],i.length,t),o=r.length;o--;)i[n=r[o]]&&(i[n]=!(a[n]=i[n]))})})}function de(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in i=ne.support={},r=ne.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},h=ne.setDocument=function(e){var t,n,o=e?e.ownerDocument||e:_;return o!==d&&9===o.nodeType&&o.documentElement?(p=(d=o).documentElement,m=!r(d),(n=d.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",ae,!1):n.attachEvent&&n.attachEvent("onunload",ae)),i.attributes=se(function(e){return e.className="i",!e.getAttribute("className")}),i.getElementsByTagName=se(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),i.getElementsByClassName=Q.test(d.getElementsByClassName),i.getById=se(function(e){return p.appendChild(e).id=w,!d.getElementsByName||!d.getElementsByName(w).length}),i.getById?(a.find.ID=function(e,t){if(void 0!==t.getElementById&&m){var i=t.getElementById(e);return i?[i]:[]}},a.filter.ID=function(e){var t=e.replace(te,ie);return function(e){return e.getAttribute("id")===t}}):(delete a.find.ID,a.filter.ID=function(e){var t=e.replace(te,ie);return function(e){var i=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return i&&i.value===t}}),a.find.TAG=i.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):i.qsa?t.querySelectorAll(e):void 0}:function(e,t){var i,a=[],n=0,r=t.getElementsByTagName(e);if("*"===e){for(;i=r[n++];)1===i.nodeType&&a.push(i);return a}return r},a.find.CLASS=i.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&m)return t.getElementsByClassName(e)},b=[],v=[],(i.qsa=Q.test(d.querySelectorAll))&&(se(function(e){p.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+F+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+F+"*(?:value|"+N+")"),e.querySelectorAll("[id~="+w+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+w+"+*").length||v.push(".#.+[+~]")}),se(function(e){var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+F+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(i.matchesSelector=Q.test(g=p.matches||p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector))&&se(function(e){i.disconnectedMatch=g.call(e,"div"),g.call(e,"[s!='']:x"),b.push("!=",z)}),v=v.length&&new RegExp(v.join("|")),b=b.length&&new RegExp(b.join("|")),t=Q.test(p.compareDocumentPosition),y=t||Q.test(p.contains)?function(e,t){var i=9===e.nodeType?e.documentElement:e,a=t&&t.parentNode;return e===a||!(!a||1!==a.nodeType||!(i.contains?i.contains(a):e.compareDocumentPosition&&16&e.compareDocumentPosition(a)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},T=t?function(e,t){if(e===t)return c=!0,0;var a=!e.compareDocumentPosition-!t.compareDocumentPosition;return a||(1&(a=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!i.sortDetached&&t.compareDocumentPosition(e)===a?e===d||e.ownerDocument===_&&y(_,e)?-1:t===d||t.ownerDocument===_&&y(_,t)?1:l?D(l,e)-D(l,t):0:4&a?-1:1)}:function(e,t){if(e===t)return c=!0,0;var i,a=0,n=e.parentNode,r=t.parentNode,o=[e],s=[t];if(!n||!r)return e===d?-1:t===d?1:n?-1:r?1:l?D(l,e)-D(l,t):0;if(n===r)return fe(e,t);for(i=e;i=i.parentNode;)o.unshift(i);for(i=t;i=i.parentNode;)s.unshift(i);for(;o[a]===s[a];)a++;return a?fe(o[a],s[a]):o[a]===_?-1:s[a]===_?1:0},d):d},ne.matches=function(e,t){return ne(e,null,null,t)},ne.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&h(e),t=t.replace(V,"='$1']"),i.matchesSelector&&m&&!S[t+" "]&&(!b||!b.test(t))&&(!v||!v.test(t)))try{var a=g.call(e,t);if(a||i.disconnectedMatch||e.document&&11!==e.document.nodeType)return a}catch(e){}return ne(t,d,null,[e]).length>0},ne.contains=function(e,t){return(e.ownerDocument||e)!==d&&h(e),y(e,t)},ne.attr=function(e,t){(e.ownerDocument||e)!==d&&h(e);var n=a.attrHandle[t.toLowerCase()],r=n&&C.call(a.attrHandle,t.toLowerCase())?n(e,t,!m):void 0;return void 0!==r?r:i.attributes||!m?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},ne.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ne.uniqueSort=function(e){var t,a=[],n=0,r=0;if(c=!i.detectDuplicates,l=!i.sortStable&&e.slice(0),e.sort(T),c){for(;t=e[r++];)t===e[r]&&(n=a.push(r));for(;n--;)e.splice(a[n],1)}return l=null,e},n=ne.getText=function(e){var t,i="",a=0,r=e.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)i+=n(e)}else if(3===r||4===r)return e.nodeValue}else for(;t=e[a++];)i+=n(t);return i},(a=ne.selectors={cacheLength:50,createPseudo:oe,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ie),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ie),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ne.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ne.error(e[0]),e},PSEUDO:function(e){var t,i=!e[6]&&e[2];return X.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":i&&W.test(i)&&(t=o(i,!0))&&(t=i.indexOf(")",i.length-t)-i.length)&&(e[0]=e[0].slice(0,t),e[2]=i.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ie).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,i){return function(a){var n=ne.attr(a,e);return null==n?"!="===t:!t||(n+="","="===t?n===i:"!="===t?n!==i:"^="===t?i&&0===n.indexOf(i):"*="===t?i&&n.indexOf(i)>-1:"$="===t?i&&n.slice(-i.length)===i:"~="===t?(" "+n.replace(U," ")+" ").indexOf(i)>-1:"|="===t&&(n===i||n.slice(0,i.length+1)===i+"-"))}},CHILD:function(e,t,i,a,n){var r="nth"!==e.slice(0,3),o="last"!==e.slice(-4),s="of-type"===t;return 1===a&&0===n?function(e){return!!e.parentNode}:function(t,i,u){var f,l,c,h,d,p,m=r!==o?"nextSibling":"previousSibling",v=t.parentNode,b=s&&t.nodeName.toLowerCase(),g=!u&&!s,y=!1;if(v){if(r){for(;m;){for(h=t;h=h[m];)if(s?h.nodeName.toLowerCase()===b:1===h.nodeType)return!1;p=m="only"===e&&!p&&"nextSibling"}return!0}if(p=[o?v.firstChild:v.lastChild],o&&g){for(y=(d=(f=(l=(c=(h=v)[w]||(h[w]={}))[h.uniqueID]||(c[h.uniqueID]={}))[e]||[])[0]===x&&f[1])&&f[2],h=d&&v.childNodes[d];h=++d&&h&&h[m]||(y=d=0)||p.pop();)if(1===h.nodeType&&++y&&h===t){l[e]=[x,d,y];break}}else if(g&&(y=d=(f=(l=(c=(h=t)[w]||(h[w]={}))[h.uniqueID]||(c[h.uniqueID]={}))[e]||[])[0]===x&&f[1]),!1===y)for(;(h=++d&&h&&h[m]||(y=d=0)||p.pop())&&((s?h.nodeName.toLowerCase()!==b:1!==h.nodeType)||!++y||(g&&((l=(c=h[w]||(h[w]={}))[h.uniqueID]||(c[h.uniqueID]={}))[e]=[x,y]),h!==t)););return(y-=n)===a||y%a==0&&y/a>=0}}},PSEUDO:function(e,t){var i,n=a.pseudos[e]||a.setFilters[e.toLowerCase()]||ne.error("unsupported pseudo: "+e);return n[w]?n(t):n.length>1?(i=[e,e,"",t],a.setFilters.hasOwnProperty(e.toLowerCase())?oe(function(e,i){for(var a,r=n(e,t),o=r.length;o--;)e[a=D(e,r[o])]=!(i[a]=r[o])}):function(e){return n(e,0,i)}):n}},pseudos:{not:oe(function(e){var t=[],i=[],a=s(e.replace(H,"$1"));return a[w]?oe(function(e,t,i,n){for(var r,o=a(e,null,n,[]),s=e.length;s--;)(r=o[s])&&(e[s]=!(t[s]=r))}):function(e,n,r){return t[0]=e,a(t,null,r,i),t[0]=null,!i.pop()}}),has:oe(function(e){return function(t){return ne(e,t).length>0}}),contains:oe(function(e){return e=e.replace(te,ie),function(t){return(t.textContent||t.innerText||n(t)).indexOf(e)>-1}}),lang:oe(function(e){return q.test(e||"")||ne.error("unsupported lang: "+e),e=e.replace(te,ie).toLowerCase(),function(t){var i;do{if(i=m?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(i=i.toLowerCase())===e||0===i.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var i=e.location&&e.location.hash;return i&&i.slice(1)===t.id},root:function(e){return e===p},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return!1===e.disabled},disabled:function(e){return!0===e.disabled},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!a.pseudos.empty(e)},header:function(e){return Z.test(e.nodeName)},input:function(e){return K.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,i){return[i<0?i+t:i]}),even:he(function(e,t){for(var i=0;i=0;)e.push(a);return e}),gt:he(function(e,t,i){for(var a=i<0?i+t:i;++a1?function(t,i,a){for(var n=e.length;n--;)if(!e[n](t,i,a))return!1;return!0}:e[0]}function ge(e,t,i,a,n){for(var r,o=[],s=0,u=e.length,f=null!=t;s-1&&(r[f]=!(o[f]=c))}}else b=ge(b===o?b.splice(p,b.length):b),n?n(null,o,b,u):O.apply(o,b)})}function we(e){for(var t,i,n,r=e.length,o=a.relative[e[0].type],s=o||a.relative[" "],u=o?1:0,l=ve(function(e){return e===t},s,!0),c=ve(function(e){return D(t,e)>-1},s,!0),h=[function(e,i,a){var n=!o&&(a||i!==f)||((t=i).nodeType?l(e,i,a):c(e,i,a));return t=null,n}];u1&&be(h),u>1&&me(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(H,"$1"),i,u0,n=e.length>0,r=function(r,o,s,u,l){var c,p,v,b=0,g="0",y=r&&[],w=[],_=f,k=r||n&&a.find.TAG("*",l),E=x+=null==_?1:Math.random()||.1,M=k.length;for(l&&(f=o===d||o||l);g!==M&&null!=(c=k[g]);g++){if(n&&c){for(p=0,o||c.ownerDocument===d||(h(c),s=!m);v=e[p++];)if(v(c,o||d,s)){u.push(c);break}l&&(x=E)}i&&((c=!v&&c)&&b--,r&&y.push(c))}if(b+=g,i&&g!==b){for(p=0;v=t[p++];)v(y,w,o,s);if(r){if(b>0)for(;g--;)y[g]||w[g]||(w[g]=I.call(u));w=ge(w)}O.apply(u,w),l&&!r&&w.length>0&&b+t.length>1&&ne.uniqueSort(u)}return l&&(x=E,f=_),y};return i?oe(r):r}(r,n))).selector=e}return s},u=ne.select=function(e,t,n,r){var u,f,l,c,h,d="function"==typeof e&&e,p=!r&&o(e=d.selector||e);if(n=n||[],1===p.length){if((f=p[0]=p[0].slice(0)).length>2&&"ID"===(l=f[0]).type&&i.getById&&9===t.nodeType&&m&&a.relative[f[1].type]){if(!(t=(a.find.ID(l.matches[0].replace(te,ie),t)||[])[0]))return n;d&&(t=t.parentNode),e=e.slice(f.shift().value.length)}for(u=X.needsContext.test(e)?0:f.length;u--&&(l=f[u],!a.relative[c=l.type]);)if((h=a.find[c])&&(r=h(l.matches[0].replace(te,ie),$.test(f[0].type)&&de(t.parentNode)||t))){if(f.splice(u,1),!(e=r.length&&me(f)))return O.apply(n,r),n;break}}return(d||s(e,p))(r,t,!m,n,!t||$.test(e)&&de(t.parentNode)||t),n},i.sortStable=w.split("").sort(T).join("")===w,i.detectDuplicates=!!c,h(),i.sortDetached=se(function(e){return 1&e.compareDocumentPosition(d.createElement("div"))}),se(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||ue("type|href|height|width",function(e,t,i){if(!i)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),i.attributes&&se(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ue("value",function(e,t,i){if(!i&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),se(function(e){return null==e.getAttribute("disabled")})||ue(N,function(e,t,i){var a;if(!i)return!0===e[t]?t.toLowerCase():(a=e.getAttributeNode(t))&&a.specified?a.value:null}),ne}(i);m.find=_,m.expr=_.selectors,m.expr[":"]=m.expr.pseudos,m.uniqueSort=m.unique=_.uniqueSort,m.text=_.getText,m.isXMLDoc=_.isXML,m.contains=_.contains;var x=function(e,t,i){for(var a=[],n=void 0!==i;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(n&&m(e).is(i))break;a.push(e)}return a},k=function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i},E=m.expr.match.needsContext,M=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,S=/^.[^:#\[\.,]*$/;function T(e,t,i){if(m.isFunction(t))return m.grep(e,function(e,a){return!!t.call(e,a,e)!==i});if(t.nodeType)return m.grep(e,function(e){return e===t!==i});if("string"==typeof t){if(S.test(t))return m.filter(t,e,i);t=m.filter(t,e)}return m.grep(e,function(e){return l.call(t,e)>-1!==i})}m.filter=function(e,t,i){var a=t[0];return i&&(e=":not("+e+")"),1===t.length&&1===a.nodeType?m.find.matchesSelector(a,e)?[a]:[]:m.find.matches(e,m.grep(t,function(e){return 1===e.nodeType}))},m.fn.extend({find:function(e){var t,i=this.length,a=[],n=this;if("string"!=typeof e)return this.pushStack(m(e).filter(function(){for(t=0;t1?m.unique(a):a)).selector=this.selector?this.selector+" "+e:e,a},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,"string"==typeof e&&E.test(e)?m(e):e||[],!1).length}});var A,C=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/;(m.fn.init=function(e,t,i){var a,n;if(!e)return this;if(i=i||A,"string"==typeof e){if(!(a="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:C.exec(e))||!a[1]&&t)return!t||t.jquery?(t||i).find(e):this.constructor(t).find(e);if(a[1]){if(t=t instanceof m?t[0]:t,m.merge(this,m.parseHTML(a[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),M.test(a[1])&&m.isPlainObject(t))for(a in t)m.isFunction(this[a])?this[a](t[a]):this.attr(a,t[a]);return this}return(n=o.getElementById(a[2]))&&n.parentNode&&(this.length=1,this[0]=n),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):m.isFunction(e)?void 0!==i.ready?i.ready(e):e(m):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),m.makeArray(e,this))}).prototype=m.fn,A=m(o);var L=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}m.fn.extend({has:function(e){var t=m(e,this),i=t.length;return this.filter(function(){for(var e=0;e-1:1===i.nodeType&&m.find.matchesSelector(i,e))){r.push(i);break}return this.pushStack(r.length>1?m.uniqueSort(r):r)},index:function(e){return e?"string"==typeof e?l.call(m(e),this[0]):l.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(m.uniqueSort(m.merge(this.get(),m(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),m.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x(e,"parentNode")},parentsUntil:function(e,t,i){return x(e,"parentNode",i)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return x(e,"nextSibling")},prevAll:function(e){return x(e,"previousSibling")},nextUntil:function(e,t,i){return x(e,"nextSibling",i)},prevUntil:function(e,t,i){return x(e,"previousSibling",i)},siblings:function(e){return k((e.parentNode||{}).firstChild,e)},children:function(e){return k(e.firstChild)},contents:function(e){return e.contentDocument||m.merge([],e.childNodes)}},function(e,t){m.fn[e]=function(i,a){var n=m.map(this,t,i);return"Until"!==e.slice(-5)&&(a=i),a&&"string"==typeof a&&(n=m.filter(a,n)),this.length>1&&(I[e]||m.uniqueSort(n),L.test(e)&&n.reverse()),this.pushStack(n)}});var O,R=/\S+/g;function D(){o.removeEventListener("DOMContentLoaded",D),i.removeEventListener("load",D),m.ready()}m.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return m.each(e.match(R)||[],function(e,i){t[i]=!0}),t}(e):m.extend({},e);var t,i,a,n,r=[],o=[],s=-1,u=function(){for(n=e.once,a=t=!0;o.length;s=-1)for(i=o.shift();++s-1;)r.splice(i,1),i<=s&&s--}),this},has:function(e){return e?m.inArray(e,r)>-1:r.length>0},empty:function(){return r&&(r=[]),this},disable:function(){return n=o=[],r=i="",this},disabled:function(){return!r},lock:function(){return n=o=[],i||(r=i=""),this},locked:function(){return!!n},fireWith:function(e,i){return n||(i=[e,(i=i||[]).slice?i.slice():i],o.push(i),t||u()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!a}};return f},m.extend({Deferred:function(e){var t=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],i="pending",a={state:function(){return i},always:function(){return n.done(arguments).fail(arguments),this},then:function(){var e=arguments;return m.Deferred(function(i){m.each(t,function(t,r){var o=m.isFunction(e[t])&&e[t];n[r[1]](function(){var e=o&&o.apply(this,arguments);e&&m.isFunction(e.promise)?e.promise().progress(i.notify).done(i.resolve).fail(i.reject):i[r[0]+"With"](this===a?i.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?m.extend(e,a):a}},n={};return a.pipe=a.then,m.each(t,function(e,r){var o=r[2],s=r[3];a[r[1]]=o.add,s&&o.add(function(){i=s},t[1^e][2].disable,t[2][2].lock),n[r[0]]=function(){return n[r[0]+"With"](this===n?a:this,arguments),this},n[r[0]+"With"]=o.fireWith}),a.promise(n),e&&e.call(n,n),n},when:function(e){var t,i,a,n=0,r=s.call(arguments),o=r.length,u=1!==o||e&&m.isFunction(e.promise)?o:0,f=1===u?e:m.Deferred(),l=function(e,i,a){return function(n){i[e]=this,a[e]=arguments.length>1?s.call(arguments):n,a===t?f.notifyWith(i,a):--u||f.resolveWith(i,a)}};if(o>1)for(t=new Array(o),i=new Array(o),a=new Array(o);n0||(O.resolveWith(o,[m]),m.fn.triggerHandler&&(m(o).triggerHandler("ready"),m(o).off("ready"))))}}),m.ready.promise=function(e){return O||(O=m.Deferred(),"complete"===o.readyState||"loading"!==o.readyState&&!o.documentElement.doScroll?i.setTimeout(m.ready):(o.addEventListener("DOMContentLoaded",D),i.addEventListener("load",D))),O.promise(e)},m.ready.promise();var N=function(e,t,i,a,n,r,o){var s=0,u=e.length,f=null==i;if("object"===m.type(i))for(s in n=!0,i)N(e,t,s,i[s],!0,r,o);else if(void 0!==a&&(n=!0,m.isFunction(a)||(o=!0),f&&(o?(t.call(e,a),t=null):(f=t,t=function(e,t,i){return f.call(m(e),i)})),t))for(;s-1&&void 0!==i&&z.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){z.remove(this,e)})}}),m.extend({queue:function(e,t,i){var a;if(e)return t=(t||"fx")+"queue",a=B.get(e,t),i&&(!a||m.isArray(i)?a=B.access(e,t,m.makeArray(i)):a.push(i)),a||[]},dequeue:function(e,t){t=t||"fx";var i=m.queue(e,t),a=i.length,n=i.shift(),r=m._queueHooks(e,t);"inprogress"===n&&(n=i.shift(),a--),n&&("fx"===t&&i.unshift("inprogress"),delete r.stop,n.call(e,function(){m.dequeue(e,t)},r)),!a&&r&&r.empty.fire()},_queueHooks:function(e,t){var i=t+"queueHooks";return B.get(e,i)||B.access(e,i,{empty:m.Callbacks("once memory").add(function(){B.remove(e,[t+"queue",i])})})}}),m.fn.extend({queue:function(e,t){var i=2;return"string"!=typeof e&&(t=e,e="fx",i--),arguments.length",""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function $(e,t){var i=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&m.nodeName(e,t)?m.merge([e],i):i}function ee(e,t){for(var i=0,a=e.length;i-1)n&&n.push(r);else if(f=m.contains(r.ownerDocument,r),o=$(c.appendChild(r),"script"),f&&ee(o),i)for(l=0;r=o[l++];)Q.test(r.type||"")&&i.push(r);return c}!function(){var e=o.createDocumentFragment().appendChild(o.createElement("div")),t=o.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),p.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",p.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var ae=/^key/,ne=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,re=/^([^.]*)(?:\.(.+)|)/;function oe(){return!0}function se(){return!1}function ue(){try{return o.activeElement}catch(e){}}function fe(e,t,i,a,n,r){var o,s;if("object"==typeof t){for(s in"string"!=typeof i&&(a=a||i,i=void 0),t)fe(e,s,i,a,t[s],r);return e}if(null==a&&null==n?(n=i,a=i=void 0):null==n&&("string"==typeof i?(n=a,a=void 0):(n=a,a=i,i=void 0)),!1===n)n=se;else if(!n)return e;return 1===r&&(o=n,(n=function(e){return m().off(e),o.apply(this,arguments)}).guid=o.guid||(o.guid=m.guid++)),e.each(function(){m.event.add(this,t,n,a,i)})}m.event={global:{},add:function(e,t,i,a,n){var r,o,s,u,f,l,c,h,d,p,v,b=B.get(e);if(b)for(i.handler&&(i=(r=i).handler,n=r.selector),i.guid||(i.guid=m.guid++),(u=b.events)||(u=b.events={}),(o=b.handle)||(o=b.handle=function(t){return void 0!==m&&m.event.triggered!==t.type?m.event.dispatch.apply(e,arguments):void 0}),f=(t=(t||"").match(R)||[""]).length;f--;)d=v=(s=re.exec(t[f])||[])[1],p=(s[2]||"").split(".").sort(),d&&(c=m.event.special[d]||{},d=(n?c.delegateType:c.bindType)||d,c=m.event.special[d]||{},l=m.extend({type:d,origType:v,data:a,handler:i,guid:i.guid,selector:n,needsContext:n&&m.expr.match.needsContext.test(n),namespace:p.join(".")},r),(h=u[d])||((h=u[d]=[]).delegateCount=0,c.setup&&!1!==c.setup.call(e,a,p,o)||e.addEventListener&&e.addEventListener(d,o)),c.add&&(c.add.call(e,l),l.handler.guid||(l.handler.guid=i.guid)),n?h.splice(h.delegateCount++,0,l):h.push(l),m.event.global[d]=!0)},remove:function(e,t,i,a,n){var r,o,s,u,f,l,c,h,d,p,v,b=B.hasData(e)&&B.get(e);if(b&&(u=b.events)){for(f=(t=(t||"").match(R)||[""]).length;f--;)if(d=v=(s=re.exec(t[f])||[])[1],p=(s[2]||"").split(".").sort(),d){for(c=m.event.special[d]||{},h=u[d=(a?c.delegateType:c.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=r=h.length;r--;)l=h[r],!n&&v!==l.origType||i&&i.guid!==l.guid||s&&!s.test(l.namespace)||a&&a!==l.selector&&("**"!==a||!l.selector)||(h.splice(r,1),l.selector&&h.delegateCount--,c.remove&&c.remove.call(e,l));o&&!h.length&&(c.teardown&&!1!==c.teardown.call(e,p,b.handle)||m.removeEvent(e,d,b.handle),delete u[d])}else for(d in u)m.event.remove(e,d+t[f],i,a,!0);m.isEmptyObject(u)&&B.remove(e,"handle events")}},dispatch:function(e){e=m.event.fix(e);var t,i,a,n,r,o,u=s.call(arguments),f=(B.get(this,"events")||{})[e.type]||[],l=m.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!l.preDispatch||!1!==l.preDispatch.call(this,e)){for(o=m.event.handlers.call(this,e,f),t=0;(n=o[t++])&&!e.isPropagationStopped();)for(e.currentTarget=n.elem,i=0;(r=n.handlers[i++])&&!e.isImmediatePropagationStopped();)e.rnamespace&&!e.rnamespace.test(r.namespace)||(e.handleObj=r,e.data=r.data,void 0!==(a=((m.event.special[r.origType]||{}).handle||r.handler).apply(n.elem,u))&&!1===(e.result=a)&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var i,a,n,r,o=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&(!0!==u.disabled||"click"!==e.type)){for(a=[],i=0;i-1:m.find(n,this,null,[u]).length),a[n]&&a.push(r);a.length&&o.push({elem:u,handlers:a})}return s]*)\/>/gi,ce=/\s*$/g;function me(e,t){return m.nodeName(e,"table")&&m.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ve(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function be(e){var t=de.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function ge(e,t){var i,a,n,r,o,s,u,f;if(1===t.nodeType){if(B.hasData(e)&&(r=B.access(e),o=B.set(t,r),f=r.events))for(n in delete o.handle,o.events={},f)for(i=0,a=f[n].length;i1&&"string"==typeof v&&!p.checkClone&&he.test(v))return e.each(function(n){var r=e.eq(n);b&&(t[0]=v.call(this,n,r.html())),we(r,t,i,a)});if(h&&(r=(n=ie(t,e[0].ownerDocument,!1,e,a)).firstChild,1===n.childNodes.length&&(n=r),r||a)){for(s=(o=m.map($(n,"script"),ve)).length;c")},clone:function(e,t,i){var a,n,r,o,s=e.cloneNode(!0),u=m.contains(e.ownerDocument,e);if(!(p.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||m.isXMLDoc(e)))for(o=$(s),a=0,n=(r=$(e)).length;a0&&ee(o,!u&&$(e,"script")),s},cleanData:function(e){for(var t,i,a,n=m.event.special,r=0;void 0!==(i=e[r]);r++)if(F(i)){if(t=i[B.expando]){if(t.events)for(a in t.events)n[a]?m.event.remove(i,a):m.removeEvent(i,a,t.handle);i[B.expando]=void 0}i[z.expando]&&(i[z.expando]=void 0)}}}),m.fn.extend({domManip:we,detach:function(e){return _e(this,e,!0)},remove:function(e){return _e(this,e)},text:function(e){return N(this,function(e){return void 0===e?m.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return we(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||me(this,e).appendChild(e)})},prepend:function(){return we(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=me(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return we(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return we(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(m.cleanData($(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return m.clone(this,e,t)})},html:function(e){return N(this,function(e){var t=this[0]||{},i=0,a=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ce.test(e)&&!J[(Z.exec(e)||["",""])[1].toLowerCase()]){e=m.htmlPrefilter(e);try{for(;i")).appendTo(t.documentElement))[0].contentDocument).write(),t.close(),i=Ee(e,t),xe.detach()),ke[e]=i),i}var Se=/^margin/,Te=new RegExp("^("+G+")(?!px)[a-z%]+$","i"),Ae=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=i),t.getComputedStyle(e)},Ce=function(e,t,i,a){var n,r,o={};for(r in t)o[r]=e.style[r],e.style[r]=t[r];for(r in n=i.apply(e,a||[]),t)e.style[r]=o[r];return n},Le=o.documentElement;function Ie(e,t,i){var a,n,r,o,s=e.style;return""!==(o=(i=i||Ae(e))?i.getPropertyValue(t)||i[t]:void 0)&&void 0!==o||m.contains(e.ownerDocument,e)||(o=m.style(e,t)),i&&!p.pixelMarginRight()&&Te.test(o)&&Se.test(t)&&(a=s.width,n=s.minWidth,r=s.maxWidth,s.minWidth=s.maxWidth=s.width=o,o=i.width,s.width=a,s.minWidth=n,s.maxWidth=r),void 0!==o?o+"":o}function Pe(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){var e,t,a,n,r=o.createElement("div"),s=o.createElement("div");function u(){s.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",s.innerHTML="",Le.appendChild(r);var o=i.getComputedStyle(s);e="1%"!==o.top,n="2px"===o.marginLeft,t="4px"===o.width,s.style.marginRight="50%",a="4px"===o.marginRight,Le.removeChild(r)}s.style&&(s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",p.clearCloneStyle="content-box"===s.style.backgroundClip,r.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",r.appendChild(s),m.extend(p,{pixelPosition:function(){return u(),e},boxSizingReliable:function(){return null==t&&u(),t},pixelMarginRight:function(){return null==t&&u(),a},reliableMarginLeft:function(){return null==t&&u(),n},reliableMarginRight:function(){var e,t=s.appendChild(o.createElement("div"));return t.style.cssText=s.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",s.style.width="1px",Le.appendChild(r),e=!parseFloat(i.getComputedStyle(t).marginRight),Le.removeChild(r),s.removeChild(t),e}}))}();var Oe=/^(none|table(?!-c[ea]).+)/,Re={position:"absolute",visibility:"hidden",display:"block"},De={letterSpacing:"0",fontWeight:"400"},Ne=["Webkit","O","Moz","ms"],Fe=o.createElement("div").style;function je(e){if(e in Fe)return e;for(var t=e[0].toUpperCase()+e.slice(1),i=Ne.length;i--;)if((e=Ne[i]+t)in Fe)return e}function Be(e,t,i){var a=V.exec(t);return a?Math.max(0,a[2]-(i||0))+(a[3]||"px"):t}function ze(e,t,i,a,n){for(var r=i===(a?"border":"content")?4:"width"===t?1:0,o=0;r<4;r+=2)"margin"===i&&(o+=m.css(e,i+W[r],!0,n)),a?("content"===i&&(o-=m.css(e,"padding"+W[r],!0,n)),"margin"!==i&&(o-=m.css(e,"border"+W[r]+"Width",!0,n))):(o+=m.css(e,"padding"+W[r],!0,n),"padding"!==i&&(o+=m.css(e,"border"+W[r]+"Width",!0,n)));return o}function Ue(e,t,i){var a=!0,n="width"===t?e.offsetWidth:e.offsetHeight,r=Ae(e),o="border-box"===m.css(e,"boxSizing",!1,r);if(n<=0||null==n){if(((n=Ie(e,t,r))<0||null==n)&&(n=e.style[t]),Te.test(n))return n;a=o&&(p.boxSizingReliable()||n===e.style[t]),n=parseFloat(n)||0}return n+ze(e,t,i||(o?"border":"content"),a,r)+"px"}function He(e,t){for(var i,a,n,r=[],o=0,s=e.length;o1)},show:function(){return He(this,!0)},hide:function(){return He(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){q(this)?m(this).show():m(this).hide()})}}),m.Tween=Ye,Ye.prototype={constructor:Ye,init:function(e,t,i,a,n,r){this.elem=e,this.prop=i,this.easing=n||m.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=a,this.unit=r||(m.cssNumber[i]?"":"px")},cur:function(){var e=Ye.propHooks[this.prop];return e&&e.get?e.get(this):Ye.propHooks._default.get(this)},run:function(e){var t,i=Ye.propHooks[this.prop];return this.options.duration?this.pos=t=m.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):Ye.propHooks._default.set(this),this}},Ye.prototype.init.prototype=Ye.prototype,Ye.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=m.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){m.fx.step[e.prop]?m.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[m.cssProps[e.prop]]&&!m.cssHooks[e.prop]?e.elem[e.prop]=e.now:m.style(e.elem,e.prop,e.now+e.unit)}}},Ye.propHooks.scrollTop=Ye.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},m.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},m.fx=Ye.prototype.init,m.fx.step={};var Ge,Ve,We=/^(?:toggle|show|hide)$/,qe=/queueHooks$/;function Xe(){return i.setTimeout(function(){Ge=void 0}),Ge=m.now()}function Ke(e,t){var i,a=0,n={height:e};for(t=t?1:0;a<4;a+=2-t)n["margin"+(i=W[a])]=n["padding"+i]=e;return t&&(n.opacity=n.width=e),n}function Ze(e,t,i){for(var a,n=(Qe.tweeners[t]||[]).concat(Qe.tweeners["*"]),r=0,o=n.length;r1)},removeAttr:function(e){return this.each(function(){m.removeAttr(this,e)})}}),m.extend({attr:function(e,t,i){var a,n,r=e.nodeType;if(3!==r&&8!==r&&2!==r)return void 0===e.getAttribute?m.prop(e,t,i):(1===r&&m.isXMLDoc(e)||(t=t.toLowerCase(),n=m.attrHooks[t]||(m.expr.match.bool.test(t)?Je:void 0)),void 0!==i?null===i?void m.removeAttr(e,t):n&&"set"in n&&void 0!==(a=n.set(e,i,t))?a:(e.setAttribute(t,i+""),i):n&&"get"in n&&null!==(a=n.get(e,t))?a:null==(a=m.find.attr(e,t))?void 0:a)},attrHooks:{type:{set:function(e,t){if(!p.radioValue&&"radio"===t&&m.nodeName(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}}},removeAttr:function(e,t){var i,a,n=0,r=t&&t.match(R);if(r&&1===e.nodeType)for(;i=r[n++];)a=m.propFix[i]||i,m.expr.match.bool.test(i)&&(e[a]=!1),e.removeAttribute(i)}}),Je={set:function(e,t,i){return!1===t?m.removeAttr(e,i):e.setAttribute(i,i),i}},m.each(m.expr.match.bool.source.match(/\w+/g),function(e,t){var i=$e[t]||m.find.attr;$e[t]=function(e,t,a){var n,r;return a||(r=$e[t],$e[t]=n,n=null!=i(e,t,a)?t.toLowerCase():null,$e[t]=r),n}});var et=/^(?:input|select|textarea|button)$/i,tt=/^(?:a|area)$/i;m.fn.extend({prop:function(e,t){return N(this,m.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[m.propFix[e]||e]})}}),m.extend({prop:function(e,t,i){var a,n,r=e.nodeType;if(3!==r&&8!==r&&2!==r)return 1===r&&m.isXMLDoc(e)||(t=m.propFix[t]||t,n=m.propHooks[t]),void 0!==i?n&&"set"in n&&void 0!==(a=n.set(e,i,t))?a:e[t]=i:n&&"get"in n&&null!==(a=n.get(e,t))?a:e[t]},propHooks:{tabIndex:{get:function(e){var t=m.find.attr(e,"tabindex");return t?parseInt(t,10):et.test(e.nodeName)||tt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),p.optSelected||(m.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this});var it=/[\t\r\n\f]/g;function at(e){return e.getAttribute&&e.getAttribute("class")||""}m.fn.extend({addClass:function(e){var t,i,a,n,r,o,s,u=0;if(m.isFunction(e))return this.each(function(t){m(this).addClass(e.call(this,t,at(this)))});if("string"==typeof e&&e)for(t=e.match(R)||[];i=this[u++];)if(n=at(i),a=1===i.nodeType&&(" "+n+" ").replace(it," ")){for(o=0;r=t[o++];)a.indexOf(" "+r+" ")<0&&(a+=r+" ");n!==(s=m.trim(a))&&i.setAttribute("class",s)}return this},removeClass:function(e){var t,i,a,n,r,o,s,u=0;if(m.isFunction(e))return this.each(function(t){m(this).removeClass(e.call(this,t,at(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(R)||[];i=this[u++];)if(n=at(i),a=1===i.nodeType&&(" "+n+" ").replace(it," ")){for(o=0;r=t[o++];)for(;a.indexOf(" "+r+" ")>-1;)a=a.replace(" "+r+" "," ");n!==(s=m.trim(a))&&i.setAttribute("class",s)}return this},toggleClass:function(e,t){var i=typeof e;return"boolean"==typeof t&&"string"===i?t?this.addClass(e):this.removeClass(e):m.isFunction(e)?this.each(function(i){m(this).toggleClass(e.call(this,i,at(this),t),t)}):this.each(function(){var t,a,n,r;if("string"===i)for(a=0,n=m(this),r=e.match(R)||[];t=r[a++];)n.hasClass(t)?n.removeClass(t):n.addClass(t);else void 0!==e&&"boolean"!==i||((t=at(this))&&B.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":B.get(this,"__className__")||""))})},hasClass:function(e){var t,i,a=0;for(t=" "+e+" ";i=this[a++];)if(1===i.nodeType&&(" "+at(i)+" ").replace(it," ").indexOf(t)>-1)return!0;return!1}});var nt=/\r/g,rt=/[\x20\t\r\n\f]+/g;m.fn.extend({val:function(e){var t,i,a,n=this[0];return arguments.length?(a=m.isFunction(e),this.each(function(i){var n;1===this.nodeType&&(null==(n=a?e.call(this,i,m(this).val()):e)?n="":"number"==typeof n?n+="":m.isArray(n)&&(n=m.map(n,function(e){return null==e?"":e+""})),(t=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,n,"value")||(this.value=n))})):n?(t=m.valHooks[n.type]||m.valHooks[n.nodeName.toLowerCase()])&&"get"in t&&void 0!==(i=t.get(n,"value"))?i:"string"==typeof(i=n.value)?i.replace(nt,""):null==i?"":i:void 0}}),m.extend({valHooks:{option:{get:function(e){var t=m.find.attr(e,"value");return null!=t?t:m.trim(m.text(e)).replace(rt," ")}},select:{get:function(e){for(var t,i,a=e.options,n=e.selectedIndex,r="select-one"===e.type||n<0,o=r?null:[],s=r?n+1:a.length,u=n<0?s:r?n:0;u-1)&&(i=!0);return i||(e.selectedIndex=-1),r}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(e,t){if(m.isArray(t))return e.checked=m.inArray(m(e).val(),t)>-1}},p.checkOn||(m.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var ot=/^(?:focusinfocus|focusoutblur)$/;m.extend(m.event,{trigger:function(e,t,a,n){var r,s,u,f,l,c,h,p=[a||o],v=d.call(e,"type")?e.type:e,b=d.call(e,"namespace")?e.namespace.split("."):[];if(s=u=a=a||o,3!==a.nodeType&&8!==a.nodeType&&!ot.test(v+m.event.triggered)&&(v.indexOf(".")>-1&&(v=(b=v.split(".")).shift(),b.sort()),l=v.indexOf(":")<0&&"on"+v,(e=e[m.expando]?e:new m.Event(v,"object"==typeof e&&e)).isTrigger=n?2:3,e.namespace=b.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=a),t=null==t?[e]:m.makeArray(t,[e]),h=m.event.special[v]||{},n||!h.trigger||!1!==h.trigger.apply(a,t))){if(!n&&!h.noBubble&&!m.isWindow(a)){for(f=h.delegateType||v,ot.test(f+v)||(s=s.parentNode);s;s=s.parentNode)p.push(s),u=s;u===(a.ownerDocument||o)&&p.push(u.defaultView||u.parentWindow||i)}for(r=0;(s=p[r++])&&!e.isPropagationStopped();)e.type=r>1?f:h.bindType||v,(c=(B.get(s,"events")||{})[e.type]&&B.get(s,"handle"))&&c.apply(s,t),(c=l&&s[l])&&c.apply&&F(s)&&(e.result=c.apply(s,t),!1===e.result&&e.preventDefault());return e.type=v,n||e.isDefaultPrevented()||h._default&&!1!==h._default.apply(p.pop(),t)||!F(a)||l&&m.isFunction(a[v])&&!m.isWindow(a)&&((u=a[l])&&(a[l]=null),m.event.triggered=v,a[v](),m.event.triggered=void 0,u&&(a[l]=u)),e.result}},simulate:function(e,t,i){var a=m.extend(new m.Event,i,{type:e,isSimulated:!0});m.event.trigger(a,null,t)}}),m.fn.extend({trigger:function(e,t){return this.each(function(){m.event.trigger(e,t,this)})},triggerHandler:function(e,t){var i=this[0];if(i)return m.event.trigger(e,t,i,!0)}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){m.fn[t]=function(e,i){return arguments.length>0?this.on(t,null,e,i):this.trigger(t)}}),m.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),p.focusin="onfocusin"in i,p.focusin||m.each({focus:"focusin",blur:"focusout"},function(e,t){var i=function(e){m.event.simulate(t,e.target,m.event.fix(e))};m.event.special[t]={setup:function(){var a=this.ownerDocument||this,n=B.access(a,t);n||a.addEventListener(e,i,!0),B.access(a,t,(n||0)+1)},teardown:function(){var a=this.ownerDocument||this,n=B.access(a,t)-1;n?B.access(a,t,n):(a.removeEventListener(e,i,!0),B.remove(a,t))}}});var st=i.location,ut=m.now(),ft=/\?/;m.parseJSON=function(e){return JSON.parse(e+"")},m.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new i.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+e),t};var lt=/#.*$/,ct=/([?&])_=[^&]*/,ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,dt=/^(?:GET|HEAD)$/,pt=/^\/\//,mt={},vt={},bt="*/".concat("*"),gt=o.createElement("a");function yt(e){return function(t,i){"string"!=typeof t&&(i=t,t="*");var a,n=0,r=t.toLowerCase().match(R)||[];if(m.isFunction(i))for(;a=r[n++];)"+"===a[0]?(a=a.slice(1)||"*",(e[a]=e[a]||[]).unshift(i)):(e[a]=e[a]||[]).push(i)}}function wt(e,t,i,a){var n={},r=e===vt;function o(s){var u;return n[s]=!0,m.each(e[s]||[],function(e,s){var f=s(t,i,a);return"string"!=typeof f||r||n[f]?r?!(u=f):void 0:(t.dataTypes.unshift(f),o(f),!1)}),u}return o(t.dataTypes[0])||!n["*"]&&o("*")}function _t(e,t){var i,a,n=m.ajaxSettings.flatOptions||{};for(i in t)void 0!==t[i]&&((n[i]?e:a||(a={}))[i]=t[i]);return a&&m.extend(!0,e,a),e}gt.href=st.href,m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:st.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(st.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":bt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_t(_t(e,m.ajaxSettings),t):_t(m.ajaxSettings,e)},ajaxPrefilter:yt(mt),ajaxTransport:yt(vt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var a,n,r,s,u,f,l,c,h=m.ajaxSetup({},t),d=h.context||h,p=h.context&&(d.nodeType||d.jquery)?m(d):m.event,v=m.Deferred(),b=m.Callbacks("once memory"),g=h.statusCode||{},y={},w={},_=0,x="canceled",k={readyState:0,getResponseHeader:function(e){var t;if(2===_){if(!s)for(s={};t=ht.exec(r);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===_?r:null},setRequestHeader:function(e,t){var i=e.toLowerCase();return _||(e=w[i]=w[i]||e,y[e]=t),this},overrideMimeType:function(e){return _||(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(_<2)for(t in e)g[t]=[g[t],e[t]];else k.always(e[k.status]);return this},abort:function(e){var t=e||x;return a&&a.abort(t),E(0,t),this}};if(v.promise(k).complete=b.add,k.success=k.done,k.error=k.fail,h.url=((e||h.url||st.href)+"").replace(lt,"").replace(pt,st.protocol+"//"),h.type=t.method||t.type||h.method||h.type,h.dataTypes=m.trim(h.dataType||"*").toLowerCase().match(R)||[""],null==h.crossDomain){f=o.createElement("a");try{f.href=h.url,f.href=f.href,h.crossDomain=gt.protocol+"//"+gt.host!=f.protocol+"//"+f.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=m.param(h.data,h.traditional)),wt(mt,h,t,k),2===_)return k;for(c in(l=m.event&&h.global)&&0==m.active++&&m.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!dt.test(h.type),n=h.url,h.hasContent||(h.data&&(n=h.url+=(ft.test(n)?"&":"?")+h.data,delete h.data),!1===h.cache&&(h.url=ct.test(n)?n.replace(ct,"$1_="+ut++):n+(ft.test(n)?"&":"?")+"_="+ut++)),h.ifModified&&(m.lastModified[n]&&k.setRequestHeader("If-Modified-Since",m.lastModified[n]),m.etag[n]&&k.setRequestHeader("If-None-Match",m.etag[n])),(h.data&&h.hasContent&&!1!==h.contentType||t.contentType)&&k.setRequestHeader("Content-Type",h.contentType),k.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+bt+"; q=0.01":""):h.accepts["*"]),h.headers)k.setRequestHeader(c,h.headers[c]);if(h.beforeSend&&(!1===h.beforeSend.call(d,k,h)||2===_))return k.abort();for(c in x="abort",{success:1,error:1,complete:1})k[c](h[c]);if(a=wt(vt,h,t,k)){if(k.readyState=1,l&&p.trigger("ajaxSend",[k,h]),2===_)return k;h.async&&h.timeout>0&&(u=i.setTimeout(function(){k.abort("timeout")},h.timeout));try{_=1,a.send(y,E)}catch(e){if(!(_<2))throw e;E(-1,e)}}else E(-1,"No Transport");function E(e,t,o,s){var f,c,y,w,x,E=t;2!==_&&(_=2,u&&i.clearTimeout(u),a=void 0,r=s||"",k.readyState=e>0?4:0,f=e>=200&&e<300||304===e,o&&(w=function(e,t,i){for(var a,n,r,o,s=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===a&&(a=e.mimeType||t.getResponseHeader("Content-Type"));if(a)for(n in s)if(s[n]&&s[n].test(a)){u.unshift(n);break}if(u[0]in i)r=u[0];else{for(n in i){if(!u[0]||e.converters[n+" "+u[0]]){r=n;break}o||(o=n)}r=r||o}if(r)return r!==u[0]&&u.unshift(r),i[r]}(h,k,o)),w=function(e,t,i,a){var n,r,o,s,u,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];for(r=l.shift();r;)if(e.responseFields[r]&&(i[e.responseFields[r]]=t),!u&&a&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=r,r=l.shift())if("*"===r)r=u;else if("*"!==u&&u!==r){if(!(o=f[u+" "+r]||f["* "+r]))for(n in f)if((s=n.split(" "))[1]===r&&(o=f[u+" "+s[0]]||f["* "+s[0]])){!0===o?o=f[n]:!0!==f[n]&&(r=s[0],l.unshift(s[1]));break}if(!0!==o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+u+" to "+r}}}return{state:"success",data:t}}(h,w,k,f),f?(h.ifModified&&((x=k.getResponseHeader("Last-Modified"))&&(m.lastModified[n]=x),(x=k.getResponseHeader("etag"))&&(m.etag[n]=x)),204===e||"HEAD"===h.type?E="nocontent":304===e?E="notmodified":(E=w.state,c=w.data,f=!(y=w.error))):(y=E,!e&&E||(E="error",e<0&&(e=0))),k.status=e,k.statusText=(t||E)+"",f?v.resolveWith(d,[c,E,k]):v.rejectWith(d,[k,E,y]),k.statusCode(g),g=void 0,l&&p.trigger(f?"ajaxSuccess":"ajaxError",[k,h,f?c:y]),b.fireWith(d,[k,E]),l&&(p.trigger("ajaxComplete",[k,h]),--m.active||m.event.trigger("ajaxStop")))}return k},getJSON:function(e,t,i){return m.get(e,t,i,"json")},getScript:function(e,t){return m.get(e,void 0,t,"script")}}),m.each(["get","post"],function(e,t){m[t]=function(e,i,a,n){return m.isFunction(i)&&(n=n||a,a=i,i=void 0),m.ajax(m.extend({url:e,type:t,dataType:n,data:i,success:a},m.isPlainObject(e)&&e))}}),m._evalUrl=function(e){return m.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},m.fn.extend({wrapAll:function(e){var t;return m.isFunction(e)?this.each(function(t){m(this).wrapAll(e.call(this,t))}):(this[0]&&(t=m(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return m.isFunction(e)?this.each(function(t){m(this).wrapInner(e.call(this,t))}):this.each(function(){var t=m(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=m.isFunction(e);return this.each(function(i){m(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(e){return!m.expr.filters.visible(e)},m.expr.filters.visible=function(e){return e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0};var xt=/%20/g,kt=/\[\]$/,Et=/\r?\n/g,Mt=/^(?:submit|button|image|reset|file)$/i,St=/^(?:input|select|textarea|keygen)/i;function Tt(e,t,i,a){var n;if(m.isArray(t))m.each(t,function(t,n){i||kt.test(e)?a(e,n):Tt(e+"["+("object"==typeof n&&null!=n?t:"")+"]",n,i,a)});else if(i||"object"!==m.type(t))a(e,t);else for(n in t)Tt(e+"["+n+"]",t[n],i,a)}m.param=function(e,t){var i,a=[],n=function(e,t){t=m.isFunction(t)?t():null==t?"":t,a[a.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(e)||e.jquery&&!m.isPlainObject(e))m.each(e,function(){n(this.name,this.value)});else for(i in e)Tt(i,e[i],t,n);return a.join("&").replace(xt,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=m.prop(this,"elements");return e?m.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!m(this).is(":disabled")&&St.test(this.nodeName)&&!Mt.test(e)&&(this.checked||!K.test(e))}).map(function(e,t){var i=m(this).val();return null==i?null:m.isArray(i)?m.map(i,function(e){return{name:t.name,value:e.replace(Et,"\r\n")}}):{name:t.name,value:i.replace(Et,"\r\n")}}).get()}}),m.ajaxSettings.xhr=function(){try{return new i.XMLHttpRequest}catch(e){}};var At={0:200,1223:204},Ct=m.ajaxSettings.xhr();p.cors=!!Ct&&"withCredentials"in Ct,p.ajax=Ct=!!Ct,m.ajaxTransport(function(e){var t,a;if(p.cors||Ct&&!e.crossDomain)return{send:function(n,r){var o,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)s[o]=e.xhrFields[o];for(o in e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest"),n)s.setRequestHeader(o,n[o]);t=function(e){return function(){t&&(t=a=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?r(0,"error"):r(s.status,s.statusText):r(At[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=t(),a=s.onerror=t("error"),void 0!==s.onabort?s.onabort=a:s.onreadystatechange=function(){4===s.readyState&&i.setTimeout(function(){t&&a()})},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}}),m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return m.globalEval(e),e}}}),m.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),m.ajaxTransport("script",function(e){var t,i;if(e.crossDomain)return{send:function(a,n){t=m("