diff --git a/.gitignore b/.gitignore index 178b0a2..74607b7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /public/blob/* !/public/blob/.gitkeep /node_modules +/public/js/dist diff --git a/public/js/dist/bundle.js b/public/js/dist/bundle.js deleted file mode 100644 index 9539a20..0000000 --- a/public/js/dist/bundle.js +++ /dev/null @@ -1,10 +0,0 @@ -!function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=23)}([function(t,e,i){"use strict";i.d(e,"j",(function(){return I})),i.d(e,"h",(function(){return N})),i.d(e,"f",(function(){return f})),i.d(e,"b",(function(){return g})),i.d(e,"g",(function(){return v})),i.d(e,"a",(function(){return _})),i.d(e,"d",(function(){return D})),i.d(e,"e",(function(){return B})),i.d(e,"k",(function(){return T})),i.d(e,"c",(function(){return O})),i.d(e,"i",(function(){return n}));var n,r,o,a,s,h,l={},c=[],u=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function d(t,e){for(var i in e)t[i]=e[i];return t}function p(t){var e=t.parentNode;e&&e.removeChild(t)}function f(t,e,i){var n,r=arguments,o={};for(n in e)"key"!==n&&"ref"!==n&&(o[n]=e[n]);if(arguments.length>3)for(i=[i],n=3;n2&&(e.children=c.slice.call(arguments,2)),m(t.type,e,e.key||t.key,e.ref||t.ref)}function B(t){var e={},i={__c:"__cC"+h++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,r=this;return this.getChildContext||(n=[],this.getChildContext=function(){return e[i.__c]=r,e},this.shouldComponentUpdate=function(e){t.value!==e.value&&n.some((function(t){t.context=e.value,b(t)}))},this.sub=function(t){n.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n.splice(n.indexOf(t),1),e&&e.call(t)}}),t.children}};return i.Consumer.contextType=i,i}n={__e:function(t,e){for(var i,n;e=e.__;)if((i=e.__c)&&!i.__)try{if(i.constructor&&null!=i.constructor.getDerivedStateFromError&&(n=!0,i.setState(i.constructor.getDerivedStateFromError(t))),null!=i.componentDidCatch&&(n=!0,i.componentDidCatch(t)),n)return b(i.__E=i)}catch(e){t=e}throw t}},_.prototype.setState=function(t,e){var i;i=this.__s!==this.state?this.__s:this.__s=d({},this.state),"function"==typeof t&&(t=t(i,this.props)),t&&d(i,t),null!=t&&this.__v&&(e&&this.__h.push(e),b(this))},_.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),b(this))},_.prototype.render=g,r=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,s=l,h=0},function(t,e,i){ -/* @preserve - * Leaflet 1.4.0, a JS library for interactive maps. http://leafletjs.com - * (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade - */ -!function(t){"use strict";var e=Object.freeze;function i(t){var e,i,n,r;for(i=1,n=arguments.length;i0?Math.floor(t):Math.ceil(t)};function I(t,e,i){return t instanceof O?t:g(t)?new O(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new O(t.x,t.y):new O(t,e,i)}function N(t,e){if(t)for(var i=e?[t,e]:t,n=0,r=i.length;n=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=D(t);var e=this.min,i=this.max,n=t.min,r=t.max,o=r.x>=e.x&&n.x<=i.x,a=r.y>=e.y&&n.y<=i.y;return o&&a},overlaps:function(t){t=D(t);var e=this.min,i=this.max,n=t.min,r=t.max,o=r.x>e.x&&n.xe.y&&n.y=n.lat&&i.lat<=r.lat&&e.lng>=n.lng&&i.lng<=r.lng},intersects:function(t){t=k(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),o=r.lat>=e.lat&&n.lat<=i.lat,a=r.lng>=e.lng&&n.lng<=i.lng;return o&&a},overlaps:function(t){t=k(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),o=r.lat>e.lat&&n.late.lng&&n.lng1,Et=!!document.createElement("canvas").getContext,Lt=!(!document.createElementNS||!Y("svg").createSVGRect),Pt=!Lt&&function(){try{var t=document.createElement("div");t.innerHTML='';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function At(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var Ct=(Object.freeze||Object)({ie:Q,ielt9:$,edge:tt,webkit:et,android:it,android23:nt,androidStock:ot,opera:at,chrome:st,gecko:ht,safari:lt,phantom:ct,opera12:ut,win:dt,ie3d:pt,webkit3d:ft,gecko3d:mt,any3d:vt,mobile:gt,mobileWebkit:_t,mobileWebkit3d:yt,msPointer:xt,pointer:bt,touch:wt,mobileOpera:Mt,mobileGecko:Tt,retina:St,canvas:Et,svg:Lt,vml:Pt}),Rt=xt?"MSPointerDown":"pointerdown",Ot=xt?"MSPointerMove":"pointermove",zt=xt?"MSPointerUp":"pointerup",It=xt?"MSPointerCancel":"pointercancel",Nt=["INPUT","SELECT","OPTION"],Dt={},Bt=!1,kt=0;function Ut(t,e,i,n){return"touchstart"===e?function(t,e,i){var n=r((function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Nt.indexOf(t.target.tagName)<0))return;De(t)}Gt(t,e)}));t["_leaflet_touchstart"+i]=n,t.addEventListener(Rt,n,!1),Bt||(document.documentElement.addEventListener(Rt,Ft,!0),document.documentElement.addEventListener(Ot,Ht,!0),document.documentElement.addEventListener(zt,jt,!0),document.documentElement.addEventListener(It,jt,!0),Bt=!0)}(t,i,n):"touchmove"===e?function(t,e,i){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Gt(t,e)};t["_leaflet_touchmove"+i]=n,t.addEventListener(Ot,n,!1)}(t,i,n):"touchend"===e&&function(t,e,i){var n=function(t){Gt(t,e)};t["_leaflet_touchend"+i]=n,t.addEventListener(zt,n,!1),t.addEventListener(It,n,!1)}(t,i,n),this}function Ft(t){Dt[t.pointerId]=t,kt++}function Ht(t){Dt[t.pointerId]&&(Dt[t.pointerId]=t)}function jt(t){delete Dt[t.pointerId],kt--}function Gt(t,e){for(var i in t.touches=[],Dt)t.touches.push(Dt[i]);t.changedTouches=[t],e(t)}var Vt=xt?"MSPointerDown":bt?"pointerdown":"touchstart",Wt=xt?"MSPointerUp":bt?"pointerup":"touchend",Zt="_leaflet_";function qt(t,e,i){var n,r,o=!1;function a(t){var e;if(bt){if(!tt||"mouse"===t.pointerType)return;e=kt}else e=t.touches.length;if(!(e>1)){var i=Date.now(),a=i-(n||i);r=t.touches?t.touches[0]:t,o=a>0&&a<=250,n=i}}function s(t){if(o&&!r.cancelBubble){if(bt){if(!tt||"mouse"===t.pointerType)return;var i,a,s={};for(a in r)i=r[a],s[a]=i&&i.bind?i.bind(r):i;r=s}r.type="dblclick",e(r),n=null}}return t[Zt+Vt+i]=a,t[Zt+Wt+i]=s,t[Zt+"dblclick"+i]=e,t.addEventListener(Vt,a,!1),t.addEventListener(Wt,s,!1),t.addEventListener("dblclick",e,!1),this}function Xt(t,e){var i=t[Zt+Vt+e],n=t[Zt+Wt+e],r=t[Zt+"dblclick"+e];return t.removeEventListener(Vt,i,!1),t.removeEventListener(Wt,n,!1),tt||t.removeEventListener("dblclick",r,!1),this}var Yt,Jt,Kt,Qt,$t,te=ve(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ee=ve(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ie="webkitTransition"===ee||"OTransition"===ee?ee+"End":"transitionend";function ne(t){return"string"==typeof t?document.getElementById(t):t}function re(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||"auto"===i)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return"auto"===i?null:i}function oe(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function ae(t){var e=t.parentNode;e&&e.removeChild(t)}function se(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function he(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function le(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ce(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=fe(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function ue(t,e){if(void 0!==t.classList)for(var i=d(e),n=0,r=i.length;n100&&n<500||t.target._simulatedClick&&!t._simulated?Be(t):(He=i,e(t))}(t,s)}),t.addEventListener(e,o,!1)):"attachEvent"in t&&t.attachEvent("on"+e,o):qt(t,o,r),t[Ae]=t[Ae]||{},t[Ae][r]=o}function Oe(t,e,i,n){var r=e+a(i)+(n?"_"+a(n):""),o=t[Ae]&&t[Ae][r];if(!o)return this;bt&&0===e.indexOf("touch")?function(t,e,i){var n=t["_leaflet_"+e+i];"touchstart"===e?t.removeEventListener(Rt,n,!1):"touchmove"===e?t.removeEventListener(Ot,n,!1):"touchend"===e&&(t.removeEventListener(zt,n,!1),t.removeEventListener(It,n,!1))}(t,e,r):!wt||"dblclick"!==e||!Xt||bt&&st?"removeEventListener"in t?"mousewheel"===e?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",o,!1):t.removeEventListener("mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,o,!1):"detachEvent"in t&&t.detachEvent("on"+e,o):Xt(t,r),t[Ae][r]=null}function ze(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Ve(t),this}function Ie(t){return Re(t,"mousewheel",ze),this}function Ne(t){return Pe(t,"mousedown touchstart dblclick",ze),Re(t,"click",Ge),this}function De(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Be(t){return De(t),ze(t),this}function ke(t,e){if(!e)return new O(t.clientX,t.clientY);var i=Ee(e),n=i.boundingClientRect;return new O((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var Ue=dt&&st?2*window.devicePixelRatio:ht?window.devicePixelRatio:1;function Fe(t){return tt?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/Ue:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var He,je={};function Ge(t){je[t.type]=!0}function Ve(t){var e=je[t.type];return je[t.type]=!1,e}function We(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}var Ze=(Object.freeze||Object)({on:Pe,off:Ce,stopPropagation:ze,disableScrollPropagation:Ie,disableClickPropagation:Ne,preventDefault:De,stop:Be,getMousePosition:ke,getWheelDelta:Fe,fakeStop:Ge,skipped:Ve,isExternalTarget:We,addListener:Pe,removeListener:Ce}),qe=R.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=ye(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=S(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=1e3*this._duration;ethis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,k(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=I((e=e||{}).paddingTopLeft||e.padding||[0,0]),n=I(e.paddingBottomRight||e.padding||[0,0]),r=this.getCenter(),o=this.project(r),a=this.project(t),s=this.getPixelBounds(),h=s.getSize().divideBy(2),l=D([s.min.add(i),s.max.subtract(n)]);if(!l.contains(a)){this._enforcingBounds=!0;var c=o.subtract(a),u=I(a.x+c.x,a.y+c.y);(a.xl.max.x)&&(u.x=o.x-c.x,c.x>0?u.x+=h.x-i.x:u.x-=h.x-n.x),(a.yl.max.y)&&(u.y=o.y-c.y,c.y>0?u.y+=h.y-i.y:u.y-=h.y-n.y),this.panTo(this.unproject(u),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=i({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var n=this.getSize(),o=e.divideBy(2).round(),a=n.divideBy(2).round(),s=o.subtract(a);return s.x||s.y?(t.animate&&t.pan?this.panBy(s):(t.pan&&this._rawPanBy(s),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:n})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=i({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=r(this._handleGeolocationResponse,this),n=r(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,n,t):navigator.geolocation.getCurrentPosition(e,n,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=new U(t.coords.latitude,t.coords.longitude),i=e.toBounds(2*t.coords.accuracy),n=this._locateOptions;if(n.setView){var r=this.getBoundsZoom(i);this.setView(e,n.maxZoom?Math.min(r,n.maxZoom):r)}var o={latlng:e,bounds:i,timestamp:t.timestamp};for(var a in t.coords)"number"==typeof t.coords[a]&&(o[a]=t.coords[a]);this.fire("locationfound",o)},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ae(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(E(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ae(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i=oe("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new B(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=k(t),i=I(i||[0,0]);var n=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),a=t.getNorthWest(),s=t.getSouthEast(),h=this.getSize().subtract(i),l=D(this.project(s,n),this.project(a,n)).getSize(),c=vt?this.options.zoomSnap:1,u=h.x/l.x,d=h.y/l.y,p=e?Math.max(u,d):Math.min(u,d);return n=this.getScaleZoom(p,n),c&&(n=Math.round(n/(c/100))*(c/100),n=e?Math.ceil(n/c)*c:Math.floor(n/c)*c),Math.max(r,Math.min(o,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new N(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=void 0===e?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(F(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(I(t),e)},layerPointToLatLng:function(t){var e=I(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(F(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(F(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(k(t))},distance:function(t,e){return this.options.crs.distance(F(t),F(e))},containerPointToLayerPoint:function(t){return I(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return I(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(I(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(F(t)))},mouseEventToContainerPoint:function(t){return ke(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=ne(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");Pe(e,"scroll",this._onScroll,this),this._containerId=a(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&vt,ue(t,"leaflet-container"+(wt?" leaflet-touch":"")+(St?" leaflet-retina":"")+($?" leaflet-oldie":"")+(lt?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=re(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),_e(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ue(t.markerPane,"leaflet-zoom-hide"),ue(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){_e(this._mapPane,new O(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var n=this._zoom!==e;this._moveStart(n,!1)._move(t,e)._moveEnd(n),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i){void 0===e&&(e=this._zoom);var n=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return E(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){_e(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[a(this._container)]=this;var e=t?Ce:Pe;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),vt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){E(this._resizeRequest),this._resizeRequest=S((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,n=[],r="mouseout"===e||"mouseover"===e,o=t.target||t.srcElement,s=!1;o;){if((i=this._targets[a(o)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(i)){s=!0;break}if(i&&i.listens(e,!0)){if(r&&!We(o,t))break;if(n.push(i),r)break}if(o===this._container)break;o=o.parentNode}return n.length||s||r||!We(o,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Ve(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e||Me(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,n){if("click"===t.type){var r=i({},t);r.type="preclick",this._fireDOMEvent(r,r.type,n)}if(!t._stopped&&(n=(n||[]).concat(this._findEventTargets(t,e))).length){var o=n[0];"contextmenu"===e&&o.listens(e,!0)&&De(t);var a={originalEvent:t};if("keypress"!==t.type){var s=o.getLatLng&&(!o._radius||o._radius<=10);a.containerPoint=s?this.latLngToContainerPoint(o.getLatLng()):this.mouseEventToContainerPoint(t),a.layerPoint=this.containerPointToLayerPoint(a.containerPoint),a.latlng=s?o.getLatLng():this.layerPointToLatLng(a.layerPoint)}for(var h=0;h0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),n=vt?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){de(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(i)||(this.panBy(i,e),0))},_createAnimProxy:function(){var t=this._proxy=oe("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=te,i=this._proxy.style[e];ge(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),i===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",(function(){var t=this.getCenter(),e=this.getZoom();ge(this._proxy,this.project(t,e),this.getZoomScale(e,1))}),this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ae(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),r=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==i.animate&&!this.getSize().contains(r)||(S((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ue(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&de(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),S((function(){this._moveEnd(!0)}),this))}}),Ye=A.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return ue(e,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e),this},remove:function(){return this._map?(ae(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),Je=function(t){return new Ye(t)};Xe.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=oe("div",e+"control-container",this._container);function n(n,r){var o=e+n+" "+e+r;t[n+r]=oe("div",o,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ae(this._controlCorners[t]);ae(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Ke=Ye.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(a(t.target)),i=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e,i=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=n):e=this._createRadioElement("leaflet-base-layers",n),this._layerControlInputs.push(e),e.layerId=a(t.layer),Pe(e,"click",this._onInputClick,this);var r=document.createElement("span");r.innerHTML=" "+t.name;var o=document.createElement("div");return i.appendChild(o),o.appendChild(e),o.appendChild(r),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,n=[],r=[];this._handlingClick=!0;for(var o=i.length-1;o>=0;o--)t=i[o],e=this._getLayer(t.layerId).layer,t.checked?n.push(e):t.checked||r.push(e);for(o=0;o=0;r--)t=i[r],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&ne.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),Qe=Ye.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=oe("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,r){var o=oe("a",i,n);return o.innerHTML=t,o.href="#",o.title=e,o.setAttribute("role","button"),o.setAttribute("aria-label",e),Ne(o),Pe(o,"click",Be),Pe(o,"click",r,this),Pe(o,"click",this._refocusOnMap,this),o},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";de(this._zoomInButton,e),de(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&ue(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&ue(this._zoomInButton,e)}});Xe.mergeOptions({zoomControl:!0}),Xe.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new Qe,this.addControl(this.zoomControl))}));var $e=Ye.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e=oe("div","leaflet-control-scale"),i=this.options;return this._addScales(i,"leaflet-control-scale-line",e),t.on(i.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=oe("div",e,i)),t.imperial&&(this._iScale=oe("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e,i,n,r=3.2808399*t;r>5280?(e=r/5280,i=this._getRoundNum(e),this._updateScale(this._iScale,i+" mi",i/e)):(n=this._getRoundNum(r),this._updateScale(this._iScale,n+" ft",n/r))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),ti=Ye.extend({options:{position:"bottomright",prefix:'Leaflet'},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=oe("div","leaflet-control-attribution"),Ne(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}}});Xe.mergeOptions({attributionControl:!0}),Xe.addInitHook((function(){this.options.attributionControl&&(new ti).addTo(this)})),Ye.Layers=Ke,Ye.Zoom=Qe,Ye.Scale=$e,Ye.Attribution=ti,Je.layers=function(t,e,i){return new Ke(t,e,i)},Je.zoom=function(t){return new Qe(t)},Je.scale=function(t){return new $e(t)},Je.attribution=function(t){return new ti(t)};var ei=A.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});ei.addTo=function(t,e){return t.addHandler(e,this),this};var ii,ni={Events:C},ri=wt?"touchstart mousedown":"mousedown",oi={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},ai={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},si=R.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){p(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(Pe(this._dragStartTarget,ri,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(si._dragging===this&&this.finishDrag(),Ce(this._dragStartTarget,ri,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!ce(this._element,"leaflet-zoom-anim")&&!(si._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(si._dragging=this,this._preventOutline&&Me(this._element),be(),Yt(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,i=Se(this._element);this._startPoint=new O(e.clientX,e.clientY),this._parentScale=Ee(i),Pe(document,ai[t.type],this._onMove,this),Pe(document,oi[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,i=new O(e.clientX,e.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)l&&(a=s,l=h);l>n&&(i[a]=1,t(e,i,n,r,a),t(e,i,n,a,o))}(t,n,e,0,i-1);var r,o=[];for(r=0;re&&(i.push(t[n]),r=n);var a,s,h,l;return re.max.x&&(i|=2),t.ye.max.y&&(i|=8),i}function pi(t,e,i,n){var r,o=e.x,a=e.y,s=i.x-o,h=i.y-a,l=s*s+h*h;return l>0&&((r=((t.x-o)*s+(t.y-a)*h)/l)>1?(o=i.x,a=i.y):r>0&&(o+=s*r,a+=h*r)),s=t.x-o,h=t.y-a,n?s*s+h*h:new O(o,a)}function fi(t){return!g(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function mi(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),fi(t)}var vi=(Object.freeze||Object)({simplify:hi,pointToSegmentDistance:li,closestPointOnSegment:function(t,e,i){return pi(t,e,i)},clipSegment:ci,_getEdgeIntersection:ui,_getBitCode:di,_sqClosestPointOnSegment:pi,isFlat:fi,_flat:mi});function gi(t,e,i){var n,r,o,a,s,h,l,c,u,d=[1,4,2,8];for(r=0,l=t.length;r1e-7;h++)e=o*Math.sin(s),e=Math.pow((1-e)/(1+e),o/2),s+=l=Math.PI/2-2*Math.atan(a*e)-s;return new U(s*i,t.x*i/n)}},bi=(Object.freeze||Object)({LonLat:yi,Mercator:xi,SphericalMercator:V}),wi=i({},G,{code:"EPSG:3395",projection:xi,transformation:function(){var t=.5/(Math.PI*xi.R);return Z(t,.5,-t,.5)}()}),Mi=i({},G,{code:"EPSG:4326",projection:yi,transformation:Z(1/180,1,-1/180,.5)}),Ti=i({},j,{projection:yi,transformation:Z(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});j.Earth=G,j.EPSG3395=wi,j.EPSG3857=q,j.EPSG900913=X,j.EPSG4326=Mi,j.Simple=Ti;var Si=R.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[a(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[a(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",(function(){e.off(i,this)}),this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});Xe.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=a(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=a(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&a(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){for(var e=0,i=(t=t?g(t)?t:[t]:[]).length;ethis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()e)return a=(n-e)/i,this._map.layerPointToLatLng([o.x-a*(o.x-r.x),o.y-a*(o.y-r.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=F(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new B,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return fi(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=fi(t),n=0,r=t.length;n=2&&e[0]instanceof U&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){Ni.prototype._setLatLngs.call(this,t),fi(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return fi(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new O(e,e);if(t=new N(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,r=0,o=this._rings.length;rt.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(l=!l);return l||Ni.prototype._containsPoint.call(this,t,!0)}}),Bi=Li.extend({initialize:function(t,e){p(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,r=g(t)?t:t.features;if(r){for(e=0,i=r.length;e0?n:[e.src]}else{g(this._url)||(this._url=[this._url]),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var a=0;ar?(e.height=r+"px",ue(t,"leaflet-popup-scrolled")):de(t,"leaflet-popup-scrolled"),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();_e(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(re(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,r=new O(this._containerLeft,-i-this._containerBottom);r._add(ye(this._container));var o=t.layerPointToContainerPoint(r),a=I(this.options.autoPanPadding),s=I(this.options.autoPanPaddingTopLeft||a),h=I(this.options.autoPanPaddingBottomRight||a),l=t.getSize(),c=0,u=0;o.x+n+h.x>l.x&&(c=o.x+n-l.x+h.x),o.x-c-s.x<0&&(c=o.x-s.x),o.y+i+h.y>l.y&&(u=o.y+i-l.y+h.y),o.y-u-s.y<0&&(u=o.y-s.y),(c||u)&&t.fire("autopanstart").panBy([c,u])}},_onCloseButtonClick:function(t){this._close(),Be(t)},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});Xe.mergeOptions({closePopupOnClick:!0}),Xe.include({openPopup:function(t,e,i){return t instanceof Ki||(t=new Ki(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Si.include({bindPopup:function(t,e){return t instanceof Ki?(p(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new Ki(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){if(t instanceof Si||(e=t,t=this),t instanceof Li)for(var i in this._layers){t=this._layers[i];break}return e||(e=t.getCenter?t.getCenter():t.getLatLng()),this._popup&&this._map&&(this._popup._source=t,this._popup.update(),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(Be(t),e instanceof Oi?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Qi=Ji.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){Ji.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){Ji.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=Ji.prototype.getEvents.call(this);return wt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=oe("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,i=this._container,n=e.latLngToContainerPoint(e.getCenter()),r=e.layerPointToContainerPoint(t),o=this.options.direction,a=i.offsetWidth,s=i.offsetHeight,h=I(this.options.offset),l=this._getAnchor();"top"===o?t=t.add(I(-a/2+h.x,-s+h.y+l.y,!0)):"bottom"===o?t=t.subtract(I(a/2-h.x,-h.y,!0)):"center"===o?t=t.subtract(I(a/2+h.x,s/2-l.y+h.y,!0)):"right"===o||"auto"===o&&r.xthis.options.maxZoom||in&&this._retainParent(r,o,a,n))},_retainChildren:function(t,e,i,n){for(var r=2*t;r<2*t+2;r++)for(var o=2*e;o<2*e+2;o++){var a=new O(r,o);a.z=i+1;var s=this._tileCoordsToKey(a),h=this._tiles[s];h&&h.active?h.retain=!0:(h&&h.loaded&&(h.retain=!0),i+1this.options.maxZoom||void 0!==this.options.minZoom&&r1)this._setView(t,i);else{for(var u=r.min.y;u<=r.max.y;u++)for(var d=r.min.x;d<=r.max.x;d++){var p=new O(d,u);if(p.z=this._tileZoom,this._isValidTile(p)){var f=this._tiles[this._tileCoordsToKey(p)];f?f.current=!0:a.push(p)}}if(a.sort((function(t,e){return t.distanceTo(o)-e.distanceTo(o)})),0!==a.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(d=0;di.max.x)||!e.wrapLat&&(t.yi.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return k(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),r=n.add(i);return[e.unproject(n,t.z),e.unproject(r,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new B(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new O(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(ae(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ue(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=l,t.onmousemove=l,$&&this.options.opacity<1&&me(t,this.options.opacity),it&&!nt&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&S(r(this._tileReady,this,t,null,o)),_e(o,i),this._tiles[n]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);(i=this._tiles[n])&&(i.loaded=+new Date,this._map._fadeAnimated?(me(i.el,0),E(this._fadeFrame),this._fadeFrame=S(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(ue(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),$||!this._map._fadeAnimated?S(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new O(this._wrapX?h(t.x,this._wrapX):t.x,this._wrapY?h(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new N(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),en=tn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=p(this,e)).detectRetina&&St&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),it||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return Pe(i,"load",r(this._tileOnLoad,this,e,i)),Pe(i,"error",r(this._tileOnError,this,e,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i.alt="",i.setAttribute("role","presentation"),i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:St?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var n=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=n),e["-y"]=n}return v(this._url,i(e,this.options))},_tileOnLoad:function(t,e){$?setTimeout(r(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=l,e.onerror=l,e.complete||(e.src=y,ae(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return ot||e.el.setAttribute("src",y),tn.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(this._map&&(!i||i.getAttribute("src")!==y))return tn.prototype._tileReady.call(this,t,e,i)}});function nn(t,e){return new en(t,e)}var rn=en.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var n=i({},this.defaultWmsParams);for(var r in e)r in this.options||(n[r]=e[r]);var o=(e=p(this,e)).detectRetina&&St?2:1,a=this.getTileSize();n.width=a.x*o,n.height=a.y*o,this.wmsParams=n},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,en.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=D(i.project(e[0]),i.project(e[1])),r=n.min,o=n.max,a=(this._wmsVersion>=1.3&&this._crs===Mi?[r.y,r.x,o.y,o.x]:[r.x,r.y,o.x,o.y]).join(","),s=en.prototype.getTileUrl.call(this,t);return s+f(this.wmsParams,s,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+a},setParams:function(t,e){return i(this.wmsParams,t),e||this.redraw(),this}});en.WMS=rn,nn.wms=function(t,e){return new rn(t,e)};var on=Si.extend({options:{padding:.1,tolerance:0},initialize:function(t){p(this,t),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ue(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),n=ye(this._container),r=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,e),a=this._map.project(t,e).subtract(o),s=r.multiplyBy(-i).add(n).add(r).subtract(a);vt?ge(this._container,s,i):_e(this._container,s)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new N(i,i.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),an=on.extend({getEvents:function(){var t=on.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){on.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");Pe(t,"mousemove",s(this._onMouseMove,32,this),this),Pe(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Pe(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){E(this._redrawRequest),delete this._ctx,ae(this._container),Ce(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){on.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=St?2:1;_e(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",St&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){on.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[a(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[a(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,i,n=t.options.dashArray.split(/[, ]+/),r=[];for(i=0;i')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),ln={_initContainer:function(){this._container=oe("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(on.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=hn("shape");ue(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=hn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ae(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,r=t._container;r.stroked=!!n.stroke,r.filled=!!n.fill,n.stroke?(e||(e=t._stroke=hn("stroke")),r.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=g(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(r.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=hn("fill")),r.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(r.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){he(t._container)},_bringToBack:function(t){le(t._container)}},cn=Pt?hn:Y,un=on.extend({getEvents:function(){var t=on.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=cn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=cn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ae(this._container),Ce(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){on.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),_e(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=cn("path");t.options.className&&ue(e,t.options.className),t.options.interactive&&ue(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ae(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,J(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",r=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+n+2*i+",0 "+n+2*-i+",0 ";this._setPath(t,r)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){he(t._path)},_bringToBack:function(t){le(t._path)}});function dn(t){return Lt||Pt?new un(t):null}Pt&&un.include(ln),Xe.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&sn(t)||dn(t)}});var pn=Di.extend({initialize:function(t,e){Di.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=k(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});un.create=cn,un.pointsToPath=J,Bi.geometryToLayer=ki,Bi.coordsToLatLng=Ui,Bi.coordsToLatLngs=Fi,Bi.latLngToCoords=Hi,Bi.latLngsToCoords=ji,Bi.getFeature=Gi,Bi.asFeature=Vi,Xe.mergeOptions({boxZoom:!0});var fn=ei.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Pe(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Ce(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ae(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),Yt(),be(),this._startPoint=this._map.mouseEventToContainerPoint(t),Pe(document,{contextmenu:Be,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=oe("div","leaflet-zoom-box",this._container),ue(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new N(this._point,this._startPoint),i=e.getSize();_e(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(ae(this._box),de(this._container,"leaflet-crosshair")),Jt(),we(),Ce(document,{contextmenu:Be,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0);var e=new B(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});Xe.addInitHook("addHandler","boxZoom",fn),Xe.mergeOptions({doubleClickZoom:!0});var mn=ei.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,r=t.originalEvent.shiftKey?i-n:i+n;"center"===e.options.doubleClickZoom?e.setZoom(r):e.setZoomAround(t.containerPoint,r)}});Xe.addInitHook("addHandler","doubleClickZoom",mn),Xe.mergeOptions({dragging:!0,inertia:!nt,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var vn=ei.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new si(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ue(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){de(this._map._container,"leaflet-grab"),de(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=k(this._map.options.maxBounds);this._offsetLimit=D(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.xe.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,r=(n-e+i)%t+e-i,o=(n+e+i)%t-e-i,a=Math.abs(r+i)0?o:-o))-e;this._delta=0,this._startTime=null,a&&("center"===t.options.scrollWheelZoom?t.setZoom(e+a):t.setZoomAround(this._lastMousePos,e+a))}});Xe.addInitHook("addHandler","scrollWheelZoom",_n),Xe.mergeOptions({tap:!0,tapTolerance:15});var yn=ei.extend({addHooks:function(){Pe(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Ce(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(De(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],i=e.target;this._startPos=this._newPos=new O(e.clientX,e.clientY),i.tagName&&"a"===i.tagName.toLowerCase()&&ue(i,"leaflet-active"),this._holdTimeout=setTimeout(r((function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))}),this),1e3),this._simulateEvent("mousedown",e),Pe(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),Ce(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],i=e.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&de(i,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new O(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var i=document.createEvent("MouseEvents");i._simulated=!0,e.target._simulatedClick=!0,i.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(i)}});wt&&!bt&&Xe.addInitHook("addHandler","tap",yn),Xe.mergeOptions({touchZoom:wt&&!nt,bounceAtZoomLimits:!0});var xn=ei.extend({addHooks:function(){ue(this._map._container,"leaflet-touch-zoom"),Pe(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){de(this._map._container,"leaflet-touch-zoom"),Ce(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),Pe(document,"touchmove",this._onTouchMove,this),Pe(document,"touchend",this._onTouchEnd,this),De(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),o=i.distanceTo(n)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoome.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===o)return}else{var a=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(1===o&&0===a.x&&0===a.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(a),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),E(this._animRequest);var s=r(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=S(s,this,!0),De(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,E(this._animRequest),Ce(document,"touchmove",this._onTouchMove),Ce(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});Xe.addInitHook("addHandler","touchZoom",xn),Xe.BoxZoom=fn,Xe.DoubleClickZoom=mn,Xe.Drag=vn,Xe.Keyboard=gn,Xe.ScrollWheelZoom=_n,Xe.Tap=yn,Xe.TouchZoom=xn,Object.freeze=e,t.version="1.4.0",t.Control=Ye,t.control=Je,t.Browser=Ct,t.Evented=R,t.Mixin=ni,t.Util=P,t.Class=A,t.Handler=ei,t.extend=i,t.bind=r,t.stamp=a,t.setOptions=p,t.DomEvent=Ze,t.DomUtil=Le,t.PosAnimation=qe,t.Draggable=si,t.LineUtil=vi,t.PolyUtil=_i,t.Point=O,t.point=I,t.Bounds=N,t.bounds=D,t.Transformation=W,t.transformation=Z,t.Projection=bi,t.LatLng=U,t.latLng=F,t.LatLngBounds=B,t.latLngBounds=k,t.CRS=j,t.GeoJSON=Bi,t.geoJSON=Zi,t.geoJson=qi,t.Layer=Si,t.LayerGroup=Ei,t.layerGroup=function(t,e){return new Ei(t,e)},t.FeatureGroup=Li,t.featureGroup=function(t){return new Li(t)},t.ImageOverlay=Xi,t.imageOverlay=function(t,e,i){return new Xi(t,e,i)},t.VideoOverlay=Yi,t.videoOverlay=function(t,e,i){return new Yi(t,e,i)},t.DivOverlay=Ji,t.Popup=Ki,t.popup=function(t,e){return new Ki(t,e)},t.Tooltip=Qi,t.tooltip=function(t,e){return new Qi(t,e)},t.Icon=Pi,t.icon=function(t){return new Pi(t)},t.DivIcon=$i,t.divIcon=function(t){return new $i(t)},t.Marker=Ri,t.marker=function(t,e){return new Ri(t,e)},t.TileLayer=en,t.tileLayer=nn,t.GridLayer=tn,t.gridLayer=function(t){return new tn(t)},t.SVG=un,t.svg=dn,t.Renderer=on,t.Canvas=an,t.canvas=sn,t.Path=Oi,t.CircleMarker=zi,t.circleMarker=function(t,e){return new zi(t,e)},t.Circle=Ii,t.circle=function(t,e,i){return new Ii(t,e,i)},t.Polyline=Ni,t.polyline=function(t,e){return new Ni(t,e)},t.Polygon=Di,t.polygon=function(t,e){return new Di(t,e)},t.Rectangle=pn,t.rectangle=function(t,e){return new pn(t,e)},t.Map=Xe,t.map=function(t,e){return new Xe(t,e)};var bn=window.L;t.noConflict=function(){return window.L=bn,this},window.L=t}(e)},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function i(t,e){for(var i=0;i>t/4).toString(16)}))}var a=["#fc5c65","#fd9644","#fed330","#26de81","#2bcbba","#eb3b5a","#fa8231","#f7b731","#20bf6b","#0fb9b1","#45aaf2","#4b7bec","#a55eea","#d1d8e0","#778ca3","#2d98da","#3867d6","#8854d0","#a5b1c2","#4b6584"];function s(t){var e=t.split("").map((function(t){return t.charCodeAt(0)-97})).reduce((function(t,e){return t+e}));return a[e%a.length]}},function(t,e,i){var n=i(24),r=i(11);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?r(t):e}},function(t,e){function i(e){return t.exports=i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},i(e)}t.exports=i},function(t,e,i){var n=i(18);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},function(t,e,i){var n=i(25),r=i(26),o=i(27);t.exports=function(t,e){return n(t)||r(t,e)||o()}},function(t,e,i){"use strict";i.r(e);var n,r,o,a=i(0),s=[],h=a.i.__r,l=a.i.diffed,c=a.i.__c,u=a.i.unmount;function d(t){a.i.__h&&a.i.__h(r);var e=r.__H||(r.__H={__:[],__h:[]});return t>=e.__.length&&e.__.push({}),e.__[t]}function p(t){return f(P,t)}function f(t,e,i){var o=d(n++);return o.__c||(o.__c=r,o.__=[i?i(e):P(void 0,e),function(e){var i=t(o.__[0],e);o.__[0]!==i&&(o.__[0]=i,o.__c.setState({}))}]),o.__}function m(t,e){var i=d(n++);L(i.__H,e)&&(i.__=t,i.__H=e,r.__H.__h.push(i))}function v(t,e){var i=d(n++);L(i.__H,e)&&(i.__=t,i.__H=e,r.__h.push(i))}function g(t){return y((function(){return{current:t}}),[])}function _(t,e,i){v((function(){"function"==typeof t?t(e()):t&&(t.current=e())}),null==i?i:i.concat(t))}function y(t,e){var i=d(n++);return L(i.__H,e)?(i.__H=e,i.__h=t,i.__=t()):i.__}function x(t,e){return y((function(){return t}),e)}function b(t){var e=r.context[t.__c];if(!e)return t.__;var i=d(n++);return null==i.__&&(i.__=!0,e.sub(r)),e.props.value}function w(t,e){a.i.useDebugValue&&a.i.useDebugValue(e?e(t):t)}function M(t){var e=d(n++),i=p();return e.__=t,r.componentDidCatch||(r.componentDidCatch=function(t){e.__&&e.__(t),i[1](t)}),[i[0],function(){i[1](void 0)}]}function T(){s.some((function(t){if(t.__P)try{t.__H.__h.forEach(S),t.__H.__h.forEach(E),t.__H.__h=[]}catch(e){return a.i.__e(e,t.__v),!0}})),s=[]}function S(t){t.t&&t.t()}function E(t){var e=t.__();"function"==typeof e&&(t.t=e)}function L(t,e){return!t||e.some((function(e,i){return e!==t[i]}))}function P(t,e){return"function"==typeof e?e(t):e}function A(t,e){for(var i in e)t[i]=e[i];return t}function C(t,e){for(var i in t)if("__source"!==i&&!(i in e))return!0;for(var n in e)if("__source"!==n&&t[n]!==e[n])return!0;return!1}a.i.__r=function(t){h&&h(t),n=0,(r=t.__c).__H&&(r.__H.__h.forEach(S),r.__H.__h.forEach(E),r.__H.__h=[])},a.i.diffed=function(t){l&&l(t);var e=t.__c;if(e){var i=e.__H;i&&i.__h.length&&(1!==s.push(e)&&o===a.i.requestAnimationFrame||((o=a.i.requestAnimationFrame)||function(t){var e,i=function(){clearTimeout(n),cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,100);"undefined"!=typeof window&&(e=requestAnimationFrame(i))})(T))}},a.i.__c=function(t,e){e.some((function(t){try{t.__h.forEach(S),t.__h=t.__h.filter((function(t){return!t.__||E(t)}))}catch(i){e.some((function(t){t.__h&&(t.__h=[])})),e=[],a.i.__e(i,t.__v)}})),c&&c(t,e)},a.i.unmount=function(t){u&&u(t);var e=t.__c;if(e){var i=e.__H;if(i)try{i.__.forEach((function(t){return t.t&&t.t()}))}catch(t){a.i.__e(t,e.__v)}}},i.d(e,"version",(function(){return et})),i.d(e,"Children",(function(){return D})),i.d(e,"render",(function(){return Y})),i.d(e,"hydrate",(function(){return J})),i.d(e,"unmountComponentAtNode",(function(){return ot})),i.d(e,"createPortal",(function(){return Z})),i.d(e,"createFactory",(function(){return it})),i.d(e,"cloneElement",(function(){return rt})),i.d(e,"isValidElement",(function(){return nt})),i.d(e,"findDOMNode",(function(){return at})),i.d(e,"PureComponent",(function(){return R})),i.d(e,"memo",(function(){return O})),i.d(e,"forwardRef",(function(){return I})),i.d(e,"unstable_batchedUpdates",(function(){return st})),i.d(e,"Suspense",(function(){return U})),i.d(e,"SuspenseList",(function(){return j})),i.d(e,"lazy",(function(){return H})),i.d(e,"useState",(function(){return p})),i.d(e,"useReducer",(function(){return f})),i.d(e,"useEffect",(function(){return m})),i.d(e,"useLayoutEffect",(function(){return v})),i.d(e,"useRef",(function(){return g})),i.d(e,"useImperativeHandle",(function(){return _})),i.d(e,"useMemo",(function(){return y})),i.d(e,"useCallback",(function(){return x})),i.d(e,"useContext",(function(){return b})),i.d(e,"useDebugValue",(function(){return w})),i.d(e,"useErrorBoundary",(function(){return M})),i.d(e,"createElement",(function(){return a.f})),i.d(e,"createContext",(function(){return a.e})),i.d(e,"createRef",(function(){return a.g})),i.d(e,"Fragment",(function(){return a.b})),i.d(e,"Component",(function(){return a.a}));var R=function(t){var e,i;function n(e){var i;return(i=t.call(this,e)||this).isPureReactComponent=!0,i}return i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,e.__proto__=i,n.prototype.shouldComponentUpdate=function(t,e){return C(this.props,t)||C(this.state,e)},n}(a.a);function O(t,e){function i(t){var i=this.props.ref,n=i==t.ref;return!n&&i&&(i.call?i(null):i.current=null),e?!e(this.props,t)||!n:C(this.props,t)}function n(e){return this.shouldComponentUpdate=i,Object(a.f)(t,A({},e))}return n.prototype.isReactComponent=!0,n.displayName="Memo("+(t.displayName||t.name)+")",n.t=!0,n}var z=a.i.vnode;function I(t){function e(e){var i=A({},e);return delete i.ref,t(i,e.ref)}return e.prototype.isReactComponent=!0,e.t=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}a.i.vnode=function(t){t.type&&t.type.t&&t.ref&&(t.props.ref=t.ref,t.ref=null),z&&z(t)};var N=function(t,e){return t?Object(a.k)(t).reduce((function(t,i,n){return t.concat(e(i,n))}),[]):null},D={map:N,forEach:N,count:function(t){return t?Object(a.k)(t).length:0},only:function(t){if(1!==(t=Object(a.k)(t)).length)throw new Error("Children.only() expects only one child.");return t[0]},toArray:a.k},B=a.i.__e;function k(t){return t&&((t=A({},t)).__c=null,t.__k=t.__k&&t.__k.map(k)),t}function U(t){this.__u=0,this.u=null,this.__b=null}function F(t){var e=t.__.__c;return e&&e.o&&e.o(t)}function H(t){var e,i,n;function r(r){if(e||(e=t()).then((function(t){i=t.default||t}),(function(t){n=t})),n)throw n;if(!i)throw e;return Object(a.f)(i,r)}return r.displayName="Lazy",r.t=!0,r}function j(){this.i=null,this.l=null}a.i.__e=function(t,e,i){if(t.then)for(var n,r=e;r=r.__;)if((n=r.__c)&&n.__c)return n.__c(t,e.__c);B(t,e,i)},(U.prototype=new a.a).__c=function(t,e){var i=this;null==i.u&&(i.u=[]),i.u.push(e);var n=F(i.__v),r=!1,o=function(){r||(r=!0,n?n(a):a())};e.__c=e.componentWillUnmount,e.componentWillUnmount=function(){o(),e.__c&&e.__c()};var a=function(){var t;if(!--i.__u)for(i.__v.__k[0]=i.state.o,i.setState({o:i.__b=null});t=i.u.pop();)t.forceUpdate()};i.__u++||i.setState({o:i.__b=i.__v.__k[0]}),t.then(o,o)},U.prototype.render=function(t,e){return this.__b&&(this.__v.__k[0]=k(this.__b),this.__b=null),[Object(a.f)(a.a,null,e.o?null:t.children),e.o&&t.fallback]};var G=function(t,e,i){if(++i[1]===i[0]&&t.l.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.l.size))for(i=t.i;i;){for(;i.length>3;)i.pop()();if(i[1]0?Math.floor(t):Math.ceil(t)};function G(t,e,i){return t instanceof H?t:P(t)?new H(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new H(t.x,t.y):new H(t,e,i)}function V(t,e){if(t)for(var i=e?[t,e]:t,n=0,r=i.length;n=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=W(t);var e=this.min,i=this.max,n=t.min,r=t.max,o=r.x>=e.x&&n.x<=i.x,a=r.y>=e.y&&n.y<=i.y;return o&&a},overlaps:function(t){t=W(t);var e=this.min,i=this.max,n=t.min,r=t.max,o=r.x>e.x&&n.xe.y&&n.y=n.lat&&i.lat<=r.lat&&e.lng>=n.lng&&i.lng<=r.lng},intersects:function(t){t=q(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),o=r.lat>=e.lat&&n.lat<=i.lat,a=r.lng>=e.lng&&n.lng<=i.lng;return o&&a},overlaps:function(t){t=q(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),o=r.lat>e.lat&&n.late.lng&&n.lng1,Nt=!!document.createElement("canvas").getContext,Dt=!(!document.createElementNS||!rt("svg").createSVGRect),Bt=!Dt&&function(){try{var t=document.createElement("div");t.innerHTML='';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function kt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}(Object.freeze||Object)({ie:st,ielt9:ht,edge:lt,webkit:ct,android:ut,android23:dt,androidStock:ft,opera:mt,chrome:vt,gecko:gt,safari:_t,phantom:yt,opera12:xt,win:bt,ie3d:wt,webkit3d:Mt,gecko3d:Tt,any3d:St,mobile:Et,mobileWebkit:Lt,mobileWebkit3d:Pt,msPointer:At,pointer:Ct,touch:Rt,mobileOpera:Ot,mobileGecko:zt,retina:It,canvas:Nt,svg:Dt,vml:Bt});var Ut=At?"MSPointerDown":"pointerdown",Ft=At?"MSPointerMove":"pointermove",Ht=At?"MSPointerUp":"pointerup",jt=At?"MSPointerCancel":"pointercancel",Gt=["INPUT","SELECT","OPTION"],Vt={},Wt=!1,Zt=0;function qt(t,e,i,n){return"touchstart"===e?function(t,e,i){var n=f((function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Gt.indexOf(t.target.tagName)<0))return;Ge(t)}Kt(t,e)}));t["_leaflet_touchstart"+i]=n,t.addEventListener(Ut,n,!1),Wt||(document.documentElement.addEventListener(Ut,Xt,!0),document.documentElement.addEventListener(Ft,Yt,!0),document.documentElement.addEventListener(Ht,Jt,!0),document.documentElement.addEventListener(jt,Jt,!0),Wt=!0)}(t,i,n):"touchmove"===e?function(t,e,i){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Kt(t,e)};t["_leaflet_touchmove"+i]=n,t.addEventListener(Ft,n,!1)}(t,i,n):"touchend"===e&&function(t,e,i){var n=function(t){Kt(t,e)};t["_leaflet_touchend"+i]=n,t.addEventListener(Ht,n,!1),t.addEventListener(jt,n,!1)}(t,i,n),this}function Xt(t){Vt[t.pointerId]=t,Zt++}function Yt(t){Vt[t.pointerId]&&(Vt[t.pointerId]=t)}function Jt(t){delete Vt[t.pointerId],Zt--}function Kt(t,e){for(var i in t.touches=[],Vt)t.touches.push(Vt[i]);t.changedTouches=[t],e(t)}var Qt=At?"MSPointerDown":Ct?"pointerdown":"touchstart",$t=At?"MSPointerUp":Ct?"pointerup":"touchend",te="_leaflet_";function ee(t,e,i){var n,r,o=!1;function a(t){var e;if(Ct){if(!lt||"mouse"===t.pointerType)return;e=Zt}else e=t.touches.length;if(!(e>1)){var i=Date.now(),a=i-(n||i);r=t.touches?t.touches[0]:t,o=a>0&&a<=250,n=i}}function s(t){if(o&&!r.cancelBubble){if(Ct){if(!lt||"mouse"===t.pointerType)return;var i,a,s={};for(a in r)i=r[a],s[a]=i&&i.bind?i.bind(r):i;r=s}r.type="dblclick",e(r),n=null}}return t[te+Qt+i]=a,t[te+$t+i]=s,t[te+"dblclick"+i]=e,t.addEventListener(Qt,a,!1),t.addEventListener($t,s,!1),t.addEventListener("dblclick",e,!1),this}function ie(t,e){var i=t[te+Qt+e],n=t[te+$t+e],r=t[te+"dblclick"+e];return t.removeEventListener(Qt,i,!1),t.removeEventListener($t,n,!1),lt||t.removeEventListener("dblclick",r,!1),this}var ne,re,oe,ae,se,he=Te(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),le=Te(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ce="webkitTransition"===le||"OTransition"===le?le+"End":"transitionend";function ue(t){return"string"==typeof t?document.getElementById(t):t}function de(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||"auto"===i)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return"auto"===i?null:i}function pe(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function fe(t){var e=t.parentNode;e&&e.removeChild(t)}function me(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function ve(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ge(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function _e(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=we(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function ye(t,e){if(void 0!==t.classList)for(var i=w(e),n=0,r=i.length;n100&&n<500||t.target._simulatedClick&&!t._simulated)return void Ve(t);Xe=i,e(t)}(t,a)}),t.addEventListener(e,o,!1)):"attachEvent"in t&&t.attachEvent("on"+e,o):ee(t,o,r),t[De]=t[De]||{},t[De][r]=o}function Ue(t,e,i,n){var r=e+v(i)+(n?"_"+v(n):""),o=t[De]&&t[De][r];if(!o)return this;Ct&&0===e.indexOf("touch")?function(t,e,i){var n=t["_leaflet_"+e+i];"touchstart"===e?t.removeEventListener(Ut,n,!1):"touchmove"===e?t.removeEventListener(Ft,n,!1):"touchend"===e&&(t.removeEventListener(Ht,n,!1),t.removeEventListener(jt,n,!1))}(t,e,r):!Rt||"dblclick"!==e||!ie||Ct&&vt?"removeEventListener"in t?"mousewheel"===e?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",o,!1):t.removeEventListener("mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,o,!1):"detachEvent"in t&&t.detachEvent("on"+e,o):ie(t,r),t[De][r]=null}function Fe(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Ke(t),this}function He(t){return ke(t,"mousewheel",Fe),this}function je(t){return Ne(t,"mousedown touchstart dblclick",Fe),ke(t,"click",Je),this}function Ge(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Ve(t){return Ge(t),Fe(t),this}function We(t,e){if(!e)return new H(t.clientX,t.clientY);var i=Ie(e),n=i.boundingClientRect;return new H((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var Ze=bt&&vt?2*window.devicePixelRatio:gt?window.devicePixelRatio:1;function qe(t){return lt?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/Ze:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Xe,Ye={};function Je(t){Ye[t.type]=!0}function Ke(t){var e=Ye[t.type];return Ye[t.type]=!1,e}function Qe(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}(Object.freeze||Object)({on:Ne,off:Be,stopPropagation:Fe,disableScrollPropagation:He,disableClickPropagation:je,preventDefault:Ge,stop:Ve,getMousePosition:We,getWheelDelta:qe,fakeStop:Je,skipped:Ke,isExternalTarget:Qe,addListener:Ne,removeListener:Be});var $e=F.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Le(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=D(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=1e3*this._duration;ethis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,q(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=G((e=e||{}).paddingTopLeft||e.padding||[0,0]),n=G(e.paddingBottomRight||e.padding||[0,0]),r=this.getCenter(),o=this.project(r),a=this.project(t),s=this.getPixelBounds(),h=s.getSize().divideBy(2),l=W([s.min.add(i),s.max.subtract(n)]);if(!l.contains(a)){this._enforcingBounds=!0;var c=o.subtract(a),u=G(a.x+c.x,a.y+c.y);(a.xl.max.x)&&(u.x=o.x-c.x,c.x>0?u.x+=h.x-i.x:u.x-=h.x-n.x),(a.yl.max.y)&&(u.y=o.y-c.y,c.y>0?u.y+=h.y-i.y:u.y-=h.y-n.y),this.panTo(this.unproject(u),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=d({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),n=e.divideBy(2).round(),r=i.divideBy(2).round(),o=n.subtract(r);return o.x||o.y?(t.animate&&t.pan?this.panBy(o):(t.pan&&this._rawPanBy(o),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(f(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=d({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=f(this._handleGeolocationResponse,this),i=f(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=new X(t.coords.latitude,t.coords.longitude),i=e.toBounds(2*t.coords.accuracy),n=this._locateOptions;if(n.setView){var r=this.getBoundsZoom(i);this.setView(e,n.maxZoom?Math.min(r,n.maxZoom):r)}var o={latlng:e,bounds:i,timestamp:t.timestamp};for(var a in t.coords)"number"==typeof t.coords[a]&&(o[a]=t.coords[a]);this.fire("locationfound",o)},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),fe(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(B(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)fe(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i=pe("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new Z(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=q(t),i=G(i||[0,0]);var n=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),a=t.getNorthWest(),s=t.getSouthEast(),h=this.getSize().subtract(i),l=W(this.project(s,n),this.project(a,n)).getSize(),c=St?this.options.zoomSnap:1,u=h.x/l.x,d=h.y/l.y,p=e?Math.max(u,d):Math.min(u,d);return n=this.getScaleZoom(p,n),c&&(n=Math.round(n/(c/100))*(c/100),n=e?Math.ceil(n/c)*c:Math.floor(n/c)*c),Math.max(r,Math.min(o,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new H(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new V(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=void 0===e?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(Y(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(G(t),e)},layerPointToLatLng:function(t){var e=G(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(Y(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(Y(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(q(t))},distance:function(t,e){return this.options.crs.distance(Y(t),Y(e))},containerPointToLayerPoint:function(t){return G(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return G(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(G(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(Y(t)))},mouseEventToContainerPoint:function(t){return We(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=ue(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");Ne(e,"scroll",this._onScroll,this),this._containerId=v(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&St,ye(t,"leaflet-container"+(Rt?" leaflet-touch":"")+(It?" leaflet-retina":"")+(ht?" leaflet-oldie":"")+(_t?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=de(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Ee(this._mapPane,new H(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ye(t.markerPane,"leaflet-zoom-hide"),ye(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){Ee(this._mapPane,new H(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var n=this._zoom!==e;this._moveStart(n,!1)._move(t,e)._moveEnd(n),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i){void 0===e&&(e=this._zoom);var n=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return B(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Ee(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[v(this._container)]=this;var e=t?Be:Ne;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),St&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){B(this._resizeRequest),this._resizeRequest=D((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,n=[],r="mouseout"===e||"mouseover"===e,o=t.target||t.srcElement,a=!1;o;){if((i=this._targets[v(o)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(i)){a=!0;break}if(i&&i.listens(e,!0)){if(r&&!Qe(o,t))break;if(n.push(i),r)break}if(o===this._container)break;o=o.parentNode}return n.length||a||r||!Qe(o,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Ke(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e||Re(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var n=d({},t);n.type="preclick",this._fireDOMEvent(n,n.type,i)}if(!t._stopped&&(i=(i||[]).concat(this._findEventTargets(t,e))).length){var r=i[0];"contextmenu"===e&&r.listens(e,!0)&&Ge(t);var o={originalEvent:t};if("keypress"!==t.type){var a=r.getLatLng&&(!r._radius||r._radius<=10);o.containerPoint=a?this.latLngToContainerPoint(r.getLatLng()):this.mouseEventToContainerPoint(t),o.layerPoint=this.containerPointToLayerPoint(o.containerPoint),o.latlng=a?r.getLatLng():this.layerPointToLatLng(o.layerPoint)}for(var s=0;s0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),n=St?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){xe(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(i))&&(this.panBy(i,e),!0)},_createAnimProxy:function(){var t=this._proxy=pe("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=he,i=this._proxy.style[e];Se(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),i===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",(function(){var t=this.getCenter(),e=this.getZoom();Se(this._proxy,this.project(t,e),this.getZoomScale(e,1))}),this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){fe(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),r=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==i.animate&&!this.getSize().contains(r))&&(D((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this),!0)},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ye(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),setTimeout(f(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&xe(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),D((function(){this._moveEnd(!0)}),this))}});var ei=k.extend({options:{position:"topright"},initialize:function(t){M(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return ye(e,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e),this},remove:function(){return this._map?(fe(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),ii=function(t){return new ei(t)};ti.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=pe("div",e+"control-container",this._container);function n(n,r){var o=e+n+" "+e+r;t[n+r]=pe("div",o,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)fe(this._controlCorners[t]);fe(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ni=ei.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(v(t.target)),i=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e,i=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=n):e=this._createRadioElement("leaflet-base-layers",n),this._layerControlInputs.push(e),e.layerId=v(t.layer),Ne(e,"click",this._onInputClick,this);var r=document.createElement("span");r.innerHTML=" "+t.name;var o=document.createElement("div");return i.appendChild(o),o.appendChild(e),o.appendChild(r),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,n=[],r=[];this._handlingClick=!0;for(var o=i.length-1;o>=0;o--)t=i[o],e=this._getLayer(t.layerId).layer,t.checked?n.push(e):t.checked||r.push(e);for(o=0;o=0;r--)t=i[r],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&ne.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ri=ei.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=pe("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,r){var o=pe("a",i,n);return o.innerHTML=t,o.href="#",o.title=e,o.setAttribute("role","button"),o.setAttribute("aria-label",e),je(o),Ne(o,"click",Ve),Ne(o,"click",r,this),Ne(o,"click",this._refocusOnMap,this),o},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";xe(this._zoomInButton,e),xe(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&ye(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&ye(this._zoomInButton,e)}});ti.mergeOptions({zoomControl:!0}),ti.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new ri,this.addControl(this.zoomControl))}));var oi=ei.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e=pe("div","leaflet-control-scale"),i=this.options;return this._addScales(i,"leaflet-control-scale-line",e),t.on(i.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=pe("div",e,i)),t.imperial&&(this._iScale=pe("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e,i,n,r=3.2808399*t;r>5280?(e=r/5280,i=this._getRoundNum(e),this._updateScale(this._iScale,i+" mi",i/e)):(n=this._getRoundNum(r),this._updateScale(this._iScale,n+" ft",n/r))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),ai=ei.extend({options:{position:"bottomright",prefix:'Leaflet'},initialize:function(t){M(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=pe("div","leaflet-control-attribution"),je(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}}});ti.mergeOptions({attributionControl:!0}),ti.addInitHook((function(){this.options.attributionControl&&(new ai).addTo(this)}));ei.Layers=ni,ei.Zoom=ri,ei.Scale=oi,ei.Attribution=ai,ii.layers=function(t,e,i){return new ni(t,e,i)},ii.zoom=function(t){return new ri(t)},ii.scale=function(t){return new oi(t)},ii.attribution=function(t){return new ai(t)};var si=k.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});si.addTo=function(t,e){return t.addHandler(e,this),this};var hi,li=Rt?"touchstart mousedown":"mousedown",ci={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},ui={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},di=F.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){M(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(Ne(this._dragStartTarget,li,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(di._dragging===this&&this.finishDrag(),Be(this._dragStartTarget,li,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!_e(this._element,"leaflet-zoom-anim")&&!(di._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(di._dragging=this,this._preventOutline&&Re(this._element),Ae(),ne(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,i=ze(this._element);this._startPoint=new H(e.clientX,e.clientY),this._parentScale=Ie(i),Ne(document,ui[t.type],this._onMove,this),Ne(document,ci[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,i=new H(e.clientX,e.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)l&&(a=s,l=h);l>n&&(i[a]=1,t(e,i,n,r,a),t(e,i,n,a,o))}(t,n,e,0,i-1);var r,o=[];for(r=0;re&&(i.push(t[n]),r=n);var a,s,h,l;re.max.x&&(i|=2),t.ye.max.y&&(i|=8),i}function _i(t,e,i,n){var r,o=e.x,a=e.y,s=i.x-o,h=i.y-a,l=s*s+h*h;return l>0&&((r=((t.x-o)*s+(t.y-a)*h)/l)>1?(o=i.x,a=i.y):r>0&&(o+=s*r,a+=h*r)),s=t.x-o,h=t.y-a,n?s*s+h*h:new H(o,a)}function yi(t){return!P(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function xi(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),yi(t)}(Object.freeze||Object)({simplify:pi,pointToSegmentDistance:fi,closestPointOnSegment:function(t,e,i){return _i(t,e,i)},clipSegment:mi,_getEdgeIntersection:vi,_getBitCode:gi,_sqClosestPointOnSegment:_i,isFlat:yi,_flat:xi});function bi(t,e,i){var n,r,o,a,s,h,l,c,u,d=[1,4,2,8];for(r=0,l=t.length;r1e-7;h++)e=o*Math.sin(s),e=Math.pow((1-e)/(1+e),o/2),s+=l=Math.PI/2-2*Math.atan(a*e)-s;return new X(s*i,t.x*i/n)}},Ti=((Object.freeze||Object)({LonLat:wi,Mercator:Mi,SphericalMercator:$}),d({},Q,{code:"EPSG:3395",projection:Mi,transformation:function(){var t=.5/(Math.PI*Mi.R);return et(t,.5,-t,.5)}()})),Si=d({},Q,{code:"EPSG:4326",projection:wi,transformation:et(1/180,1,-1/180,.5)}),Ei=d({},K,{projection:wi,transformation:et(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});K.Earth=Q,K.EPSG3395=Ti,K.EPSG3857=it,K.EPSG900913=nt,K.EPSG4326=Si,K.Simple=Ei;var Li=F.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[v(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[v(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",(function(){e.off(i,this)}),this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});ti.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=v(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=v(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&v(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){for(var e=0,i=(t=t?P(t)?t:[t]:[]).length;ethis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()e)return a=(n-e)/i,this._map.layerPointToLatLng([o.x-a*(o.x-r.x),o.y-a*(o.y-r.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=Y(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new Z,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return yi(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=yi(t),n=0,r=t.length;n=2&&e[0]instanceof X&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){Bi.prototype._setLatLngs.call(this,t),yi(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return yi(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new H(e,e);if(t=new V(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,r=0,o=this._rings.length;rt.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(l=!l);return l||Bi.prototype._containsPoint.call(this,t,!0)}});var Ui=Ai.extend({initialize:function(t,e){M(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,r=P(t)?t:t.features;if(r){for(e=0,i=r.length;e0?n:[e.src]}else{P(this._url)||(this._url=[this._url]),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var o=0;or?(e.height=r+"px",ye(t,"leaflet-popup-scrolled")):xe(t,"leaflet-popup-scrolled"),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();Ee(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(de(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,r=new H(this._containerLeft,-i-this._containerBottom);r._add(Le(this._container));var o=t.layerPointToContainerPoint(r),a=G(this.options.autoPanPadding),s=G(this.options.autoPanPaddingTopLeft||a),h=G(this.options.autoPanPaddingBottomRight||a),l=t.getSize(),c=0,u=0;o.x+n+h.x>l.x&&(c=o.x+n-l.x+h.x),o.x-c-s.x<0&&(c=o.x-s.x),o.y+i+h.y>l.y&&(u=o.y+i-l.y+h.y),o.y-u-s.y<0&&(u=o.y-s.y),(c||u)&&t.fire("autopanstart").panBy([c,u])}},_onCloseButtonClick:function(t){this._close(),Ve(t)},_getAnchor:function(){return G(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});ti.mergeOptions({closePopupOnClick:!0}),ti.include({openPopup:function(t,e,i){return t instanceof Ji||(t=new Ji(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Li.include({bindPopup:function(t,e){return t instanceof Ji?(M(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new Ji(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){if(t instanceof Li||(e=t,t=this),t instanceof Ai)for(var i in this._layers){t=this._layers[i];break}return e||(e=t.getCenter?t.getCenter():t.getLatLng()),this._popup&&this._map&&(this._popup._source=t,this._popup.update(),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(Ve(t),e instanceof Ii?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Ki=Yi.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){Yi.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){Yi.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=Yi.prototype.getEvents.call(this);return Rt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=pe("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,i=this._container,n=e.latLngToContainerPoint(e.getCenter()),r=e.layerPointToContainerPoint(t),o=this.options.direction,a=i.offsetWidth,s=i.offsetHeight,h=G(this.options.offset),l=this._getAnchor();"top"===o?t=t.add(G(-a/2+h.x,-s+h.y+l.y,!0)):"bottom"===o?t=t.subtract(G(a/2-h.x,-h.y,!0)):"center"===o?t=t.subtract(G(a/2+h.x,s/2-l.y+h.y,!0)):"right"===o||"auto"===o&&r.xthis.options.maxZoom||in&&this._retainParent(r,o,a,n))},_retainChildren:function(t,e,i,n){for(var r=2*t;r<2*t+2;r++)for(var o=2*e;o<2*e+2;o++){var a=new H(r,o);a.z=i+1;var s=this._tileCoordsToKey(a),h=this._tiles[s];h&&h.active?h.retain=!0:(h&&h.loaded&&(h.retain=!0),i+1this.options.maxZoom||void 0!==this.options.minZoom&&r1)this._setView(t,i);else{for(var u=r.min.y;u<=r.max.y;u++)for(var d=r.min.x;d<=r.max.x;d++){var p=new H(d,u);if(p.z=this._tileZoom,this._isValidTile(p)){var f=this._tiles[this._tileCoordsToKey(p)];f?f.current=!0:a.push(p)}}if(a.sort((function(t,e){return t.distanceTo(o)-e.distanceTo(o)})),0!==a.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(d=0;di.max.x)||!e.wrapLat&&(t.yi.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return q(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),r=n.add(i);return[e.unproject(n,t.z),e.unproject(r,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new Z(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new H(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(fe(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ye(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=y,t.onmousemove=y,ht&&this.options.opacity<1&&Me(t,this.options.opacity),ut&&!dt&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),r=this.createTile(this._wrapCoords(t),f(this._tileReady,this,t));this._initTile(r),this.createTile.length<2&&D(f(this._tileReady,this,t,null,r)),Ee(r,i),this._tiles[n]={el:r,coords:t,current:!0},e.appendChild(r),this.fire("tileloadstart",{tile:r,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);(i=this._tiles[n])&&(i.loaded=+new Date,this._map._fadeAnimated?(Me(i.el,0),B(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(ye(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),ht||!this._map._fadeAnimated?D(this._pruneTiles,this):setTimeout(f(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new H(this._wrapX?_(t.x,this._wrapX):t.x,this._wrapY?_(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new V(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var en=tn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=M(this,e)).detectRetina&&It&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),ut||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return Ne(i,"load",f(this._tileOnLoad,this,e,i)),Ne(i,"error",f(this._tileOnError,this,e,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i.alt="",i.setAttribute("role","presentation"),i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:It?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return E(this._url,d(e,this.options))},_tileOnLoad:function(t,e){ht?setTimeout(f(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=y,e.onerror=y,e.complete||(e.src=C,fe(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return ft||e.el.setAttribute("src",C),tn.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(this._map&&(!i||i.getAttribute("src")!==C))return tn.prototype._tileReady.call(this,t,e,i)}});var nn=en.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=d({},this.defaultWmsParams);for(var n in e)n in this.options||(i[n]=e[n]);var r=(e=M(this,e)).detectRetina&&It?2:1,o=this.getTileSize();i.width=o.x*r,i.height=o.y*r,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,en.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=W(i.project(e[0]),i.project(e[1])),r=n.min,o=n.max,a=(this._wmsVersion>=1.3&&this._crs===Si?[r.y,r.x,o.y,o.x]:[r.x,r.y,o.x,o.y]).join(","),s=en.prototype.getTileUrl.call(this,t);return s+T(this.wmsParams,s,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+a},setParams:function(t,e){return d(this.wmsParams,t),e||this.redraw(),this}});en.WMS=nn;var rn=Li.extend({options:{padding:.1,tolerance:0},initialize:function(t){M(this,t),v(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ye(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),n=Le(this._container),r=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,e),a=this._map.project(t,e).subtract(o),s=r.multiplyBy(-i).add(n).add(r).subtract(a);St?Se(this._container,s,i):Ee(this._container,s)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new V(i,i.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),on=rn.extend({getEvents:function(){var t=rn.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){rn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");Ne(t,"mousemove",g(this._onMouseMove,32,this),this),Ne(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ne(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){B(this._redrawRequest),delete this._ctx,fe(this._container),Be(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){rn.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=It?2:1;Ee(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",It&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){rn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[v(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[v(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,i,n=t.options.dashArray.split(/[, ]+/),r=[];for(i=0;i')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),sn={_initContainer:function(){this._container=pe("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(rn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=an("shape");ye(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=an("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[v(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;fe(e),t.removeInteractiveTarget(e),delete this._layers[v(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,r=t._container;r.stroked=!!n.stroke,r.filled=!!n.fill,n.stroke?(e||(e=t._stroke=an("stroke")),r.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=P(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(r.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=an("fill")),r.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(r.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){ve(t._container)},_bringToBack:function(t){ge(t._container)}},hn=Bt?an:rt,ln=rn.extend({getEvents:function(){var t=rn.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=hn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=hn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){fe(this._container),Be(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){rn.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),Ee(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=hn("path");t.options.className&&ye(e,t.options.className),t.options.interactive&&ye(e,"leaflet-interactive"),this._updateStyle(t),this._layers[v(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){fe(t._path),t.removeInteractiveTarget(t._path),delete this._layers[v(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,ot(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",r=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+n+2*i+",0 "+n+2*-i+",0 ";this._setPath(t,r)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){ve(t._path)},_bringToBack:function(t){ge(t._path)}});Bt&&ln.include(sn),ti.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&function(t){return Nt?new on(t):null}(t)||function(t){return Dt||Bt?new ln(t):null}(t)}});ki.extend({initialize:function(t,e){ki.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=q(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});ln.create=hn,ln.pointsToPath=ot,Ui.geometryToLayer=Fi,Ui.coordsToLatLng=Hi,Ui.coordsToLatLngs=ji,Ui.latLngToCoords=Gi,Ui.latLngsToCoords=Vi,Ui.getFeature=Wi,Ui.asFeature=Zi,ti.mergeOptions({boxZoom:!0});var cn=si.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Ne(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Be(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){fe(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ne(),Ae(),this._startPoint=this._map.mouseEventToContainerPoint(t),Ne(document,{contextmenu:Ve,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=pe("div","leaflet-zoom-box",this._container),ye(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new V(this._point,this._startPoint),i=e.getSize();Ee(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(fe(this._box),xe(this._container,"leaflet-crosshair")),re(),Ce(),Be(document,{contextmenu:Ve,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(f(this._resetState,this),0);var e=new Z(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});ti.addInitHook("addHandler","boxZoom",cn),ti.mergeOptions({doubleClickZoom:!0});var un=si.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,r=t.originalEvent.shiftKey?i-n:i+n;"center"===e.options.doubleClickZoom?e.setZoom(r):e.setZoomAround(t.containerPoint,r)}});ti.addInitHook("addHandler","doubleClickZoom",un),ti.mergeOptions({dragging:!0,inertia:!dt,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var dn=si.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new di(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ye(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){xe(this._map._container,"leaflet-grab"),xe(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=q(this._map.options.maxBounds);this._offsetLimit=W(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.xe.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,r=(n-e+i)%t+e-i,o=(n+e+i)%t-e-i,a=Math.abs(r+i)0?o:-o))-e;this._delta=0,this._startTime=null,a&&("center"===t.options.scrollWheelZoom?t.setZoom(e+a):t.setZoomAround(this._lastMousePos,e+a))}});ti.addInitHook("addHandler","scrollWheelZoom",fn),ti.mergeOptions({tap:!0,tapTolerance:15});var mn=si.extend({addHooks:function(){Ne(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Be(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Ge(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],i=e.target;this._startPos=this._newPos=new H(e.clientX,e.clientY),i.tagName&&"a"===i.tagName.toLowerCase()&&ye(i,"leaflet-active"),this._holdTimeout=setTimeout(f((function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))}),this),1e3),this._simulateEvent("mousedown",e),Ne(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),Be(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],i=e.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&xe(i,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new H(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var i=document.createEvent("MouseEvents");i._simulated=!0,e.target._simulatedClick=!0,i.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(i)}});Rt&&!Ct&&ti.addInitHook("addHandler","tap",mn),ti.mergeOptions({touchZoom:Rt&&!dt,bounceAtZoomLimits:!0});var vn=si.extend({addHooks:function(){ye(this._map._container,"leaflet-touch-zoom"),Ne(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){xe(this._map._container,"leaflet-touch-zoom"),Be(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),Ne(document,"touchmove",this._onTouchMove,this),Ne(document,"touchend",this._onTouchEnd,this),Ge(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),r=i.distanceTo(n)/this._startDist;if(this._zoom=e.getScaleZoom(r,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoome.getMaxZoom()&&r>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===r)return}else{var o=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(1===r&&0===o.x&&0===o.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(o),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),B(this._animRequest);var a=f(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=D(a,this,!0),Ge(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,B(this._animRequest),Be(document,"touchmove",this._onTouchMove),Be(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});ti.addInitHook("addHandler","touchZoom",vn),ti.BoxZoom=cn,ti.DoubleClickZoom=un,ti.Drag=dn,ti.Keyboard=pn,ti.ScrollWheelZoom=fn,ti.Tap=mn,ti.TouchZoom=vn,Object.freeze=u;var gn=l.Marker.extend({options:{rotation:"0deg",color:"#fff",icon:$i({className:"nwah-player-marker",iconSize:[0,0],iconAnchor:[5,10]})},setRotation:function(t){this.options.rotation=t},_initIcon:function(){l.Marker.prototype._initIcon.call(this),this._icon.style.borderBottomColor=this.options.color||"#fff"},_setPos:function(t){if(l.Marker.prototype._setPos.call(this,t),this.options.icon&&this.options.icon.options&&this.options.icon.options.iconAnchor){var e=this.options.icon.options.iconAnchor;this._icon.style.transformOrigin="".concat(e[0],"px ").concat(e[1],"px")}else this._icon.style.transformOrigin="center bottom";this._icon.style.transform+=" rotateZ(".concat(this.options.rotation,")")}}),_n=i(5),yn=l.Marker.extend({options:{color:"#fff",icon:$i({className:"nwah-entry-marker",iconSize:["",""]})},_initIcon:function(){l.Marker.prototype._initIcon.call(this),this._icon.src="",this._icon.style.backgroundColor=this.options.color},mark:function(){this._icon.classList.add("mark")},unmark:function(){this._icon.classList.remove("mark")}}),xn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{color:"#fff"},i=e.color,n=void 0===i?"#fff":i;a()(this,t),this.nwahMap=null,this.color=n,this.currentLine=null,this.items=[],this.lastEntry=null,this.isOutside=!1,this.lastPosition=null,this.map=null,this.expirationTime=6e5}return h()(t,[{key:"addTo",value:function(t){this.nwahMap=t,this.map=t.map,this.items.forEach((function(t){return t.item.addTo(map)}))}},{key:"push",value:function(t,e,i,n){if(this.isOutside!==i&&(this.isOutside?(this.lastEntry=new yn(this.nwahMap.gameCoordsToLatLng(this.lastPosition.x,this.lastPosition.y),{color:this.color}),this.map&&this.lastEntry.addTo(this.map),this.lastEntry.mark(),this.items.push({type:"entry",item:this.lastEntry,locations:[{time:performance.now()}],marked:!0})):null!==this.lastEntry&&(this.lastEntry.marked=!1,this.lastEntry.unmark())),this.isOutside=i,!i)return this.currentLine=null,void this.cull();if(null!==this.lastPosition){var r=this.lastPosition.x-t,o=this.lastPosition.y-e;if(Math.sqrt(r*r+o*o)>this.nwahMap.settings.cellSize){var a=Object(l.polyline)([this.nwahMap.gameCoordsToLatLng(this.lastPosition.x,this.lastPosition.y),this.nwahMap.gameCoordsToLatLng(t,e)],{color:this.color,opacity:.2});a.addTo(this.map),this.items.push({type:"teleport",item:a,locations:[{time:performance.now()}]}),this.currentLine&&(this.currentLine=null)}}null===this.currentLine&&(this.currentLine=Object(l.polyline)([],{dashArray:"4",color:this.color}),this.items.push(this.lastItem={type:"path",item:this.currentLine,locations:[]}),this.map&&this.currentLine.addTo(this.map)),this.lastPosition={x:t,y:e};var s=this.nwahMap.gameCoordsToLatLng(t,e);this.lastItem.locations.push({time:performance.now(),location:s}),this.lastItem.item.addLatLng(s),this.cull()}},{key:"remove",value:function(){var t=this,e=this.items;this.items=[],e.forEach((function(e){return t.map.removeLayer(e.item)}))}},{key:"cull",value:function(){for(var t=0,e=performance.now()-this.expirationTime;t3&&void 0!==arguments[3]&&arguments[3];var n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;n!==this.isOutside&&(n?this.map.addLayer(this.arrow):this.map.removeLayer(this.arrow),this.isOutside=n),this.trail.push(t,e,n,r),n&&(this.x=t,this.y=e,this.rot=i,this.map&&(this.arrow.setRotation(Object(_n.b)(this.rot)+"rad"),this.arrow.setLatLng(this.nwahMap.gameCoordsToLatLng(this.x,this.y))))}}]),t}();i(0),i(16);i.d(e,"a",(function(){return wn}));var wn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.mapUrl,n=e.settings,r=e.icons,o=e.websocketUrl,s=e.playerList;a()(this,t),this.players={},this.mapUrl=i,this.playerList=s,this.settings=n||{cellSize:2048,cellOffsetY:-20,cellOffsetX:8},this.map=null,this.follow=!1,this.icons=r||c,this.websocketUrl=o}return h()(t,[{key:"setFollow",value:function(t){this.follow=t}},{key:"init",value:function(t,e){var i=this;this.map=Object(l.map)(t,{zoom:3,center:this.gameCoordsToLatLng(0,0),crs:l.CRS.Simple}),window.nwahMap=this,this.map.setMaxBounds(new l.LatLngBounds(new l.LatLng(-255,255),new l.LatLng(0,0))),this.map.invalidateSize(),this.tileLayer=Object(l.tileLayer)("/tileset/mwmap/zoom{z}/vvardenfell-{x}-{y}-{z}.jpg",{attribution:"uesp.net",minZoom:0,maxZoom:7,zoomOffset:10}),this.tileLayer.addTo(this.map),this.websocketUrl&&(this.websocket=new WebSocket(this.websocketUrl),this.websocket.onmessage=function(t){var n=JSON.parse(t.data);"playerPosition"===n.type&&i.updatePositions(n.positions),"fullPlayer"===n.type&&(i.updatePlayers(n.players),e.setState({players:n.players}),window.players=n.players),i.follow&&i.zoomOnPlayers()})}},{key:"zoomOnPlayers",value:function(){var t=this,e=Object.values(this.players).filter((function(t){return t.isOutside})).map((function(e){return t.gameCoordsToLatLng(e.x,e.y)}));if(0!==e.length){var i=new l.LatLngBounds(e);this.map.fitBounds(i)}}},{key:"updatePositions",value:function(t){var e=new Set(Object.keys(this.players)),i=!0,n=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done);i=!0){var h=a.value,l=h.name;e.delete(l),l in this.players||(this.players[l]=new bn(l),this.players[l].addTo(this));var c=r()(h.position,2),u=c[0],d=c[1];this.players[l].update(u,d,h.rotation,!1,h.isOutside,h.cell)}}catch(t){n=!0,o=t}finally{try{i||null==s.return||s.return()}finally{if(n)throw o}}var p=!0,f=!1,m=void 0;try{for(var v,g=e[Symbol.iterator]();!(p=(v=g.next()).done);p=!0){var _=v.value;this.players[_].remove(),delete this.players[_]}}catch(t){f=!0,m=t}finally{try{p||null==g.return||g.return()}finally{if(f)throw m}}}},{key:"updatePlayers",value:function(t){var e=new Set(Object.keys(this.players)),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,h=s.name;e.delete(h),h in this.players||(this.players[h]=new bn(h),this.players[h].addTo(this));var l=s.position,c=l.x,u=l.y;this.players[h].update(c,u,s.rotation.z,!0,s.isOutside,s.cell)}}catch(t){n=!0,r=t}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var d=!0,p=!1,f=void 0;try{for(var m,v=e[Symbol.iterator]();!(d=(m=v.next()).done);d=!0){var g=m.value;this.players[g].remove(),delete this.players[g]}}catch(t){p=!0,f=t}finally{try{d||null==v.return||v.return()}finally{if(p)throw f}}}},{key:"gameCoordsToLatLng",value:function(t,e){return new l.LatLng(e/this.settings.cellSize-128+this.settings.cellOffsetY,128+(t/this.settings.cellSize+this.settings.cellOffsetX))}},{key:"show",value:function(t){var e=t.x,i=t.y;this.map.panTo(this.gameCoordsToLatLng(e,i))}}]),t}()},function(t,e,i){"use strict";var n=i(9),r=i.n(n),o=i(4),a=i.n(o),s=i(2),h=i.n(s),l=i(3),c=i.n(l);void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i>8&255]+d[t>>16&255]+d[t>>24&255]+"-"+d[255&e]+d[e>>8&255]+"-"+d[e>>16&15|64]+d[e>>24&255]+"-"+d[63&i|128]+d[i>>8&255]+"-"+d[i>>16&255]+d[i>>24&255]+d[255&n]+d[n>>8&255]+d[n>>16&255]+d[n>>24&255]).toUpperCase()},clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*m.DEG2RAD},radToDeg:function(t){return t*m.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,n,r){var o=Math.cos,a=Math.sin,s=o(i/2),h=a(i/2),l=o((e+n)/2),c=a((e+n)/2),u=o((e-n)/2),d=a((e-n)/2),p=o((n-e)/2),f=a((n-e)/2);"XYX"===r?t.set(s*c,h*u,h*d,s*l):"YZY"===r?t.set(h*d,s*c,h*u,s*l):"ZXZ"===r?t.set(h*u,h*d,s*c,s*l):"XZX"===r?t.set(s*c,h*f,h*p,s*l):"YXY"===r?t.set(h*p,s*c,h*f,s*l):"ZYZ"===r?t.set(h*f,h*p,s*c,s*l):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.")}};function v(t,e){this.x=t||0,this.y=e||0}function g(){this.elements=[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.")}Object.defineProperties(v.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(v.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*n+t.x,this.y=r*n+o*i+t.y,this}}),Object.assign(g.prototype,{isMatrix3:!0,set:function(t,e,i,n,r,o,a,s,h){var l=this.elements;return l[0]=t,l[1]=n,l[2]=a,l[3]=e,l[4]=r,l[5]=s,l[6]=i,l[7]=o,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},extractBasis:function(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,o=i[0],a=i[3],s=i[6],h=i[1],l=i[4],c=i[7],u=i[2],d=i[5],p=i[8],f=n[0],m=n[3],v=n[6],g=n[1],_=n[4],y=n[7],x=n[2],b=n[5],w=n[8];return r[0]=o*f+a*g+s*x,r[3]=o*m+a*_+s*b,r[6]=o*v+a*y+s*w,r[1]=h*f+l*g+c*x,r[4]=h*m+l*_+c*b,r[7]=h*v+l*y+c*w,r[2]=u*f+d*g+p*x,r[5]=u*m+d*_+p*b,r[8]=u*v+d*y+p*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],a=t[5],s=t[6],h=t[7],l=t[8];return e*o*l-e*a*h-i*r*l+i*a*s+n*r*h-n*o*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var i=t.elements,n=this.elements,r=i[0],o=i[1],a=i[2],s=i[3],h=i[4],l=i[5],c=i[6],u=i[7],d=i[8],p=d*h-l*u,f=l*c-d*s,m=u*s-h*c,v=r*p+o*f+a*m;if(0===v){var g="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(g);return console.warn(g),this.identity()}var _=1/v;return n[0]=p*_,n[1]=(a*u-d*o)*_,n[2]=(l*o-a*h)*_,n[3]=f*_,n[4]=(d*r-a*c)*_,n[5]=(a*s-l*r)*_,n[6]=m*_,n[7]=(o*c-u*r)*_,n[8]=(h*r-o*s)*_,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},setUvTransform:function(t,e,i,n,r,o,a){var s=Math.cos(r),h=Math.sin(r);this.set(i*s,i*h,-i*(s*o+h*a)+o+t,-n*h,n*s,-n*(-h*o+s*a)+a+e,0,0,1)},scale:function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],o=n[3],a=n[6],s=n[1],h=n[4],l=n[7];return n[0]=e*r+i*s,n[3]=e*o+i*h,n[6]=e*a+i*l,n[1]=-i*r+e*s,n[4]=-i*o+e*h,n[7]=-i*a+e*l,this},translate:function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}});var _={getDataURL:function(t){var e;if("undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)e=t;else{void 0===f&&(f=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),f.width=t.width,f.height=t.height;var i=f.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=f}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},y=0;function x(t,e,i,n,r,o,a,s,h,l){Object.defineProperty(this,"id",{value:y++}),this.uuid=m.generateUUID(),this.name="",this.image=void 0!==t?t:x.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:x.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:1001,this.wrapT=void 0!==n?n:1001,this.magFilter=void 0!==r?r:1006,this.minFilter=void 0!==o?o:1008,this.anisotropy=void 0!==h?h:1,this.format=void 0!==a?a:1023,this.internalFormat=null,this.type=void 0!==s?s:1009,this.offset=new v(0,0),this.repeat=new v(1,1),this.center=new v(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new g,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:3e3,this.version=0,this.onUpdate=null}function b(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function w(t,e,i){this.width=t,this.height=e,this.scissor=new b(0,0,t,e),this.scissorTest=!1,this.viewport=new b(0,0,t,e),i=i||{},this.texture=new x(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,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 M(t,e,i){w.call(this,t,e,i),this.samples=4}function T(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}x.DEFAULT_IMAGE=void 0,x.DEFAULT_MAPPING=300,x.prototype=Object.assign(Object.create(u.prototype),{constructor:x,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=m.generateUUID()),!e&&void 0===t.images[n.uuid]){var r;if(Array.isArray(n)){r=[];for(var o=0,a=n.length;o1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(x.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.defineProperties(b.prototype,{width:{get:function(){return this.z},set:function(t){this.z=t}},height:{get:function(){return this.w},set:function(t){this.w=t}}}),Object.assign(b.prototype,{isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*i+o[8]*n+o[12]*r,this.y=o[1]*e+o[5]*i+o[9]*n+o[13]*r,this.z=o[2]*e+o[6]*i+o[10]*n+o[14]*r,this.w=o[3]*e+o[7]*i+o[11]*n+o[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,i,n,r,o=t.elements,a=o[0],s=o[4],h=o[8],l=o[1],c=o[5],u=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(s-l)<.01&&Math.abs(h-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(h+d)<.1&&Math.abs(u+p)<.1&&Math.abs(a+c+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,v=(c+1)/2,g=(f+1)/2,_=(s+l)/4,y=(h+d)/4,x=(u+p)/4;return m>v&&m>g?m<.01?(i=0,n=.707106781,r=.707106781):(n=_/(i=Math.sqrt(m)),r=y/i):v>g?v<.01?(i=.707106781,n=0,r=.707106781):(i=_/(n=Math.sqrt(v)),r=x/n):g<.01?(i=.707106781,n=.707106781,r=0):(i=y/(r=Math.sqrt(g)),n=x/r),this.set(i,n,r,e),this}var b=Math.sqrt((p-u)*(p-u)+(h-d)*(h-d)+(l-s)*(l-s));return Math.abs(b)<.001&&(b=1),this.x=(p-u)/b,this.y=(h-d)/b,this.z=(l-s)/b,this.w=Math.acos((a+c+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),w.prototype=Object.assign(Object.create(u.prototype),{constructor:w,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),M.prototype=Object.assign(Object.create(w.prototype),{constructor:M,isWebGLMultisampleRenderTarget:!0,copy:function(t){return w.prototype.copy.call(this,t),this.samples=t.samples,this}}),Object.assign(T,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,o,a){var s=i[n+0],h=i[n+1],l=i[n+2],c=i[n+3],u=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(c!==f||s!==u||h!==d||l!==p){var m=1-a,v=s*u+h*d+l*p+c*f,g=v>=0?1:-1,_=1-v*v;if(_>Number.EPSILON){var y=Math.sqrt(_),x=Math.atan2(y,v*g);m=Math.sin(m*x)/y,a=Math.sin(a*x)/y}var b=a*g;if(s=s*m+u*b,h=h*m+d*b,l=l*m+p*b,c=c*m+f*b,m===1-a){var w=1/Math.sqrt(s*s+h*h+l*l+c*c);s*=w,h*=w,l*=w,c*=w}}t[e]=s,t[e+1]=h,t[e+2]=l,t[e+3]=c}}),Object.defineProperties(T.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign(T.prototype,{isQuaternion:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,n=t._y,r=t._z,o=t.order,a=Math.cos,s=Math.sin,h=a(i/2),l=a(n/2),c=a(r/2),u=s(i/2),d=s(n/2),p=s(r/2);return"XYZ"===o?(this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p):"YXZ"===o?(this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p):"ZXY"===o?(this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p):"ZYX"===o?(this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p):"YZX"===o?(this._x=u*l*c+h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c-u*d*p):"XZY"===o&&(this._x=u*l*c-h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c+u*d*p),!1!==e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,n=i[0],r=i[4],o=i[8],a=i[1],s=i[5],h=i[9],l=i[2],c=i[6],u=i[10],d=n+s+u;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(c-h)*e,this._y=(o-l)*e,this._z=(a-r)*e):n>s&&n>u?(e=2*Math.sqrt(1+n-s-u),this._w=(c-h)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+l)/e):s>u?(e=2*Math.sqrt(1+s-n-u),this._w=(o-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(h+c)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(a-r)/e,this._x=(o+l)/e,this._y=(h+c)/e,this._z=.25*e),this._onChangeCallback(),this},setFromUnitVectors:function(t,e){var i=t.dot(e)+1;return i<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(m.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var i=this.angleTo(t);if(0===i)return this;var n=Math.min(1,e/i);return this.slerp(t,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,o=t._w,a=e._x,s=e._y,h=e._z,l=e._w;return this._x=i*l+o*a+n*h-r*s,this._y=n*l+o*s+r*a-i*h,this._z=r*l+o*h+i*s-n*a,this._w=o*l-i*a-n*s-r*h,this._onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,o=this._w,a=o*t._w+i*t._x+n*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;var s=1-a*a;if(s<=Number.EPSILON){var h=1-e;return this._w=h*o+e*this._w,this._x=h*i+e*this._x,this._y=h*n+e*this._y,this._z=h*r+e*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),c=Math.atan2(l,a),u=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this._w=o*u+this._w*d,this._x=i*u+this._x*d,this._y=n*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}});var S=new L,E=new T;function L(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}Object.assign(L.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(E.setFromEuler(t))},applyAxisAngle:function(t,e){return this.applyQuaternion(E.setFromAxisAngle(t,e))},applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyNormalMatrix:function(t){return this.applyMatrix3(t).normalize()},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,a=t.z,s=t.w,h=s*e+o*n-a*i,l=s*i+a*e-r*n,c=s*n+r*i-o*e,u=-r*e-o*i-a*n;return this.x=h*s+u*-r+l*-a-c*-o,this.y=l*s+u*-o+c*-r-h*-a,this.z=c*s+u*-a+h*-o-l*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},projectOnVector:function(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);var i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)},projectOnPlane:function(t){return S.copy(this).projectOnVector(t),this.sub(S)},reflect:function(t){return this.sub(S.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(m.clamp(i,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,i){var n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},setFromMatrix3Column:function(t,e){return this.fromArray(t.elements,3*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}});var P=new L,A=new N,C=new L(0,0,0),R=new L(1,1,1),O=new L,z=new L,I=new L;function N(){this.elements=[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.")}Object.assign(N.prototype,{isMatrix4:!0,set:function(t,e,i,n,r,o,a,s,h,l,c,u,d,p,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=n,v[1]=r,v[5]=o,v[9]=a,v[13]=s,v[2]=h,v[6]=l,v[10]=c,v[14]=u,v[3]=d,v[7]=p,v[11]=f,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 N).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(t){var e=this.elements,i=t.elements,n=1/P.setFromMatrixColumn(t,0).length(),r=1/P.setFromMatrixColumn(t,1).length(),o=1/P.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i),a=Math.sin(i),s=Math.cos(n),h=Math.sin(n),l=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){var u=o*l,d=o*c,p=a*l,f=a*c;e[0]=s*l,e[4]=-s*c,e[8]=h,e[1]=d+p*h,e[5]=u-f*h,e[9]=-a*s,e[2]=f-u*h,e[6]=p+d*h,e[10]=o*s}else if("YXZ"===t.order){var m=s*l,v=s*c,g=h*l,_=h*c;e[0]=m+_*a,e[4]=g*a-v,e[8]=o*h,e[1]=o*c,e[5]=o*l,e[9]=-a,e[2]=v*a-g,e[6]=_+m*a,e[10]=o*s}else if("ZXY"===t.order){m=s*l,v=s*c,g=h*l,_=h*c;e[0]=m-_*a,e[4]=-o*c,e[8]=g+v*a,e[1]=v+g*a,e[5]=o*l,e[9]=_-m*a,e[2]=-o*h,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){u=o*l,d=o*c,p=a*l,f=a*c;e[0]=s*l,e[4]=p*h-d,e[8]=u*h+f,e[1]=s*c,e[5]=f*h+u,e[9]=d*h-p,e[2]=-h,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var y=o*s,x=o*h,b=a*s,w=a*h;e[0]=s*l,e[4]=w-y*c,e[8]=b*c+x,e[1]=c,e[5]=o*l,e[9]=-a*l,e[2]=-h*l,e[6]=x*c+b,e[10]=y-w*c}else if("XZY"===t.order){y=o*s,x=o*h,b=a*s,w=a*h;e[0]=s*l,e[4]=-c,e[8]=h*l,e[1]=y*c+w,e[5]=o*l,e[9]=x*c-b,e[2]=b*c-x,e[6]=a*l,e[10]=w*c+y}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){return this.compose(C,t,R)},lookAt:function(t,e,i){var n=this.elements;return I.subVectors(t,e),0===I.lengthSq()&&(I.z=1),I.normalize(),O.crossVectors(i,I),0===O.lengthSq()&&(1===Math.abs(i.z)?I.x+=1e-4:I.z+=1e-4,I.normalize(),O.crossVectors(i,I)),O.normalize(),z.crossVectors(I,O),n[0]=O.x,n[4]=z.x,n[8]=I.x,n[1]=O.y,n[5]=z.y,n[9]=I.y,n[2]=O.z,n[6]=z.z,n[10]=I.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,o=i[0],a=i[4],s=i[8],h=i[12],l=i[1],c=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],v=i[14],g=i[3],_=i[7],y=i[11],x=i[15],b=n[0],w=n[4],M=n[8],T=n[12],S=n[1],E=n[5],L=n[9],P=n[13],A=n[2],C=n[6],R=n[10],O=n[14],z=n[3],I=n[7],N=n[11],D=n[15];return r[0]=o*b+a*S+s*A+h*z,r[4]=o*w+a*E+s*C+h*I,r[8]=o*M+a*L+s*R+h*N,r[12]=o*T+a*P+s*O+h*D,r[1]=l*b+c*S+u*A+d*z,r[5]=l*w+c*E+u*C+d*I,r[9]=l*M+c*L+u*R+d*N,r[13]=l*T+c*P+u*O+d*D,r[2]=p*b+f*S+m*A+v*z,r[6]=p*w+f*E+m*C+v*I,r[10]=p*M+f*L+m*R+v*N,r[14]=p*T+f*P+m*O+v*D,r[3]=g*b+_*S+y*A+x*z,r[7]=g*w+_*E+y*C+x*I,r[11]=g*M+_*L+y*R+x*N,r[15]=g*T+_*P+y*O+x*D,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],o=t[1],a=t[5],s=t[9],h=t[13],l=t[2],c=t[6],u=t[10],d=t[14];return t[3]*(+r*s*c-n*h*c-r*a*u+i*h*u+n*a*d-i*s*d)+t[7]*(+e*s*d-e*h*u+r*o*u-n*o*d+n*h*l-r*s*l)+t[11]*(+e*h*c-e*a*d-r*o*c+i*o*d+r*a*l-i*h*l)+t[15]*(-n*a*l-e*s*c+e*a*u+n*o*c-i*o*u+i*s*l)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t,e,i){var n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this},getInverse:function(t,e){var i=this.elements,n=t.elements,r=n[0],o=n[1],a=n[2],s=n[3],h=n[4],l=n[5],c=n[6],u=n[7],d=n[8],p=n[9],f=n[10],m=n[11],v=n[12],g=n[13],_=n[14],y=n[15],x=p*_*u-g*f*u+g*c*m-l*_*m-p*c*y+l*f*y,b=v*f*u-d*_*u-v*c*m+h*_*m+d*c*y-h*f*y,w=d*g*u-v*p*u+v*l*m-h*g*m-d*l*y+h*p*y,M=v*p*c-d*g*c-v*l*f+h*g*f+d*l*_-h*p*_,T=r*x+o*b+a*w+s*M;if(0===T){var S="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(S);return console.warn(S),this.identity()}var E=1/T;return i[0]=x*E,i[1]=(g*f*s-p*_*s-g*a*m+o*_*m+p*a*y-o*f*y)*E,i[2]=(l*_*s-g*c*s+g*a*u-o*_*u-l*a*y+o*c*y)*E,i[3]=(p*c*s-l*f*s-p*a*u+o*f*u+l*a*m-o*c*m)*E,i[4]=b*E,i[5]=(d*_*s-v*f*s+v*a*m-r*_*m-d*a*y+r*f*y)*E,i[6]=(v*c*s-h*_*s-v*a*u+r*_*u+h*a*y-r*c*y)*E,i[7]=(h*f*s-d*c*s+d*a*u-r*f*u-h*a*m+r*c*m)*E,i[8]=w*E,i[9]=(v*p*s-d*g*s-v*o*m+r*g*m+d*o*y-r*p*y)*E,i[10]=(h*g*s-v*l*s+v*o*u-r*g*u-h*o*y+r*l*y)*E,i[11]=(d*l*s-h*p*s-d*o*u+r*p*u+h*o*m-r*l*m)*E,i[12]=M*E,i[13]=(d*g*a-v*p*a+v*o*f-r*g*f-d*o*_+r*p*_)*E,i[14]=(v*l*a-h*g*a-v*o*c+r*g*c+h*o*_-r*l*_)*E,i[15]=(h*p*a-d*l*a+d*o*c-r*p*c-h*o*f+r*l*f)*E,this},scale:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,o=t.x,a=t.y,s=t.z,h=r*o,l=r*a;return this.set(h*o+i,h*a-n*s,h*s+n*a,0,h*a+n*s,l*a+i,l*s-n*o,0,h*s-n*a,l*s+n*o,r*s*s+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,i){var n=this.elements,r=e._x,o=e._y,a=e._z,s=e._w,h=r+r,l=o+o,c=a+a,u=r*h,d=r*l,p=r*c,f=o*l,m=o*c,v=a*c,g=s*h,_=s*l,y=s*c,x=i.x,b=i.y,w=i.z;return n[0]=(1-(f+v))*x,n[1]=(d+y)*x,n[2]=(p-_)*x,n[3]=0,n[4]=(d-y)*b,n[5]=(1-(u+v))*b,n[6]=(m+g)*b,n[7]=0,n[8]=(p+_)*w,n[9]=(m-g)*w,n[10]=(1-(u+f))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this},decompose:function(t,e,i){var n=this.elements,r=P.set(n[0],n[1],n[2]).length(),o=P.set(n[4],n[5],n[6]).length(),a=P.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],A.copy(this);var s=1/r,h=1/o,l=1/a;return A.elements[0]*=s,A.elements[1]*=s,A.elements[2]*=s,A.elements[4]*=h,A.elements[5]*=h,A.elements[6]*=h,A.elements[8]*=l,A.elements[9]*=l,A.elements[10]*=l,e.setFromRotationMatrix(A),i.x=r,i.y=o,i.z=a,this},makePerspective:function(t,e,i,n,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*r/(e-t),h=2*r/(i-n),l=(e+t)/(e-t),c=(i+n)/(i-n),u=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=s,a[4]=0,a[8]=l,a[12]=0,a[1]=0,a[5]=h,a[9]=c,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,i,n,r,o){var a=this.elements,s=1/(e-t),h=1/(i-n),l=1/(o-r),c=(e+t)*s,u=(i+n)*h,d=(o+r)*l;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-c,a[1]=0,a[5]=2*h,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*l,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}});var D=new N,B=new T;function k(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._order=n||k.DefaultOrder}function U(){this.mask=1}k.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],k.DefaultOrder="XYZ",Object.defineProperties(k.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}}),Object.assign(k.prototype,{isEuler:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var n=m.clamp,r=t.elements,o=r[0],a=r[4],s=r[8],h=r[1],l=r[5],c=r[9],u=r[2],d=r[6],p=r[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-u,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(h,o))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(h,o)):(this._x=0,this._z=Math.atan2(-a,l))):"YZX"===e?(this._z=Math.asin(n(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e?(this._z=Math.asin(-n(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-c,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==i&&this._onChangeCallback(),this},setFromQuaternion:function(t,e,i){return D.makeRotationFromQuaternion(t),this.setFromRotationMatrix(D,e,i)},setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(t){return B.setFromEuler(this),this.setFromQuaternion(B,t)},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new L(this._x,this._y,this._z)},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}}),Object.assign(U.prototype,{set:function(t){this.mask=1<1){for(var e=0;e1){for(var e=0;e0){n.children=[];for(s=0;s0&&(i.geometries=u),d.length>0&&(i.materials=d),p.length>0&&(i.textures=p),f.length>0&&(i.images=f),a.length>0&&(i.shapes=a)}return i.object=n,i;function m(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var i=0;is)return!1}return!0}Object.assign(ft.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,h=t.length;sr&&(r=l),c>o&&(o=c),u>a&&(a=u)}return this.min.set(e,i,n),this.max.set(r,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,h=t.count;sr&&(r=l),c>o&&(o=c),u>a&&(a=u)}return this.min.set(e,i,n),this.max.set(r,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new L),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(t){return this.clampPoint(t.center,it),it.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant},intersectsTriangle:function(t){if(this.isEmpty())return!1;this.getCenter(ct),ut.subVectors(this.max,ct),rt.subVectors(t.a,ct),ot.subVectors(t.b,ct),at.subVectors(t.c,ct),st.subVectors(ot,rt),ht.subVectors(at,ot),lt.subVectors(rt,at);var e=[0,-st.z,st.y,0,-ht.z,ht.y,0,-lt.z,lt.y,st.z,0,-st.x,ht.z,0,-ht.x,lt.z,0,-lt.x,-st.y,st.x,0,-ht.y,ht.x,0,-lt.y,lt.x,0];return!!mt(e,rt,ot,at,ut)&&(!!mt(e=[1,0,0,0,1,0,0,0,1],rt,ot,at,ut)&&(dt.crossVectors(st,ht),mt(e=[dt.x,dt.y,dt.z],rt,ot,at,ut)))},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new L),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return it.copy(t).clamp(this.min,this.max).sub(t).length()},getBoundingSphere:function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(it).length(),t},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){return this.isEmpty()||(et[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),et[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),et[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),et[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),et[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),et[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),et[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),et[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(et)),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var vt=new ft;function gt(t,e){this.center=void 0!==t?t:new L,this.radius=void 0!==e?e:0}Object.assign(gt.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(t,e){var i=this.center;void 0!==e?i.copy(e):vt.setFromPoints(t).getCenter(i);for(var n=0,r=0,o=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new ft),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}});var _t=new L,yt=new L,xt=new L,bt=new L,wt=new L,Mt=new L,Tt=new L;function St(t,e){this.origin=void 0!==t?t:new L,this.direction=void 0!==e?e:new L(0,0,-1)}Object.assign(St.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new L),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(t){return this.origin.copy(this.at(t,_t)),this},closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new L),e.subVectors(t,this.origin);var i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(t){var e=_t.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(_t.copy(this.direction).multiplyScalar(e).add(this.origin),_t.distanceToSquared(t))},distanceSqToSegment:function(t,e,i,n){yt.copy(t).add(e).multiplyScalar(.5),xt.copy(e).sub(t).normalize(),bt.copy(this.origin).sub(yt);var r,o,a,s,h=.5*t.distanceTo(e),l=-this.direction.dot(xt),c=bt.dot(this.direction),u=-bt.dot(xt),d=bt.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(o=l*c-u,s=h*p,(r=l*u-c)>=0)if(o>=-s)if(o<=s){var f=1/p;a=(r*=f)*(r+l*(o*=f)+2*c)+o*(l*r+o+2*u)+d}else o=h,a=-(r=Math.max(0,-(l*o+c)))*r+o*(o+2*u)+d;else o=-h,a=-(r=Math.max(0,-(l*o+c)))*r+o*(o+2*u)+d;else o<=-s?a=-(r=Math.max(0,-(-l*h+c)))*r+(o=r>0?-h:Math.min(Math.max(-h,-u),h))*(o+2*u)+d:o<=s?(r=0,a=(o=Math.min(Math.max(-h,-u),h))*(o+2*u)+d):a=-(r=Math.max(0,-(l*h+c)))*r+(o=r>0?h:Math.min(Math.max(-h,-u),h))*(o+2*u)+d;else o=l>0?-h:h,a=-(r=Math.max(0,-(l*o+c)))*r+o*(o+2*u)+d;return i&&i.copy(this.direction).multiplyScalar(r).add(this.origin),n&&n.copy(xt).multiplyScalar(o).add(yt),a},intersectSphere:function(t,e){_t.subVectors(t.center,this.origin);var i=_t.dot(this.direction),n=_t.dot(_t)-i*i,r=t.radius*t.radius;if(n>r)return null;var o=Math.sqrt(r-n),a=i-o,s=i+o;return a<0&&s<0?null:a<0?this.at(s,e):this.at(a,e)},intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var i,n,r,o,a,s,h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(i=(t.min.x-u.x)*h,n=(t.max.x-u.x)*h):(i=(t.max.x-u.x)*h,n=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,o=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,o=(t.min.y-u.y)*l),i>o||r>n?null:((r>i||i!=i)&&(i=r),(o=0?(a=(t.min.z-u.z)*c,s=(t.max.z-u.z)*c):(a=(t.max.z-u.z)*c,s=(t.min.z-u.z)*c),i>s||a>n?null:((a>i||i!=i)&&(i=a),(s=0?i:n,e)))},intersectsBox:function(t){return null!==this.intersectBox(t,_t)},intersectTriangle:function(t,e,i,n,r){wt.subVectors(e,t),Mt.subVectors(i,t),Tt.crossVectors(wt,Mt);var o,a=this.direction.dot(Tt);if(a>0){if(n)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}bt.subVectors(this.origin,t);var s=o*this.direction.dot(Mt.crossVectors(bt,Mt));if(s<0)return null;var h=o*this.direction.dot(wt.cross(bt));if(h<0)return null;if(s+h>a)return null;var l=-o*bt.dot(Tt);return l<0?null:this.at(l/a,r)},applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}});var Et=new L,Lt=new L,Pt=new g;function At(t,e){this.normal=void 0!==t?t:new L(1,0,0),this.constant=void 0!==e?e:0}Object.assign(At.prototype,{isPlane:!0,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(t,e,i){var n=Et.subVectors(i,e).cross(Lt.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new L),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new L);var i=t.delta(Et),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;var r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?void 0:e.copy(i).multiplyScalar(r).add(t.start)},intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new L),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(t,e){var i=e||Pt.getNormalMatrix(t),n=this.coplanarPoint(Et).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this},translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}});var Ct=new L,Rt=new L,Ot=new L,zt=new L,It=new L,Nt=new L,Dt=new L,Bt=new L,kt=new L,Ut=new L;function Ft(t,e,i){this.a=void 0!==t?t:new L,this.b=void 0!==e?e:new L,this.c=void 0!==i?i:new L}Object.assign(Ft,{getNormal:function(t,e,i,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new L),n.subVectors(i,e),Ct.subVectors(t,e),n.cross(Ct);var r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)},getBarycoord:function(t,e,i,n,r){Ct.subVectors(n,e),Rt.subVectors(i,e),Ot.subVectors(t,e);var o=Ct.dot(Ct),a=Ct.dot(Rt),s=Ct.dot(Ot),h=Rt.dot(Rt),l=Rt.dot(Ot),c=o*h-a*a;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new L),0===c)return r.set(-2,-1,-1);var u=1/c,d=(h*s-a*l)*u,p=(o*l-a*s)*u;return r.set(1-d-p,p,d)},containsPoint:function(t,e,i,n){return Ft.getBarycoord(t,e,i,n,zt),zt.x>=0&&zt.y>=0&&zt.x+zt.y<=1},getUV:function(t,e,i,n,r,o,a,s){return this.getBarycoord(t,e,i,n,zt),s.set(0,0),s.addScaledVector(r,zt.x),s.addScaledVector(o,zt.y),s.addScaledVector(a,zt.z),s},isFrontFacing:function(t,e,i,n){return Ct.subVectors(i,e),Rt.subVectors(t,e),Ct.cross(Rt).dot(n)<0}}),Object.assign(Ft.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){return Ct.subVectors(this.c,this.b),Rt.subVectors(this.a,this.b),.5*Ct.cross(Rt).length()},getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new L),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return Ft.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new At),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return Ft.getBarycoord(t,this.a,this.b,this.c,e)},getUV:function(t,e,i,n,r){return Ft.getUV(t,this.a,this.b,this.c,e,i,n,r)},containsPoint:function(t){return Ft.containsPoint(t,this.a,this.b,this.c)},isFrontFacing:function(t){return Ft.isFrontFacing(this.a,this.b,this.c,t)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new L);var i,n,r=this.a,o=this.b,a=this.c;It.subVectors(o,r),Nt.subVectors(a,r),Bt.subVectors(t,r);var s=It.dot(Bt),h=Nt.dot(Bt);if(s<=0&&h<=0)return e.copy(r);kt.subVectors(t,o);var l=It.dot(kt),c=Nt.dot(kt);if(l>=0&&c<=l)return e.copy(o);var u=s*c-l*h;if(u<=0&&s>=0&&l<=0)return i=s/(s-l),e.copy(r).addScaledVector(It,i);Ut.subVectors(t,a);var d=It.dot(Ut),p=Nt.dot(Ut);if(p>=0&&d<=p)return e.copy(a);var f=d*h-s*p;if(f<=0&&h>=0&&p<=0)return n=h/(h-p),e.copy(r).addScaledVector(Nt,n);var m=l*p-d*c;if(m<=0&&c-l>=0&&d-p>=0)return Dt.subVectors(a,o),n=(c-l)/(c-l+(d-p)),e.copy(o).addScaledVector(Dt,n);var v=1/(m+f+u);return i=f*v,n=u*v,e.copy(r).addScaledVector(It,i).addScaledVector(Nt,n)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}});var Ht={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},jt={h:0,s:0,l:0},Gt={h:0,s:0,l:0};function Vt(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}function Wt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function Zt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function qt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function Xt(t,e,i,n,r,o){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new L,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new Vt,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0}Object.assign(Vt.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(t,e,i){if(t=m.euclideanModulo(t,1),e=m.clamp(e,0,1),i=m.clamp(i,0,1),0===e)this.r=this.g=this.b=i;else{var n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Wt(r,n,t+1/3),this.g=Wt(r,n,t),this.b=Wt(r,n,t-1/3)}return this},setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,h=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(a,s,h)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l=i[1],c=l.length;if(3===c)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this},setColorName:function(t){var e=Ht[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(t){return this.r=Zt(t.r),this.g=Zt(t.g),this.b=Zt(t.b),this},copyLinearToSRGB:function(t){return this.r=qt(t.r),this.g=qt(t.g),this.b=qt(t.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),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(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,i,n=this.r,r=this.g,o=this.b,a=Math.max(n,r,o),s=Math.min(n,r,o),h=(s+a)/2;if(s===a)e=0,i=0;else{var l=a-s;switch(i=h<=.5?l/(a+s):l/(2-a-s),a){case n:e=(r-o)/l+(r0&&(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),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.morphNormals&&(i.morphNormals=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){var r=n(t.textures),o=n(t.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Jt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Kt.prototype=Object.create(Jt.prototype),Kt.prototype.constructor=Kt,Kt.prototype.isMeshBasicMaterial=!0,Kt.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this};var Qt=new L;function $t(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function te(t,e,i){$t.call(this,new Int8Array(t),e,i)}function ee(t,e,i){$t.call(this,new Uint8Array(t),e,i)}function ie(t,e,i){$t.call(this,new Uint8ClampedArray(t),e,i)}function ne(t,e,i){$t.call(this,new Int16Array(t),e,i)}function re(t,e,i){$t.call(this,new Uint16Array(t),e,i)}function oe(t,e,i){$t.call(this,new Int32Array(t),e,i)}function ae(t,e,i){$t.call(this,new Uint32Array(t),e,i)}function se(t,e,i){$t.call(this,new Float32Array(t),e,i)}function he(t,e,i){$t.call(this,new Float64Array(t),e,i)}function le(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function ce(t){if(0===t.length)return-1/0;for(var e=t[0],i=1,n=t.length;ie&&(e=t[i]);return e}Object.defineProperty($t.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign($t.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n0,a=r[1]&&r[1].length>0,s=t.morphTargets,h=s.length;if(h>0){e=[];for(var l=0;l0){c=[];for(l=0;l0&&0===i.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l65535?ae:re)(t,1):this.index=t},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){var e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);var i=this.attributes.normal;if(void 0!==i){var n=(new g).getNormalMatrix(t);i.applyNormalMatrix(n),i.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return de.makeRotationX(t),this.applyMatrix4(de),this},rotateY:function(t){return de.makeRotationY(t),this.applyMatrix4(de),this},rotateZ:function(t){return de.makeRotationZ(t),this.applyMatrix4(de),this},translate:function(t,e,i){return de.makeTranslation(t,e,i),this.applyMatrix4(de),this},scale:function(t,e,i){return de.makeScale(t,e,i),this.applyMatrix4(de),this},lookAt:function(t){return pe.lookAt(t),pe.updateMatrix(),this.applyMatrix4(pe.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(fe).negate(),this.translate(fe.x,fe.y,fe.z),this},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var i=new se(3*e.vertices.length,3),n=new se(3*e.colors.length,3);if(this.setAttribute("position",i.copyVector3sArray(e.vertices)),this.setAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new se(e.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],i=0,n=t.length;i0){var i=new Float32Array(3*t.normals.length);this.setAttribute("normal",new $t(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.setAttribute("color",new $t(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.setAttribute("uv",new $t(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.setAttribute("uv2",new $t(o,2).copyVector2sArray(t.uvs2))}for(var a in this.groups=t.groups,t.morphTargets){for(var s=[],h=t.morphTargets[a],l=0,c=h.length;l0){var p=new se(4*t.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var f=new se(4*t.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ft);var t=this.attributes.position,e=this.morphAttributes.position;if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(var i=0,n=e.length;i0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};var n=this.index;null!==n&&(t.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});var r=this.attributes;for(var i in r){var o=(d=r[i]).toJSON();""!==d.name&&(o.name=d.name),t.data.attributes[i]=o}var a={},s=!1;for(var i in this.morphAttributes){for(var h=this.morphAttributes[i],l=[],c=0,u=h.length;c0&&(a[i]=l,s=!0)}s&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(t.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t},clone:function(){return(new _e).copy(this)},copy:function(t){var e,i,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var o=t.attributes;for(e in o){var a=o[e];this.setAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var h=[],l=s[e];for(i=0,n=l.length;ii.far?null:{distance:h,point:Ne.clone(),object:t}}function ke(t,e,i,n,r,o,a,s,h,l,c,u){we.fromBufferAttribute(r,l),Me.fromBufferAttribute(r,c),Te.fromBufferAttribute(r,u);var d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){Pe.set(0,0,0),Ae.set(0,0,0),Ce.set(0,0,0);for(var p=0,f=o.length;p0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=a.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){var i,n=this.geometry,r=this.material,o=this.matrixWorld;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),be.copy(n.boundingSphere),be.applyMatrix4(o),!1!==t.ray.intersectsSphere(be)&&(ye.getInverse(o),xe.copy(t.ray).applyMatrix4(ye),null===n.boundingBox||!1!==xe.intersectsBox(n.boundingBox))))if(n.isBufferGeometry){var a,s,h,l,c,u,d,p,f,m=n.index,g=n.attributes.position,_=n.morphAttributes.position,y=n.morphTargetsRelative,x=n.attributes.uv,b=n.attributes.uv2,w=n.groups,M=n.drawRange;if(null!==m)if(Array.isArray(r))for(l=0,u=w.length;l0&&(L=R);for(var O=0,z=C.length;O0)for(l=0;l0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i=0;i--){var f=d[i];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a0,v=p.vertexNormals.length>0,g=1!==p.color.r||1!==p.color.g||1!==p.color.b,_=p.vertexColors.length>0,y=0;if(y=M(y,0,0),y=M(y,1,!0),y=M(y,2,!1),y=M(y,3,f),y=M(y,4,m),y=M(y,5,v),y=M(y,6,g),y=M(y,7,_),a.push(y),a.push(p.a,p.b,p.c),a.push(p.materialIndex),f){var x=this.faceVertexUvs[0][r];a.push(E(x[0]),E(x[1]),E(x[2]))}if(m&&a.push(T(p.normal)),v){var b=p.vertexNormals;a.push(T(b[0]),T(b[1]),T(b[2]))}if(g&&a.push(S(p.color)),_){var w=p.vertexColors;a.push(S(w[0]),S(w[1]),S(w[2]))}}function M(t,e,i){return i?t|1<0&&(t.data.colors=l),u.length>0&&(t.data.uvs=[u]),t.data.faces=a,t},clone:function(){return(new Ge).copy(this)},copy:function(t){var e,i,n,r,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,i=s.length;e0?1:-1,l.push(C.x,C.y,C.z),c.push(_/m),c.push(1-y/v),P+=1}}for(y=0;y0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var r={};for(var o in this.extensions)!0===this.extensions[o]&&(r[o]=!0);return Object.keys(r).length>0&&(e.extensions=r),e},Ye.prototype=Object.assign(Object.create($.prototype),{constructor:Ye,isCamera:!0,copy:function(t,e){return $.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new L),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){$.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(t,e){$.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Je.prototype=Object.assign(Object.create(Ye.prototype),{constructor:Je,isPerspectiveCamera:!0,copy:function(t,e){return Ye.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*m.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*m.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*m.RAD2DEG*Math.atan(Math.tan(.5*m.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*m.DEG2RAD*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;r+=o.offsetX*n/a,e-=o.offsetY*i/s,n*=o.width/a,i*=o.height/s}var h=this.filmOffset;0!==h&&(r+=t*h/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=$.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});function Ke(t,e,i,n){$.call(this),this.type="CubeCamera";var r=new Je(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new L(1,0,0)),this.add(r);var o=new Je(90,1,t,e);o.up.set(0,-1,0),o.lookAt(new L(-1,0,0)),this.add(o);var a=new Je(90,1,t,e);a.up.set(0,0,1),a.lookAt(new L(0,1,0)),this.add(a);var s=new Je(90,1,t,e);s.up.set(0,0,-1),s.lookAt(new L(0,-1,0)),this.add(s);var h=new Je(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new L(0,0,1)),this.add(h);var l=new Je(90,1,t,e);l.up.set(0,-1,0),l.lookAt(new L(0,0,-1)),this.add(l),n=n||{format:1022,magFilter:1006,minFilter:1006},this.renderTarget=new Qe(i,n),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var i=t.getRenderTarget(),n=this.renderTarget,c=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,o),t.setRenderTarget(n,2),t.render(e,a),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,h),n.texture.generateMipmaps=c,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(i)},this.clear=function(t,e,i,n){for(var r=t.getRenderTarget(),o=this.renderTarget,a=0;a<6;a++)t.setRenderTarget(o,a),t.clear(e,i,n);t.setRenderTarget(r)}}function Qe(t,e,i){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=i),w.call(this,t,t,e)}function $e(t,e,i,n,r,o,a,s,h,l,c,u){x.call(this,null,o,a,s,h,l,n,r,c,u),this.image={data:t||null,width:e||1,height:i||1},this.magFilter=void 0!==h?h:1003,this.minFilter=void 0!==l?l:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Ke.prototype=Object.create($.prototype),Ke.prototype.constructor=Ke,Qe.prototype=Object.create(w.prototype),Qe.prototype.constructor=Qe,Qe.prototype.isWebGLCubeRenderTarget=!0,Qe.prototype.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=e.format,this.texture.encoding=e.encoding;var i=new tt,n={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include ","\t#include ","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new Xe({type:"CubemapFromEquirect",uniforms:We(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;var o=new De(new Ve(5,5,5),r);i.add(o);var a=new Ke(1,10,1);return a.renderTarget=this,a.renderTarget.texture.name="CubeCameraTexture",a.update(t,i),o.geometry.dispose(),o.material.dispose(),this},$e.prototype=Object.create(x.prototype),$e.prototype.constructor=$e,$e.prototype.isDataTexture=!0;var ti=new gt,ei=new L;function ii(t,e,i,n,r,o){this.planes=[void 0!==t?t:new At,void 0!==e?e:new At,void 0!==i?i:new At,void 0!==n?n:new At,void 0!==r?r:new At,void 0!==o?o:new At]}Object.assign(ii.prototype,{set:function(t,e,i,n,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromProjectionMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],o=i[2],a=i[3],s=i[4],h=i[5],l=i[6],c=i[7],u=i[8],d=i[9],p=i[10],f=i[11],m=i[12],v=i[13],g=i[14],_=i[15];return e[0].setComponents(a-n,c-s,f-u,_-m).normalize(),e[1].setComponents(a+n,c+s,f+u,_+m).normalize(),e[2].setComponents(a+r,c+h,f+d,_+v).normalize(),e[3].setComponents(a-r,c-h,f-d,_-v).normalize(),e[4].setComponents(a-o,c-l,f-p,_-g).normalize(),e[5].setComponents(a+o,c+l,f+p,_+g).normalize(),this},intersectsObject:function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),ti.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(ti)},intersectsSprite:function(t){return ti.center.set(0,0,0),ti.radius=.7071067811865476,ti.applyMatrix4(t.matrixWorld),this.intersectsSphere(ti)},intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(i)0?t.max.x:t.min.x,ei.y=n.normal.y>0?t.max.y:t.min.y,ei.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(ei)<0)return!1}return!0},containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}});var ni={common:{diffuse:{value:new Vt(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new g},uv2Transform:{value:new g},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new v(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Vt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Vt(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new g}},sprite:{diffuse:{value:new Vt(15658734)},opacity:{value:1},center:{value:new v(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new g}}};function ri(){var t=null,e=!1,i=null;function n(r,o){!1!==e&&(i(r,o),t.requestAnimationFrame(n))}return{start:function(){!0!==e&&null!==i&&(t.requestAnimationFrame(n),e=!0)},stop:function(){e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function oi(t,e){var i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){e.isInterleavedBufferAttribute&&(e=e.data);var o=n.get(e);void 0===o?n.set(e,function(e,i){var n=e.array,r=e.usage,o=t.createBuffer();t.bindBuffer(i,o),t.bufferData(i,n,r),e.onUploadCallback();var a=5126;return n instanceof Float32Array?a=5126:n instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):n instanceof Uint16Array?a=5123:n instanceof Int16Array?a=5122:n instanceof Uint32Array?a=5125:n instanceof Int32Array?a=5124:n instanceof Int8Array?a=5120:n instanceof Uint8Array&&(a=5121),{buffer:o,type:a,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version}}(e,r)):o.version 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\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}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\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#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP ) && ! defined( TOON )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP ) && ! defined( TOON )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP ) && ! defined( TOON )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(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}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\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#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, 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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = 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\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\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",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 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 roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\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",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",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 = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\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};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\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};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * 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_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",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)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = max( clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\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 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\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}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 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\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.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\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\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#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * 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 defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\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 *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#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 );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\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}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), 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( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), 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 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\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",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\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 highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",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\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",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\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).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\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\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 \nvarying vec2 vHighPrecisionZW;\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\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\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#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \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}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\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 \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#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\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 \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\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\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 \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\t#include \n}",meshtoon_vert:"#define TOON\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}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\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\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\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}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\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}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},li={basic:{uniforms:Ze([ni.common,ni.specularmap,ni.envmap,ni.aomap,ni.lightmap,ni.fog]),vertexShader:hi.meshbasic_vert,fragmentShader:hi.meshbasic_frag},lambert:{uniforms:Ze([ni.common,ni.specularmap,ni.envmap,ni.aomap,ni.lightmap,ni.emissivemap,ni.fog,ni.lights,{emissive:{value:new Vt(0)}}]),vertexShader:hi.meshlambert_vert,fragmentShader:hi.meshlambert_frag},phong:{uniforms:Ze([ni.common,ni.specularmap,ni.envmap,ni.aomap,ni.lightmap,ni.emissivemap,ni.bumpmap,ni.normalmap,ni.displacementmap,ni.fog,ni.lights,{emissive:{value:new Vt(0)},specular:{value:new Vt(1118481)},shininess:{value:30}}]),vertexShader:hi.meshphong_vert,fragmentShader:hi.meshphong_frag},standard:{uniforms:Ze([ni.common,ni.envmap,ni.aomap,ni.lightmap,ni.emissivemap,ni.bumpmap,ni.normalmap,ni.displacementmap,ni.roughnessmap,ni.metalnessmap,ni.fog,ni.lights,{emissive:{value:new Vt(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:hi.meshphysical_vert,fragmentShader:hi.meshphysical_frag},toon:{uniforms:Ze([ni.common,ni.specularmap,ni.aomap,ni.lightmap,ni.emissivemap,ni.bumpmap,ni.normalmap,ni.displacementmap,ni.gradientmap,ni.fog,ni.lights,{emissive:{value:new Vt(0)},specular:{value:new Vt(1118481)},shininess:{value:30}}]),vertexShader:hi.meshtoon_vert,fragmentShader:hi.meshtoon_frag},matcap:{uniforms:Ze([ni.common,ni.bumpmap,ni.normalmap,ni.displacementmap,ni.fog,{matcap:{value:null}}]),vertexShader:hi.meshmatcap_vert,fragmentShader:hi.meshmatcap_frag},points:{uniforms:Ze([ni.points,ni.fog]),vertexShader:hi.points_vert,fragmentShader:hi.points_frag},dashed:{uniforms:Ze([ni.common,ni.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hi.linedashed_vert,fragmentShader:hi.linedashed_frag},depth:{uniforms:Ze([ni.common,ni.displacementmap]),vertexShader:hi.depth_vert,fragmentShader:hi.depth_frag},normal:{uniforms:Ze([ni.common,ni.bumpmap,ni.normalmap,ni.displacementmap,{opacity:{value:1}}]),vertexShader:hi.normal_vert,fragmentShader:hi.normal_frag},sprite:{uniforms:Ze([ni.sprite,ni.fog]),vertexShader:hi.sprite_vert,fragmentShader:hi.sprite_frag},background:{uniforms:{uvTransform:{value:new g},t2D:{value:null}},vertexShader:hi.background_vert,fragmentShader:hi.background_frag},cube:{uniforms:Ze([ni.envmap,{opacity:{value:1}}]),vertexShader:hi.cube_vert,fragmentShader:hi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hi.equirect_vert,fragmentShader:hi.equirect_frag},distanceRGBA:{uniforms:Ze([ni.common,ni.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hi.distanceRGBA_vert,fragmentShader:hi.distanceRGBA_frag},shadow:{uniforms:Ze([ni.lights,ni.fog,{color:{value:new Vt(0)},opacity:{value:1}}]),vertexShader:hi.shadow_vert,fragmentShader:hi.shadow_frag}};function ci(t,e,i,n){var r,o,a=new Vt(0),s=0,h=null,l=0,c=null;function u(t,i){e.buffers.color.setClear(t.r,t.g,t.b,i,n)}return{getClearColor:function(){return a},setClearColor:function(t,e){a.set(t),u(a,s=void 0!==e?e:1)},getClearAlpha:function(){return s},setClearAlpha:function(t){u(a,s=t)},render:function(e,n,d,p){var f=n.background,m=t.xr,v=m.getSession&&m.getSession();if(v&&"additive"===v.environmentBlendMode&&(f=null),null===f?u(a,s):f&&f.isColor&&(u(f,1),p=!0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||306===f.mapping)){void 0===o&&((o=new De(new Ve(1,1,1),new Xe({type:"BackgroundCubeMaterial",uniforms:We(li.cube.uniforms),vertexShader:li.cube.vertexShader,fragmentShader:li.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o));var g=f.isWebGLCubeRenderTarget?f.texture:f;o.material.uniforms.envMap.value=g,o.material.uniforms.flipEnvMap.value=g.isCubeTexture?-1:1,h===f&&l===g.version&&c===t.toneMapping||(o.material.needsUpdate=!0,h=f,l=g.version,c=t.toneMapping),e.unshift(o,o.geometry,o.material,0,0,null)}else f&&f.isTexture&&(void 0===r&&((r=new De(new si(2,2),new Xe({type:"BackgroundMaterial",uniforms:We(li.background.uniforms),vertexShader:li.background.vertexShader,fragmentShader:li.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(r)),r.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),r.material.uniforms.uvTransform.value.copy(f.matrix),h===f&&l===f.version&&c===t.toneMapping||(r.material.needsUpdate=!0,h=f,l=f.version,c=t.toneMapping),e.unshift(r,r.geometry,r.material,0,0,null))}}}function ui(t,e,i,n){var r,o=n.isWebGL2;this.setMode=function(t){r=t},this.render=function(e,n){t.drawArrays(r,e,n),i.update(n,r)},this.renderInstances=function(n,a,s,h){if(0!==h){var l,c;if(o)l=t,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](r,a,s,h),i.update(s,r,h)}}}function di(t,e,i){var n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext,a=void 0!==i.precision?i.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var h=!0===i.logarithmicDepthBuffer,l=t.getParameter(34930),c=t.getParameter(35660),u=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),v=t.getParameter(36349),g=c>0,_=o||!!e.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==n)return n;var i=e.get("EXT_texture_filter_anisotropic");return n=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:h,maxTextures:l,maxVertexTextures:c,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:_,floatVertexTextures:g&&_,maxSamples:o?t.getParameter(36183):0}}function pi(){var t=this,e=null,i=0,n=!1,r=!1,o=new At,a=new g,s={value:null,needsUpdate:!1};function h(){s.value!==e&&(s.value=e,s.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function l(e,i,n,r){var h=null!==e?e.length:0,l=null;if(0!==h){if(l=s.value,!0!==r||null===l){var c=n+4*h,u=i.matrixWorldInverse;a.getNormalMatrix(u),(null===l||l.length65535?ae:re)(i,1);p.version=a,e.update(p,34963);var f=r.get(t);f&&e.remove(f),r.set(t,p)}return{get:function(t,e){var r=n.get(e);return r||(e.addEventListener("dispose",o),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new _e).setFromObject(t)),r=e._bufferGeometry),n.set(e,r),i.memory.geometries++,r)},update:function(t){var i=t.index,n=t.attributes;for(var r in null!==i&&e.update(i,34963),n)e.update(n[r],34962);var o=t.morphAttributes;for(var r in o)for(var a=o[r],s=0,h=a.length;s0)return t;var r=e*i,o=Pi[r];if(void 0===o&&(o=new Float32Array(r),Pi[r]=o),0!==e){n.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=i,t[a].toArray(o,s)}return o}function Ii(t,e){if(t.length!==e.length)return!1;for(var i=0,n=t.length;i/gm;function Cn(t){return t.replace(An,Rn)}function Rn(t,e){var i=hi[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Cn(i)}var On=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function zn(t){return t.replace(On,In)}function In(t,e,i,n){for(var r="",o=parseInt(e);o0?t.gammaFactor:1,g=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(En).join("\n")}(i),_=function(t){var e=[];for(var i in t){var n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(l),y=h.createProgram();if(i.isRawShaderMaterial?((n=[_].filter(En).join("\n")).length>0&&(n+="\n"),(r=[g,_].filter(En).join("\n")).length>0&&(r+="\n")):(n=[Nn(i),"#define SHADER_NAME "+i.shaderName,_,i.instancing?"#define USE_INSTANCING":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+v,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+f:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#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(En).join("\n"),r=[g,Nn(i),"#define SHADER_NAME "+i.shaderName,_,i.alphaTest?"#define ALPHATEST "+i.alphaTest+(i.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+v,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+p:"",i.envMap?"#define "+f:"",i.envMap?"#define "+m:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.sheen?"#define USE_SHEEN":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensionShaderTextureLOD||i.envMap)&&i.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?hi.tonemapping_pars_fragment:"",0!==i.toneMapping?Sn("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.outputEncoding||i.mapEncoding||i.matcapEncoding||i.envMapEncoding||i.emissiveMapEncoding||i.lightMapEncoding?hi.encodings_pars_fragment:"",i.mapEncoding?Tn("mapTexelToLinear",i.mapEncoding):"",i.matcapEncoding?Tn("matcapTexelToLinear",i.matcapEncoding):"",i.envMapEncoding?Tn("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?Tn("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.lightMapEncoding?Tn("lightMapTexelToLinear",i.lightMapEncoding):"",i.outputEncoding?(o="linearToOutputTexel",a=i.outputEncoding,s=wn(a),"vec4 "+o+"( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"):"",i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(En).join("\n")),c=Pn(c=Ln(c=Cn(c),i),i),u=Pn(u=Ln(u=Cn(u),i),i),c=zn(c),u=zn(u),i.isWebGL2&&!i.isRawShaderMaterial){var x=!1,b=/^\s*#version\s+300\s+es\s*\n/;i.isShaderMaterial&&null!==c.match(b)&&null!==u.match(b)&&(x=!0,c=c.replace(b,""),u=u.replace(b,"")),n=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+n,r=["#version 300 es\n","#define varying in",x?"":"out highp vec4 pc_fragColor;",x?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+r}var w,M,T=r+u,S=xn(h,35633,n+c),E=xn(h,35632,T);if(h.attachShader(y,S),h.attachShader(y,E),void 0!==i.index0AttributeName?h.bindAttribLocation(y,0,i.index0AttributeName):!0===i.morphTargets&&h.bindAttribLocation(y,0,"position"),h.linkProgram(y),t.debug.checkShaderErrors){var L=h.getProgramInfoLog(y).trim(),P=h.getShaderInfoLog(S).trim(),A=h.getShaderInfoLog(E).trim(),C=!0,R=!0;if(!1===h.getProgramParameter(y,35714)){C=!1;var O=Mn(h,S,"vertex"),z=Mn(h,E,"fragment");console.error("THREE.WebGLProgram: shader error: ",h.getError(),"35715",h.getProgramParameter(y,35715),"gl.getProgramInfoLog",L,O,z)}else""!==L?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",L):""!==P&&""!==A||(R=!1);R&&(this.diagnostics={runnable:C,programLog:L,vertexShader:{log:P,prefix:n},fragmentShader:{log:A,prefix:r}})}return h.detachShader(y,S),h.detachShader(y,E),h.deleteShader(S),h.deleteShader(E),this.getUniforms=function(){return void 0===w&&(w=new yn(h,y)),w},this.getAttributes=function(){return void 0===M&&(M=function(t,e){for(var i={},n=t.getProgramParameter(e,35721),r=0;r0,maxBones:w,useVertexTexture:a,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numClippingPlanes:m,numClipIntersection:v,dithering:n.dithering,shadowMapEnabled:t.shadowMap.enabled&&p.length>0,shadowMapType:t.shadowMap.type,toneMapping:n.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:2===n.side,flipSided:1===n.side,depthPacking:void 0!==n.depthPacking&&n.depthPacking,index0AttributeName:n.index0AttributeName,extensionDerivatives:n.extensions&&n.extensions.derivatives,extensionFragDepth:n.extensions&&n.extensions.fragDepth,extensionDrawbuffers:n.extensions&&n.extensions.drawBuffers,extensionShaderTextureLOD:n.extensions&&n.extensions.shaderTextureLOD,rendererExtensionFragDepth:r||null!==e.get("EXT_frag_depth"),rendererExtensionDrawBuffers:r||null!==e.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:r||null!==e.get("EXT_shader_texture_lod"),onBeforeCompile:n.onBeforeCompile}},this.getProgramCacheKey=function(e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var n in e.defines)i.push(n),i.push(e.defines[n]);if(void 0===e.isRawShaderMaterial){for(var r=0;r1&&i.sort(t||Un),n.length>1&&n.sort(e||Fn)}}}function jn(){var t=new WeakMap;function e(i){var n=i.target;n.removeEventListener("dispose",e),t.delete(n)}return{get:function(i,n){var r,o=t.get(i);return void 0===o?(r=new Hn,t.set(i,new WeakMap),t.get(i).set(n,r),i.addEventListener("dispose",e)):void 0===(r=o.get(n))&&(r=new Hn,o.set(n,r)),r},dispose:function(){t=new WeakMap}}}function Gn(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new L,color:new Vt};break;case"SpotLight":i={position:new L,direction:new L,color:new Vt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new L,color:new Vt,distance:0,decay:0};break;case"HemisphereLight":i={direction:new L,skyColor:new Vt,groundColor:new Vt};break;case"RectAreaLight":i={color:new Vt,position:new L,halfWidth:new L,halfHeight:new L}}return t[e.id]=i,i}}}var Vn=0;function Wn(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Zn(){for(var t,e=new Gn,i=(t={},{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowRadius:1,shadowMapSize:new v};break;case"PointLight":i={shadowBias:0,shadowRadius:1,shadowMapSize:new v,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)n.probe.push(new L);var o=new L,a=new N,s=new N;return{setup:function(t,r,h){for(var l=0,c=0,u=0,d=0;d<9;d++)n.probe[d].set(0,0,0);var p=0,f=0,m=0,v=0,g=0,_=0,y=0,x=0,b=h.matrixWorldInverse;t.sort(Wn),d=0;for(var w=t.length;d\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=u.clone();d.defines.HORIZONAL_PASS=1;var p=new _e;p.setAttribute("position",new $t(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new De(p,u),m=this;function g(i,n){var r=e.update(f);u.uniforms.shadow_pass.value=i.map.texture,u.uniforms.resolution.value=i.mapSize,u.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,u,f,null),d.uniforms.shadow_pass.value=i.mapPass.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,d,f,null)}function _(t,e,i){var n=t<<0|e<<1|i<<2,r=s[n];return void 0===r&&(r=new Yn({depthPacking:3201,morphTargets:t,skinning:e}),s[n]=r),r}function y(t,e,i){var n=t<<0|e<<1|i<<2,r=h[n];return void 0===r&&(r=new Jn({morphTargets:t,skinning:e}),h[n]=r),r}function x(e,i,n,r,o,a){var s=e.geometry,h=null,u=_,d=e.customDepthMaterial;if(!0===n.isPointLight&&(u=y,d=e.customDistanceMaterial),void 0===d){var p=!1;!0===i.morphTargets&&(!0===s.isBufferGeometry?p=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:!0===s.isGeometry&&(p=s.morphTargets&&s.morphTargets.length>0));var f=!1;!0===e.isSkinnedMesh&&(!0===i.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),h=u(p,f,!0===e.isInstancedMesh)}else h=d;if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var m=h.uuid,v=i.uuid,g=l[m];void 0===g&&(g={},l[m]=g);var x=g[v];void 0===x&&(x=h.clone(),g[v]=x),h=x}return h.visible=i.visible,h.wireframe=i.wireframe,h.side=3===a?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:c[i.side],h.clipShadows=i.clipShadows,h.clippingPlanes=i.clippingPlanes,h.clipIntersection=i.clipIntersection,h.wireframeLinewidth=i.wireframeLinewidth,h.linewidth=i.linewidth,!0===n.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(n.matrixWorld),h.nearDistance=r,h.farDistance=o),h}function M(i,r,o,a,s){if(!1!==i.visible){if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===s)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,i.matrixWorld);var h=e.update(i),l=i.material;if(Array.isArray(l))for(var c=h.groups,u=0,d=c.length;ui||r.y>i)&&(console.warn("THREE.WebGLShadowMap:",v,"has shadow exceeding max texture size, reducing"),r.x>i&&(o.x=Math.floor(i/y.x),r.x=o.x*y.x,_.mapSize.x=o.x),r.y>i&&(o.y=Math.floor(i/y.y),r.y=o.y*y.y,_.mapSize.y=o.y)),null===_.map&&!_.isPointLightShadow&&3===this.type){var x={minFilter:1006,magFilter:1006,format:1023};_.map=new w(r.x,r.y,x),_.map.texture.name=v.name+".shadowMap",_.mapPass=new w(r.x,r.y,x),_.camera.updateProjectionMatrix()}if(null===_.map){x={minFilter:1003,magFilter:1003,format:1023};_.map=new w(r.x,r.y,x),_.map.texture.name=v.name+".shadowMap",_.camera.updateProjectionMatrix()}t.setRenderTarget(_.map),t.clear();for(var b=_.getViewportCount(),T=0;T=1):-1!==R.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(R)[1]),A=C>=2);var O=null,z={},I=new b,N=new b;function D(e,i,n){var r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var a=0;an||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var o=e?m.floorPowerOfTwo:Math.floor,a=o(r*t.width),h=o(r*t.height);void 0===s&&(s=v(a,h));var l=i?v(a,h):s;return l.width=a,l.height=h,l.getContext("2d").drawImage(t,0,0,a,h),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+h+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function _(t){return m.isPowerOfTwo(t.width)&&m.isPowerOfTwo(t.height)}function y(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function x(e,i,r,o){t.generateMipmap(e),n.get(i).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function b(i,n,r){if(!1===h)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}var o=n;return 6403===n&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===n&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===n&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325===o||33326===o||34842===o||34836===o?e.get("EXT_color_buffer_float"):34843!==o&&34837!==o||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),o}function w(t){return 1003===t||1004===t||1005===t?9728:9729}function M(e){var i=e.target;i.removeEventListener("dispose",M),function(e){var i=n.get(e);if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture),n.remove(e)}(i),i.isVideoTexture&&p.delete(i),a.memory.textures--}function T(e){var i=e.target;i.removeEventListener("dispose",T),function(e){var i=n.get(e),r=n.get(e.texture);if(!e)return;void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)t.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[o]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}(i),a.memory.textures--}var S=0;function E(t,e){var r=n.get(t);if(t.isVideoTexture&&function(t){var e=a.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){var o=t.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.complete)return void z(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function L(e,r){if(6===e.image.length){var a=n.get(e);if(e.version>0&&a.__version!==e.version){O(a,e),i.activeTexture(33984+r),i.bindTexture(34067,a.__webglTexture),t.pixelStorei(37440,e.flipY);for(var s=e&&(e.isCompressedTexture||e.image[0].isCompressedTexture),l=e.image[0]&&e.image[0].isDataTexture,u=[],d=0;d<6;d++)u[d]=s||l?l?e.image[d].image:e.image[d]:g(e.image[d],!1,!0,c);var p,f=u[0],m=_(f)||h,v=o.convert(e.format),w=o.convert(e.type),M=b(e.internalFormat,v,w);if(R(34067,e,m),s){for(d=0;d<6;d++){p=u[d].mipmaps;for(var T=0;T1||n.get(o).__currentAnisotropy)&&(t.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function O(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",M),e.__webglTexture=t.createTexture(),a.memory.textures++)}function z(e,n,r){var a=3553;n.isDataTexture2DArray&&(a=35866),n.isDataTexture3D&&(a=32879),O(e,n),i.activeTexture(33984+r),i.bindTexture(a,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment);var s=function(t){return!h&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(n)&&!1===_(n.image),l=g(n.image,s,!1,u),c=_(l)||h,d=o.convert(n.format),p=o.convert(n.type),f=b(n.internalFormat,d,p);R(a,n,c);var m,v=n.mipmaps;if(n.isDepthTexture){if(f=6402,1015===n.type){if(!1===h)throw new Error("Float Depth Texture only supported in WebGL2.0");f=36012}else h&&(f=33189);1026===n.format&&6402===f&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1012,p=o.convert(n.type)),1027===n.format&&(f=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,p=o.convert(n.type))),i.texImage2D(3553,0,f,l.width,l.height,0,d,p,null)}else if(n.isDataTexture)if(v.length>0&&c){for(var w=0,M=v.length;w0&&c){for(w=0,M=v.length;w=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=E,this.setTexture2DArray=function(t,e){var r=n.get(t);t.version>0&&r.__version!==t.version?z(r,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){var r=n.get(t);t.version>0&&r.__version!==t.version?z(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=L,this.setTextureCubeDynamic=P,this.setupRenderTarget=function(e){var r=n.get(e),s=n.get(e.texture);e.addEventListener("dispose",T),s.__webglTexture=t.createTexture(),a.memory.textures++;var l=!0===e.isWebGLCubeRenderTarget,c=!0===e.isWebGLMultisampleRenderTarget,u=_(e)||h;if(l){r.__webglFramebuffer=[];for(var d=0;d<6;d++)r.__webglFramebuffer[d]=t.createFramebuffer()}else if(r.__webglFramebuffer=t.createFramebuffer(),c)if(h){r.__webglMultisampledFramebuffer=t.createFramebuffer(),r.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,r.__webglColorRenderbuffer);var p=o.convert(e.texture.format),f=o.convert(e.texture.type),m=b(e.texture.internalFormat,p,f),v=B(e);t.renderbufferStorageMultisample(36161,v,m,e.width,e.height),t.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(r.__webglDepthRenderbuffer=t.createRenderbuffer(),N(r.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){i.bindTexture(34067,s.__webglTexture),R(34067,e.texture,u);for(d=0;d<6;d++)I(r.__webglFramebuffer[d],e,36064,34069+d);y(e.texture,u)&&x(34067,e.texture,e.width,e.height),i.bindTexture(34067,null)}else i.bindTexture(3553,s.__webglTexture),R(3553,e.texture,u),I(r.__webglFramebuffer,e,36064,3553),y(e.texture,u)&&x(3553,e.texture,e.width,e.height),i.bindTexture(3553,null);e.depthBuffer&&D(e)},this.updateRenderTargetMipmap=function(t){var e=t.texture;if(y(e,_(t)||h)){var r=t.isWebGLCubeRenderTarget?34067:3553,o=n.get(e).__webglTexture;i.bindTexture(r,o),x(r,e,t.width,t.height),i.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(h){var i=n.get(e);t.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,i.__webglFramebuffer);var r=e.width,o=e.height,a=16384;e.depthBuffer&&(a|=256),e.stencilBuffer&&(a|=1024),t.blitFramebuffer(0,0,r,o,0,0,r,o,a,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===k&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),k=!0),t=t.texture),E(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===U&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),U=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?L(t,e):P(t,e)}}function tr(t,e,i){var n=i.isWebGL2;return{convert:function(t){var i;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return n?5131:null!==(i=e.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(null===(i=e.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(null===(i=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===t)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return null!==(i=e.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&null!==(i=e.get("WEBGL_compressed_texture_etc"))){if(37492===t)return i.COMPRESSED_RGB8_ETC2;if(37496===t)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?null!==(i=e.get("WEBGL_compressed_texture_astc"))?t:null:1020===t?n?34042:null!==(i=e.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function er(t){Je.call(this),this.cameras=t||[]}function ir(){$.call(this),this.type="Group"}function nr(t,e){var i=this,n=null,r=1,o=null,a="local-floor",s=null,h=[],l=new Map,c=new Je;c.layers.enable(1),c.viewport=new b;var u=new Je;u.layers.enable(2),u.viewport=new b;var d=new er([c,u]);d.layers.enable(1),d.layers.enable(2);var p=null,f=null;function m(t){var e=l.get(t.inputSource);e&&(e.targetRay&&e.targetRay.dispatchEvent({type:t.type}),e.grip&&e.grip.dispatchEvent({type:t.type}))}function v(){l.forEach((function(t,e){t.targetRay&&(t.targetRay.dispatchEvent({type:"disconnected",data:e}),t.targetRay.visible=!1),t.grip&&(t.grip.dispatchEvent({type:"disconnected",data:e}),t.grip.visible=!1)})),l.clear(),t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),T.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function g(t){o=t,T.setContext(n),T.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}function _(t){for(var e=n.inputSources,i=0;i=0){var l=r[s];if(void 0!==l){var c=l.normalized,u=l.itemSize;if(void 0===(w=M.get(l)))continue;var d=w.buffer,m=w.type,v=w.bytesPerElement;if(l.isInterleavedBufferAttribute){var y=l.data,x=y.stride,b=l.offset;y&&y.isInstancedInterleavedBuffer?(_.enableAttributeAndDivisor(h,y.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=y.meshPerAttribute*y.count)):_.enableAttribute(h),p.bindBuffer(34962,d),p.vertexAttribPointer(h,u,m,c,x*v,b*v)}else l.isInstancedBufferAttribute?(_.enableAttributeAndDivisor(h,l.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=l.meshPerAttribute*l.count)):_.enableAttribute(h),p.bindBuffer(34962,d),p.vertexAttribPointer(h,u,m,c,0,0)}else if("instanceMatrix"===s){var w;if(void 0===(w=M.get(t.instanceMatrix)))continue;d=w.buffer,m=w.type;_.enableAttributeAndDivisor(h+0,1),_.enableAttributeAndDivisor(h+1,1),_.enableAttributeAndDivisor(h+2,1),_.enableAttributeAndDivisor(h+3,1),p.bindBuffer(34962,d),p.vertexAttribPointer(h+0,4,m,!1,64,0),p.vertexAttribPointer(h+1,4,m,!1,64,16),p.vertexAttribPointer(h+2,4,m,!1,64,32),p.vertexAttribPointer(h+3,4,m,!1,64,48)}else if(void 0!==a){var T=a[s];if(void 0!==T)switch(T.length){case 2:p.vertexAttrib2fv(h,T);break;case 3:p.vertexAttrib3fv(h,T);break;case 4:p.vertexAttrib4fv(h,T);break;default:p.vertexAttrib1fv(h,T)}}}}_.disableUnusedAttributes()}(r,i,n,s),null!==l&&p.bindBuffer(34963,u.buffer));var v=null!==l?l.count:c.count,y=i.drawRange.start*d,x=i.drawRange.count*d,b=null!==o?o.start*d:0,w=null!==o?o.count*d:1/0,S=Math.max(y,b),E=Math.min(v,y+x,b+w)-1,L=Math.max(0,E-S+1);if(0!==L){if(r.isMesh)!0===n.wireframe?(_.setLineWidth(n.wireframeLinewidth*ut()),m.setMode(1)):m.setMode(4);else if(r.isLine){var P=n.linewidth;void 0===P&&(P=1),_.setLineWidth(P*ut()),r.isLineSegments?m.setMode(1):r.isLineLoop?m.setMode(2):m.setMode(3)}else r.isPoints?m.setMode(0):r.isSprite&&m.setMode(4);r.isInstancedMesh?m.renderInstances(i,S,L,r.count):i.isInstancedBufferGeometry?m.renderInstances(i,S,L,i.maxInstancedCount):m.render(S,L)}},this.compile=function(t,e){(d=A.get(t,e)).init(),t.traverse((function(t){t.isLight&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(e);var i={};t.traverse((function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(p=0;p=0&&t.numSupportedMorphNormals++}var f=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=at.numPlanes,n.numIntersection=at.numIntersection,f.clippingPlanes=at.uniform),n.fog=e.fog,n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=a,n.needsLights&&(f.ambientLightColor.value=r.state.ambient,f.lightProbe.value=r.state.probe,f.directionalLights.value=r.state.directional,f.directionalLightShadows.value=r.state.directionalShadow,f.spotLights.value=r.state.spot,f.spotLightShadows.value=r.state.spotShadow,f.rectAreaLights.value=r.state.rectArea,f.pointLights.value=r.state.point,f.pointLightShadows.value=r.state.pointShadow,f.hemisphereLights.value=r.state.hemi,f.directionalShadowMap.value=r.state.directionalShadowMap,f.directionalShadowMatrix.value=r.state.directionalShadowMatrix,f.spotShadowMap.value=r.state.spotShadowMap,f.spotShadowMatrix.value=r.state.spotShadowMatrix,f.pointShadowMap.value=r.state.pointShadowMap,f.pointShadowMatrix.value=r.state.pointShadowMatrix);var m=n.program.getUniforms(),v=yn.seqWithValue(m.seq,f);n.uniformsList=v}function Lt(t,e,i,n){w.resetTextureUnits();var r=e.fog,o=i.isMeshStandardMaterial?e.environment:null,a=x.get(i),s=d.state.lights;if(st&&(ht||t!==W)){var h=t===W&&i.id===G;at.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,a,h)}i.version===a.__version?void 0===a.program||i.fog&&a.fog!==r||a.environment!==o||a.needsLights&&a.lightsStateVersion!==s.state.version?Et(i,e,n):void 0===a.numClippingPlanes||a.numClippingPlanes===at.numPlanes&&a.numIntersection===at.numIntersection?a.outputEncoding!==D.outputEncoding&&Et(i,e,n):Et(i,e,n):(Et(i,e,n),a.__version=i.version);var l,c,u=!1,f=!1,v=!1,y=a.program,b=y.getUniforms(),M=a.uniforms;if(_.useProgram(y.program)&&(u=!0,f=!0,v=!0),i.id!==G&&(G=i.id,f=!0),u||W!==t){if(b.setValue(p,"projectionMatrix",t.projectionMatrix),g.logarithmicDepthBuffer&&b.setValue(p,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),W!==t&&(W=t,f=!0,v=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){var T=b.map.cameraPosition;void 0!==T&&T.setValue(p,ct.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&b.setValue(p,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&b.setValue(p,"viewMatrix",t.matrixWorldInverse)}if(i.skinning){b.setOptional(p,n,"bindMatrix"),b.setOptional(p,n,"bindMatrixInverse");var S=n.skeleton;if(S){var E=S.bones;if(g.floatVertexTextures){if(void 0===S.boneTexture){var L=Math.sqrt(4*E.length);L=m.ceilPowerOfTwo(L),L=Math.max(L,4);var P=new Float32Array(L*L*4);P.set(S.boneMatrices);var A=new $e(P,L,L,1023,1015);S.boneMatrices=P,S.boneTexture=A,S.boneTextureSize=L}b.setValue(p,"boneTexture",S.boneTexture,w),b.setValue(p,"boneTextureSize",S.boneTextureSize)}else b.setOptional(p,S,"boneMatrices")}}return(f||a.receiveShadow!==n.receiveShadow)&&(a.receiveShadow=n.receiveShadow,b.setValue(p,"receiveShadow",n.receiveShadow)),f&&(b.setValue(p,"toneMappingExposure",D.toneMappingExposure),b.setValue(p,"toneMappingWhitePoint",D.toneMappingWhitePoint),a.needsLights&&(c=v,(l=M).ambientLightColor.needsUpdate=c,l.lightProbe.needsUpdate=c,l.directionalLights.needsUpdate=c,l.directionalLightShadows.needsUpdate=c,l.pointLights.needsUpdate=c,l.pointLightShadows.needsUpdate=c,l.spotLights.needsUpdate=c,l.spotLightShadows.needsUpdate=c,l.rectAreaLights.needsUpdate=c,l.hemisphereLights.needsUpdate=c),r&&i.fog&&function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(M,r),i.isMeshBasicMaterial?Pt(M,i):i.isMeshLambertMaterial?(Pt(M,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(M,i)):i.isMeshToonMaterial?(Pt(M,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(M,i)):i.isMeshPhongMaterial?(Pt(M,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(M,i)):i.isMeshStandardMaterial?(Pt(M,i,o),i.isMeshPhysicalMaterial?function(t,e,i){At(t,e,i),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate());t.transparency.value=e.transparency}(M,i,o):At(M,i,o)):i.isMeshMatcapMaterial?(Pt(M,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(M,i)):i.isMeshDepthMaterial?(Pt(M,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(M,i)):i.isMeshDistanceMaterial?(Pt(M,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(M,i)):i.isMeshNormalMaterial?(Pt(M,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(M,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(M,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(M,i)):i.isPointsMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*Q,t.scale.value=.5*K,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);var i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(M,i):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);var i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(M,i):i.isShadowMaterial&&(M.color.value.copy(i.color),M.opacity.value=i.opacity),void 0!==M.ltc_1&&(M.ltc_1.value=ni.LTC_1),void 0!==M.ltc_2&&(M.ltc_2.value=ni.LTC_2),yn.upload(p,a.uniformsList,M,w),i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(yn.upload(p,a.uniformsList,M,w),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&b.setValue(p,"center",n.center),b.setValue(p,"modelViewMatrix",n.modelViewMatrix),b.setValue(p,"normalMatrix",n.normalMatrix),b.setValue(p,"modelMatrix",n.matrixWorld),y}function Pt(t,e,i){t.opacity.value=e.opacity,e.color&&t.diffuse.value.copy(e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap);var n,r,o=e.envMap||i;o&&(t.envMap.value=o,t.flipEnvMap.value=o.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=x.get(o).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix)),e.aoMap?r=e.aoMap:e.lightMap&&(r=e.lightMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uv2Transform.value.copy(r.matrix))}function At(t,e,i){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),(e.envMap||i)&&(t.envMapIntensity.value=e.envMapIntensity)}wt.setAnimationLoop((function(t){ft.isPresenting||bt&&bt(t)})),"undefined"!=typeof window&&wt.setContext(window),this.setAnimationLoop=function(t){bt=t,ft.setAnimationLoop(t),wt.start()},this.render=function(t,e){var i,n;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),i=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),n=arguments[3]),e&&e.isCamera){if(!B){V.geometry=null,V.program=null,V.wireframe=!1,G=-1,W=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),ft.enabled&&ft.isPresenting&&(e=ft.getCamera(e)),(d=A.get(t,e)).init(),t.onBeforeRender(D,t,e,i||H),lt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),ot.setFromProjectionMatrix(lt),ht=this.localClippingEnabled,st=at.init(this.clippingPlanes,ht,e),(u=P.get(t,e)).init(),Mt(t,e,0,D.sortObjects),u.finish(),!0===D.sortObjects&&u.sort($,et),st&&at.beginShadows();var r=d.state.shadowsArray;mt.render(r,t,e),d.setupLights(e),st&&at.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),C.render(u,t,e,n);var o=u.opaque,a=u.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;o.length&&Tt(o,t,e,s),a.length&&Tt(a,t,e,s)}else o.length&&Tt(o,t,e),a.length&&Tt(a,t,e);t.onAfterRender(D,t,e),null!==H&&(w.updateRenderTargetMipmap(H),w.updateMultisampleRenderTarget(H)),_.buffers.depth.setTest(!0),_.buffers.depth.setMask(!0),_.buffers.color.setMask(!0),_.setPolygonOffset(!1),u=null,d=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(t){k!==t&&null===H&&p.bindFramebuffer(36160,t),k=t},this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return H},this.setRenderTarget=function(t,e,i){H=t,U=e,F=i,t&&void 0===x.get(t).__webglFramebuffer&&w.setupRenderTarget(t);var n=k,r=!1;if(t){var o=x.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=o[e||0],r=!0):n=t.isWebGLMultisampleRenderTarget?x.get(t).__webglMultisampledFramebuffer:o,q.copy(t.viewport),X.copy(t.scissor),Y=t.scissorTest}else q.copy(it).multiplyScalar(Q).floor(),X.copy(nt).multiplyScalar(Q).floor(),Y=rt;if(j!==n&&(p.bindFramebuffer(36160,n),j=n),_.viewport(q),_.scissor(X),_.setScissorTest(Y),r){var a=x.get(t.texture);p.framebufferTexture2D(36160,36064,34069+(e||0),a.__webglTexture,i||0)}},this.readRenderTargetPixels=function(t,e,i,n,r,o,a){if(t&&t.isWebGLRenderTarget){var s=x.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]),s){var h=!1;s!==j&&(p.bindFramebuffer(36160,s),h=!0);try{var l=t.texture,c=l.format,u=l.type;if(1023!==c&&I.convert(c)!==p.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(1009===u||I.convert(u)===p.getParameter(35738)||1015===u&&(g.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||1016===u&&(g.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===p.checkFramebufferStatus(36160)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&p.readPixels(e,i,n,r,I.convert(c),I.convert(u),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{h&&p.bindFramebuffer(36160,j)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,i){void 0===i&&(i=0);var n=Math.pow(2,-i),r=Math.floor(e.image.width*n),o=Math.floor(e.image.height*n),a=I.convert(e.format);w.setTexture2D(e,0),p.copyTexImage2D(3553,i,a,t.x,t.y,r,o,0),_.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n){var r=e.image.width,o=e.image.height,a=I.convert(i.format),s=I.convert(i.type);w.setTexture2D(i,0),e.isDataTexture?p.texSubImage2D(3553,n||0,t.x,t.y,r,o,a,s,e.image.data):p.texSubImage2D(3553,n||0,t.x,t.y,a,s,e.image),_.unbindTexture()},this.initTexture=function(t){w.setTexture2D(t,0),_.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function or(t,e){this.name="",this.color=new Vt(t),this.density=void 0!==e?e:25e-5}function ar(t,e,i){this.name="",this.color=new Vt(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function sr(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}er.prototype=Object.assign(Object.create(Je.prototype),{constructor:er,isArrayCamera:!0}),ir.prototype=Object.assign(Object.create($.prototype),{constructor:ir,isGroup:!0}),Object.assign(nr.prototype,u.prototype),Object.assign(or.prototype,{isFogExp2:!0,clone:function(){return new or(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(ar.prototype,{isFog:!0,clone:function(){return new ar(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(sr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(sr.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,i){t*=this.stride,i*=e.stride;for(var n=0,r=this.stride;nt.far||e.push({distance:s,point:dr.clone(),uv:Ft.getUV(dr,_r,yr,xr,br,wr,Mr,new v),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return $.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}});var Er=new L,Lr=new L;function Pr(){$.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function Ar(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),De.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new N,this.bindMatrixInverse=new N}Pr.prototype=Object.assign(Object.create($.prototype),{constructor:Pr,isLOD:!0,copy:function(t){$.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i0){for(var i=1,n=e.length;i0){Er.setFromMatrixPosition(this.matrixWorld);var i=t.ray.origin.distanceTo(Er);this.getObjectForDistance(i).raycast(t,e)}},update:function(t){var e=this.levels;if(e.length>1){Er.setFromMatrixPosition(t.matrixWorld),Lr.setFromMatrixPosition(this.matrixWorld);var i=Er.distanceTo(Lr)/t.zoom;e[0].object.visible=!0;for(var n=1,r=e.length;n=e[n].distance;n++)e[n-1].object.visible=!1,e[n].object.visible=!0;for(this._currentLevel=n-1;n0&&(Dr[0].instanceId=r,Dr[0].object=this,e.push(Dr[0]),Dr.length=0)},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){}}),Ur.prototype=Object.create(Jt.prototype),Ur.prototype.constructor=Ur,Ur.prototype.isLineBasicMaterial=!0,Ur.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this};var Fr=new L,Hr=new L,jr=new N,Gr=new St,Vr=new gt;function Wr(t,e,i){1===i&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),$.call(this),this.type="Line",this.geometry=void 0!==t?t:new _e,this.material=void 0!==e?e:new Ur}Wr.prototype=Object.assign(Object.create($.prototype),{constructor:Wr,isLine:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,i=[0],n=1,r=e.count;na))c.applyMatrix4(this.matrixWorld),(b=t.ray.origin.distanceTo(c))t.far||e.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,v=p.length/3-1;ma))c.applyMatrix4(this.matrixWorld),(b=t.ray.origin.distanceTo(c))t.far||e.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(i.isGeometry){var y=i.vertices,x=y.length;for(m=0;ma))c.applyMatrix4(this.matrixWorld),(b=t.ray.origin.distanceTo(c))t.far||e.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Zr=new L,qr=new L;function Xr(t,e){Wr.call(this,t,e),this.type="LineSegments"}function Yr(t,e){Wr.call(this,t,e),this.type="LineLoop"}function Jr(t){Jt.call(this),this.type="PointsMaterial",this.color=new Vt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}Xr.prototype=Object.assign(Object.create(Wr.prototype),{constructor:Xr,isLineSegments:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,i=[],n=0,r=e.count;nr.far)return;o.push({distance:l,distanceToRay:Math.sqrt(s),point:h,index:e,face:null,object:a})}}function no(t,e,i,n,r,o,a,s,h){x.call(this,t,e,i,n,r,o,a,s,h),this.format=void 0!==a?a:1022,this.minFilter=void 0!==o?o:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1}function ro(t,e,i,n,r,o,a,s,h,l,c,u){x.call(this,null,o,a,s,h,l,n,r,c,u),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function oo(t,e,i,n,r,o,a,s,h){x.call(this,t,e,i,n,r,o,a,s,h),this.needsUpdate=!0}function ao(t,e,i,n,r,o,a,s,h,l){if(1026!==(l=void 0!==l?l:1026)&&1027!==l)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===l&&(i=1012),void 0===i&&1027===l&&(i=1020),x.call(this,null,n,r,o,a,s,l,i,h),this.image={width:t,height:e},this.magFilter=void 0!==a?a:1003,this.minFilter=void 0!==s?s:1003,this.flipY=!1,this.generateMipmaps=!1}function so(t){_e.call(this),this.type="WireframeGeometry";var e,i,n,r,o,a,s,h,l,c,u=[],d=[0,0],p={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,n=m.length;e=0?(t(v-1e-5,m,u),d.subVectors(c,u)):(t(v+1e-5,m,u),d.subVectors(u,c)),m-1e-5>=0?(t(v,m-1e-5,u),p.subVectors(c,u)):(t(v,m+1e-5,u),p.subVectors(u,c)),l.crossVectors(d,p).normalize(),s.push(l.x,l.y,l.z),h.push(v,m)}}for(n=0;n.9&&a<.1&&(e<.2&&(o[t+0]+=1),i<.2&&(o[t+2]+=1),n<.2&&(o[t+4]+=1))}}()}(),this.setAttribute("position",new se(r,3)),this.setAttribute("normal",new se(r.slice(),3)),this.setAttribute("uv",new se(o,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}function po(t,e){Ge.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new fo(t,e)),this.mergeVertices()}function fo(t,e){uo.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function mo(t,e){Ge.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new vo(t,e)),this.mergeVertices()}function vo(t,e){uo.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function go(t,e){Ge.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new _o(t,e)),this.mergeVertices()}function _o(t,e){var i=(1+Math.sqrt(5))/2,n=[-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];uo.call(this,n,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function yo(t,e){Ge.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new xo(t,e)),this.mergeVertices()}function xo(t,e){var i=(1+Math.sqrt(5))/2,n=1/i,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n];uo.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function bo(t,e,i,n,r,o){Ge.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new wo(t,e,i,n,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function wo(t,e,i,n,r){_e.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},e=e||64,i=i||1,n=n||8,r=r||!1;var o=t.computeFrenetFrames(e,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,h=new L,l=new L,c=new v,u=new L,d=[],p=[],f=[],m=[];function g(r){u=t.getPointAt(r/e,u);var a=o.normals[r],c=o.binormals[r];for(s=0;s<=n;s++){var f=s/n*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);l.x=v*a.x+m*c.x,l.y=v*a.y+m*c.y,l.z=v*a.z+m*c.z,l.normalize(),p.push(l.x,l.y,l.z),h.x=u.x+i*l.x,h.y=u.y+i*l.y,h.z=u.z+i*l.z,d.push(h.x,h.y,h.z)}}!function(){for(a=0;a0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=a.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),no.prototype=Object.assign(Object.create(x.prototype),{constructor:no,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),ro.prototype=Object.create(x.prototype),ro.prototype.constructor=ro,ro.prototype.isCompressedTexture=!0,oo.prototype=Object.create(x.prototype),oo.prototype.constructor=oo,oo.prototype.isCanvasTexture=!0,ao.prototype=Object.create(x.prototype),ao.prototype.constructor=ao,ao.prototype.isDepthTexture=!0,so.prototype=Object.create(_e.prototype),so.prototype.constructor=so,ho.prototype=Object.create(Ge.prototype),ho.prototype.constructor=ho,lo.prototype=Object.create(_e.prototype),lo.prototype.constructor=lo,co.prototype=Object.create(Ge.prototype),co.prototype.constructor=co,uo.prototype=Object.create(_e.prototype),uo.prototype.constructor=uo,po.prototype=Object.create(Ge.prototype),po.prototype.constructor=po,fo.prototype=Object.create(uo.prototype),fo.prototype.constructor=fo,mo.prototype=Object.create(Ge.prototype),mo.prototype.constructor=mo,vo.prototype=Object.create(uo.prototype),vo.prototype.constructor=vo,go.prototype=Object.create(Ge.prototype),go.prototype.constructor=go,_o.prototype=Object.create(uo.prototype),_o.prototype.constructor=_o,yo.prototype=Object.create(Ge.prototype),yo.prototype.constructor=yo,xo.prototype=Object.create(uo.prototype),xo.prototype.constructor=xo,bo.prototype=Object.create(Ge.prototype),bo.prototype.constructor=bo,wo.prototype=Object.create(_e.prototype),wo.prototype.constructor=wo,wo.prototype.toJSON=function(){var t=_e.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},Mo.prototype=Object.create(Ge.prototype),Mo.prototype.constructor=Mo,To.prototype=Object.create(_e.prototype),To.prototype.constructor=To,So.prototype=Object.create(Ge.prototype),So.prototype.constructor=So,Eo.prototype=Object.create(_e.prototype),Eo.prototype.constructor=Eo;var Lo=function(t,e,i){i=i||2;var n,r,o,a,s,h,l,c=e&&e.length,u=c?e[0]*i:t.length,d=Po(t,0,u,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,n){var r,o,a,s,h,l=[];for(r=0,o=e.length;r80*i){n=o=t[0],r=a=t[1];for(var f=i;fo&&(o=s),h>a&&(a=h);l=0!==(l=Math.max(o-n,a-r))?1/l:0}return Co(d,p,i,n,r,l),p};function Po(t,e,i,n,r){var o,a;if(r===function(t,e,i,n){for(var r=0,o=e,a=i-n;o0)for(o=e;o=e;o-=n)a=Zo(o,t[o],t[o+1],a);return a&&jo(a,a.next)&&(qo(a),a=a.next),a}function Ao(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!jo(n,n.next)&&0!==Ho(n.prev,n,n.next))n=n.next;else{if(qo(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function Co(t,e,i,n,r,o,a){if(t){!a&&o&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=Bo(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,o,a,s,h,l=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,n=i,s=0,e=0;e0||h>0&&n;)0!==s&&(0===h||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,h--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,l*=2}while(a>1)}(r)}(t,n,r,o);for(var s,h,l=t;t.prev!==t.next;)if(s=t.prev,h=t.next,o?Oo(t,n,r,o):Ro(t))e.push(s.i/i),e.push(t.i/i),e.push(h.i/i),qo(t),t=h.next,l=h.next;else if((t=h)===l){a?1===a?Co(t=zo(t,e,i),e,i,n,r,o,2):2===a&&Io(t,e,i,n,r,o):Co(Ao(t),e,i,n,r,o,1);break}}}function Ro(t){var e=t.prev,i=t,n=t.next;if(Ho(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(Uo(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&Ho(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Oo(t,e,i,n){var r=t.prev,o=t,a=t.next;if(Ho(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,c=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,u=Bo(s,h,e,i,n),d=Bo(l,c,e,i,n),p=t.prevZ,f=t.nextZ;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&Uo(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ho(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&Uo(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Ho(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&Uo(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ho(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Uo(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Ho(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function zo(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!jo(r,o)&&Go(r,n,n.next,o)&&Vo(r,o)&&Vo(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),qo(n),qo(n.next),n=t=o),n=n.next}while(n!==t);return n}function Io(t,e,i,n,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Fo(a,s)){var h=Wo(a,s);return a=Ao(a,a.next),h=Ao(h,h.next),Co(a,e,i,n,r,o),void Co(h,e,i,n,r,o)}s=s.next}a=a.next}while(a!==t)}function No(t,e){return t.x-e.x}function Do(t,e){if(e=function(t,e){var i,n=e,r=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(o===n.y)return n;if(o===n.next.y)return n.next}i=n.x=n.x&&n.x>=c&&r!==n.x&&Uo(oi.x)&&Vo(n,t)&&(i=n,d=h),n=n.next;return i}(t,e)){var i=Wo(e,t);Ao(i,i.next)}}function Bo(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ko(t){var e=t,i=t;do{(e.x=0&&(t-a)*(n-s)-(i-a)*(e-s)>=0&&(i-a)*(o-s)-(r-a)*(n-s)>=0}function Fo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Go(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&Vo(t,e)&&Vo(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function Ho(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function jo(t,e){return t.x===e.x&&t.y===e.y}function Go(t,e,i,n){return!!(jo(t,i)&&jo(e,n)||jo(t,n)&&jo(i,e))||Ho(t,e,i)>0!=Ho(t,e,n)>0&&Ho(i,n,t)>0!=Ho(i,n,e)>0}function Vo(t,e){return Ho(t.prev,t,t.next)<0?Ho(t,e,t.next)>=0&&Ho(t,t.prev,e)>=0:Ho(t,e,t.prev)<0||Ho(t,t.next,e)<0}function Wo(t,e){var i=new Xo(t.i,t.x,t.y),n=new Xo(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function Zo(t,e,i,n){var r=new Xo(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function qo(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Xo(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Yo={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function Ko(t,e){for(var i=0;iNumber.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(h*h+l*l),f=e.x-s/d,m=e.y+a/d,g=((i.x-l/p-f)*l-(i.y+h/p-m)*h)/(a*l-s*h),_=(n=f+a*g-t.x)*n+(r=m+s*g-t.y)*r;if(_<=2)return new v(n,r);o=Math.sqrt(_/2)}else{var y=!1;a>Number.EPSILON?h>Number.EPSILON&&(y=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(n=-s,r=a,o=Math.sqrt(c)):(n=a,r=s,o=Math.sqrt(c/2))}return new v(n/o,r/o)}for(var j=[],G=0,V=R.length,W=V-1,Z=G+1;G=0;z--){for(N=z/p,D=c*Math.cos(N*Math.PI/2),I=u*Math.sin(N*Math.PI/2)+d,G=0,V=R.length;G=0;){i=G,(n=G-1)<0&&(n=t.length-1);var r=0,o=s+2*p;for(r=0;r0)&&f.push(w,M,S),(h!==i-1||l0&&_(!0),e>0&&_(!1)),this.setIndex(l),this.setAttribute("position",new se(c,3)),this.setAttribute("normal",new se(u,3)),this.setAttribute("uv",new se(d,2))}function va(t,e,i,n,r,o,a){fa.call(this,0,t,e,i,n,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:o,thetaLength:a}}function ga(t,e,i,n,r,o,a){ma.call(this,0,t,e,i,n,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:o,thetaLength:a}}function _a(t,e,i,n){Ge.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new ya(t,e,i,n)),this.mergeVertices()}function ya(t,e,i,n){_e.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},t=t||1,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r,o,a=[],s=[],h=[],l=[],c=new L,u=new v;for(s.push(0,0,0),h.push(0,0,1),l.push(.5,.5),o=0,r=3;o<=e;o++,r+=3){var d=i+o/e*n;c.x=t*Math.cos(d),c.y=t*Math.sin(d),s.push(c.x,c.y,c.z),h.push(0,0,1),u.x=(s[r]/t+1)/2,u.y=(s[r+1]/t+1)/2,l.push(u.x,u.y)}for(r=1;r<=e;r++)a.push(r,r+1,0);this.setIndex(a),this.setAttribute("position",new se(s,3)),this.setAttribute("normal",new se(h,3)),this.setAttribute("uv",new se(l,2))}ia.prototype=Object.create(Ge.prototype),ia.prototype.constructor=ia,na.prototype=Object.create($o.prototype),na.prototype.constructor=na,ra.prototype=Object.create(Ge.prototype),ra.prototype.constructor=ra,oa.prototype=Object.create(_e.prototype),oa.prototype.constructor=oa,aa.prototype=Object.create(Ge.prototype),aa.prototype.constructor=aa,sa.prototype=Object.create(_e.prototype),sa.prototype.constructor=sa,ha.prototype=Object.create(Ge.prototype),ha.prototype.constructor=ha,la.prototype=Object.create(_e.prototype),la.prototype.constructor=la,ca.prototype=Object.create(Ge.prototype),ca.prototype.constructor=ca,ca.prototype.toJSON=function(){var t=Ge.prototype.toJSON.call(this);return da(this.parameters.shapes,t)},ua.prototype=Object.create(_e.prototype),ua.prototype.constructor=ua,ua.prototype.toJSON=function(){var t=_e.prototype.toJSON.call(this);return da(this.parameters.shapes,t)},pa.prototype=Object.create(_e.prototype),pa.prototype.constructor=pa,fa.prototype=Object.create(Ge.prototype),fa.prototype.constructor=fa,ma.prototype=Object.create(_e.prototype),ma.prototype.constructor=ma,va.prototype=Object.create(fa.prototype),va.prototype.constructor=va,ga.prototype=Object.create(ma.prototype),ga.prototype.constructor=ga,_a.prototype=Object.create(Ge.prototype),_a.prototype.constructor=_a,ya.prototype=Object.create(_e.prototype),ya.prototype.constructor=ya;var xa=Object.freeze({__proto__:null,WireframeGeometry:so,ParametricGeometry:ho,ParametricBufferGeometry:lo,TetrahedronGeometry:po,TetrahedronBufferGeometry:fo,OctahedronGeometry:mo,OctahedronBufferGeometry:vo,IcosahedronGeometry:go,IcosahedronBufferGeometry:_o,DodecahedronGeometry:yo,DodecahedronBufferGeometry:xo,PolyhedronGeometry:co,PolyhedronBufferGeometry:uo,TubeGeometry:bo,TubeBufferGeometry:wo,TorusKnotGeometry:Mo,TorusKnotBufferGeometry:To,TorusGeometry:So,TorusBufferGeometry:Eo,TextGeometry:ia,TextBufferGeometry:na,SphereGeometry:ra,SphereBufferGeometry:oa,RingGeometry:aa,RingBufferGeometry:sa,PlaneGeometry:ai,PlaneBufferGeometry:si,LatheGeometry:ha,LatheBufferGeometry:la,ShapeGeometry:ca,ShapeBufferGeometry:ua,ExtrudeGeometry:Qo,ExtrudeBufferGeometry:$o,EdgesGeometry:pa,ConeGeometry:va,ConeBufferGeometry:ga,CylinderGeometry:fa,CylinderBufferGeometry:ma,CircleGeometry:_a,CircleBufferGeometry:ya,BoxGeometry:class extends Ge{constructor(t,e,i,n,r,o){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new Ve(t,e,i,n,r,o)),this.mergeVertices()}},BoxBufferGeometry:Ve});function ba(t){Jt.call(this),this.type="ShadowMaterial",this.color=new Vt(0),this.transparent=!0,this.setValues(t)}function wa(t){Xe.call(this,t),this.type="RawShaderMaterial"}function Ma(t){Jt.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Vt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new v(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(t)}function Ta(t){Ma.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearcoat=0,this.clearcoatRoughness=0,this.sheen=null,this.clearcoatNormalScale=new v(1,1),this.clearcoatNormalMap=null,this.transparency=0,this.setValues(t)}function Sa(t){Jt.call(this),this.type="MeshPhongMaterial",this.color=new Vt(16777215),this.specular=new Vt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new v(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ea(t){Jt.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Vt(16777215),this.specular=new Vt(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new v(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function La(t){Jt.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new v(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Pa(t){Jt.call(this),this.type="MeshLambertMaterial",this.color=new Vt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Aa(t){Jt.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Vt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new v(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ca(t){Ur.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}ba.prototype=Object.create(Jt.prototype),ba.prototype.constructor=ba,ba.prototype.isShadowMaterial=!0,ba.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this},wa.prototype=Object.create(Xe.prototype),wa.prototype.constructor=wa,wa.prototype.isRawShaderMaterial=!0,Ma.prototype=Object.create(Jt.prototype),Ma.prototype.constructor=Ma,Ma.prototype.isMeshStandardMaterial=!0,Ma.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.vertexTangents=t.vertexTangents,this},Ta.prototype=Object.create(Ma.prototype),Ta.prototype.constructor=Ta,Ta.prototype.isMeshPhysicalMaterial=!0,Ta.prototype.copy=function(t){return Ma.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearcoat=t.clearcoat,this.clearcoatRoughness=t.clearcoatRoughness,t.sheen?this.sheen=(this.sheen||new Vt).copy(t.sheen):this.sheen=null,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.transparency=t.transparency,this},Sa.prototype=Object.create(Jt.prototype),Sa.prototype.constructor=Sa,Sa.prototype.isMeshPhongMaterial=!0,Sa.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ea.prototype=Object.create(Jt.prototype),Ea.prototype.constructor=Ea,Ea.prototype.isMeshToonMaterial=!0,Ea.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},La.prototype=Object.create(Jt.prototype),La.prototype.constructor=La,La.prototype.isMeshNormalMaterial=!0,La.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Pa.prototype=Object.create(Jt.prototype),Pa.prototype.constructor=Pa,Pa.prototype.isMeshLambertMaterial=!0,Pa.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Aa.prototype=Object.create(Jt.prototype),Aa.prototype.constructor=Aa,Aa.prototype.isMeshMatcapMaterial=!0,Aa.prototype.copy=function(t){return Jt.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ca.prototype=Object.create(Ur.prototype),Ca.prototype.constructor=Ca,Ca.prototype.isLineDashedMaterial=!0,Ca.prototype.copy=function(t){return Ur.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Ra=Object.freeze({__proto__:null,ShadowMaterial:ba,SpriteMaterial:ur,RawShaderMaterial:wa,ShaderMaterial:Xe,PointsMaterial:Jr,MeshPhysicalMaterial:Ta,MeshStandardMaterial:Ma,MeshPhongMaterial:Sa,MeshToonMaterial:Ea,MeshNormalMaterial:La,MeshLambertMaterial:Pa,MeshDepthMaterial:Yn,MeshDistanceMaterial:Jn,MeshBasicMaterial:Kt,MeshMatcapMaterial:Aa,LineDashedMaterial:Ca,LineBasicMaterial:Ur,Material:Jt}),Oa={arraySlice:function(t,e,i){return Oa.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,i=new Array(e),n=0;n!==e;++n)i[n]=n;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),o=0,a=0;a!==n;++o)for(var s=i[o]*e,h=0;h!==e;++h)r[a++]=t[s+h];return r},flattenJSON:function(t,e,i,n){for(var r=1,o=t[0];void 0!==o&&void 0===o[n];)o=t[r++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[n])&&(e.push(o.time),i.push.apply(i,a)),o=t[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[n])&&(e.push(o.time),a.toArray(i,i.length)),o=t[r++]}while(void 0!==o);else do{void 0!==(a=o[n])&&(e.push(o.time),i.push(a)),o=t[r++]}while(void 0!==o)}},subclip:function(t,e,i,n,r){r=r||30;var o=t.clone();o.name=e;for(var a=[],s=0;s=n)){c.push(h.times[d]);for(var f=0;fo.tracks[s].times[0]&&(m=o.tracks[s].times[0]);for(s=0;s=r)break t;var s=e[1];t=(r=e[--i-1]))break e}o=i,i=0}for(;i>>1;te;)--o;if(++o,0!==r||o!==n){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=Oa.arraySlice(i,r,o),this.values=Oa.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=i[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),t=!1;break}o=s}if(void 0!==n&&Oa.isTypedArray(n)){a=0;for(var h=n.length;a!==h;++a){var l=n[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),t=!1;break}}}return t},optimize:function(){for(var t=Oa.arraySlice(this.times),e=Oa.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=1,o=t.length-1,a=1;a0){t[r]=t[o];for(f=o*i,m=r*i,d=0;d!==i;++d)e[m+d]=e[f+d];++r}return r!==t.length?(this.times=Oa.arraySlice(t,0,r),this.values=Oa.arraySlice(e,0,r*i)):(this.times=t,this.values=e),this},clone:function(){var t=Oa.arraySlice(this.times,0),e=Oa.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}),ka.prototype=Object.assign(Object.create(Ba.prototype),{constructor:ka,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ua.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Ua,ValueTypeName:"color"}),Fa.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Fa,ValueTypeName:"number"}),Ha.prototype=Object.assign(Object.create(za.prototype),{constructor:Ha,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,h=(i-e)/(n-e),l=s+a;s!==l;s+=4)T.slerpFlat(r,0,o,s-a,o,s,h);return r}}),ja.prototype=Object.assign(Object.create(Ba.prototype),{constructor:ja,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Ha(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Ga.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Ga,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Va.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Va,ValueTypeName:"vector"}),Object.assign(Wa,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,o=i.length;r!==o;++r)e.push(Za(i[r]).scale(n));return new Wa(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid},r=0,o=i.length;r!==o;++r)e.push(Ba.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.length,o=[],a=0;a1){var l=n[u=h[1]];l||(n[u]=l=[]),l.push(s)}}var c=[];for(var u in n)c.push(Wa.CreateFromMorphTargetSequence(u,n[u],e,i));return c},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(t,e,i,n,r){if(0!==i.length){var o=[],a=[];Oa.flattenJSON(i,o,a,n),0!==o.length&&r.push(new t(e,o,a))}},n=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],h=0;h0||0===t.search(/^data\:image\/jpeg/);r.format=n?1022:1023,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}),Object.assign(os.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,n=[],r=this.getPoint(0),o=0;for(n.push(0),i=1;i<=t;i++)o+=(e=this.getPoint(i/t)).distanceTo(r),n.push(o),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i,n=this.getLengths(),r=0,o=n.length;i=e||t*n[o-1];for(var a,s=0,h=o-1;s<=h;)if((a=n[r=Math.floor(s+(h-s)/2)]-i)<0)s=r+1;else{if(!(a>0)){h=r;break}h=r-1}if(n[r=h]===i)return r/(o-1);var l=n[r];return(r+(i-l)/(n[r+1]-l))/(o-1)},getTangent:function(t){var e=t-1e-4,i=t+1e-4;e<0&&(e=0),i>1&&(i=1);var n=this.getPoint(e);return this.getPoint(i).clone().sub(n).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var i,n,r,o=new L,a=[],s=[],h=[],l=new L,c=new N;for(i=0;i<=t;i++)n=i/t,a[i]=this.getTangentAt(n),a[i].normalize();s[0]=new L,h[0]=new L;var u=Number.MAX_VALUE,d=Math.abs(a[0].x),p=Math.abs(a[0].y),f=Math.abs(a[0].z);for(d<=u&&(u=d,o.set(1,0,0)),p<=u&&(u=p,o.set(0,1,0)),f<=u&&o.set(0,0,1),l.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],l),h[0].crossVectors(a[0],s[0]),i=1;i<=t;i++)s[i]=s[i-1].clone(),h[i]=h[i-1].clone(),l.crossVectors(a[i-1],a[i]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(m.clamp(a[i-1].dot(a[i]),-1,1)),s[i].applyMatrix4(c.makeRotationAxis(l,r))),h[i].crossVectors(a[i],s[i]);if(!0===e)for(r=Math.acos(m.clamp(s[0].dot(s[t]),-1,1)),r/=t,a[0].dot(l.crossVectors(s[0],s[t]))>0&&(r=-r),i=1;i<=t;i++)s[i].applyMatrix4(c.makeRotationAxis(a[i],r*i)),h[i].crossVectors(a[i],s[i]);return{tangents:a,normals:s,binormals:h}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),as.prototype=Object.create(os.prototype),as.prototype.constructor=as,as.prototype.isEllipseCurve=!0,as.prototype.getPoint=function(t,e){for(var i=e||new v,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)n;)r-=n;r0?0:(Math.floor(Math.abs(c)/h)+1)*h:0===u&&c===h-1&&(c=h-2,u=1),this.closed||c>0?i=s[(c-1)%h]:(ls.subVectors(s[0],s[1]).add(s[0]),i=ls),n=s[c%h],r=s[(c+1)%h],this.closed||c+2n.length-2?n.length-1:o+1],c=n[o>n.length-3?n.length-1:o+2];return i.set(fs(a,s.x,h.x,l.x,c.x),fs(a,s.y,h.y,l.y,c.y)),i},Ms.prototype.copy=function(t){os.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e=e){var r=i[n]-e,o=this.curves[n],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(t){os.prototype.copy.call(this,t),this.curves=[];for(var e=0,i=t.curves.length;e0){var l=h.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(h);var c=h.getPoint(1);return this.currentPoint.copy(c),this},copy:function(t){return Ss.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Ss.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Ss.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),Ls.prototype=Object.assign(Object.create(Es.prototype),{constructor:Ls,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i0:n.vertexColors=t.vertexColors),void 0!==t.uniforms)for(var r in t.uniforms){var o=t.uniforms[r];switch(n.uniforms[r]={},o.type){case"t":n.uniforms[r].value=i(o.value);break;case"c":n.uniforms[r].value=(new Vt).setHex(o.value);break;case"v2":n.uniforms[r].value=(new v).fromArray(o.value);break;case"v3":n.uniforms[r].value=(new L).fromArray(o.value);break;case"v4":n.uniforms[r].value=(new b).fromArray(o.value);break;case"m3":n.uniforms[r].value=(new g).fromArray(o.value);case"m4":n.uniforms[r].value=(new N).fromArray(o.value);break;default:n.uniforms[r].value=o.value}}if(void 0!==t.defines&&(n.defines=t.defines),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(var a in t.extensions)n.extensions[a]=t.extensions[a];if(void 0!==t.shading&&(n.flatShading=1===t.shading),void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(n.map=i(t.map)),void 0!==t.matcap&&(n.matcap=i(t.matcap)),void 0!==t.alphaMap&&(n.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(n.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(n.bumpScale=t.bumpScale),void 0!==t.normalMap&&(n.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(n.normalMapType=t.normalMapType),void 0!==t.normalScale){var s=t.normalScale;!1===Array.isArray(s)&&(s=[s,s]),n.normalScale=(new v).fromArray(s)}return void 0!==t.displacementMap&&(n.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(n.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(n.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(n.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(n.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(n.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(n.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(n.specularMap=i(t.specularMap)),void 0!==t.envMap&&(n.envMap=i(t.envMap)),void 0!==t.envMapIntensity&&(n.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(n.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(n.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(n.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(n.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(n.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(n.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(n.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatNormalMap&&(n.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(n.clearcoatNormalScale=(new v).fromArray(t.clearcoatNormalScale)),n},setTextures:function(t){return this.textures=t,this}});var Hs=function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)};function js(){_e.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Gs(t,e,i,n){"number"==typeof i&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),$t.call(this,t,e,i),this.meshPerAttribute=n||1}function Vs(t){Ja.call(this,t)}js.prototype=Object.assign(Object.create(_e.prototype),{constructor:js,isInstancedBufferGeometry:!0,copy:function(t){return _e.prototype.copy.call(this,t),this.maxInstancedCount=t.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t=_e.prototype.toJSON.call(this);return t.maxInstancedCount=this.maxInstancedCount,t.isInstancedBufferGeometry=!0,t}}),Gs.prototype=Object.assign(Object.create($t.prototype),{constructor:Gs,isInstancedBufferAttribute:!0,copy:function(t){return $t.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){var t=$t.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}),Vs.prototype=Object.assign(Object.create(Ja.prototype),{constructor:Vs,load:function(t,e,i,n){var r=this,o=new Qa(r.manager);o.setPath(r.path),o.load(t,(function(t){e(r.parse(JSON.parse(t)))}),i,n)},parse:function(t){var e=t.isInstancedBufferGeometry?new js:new _e,i=t.data.index;if(void 0!==i){var n=new Ws[i.type](i.array);e.setIndex(new $t(n,1))}var r=t.data.attributes;for(var o in r){var a=r[o],s=(n=new Ws[a.type](a.array),new(a.isInstancedBufferAttribute?Gs:$t)(n,a.itemSize,a.normalized));void 0!==a.name&&(s.name=a.name),e.setAttribute(o,s)}var h=t.data.morphAttributes;if(h)for(var o in h){for(var l=h[o],c=[],u=0,d=l.length;u0){var o=new is(new Xa(e));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a0?new Ar(a,s):new De(a,s);break;case"InstancedMesh":a=r(t.geometry),s=o(t.material);var h=t.count,l=t.instanceMatrix;(n=new kr(a,s,h)).instanceMatrix=new $t(new Float32Array(l.array),16);break;case"LOD":n=new Pr;break;case"Line":n=new Wr(r(t.geometry),o(t.material),t.mode);break;case"LineLoop":n=new Yr(r(t.geometry),o(t.material));break;case"LineSegments":n=new Xr(r(t.geometry),o(t.material));break;case"PointCloud":case"Points":n=new eo(r(t.geometry),o(t.material));break;case"Sprite":n=new Tr(o(t.material));break;case"Group":n=new ir;break;default:n=new $}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.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.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children)for(var c=t.children,u=0;uNumber.EPSILON){if(l<0&&(a=e[o],h=-h,s=e[r],l=-l),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var c=l*(t.x-a.x)-h*(t.y-a.y);if(0===c)return!0;if(c<0)continue;n=!n}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return n}var r=Yo.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return i(o);var a,s,h,l=[];if(1===o.length)return s=o[0],(h=new Ls).curves=s.curves,l.push(h),l;var c=!r(o[0].getPoints());c=t?!c:c;var u,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,_=o.length;g<_;g++)a=r(u=(s=o[g]).getPoints()),(a=t?!a:a)?(!c&&f[v]&&v++,f[v]={s:new Ls,p:u},f[v].s.curves=s.curves,c&&v++,m[v]=[]):m[v].push({h:s,p:u[0]});if(!f[0])return i(o);if(f.length>1){for(var y=!1,x=[],b=0,w=f.length;b0&&(y||(m=p))}g=0;for(var P=f.length;g0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==r;++o)t[e+o]=t[i+o]},_slerp:function(t,e,i,n){T.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var o=1-n,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[i+a]*n}}});var Th=new RegExp("[\\[\\]\\.:\\/]","g"),Sh="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Eh=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Lh=/(WCOD+)?/.source.replace("WCOD",Sh),Ph=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ah=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ch=new RegExp("^"+Eh+Lh+Ph+Ah+"$"),Rh=["material","materials","bones"];function Oh(t,e,i){var n=i||zh.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function zh(t,e,i){this.path=e,this.parsedPath=i||zh.parseTrackName(e),this.node=zh.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Ih(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,o=new Array(r),a={endingStart:2400,endingEnd:2400},s=0;s!==r;++s){var h=n[s].createInterpolant(null);o[s]=h,h.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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 Nh(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Dh(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Bh(t,e,i){sr.call(this,t,e),this.meshPerAttribute=i||1}function kh(t,e,i,n){this.ray=new St(t,e),this.near=i||0,this.far=n||1/0,this.camera=null,this.layers=new U,this.params={Mesh:{},Line:{threshold:1},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 Uh(t,e){return t.distance-e.distance}function Fh(t,e,i,n){if(t.layers.test(e.layers)&&t.raycast(e,i),!0===n)for(var r=t.children,o=0,a=r.length;o=e){var c=e++,u=t[c];i[u.uuid]=l,t[l]=u,i[h]=c,t[c]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[c],v=f[l];f[l]=m,f[c]=v}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var h=arguments[a],l=h.uuid,c=n[l];if(void 0!==c)if(delete n[l],c0)for(var h=this._interpolants,l=this._propertyBindings,c=0,u=h.length;c!==u;++c)h[c].evaluate(a),l[c].accumulate(n,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t,i=this._clip.duration,n=this.loop,r=this._loopCount,o=2202===n;if(0===t)return-1===r?e:o&&1==(1&r)?i-e:e;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0)){this.time=e;break t}e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=i||e<0){var a=Math.floor(e/i);e-=i*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var h=t<0;this._setEndings(h,!h,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=e;if(o&&1==(1&r))return i-e}return e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,o=this._weightInterpolant;null===o&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=i,this}}),Nh.prototype=Object.assign(Object.create(u.prototype),{constructor:Nh,_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings,a=t._interpolants,s=i.uuid,h=this._bindingsByRootAndName,l=h[s];void 0===l&&(l={},h[s]=l);for(var c=0;c!==r;++c){var u=n[c],d=u.name,p=l[d];if(void 0!==p)o[c]=p;else{if(void 0!==(p=o[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[c].binding.parsedPath;++(p=new Mh(zh.create(i,d,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),o[c]=p}a[c].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new v),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new v),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return Hh.copy(t).clamp(this.min,this.max).sub(t).length()},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Gh=new L,Vh=new L;function Wh(t,e){this.start=void 0!==t?t:new L,this.end=void 0!==e?e:new L}function Zh(t){$.call(this),this.material=t,this.render=function(){}}Object.assign(Wh.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new L),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new L),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new L),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(t,e){Gh.subVectors(t,this.start),Vh.subVectors(this.end,this.start);var i=Vh.dot(Vh),n=Vh.dot(Gh)/i;return e&&(n=m.clamp(n,0,1)),n},closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e);return void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new L),this.delta(i).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Zh.prototype=Object.create($.prototype),Zh.prototype.constructor=Zh,Zh.prototype.isImmediateRenderObject=!0;var qh=new L;function Xh(t,e){$.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var i=new _e,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,o=1;r<32;r++,o++){var a=r/32*Math.PI*2,s=o/32*Math.PI*2;n.push(Math.cos(a),Math.sin(a),1,Math.cos(s),Math.sin(s),1)}i.setAttribute("position",new se(n,3));var h=new Ur({fog:!1});this.cone=new Xr(i,h),this.add(this.cone),this.update()}Xh.prototype=Object.create($.prototype),Xh.prototype.constructor=Xh,Xh.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Xh.prototype.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),qh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(qh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Yh=new L,Jh=new N,Kh=new N;function Qh(t){for(var e=function t(e){var i=[];e&&e.isBone&&i.push(e);for(var n=0;n.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{xl.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(xl,e)}},bl.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},bl.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},bl.prototype.copy=function(t){return $.prototype.copy.call(this,t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this},bl.prototype.clone=function(){return(new this.constructor).copy(this)},wl.prototype=Object.create(Xr.prototype),wl.prototype.constructor=wl;var Ml,Tl,Sl,El,Ll=Math.pow(2,8),Pl=[.125,.215,.35,.446,.526,.582],Al=5+Pl.length,Cl={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},Rl=new Ns,Ol=(Ml=20,Tl=new Float32Array(Ml),Sl=new L(0,1,0),(El=new wa({defines:{n:Ml},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:Tl},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:Sl},inputEncoding:{value:Cl[3e3]},outputEncoding:{value:Cl[3e3]}},vertexShader:ec(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${ic()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include \n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tfor (int i = 0; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfor (int dir = -1; dir < 2; dir += 2) {\n\t\t\tif (i == 0 && dir == 1)\n\t\t\t\tcontinue;\n\t\t\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\t\t\tif (all(equal(axis, vec3(0.0))))\n\t\t\t\taxis = cross(vec3(0.0, 1.0, 0.0), vOutputDirection);\n\t\t\taxis = normalize(axis);\n\t\t\tfloat theta = dTheta * float(dir * i);\n\t\t\tfloat cosTheta = cos(theta);\n\t\t\t// Rodrigues' axis-angle rotation\n\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t\t\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\t\t\tgl_FragColor.rgb +=\n\t\t\t\t\tweights[i] * bilinearCubeUV(envMap, sampleDirection, mipInt);\n\t\t}\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",El),zl=null,Il=null,{_lodPlanes:Nl,_sizeLods:Dl,_sigmas:Bl}=function(){for(var t=[],e=[],i=[],n=8,r=0;r4?a=Pl[r-8+4-1]:0==r&&(a=0),i.push(a);for(var s=1/(o-1),h=-s/2,l=1+s/2,c=[h,h,l,h,l,l,h,h,l,l,h,l],u=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];u.set(g,18*f),d.set(c,12*f);var _=[f,f,f,f,f,f];p.set(_,6*f)}var y=new _e;y.setAttribute("position",new $t(u,3)),y.setAttribute("uv",new $t(d,2)),y.setAttribute("faceIndex",new $t(p,1)),t.push(y),n>4&&n--}return{_lodPlanes:t,_sizeLods:e,_sigmas:i}}(),kl=null,Ul=null,Fl=null,Hl=(1+Math.sqrt(5))/2,jl=1/Hl,Gl=[new L(1,1,1),new L(-1,1,1),new L(1,1,-1),new L(-1,1,-1),new L(0,Hl,jl),new L(0,Hl,-jl),new L(jl,0,Hl),new L(-jl,0,Hl),new L(Hl,jl,0),new L(-Hl,jl,0)];function Vl(t){Ul=t,ql(Ol)}function Wl(t){var e={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:t?t.type:1009,format:t?t.format:1023,encoding:t?t.encoding:3002,depthBuffer:!1,stencilBuffer:!1},i=Xl(e);return i.depthBuffer=!t,kl=Xl(e),i}function Zl(t){kl.dispose(),Ul.setRenderTarget(Fl),t.scissorTest=!1,t.setSize(t.width,t.height)}function ql(t){var e=new tt;e.add(new De(Nl[0],t)),Ul.compile(e,Rl)}function Xl(t){var e=new w(3*Ll,3*Ll,t);return e.texture.mapping=306,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Yl(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function Jl(t){var e=Ul.autoClear;Ul.autoClear=!1;for(var i=1;i20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${d} samples when the maximum is set to 20`);for(var p=[],f=0,m=0;m<20;++m){var v=m/u,g=Math.exp(-v*v/2);p.push(g),0==m?f+=g:m4?n-8+4:0),3*_,2*_),Ul.setRenderTarget(e),Ul.render(s,Rl)}function $l(){var t=new wa({uniforms:{envMap:{value:null},texelSize:{value:new v(1,1)},inputEncoding:{value:Cl[3e3]},outputEncoding:{value:Cl[3e3]}},vertexShader:ec(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${ic()}\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1});return t.type="EquirectangularToCubeUV",t}function tc(){var t=new wa({uniforms:{envMap:{value:null},inputEncoding:{value:Cl[3e3]},outputEncoding:{value:Cl[3e3]}},vertexShader:ec(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${ic()}\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1});return t.type="CubemapToCubeUV",t}function ec(){return"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"}function ic(){return"\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include \n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"}Vl.prototype={constructor:Vl,fromScene:function(t,e=0,i=.1,n=100){Fl=Ul.getRenderTarget();var r=Wl();return function(t,e,i,n){var r=new Je(90,1,e,i),o=[1,1,1,1,-1,1],a=[1,1,-1,-1,-1,1],s=Ul.outputEncoding,h=Ul.toneMapping,l=Ul.toneMappingExposure,c=Ul.getClearColor(),u=Ul.getClearAlpha();Ul.toneMapping=1,Ul.toneMappingExposure=1,Ul.outputEncoding=3e3,t.scale.z*=-1;var d=t.background;if(d&&d.isColor){d.convertSRGBToLinear();var p=Math.max(d.r,d.g,d.b),f=Math.min(Math.max(Math.ceil(Math.log2(p)),-128),127);d=d.multiplyScalar(Math.pow(2,-f));var m=(f+128)/255;Ul.setClearColor(d,m),t.background=null}for(var v=0;v<6;v++){var g=v%3;0==g?(r.up.set(0,o[v],0),r.lookAt(a[v],0,0)):1==g?(r.up.set(0,0,o[v]),r.lookAt(0,a[v],0)):(r.up.set(0,o[v],0),r.lookAt(0,0,a[v])),Yl(n,g*Ll,v>2?Ll:0,Ll,Ll),Ul.setRenderTarget(n),Ul.render(t,r)}Ul.toneMapping=h,Ul.toneMappingExposure=l,Ul.outputEncoding=s,Ul.setClearColor(c,u),t.scale.z*=-1}(t,i,n,r),e>0&&Kl(r,0,0,e),Jl(r),Zl(r),r},fromEquirectangular:function(t){return t.magFilter=1003,t.minFilter=1003,t.generateMipmaps=!1,this.fromCubemap(t)},fromCubemap:function(t){Fl=Ul.getRenderTarget();var e=Wl(t);return function(t,e){var i=new tt;t.isCubeTexture?null==Il&&(Il=tc()):null==zl&&(zl=$l());var n=t.isCubeTexture?Il:zl;i.add(new De(Nl[0],n));var r=n.uniforms;r.envMap.value=t,t.isCubeTexture||r.texelSize.value.set(1/t.image.width,1/t.image.height);r.inputEncoding.value=Cl[t.encoding],r.outputEncoding.value=Cl[t.encoding],Yl(e,0,0,3*Ll,2*Ll),Ul.setRenderTarget(e),Ul.render(i,Rl)}(t,e),Jl(e),Zl(e),e},compileCubemapShader:function(){null==Il&&ql(Il=tc())},compileEquirectangularShader:function(){null==zl&&ql(zl=$l())},dispose:function(){Ol.dispose(),null!=Il&&Il.dispose(),null!=zl&&zl.dispose();for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:{},i=e.vertices,n=void 0===i?[]:i,r=e.faces,o=void 0===r?[]:r,a=e.texture,s=void 0===a?null:a,l=e.uvSets,c=void 0===l?[]:l,u=e.normals,d=void 0===u?[]:u,p=e.translation,f=void 0===p?[0,0,0]:p,m=e.rotation,v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},_=arguments.length>3&&void 0!==arguments[3]&&arguments[3];h()(this,t),this.id=Object(hc.c)(),this.vertices=n,this.translation=f,this.rotation=m,this.faces=o,this.textureInfo=s,this.normals=d,this.uvSets=c,this.filePrefix=v,this.isLoaded=!1,this.onLoad=g,this.geometry=null,this.mesh=null,this.texture=null,this.material=null,_&&this.getMaterial()}return c()(t,[{key:"getMaterial",value:function(){var t=this;if(this.material)return this.material;var e={color:16777215,transparent:!0,alphaTest:.2};return this.textureInfo&&(this.texture=(new rs).load(this.filePrefix+this.textureInfo.file,(function(){t.isLoaded=!0,t.onLoad()}),null,(function(t){console.log(t)})),this.textureInfo.wrapS&&(this.texture.wrapS=1e3),this.textureInfo.wrapT&&(this.texture.wrapT=1e3),this.texture.flipY=!1,e.map=this.texture),this.material=new Sa(e)}},{key:"getGeometry",value:function(){if(this.geometry)return this.geometry;var t=this.geometry=new Ge,e=!0,i=!1,n=void 0;try{for(var o,a=this.vertices[Symbol.iterator]();!(e=(o=a.next()).done);e=!0){var s=r()(o.value,3),h=s[0],l=s[1],c=s[2];t.vertices.push(new L(h,l,c))}}catch(t){i=!0,n=t}finally{try{e||null==a.return||a.return()}finally{if(i)throw n}}for(var u=[],d=0;d1&&void 0!==arguments[1]?arguments[1]:""),a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];h()(this,t),this.id=Object(hc.c)();var l=0;this.shapes=r.map((function(t){return new lc(t,o,(function(){++l===r.length&&(i.isLoaded=!0,i.onLoad())}),s)})),this.isLoaded=!1,this.onLoad=a,this.group=null,0===this.shapes.length&&(this.onLoad(),this.isLoaded=!0)}return c()(t,[{key:"getGroup",value:function(){if(this.group)return this.group;this.group=new ir;var t=!0,e=!1,i=void 0;try{for(var n,r=this.shapes[Symbol.iterator]();!(t=(n=r.next()).done);t=!0){var o=n.value;this.group.add(o.getMesh())}}catch(t){e=!0,i=t}finally{try{t||null==r.return||r.return()}finally{if(e)throw i}}return this.group}}],[{key:"forceLoad",value:function(e,i){return new Promise((function(n,r){var o=new t(e,i,(function(){n(o)}),!0)}))}}]),t}();i.d(e,"a",(function(){return uc}));var uc=function(){function t(){h()(this,t),this.shapes={},this.renderQueue=[],this.isRendering=!1,this.scene=null,this.renderer=null,this.camera=null,this.canvas=null}var e,i;return c()(t,[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.innerWidth,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.innerHeight;if(void 0!==window.OffscreenCanvas)this.canvas=new OffscreenCanvas(t,e);else{var i=document.createElement("canvas");i.width=t,i.height=e,this.canvas=i}this.renderer=new rr({canvas:this.canvas,alpha:!0}),this.renderer.setSize(t,e),this.camera=new Je(70,t/e,1,200),this.camera.position.z=40,this.scene=new tt;var n=new Is(16777215,1);n.position.set(1,1,2),this.camera.add(n),this.scene.add(this.camera);var r=new ks(4210752,1);this.scene.add(r)}},{key:"draw",value:(i=a()((function*(){var t=this;return this.renderer.render(this.scene,this.camera),new Promise(function(){var e=a()((function*(e,i){window.requestAnimationFrame(a()((function*(){t.canvas.convertToBlob?yield t.canvas.convertToBlob({type:"image/png"}).then(e,i):t.canvas.toBlob((function(t){return t?e(t):i()}),"image/png")})))}));return function(t,i){return e.apply(this,arguments)}}())})),function(){return i.apply(this,arguments)})},{key:"render",value:function(t){var e=this;return new Promise(function(){var i=a()((function*(i){e.renderQueue.push([t,i]),e.isRendering||(yield e.startRender())}));return function(t){return i.apply(this,arguments)}}())}},{key:"startRender",value:(e=a()((function*(){var t=this;if(!this.isRendering){for(this.isRendering=!0,this.clear();this.renderQueue.length>0;){var e=this.renderQueue.shift(),i=r()(e,2),n=i[0],o=i[1];console.log(n,o);var s=n.map(function(){var e=a()((function*(e){var i=yield fetch("blob/shape/".concat(e,".json")),n=yield i.json(),r=yield cc.forceLoad(n,"blob/texture/");t.add(r)}));return function(t){return e.apply(this,arguments)}}());yield Promise.all(s),this.rotate(Math.PI/180*-5,Math.PI/180*-30,0),o(yield this.draw()),this.clear()}this.isRendering=!1}})),function(){return e.apply(this,arguments)})},{key:"add",value:function(t){this.shapes[t.id]=t,this.scene.add(t.getGroup())}},{key:"remove",value:function(t){delete this.shapes[t.id],this.scene.remove(t.getGroup())}},{key:"clear",value:function(){for(var t=0,e=Object.values(this.shapes);t -
+
{ceilCurrent}/{base} ({Math.ceil(perc)}%)
diff --git a/src/head-render/HeadRenderer.js b/src/head-render/HeadRenderer.js index eeced71..5674432 100644 --- a/src/head-render/HeadRenderer.js +++ b/src/head-render/HeadRenderer.js @@ -84,16 +84,19 @@ export class HeadRenderer { this.clear(); while (this.renderQueue.length > 0) { let [objects, res] = this.renderQueue.shift(); - console.log(objects, res); - let shapePromises = objects.map(async x => { - let req = await fetch(`blob/shape/${x}.json`); - let json = await req.json(); - let shapeColl = await ShapeCollection.forceLoad(json, 'blob/texture/'); - this.add(shapeColl); - }); - await Promise.all(shapePromises); - this.rotate(-5 * (Math.PI / 180), -30 * (Math.PI / 180), 0); - res(await this.draw()); + try { + let shapePromises = objects.map(async x => { + let req = await fetch(`blob/shape/${x}.json`); + let json = await req.json(); + let shapeColl = await ShapeCollection.forceLoad(json, 'blob/texture/'); + this.add(shapeColl); + }); + await Promise.all(shapePromises); + this.rotate(-5 * (Math.PI / 180), -30 * (Math.PI / 180), 0); + res(await this.draw()); + } catch (e) { + console.log("Failed to render", objects); + } this.clear(); } diff --git a/src/utils.js b/src/utils.js index fdac9c7..7523af6 100644 --- a/src/utils.js +++ b/src/utils.js @@ -12,26 +12,26 @@ export function uuidv4() { } const COLORS = [ - '#fc5c65', + // '#fc5c65', '#fd9644', - '#fed330', + // '#fed330', '#26de81', - '#2bcbba', + // '#2bcbba', '#eb3b5a', - '#fa8231', - '#f7b731', - '#20bf6b', - '#0fb9b1', + // '#fa8231', + // '#f7b731', + // '#20bf6b', + // '#0fb9b1', '#45aaf2', - '#4b7bec', + // '#4b7bec', '#a55eea', - '#d1d8e0', - '#778ca3', - '#2d98da', - '#3867d6', - '#8854d0', - '#a5b1c2', - '#4b6584', + '#fff', + // '#778ca3', + // '#2d98da', + // '#3867d6', + // '#8854d0', + // '#a5b1c2', + // '#4b6584', ]; export function colorFromName(name) {