var AMRT=function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function n(e){for(var n=1;n=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;M(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:B(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e,t,n,i,r,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,r)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var o=e.apply(t,n);function s(e){a(o,i,r,s,l,"next",e)}function l(e){a(o,i,r,s,l,"throw",e)}s(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}Array.prototype.insert=function(e,t){this.splice(t,0,e)},Array.prototype.removeAt=function(e){return!(isNaN(e)||e>=this.length)&&this.splice(e,1)[0]},Array.prototype.remove=function(e){var t=this.indexOf(e);t>-1&&this.splice(t,1)},"function"!=typeof String.prototype.startsWith&&(String.prototype.startsWith=function(e){return this.slice(0,e.length)===e}),"function"!=typeof String.prototype.endsWith&&(String.prototype.endsWith=function(e){return-1!==this.indexOf(e,this.length-e.length)}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"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(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>8&255]+qe[e>>16&255]+qe[e>>24&255]+"-"+qe[255&t]+qe[t>>8&255]+"-"+qe[t>>16&15|64]+qe[t>>24&255]+"-"+qe[63&n|128]+qe[n>>8&255]+"-"+qe[n>>16&255]+qe[n>>24&255]+qe[255&i]+qe[i>>8&255]+qe[i>>16&255]+qe[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*et.DEG2RAD},radToDeg:function(e){return e*et.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){var t=Math.log(e)/Math.LN2;return t=t-Math.floor(t)<=.5?Math.floor(t):Math.ceil(t),Math.pow(2,t)}};function tt(e,t){this.x=e||0,this.y=t||0}function nt(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}Object.defineProperties(tt.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(tt.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?this.addVectors(e,t):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?this.subVectors(e,t):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.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(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}}),Object.assign(nt,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,a,o){var s=n[i+0],l=n[i+1],A=n[i+2],c=n[i+3],h=r[a+0],u=r[a+1],d=r[a+2],f=r[a+3];if(c!==f||s!==h||l!==u||A!==d){var p=1-o,m=s*h+l*u+A*d+c*f,v=m>=0?1:-1,g=1-m*m;if(g>Number.EPSILON){var y=Math.sqrt(g),w=Math.atan2(y,m*v);p=Math.sin(p*w)/y,o=Math.sin(o*w)/y}var x=o*v;if(s=s*p+h*x,l=l*p+u*x,A=A*p+d*x,c=c*p+f*x,p===1-o){var b=1/Math.sqrt(s*s+l*l+A*A+c*c);s*=b,l*=b,A*=b,c*=b}}e[t]=s,e[t+1]=l,e[t+2]=A,e[t+3]=c}}),Object.defineProperties(nt.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(nt.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(n/2),A=o(i/2),c=o(r/2),h=s(n/2),u=s(i/2),d=s(r/2);return"XYZ"===a?(this._x=h*A*c+l*u*d,this._y=l*u*c-h*A*d,this._z=l*A*d+h*u*c,this._w=l*A*c-h*u*d):"YXZ"===a?(this._x=h*A*c+l*u*d,this._y=l*u*c-h*A*d,this._z=l*A*d-h*u*c,this._w=l*A*c+h*u*d):"ZXY"===a?(this._x=h*A*c-l*u*d,this._y=l*u*c+h*A*d,this._z=l*A*d+h*u*c,this._w=l*A*c-h*u*d):"ZYX"===a?(this._x=h*A*c-l*u*d,this._y=l*u*c+h*A*d,this._z=l*A*d-h*u*c,this._w=l*A*c+h*u*d):"YZX"===a?(this._x=h*A*c+l*u*d,this._y=l*u*c+h*A*d,this._z=l*A*d-h*u*c,this._w=l*A*c-h*u*d):"XZY"===a&&(this._x=h*A*c-l*u*d,this._y=l*u*c-h*A*d,this._z=l*A*d+h*u*c,this._w=l*A*c+h*u*d),!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],l=n[9],A=n[2],c=n[6],h=n[10],u=i+s+h;return u>0?(t=.5/Math.sqrt(u+1),this._w=.25/t,this._x=(c-l)*t,this._y=(a-A)*t,this._z=(o-r)*t):i>s&&i>h?(t=2*Math.sqrt(1+i-s-h),this._w=(c-l)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+A)/t):s>h?(t=2*Math.sqrt(1+s-i-h),this._w=(a-A)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(l+c)/t):(t=2*Math.sqrt(1+h-i-s),this._w=(o-r)/t,this._x=(a+A)/t,this._y=(l+c)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(et.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},invert:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,A=t._w;return this._x=n*A+a*o+i*l-r*s,this._y=i*A+a*s+r*o-n*l,this._z=r*A+a*l+n*s-i*o,this._w=a*A-n*o-i*s-r*l,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var A=Math.sqrt(s),c=Math.atan2(A,o),h=Math.sin((1-t)*c)/A,u=Math.sin(t*c)/A;return this._w=a*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},slerpQuaternions:function(e,t,n){return this.copy(e).slerp(t,n)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var it=new at,rt=new nt;function at(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(at.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(rt.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(rt.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,A=s*n+o*t-r*i,c=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=l*s+h*-r+A*-o-c*-a,this.y=A*s+h*-a+c*-r-l*-o,this.z=c*s+h*-o+l*-a-A*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},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(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(e){return it.copy(this).projectOnVector(e),this.sub(it)},reflect:function(e){return this.sub(it.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());0===t&&console.error("Vector3: angleTo() can't handle zero length vectors.");var n=this.dot(e)/t;return Math.acos(et.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}});var ot,st=new at;function lt(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.assign(lt.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,l){var A=this.elements;return A[0]=e,A[1]=i,A[2]=o,A[3]=t,A[4]=r,A[5]=s,A[6]=n,A[7]=a,A[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(e){for(var t=0,n=e.count;t2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},ct=0;function ht(e,t,n,i,r,a,o,s,l,A){Object.defineProperty(this,"id",{value:ct++}),this.uuid=et.generateUUID(),this.name="",this.image=void 0!==e?e:ht.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:ht.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:j,this.wrapT=void 0!==i?i:j,this.magFilter=void 0!==r?r:Z,this.minFilter=void 0!==a?a:q,this.anisotropy=void 0!==l?l:1,this.format=void 0!==o?o:ce,this.type=void 0!==s?s:$,this.offset=new tt(0,0),this.repeat=new tt(1,1),this.center=new tt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new lt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==A?A:Oe,this.version=0,this.onUpdate=null}function ut(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function dt(e,t,n){this.width=e,this.height=t,this.scissor=new ut(0,0,e,t),this.scissorTest=!1,this.viewport=new ut(0,0,e,t),n=n||{},this.texture=new ht(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Z,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function ft(e,t,n){dt.call(this,e,t,n),this.samples=4}ht.DEFAULT_IMAGE=void 0,ht.DEFAULT_MAPPING=O,ht.prototype=Object.assign(Object.create(Je.prototype),{constructor:ht,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(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={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 i=this.image;if(void 0===i.uuid&&(i.uuid=et.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a1)switch(this.wrapS){case V:e.x=e.x-Math.floor(e.x);break;case j:e.x=e.x<0?0:1;break;case W:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case V:e.y=e.y-Math.floor(e.y);break;case j:e.y=e.y<0?0:1;break;case W:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(ht.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(ut.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(ut.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?this.addVectors(e,t):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?this.subVectors(e,t):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,a=.01,o=.1,s=e.elements,l=s[0],A=s[4],c=s[8],h=s[1],u=s[5],d=s[9],f=s[2],p=s[6],m=s[10];if(Math.abs(A-h)g&&v>y?vy?g0&&console.error("Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(bt.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,l,A,c,h,u,d,f,p){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=A,m[10]=c,m[14]=h,m[3]=u,m[7]=d,m[11]=f,m[15]=p,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 bt).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,i=1/pt.setFromMatrixColumn(e,0).length(),r=1/pt.setFromMatrixColumn(e,1).length(),a=1/pt.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),A=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){var h=a*A,u=a*c,d=o*A,f=o*c;t[0]=s*A,t[4]=-s*c,t[8]=l,t[1]=u+d*l,t[5]=h-f*l,t[9]=-o*s,t[2]=f-h*l,t[6]=d+u*l,t[10]=a*s}else if("YXZ"===e.order){var p=s*A,m=s*c,v=l*A,g=l*c;t[0]=p+g*o,t[4]=v*o-m,t[8]=a*l,t[1]=a*c,t[5]=a*A,t[9]=-o,t[2]=m*o-v,t[6]=g+p*o,t[10]=a*s}else if("ZXY"===e.order){p=s*A,m=s*c,v=l*A,g=l*c;t[0]=p-g*o,t[4]=-a*c,t[8]=v+m*o,t[1]=m+v*o,t[5]=a*A,t[9]=g-p*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){h=a*A,u=a*c,d=o*A,f=o*c;t[0]=s*A,t[4]=d*l-u,t[8]=h*l+f,t[1]=s*c,t[5]=f*l+h,t[9]=u*l-d,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var y=a*s,w=a*l,x=o*s,b=o*l;t[0]=s*A,t[4]=b-y*c,t[8]=x*c+w,t[1]=c,t[5]=a*A,t[9]=-o*A,t[2]=-l*A,t[6]=w*c+x,t[10]=y-b*c}else if("XZY"===e.order){y=a*s,w=a*l,x=o*s,b=o*l;t[0]=s*A,t[4]=-c,t[8]=l*A,t[1]=y*c+b,t[5]=a*A,t[9]=w*c-x,t[2]=x*c-w,t[6]=o*A,t[10]=b*c+y}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(vt,e,gt)},lookAt:function(e,t,n){var i=this.elements;return xt.subVectors(e,t),0===xt.lengthSq()&&(xt.z=1),xt.normalize(),yt.crossVectors(n,xt),0===yt.lengthSq()&&(1===Math.abs(n.z)?xt.x+=1e-4:xt.z+=1e-4,xt.normalize(),yt.crossVectors(n,xt)),yt.normalize(),wt.crossVectors(xt,yt),i[0]=yt.x,i[4]=wt.x,i[8]=xt.x,i[1]=yt.y,i[5]=wt.y,i[9]=xt.y,i[2]=yt.z,i[6]=wt.z,i[10]=xt.z,this},multiply:function(e,t){return void 0!==t?(console.warn("Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],A=n[1],c=n[5],h=n[9],u=n[13],d=n[2],f=n[6],p=n[10],m=n[14],v=n[3],g=n[7],y=n[11],w=n[15],x=i[0],b=i[4],M=i[8],C=i[12],B=i[1],E=i[5],S=i[9],T=i[13],_=i[2],I=i[6],L=i[10],F=i[14],k=i[3],P=i[7],U=i[11],D=i[15];return r[0]=a*x+o*B+s*_+l*k,r[4]=a*b+o*E+s*I+l*P,r[8]=a*M+o*S+s*L+l*U,r[12]=a*C+o*T+s*F+l*D,r[1]=A*x+c*B+h*_+u*k,r[5]=A*b+c*E+h*I+u*P,r[9]=A*M+c*S+h*L+u*U,r[13]=A*C+c*T+h*F+u*D,r[2]=d*x+f*B+p*_+m*k,r[6]=d*b+f*E+p*I+m*P,r[10]=d*M+f*S+p*L+m*U,r[14]=d*C+f*T+p*F+m*D,r[3]=v*x+g*B+y*_+w*k,r[7]=v*b+g*E+y*I+w*P,r[11]=v*M+g*S+y*L+w*U,r[15]=v*C+g*T+y*F+w*D,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(e){for(var t=0,n=e.count;t1){for(var t=0;t1){for(var t=0;t0){i.children=[];for(s=0;s0&&(n.geometries=h),u.length>0&&(n.materials=u),d.length>0&&(n.textures=d),f.length>0&&(n.images=f),o.length>0&&(n.shapes=o)}return n.object=i,n;function p(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(this.viewer&&this.viewer.renderManager.render(),void 0===t&&(t=!0),this.name=e.name,this.lastUUID=e.uuid,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,e.ID&&(this.ID=e.ID),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;ns)return!1}return!0}Object.assign(tn.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;sr&&(r=A),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;sr&&(r=A),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("Box3: .getParameter() target is now required"),t=new at),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Ht),Ht.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Jt),qt.subVectors(this.max,Jt),jt.subVectors(e.a,Jt),Wt.subVectors(e.b,Jt),Xt.subVectors(e.c,Jt),Yt.subVectors(Wt,jt),Kt.subVectors(Xt,Wt),Zt.subVectors(jt,Xt);var t=[0,-Yt.z,Yt.y,0,-Kt.z,Kt.y,0,-Zt.z,Zt.y,Yt.z,0,-Yt.x,Kt.z,0,-Kt.x,Zt.z,0,-Zt.x,-Yt.y,Yt.x,0,-Kt.y,Kt.x,0,-Zt.y,Zt.x,0];return!!nn(t,jt,Wt,Xt,qt)&&(!!nn(t=[1,0,0,0,1,0,0,0,1],jt,Wt,Xt,qt)&&($t.crossVectors(Yt,Kt),nn(t=[$t.x,$t.y,$t.z],jt,Wt,Xt,qt)))},clampPoint:function(e,t){return void 0===t&&(console.warn("Box3: .clampPoint() target is now required"),t=new at),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Ht.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(Ht).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(Gt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Gt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Gt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Gt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Gt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Gt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Gt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Gt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Gt)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var rn=new tn;function an(e,t){this.center=void 0!==e?e:new at,this.radius=void 0!==t?t:0}Object.assign(an.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):rn.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(e=new tn),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var on=new at,sn=new at,ln=new at,An=new at,cn=new at,hn=new at,un=new at;function dn(e,t){this.origin=void 0!==e?e:new at,this.direction=void 0!==t?t:new at(0,0,-1)}Object.assign(dn.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(t=new at),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,on)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("Ray: .closestPointToPoint() target is now required"),t=new at),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=on.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(on.copy(this.direction).multiplyScalar(t).add(this.origin),on.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,i){sn.copy(e).add(t).multiplyScalar(.5),ln.copy(t).sub(e).normalize(),An.copy(this.origin).sub(sn);var r,a,o,s,l=.5*e.distanceTo(t),A=-this.direction.dot(ln),c=An.dot(this.direction),h=-An.dot(ln),u=An.lengthSq(),d=Math.abs(1-A*A);if(d>0)if(a=A*c-h,s=l*d,(r=A*h-c)>=0)if(a>=-s)if(a<=s){var f=1/d;o=(r*=f)*(r+A*(a*=f)+2*c)+a*(A*r+a+2*h)+u}else a=l,o=-(r=Math.max(0,-(A*a+c)))*r+a*(a+2*h)+u;else a=-l,o=-(r=Math.max(0,-(A*a+c)))*r+a*(a+2*h)+u;else a<=-s?o=-(r=Math.max(0,-(-A*l+c)))*r+(a=r>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+u:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+u):o=-(r=Math.max(0,-(A*l+c)))*r+(a=r>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+u;else a=A>0?-l:l,o=-(r=Math.max(0,-(A*a+c)))*r+a*(a+2*h)+u;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(ln).multiplyScalar(a).add(sn),o},intersectSphere:function(e,t){on.subVectors(e.center,this.origin);var n=on.dot(this.direction),i=on.dot(on)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,a,o,s,l=1/this.direction.x,A=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),A>=0?(r=(e.min.y-h.y)*A,a=(e.max.y-h.y)*A):(r=(e.max.y-h.y)*A,a=(e.min.y-h.y)*A),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s=0?n:i,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,on)},intersectTriangle:function(e,t,n,i,r){cn.subVectors(t,e),hn.subVectors(n,e),un.crossVectors(cn,hn);var a,o=this.direction.dot(un);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}An.subVectors(this.origin,e);var s=a*this.direction.dot(hn.crossVectors(An,hn));if(s<0)return null;var l=a*this.direction.dot(cn.cross(An));if(l<0)return null;if(s+l>o)return null;var A=-a*An.dot(un);return A<0?null:this.at(A/o,r)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var fn=new at,pn=new at,mn=new lt;function vn(e,t){this.normal=void 0!==e?e:new at(1,0,0),this.constant=void 0!==t?t:0}Object.assign(vn.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var i=fn.subVectors(n,t).cross(pn.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("Plane: .projectPoint() target is now required"),t=new at),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("Plane: .intersectLine() target is now required"),t=new at);var n=e.delta(fn),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?void 0:t.copy(n).multiplyScalar(r).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("Plane: .coplanarPoint() target is now required"),e=new at),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||mn.getNormalMatrix(e),i=this.coplanarPoint(fn).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var gn=new at,yn=new at,wn=new at,xn=new at,bn=new at,Mn=new at,Cn=new at,Bn=new at,En=new at,Sn=new at;function Tn(e,t,n){this.a=void 0!==e?e:new at,this.b=void 0!==t?t:new at,this.c=void 0!==n?n:new at}Object.assign(Tn,{getNormal:function(e,t,n,i){void 0===i&&(i=new at),i.subVectors(n,t),gn.subVectors(e,t),i.cross(gn);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)},getBarycoord:function(e,t,n,i,r){gn.subVectors(i,t),yn.subVectors(n,t),wn.subVectors(e,t);var a=gn.dot(gn),o=gn.dot(yn),s=gn.dot(wn),l=yn.dot(yn),A=yn.dot(wn),c=a*l-o*o;if(void 0===r&&(r=new at),0===c)return r.set(-2,-1,-1);var h=1/c,u=(l*s-o*A)*h,d=(a*A-o*s)*h;return r.set(1-u-d,d,u)},containsPoint:function(e,t,n,i){return Tn.getBarycoord(e,t,n,i,xn),xn.x>=0&&xn.y>=0&&xn.x+xn.y<=1},getUV:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,xn),s.set(0,0),s.addScaledVector(r,xn.x),s.addScaledVector(a,xn.y),s.addScaledVector(o,xn.z),s},isFrontFacing:function(e,t,n,i){return gn.subVectors(n,t),yn.subVectors(e,t),gn.cross(yn).dot(i)<0}}),Object.assign(Tn.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return gn.subVectors(this.c,this.b),yn.subVectors(this.a,this.b),.5*gn.cross(yn).length()},getMidpoint:function(e){return void 0===e&&(e=new at),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Tn.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(e=new vn),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Tn.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return Tn.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return Tn.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return Tn.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(t=new at);var n,i,r=this.a,a=this.b,o=this.c;bn.subVectors(a,r),Mn.subVectors(o,r),Bn.subVectors(e,r);var s=bn.dot(Bn),l=Mn.dot(Bn);if(s<=0&&l<=0)return t.copy(r);En.subVectors(e,a);var A=bn.dot(En),c=Mn.dot(En);if(A>=0&&c<=A)return t.copy(a);var h=s*c-A*l;if(h<=0&&s>=0&&A<=0)return n=s/(s-A),t.copy(r).addScaledVector(bn,n);Sn.subVectors(e,o);var u=bn.dot(Sn),d=Mn.dot(Sn);if(d>=0&&u<=d)return t.copy(o);var f=u*l-s*d;if(f<=0&&l>=0&&d<=0)return i=l/(l-d),t.copy(r).addScaledVector(Mn,i);var p=A*d-u*c;if(p<=0&&c-A>=0&&u-d>=0)return Cn.subVectors(o,a),i=(c-A)/(c-A+(u-d)),t.copy(a).addScaledVector(Cn,i);var m=1/(p+f+h);return n=f*m,i=h*m,t.copy(r).addScaledVector(bn,n).addScaledVector(Mn,i)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var _n={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},In={h:0,s:0,l:0},Ln={h:0,s:0,l:0};function Fn(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function kn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Pn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Un(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function Dn(e,t,n,i,r,a){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new at,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new Fn,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}Object.assign(Fn.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=et.euclideanModulo(e,1),t=et.clamp(t,0,1),n=et.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=kn(r,i,e+1/3),this.g=kn(r,i,e),this.b=kn(r,i,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var A=n[1],c=A.length;if(3===c)return this.r=parseInt(A.charAt(0)+A.charAt(0),16)/255,this.g=parseInt(A.charAt(1)+A.charAt(1),16)/255,this.b=parseInt(A.charAt(2)+A.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(A.charAt(0)+A.charAt(1),16)/255,this.g=parseInt(A.charAt(2)+A.charAt(3),16)/255,this.b=parseInt(A.charAt(4)+A.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=_n[e];return void 0!==t?this.setHex(t):console.warn("Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=Pn(e.r),this.g=Pn(e.g),this.b=Pn(e.b),this},copyLinearToSRGB:function(e){return this.r=Un(e.r),this.g=Un(e.g),this.b=Un(e.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(e){void 0===e&&(console.warn("Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,a=this.b,o=Math.max(i,r,a),s=Math.min(i,r,a),l=(s+o)/2;if(s===o)t=0,n=0;else{var A=o-s;switch(n=l<=.5?A/(o+s):A/(2-o-s),o){case i:t=(r-a)/A+(rt&&(t=e[n]);return t}On.prototype=Object.assign(Object.create(Je.prototype),{constructor:On,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(this.type+": '"+t+"' is not a property of this material.")}else console.warn(this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),0!==this.vertexColors&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexTangents=e.vertexTangents,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(On.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Nn.prototype=Object.create(On.prototype),Nn.prototype.constructor=Nn,Nn.prototype.isMeshBasicMaterial=!0,Nn.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},Object.defineProperty(zn.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(zn.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i0,o=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var A=0;A0){c=[];for(A=0;A0&&0===n.length&&console.error("DirectGeometry: Faceless geometries are not supported.");for(A=0;A65535?Xn:jn)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new lt).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0);var i=this.attributes.tangent;void 0!==i&&((new lt).getNormalMatrix(e).applyToBufferAttribute(i),i.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},applyMatrix4:function(e){return this.applyMatrix(e),this},rotateX:function(e){return ei.makeRotationX(e),this.applyMatrix(ei),this},rotateY:function(e){return ei.makeRotationY(e),this.applyMatrix(ei),this},rotateZ:function(e){return ei.makeRotationZ(e),this.applyMatrix(ei),this},translate:function(e,t,n){return ei.makeTranslation(e,t,n),this.applyMatrix(ei),this},scale:function(e,t,n){return ei.makeScale(e,t,n),this.applyMatrix(ei),this},lookAt:function(e){return ti.lookAt(e),ti.updateMatrix(),this.applyMatrix(ti.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ni).negate(),this.translate(ni.x,ni.y,ni.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Yn(3*t.vertices.length,3),i=new Yn(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new Yn(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new zn(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.setAttribute("color",new zn(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new zn(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new zn(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[o],A=0,c=l.length;A0){var d=new Yn(4*e.skinIndices.length,4);this.setAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new Yn(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new tn);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n.01&&oi.y>.01&&oi.z<.01?this.boundingBox.max.z+=.01:oi.x>.01&&oi.y<.01&&oi.z>.01?this.boundingBox.max.y+=.01:oi.x<.01&&oi.y>.01&&oi.z>.01&&(this.boundingBox.max.x+=.01),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new an);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(ii.setFromBufferAttribute(e),t)for(var i=0,r=t.length;i0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var n in r){var a=(u=r[n]).toJSON();""!==u.name&&(a.name=u.name),e.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],A=[],c=0,h=l.length;c0&&(o[n]=A,s=!0)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new si).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],A=s[t];for(n=0,i=A.length;n=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});var Ai=new bt,ci=new dn,hi=new an,ui=new at,di=new at,fi=new at,pi=new at,mi=new at,vi=new at,gi=new at,yi=new at,wi=new at,xi=new tt,bi=new tt,Mi=new tt,Ci=new at,Bi=new at;function Ei(e,t){zt.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new si,this.material=void 0!==t?t:new Nn({color:16777215*Math.random()}),this.drawMode=0,this.updateMorphTargets()}Ei.prototype=Object.assign(Object.create(zt.prototype),{constructor:Ei,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return zt.prototype.copy.call(this,e),this.drawMode=e.drawMode,void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e0&&console.error("Mesh.updateMorphTargets() no longer supports Geometry. Use BufferGeometry instead.")}},raycast:function(e,t){var n,i=this.geometry,r=this.material,a=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),hi.copy(i.boundingSphere),hi.applyMatrix4(a),!1!==e.ray.intersectsSphere(hi)&&(Ai.getInverse(a),ci.copy(e.ray).applyMatrix4(Ai),null===i.boundingBox||!1!==ci.intersectsBox(i.boundingBox))))if(0===this.drawMode){if(i.isBufferGeometry){var o,s,l,A,c,h,u,d,f,p=i.index,m=i.attributes.position,v=i.morphAttributes.position,g=i.morphTargetsRelative,y=i.attributes.uv,w=i.attributes.uv2,x=i.groups,b=i.drawRange;if(null!==p)if(Array.isArray(r))for(A=0,h=x.length;A0&&(E=I);for(var L=0,F=_.length;Ln.far?null:{distance:l,point:Bi.clone(),object:e}},checkBufferGeometryIntersection:function(e,t,n,i,r,a,o,s,l,A,c,h){this.getVertexByIndex(ui,r,A),this.getVertexByIndex(di,r,c),this.getVertexByIndex(fi,r,h);var u=e.morphTargetInfluences;if(t.morphTargets&&a&&u){gi.set(0,0,0),yi.set(0,0,0),wi.set(0,0,0);for(var d=0,f=a.length;d0)for(A=0;A0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n=0;n--){var f=u[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o0,m=d.vertexNormals.length>0,v=1!==d.color.r||1!==d.color.g||1!==d.color.b,g=d.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,p),y=M(y,5,m),y=M(y,6,v),y=M(y,7,g),o.push(y),o.push(d.a,d.b,d.c),o.push(d.materialIndex),f){var w=this.faceVertexUvs[0][r];o.push(E(w[0]),E(w[1]),E(w[2]))}if(p&&o.push(C(d.normal)),m){var x=d.vertexNormals;o.push(C(x[0]),C(x[1]),C(x[2]))}if(v&&o.push(B(d.color)),g){var b=d.vertexColors;o.push(B(b[0]),B(b[1]),B(b[2]))}}function M(e,t,n){return n?e|1<0&&(e.data.colors=A),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new Li).copy(this)},copy:function(e){var t,n,i,r,a,o;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=e.name;var s=e.vertices;for(t=0,n=s.length;t0?1:-1,d.push(_.x,_.y,_.z),f.push(g/l),f.push(1-y/A),S+=1}}for(y=0;y0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return Object.keys(r).length>0&&(t.extensions=r),t},Oi.prototype=Object.assign(Object.create(zt.prototype),{constructor:Oi,isCamera:!0,copy:function(e,t){return zt.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("Camera: .getWorldDirection() target is now required"),e=new at),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){zt.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverseR.getInverse(this.matrixWorld.clone().multiply(this.rotateMatrix)),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Ni.prototype=Object.assign(Object.create(Oi.prototype),{constructor:Ni,isPerspectiveCamera:!0,copy:function(e,t){return Oi.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*et.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*et.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*et.RAD2DEG*Math.atan(Math.tan(.5*et.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(e,t,n,i,r,a){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*et.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=zt.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});var zi=90;function Qi(e,t,n,i){zt.call(this),this.type="CubeCamera";var r=new Ni(zi,1,e,t);r.up.set(0,-1,0),r.lookAt(new at(1,0,0)),this.add(r);var a=new Ni(zi,1,e,t);a.up.set(0,-1,0),a.lookAt(new at(-1,0,0)),this.add(a);var o=new Ni(zi,1,e,t);o.up.set(0,0,1),o.lookAt(new at(0,1,0)),this.add(o);var s=new Ni(zi,1,e,t);s.up.set(0,0,-1),s.lookAt(new at(0,-1,0)),this.add(s);var l=new Ni(zi,1,e,t);l.up.set(0,-1,0),l.lookAt(new at(0,0,1)),this.add(l);var A=new Ni(zi,1,e,t);A.up.set(0,-1,0),A.lookAt(new at(0,0,-1)),this.add(A),i=i||{format:Ae,magFilter:Z,minFilter:Z},this.renderTarget=new Gi(n,n,i),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=e.getRenderTarget(),i=this.renderTarget,c=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,a),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,s),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=c,e.setRenderTarget(i,5),e.render(t,A),e.setRenderTarget(n)},this.clear=function(e,t,n,i){for(var r=e.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)e.setRenderTarget(a,o),e.clear(t,n,i);e.setRenderTarget(r)}}function Gi(e,t,n){dt.call(this,e,t,n)}function Hi(e,t,n,i,r,a,o,s,l,A,c,h){ht.call(this,null,a,o,s,l,A,i,r,c,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:X,this.minFilter=void 0!==A?A:X,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Qi.prototype=Object.create(zt.prototype),Qi.prototype.constructor=Qi,Gi.prototype=Object.create(dt.prototype),Gi.prototype.constructor=Gi,Gi.prototype.isWebGLRenderTargetCube=!0,Gi.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new Qt,i={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 Ri({type:"CubemapFromEquirect",uniforms:Pi(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;var a=new Ei(new ki(5,5,5),r);n.add(a);var o=new Qi(1,10,1);return o.renderTarget=this,o.renderTarget.texture.name="CubeCameraTexture",o.update(e,n),a.geometry.dispose(),a.material.dispose(),this},Hi.prototype=Object.create(ht.prototype),Hi.prototype.constructor=Hi,Hi.prototype.isDataTexture=!0;var Vi=new an,ji=new at;function Wi(e,t,n,i,r,a){this.planes=[void 0!==e?e:new vn,void 0!==t?t:new vn,void 0!==n?n:new vn,void 0!==i?i:new vn,void 0!==r?r:new vn,void 0!==a?a:new vn]}Object.assign(Wi.prototype,{set:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],A=n[6],c=n[7],h=n[8],u=n[9],d=n[10],f=n[11],p=n[12],m=n[13],v=n[14],g=n[15];return t[0].setComponents(o-i,c-s,f-h,g-p).normalize(),t[1].setComponents(o+i,c+s,f+h,g+p).normalize(),t[2].setComponents(o+r,c+l,f+u,g+m).normalize(),t[3].setComponents(o-r,c-l,f-u,g-m).normalize(),t[4].setComponents(o-a,c-A,f-d,g-v).normalize(),t[5].setComponents(o+a,c+A,f+d,g+v).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Vi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Vi)},intersectsSprite:function(e){return Vi.center.set(0,0,0),Vi.radius=.7071067811865476,Vi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Vi)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,ji.y=i.normal.y>0?e.max.y:e.min.y,ji.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(ji)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0},toArray:function(){for(var e=[],t=0;t<6;t++){var n=this.planes[t].normal.toArray();e.push.apply(e,n),n=null,e.push(this.planes[t].constant)}return e},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],A=n[6],c=n[7],h=n[8],u=n[9],d=n[10],f=n[11],p=n[12],m=n[13],v=n[14],g=n[15];return t[0].setComponents(o-i,c-s,f-h,g-p).normalize(),t[1].setComponents(o+i,c+s,f+h,g+p).normalize(),t[2].setComponents(o+r,c+l,f+u,g+m).normalize(),t[3].setComponents(o-r,c-l,f-u,g-m).normalize(),t[4].setComponents(o-a,c-A,f-d,g-v).normalize(),t[5].setComponents(o+a,c+A,f+d,g+v).normalize(),this}});var Xi={alphamap_fragment:"\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",alphamap_pars_fragment:"\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",alphatest_fragment:"\n#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",aomap_fragment:"\n#ifdef USE_AOMAP\n\n\t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\n\t#endif\n\n#endif\n",aomap_pars_fragment:"\n#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif\n",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n\n#ifdef USE_TANGENT\n\n\tvec3 objectTangent = vec3( tangent.xyz );\n\n#endif\n",bsdfs:'\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via \'environmentBRDF\' from "Physically Based Shading on Mobile"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n\n}\n\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\n\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t// page 32, equation 26: E[window1]\n\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t// this is intended to be used on spot and point lights who are represented as luminous intensity\n\t// but who must be converted to luminous irradiance for surface lighting calculation\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\tif( cutoffDistance > 0.0 ) {\n\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t}\n\n\treturn distanceFalloff;\n\n#else\n\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n\t}\n\n\treturn 1.0;\n\n#endif\n\n}\n\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\n\treturn RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\n\t// Original approximation by Christophe Schlick \'94\n\t// float fresnel = pow( 1.0 - dotLH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH \'13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n\n} // validated\n\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\n\t// See F_Schlick\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\n\treturn Fr * fresnel + F0;\n\n}\n\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (34)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\t// geometry term (normalized) = G(l)⋅G(v) / 4(n⋅l)(n⋅v)\n\t// also see #12151\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\n\treturn 1.0 / ( gl * gv );\n\n} // validated\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\n\t// dotNL and dotNV are explicitly swapped. This is not a mistake.\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility\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\n\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\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\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\tfloat D = D_GGX( alpha, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n// Rect Area Light\n\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\n// code: https://github.com/selfshadow/ltc_code/\n\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\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\n\tfloat dotNV = saturate( dot( N, V ) );\n\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\treturn uv;\n\n}\n\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\n\t// An approximation of the form factor of a horizon-clipped rectangle.\n\n\tfloat l = length( f );\n\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n\n}\n\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\n\tfloat x = dot( v1, v2 );\n\n\tfloat y = abs( x );\n\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\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\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\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\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\n\t// transform rect\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\n\t// project rect onto sphere\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\n\t// calculate vector form factor\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\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see referece)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\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\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\n\treturn specularColor * brdf.x + brdf.y;\n\n} // validated\n\n// Fdez-Agüera\'s "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\n\t//float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\t//float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n// source: http://simonstechblog.blogspot.ca/2011/12/microfacet-brdf.html\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\n\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs#L94\nfloat D_Charlie(float roughness, float NoH) {\n\t// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs#L136\nfloat V_Neubelt(float NoV, float NoL) {\n\t// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\n\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n\n}\n\n#endif\n',bumpmap_pars_fragment:"\n#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n\t// http://api.unrealengine.com/attachments/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/mm_sfgrad_bump.pdf\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\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\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\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;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",clipping_planes_fragment:"\nfloat clipping_opacity = 1.0;\n#if NUM_CLIPPING_PLANES > 0\n\n\tvec4 plane;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w && clippingTransparent ) clipping_opacity= 0.3;\n if ( dot( vViewPosition, plane.xyz ) > plane.w && !clippingTransparent ) discard;\n\t\t\n\t}\n\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\tbool clipped = true;\n\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t\n\n\t\t}\n\n\t\tif ( clipped ){\n\t\t if(clippingTransparent)\n\t\t clipping_opacity= 0.3;\n\t\t else\n\t\t discard;\n\t\t}\n\n\t#endif\n\n#endif\n",clipping_planes_pars_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n",clipping_planes_pars_vertex:"\n#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"\n#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"\n#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif\n",color_pars_fragment:"\n#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",color_pars_vertex:"\n#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",color_vertex:"\n#ifdef USE_COLOR\n\n\tvColor.xyz = color.xyz;\n\n#endif\n",common:"\n#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\n#ifndef saturate\n// may have defined saturate() already\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\n\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 ) ); }\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\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\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\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\n\treturn - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n\nmat3 transposeMat3( const in mat3 m ) {\n\n\tmat3 tmp;\n\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\n\treturn tmp;\n\n}\n\n// https://en.wikipedia.org/wiki/Relative_luminance\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\n\treturn dot( weights, color.rgb );\n\n}\n\n \nbool isPerspectiveMatrix( mat4 m ) {\n\n return m[ 2 ][ 3 ] == - 1.0;\n\n}\n",cube_uv_reflection_fragment:"\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n#define cubeUV_textureSize (1024.0)\n\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\n\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\t// Clamp the value to the max mip level counts. hard coded to 6 mips\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\n\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\t// float powScale = exp2(roughnessLevel + mipLevel);\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\t// float scale = 1.0 / exp2(roughnessLevel + 2.0 + mipLevel);\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\t// float mipOffset = 0.75*(1.0 - 1.0/exp2(mipLevel))/exp2(roughnessLevel);\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\n\tfloat rcpPowScale = 1.0 / powScale;\n\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\n\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\n\t// round to nearest mipmap if we are not interpolating.\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\n\t// Tri linear interpolation.\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\n\tvec4 result = mix(color10, color20, t);\n\n\treturn vec4(result.rgb, 1.0);\n}\n\nvec4 textureCubeUVSample( sampler2D envMap, vec3 reflectedDirection) {\n\n\tvec2 uv_10 = getCubeUV(reflectedDirection, 0.0, 0.0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\n\treturn color10;\n}\n\n#endif\n",defaultnormal_vertex:"\nvec3 transformedNormal = objectNormal;\n\n#ifdef USE_INSTANCING\n\n\ttransformedNormal = mat3( instanceMatrix ) * transformedNormal;\n\n#endif\n\ntransformedNormal = normalMatrix * transformedNormal;\n\n#ifdef FLIP_SIDED\n\n\ttransformedNormal = - transformedNormal;\n\n#endif\n\n#ifdef USE_TANGENT\n\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\n\t#ifdef FLIP_SIDED\n\n\t\ttransformedTangent = - transformedTangent;\n\n\t#endif\n\n#endif\n",displacementmap_pars_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n",displacementmap_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n\n#endif\n",emissivemap_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n",emissivemap_pars_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n",encodings_fragment:"\ngl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\n// For a discussion of what this is, please read this: http://lousodrome.net/blog/light/2013/05/26/gamma-correct-and-hdr-rendering-in-a-32-bits-buffer/\n\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\n\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\n\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\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}\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}\n\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\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// return vec4( value.brg, ( 3.0 + 128.0 ) / 256.0 );\n}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\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}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\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 = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\n\n// LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html\n\n// M matrix, for encoding\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}\n\n// Inverse M matrix, for decoding\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}\n",envmap_fragment:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\n\t\t}\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\n\t\tvec2 sampleUV;\n\n\t\treflectVec = normalize( reflectVec );\n\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\n\t\treflectVec = normalize( reflectVec );\n\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\n\t#else\n\n\t\tvec4 envColor = vec4( 0.0 );\n\n\t#endif\n\n\tenvColor = envMapTexelToLinear( envColor );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",envmap_common_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\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\n",envmap_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n\n#endif\n",envmap_pars_vertex:"\n#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n",envmap_physical_pars_fragment:"\n#if defined( USE_ENVMAP )\n\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\n\tvec3 getLightProbeIndirectIrradiance( /*const in SpecularLightProbe specularLightProbe,*/ const in GeometricContext geometry, const in int maxMIPLevel ) {\n\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\n\t\t\t// TODO: replace with properly filtered cubemaps and access the irradiance LOD level, be it the last LOD level\n\t\t\t// of a specular cubemap, or just the default level of a specially created irradiance cubemap.\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\n\t\t\t#else\n\n\t\t\t\t// force the bias high to get the last LOD level as it is the most blurred.\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\n\t\t#else\n\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\n\t\t#endif\n \n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t}\n\n\t// Trowbridge-Reitz distribution to Mip level, following the logic of http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\n\t\t// clamp to allowable LOD ranges.\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\n\t}\n\n\tvec3 getLightProbeIndirectRadiance( /*const in SpecularLightProbe specularLightProbe,*/ const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\n\t\t // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\n\t\t#else\n\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\n\t\t#endif\n\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, roughness );\n\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\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\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t}\n\n#endif\n",envmap_vertex:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex;\n\n\t\tif ( isOrthographic ) { \n\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\t}\n\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\n\n\tfogDepth = -mvPosition.z;\n\n#endif\n",fog_pars_vertex:"\n#ifdef USE_FOG\n\n\tvarying float fogDepth;\n\n#endif\n",fog_fragment:"\n#ifdef USE_FOG\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n",fog_pars_fragment:"\n#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\n\t#endif\n\n#endif\n",gradientmap_pars_fragment:"\n#ifdef TOON\n\n\tuniform sampler2D gradientMap;\n\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\n\t\t// dotNL will be from -1.0 to 1.0\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\n\t\t#ifdef USE_GRADIENTMAP\n\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\n\t\t#else\n\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\n\t\t#endif\n\n\n\t}\n\n#endif\n",lightmap_fragment:"\n#ifdef USE_LIGHTMAP\n\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity; // factor of PI should not be present; included here to prevent breakage\n\n#endif\n",lightmap_pars_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif\n",lights_lambert_vertex:"\nvec3 diffuse = vec3( 1.0 );\n\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\n\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\n\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\n\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n\n#if NUM_POINT_LIGHTS > 0\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if NUM_SPOT_LIGHTS > 0\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\t}\n\n#endif\n\n/*\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\t// TODO (abelnation): implement\n\n\t}\n\n#endif\n*/\n\n#if NUM_DIR_LIGHTS > 0\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if NUM_HEMI_LIGHTS > 0\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\n\t\t#endif\n\n\t}\n\n#endif\n",lights_pars_begin:"\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\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\n\t// band 2\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\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI;\n\n\t#endif\n\n\treturn irradiance;\n\n}\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// directLight is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\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\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\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\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// directLight is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\n\t\tif ( angleCos > spotLight.coneCos ) {\n\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\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\n\t\t} else {\n\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\n\t\t}\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tirradiance *= PI;\n\n\t\t#endif\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n",lights_phong_fragment:"\nBlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n\nstruct BlinnPhongMaterial {\n\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t#ifdef TOON\n\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\n\t#else\n\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\n\t#endif\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI; // punctual light\n\n\t#endif\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n\n#ifdef REFLECTIVITY\n\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n\n#endif\n\n#ifdef CLEARCOAT\n\n\tmaterial.clearcoat = saturate( clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n\n#endif\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheen;\n\n#endif\n",lights_physical_pars_fragment:"\nstruct PhysicalMaterial {\n\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n\n};\n\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\n\n// Clear coat directional hemishperical reflectance (this approximation should be improved)\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\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\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\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\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t}\n\n#endif\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI; // punctual light\n\n\t#endif\n\n\t#ifdef CLEARCOAT\n\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tccIrradiance *= PI; // punctual light\n\n\t\t#endif\n\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\n\t#else\n\n\t\tfloat clearcoatDHR = 0.0;\n\n\t#endif\n\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\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n}\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\n\t#ifdef CLEARCOAT\n\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\n\t#else\n\n\t\tfloat clearcoatDHR = 0.0;\n\n\t#endif\n\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n",lights_fragment_begin:"\n/**\n * This is a template that can be used to light a material, it uses pluggable\n * RenderEquations (RE)for specific lighting scenarios.\n *\n * Instructions for use:\n * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n * - If you have defined an RE_IndirectSpecular, you need to also provide a Material_LightProbeLOD. <---- ???\n * - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n *\n * TODO:\n * - Add area light support.\n * - Add sphere light support.\n * - Add diffuse light probe (irradiance cubemap) support.\n */\n\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n\t\t}\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_fragment_maps:"\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tlightMapIrradiance *= PI; // factor of PI should not be present; included here to prevent breakage\n\n\t\t#endif\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel );\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\tradiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\n\t#ifdef CLEARCOAT\n\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\n\t#endif\n\n#endif\n",lights_fragment_end:"\n#if defined( RE_IndirectDiffuse )\n\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n \n#endif\n",logdepthbuf_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\t// Doing a strict comparison with == 1.0 can cause noise artifacts\n\t// on some platforms. See issue #17623.\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n\n#endif\n",logdepthbuf_pars_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n",logdepthbuf_pars_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\n\t#else\n\n\t\tuniform float logDepthBufFC;\n\n\t#endif\n\n#endif\n",logdepthbuf_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\n\t#else\n\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\n\t\t\tgl_Position.z *= gl_Position.w;\n\n\t\t}\n\n\t#endif\n\n#endif\n",map_fragment:"\n#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n\n#endif\n",map_pars_fragment:"\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n",map_particle_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_MAP\n\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n\n#endif\n",map_particle_pars_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tuniform mat3 uvTransform;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",metalnessmap_fragment:"\nfloat metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tmetalnessFactor *= texelMetalness.b;\n\n#endif\n",metalnessmap_pars_fragment:"\n#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif\n",morphnormal_vertex:"\n#ifdef USE_MORPHNORMALS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\n#endif\n",morphtarget_pars_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\tuniform float morphTargetBaseInfluence;\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif\n",morphtarget_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n#endif\n",normal_fragment_begin:"\n#ifdef FLAT_SHADED\n\n\t// Workaround for Adreno/Nexus5 not able able to do dFdx( vViewPosition ) ...\n\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\n#else\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n\t#endif\n\n\t#ifdef USE_TANGENT\n\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\n\t\t#ifdef DOUBLE_SIDED\n\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\n\t\t#endif\n\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n\n// non perturbed normal for clearcoat among others\n\nvec3 geometryNormal = normal;\n\n",normal_fragment_maps:"\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n\t#ifdef FLIP_SIDED\n\n\t\tnormal = - normal;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n\t#endif\n\n\tnormal = normalize( normalMatrix * normal );\n\n#elif defined( TANGENTSPACE_NORMALMAP )\n\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tnormal = normalize( vTBN * mapN );\n\n\t#else\n\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\n\t#endif\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n",normalmap_pars_fragment:"\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n#endif\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tuniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\n\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\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\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude\n\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\n\t\tmat3 tsn = mat3( S, T, N );\n\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n\t\treturn normalize( tsn * mapN );\n\n\t}\n\n#endif\n",clearcoat_normal_fragment_begin:"\n#ifdef CLEARCOAT\n\n\tvec3 clearcoatNormal = geometryNormal;\n\n#endif\n",clearcoat_normal_fragment_maps:"\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\n\t#else\n\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\n\t#endif\n\n#endif\n",clearcoat_normalmap_pars_fragment:"\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n\n#endif\n",packing:"\nvec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\n\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\n\nconst float ShiftRight8 = 1. / 256.;\n\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8; // tidy overflow\n\treturn r * PackUpscale;\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\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 unpack2HalfToRGBA( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\n\n// NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions\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}\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"\n#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n",project_vertex:"\nvec4 mvPosition = vec4( transformed, 1.0 );\n\n#ifdef USE_INSTANCING\n\n\tmvPosition = instanceMatrix * mvPosition;\n\n#endif\n\nmvPosition = modelViewMatrix * mvPosition;\n\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"\n#ifdef DITHERING\n\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n\n#endif\n",dithering_pars_fragment:"\n#ifdef DITHERING\n\n\t// based on https://www.shadertoy.com/view/MslGR8\n\tvec3 dithering( vec3 color ) {\n\t\t//Calculate grid position\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\n\t\t//modify shift acording to grid position.\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\n\t\t//shift the color by dither_shift\n\t\treturn color + dither_shift_RGB;\n\t}\n\n#endif\n",roughnessmap_fragment:"\nfloat roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\troughnessFactor *= texelRoughness.g;\n\n#endif\n",roughnessmap_pars_fragment:"\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n",shadowmap_pars_fragment:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): create uniforms for area light shadows\n\n\t#endif\n\t*/\n\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n\t}\n\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\n\t\treturn unpack2HalfToRGBA( texture2D( shadow, uv ) );\n\n\t}\n\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\n\t\tfloat occlusion = 1.0;\n\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\n\t\tfloat hard_shadow = step( compare , distribution.x ); // Hard Shadow\n\n\t\tif (hard_shadow != 1.0 ) {\n\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 ); // Chebeyshevs inequality\n\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed\n\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\n\t\t}\n\t\treturn occlusion;\n\n\t}\n\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = ( floor( uv * size - 0.5 ) + 0.5 ) * texelSize;\n\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\n\t\tvec2 f = fract( uv * size + 0.5 );\n\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\n\t\treturn c;\n\n\t}\n\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\n\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t// if ( all( something, something ) ) using this instead\n\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\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\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\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\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\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\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#else // no percentage-closer filtering:\n\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#endif\n\n\t\t}\n\n\t\treturn shadow;\n\n\t}\n\n\t// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n\t// vector suitable for 2D texture mapping. This code uses the following layout for the\n\t// 2D texture:\n\t//\n\t// xzXZ\n\t// y Y\n\t//\n\t// Y - Positive y direction\n\t// y - Negative y direction\n\t// X - Positive x direction\n\t// x - Negative x direction\n\t// Z - Positive z direction\n\t// z - Negative z direction\n\t//\n\t// Source and test bed:\n\t// https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\t\t// Number of texels to avoid at the edge of each square\n\n\t\tvec3 absV = abs( v );\n\n\t\t// Intersect unit cube\n\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\n\t\t// Apply scale to avoid seams\n\n\t\t// two texels less per square (one texel will do for NEAREST)\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\t\t// Unwrap\n\n\t\t// space: -1 ... 1 range for each square\n\t\t//\n\t\t// #X##\t\tdim := ( 4 , 2 )\n\t\t// # #\t\tcenter := ( 1 , 1 )\n\n\t\tvec2 planar = v.xy;\n\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\tif ( absV.z >= almostOne ) {\n\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t} else if ( absV.y >= almostOne ) {\n\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\n\t\t}\n\n\t\t// Transform to UV space\n\n\t\t// scale := 0.5 / dim\n\t\t// translate := ( center + 0.5 ) / dim\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t}\n\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// dp = normalized distance from light to fragment position\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\n\t\tdp += shadowBias;\n\n\t\t// bd3D = base direction 3D\n\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\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\n\t\t#else // no percentage-closer filtering\n\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\n\t\t#endif\n\n\t}\n\n#endif\n",shadowmap_pars_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): uniforms for area light shadows\n\n\t#endif\n\t*/\n\n#endif\n",shadowmap_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\n\t}\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\n\t}\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\n\t}\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\n\t#endif\n\t*/\n\n#endif\n",shadowmask_pars_fragment:"\nfloat getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\tDirectionalLight directionalLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t}\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\tSpotLight spotLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\n\t}\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\tPointLight pointLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\n\t}\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update shadow for Area light\n\n\t#endif\n\t*/\n\n\t#endif\n\n\treturn shadow;\n\n}\n",skinbase_vertex:"\n#ifdef USE_SKINNING\n\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\n#endif\n",skinning_pars_vertex:"\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\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\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\n\t\t\ty = dy * ( y + 0.5 );\n\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\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",skinning_vertex:"\n#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\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\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n",skinnormal_vertex:"\n#ifdef USE_SKINNING\n\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\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n",specularmap_fragment:"\nfloat specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif\n",specularmap_pars_fragment:"\n#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif\n",tonemapping_fragment:"\n#if defined( TONE_MAPPING )\n\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n",tonemapping_pars_fragment:"\n#ifndef saturate\n// may have defined saturate() already\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n\treturn toneMappingExposure * color;\n\n}\n\n// source: https://www.cs.utah.edu/~reinhard/cdrom/\nvec3 ReinhardToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\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\n\t// John Hable's filmic operator from Uncharted 2 video game\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\n\t// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n\n// source: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n\n}\n",uv_pars_fragment:"\n#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\n\tvarying vec2 vUv;\n\n#endif\n",uv_pars_vertex:"\n#ifdef USE_UV\n\n\t#ifdef UVS_VERTEX_ONLY\n\n\t\tvec2 vUv;\n\n\t#else\n\n\t\tvarying vec2 vUv;\n\n\t#endif\n\n\tuniform mat3 uvTransform;\n\n#endif\n",uv_vertex:"\n#ifdef USE_UV\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n#endif\n",uv2_pars_fragment:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif\n",uv2_pars_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n#endif\n",uv2_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = uv2;\n\n#endif\n",worldpos_vertex:"\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n\n#endif\n",amrt_aomap_fragment:"\n#if defined(USE_AOMAP)\n float ambientOcclusion = mix(1.0, aoMapTexelToLinear(texture2D( aoMap, vUvAO )).g, aoScale);\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\n\t#endif\n#endif\n",amrt_emissivemap_fragment:"\n#if defined(USE_EMISSIVEMAP)\n vec4 emissiveColor = texture2D( emissiveMap, vUvEmissive );\n\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",amrt_map_fragment:"\n#if defined( USE_ALBEDO )\n vec4 texelColor = texture2D( albedo, vUvAlbedo );\n texelColor = albedoTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif\n",amrt_map_pars_fragment:"\n\n// struct MapData\n// {\n// vec3 Normal;\n// vec3 Albedo;\n// float Emission;\n// float Metallic;\n// float Smoothness;\n// float Occlusion;\n// float Alpha;\n// };\n\n#ifdef USE_ALBEDO\n\n\tuniform sampler2D albedo;\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform float normalScale;\n\n#endif\n\n#ifdef USE_NORMALMAP2\n\n\tuniform sampler2D normalMap2;\n\tuniform float normalScale2;\n\n#endif\n\n#ifdef USE_METALLICMAP\n\n\tuniform sampler2D metallicMap;\n\n#endif\n\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n\n#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoScale;\n\n#endif\n\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n\n#ifdef USE_REFLECTMAP\n #ifdef USE_REFLECTMAP_UV\n uniform sampler2D reflectMap;\n #else\n uniform samplerCube reflectMap;\n #endif\n\tuniform float reflectIntensity;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n\n#ifdef USE_DISSOLVE\n uniform vec3 dissolveColor;\n uniform float dissolveRatio;\n\tuniform sampler2D dissolveMap;\n#endif\n\n",amrt_metalnessmap_fragment:"\nfloat metalnessFactor = metalness;\n#if defined(USE_METALLICMAP)\n metalnessFactor = metallicMapTexelToLinear(texture2D( metallicMap, vUvMetal )).r;\n#endif\n",amrt_alphamap_fragment:"\n#ifdef USE_ALPHAMAP\n\n\tgl_FragColor.a = texture2D( alphaMap, vUvAlpha ).g;\n\n#endif\n",amrt_normal_fragment_maps:"\n\n#if defined( USE_NORMALMAP ) || defined( USE_NORMALMAP2 )\n\n #if defined( USE_NORMALMAP ) && defined( USE_NORMALMAP2 )\n vec3 mapN = BlendNormals( UnpackScaleNormal( normalMapTexelToLinear(texture2D( normalMap, vUvNormal )), normalScale ) , UnpackScaleNormal( normalMap2TexelToLinear(texture2D( normalMap2, vUvNormal2 )), normalScale2 ) );\n #elif defined( USE_NORMALMAP )\n vec3 mapN = normalize(UnpackScaleNormal( normalMapTexelToLinear(texture2D( normalMap, vUvNormal )), normalScale));\n #elif defined( USE_NORMALMAP2 )\n vec3 mapN = normalize(UnpackScaleNormal( normalMap2TexelToLinear(texture2D( normalMap2, vUvNormal2 )), normalScale2));\n #endif\n \n #ifdef USE_TANGENT\n \n normal = normalize( vTBN * mapN );\n \n #else\n \n normal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n \n #endif\n \n#endif\n",amrt_roughnessmap_fragment:"\n#if defined(USE_ROUGHNESSMAP)\n roughnessFactor = roughnessMapTexelToLinear(texture2D( roughnessMap, vUvRough )).r;\n#endif\n",amrt_uv_pars_fragment:"\n\n#ifdef USE_ALBEDO\n\n\tvarying vec2 vUvAlbedo;\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n\tvarying vec2 vUvNormal;\n\n#endif\n\n#ifdef USE_NORMALMAP2\n\n\tvarying vec2 vUvNormal2;\n\n#endif\n\n#ifdef USE_METALLICMAP\n\n\tvarying vec2 vUvMetal;\n\n#endif\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvarying vec2 vUvRough;\n\n#endif\n\n#ifdef USE_AOMAP\n\n\tvarying vec2 vUvAO;\n\n#endif\n\n#ifdef USE_EMISSIVEMAP\n\n\tvarying vec2 vUvEmissive;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tvarying vec2 vUvAlpha;\n\n#endif\n\n#ifdef USE_DISSOLVE\n\n varying vec2 vUv;\n \n#endif\n",amrt_uv_pars_vertex:"\n\nattribute vec2 uv2;\n\n#ifdef USE_ALBEDO\n\n\tvarying vec2 vUvAlbedo;\n\tuniform mat3 albedoUVTransform;\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n\tvarying vec2 vUvNormal;\n\tuniform mat3 normalUVTransform;\n\n#endif\n\n#ifdef USE_NORMALMAP2\n\n\tvarying vec2 vUvNormal2;\n\tuniform mat3 normal2UVTransform;\n\n#endif\n\n#ifdef USE_METALLICMAP\n\n\tvarying vec2 vUvMetal;\n\tuniform mat3 metalUVTransform;\n\n#endif\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvarying vec2 vUvRough;\n\tuniform mat3 roughUVTransform;\n\n#endif\n\n#ifdef USE_AOMAP\n\n\tvarying vec2 vUvAO;\n\tuniform mat3 aoUVTransform;\n\n#endif\n\n#ifdef USE_EMISSIVEMAP\n\n\tvarying vec2 vUvEmissive;\n\tuniform mat3 emissiveUVTransform;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tvarying vec2 vUvAlpha;\n uniform mat3 alphaUVTransform;\n\n#endif\n\n#ifdef USE_DISSOLVE\n\n\tvarying vec2 vUv;\n\n#endif\n\n",amrt_uv_vertex:"\n\n#ifdef USE_ALBEDO\n\t\n\t#ifdef ALBEDO_UV1\n\n\t\tvUvAlbedo = ( albedoUVTransform * vec3( uv, 1 ) ).xy;\n\n\t#else\n\n\t\tvUvAlbedo = ( albedoUVTransform * vec3( uv2, 1 ) ).xy;\n\n\t#endif\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n vUvNormal = ( normalUVTransform * vec3( uv, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_NORMALMAP2\n\n vUvNormal2 = ( normal2UVTransform * vec3( uv2, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_METALLICMAP\n\n vUvMetal = ( metalUVTransform * vec3( uv, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_ROUGHNESSMAP\n \n vUvRough = ( roughUVTransform * vec3( uv, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n \n vUvAlpha = ( alphaUVTransform * vec3( uv, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_AOMAP\n\t\n\t#ifdef AO_UV1\n\n\t\tvUvAO = ( aoUVTransform * vec3( uv, 1 ) ).xy;\n\n\t#else\n\n\t\tvUvAO = ( aoUVTransform * vec3( uv2, 1 ) ).xy;\n\n\t#endif\n\n#endif\n\n#ifdef USE_EMISSIVEMAP\n\t\n\t#ifdef EMISSIVE_UV1\n\n\t\tvUvEmissive = ( emissiveUVTransform * vec3( uv, 1 ) ).xy;\n\n\t#else\n\n\t\tvUvEmissive = ( emissiveUVTransform * vec3( uv2, 1 ) ).xy;\n\n\t#endif\n\n#endif\n\n#ifdef USE_DISSOLVE\n\n vUv = uv;\n \n#endif\n",amrt_worldpos_vertex:"\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_REFLECTMAP )\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n#endif\n",amrt_envmap_physical_pars_fragment:"\n#if defined( USE_ENVMAP )\n\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\n\tvec3 getLightProbeIndirectIrradiance( /*const in SpecularLightProbe specularLightProbe,*/ const in GeometricContext geometry, const in int maxMIPLevel ) {\n \n\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t\n\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\n\t\t\t// TODO: replace with properly filtered cubemaps and access the irradiance LOD level, be it the last LOD level\n\t\t\t// of a specular cubemap, or just the default level of a specially created irradiance cubemap.\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\n\t\t\t#else\n\n\t\t\t\t// force the bias high to get the last LOD level as it is the most blurred.\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\n\t\t#endif\n \n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t}\n\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n\n float sigma = PI * roughness * roughness / ( 1.0 + roughness ) + 0.000001;\n float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n // clamp to allowable LOD ranges.\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n \n\n\tvec3 getLightProbeIndirectRadiance( /*const in SpecularLightProbe specularLightProbe,*/ const in vec3 viewDir, const in vec3 normal, const in float roughness, const in float rroughness,const in int maxMIPLevel ) {\n \n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\n\t\t // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\n\t\t#else\n\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\n\t\t#endif\n\n #ifdef ENVMAP_TYPE_CUBE_UV\n\t\t reflectVec = inverseTransformDirection( reflectVec, viewMatrixR );\n #else\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n #endif\n \n reflectVec *= envYMatrix;\n \n float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\t\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\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\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#endif\n\t\t\n\t\t\n\t\tenvMapColor = LinearTosRGB(envMapColor);\n\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t}\n\n#endif\n",amrt_cube_uv_reflection_fragment:"\n#if defined(ENVMAP_TYPE_CUBE_UV) || defined(USE_REFLECTMAP_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\n// These shader functions convert between the UV coordinates of a single face of\n// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n// sampling a textureCube (not generally normalized).\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\nvec3 bilinearCubeUVR(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 = reflectMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = reflectMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = reflectMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = reflectMapTexelToLinear(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\n// These defines must match with PMREMGenerator\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);// 1.16 = 1.79^0.25\n }\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\nvec4 textureCubeUVR(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 = bilinearCubeUVR(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUVR(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif\n",amrt_lights_fragment_maps:"\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tlightMapIrradiance *= PI; // factor of PI should not be present; included here to prevent breakage\n\n\t\t#endif\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel );\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\tradiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, material.specularRoughness,roughnessFactor, maxMipLevel );\n\n\t#ifdef CLEARCOAT\n\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\n\t#endif\n\n#endif\n\n#if defined( USE_REFLECTMAP )\n vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n \n #ifdef USE_REFLECTMAP_UV\n reflectVec = inverseTransformDirection( reflectVec, viewMatrixR ); \n vec4 reflectdiffuse = textureCubeUVR( reflectMap, reflectVec, 0.0 );\n reflectdiffuse = LinearTosRGB(reflectdiffuse);\n radiance += reflectdiffuse.rgb * reflectIntensity;\n #else\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n reflectVec = vec3( -1.0 * reflectVec.x, reflectVec.yz );\n vec4 reflectdiffuse = textureCube( reflectMap, reflectVec );\n reflectdiffuse.rgb = reflectMapTexelToLinear(reflectdiffuse).rgb;\n reflectdiffuse = LinearTosRGB(reflectdiffuse);\n radiance += reflectdiffuse.rgb * reflectIntensity;\n #endif\n#endif\n",amrt_bsdfs:'\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via \'environmentBRDF\' from "Physically Based Shading on Mobile"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n\n}\n\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\n\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t// page 32, equation 26: E[window1]\n\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t// this is intended to be used on spot and point lights who are represented as luminous intensity\n\t// but who must be converted to luminous irradiance for surface lighting calculation\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\tif( cutoffDistance > 0.0 ) {\n\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t}\n\n\treturn distanceFalloff;\n\n#else\n\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n\t}\n\n\treturn 1.0;\n\n#endif\n\n}\n\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\n\treturn RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\n\t// Original approximation by Christophe Schlick \'94\n\t// float fresnel = pow( 1.0 - dotLH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH \'13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n\n} // validated\n\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\n\t// See F_Schlick\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\n\treturn Fr * fresnel + F0;\n\n}\n\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (34)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\t// geometry term (normalized) = G(l)⋅G(v) / 4(n⋅l)(n⋅v)\n\t// also see #12151\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\n\treturn 1.0 / ( gl * gv );\n\n} // validated\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\n\t// dotNL and dotNV are explicitly swapped. This is not a mistake.\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility\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\n\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\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\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\tfloat D = D_GGX( alpha, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n// Rect Area Light\n\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\n// code: https://github.com/selfshadow/ltc_code/\n\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\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\n\tfloat dotNV = saturate( dot( N, V ) );\n\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\treturn uv;\n\n}\n\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\n\t// An approximation of the form factor of a horizon-clipped rectangle.\n\n\tfloat l = length( f );\n\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n\n}\n\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\n\tfloat x = dot( v1, v2 );\n\n\tfloat y = abs( x );\n\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\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\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\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\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\n\t// transform rect\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\n\t// project rect onto sphere\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\n\t// calculate vector form factor\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\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see referece)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\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\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\n\treturn specularColor * brdf.x + brdf.y;\n\n} // validated\n\n// Fdez-Agüera\'s "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\n\t//float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\t//float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n// source: http://simonstechblog.blogspot.ca/2011/12/microfacet-brdf.html\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\n\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs#L94\nfloat D_Charlie(float roughness, float NoH) {\n\t// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs#L136\nfloat V_Neubelt(float NoV, float NoL) {\n\t// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\n\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n\n}\n\n#endif\n',amrt_lights_physical_fragment:"\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\n#if defined( USE_REFLECTMAP )\n vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n \n #ifdef USE_REFLECTMAP_UV\n reflectVec = inverseTransformDirection( reflectVec, viewMatrixR );\n reflectVec*=reflecYMatrix;\n vec4 reflectdiffuse = textureCubeUVR( reflectMap, reflectVec, 0.0 );\n reflectdiffuse = LinearTosRGB(reflectdiffuse);\n diffuseColor.rgb += reflectdiffuse.rgb * reflectIntensity;\n #else\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n reflectVec = vec3( -1.0 * reflectVec.x, reflectVec.yz );\n reflectVec*=reflecYMatrix;\n vec4 reflectdiffuse = textureCube( reflectMap, reflectVec );\n reflectdiffuse.rgb = reflectMapTexelToLinear(reflectdiffuse).rgb;\n reflectdiffuse = LinearTosRGB(reflectdiffuse);\n diffuseColor.rgb += reflectdiffuse.rgb * reflectIntensity;\n #endif\n#endif\n\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ) * 0.779083699;\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n\n#ifdef REFLECTIVITY\n\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n\n#endif\n\n#ifdef CLEARCOAT\n\n\tmaterial.clearcoat = saturate( clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n\n#endif\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheen;\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n #ifdef TRANSPARENCY\n directLight.color *= (1.0 - transparency);\n #endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n #ifdef TRANSPARENCY\n directLight.color *= (1.0 - transparency);\n #endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n #ifdef TRANSPARENCY\n directLight.color *= (1.0 - transparency);\n #endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#ifdef TRANSPARENCY\n irradiance *= (1.0 - transparency);\n #endif\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n\t\t}\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tlightMapIrradiance *= PI; // factor of PI should not be present; included here to prevent breakage\n\n\t\t#endif\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel );\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\tradiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, material.specularRoughness,roughnessFactor, maxMipLevel );\n\n\t#ifdef CLEARCOAT\n\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\n\t#endif\n\n#endif\n",amrt_dissolve_fragment:"\n#if defined( USE_DISSOLVE )\n vec4 dissove = texture2D( dissolveMap, vUv );\n if(dissove.r < dissolveRatio) discard;\n if(abs(dissove.r - dissolveRatio) < 0.05){\n gl_FragColor.rgb = dissolveColor;\n }\n#endif\n",background_frag:"\nuniform sampler2D t2D;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tvec4 texColor = texture2D( t2D, vUv );\n\n\tgl_FragColor = mapTexelToLinear( texColor );\n\n\t#include \n\t#include \n\n}\n",background_vert:"\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n",cube_frag:"\nuniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nuniform float brightness;\nvarying vec3 vWorldDirection;\n\nvoid main() {\n\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\n\tgl_FragColor = mapTexelToLinear( texColor );\n gl_FragColor *= brightness;\n\tgl_FragColor.a *= opacity;\n\n\t#include \n\t#include \n\n}\n",cube_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n",depth_frag:"\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\n\t#endif\n\n}\n",depth_vert:"\n#include \n#include \n#include \n#include \n//#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t//#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t//#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t//#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",distanceRGBA_frag:"\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main () {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#include \n\t#include \n\t#include \n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = packDepthToRGBA( dist );\n\n}\n",distanceRGBA_vert:"\n#define DISTANCE\n\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvWorldPosition = worldPosition.xyz;\n\n}\n",equirect_frag:"\nuniform sampler2D tEquirect;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvec3 direction = normalize( vWorldDirection );\n\n\tvec2 sampleUV;\n\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\n\tgl_FragColor = mapTexelToLinear( texColor );\n\n\t#include \n\t#include \n\n}\n",equirect_vert:"\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n}\n",linedashed_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",linedashed_vert:"\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvLineDistance = scale * lineDistance;\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\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\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include \n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshbasic_vert:"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#ifdef USE_ENVMAP\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshlambert_frag:"\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\n\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\nvoid main() {\n\n\t#include \n\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\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\n\t#endif\n\n\t#include \n\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\n\t#else\n\n\t\treflectedLight.directDiffuse = vLightFront;\n\n\t#endif\n\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"\n#define LAMBERT\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\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\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshmatcap_frag:"\n#define MATCAP\n\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\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; // 0.495 to remove artifacts caused by undersized matcap disks\n\n\t#ifdef USE_MATCAP\n\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\n\t#else\n\n\t\tvec4 matcapColor = vec4( 1.0 );\n\n\t#endif\n\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshmatcap_vert:"\n#define MATCAP\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\t\tvNormal = normalize( transformedNormal );\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n}\n",meshphong_frag:"\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\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\nvoid main() {\n\n\t#include \n\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\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphong_vert:"\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\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\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphysical_frag:"\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\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 \n\nvoid main() {\n\n\t#include \n\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\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t// this is a stub for the transparency model\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",meshphysical_vert:"\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n}\n",normal_frag:"\n#define NORMAL\n\nuniform float opacity;\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\n}\n",normal_vert:"\n#define NORMAL\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\n#include \n#include \n#include \n#include \n//#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t//#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t//#include \n\t//#include \n\t#include \n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n\n\t#include \n\t#include \n\t//#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvViewPosition = - mvPosition.xyz;\n\n#endif\n\n}\n",points_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",points_vert:"\nuniform float size;\nuniform float scale;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_PointSize = size;\n\n\t#ifdef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",shadow_frag:"\nuniform vec3 color;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\n\t#include \n\n}\n",shadow_vert:"\n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",sprite_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\n}\n",sprite_vert:"\nuniform float rotation;\nuniform vec2 center;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\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\n\t#ifndef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\n\t#endif\n\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\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\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\t#include \n\n}\n",amrtbasic_vert:"\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n}\n",amrtbasic_frag:"\n\nprecision mediump sampler2D;\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\n#define REFLECTIVITY\n//#define TRANSPARENCY\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float smoothness;\nuniform float metalness;\nuniform float opacity;\nuniform mat3 envYMatrix;\nuniform mat3 reflecYMatrix;\nuniform bool clippingTransparent;\n\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\nvec3 BlendNormals(vec3 n1, vec3 n2)\n{\n return normalize(vec3(n1.xy + n2.xy, n1.z*n2.z));\n}\n\nvec3 UnpackScaleNormal(vec4 packednormal, float bumpScale)\n{\n vec3 normal = packednormal.xyz * 2.0 - 1.0;\n normal.xy *= bumpScale;\n return normal;\n}\nfloat Pow5( const in float x ) { float x2 = x*x; return x2*x2*x; }\n#include \n#include \n#include \n#include \n\n\nvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\n vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n \n vec2 vUvs;\n #if defined( USE_NORMALMAP2 )\n vUvs = vUvNormal2;\n #elif defined( USE_NORMALMAP )\n vUvs = vUvNormal;\n #endif\n \n vec2 st0 = dFdx( vUvs.st );\n vec2 st1 = dFdy( vUvs.st );\n\n float scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude\n\n vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n vec3 N = normalize( surf_norm );\n\n mat3 tsn = mat3( S, T, N );\n\n mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n return normalize( tsn * mapN );\n\n}\n\n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n\nvoid main() {\n\n float roughnessFactor = 1.0 - smoothness;\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\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\n\t#include \n\n \n\n\t// accumulation\n\t#include \n\t// #include \n\t// #include \n\t#include \n\n\t// modulation\n\t#include \n\t\n\t//ssr\n\t#include \n\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n \n\t// this is a stub for the transparency model\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1.0 - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular));\n\t#endif\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n #include \n #include \n \n if(clippingTransparent)gl_FragColor.a *= clipping_opacity;\n}\n",amrtshadow_vert:"\n#include \n#include \n#include \n#include \n\nuniform vec4 shadowPlane;\nuniform vec3 lightDirection;\nuniform vec3 center;\n\nvarying vec4 worldPosition;\nvarying vec3 projectionPosition;\nvarying vec3 projectionCenter;\n\nvoid main() {\n vec3 objectNormal = vec3( normal );\n vec3 transformed = vec3( position );\n\n #include \n\t#include \n #include \n\n vec4 mvPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n #endif\n\n worldPosition = modelMatrix * mvPosition;\n\n #ifdef USE_SKINNING\n projectionCenter = (shadowSkinMatrix * vec4(center, 1.0)).xyz;\n #else\n projectionCenter = center;\n #endif\n\n projectionCenter = projectOnPlane(projectionCenter, shadowPlane.xyz * shadowPlane.w, shadowPlane.xyz);\n\n projectionPosition = linePlaneIntersect(worldPosition.xyz, -lightDirection, shadowPlane.xyz * shadowPlane.w, shadowPlane.xyz);\n gl_Position = projectionMatrix * viewMatrix * vec4(projectionPosition, 1.0);\n \n\t#include \n}\n",amrtshadow_frag:"\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n\nuniform vec3 color;\nuniform vec4 shadowPlane;\nuniform float shadowLength;\nuniform float shadowStrength;\nuniform vec3 lightDirection;\n\nvarying vec4 worldPosition;\nvarying vec3 projectionPosition;\nvarying vec3 projectionCenter;\n\nvoid main() {\n\n if(sideOfPlane(cameraPosition, shadowPlane.xyz * shadowPlane.w, shadowPlane.xyz) > 0.0) discard;\n if(dot(lightDirection, shadowPlane.xyz) < 0.0) discard;\n\n #include \n\n float dis = distance(projectionPosition, projectionCenter) / shadowLength;\n dis = smoothstep(0.05, 0.9, dis);\n\n gl_FragColor = vec4(color, pow(max(1.0 - dis, 0.0), 2.0) * shadowStrength);\n\n\t#include \n}\n",acf_vert:"\n#ifdef USE_UV\n varying vec2 vUv;\n#endif\n\nvoid main() {\n\n\t#ifdef USE_UV\n\n vUv = uv;\n \n #endif\n\n\tvec4 mvPosition = vec4( position, 1.0 );\n \n mvPosition = modelViewMatrix * mvPosition;\n \n gl_Position = projectionMatrix * mvPosition;\n}\n",acf_frag:"\nuniform vec3 diffuse;\n\n#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, 1.0 );\n\n\t#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n diffuseColor *= texelColor;\n #endif\n \n\tgl_FragColor = diffuseColor;\n}\n",amrt_skinbase_vertex:"\n#ifdef USE_SKINNING\n\n mat4 boneMatX = getBoneMatrix( skinIndex_4.x );\n mat4 boneMatY = getBoneMatrix( skinIndex_4.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex_4.z );\n mat4 boneMatW = getBoneMatrix( skinIndex_4.w );\n \n \n #ifdef BONE_8\n mat4 boneMatX_8 = getBoneMatrix( skinIndex_8.x );\n mat4 boneMatY_8 = getBoneMatrix( skinIndex_8.y );\n mat4 boneMatZ_8 = getBoneMatrix( skinIndex_8.z );\n mat4 boneMatW_8 = getBoneMatrix( skinIndex_8.w );\n #endif\n \n #ifdef BONE_12\n mat4 boneMatX_12 = getBoneMatrix( skinIndex_12.x );\n mat4 boneMatY_12 = getBoneMatrix( skinIndex_12.y );\n mat4 boneMatZ_12 = getBoneMatrix( skinIndex_12.z );\n mat4 boneMatW_12 = getBoneMatrix( skinIndex_12.w );\n #endif\n \n #ifdef BONE_16\n mat4 boneMatX_16 = getBoneMatrix( skinIndex_16.x );\n mat4 boneMatY_16 = getBoneMatrix( skinIndex_16.y );\n mat4 boneMatZ_16 = getBoneMatrix( skinIndex_16.z );\n mat4 boneMatW_16 = getBoneMatrix( skinIndex_16.w );\n #endif\n\n#endif\n",amrt_skinning_pars_vertex:"\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t\n attribute vec4 skinIndex_4;\n\tattribute vec4 skinWeight_4;\n\t\n\t#ifdef BONE_8\n attribute vec4 skinIndex_8;\n attribute vec4 skinWeight_8;\n \n\t#endif\n\t\n\t#ifdef BONE_12\n attribute vec4 skinIndex_12;\n attribute vec4 skinWeight_12;\n\t#endif\n\t\n\t#ifdef BONE_16\n attribute vec4 skinIndex_16;\n attribute vec4 skinWeight_16;\n\t#endif\n\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\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\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\n\t\t\ty = dy * ( y + 0.5 );\n\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\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\t\t\n\t\tvec4 getSkinVertex(vec4 skinVertex, vec4 skinIndexTmp,vec4 skinWeightTmp){\n\t\t\n\t\t mat4 boneMatX = getBoneMatrix( skinIndexTmp.x );\n mat4 boneMatY = getBoneMatrix( skinIndexTmp.y );\n mat4 boneMatZ = getBoneMatrix( skinIndexTmp.z );\n mat4 boneMatW = getBoneMatrix( skinIndexTmp.w );\n \n vec4 skinned = vec4( 0.0 );\n\n skinned += boneMatX * skinVertex * skinWeightTmp.x;\n skinned += boneMatY * skinVertex * skinWeightTmp.y;\n skinned += boneMatZ * skinVertex * skinWeightTmp.z;\n skinned += boneMatW * skinVertex * skinWeightTmp.w;\n return skinned;\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",amrt_skinning_vertex:"\n\n#ifdef USE_SKINNING\n\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n \n vec4 skinned = vec4( 0.0 );\n \n skinned += boneMatX * skinVertex * skinWeight_4.x;\n skinned += boneMatY * skinVertex * skinWeight_4.y;\n skinned += boneMatZ * skinVertex * skinWeight_4.z;\n skinned += boneMatW * skinVertex * skinWeight_4.w;\n \n #ifdef BONE_8\n skinned += boneMatX_8 * skinVertex * skinWeight_8.x;\n skinned += boneMatY_8 * skinVertex * skinWeight_8.y;\n skinned += boneMatZ_8 * skinVertex * skinWeight_8.z;\n skinned += boneMatW_8 * skinVertex * skinWeight_8.w;\n\n #endif\n \n #ifdef BONE_12\n skinned += boneMatX_12 * skinVertex * skinWeight_12.x;\n skinned += boneMatY_12 * skinVertex * skinWeight_12.y;\n skinned += boneMatZ_12 * skinVertex * skinWeight_12.z;\n skinned += boneMatW_12 * skinVertex * skinWeight_12.w;\n #endif\n \n #ifdef BONE_16\n skinned += boneMatX_16 * skinVertex * skinWeight_16.x;\n skinned += boneMatY_16 * skinVertex * skinWeight_16.y;\n skinned += boneMatZ_16 * skinVertex * skinWeight_16.z;\n skinned += boneMatW_16 * skinVertex * skinWeight_16.w;\n #endif\n \n transformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n",amrt_skinnormal_vertex:"\n#ifdef USE_SKINNING\n\n\t mat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight_4.x * boneMatX;\n\tskinMatrix += skinWeight_4.y * boneMatY;\n\tskinMatrix += skinWeight_4.z * boneMatZ;\n\tskinMatrix += skinWeight_4.w * boneMatW;\n\t\n\t#ifdef BONE_8\n skinMatrix += skinWeight_8.x * boneMatX_8;\n skinMatrix += skinWeight_8.y * boneMatY_8;\n skinMatrix += skinWeight_8.z * boneMatZ_8;\n skinMatrix += skinWeight_8.w * boneMatW_8;\n\t#endif\n\t\n\t#ifdef BONE_12\n skinMatrix += skinWeight_12.x * boneMatX_12;\n skinMatrix += skinWeight_12.y * boneMatY_12;\n skinMatrix += skinWeight_12.z * boneMatZ_12;\n skinMatrix += skinWeight_12.w * boneMatW_12;\n\t#endif\n\t\n\t#ifdef BONE_16\n skinMatrix += skinWeight_16.x * boneMatX_16;\n skinMatrix += skinWeight_16.y * boneMatY_16;\n skinMatrix += skinWeight_16.z * boneMatZ_16;\n skinMatrix += skinWeight_16.w * boneMatW_16;\n\t#endif\n\t\n mat4 shadowSkinMatrix = skinMatrix;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\t\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n",amrt_ssr_uniform_fragment:"\n\n#ifdef USE_SSR\n\t\nuniform sampler2D ssrTexture;\nuniform sampler2D tDepth;\nuniform float maxDistance;\nuniform float ssrOpacity;\nuniform float fresnelCoe;\nuniform float virtualCameraNear;\nuniform float virtualCameraFar;\nuniform mat4 virtualCameraProjectionMatrix;\nuniform mat4 virtualCameraProjectionMatrixInverse;\nuniform mat4 virtualCameraMatrixWorld;\nuniform vec2 resolution;\nvarying vec4 ssrUV;\nuniform float planeOffset;\n\n\nfloat getDepth( const in vec2 uv ) {\n return texture2D( tDepth, uv ).x;\n}\nfloat getViewZ( const in float depth ) {\n return perspectiveDepthToViewZ( depth, virtualCameraNear, virtualCameraFar );\n}\nvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n clipPosition *= clipW; //clip\n return ( virtualCameraProjectionMatrixInverse * clipPosition ).xyz;//view\n}\n\n#define ssr_maxMipLevel 8.0\n#define ssr_minMipLevel 4.0\n// #define ssr_maxTileSize 256.0\n// #define ssr_minTileSize 16.0\n#define MAXSIZE 1024.0\n\nvec3 sampleTexture(sampler2D envMap,vec2 uv,vec2 xRange,vec2 yRange){\n\n float sx = 0.5 / MAXSIZE;\n float maxY = (MAXSIZE + MAXSIZE / 2.0);\n float sy = 0.5 / maxY;\n if(uv.x > xRange.y){\n uv.x = xRange.y - sx;\n }\n if(uv.y > yRange.y - sy){\n uv.y = yRange.y - sy;\n // return vec3(1.0,0.0,0.0);\n }\n\n return texture2D(envMap, uv).rgb;\n}\n\nvec3 ssrbilinearCubeUV(sampler2D envMap,vec2 vUv, float mipInt) {\n\n float maxY = (MAXSIZE + MAXSIZE / 2.0);\n vUv = fract(vUv);\n vec2 uv = vUv;\n float expInt = mipInt;\n if(mipInt > 4.0){\n expInt = 4.0;\n }\n float e = exp2(expInt);\n \n float texSize = MAXSIZE / e;\n \n vec2 xRange = vec2(0.0,1.0);\n vec2 yRange = vec2(0.0,1.0);\n\n if(mipInt == 0.0 ){\n float uvx = vUv.x;\n float uvy = vUv.y * (texSize / maxY);\n yRange.y = texSize / maxY;\n uv = vec2(uvx,uvy);\n }\n else\n {\n xRange.x = (MAXSIZE - 2.0 * texSize) / MAXSIZE;\n xRange.y = xRange.x + texSize / MAXSIZE;\n float uvx = xRange.x + (texSize / MAXSIZE) * vUv.x;\n float uvy = vUv.y;\n if(mipInt < 5.0){\n yRange.x = MAXSIZE / maxY;\n yRange.y = yRange.x + texSize / maxY;\n uvy = yRange.x + texSize / maxY * vUv.y;\n }\n if(mipInt > 4.0){\n yRange.x = (MAXSIZE + (mipInt - 4.0) * texSize) / maxY;\n yRange.y = yRange.x + texSize / maxY;\n uvy = yRange.x + texSize / maxY * vUv.y;\n }\n uv = vec2(uvx,uvy);\n }\n\n float sx = 0.5 / MAXSIZE;\n float sy = 0.5 / maxY;\n\n float maxx = uv.x / sx;\n float maxy = uv.y / sy;\n\n float fx = fract(maxx);\n float fy = fract(maxy);\n \n vec3 mx0 = sampleTexture(envMap, uv,xRange,yRange).rgb;\n // return mx0;\n vec3 mx1 = sampleTexture(envMap, uv + vec2(sx,0.0),xRange,yRange).rgb;\n\n vec3 my0 = sampleTexture(envMap, uv + vec2(0.0,sy),xRange,yRange).rgb;\n vec3 my1 = sampleTexture(envMap, uv + vec2(sx,sy),xRange,yRange).rgb;\n vec3 tm = mix(mx0,mx1,fx);\n vec3 tm1 = mix(my0,my1,fx);\n\n return mix(tm,tm1,fy);\n}\n\n\nfloat ssrroughnessToMip(float roughness) {\n float mip = 0.0;\n\n if(roughness >= 0.8){\n mip = 9.0 + (roughness - 0.8) / 0.2;\n }else if(roughness >= 0.4){\n mip = 6.0 + 3.0 * (roughness - 0.4) / 0.4;\n }else if(roughness >= 0.305){\n mip = 5.0 + (roughness - 0.305) / 0.095;\n }else if(roughness >= 0.21){\n mip = 4.0 + (roughness - 0.21) / 0.095;\n }else{\n mip = 4.0 * roughness / 0.21;\n }\n\n return mip;\n}\n\nvec4 ssrtextureCubeUV(sampler2D envMap, vec2 vUv,float roughness) {\n float mip = ssrroughnessToMip(roughness);//clamp(ssrroughnessToMip(roughness), ssrm0, ssr_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n\n // vec3 color11 = ssrbilinearCubeUV(envMap, vUv,10.0);\n // return vec4(color11,1.0);\n\n vec3 color0 = ssrbilinearCubeUV(envMap, vUv,mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = ssrbilinearCubeUV(envMap, vUv,mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif\n\n",amrt_ssr_fragment:"\n\n#ifdef USE_SSR\n\t\n \n vec2 newssrUV = vec2(ssrUV.x / ssrUV.w,ssrUV.y / ssrUV.w);\n // vec4 ssrColor = texture2D(ssrTexture,newssrUV);\n // // // vec4 ssrColor = texture2DProj( ssrTexture, ssrUV );\n // reflectedLight.indirectSpecular = ssrColor.rgb;\n\n vec4 ssrColor = ssrtextureCubeUV(ssrTexture,newssrUV,material.specularRoughness);\n vec2 uv=(gl_FragCoord.xy-.5)/resolution.xy;\n uv.x=1.-uv.x;\n float depth = texture2DProj( tDepth, ssrUV ).r;\n float viewZ = getViewZ( depth );\n float clipW = virtualCameraProjectionMatrix[2][3] * viewZ+virtualCameraProjectionMatrix[3][3];\n vec3 viewPosition=getViewPosition( uv, depth, clipW );\n vec3 worldPosition=(virtualCameraMatrixWorld*vec4(viewPosition,1)).xyz;\n float ratio= saturate(1.0 - (abs(worldPosition.y - planeOffset)/maxDistance));\n float attenuation=ratio*ratio;\n float op = ssrOpacity*attenuation;// * fresnelCoe;\n reflectedLight.indirectSpecular = ssrColor.rgb * op; // * op\n \n\n\n#endif\n\n",amrt_ssr_uv_vertex:"\n\n#ifdef USE_SSR\n\t\nvarying vec4 ssrUV;\nuniform mat4 ssrTextureMatrix;\n\n#endif\n\n",amrt_ssr_vertex:"\n#ifdef USE_SSR\n ssrUV = ssrTextureMatrix * vec4( position, 1.0 );\n#endif\n\n"},Yi={common:{diffuse:{value:new Fn(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new lt},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 tt(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 Fn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},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 Fn(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new lt}},sprite:{diffuse:{value:new Fn(15658734)},opacity:{value:1},center:{value:new tt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new lt}},amrtbasic:{diffuse:{value:new Fn(.5,.5,.5)},opacity:{value:1},emissive:{value:new Fn(0)},smoothness:{value:.5},metalness:{value:.5},transparency:{value:0},cutout:{value:1},albedo:{value:null},normalMap:{value:null},normalScale:{value:1},normalMap2:{value:null},normalScale2:{value:1},metallicMap:{value:null},roughnessMap:{value:null},aoMap:{value:null},aoScale:{value:1},emissiveMap:{value:null},reflectMap:{value:null},reflectIntensity:{value:0},envMapIntensity:{value:1},alphaMap:{value:null},dissolveMap:{value:null},dissolveRatio:{value:1},dissolveColor:{value:new Fn(0)},ssrTextureMatrix:{value:new bt},ssrTexture:{value:null},maxDistance:{value:10},ssrOpacity:{value:1},fresnelCoe:{value:0},virtualCameraNear:{value:.1},virtualCameraFar:{value:1e3},virtualCameraMatrixWorld:{value:new bt},virtualCameraProjectionMatrix:{value:new bt},virtualCameraProjectionMatrixInverse:{value:new bt},resolution:{value:new tt},tDepth:{value:null},albedoUVTransform:{value:new lt},normalUVTransform:{value:new lt},normal2UVTransform:{value:new lt},metalUVTransform:{value:new lt},roughUVTransform:{value:new lt},aoUVTransform:{value:new lt},emissiveUVTransform:{value:new lt},alphaUVTransform:{value:new lt},clippingTransparent:{value:!1},planeOffset:{value:0}},amrtshadow:{color:{value:new Fn(0)},shadowPlane:{value:new vn(new at(0,-1),0)},shadowStrength:{value:1},lightDirection:{value:new at(-1,-1,-1)},shadowLength:{value:1},center:{value:new at(0,0,0)}}},Ki={basic:{uniforms:Ui([Yi.common,Yi.specularmap,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.fog]),vertexShader:Xi.meshbasic_vert,fragmentShader:Xi.meshbasic_frag},lambert:{uniforms:Ui([Yi.common,Yi.specularmap,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.fog,Yi.lights,{emissive:{value:new Fn(0)}}]),vertexShader:Xi.meshlambert_vert,fragmentShader:Xi.meshlambert_frag},phong:{uniforms:Ui([Yi.common,Yi.specularmap,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.gradientmap,Yi.fog,Yi.lights,{emissive:{value:new Fn(0)},specular:{value:new Fn(1118481)},shininess:{value:30}}]),vertexShader:Xi.meshphong_vert,fragmentShader:Xi.meshphong_frag},standard:{uniforms:Ui([Yi.common,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.roughnessmap,Yi.metalnessmap,Yi.fog,Yi.lights,{emissive:{value:new Fn(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Xi.meshphysical_vert,fragmentShader:Xi.meshphysical_frag},matcap:{uniforms:Ui([Yi.common,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.fog,{matcap:{value:null}}]),vertexShader:Xi.meshmatcap_vert,fragmentShader:Xi.meshmatcap_frag},points:{uniforms:Ui([Yi.points,Yi.fog]),vertexShader:Xi.points_vert,fragmentShader:Xi.points_frag},dashed:{uniforms:Ui([Yi.common,Yi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Xi.linedashed_vert,fragmentShader:Xi.linedashed_frag},depth:{uniforms:Ui([Yi.common,Yi.displacementmap]),vertexShader:Xi.depth_vert,fragmentShader:Xi.depth_frag},normal:{uniforms:Ui([Yi.common,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,{opacity:{value:1}}]),vertexShader:Xi.normal_vert,fragmentShader:Xi.normal_frag},sprite:{uniforms:Ui([Yi.sprite,Yi.fog]),vertexShader:Xi.sprite_vert,fragmentShader:Xi.sprite_frag},background:{uniforms:{uvTransform:{value:new lt},t2D:{value:null}},vertexShader:Xi.background_vert,fragmentShader:Xi.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1},brightness:{value:1}},vertexShader:Xi.cube_vert,fragmentShader:Xi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Xi.equirect_vert,fragmentShader:Xi.equirect_frag},distanceRGBA:{uniforms:Ui([Yi.common,Yi.displacementmap,{referencePosition:{value:new at},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Xi.distanceRGBA_vert,fragmentShader:Xi.distanceRGBA_frag},shadow:{uniforms:Ui([Yi.lights,Yi.fog,{color:{value:new Fn(0)},opacity:{value:1}}]),vertexShader:Xi.shadow_vert,fragmentShader:Xi.shadow_frag},acf:{uniforms:{diffuse:{value:new Fn(0)},map:{value:null}},vertexShader:Xi.acf_vert,fragmentShader:Xi.acf_frag}};function Zi(){var e=null,t=!1,n=null;function i(r,a){!1!==t&&(n(r,a),e.requestAnimationFrame(i))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(i),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Ji(e){var t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){n.isInterleavedBufferAttribute&&(n=n.data);var r=t.get(n);void 0===r?t.set(n,function(t,n){var i=t.array,r=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,i,r),t.onUploadCallback();var o=e.FLOAT;return i instanceof Float32Array?o=e.FLOAT:i instanceof Float64Array?console.warn("WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?o=e.UNSIGNED_SHORT:i instanceof Int16Array?o=e.SHORT:i instanceof Uint32Array?o=e.UNSIGNED_INT:i instanceof Int32Array?o=e.INT:i instanceof Int8Array?o=e.BYTE:i instanceof Uint8Array&&(o=e.UNSIGNED_BYTE),{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(n,i)):r.version0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===n.logarithmicDepthBuffer,A=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),c=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),u=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),d=e.getParameter(e.MAX_VERTEX_ATTRIBS),f=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),p=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=c>0,g=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:A,maxVertexTextures:c,maxTextureSize:h,maxCubemapSize:u,maxAttributes:d,maxVertexUniforms:f,maxVaryings:p,maxFragmentUniforms:m,vertexTextures:v,floatFragmentTextures:g,floatVertexTextures:v&&g,maxSamples:a?e.getParameter(e.MAX_SAMPLES):0}}function ir(){var e=this,t=null,n=0,i=!1,r=!1,a=new vn,o=new lt,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function A(t,n,i,r){var l=null!==t?t.length:0,A=null;if(0!==l){if(A=s.value,!0!==r||null===A){var c=i+4*l,h=n.matrixWorldInverse;o.getNormalMatrix(h),(null===A||A.length65535?Xn:jn)(i,1);f.version=s,t.update(f,e.ELEMENT_ARRAY_BUFFER);var p=r.get(n);p&&t.remove(p),r.set(n,f)}return{get:function(e,t){var r=i.get(t);return r||(t.addEventListener("dispose",a),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new si).setFromObject(e)),r=t._bufferGeometry),i.set(t,r),n.memory.geometries++,r)},update:function(n){var i=n.index,r=n.attributes;for(var a in null!==i&&t.update(i,e.ELEMENT_ARRAY_BUFFER),r)t.update(r[a],e.ARRAY_BUFFER);var o=n.morphAttributes;for(var a in o)for(var s=o[a],l=0,A=s.length;l0)return e;var r=t*n,a=gr[r];if(void 0===a&&(a=new Float32Array(r),gr[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function Cr(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n/gm;function ga(e){return e.replace(va,ya)}function ya(e,t){var n=Xi[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return ga(n)}var wa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function xa(e){return e.replace(wa,ba)}function ba(e,t,n,i){for(var r="",a=parseInt(t);a0?e.gammaFactor:1,w=a.isWebGL2?"":function(e,t,n){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||!t.vertexTangents?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":"",n.get("OES_texture_half_float")?"#extension OES_texture_half_float : enable":""].filter(fa).join("\n")}(i.extensions,a,t),x=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(u),b=h.createProgram(),M=a.numMultiviewViews;if(i.isRawShaderMaterial?((o=[x].filter(fa).join("\n")).length>0&&(o+="\n"),(s=[w,x].filter(fa).join("\n")).length>0&&(s+="\n")):(o=[Ma(a),"#define SHADER_NAME "+r.name,x,a.instancing?"#define USE_INSTANCING":"",a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+y,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+v:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.normalMap&&a.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.dissolveMap?"#define USE_DISSOLVE":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.vertexUvs?"#define USE_UV":"",a.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+p:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.albedo?"#define USE_ALBEDO":"",1===a.albedoUV?"#define ALBEDO_UV2":"#define ALBEDO_UV1",a.normalMap2?"#define USE_NORMALMAP2":"",a.metallicMap?"#define USE_METALLICMAP":"",1===a.aoUV?"#define AO_UV2":"#define AO_UV1",1===a.emissiveUV?"#define EMISSIVE_UV2":"#define EMISSIVE_UV1",a.reflectMap?"#define USE_REFLECTMAP":"",a.boneNum>4?"#define BONE_8":"",a.boneNum>8?"#define BONE_12":"",a.boneNum>12?"#define BONE_16":"",a.ssrTexture?"#define USE_SSR":"","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","\n"].filter(fa).join("\n"),s=[w,Ma(a),"#define SHADER_NAME "+r.name,x,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+y,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+m:"",a.envMap?"#define "+v:"",a.envMap?"#define "+g:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.normalMap&&a.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.dissolveMap?"#define USE_DISSOLVE":"",a.sheen?"#define USE_SHEEN":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.vertexUvs?"#define USE_UV":"",a.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+p:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensions&&i.extensions.shaderTextureLOD||a.envMap||a.reflectMap)&&(a.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform mat4 viewMatrixR;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==a.toneMapping?"#define TONE_MAPPING":"",0!==a.toneMapping?Xi.tonemapping_pars_fragment:"",0!==a.toneMapping?da("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Xi.encodings_pars_fragment:"",a.mapEncoding?ua("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?ua("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?ua("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?ua("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(l="linearToOutputTexel",A=a.outputEncoding,c=ca(A),"vec4 "+l+"( vec4 value ) { return LinearTo"+c[0]+c[1]+"; }"):"",a.albedoEncoding?ua("albedoTexelToLinear",a.albedoEncoding):"",a.normalMapEncoding?ua("normalMapTexelToLinear",a.normalMapEncoding):"",a.normalMap2Encoding?ua("normalMap2TexelToLinear",a.normalMap2Encoding):"",a.metallicMapEncoding?ua("metallicMapTexelToLinear",a.metallicMapEncoding):"",a.roughnessMapEncoding?ua("roughnessMapTexelToLinear",a.roughnessMapEncoding):"",a.aoMapEncoding?ua("aoMapTexelToLinear",a.aoMapEncoding):"",a.reflectMapEncoding?ua("reflectMapTexelToLinear",a.reflectMapEncoding):"",a.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"",a.albedo?"#define USE_ALBEDO":"",1===a.albedoUV?"#define ALBEDO_UV2":"#define ALBEDO_UV1",a.normalMap2?"#define USE_NORMALMAP2":"",a.metallicMap?"#define USE_METALLICMAP":"",1===a.aoUV?"#define AO_UV2":"#define AO_UV1",1===a.emissiveUV?"#define EMISSIVE_UV2":"#define EMISSIVE_UV1",a.reflectMap?"#define USE_REFLECTMAP":"",a.reflectMapUV?"#define USE_REFLECTMAP_UV":"",a.transparency?"#define TRANSPARENCY":"",a.ssrTexture?"#define USE_SSR":"","\n"].filter(fa).join("\n")),d=ma(d=pa(d=ga(d),a),a),f=ma(f=pa(f=ga(f),a),a),d=xa(d),f=xa(f),a.isWebGL2&&!i.isRawShaderMaterial){var C=!1,B=/^\s*#version\s+300\s+es\s*\n/;i.isShaderMaterial&&null!==d.match(B)&&null!==f.match(B)&&(C=!0,d=d.replace(B,""),f=f.replace(B,"")),o=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+o,s=["#version 300 es\n","#define varying in",C?"":"out highp vec4 pc_fragColor;",C?"":"#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"+s,M>0&&(o=(o=o.replace("#version 300 es\n",["#version 300 es\n","#extension GL_OVR_multiview2 : require","layout(num_views = "+M+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+M+"];","uniform mat4 projectionMatrices["+M+"];","uniform mat4 viewMatrices["+M+"];","uniform mat3 normalMatrices["+M+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),s=(s=s.replace("#version 300 es\n",["#version 300 es\n","#extension GL_OVR_multiview2 : require","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+M+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n")))}var E,S,T=o+d,_=s+f,I=la(h,h.VERTEX_SHADER,T),L=la(h,h.FRAGMENT_SHADER,_);if(h.attachShader(b,I),h.attachShader(b,L),void 0!==i.index0AttributeName?h.bindAttribLocation(b,0,i.index0AttributeName):!0===a.morphTargets&&h.bindAttribLocation(b,0,"position"),h.linkProgram(b),e.debug.checkShaderErrors){var F=h.getProgramInfoLog(b).trim(),k=h.getShaderInfoLog(I).trim(),P=h.getShaderInfoLog(L).trim(),U=!0,D=!0;if(!1===h.getProgramParameter(b,h.LINK_STATUS)){U=!1;var R=ha(h,I,"vertex"),O=ha(h,L,"fragment");console.error("WebGLProgram: shader error: ",h.getError(),"gl.VALIDATE_STATUS",h.getProgramParameter(b,h.VALIDATE_STATUS),"gl.getProgramInfoLog",F,R,O)}else""!==F?console.warn("WebGLProgram: gl.getProgramInfoLog()",F):""!==k&&""!==P||(D=!1);D&&(this.diagnostics={runnable:U,material:i,programLog:F,vertexShader:{log:k,prefix:o},fragmentShader:{log:P,prefix:s}})}return h.deleteShader(I),h.deleteShader(L),this.getUniforms=function(){return void 0===E&&(E=new sa(h,b)),E},this.getAttributes=function(){return void 0===S&&(S=function(e,t){for(var n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),r=0;r0,maxBones:g,useVertexTexture:o,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:i.directional.length,numPointLights:i.point.length,numSpotLights:i.spot.length,numRectAreaLights:i.rectArea.length,numHemiLights:i.hemi.length,numDirLightShadows:i.directionalShadowMap.length,numPointLightShadows:i.pointShadowMap.length,numSpotLightShadows:i.spotShadowMap.length,numClippingPlanes:f,numClipIntersection:p,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:t.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:2===t.side,flipSided:1===t.side,depthPacking:void 0!==t.depthPacking&&t.depthPacking,albedo:!!t.albedo,albedoUV:t.albedoUV,normalMap2:!!t.normalMap2,metallicMap:!!t.metallicMap,aoUV:t.aoUV,emissiveUV:t.emissiveUV,reflectMap:!!t.reflectMap,reflectMapUV:!!t.reflectMap&&!t.reflectMap.isCubeTexture,aoMapEncoding:u(t.aoMap,e.gammaInput),roughnessMapEncoding:u(t.roughnessMap,e.gammaInput),metallicMapEncoding:u(t.metallicMap,e.gammaInput),normalMapEncoding:u(t.normalMap,e.gammaInput),normalMap2Encoding:u(t.normalMap2,e.gammaInput),albedoEncoding:u(t.albedo,e.gammaInput),reflectMapEncoding:u(t.reflectMap,e.gammaInput),transparency:void 0!==t.transparency&&t.transparency>0,boneNum:y,dissolveMap:!!t.dissolveMap,dissolveRatio:t.dissolveRatio,ssrTexture:!!t.ssrTexture}},this.getProgramCacheKey=function(t,n){var i=[];if(n.shaderID?i.push(n.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)i.push(r),i.push(t.defines[r]);for(var a=0;a1&&n.sort(Sa),i.length>1&&i.sort(Ta)}}}function Ia(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r,a=e.get(n);return void 0===a?(r=new _a,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):void 0===(r=a.get(i))&&(r=new _a,a.set(i,r)),r},dispose:function(){e=new WeakMap}}}function La(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new at,color:new Fn,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new tt};break;case"SpotLight":n={position:new at,direction:new at,color:new Fn,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new tt};break;case"PointLight":n={position:new at,color:new Fn,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new tt,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new at,skyColor:new Fn,groundColor:new Fn};break;case"RectAreaLight":n={color:new Fn,position:new at,halfWidth:new at,halfHeight:new at}}return e[t.id]=n,n}}}var Fa=0;function ka(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Pa(){for(var e=new La,t={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:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},n=0;n<9;n++)t.probe.push(new at);var i=new at,r=new bt,a=new bt;return{setup:function(n,o,s){for(var l=0,A=0,c=0,h=0;h<9;h++)t.probe[h].set(0,0,0);var u=0,d=0,f=0,p=0,m=0,v=0,g=0,y=0,w=s.matrixWorldInverse;n.sort(ka),h=0;for(var x=n.length;h\n\nvoid main() {\n\n float mean = 0.0;\n float squared_mean = 0.0;\n\n\t// This seems totally useless but it's a crazy work around for a Adreno compiler bug\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\n #ifdef HORIZONAL_PASS\n\n vec2 distribution = unpack2HalfToRGBA ( 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\n #else\n\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\n #endif\n\n }\n\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n\n float std_dev = sqrt( squared_mean - mean * mean );\n\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n\n}\n"}),u=h.clone();u.defines.HORIZONAL_PASS=1;var d=new si;d.setAttribute("position",new zn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new Ei(d,h),p=this;function m(n,i){var r=t.update(f);h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,h,f,null),u.uniforms.shadow_pass.value=n.mapPass.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,u,f,null)}function v(e,t,n){var i=e<<0|t<<1|n<<2,r=s[i];return void 0===r&&(r=new Ra({depthPacking:je,morphTargets:e,skinning:t}),s[i]=r),r}function g(e,t,n){var i=e<<0|t<<1|n<<2,r=l[i];return void 0===r&&(r=new Oa({morphTargets:e,skinning:t}),l[i]=r),r}function y(t,n,i,r,a,o){var s=t.geometry,l=null,h=v,u=t.customDepthMaterial;if(!0===i.isPointLight&&(h=g,u=t.customDistanceMaterial),void 0===u){var d=!1;!0===n.morphTargets&&(!0===s.isBufferGeometry?d=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:!0===s.isGeometry&&(d=s.morphTargets&&s.morphTargets.length>0));var f=!1;!0===t.isSkinnedMesh&&!0===n.skinning&&(f=!0),l=h(d,f,!0===t.isInstancedMesh)}else l=u;if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var p=l.uuid,m=n.uuid,y=A[p];void 0===y&&(y={},A[p]=y);var w=y[m];void 0===w&&(w=l.clone(),y[m]=w),l=w}return l.visible=n.visible,l.wireframe=n.wireframe,l.side=3===o?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:c[n.side],l.clipShadows=n.clipShadows,l.clippingPlanes=n.clippingPlanes,l.clipIntersection=n.clipIntersection,l.wireframeLinewidth=n.wireframeLinewidth,l.linewidth=n.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=r,l.farDistance=a),l}function w(n,r,a,o,s){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),A=n.material;if(Array.isArray(A))for(var c=l.groups,h=0,u=c.length;hn||r.y>n)&&(console.warn("WebGLShadowMap:",v,"has shadow exceeding max texture size, reducing"),r.x>n&&(a.x=Math.floor(n/y.x),r.x=a.x*y.x,g.mapSize.x=a.x),r.y>n&&(a.y=Math.floor(n/y.y),r.y=a.y*y.y,g.mapSize.y=a.y)),null===g.map&&!g.isPointLightShadow&&3===this.type){var x={minFilter:Z,magFilter:Z,format:ce};g.map=new dt(r.x,r.y,x),g.map.texture.name=v.name+".shadowMap",g.mapPass=new dt(r.x,r.y,x),g.camera.updateProjectionMatrix()}if(null===g.map){x={minFilter:X,magFilter:X,format:ce};g.map=new dt(r.x,r.y,x),g.map.texture.name=v.name+".shadowMap",g.camera.updateProjectionMatrix()}e.setRenderTarget(g.map),e.clear();for(var b=g.getViewportCount(),M=0;M=1):-1!==Q.indexOf("OpenGL ES")&&(z=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(Q)[1]),N=z>=2);var G=null,H={},V=new ut,j=new ut;function W(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var o=0;oi||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?et.floorPowerOfTwo:Math.floor,o=a(r*e.width),s=a(r*e.height);void 0===A&&(A=g(o,s));var l=n?g(o,s):A;return l.width=o,l.height=s,l.getContext("2d").drawImage(e,0,0,o,s),console.warn("Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),l}return"data"in e&&console.warn("Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function w(e){return et.isPowerOfTwo(e.width)&&et.isPowerOfTwo(e.height)}function x(e,t){return e.generateMipmaps&&t&&e.minFilter!==X&&e.minFilter!==Z}function b(t,n,r,a){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log(Math.max(r,a))*Math.LOG2E}function M(n,i){if(!1===h)return n;var r=n;return n===e.RED&&(i===e.FLOAT&&(r=e.R32F),i===e.HALF_FLOAT&&(r=e.R16F),i===e.UNSIGNED_BYTE&&(r=e.R8)),n===e.RGB&&(i===e.FLOAT&&(r=e.RGB32F),i===e.HALF_FLOAT&&(r=e.RGB16F),i===e.UNSIGNED_BYTE&&(r=e.RGB8)),n===e.RGBA&&(i===e.FLOAT&&(r=e.RGBA32F),i===e.HALF_FLOAT&&(r=e.RGBA16F),i===e.UNSIGNED_BYTE&&(r=e.RGBA8)),r===e.R16F||r===e.R32F||r===e.RGBA16F||r===e.RGBA32F?t.get("EXT_color_buffer_float"):r!==e.RGB16F&&r!==e.RGB32F||console.warn("Floating point textures with RGB format not supported. Please use RGBA instead."),r}function C(t){return t===X||t===Y||t===K?e.NEAREST:e.LINEAR}function B(t){var n=t.target;n.removeEventListener("dispose",B),function(t){var n=i.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),i.remove(t)}(n),n.isVideoTexture&&m.delete(n),o.memory.textures--}function E(t){var n=t.target;n.removeEventListener("dispose",E),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);if(t.isWebGLMultiviewRenderTarget){e.deleteTexture(n.__webglColorTexture),e.deleteTexture(n.__webglDepthStencilTexture),o.memory.textures-=2;a=0;for(var s=n.__webglViewFramebuffers.length;a0&&a.__version!==t.version){var s=t.image;if(void 0===s)console.warn("Texture marked for update but image is undefined");else if(!1!==s.complete)return void U(a,t,r)}n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_2D,a.__webglTexture)}function _(t,r){if(6===t.image.length){var o=i.get(t);if(t.version>0&&o.__version!==t.version){P(o,t),n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var s=t&&t.isCompressedTexture,l=t.image[0]&&t.image[0].isDataTexture,A=[],c=0;c<6;c++)A[c]=s||l?l?t.image[c].image:t.image[c]:y(t.image[c],!1,!0,d);var u,f=A[0],p=w(f)||h,m=a.convert(t.format),v=a.convert(t.type),g=M(m,v);if(k(e.TEXTURE_CUBE_MAP,t,p),s){for(c=0;c<6;c++){u=A[c].mipmaps;for(var C=0;C1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function P(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",B),t.__webglTexture=e.createTexture(),o.memory.textures++)}function U(t,i,r){var o=e.TEXTURE_2D;i.isDataTexture2DArray&&(o=e.TEXTURE_2D_ARRAY),i.isDataTexture3D&&(o=e.TEXTURE_3D),P(t,i),n.activeTexture(e.TEXTURE0+r),n.bindTexture(o,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment);var s=function(e){return!h&&(e.wrapS!==j||e.wrapT!==j||e.minFilter!==X&&e.minFilter!==Z)}(i)&&!1===w(i.image),l=y(i.image,s,!1,f),A=w(l)||h,c=a.convert(i.format),u=a.convert(i.type),d=M(c,u);k(o,i,A);var p,m=i.mipmaps;if(i.isDepthTexture){if(d=e.DEPTH_COMPONENT,i.type===ne){if(!1===h)throw new Error("Float Depth Texture only supported in WebGL2.0");d=e.DEPTH_COMPONENT32F}else h&&(d=e.DEPTH_COMPONENT16);i.format===fe&&d===e.DEPTH_COMPONENT&&i.type!==ee&&i.type!==te&&(console.warn("Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=ee,u=a.convert(i.type)),i.format===pe&&(d=e.DEPTH_STENCIL,i.type!==se&&(console.warn(" Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=se,u=a.convert(i.type))),n.texImage2D(e.TEXTURE_2D,0,d,l.width,l.height,0,c,u,null)}else if(i.isDataTexture)if(m.length>0&&A){for(var v=0,g=m.length;v0&&A){for(v=0,g=m.length;v=u&&console.warn("Trying to use "+e+" texture units while this GPU supports only "+u),S+=1,e},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(t,r){var a=i.get(t);t.version>0&&a.__version!==t.version?U(a,t,r):(n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture))},this.setTexture3D=function(t,r){var a=i.get(t);t.version>0&&a.__version!==t.version?U(a,t,r):(n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_3D,a.__webglTexture))},this.setTextureCube=_,this.setTextureCubeDynamic=I,this.setupRenderTarget=function(r){var s=i.get(r),l=i.get(r.texture);r.addEventListener("dispose",E),l.__webglTexture=e.createTexture(),o.memory.textures++;var A=!0===r.isWebGLRenderTargetCube,c=!0===r.isWebGLMultisampleRenderTarget,u=!0===r.isWebGLMultiviewRenderTarget,d=w(r)||h;if(A){s.__webglFramebuffer=[];for(var f=0;f<6;f++)s.__webglFramebuffer[f]=e.createFramebuffer()}else if(s.__webglFramebuffer=e.createFramebuffer(),c)if(h){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s.__webglColorRenderbuffer);var p=M(a.convert(r.texture.format),a.convert(r.texture.type)),m=N(r);e.renderbufferStorageMultisample(e.RENDERBUFFER,m,p,r.width,r.height),e.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,s.__webglColorRenderbuffer),e.bindRenderbuffer(e.RENDERBUFFER,null),r.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),R(s.__webglDepthRenderbuffer,r,!0)),e.bindFramebuffer(e.FRAMEBUFFER,null)}else console.warn("WebGLMultisampleRenderTarget can only be used with WebGL2.");else if(u){var v=r.width,g=r.height,y=r.numViews;e.bindFramebuffer(e.FRAMEBUFFER,s.__webglFramebuffer);var C=t.get("OVR_multiview2");o.memory.textures+=2;var B=e.createTexture();e.bindTexture(e.TEXTURE_2D_ARRAY,B),e.texParameteri(e.TEXTURE_2D_ARRAY,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D_ARRAY,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texImage3D(e.TEXTURE_2D_ARRAY,0,e.RGBA8,v,g,y,0,e.RGBA,e.UNSIGNED_BYTE,null),C.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,B,0,0,y);var S=e.createTexture();e.bindTexture(e.TEXTURE_2D_ARRAY,S),e.texParameteri(e.TEXTURE_2D_ARRAY,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D_ARRAY,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texImage3D(e.TEXTURE_2D_ARRAY,0,e.DEPTH24_STENCIL8,v,g,y,0,e.DEPTH_STENCIL,e.UNSIGNED_INT_24_8,null),C.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,S,0,0,y);var T=new Array(y);for(f=0;fh)return!1;for(var n=1,i=t.length;n=0){var A=r[s];if(void 0!==A){var c=A.normalized,h=A.itemSize;if(void 0===(M=w.get(A)))continue;var u=M.buffer,v=M.type,g=M.bytesPerElement;if(A.isInterleavedBufferAttribute){var y=A.data,x=y.stride,b=A.offset;y&&y.isInstancedInterleavedBuffer?(m.enableAttributeAndDivisor(l,y.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=y.meshPerAttribute*y.count)):m.enableAttribute(l),d.bindBuffer(d.ARRAY_BUFFER,u),d.vertexAttribPointer(l,h,v,c,x*g,b*g)}else A.isInstancedBufferAttribute?(m.enableAttributeAndDivisor(l,A.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=A.meshPerAttribute*A.count)):m.enableAttribute(l),d.bindBuffer(d.ARRAY_BUFFER,u),d.vertexAttribPointer(l,h,v,c,0,0)}else if("instanceMatrix"===s){if(void 0===e.instanceMatrix)continue;var M;if(void 0===(M=w.get(e.instanceMatrix)))continue;u=M.buffer,v=M.type;m.enableAttributeAndDivisor(l+0,1),m.enableAttributeAndDivisor(l+1,1),m.enableAttributeAndDivisor(l+2,1),m.enableAttributeAndDivisor(l+3,1),d.bindBuffer(d.ARRAY_BUFFER,u),d.vertexAttribPointer(l+0,4,v,!1,64,0),d.vertexAttribPointer(l+1,4,v,!1,64,16),d.vertexAttribPointer(l+2,4,v,!1,64,32),d.vertexAttribPointer(l+3,4,v,!1,64,48)}else if(void 0!==o){var C=o[s];if(void 0!==C)switch(C.length){case 2:d.vertexAttrib2fv(l,C);break;case 3:d.vertexAttrib3fv(l,C);break;case 4:d.vertexAttrib4fv(l,C);break;default:d.vertexAttrib1fv(l,C)}}}}m.disableUnusedAttributes()}(r,n,i,s),null!==A&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.buffer));var g=1/0;null!==A?g=A.count:void 0!==c&&(g=c.count);var y=n.drawRange.start*u,b=n.drawRange.count*u,M=null!==a?a.start*u:0,C=null!==a?a.count*u:1/0,B=Math.max(y,M),E=Math.min(g,y+b,M+C)-1,I=Math.max(0,E-B+1);if(0!==I){if(r.isMesh)if(!0===i.wireframe)m.setLineWidth(i.wireframeLinewidth*oe()),v.setMode(d.LINES);else switch(r.drawMode){case 0:v.setMode(d.TRIANGLES);break;case 1:v.setMode(d.TRIANGLE_STRIP);break;case 2:v.setMode(d.TRIANGLE_FAN)}else if(r.isLine){var L=i.linewidth;void 0===L&&(L=1),m.setLineWidth(L*oe()),r.isLineSegments?v.setMode(d.LINES):r.isLineLoop?v.setMode(d.LINE_LOOP):v.setMode(d.LINE_STRIP)}else r.isPoints?v.setMode(d.POINTS):r.isSprite&&v.setMode(d.TRIANGLES);r.isInstancedMesh?v.renderInstances(n,B,I,r.count):n.isInstancedBufferGeometry?v.renderInstances(n,B,I,n.maxInstancedCount):v.render(B,I)}}},this.compile=function(e,t){(u=B.get(e,t)).init(),e.traverse((function(e){e.isLight&&(u.pushLight(e),e.castShadow&&u.pushShadow(e))})),u.setupLights(t),e.traverse((function(t){if(t.material)if(Array.isArray(t.material))for(var n=0;n=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(f=0;f=0&&e.numSupportedMorphNormals++}var p=i.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=q.numPlanes,i.numIntersection=q.numIntersection,p.clippingPlanes=q.uniform),i.fog=t,i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isAMRTBasicMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(p.ambientLightColor.value=r.state.ambient,p.lightProbe.value=r.state.probe,p.directionalLights.value=r.state.directional,p.spotLights.value=r.state.spot,p.rectAreaLights.value=r.state.rectArea,p.pointLights.value=r.state.point,p.hemisphereLights.value=r.state.hemi,p.directionalShadowMap.value=r.state.directionalShadowMap,p.directionalShadowMatrix.value=r.state.directionalShadowMatrix,p.spotShadowMap.value=r.state.spotShadowMap,p.spotShadowMatrix.value=r.state.spotShadowMatrix,p.pointShadowMap.value=r.state.pointShadowMap,p.pointShadowMatrix.value=r.state.pointShadowMatrix);var m=i.program.getUniforms(),v=sa.seqWithValue(m.seq,p);i.uniformsList=v}function Be(e,t,n,i){y.resetTextureUnits();var r=g.get(n),a=u.state.lights;if(ee&&(te||e!==z)){var o=e===z&&n.id===O;q.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,r,o)}n.version===r.__version&&(void 0===r.program||n.fog&&r.fog!==t||r.needsLights&&r.lightsStateVersion!==a.state.version?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===q.numPlanes&&r.numIntersection===q.numIntersection||(n.needsUpdate=!0)),n.version!==r.__version&&(Ce(n,t,i),r.__version=n.version);var s,l,A=!1,c=!1,h=!1,f=r.program,v=f.getUniforms(),w=r.shader.uniforms;if(m.useProgram(f.program)&&(A=!0,c=!0,h=!0),n.id!==O&&(O=n.id,c=!0),A||z!==e){if(f.numMultiviewViews>0?ue.updateCameraProjectionMatricesUniform(e,v):v.setValue(d,"projectionMatrix",e.projectionMatrix),p.logarithmicDepthBuffer&&v.setValue(d,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),z!==e&&(z=e,c=!0,h=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isAMRTBasicMaterial||n.isACFBasicMaterial||n.isAMRTShadowMaterial||n.envMap){var x=v.map.cameraPosition;void 0!==x&&x.setValue(d,ae.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isAMRTBasicMaterial||n.isACFBasicMaterial||n.isShaderMaterial)&&v.setValue(d,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isAMRTBasicMaterial||n.isACFBasicMaterial||n.isShaderMaterial||n.skinning||n.isAMRTShadowMaterial)&&(f.numMultiviewViews>0?ue.updateCameraViewMatricesUniform(e,v):(v.setValue(d,"viewMatrix",e.matrixWorldInverse),v.setValue(d,"viewMatrixR",e.matrixWorldInverseR)))}if(n.skinning){v.setOptional(d,i,"bindMatrix"),v.setOptional(d,i,"bindMatrixInverse");var b=i.skeleton;if(b){var M=b.bones;if(p.floatVertexTextures){if(void 0===b.boneTexture){var C=Math.sqrt(4*M.length);C=et.ceilPowerOfTwo(C),C=Math.max(C,4);var B=new Float32Array(C*C*4);B.set(b.boneMatrices);var E=new Hi(B,C,C,ce,ne);b.boneMatrices=B,b.boneTexture=E,b.boneTextureSize=C}v.setValue(d,"boneTexture",b.boneTexture,y),v.setValue(d,"boneTextureSize",b.boneTextureSize)}else v.setOptional(d,b,"boneMatrices")}}return(c||r.receiveShadow!==i.receiveShadow)&&(r.receiveShadow=i.receiveShadow,v.setValue(d,"receiveShadow",i.receiveShadow)),c&&(v.setValue(d,"toneMappingExposure",L.toneMappingExposure),v.setValue(d,"toneMappingWhitePoint",L.toneMappingWhitePoint),r.needsLights&&(l=h,(s=w).ambientLightColor.needsUpdate=l,s.lightProbe.needsUpdate=l,s.directionalLights.needsUpdate=l,s.pointLights.needsUpdate=l,s.spotLights.needsUpdate=l,s.rectAreaLights.needsUpdate=l,s.hemisphereLights.needsUpdate=l),t&&n.fog&&function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(w,t),n.isMeshBasicMaterial?Ee(w,n):n.isMeshLambertMaterial?(Ee(w,n),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(w,n)):n.isMeshPhongMaterial?(Ee(w,n),n.isMeshToonMaterial?function(e,t){Se(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(w,n):Se(w,n)):n.isMeshStandardMaterial?(Ee(w,n),n.isMeshPhysicalMaterial?function(e,t){Te(e,t),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(w,n):Te(w,n)):n.isAMRTBasicMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.emissive.value.copy(t.emissive),e.smoothness.value=t.smoothness,e.metalness.value=t.metallic,e.reflectivity.value=t.reflectivity,e.transparency.value=t.transparency,e.envYMatrix.value.copy(t.envYMatrix),e.reflecYMatrix.value.copy(t.reflecYMatrix),e.clippingTransparent.value=t.clippingTransparent,e.planeOffset.value=t.planeOffset,t.albedo&&(e.albedo.value=t.albedo,!0===t.albedo.matrixAutoUpdate&&t.albedo.updateMatrix(),e.albedoUVTransform.value.copy(t.albedo.matrix));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value=t.normalScale,!0===t.normalMap.matrixAutoUpdate&&t.normalMap.updateMatrix(),e.normalUVTransform.value.copy(t.normalMap.matrix));t.normalMap2&&(e.normalMap2.value=t.normalMap2,e.normalScale2.value=t.normalScale2,!0===t.normalMap2.matrixAutoUpdate&&t.normalMap2.updateMatrix(),e.normal2UVTransform.value.copy(t.normalMap2.matrix));t.metallicMap&&(e.metallicMap.value=t.metallicMap,!0===t.metallicMap.matrixAutoUpdate&&t.metallicMap.updateMatrix(),e.metalUVTransform.value.copy(t.metallicMap.matrix));t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,!0===t.roughnessMap.matrixAutoUpdate&&t.roughnessMap.updateMatrix(),e.roughUVTransform.value.copy(t.roughnessMap.matrix));t.aoMap&&(e.aoMap.value=t.aoMap,e.aoScale.value=t.aoScale,!0===t.aoMap.matrixAutoUpdate&&t.aoMap.updateMatrix(),e.aoUVTransform.value.copy(t.aoMap.matrix));t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap,!0===t.emissiveMap.matrixAutoUpdate&&t.emissiveMap.updateMatrix(),e.emissiveUVTransform.value.copy(t.emissiveMap.matrix));t.reflectMap&&(e.reflectMap.value=t.reflectMap,e.reflectIntensity.value=t.reflectIntensity);e.cutout.value=t.cutout,t.envMap&&(e.envMap.value=t.envMap,e.envMapIntensity.value=t.envMapIntensity,e.flipEnvMap.value=t.envMap.isCubeTexture?-1:1,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=8);t.alphaMap&&(e.alphaMap.value=t.alphaMap,!0===t.alphaMap.matrixAutoUpdate&&t.alphaMap.updateMatrix(),e.alphaUVTransform.value.copy(t.alphaMap.matrix));t.dissolveMap&&(e.dissolveMap.value=t.dissolveMap,e.dissolveRatio.value=t.dissolveRatio,e.dissolveColor.value=t.dissolveColor,!0===t.dissolveMap.matrixAutoUpdate&&t.dissolveMap.updateMatrix());t.ssrTexture&&(e.ssrTexture.value=t.ssrTexture,e.ssrTextureMatrix.value=t.ssrTextureMatrix,e.maxDistance.value=t.maxDistance,e.ssrOpacity.value=t.ssrOpacity,e.fresnelCoe.value=t.fresnelCoe,e.virtualCameraNear.value=t.virtualCameraNear,e.virtualCameraFar.value=t.virtualCameraFar,e.virtualCameraMatrixWorld.value=t.virtualCameraMatrixWorld,e.virtualCameraProjectionMatrix.value=t.virtualCameraProjectionMatrix,e.virtualCameraProjectionMatrixInverse.value=t.virtualCameraProjectionMatrixInverse,e.resolution.value=t.resolution,e.tDepth.value=t.depthTexture,!0===t.ssrTexture.matrixAutoUpdate&&t.ssrTexture.updateMatrix())}(w,n):n.isAMRTShadowMaterial?function(e,t){e.color.value=t.color,e.shadowPlane.value=t.shadowPlane,e.lightDirection.value=t.lightDirection,e.shadowLength.value=t.shadowLength,e.center.value=t.center,e.shadowStrength.value=t.shadowStrength}(w,n):n.isMeshMatcapMaterial?(Ee(w,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isMeshDepthMaterial?(Ee(w,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isMeshDistanceMaterial?(Ee(w,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(w,n)):n.isMeshNormalMaterial?(Ee(w,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(w,n),n.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(w,n)):n.isPointsMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*X,e.scale.value=.5*W,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(w,n):n.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(w,n):n.isShadowMaterial?(w.color.value.copy(n.color),w.opacity.value=n.opacity):n.isACFBasicMaterial&&(n.color&&w.diffuse.value.copy(n.color),n.map&&(w.map.value=n.map)),void 0!==w.ltc_1&&(w.ltc_1.value=Yi.LTC_1),void 0!==w.ltc_2&&(w.ltc_2.value=Yi.LTC_2),sa.upload(d,r.uniformsList,w,y),n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(sa.upload(d,r.uniformsList,w,y),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&v.setValue(d,"center",i.center),f.numMultiviewViews>0?ue.updateObjectMatricesUniforms(i,e,v):(v.setValue(d,"modelViewMatrix",i.modelViewMatrix),v.setValue(d,"normalMatrix",i.normalMatrix)),v.setValue(d,"modelMatrix",i.matrixWorld),f}function Ee(e,t){var n;e.opacity.value=t.opacity,t.color&&e.diffuse.value.copy(t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=g.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function Se(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function Te(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}ye.setAnimationLoop((function(e){he.isPresenting()||ge&&ge(e)})),"undefined"!=typeof window&&ye.setContext(window),this.setAnimationLoop=function(e){ge=e,he.setAnimationLoop(e),ye.start()},this.render=function(e,t){var n,i;if(void 0!==arguments[2]&&(console.warn("the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),t&&t.isCamera){if(!F){N.geometry=null,N.program=null,N.wireframe=!1,O=-1,z=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),he.enabled&&he.isPresenting()&&(t=he.getCamera(t)),(u=B.get(e,t)).init(),e.onBeforeRender(L,e,t,n||D),re.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),J.setFromMatrix(re),te=this.localClippingEnabled,ee=q.init(this.clippingPlanes,te,t),(h=C.get(e,t)).init(),xe(e,t,0,L.sortObjects),!0===L.sortObjects&&h.sort(),ee&&q.beginShadows();var r=u.state.shadowsArray;de.render(r,e,t),u.setupLights(t),ee&&q.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),he.enabled&&ue.isAvailable()&&ue.attachCamera(t),E.render(h,e,t,i);var a=h.opaque,o=h.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&be(a,e,t,s),o.length&&be(o,e,t,s)}else a.length&&be(a,e,t),o.length&&be(o,e,t);e.onAfterRender(L,e,t),null!==D&&(y.updateRenderTargetMipmap(D),y.updateMultisampleRenderTarget(D)),m.buffers.depth.setTest(!0),m.buffers.depth.setMask(!0),m.buffers.color.setMask(!0),m.setPolygonOffset(!1),he.enabled&&(ue.isAvailable()&&ue.detachCamera(t),he.submitFrame()),h=null,u=null}}else console.error("camera is not an instance of Camera.")},this.renderArray=function(e,t,n){if(!F){N.geometry=null,N.program=null,N.wireframe=!1,O=-1,z=null,null===n.parent&&n.updateMatrixWorld(),(u=B.get(t,n)).init(),re.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),J.setFromMatrix(re),te=this.localClippingEnabled,ee=q.init(this.clippingPlanes,te,n),(h=C.get(t,n)).init();for(var i=0;i=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&d.readPixels(t,n,i,r,I.convert(c),I.convert(h),a):console.error("readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&d.bindFramebuffer(d.FRAMEBUFFER,R)}}}else console.error("renderTarget is not WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=I.convert(t.format);y.setTexture2D(t,0),d.copyTexImage2D(d.TEXTURE_2D,n,o,e.x,e.y,r,a,0),m.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i){var r=t.image.width,a=t.image.height,o=I.convert(n.format),s=I.convert(n.type);y.setTexture2D(n,0),t.isDataTexture?d.texSubImage2D(d.TEXTURE_2D,i||0,e.x,e.y,r,a,o,s,t.image.data):d.texSubImage2D(d.TEXTURE_2D,i||0,e.x,e.y,o,s,t.image),m.unbindTexture()},this.initTexture=function(e){y.setTexture2D(e,0),m.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function eo(e,t){this.name="",this.color=new Fn(e),this.density=void 0!==t?t:25e-5}function to(e,t,n){this.name="",this.color=new Fn(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function no(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Xe,this.updateRange={offset:0,count:-1},this.version=0}function io(e,t,n,i){this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function ro(e){On.call(this),this.type="SpriteMaterial",this.color=new Fn(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.assign(Ja.prototype,Je.prototype),Object.assign(qa.prototype,Je.prototype),Object.assign(eo.prototype,{isFogExp2:!0,clone:function(){return new eo(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(to.prototype,{isFog:!0,clone:function(){return new to(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(no.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(no.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;ie.far||t.push({distance:s,point:ao.clone(),uv:Tn.getUV(ao,ho,uo,fo,po,mo,vo,new tt),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return zt.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var wo=new at,xo=new at;function bo(){zt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}bo.prototype=Object.assign(Object.create(zt.prototype),{constructor:bo,isLOD:!0,copy:function(e){zt.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n0){for(var n=1,i=t.length;n0){wo.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(wo);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){wo.setFromMatrixPosition(e.matrixWorld),xo.setFromMatrixPosition(this.matrixWorld);var n=wo.distanceTo(xo);t[0].object.visible=!0;for(var i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(;i=n.count)&&this.geometry.attributes.skinIndex_4){Co.set(n.array[3*e],n.array[3*e+1],n.array[3*e+2]);var i=t;i||(i=new at(0,0,0)),Co.applyMatrix4(this.bindMatrix);var r=this.geometry.attributes.skinIndex_4.array,a=this.geometry.attributes.skinWeight_4.array;return i.copy(this.getVertexByWeight(r[4*e],a[4*e],Co)),i.add(this.getVertexByWeight(r[4*e+1],a[4*e+1],Co)),i.add(this.getVertexByWeight(r[4*e+2],a[4*e+2],Co)),i.add(this.getVertexByWeight(r[4*e+3],a[4*e+3],Co)),this.boneNum>4&&(r=this.geometry.attributes.skinIndex_8.array,a=this.geometry.attributes.skinWeight_8.array,i.add(this.getVertexByWeight(r[4*e],a[4*e],Co)),i.add(this.getVertexByWeight(r[4*e+1],a[4*e+1],Co)),i.add(this.getVertexByWeight(r[4*e+2],a[4*e+2],Co)),i.add(this.getVertexByWeight(r[4*e+3],a[4*e+3],Co))),i.applyMatrix4(this.bindMatrixInverse),i}},getVertexByWeight:function(e,t,n){if(e=3?n.getInverse(this.bones[e].offsetMatrix):n.getInverse(this.bones[e].matrixWorld))}else this.bones[e].version>=3?n.getInverse(this.bones[e].offsetMatrix):n.getInverse(this.bones[e].matrixWorld);this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t0&&(Fo[0].instanceId=r,Fo[0].object=this,t.push(Fo[0]),Fo.length=0)},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e),0===e?(this.geometry.boundingBox.copy((new tn).copy(Po).applyMatrix4(t)),null==this.geometry.boundingSphere&&(this.geometry.boundingSphere=new an)):this.geometry.boundingBox.union((new tn).copy(Po).applyMatrix4(t)),this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere)},updateMorphTargets:function(){}}),Do.prototype=Object.create(On.prototype),Do.prototype.constructor=Do,Do.prototype.isLineBasicMaterial=!0,Do.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this};var Ro=new at,Oo=new at,No=new bt,zo=new dn,Qo=new an;function Go(e,t,n){1===n&&console.error("Line: parameter LinePieces no longer supported. Use LineSegments instead."),zt.call(this),this.type="Line",this.geometry=void 0!==e?e:new si,this.material=void 0!==t?t:new Do({color:16777215*Math.random()})}Go.prototype=Object.assign(Object.create(zt.prototype),{constructor:Go,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;io))c.applyMatrix4(this.matrixWorld),(x=e.ray.origin.distanceTo(c))e.far||t.push({distance:x,point:A.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this})}else for(p=0,m=d.length/3-1;po))c.applyMatrix4(this.matrixWorld),(x=e.ray.origin.distanceTo(c))e.far||t.push({distance:x,point:A.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this})}}else if(i.isGeometry){var y=i.vertices,w=y.length;for(p=0;po))c.applyMatrix4(this.matrixWorld),(x=e.ray.origin.distanceTo(c))e.far||t.push({distance:x,point:A.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Ho=new at,Vo=new at;function jo(e,t){Go.call(this,e,t),this.type="LineSegments"}function Wo(e,t){Go.call(this,e,t),this.type="LineLoop"}function Xo(e){On.call(this),this.type="PointsMaterial",this.color=new Fn(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}jo.prototype=Object.assign(Object.create(Go.prototype),{constructor:jo,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;ir.far)return;a.push({distance:A,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}function es(e,t,n,i,r,a,o,s,l,A,c,h){ht.call(this,null,a,o,s,l,A,i,r,c,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function ts(e,t,n,i,r,a,o,s,l){ht.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}function ns(e,t,n,i,r,a,o,s,l,A){if((A=void 0!==A?A:fe)!==fe&&A!==pe)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&A===fe&&(n=ee),void 0===n&&A===pe&&(n=se),ht.call(this,null,i,r,a,o,s,A,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:X,this.minFilter=void 0!==s?s:X,this.flipY=!1,this.generateMipmaps=!1}function is(e){si.call(this),this.type="WireframeGeometry";var t,n,i,r,a,o,s,l,A,c,h=[],u=[0,0],d={},f=["a","b","c"];if(e&&e.isGeometry){var p=e.faces;for(t=0,i=p.length;t=0?(e(v-A,m,u),d.subVectors(h,u)):(e(v+A,m,u),d.subVectors(u,h)),m-A>=0?(e(v,m-A,u),f.subVectors(h,u)):(e(v,m+A,u),f.subVectors(u,h)),c.crossVectors(d,f).normalize(),s.push(c.x,c.y,c.z),l.push(v,m)}}for(i=0;i.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new Yn(r,3)),this.setAttribute("normal",new Yn(r.slice(),3)),this.setAttribute("uv",new Yn(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function ls(e,t){Li.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new As(e,t)),this.mergeVertices()}function As(e,t){ss.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function cs(e,t){Li.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new hs(e,t)),this.mergeVertices()}function hs(e,t){ss.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function us(e,t){Li.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ds(e,t)),this.mergeVertices()}function ds(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];ss.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function fs(e,t){Li.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ps(e,t)),this.mergeVertices()}function ps(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];ss.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],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ms(e,t,n,i,r,a){Li.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==a&&console.warn("TubeGeometry: taper has been removed.");var o=new vs(e,t,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function vs(e,t,n,i,r){si.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,l=new at,A=new at,c=new tt,h=new at,u=[],d=[],f=[],p=[];function m(r){h=e.getPointAt(r/t,h);var o=a.normals[r],c=a.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,p=Math.sin(f),m=-Math.cos(f);A.x=m*o.x+p*c.x,A.y=m*o.y+p*c.y,A.z=m*o.z+p*c.z,A.normalize(),d.push(A.x,A.y,A.z),l.x=h.x+n*A.x,l.y=h.y+n*A.y,l.z=h.z+n*A.z,u.push(l.x,l.y,l.z)}}!function(){for(o=0;o0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e0&&console.error("Points.updateMorphTargets() does not support Geometry. Use BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),es.prototype=Object.create(ht.prototype),es.prototype.constructor=es,es.prototype.isCompressedTexture=!0,ts.prototype=Object.create(ht.prototype),ts.prototype.constructor=ts,ts.prototype.isCanvasTexture=!0,ns.prototype=Object.create(ht.prototype),ns.prototype.constructor=ns,ns.prototype.isDepthTexture=!0,is.prototype=Object.create(si.prototype),is.prototype.constructor=is,rs.prototype=Object.create(Li.prototype),rs.prototype.constructor=rs,as.prototype=Object.create(si.prototype),as.prototype.constructor=as,os.prototype=Object.create(Li.prototype),os.prototype.constructor=os,ss.prototype=Object.create(si.prototype),ss.prototype.constructor=ss,ls.prototype=Object.create(Li.prototype),ls.prototype.constructor=ls,As.prototype=Object.create(ss.prototype),As.prototype.constructor=As,cs.prototype=Object.create(Li.prototype),cs.prototype.constructor=cs,hs.prototype=Object.create(ss.prototype),hs.prototype.constructor=hs,us.prototype=Object.create(Li.prototype),us.prototype.constructor=us,ds.prototype=Object.create(ss.prototype),ds.prototype.constructor=ds,fs.prototype=Object.create(Li.prototype),fs.prototype.constructor=fs,ps.prototype=Object.create(ss.prototype),ps.prototype.constructor=ps,ms.prototype=Object.create(Li.prototype),ms.prototype.constructor=ms,vs.prototype=Object.create(si.prototype),vs.prototype.constructor=vs,vs.prototype.toJSON=function(){var e=si.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},gs.prototype=Object.create(Li.prototype),gs.prototype.constructor=gs,ys.prototype=Object.create(si.prototype),ys.prototype.constructor=ys,ws.prototype=Object.create(Li.prototype),ws.prototype.constructor=ws,xs.prototype=Object.create(si.prototype),xs.prototype.constructor=xs;var bs=function(e,t,n){n=n||2;var i,r,a,o,s,l,A,c=t&&t.length,h=c?t[0]*n:e.length,u=Ms(e,0,h,n,!0),d=[];if(!u||u.next===u.prev)return d;if(c&&(u=function(e,t,n,i){var r,a,o,s=[];for(r=0,a=t.length;r80*n){i=a=e[0],r=o=e[1];for(var f=n;fa&&(a=s),l>o&&(o=l);A=0!==(A=Math.max(a-i,o-r))?1/A:0}return Bs(u,d,n,i,r,A),d};function Ms(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a0)for(a=t;a=t;a-=i)o=Qs(a,e[a],e[a+1],o);return o&&Rs(o,o.next)&&(Gs(o),o=o.next),o}function Cs(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!Rs(i,i.next)&&0!==Ds(i.prev,i,i.next))i=i.next;else{if(Gs(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function Bs(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=Fs(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,l,A=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,A*=2}while(o>1)}(r)}(e,i,r,a);for(var s,l,A=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?Ss(e,i,r,a):Es(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),Gs(e),e=l.next,A=l.next;else if((e=l)===A){o?1===o?Bs(e=Ts(e,t,n),t,n,i,r,a,2):2===o&&_s(e,t,n,i,r,a):Bs(Cs(e),t,n,i,r,a,1);break}}}function Es(e){var t=e.prev,n=e,i=e.next;if(Ds(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(Ps(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Ds(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Ss(e,t,n,i){var r=e.prev,a=e,o=e.next;if(Ds(r,a,o)>=0)return!1;for(var s=r.xa.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,c=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,h=Fs(s,l,t,n,i),u=Fs(A,c,t,n,i),d=e.prevZ,f=e.nextZ;d&&d.z>=h&&f&&f.z<=u;){if(d!==e.prev&&d!==e.next&&Ps(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Ds(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&Ps(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ds(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=h;){if(d!==e.prev&&d!==e.next&&Ps(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Ds(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=u;){if(f!==e.prev&&f!==e.next&&Ps(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ds(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Ts(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!Rs(r,a)&&Os(r,i,i.next,a)&&Ns(r,a)&&Ns(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),Gs(i),Gs(i.next),i=e=a),i=i.next}while(i!==e);return i}function _s(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Us(o,s)){var l=zs(o,s);return o=Cs(o,o.next),l=Cs(l,l.next),Bs(o,t,n,i,r,a),void Bs(l,t,n,i,r,a)}s=s.next}o=o.next}while(o!==e)}function Is(e,t){return e.x-t.x}function Ls(e,t){if(t=function(e,t){var n,i=t,r=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>o){if(o=s,s===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x=i.x&&i.x>=c&&r!==i.x&&Ps(an.x)&&Ns(i,e)&&(n=i,u=l),i=i.next;return n}(e,t),t){var n=zs(t,e);Cs(n,n.next)}}function Fs(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ks(e){var t=e,n=e;do{(t.x=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function Us(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Os(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&Ns(e,t)&&Ns(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)}function Ds(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Rs(e,t){return e.x===t.x&&e.y===t.y}function Os(e,t,n,i){return!!(Rs(e,n)&&Rs(t,i)||Rs(e,i)&&Rs(n,t))||Ds(e,t,n)>0!=Ds(e,t,i)>0&&Ds(n,i,e)>0!=Ds(n,i,t)>0}function Ns(e,t){return Ds(e.prev,e,e.next)<0?Ds(e,t,e.next)>=0&&Ds(e,e.prev,t)>=0:Ds(e,t,e.prev)<0||Ds(e,e.next,t)<0}function zs(e,t){var n=new Hs(e.i,e.x,e.y),i=new Hs(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Qs(e,t,n,i){var r=new Hs(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Gs(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Hs(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Vs={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r2&&e[t-1].equals(e[0])&&e.pop()}function Ws(e,t){for(var n=0;nNumber.EPSILON){var u=Math.sqrt(c),d=Math.sqrt(l*l+A*A),f=t.x-s/u,p=t.y+o/u,m=((n.x-A/d-f)*A-(n.y+l/d-p)*l)/(o*A-s*l),v=(i=f+o*m-e.x)*i+(r=p+s*m-e.y)*r;if(v<=2)return new tt(i,r);a=Math.sqrt(v/2)}else{var g=!1;o>Number.EPSILON?l>Number.EPSILON&&(g=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(g=!0):Math.sign(s)===Math.sign(A)&&(g=!0),g?(i=-s,r=o,a=Math.sqrt(c)):(i=o,r=s,a=Math.sqrt(c/2))}return new tt(i/a,r/a)}for(var z=[],Q=0,G=_.length,H=G-1,V=Q+1;Q=0;L--){for(k=L/d,P=c*Math.cos(k*Math.PI/2),F=h*Math.sin(k*Math.PI/2)+u,Q=0,G=_.length;Q=0;){n=Q,(i=Q-1)<0&&(i=e.length-1);var r=0,a=s+2*d;for(r=0;r0)&&f.push(b,M,B),(l!==n-1||A0&&v(!0),t>0&&v(!1)),this.setIndex(A),this.setAttribute("position",new Yn(c,3)),this.setAttribute("normal",new Yn(h,3)),this.setAttribute("uv",new Yn(u,2))}function hl(e,t,n,i,r,a,o){Al.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function ul(e,t,n,i,r,a,o){cl.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function dl(e,t,n,i){Li.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new fl(e,t,n,i)),this.mergeVertices()}function fl(e,t,n,i){si.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,a,o=[],s=[],l=[],A=[],c=new at,h=new tt;for(s.push(0,0,0),l.push(0,0,1),A.push(.5,.5),a=0,r=3;a<=t;a++,r+=3){var u=n+a/t*i;c.x=e*Math.cos(u),c.y=e*Math.sin(u),s.push(c.x,c.y,c.z),l.push(0,0,1),h.x=(s[r]/e+1)/2,h.y=(s[r+1]/e+1)/2,A.push(h.x,h.y)}for(r=1;r<=t;r++)o.push(r,r+1,0);this.setIndex(o),this.setAttribute("position",new Yn(s,3)),this.setAttribute("normal",new Yn(l,3)),this.setAttribute("uv",new Yn(A,2))}Js.prototype=Object.create(Li.prototype),Js.prototype.constructor=Js,qs.prototype=Object.create(Ys.prototype),qs.prototype.constructor=qs,$s.prototype=Object.create(Li.prototype),$s.prototype.constructor=$s,el.prototype=Object.create(si.prototype),el.prototype.constructor=el,tl.prototype=Object.create(Li.prototype),tl.prototype.constructor=tl,nl.prototype=Object.create(si.prototype),nl.prototype.constructor=nl,il.prototype=Object.create(Li.prototype),il.prototype.constructor=il,rl.prototype=Object.create(si.prototype),rl.prototype.constructor=rl,al.prototype=Object.create(Li.prototype),al.prototype.constructor=al,al.prototype.toJSON=function(){var e=Li.prototype.toJSON.call(this);return sl(this.parameters.shapes,e)},ol.prototype=Object.create(si.prototype),ol.prototype.constructor=ol,ol.prototype.toJSON=function(){var e=si.prototype.toJSON.call(this);return sl(this.parameters.shapes,e)},ll.prototype=Object.create(si.prototype),ll.prototype.constructor=ll,Al.prototype=Object.create(Li.prototype),Al.prototype.constructor=Al,cl.prototype=Object.create(si.prototype),cl.prototype.constructor=cl,hl.prototype=Object.create(Al.prototype),hl.prototype.constructor=hl,ul.prototype=Object.create(cl.prototype),ul.prototype.constructor=ul,dl.prototype=Object.create(Li.prototype),dl.prototype.constructor=dl,fl.prototype=Object.create(si.prototype),fl.prototype.constructor=fl;var pl=Object.freeze({__proto__:null,WireframeGeometry:is,ParametricGeometry:rs,ParametricBufferGeometry:as,TetrahedronGeometry:ls,TetrahedronBufferGeometry:As,OctahedronGeometry:cs,OctahedronBufferGeometry:hs,IcosahedronGeometry:us,IcosahedronBufferGeometry:ds,DodecahedronGeometry:fs,DodecahedronBufferGeometry:ps,PolyhedronGeometry:os,PolyhedronBufferGeometry:ss,TubeGeometry:ms,TubeBufferGeometry:vs,TorusKnotGeometry:gs,TorusKnotBufferGeometry:ys,TorusGeometry:ws,TorusBufferGeometry:xs,TextGeometry:Js,TextBufferGeometry:qs,SphereGeometry:$s,SphereBufferGeometry:el,RingGeometry:tl,RingBufferGeometry:nl,PlaneGeometry:qi,PlaneBufferGeometry:$i,LatheGeometry:il,LatheBufferGeometry:rl,ShapeGeometry:al,ShapeBufferGeometry:ol,ExtrudeGeometry:Xs,ExtrudeBufferGeometry:Ys,EdgesGeometry:ll,ConeGeometry:hl,ConeBufferGeometry:ul,CylinderGeometry:Al,CylinderBufferGeometry:cl,CircleGeometry:dl,CircleBufferGeometry:fl,BoxGeometry:Fi,BoxBufferGeometry:ki});function ml(e){On.call(this),this.type="ShadowMaterial",this.color=new Fn(0),this.transparent=!0,this.setValues(e)}function vl(e){Ri.call(this,e),this.type="RawShaderMaterial"}function gl(e){On.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Fn(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new tt(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.setValues(e)}function yl(e){gl.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearcoat=0,this.clearcoatRoughness=0,this.sheen=null,this.clearcoatNormalScale=new tt(1,1),this.clearcoatNormalMap=null,this.transparency=0,this.setValues(e)}function wl(e){On.call(this),this.type="MeshPhongMaterial",this.color=new Fn(16777215),this.specular=new Fn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new tt(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(e)}function xl(e){wl.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function bl(e){On.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new tt(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(e)}function Ml(e){On.call(this),this.type="MeshLambertMaterial",this.color=new Fn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fn(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(e)}function Cl(e){On.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Fn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new tt(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(e)}function Bl(e){Do.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function El(e){On.call(this),this.defines={STANDARD:""},this.type="AMRTBasicMaterial",this.color=new Fn(16777215),this.albedo=null,this.albedoUV=0,this.normalMap=null,this.normalScale=1,this.normalMap2=null,this.normalScale2=1,this.metallicMap=null,this.metallic=0,this.roughnessMap=null,this.smoothness=0,this.aoMap=null,this.aoScale=1,this.aoUV=0,this.emissive=new Fn(0),this.emissiveMap=null,this.emissiveUV=0,this.reflectMap=null,this.reflectIntensity=0,this.cutout=.5,this.reflectivity=1,this.transparency=0,this.opacity=1,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.vertexTangents=!0,this.normalMapType=0,this.envRotateY=0,this.envYMatrix=new lt,this.reflectRotateY=0,this.reflecYMatrix=new lt,this.dissolveMap=null,this.dissolveRatio=0,this.dissolveColor=new Fn(16774921),this.ssrTextureMatrix=new bt,this.ssrTexture=null,this.maxDistance=10,this.ssrOpacity=1,this.fresnelCoe=0,this.depthTexture=null,this.planeOffset=0,this.virtualCameraNear=.1,this.virtualCameraFar=1e3,this.virtualCameraMatrixWorld=new bt,this.virtualCameraProjectionMatrix=new bt,this.virtualCameraProjectionMatrixInverse=new bt,this.resolution=new tt,this.setValues(e),this.__defineSetter__("envRotateY",(function(e){this.envYMatrix=(new lt).rotateY(e)})),this.__defineSetter__("reflectRotateY",(function(e){this.reflecYMatrix=(new lt).rotateY(e)}))}function Sl(e){On.call(this),this.type="AMRTShadowMaterial",this.color=new Fn(0),this.shadowPlane=new vn(new at(0,-1,0),0),this.lightDirection=new at(-1,-1,-1),this.shadowLength=1,this.center=new at(0,0,0),this.shadowStrength=1,this.skinning=!1,this.morphTargets=!1,this.transparent=!0,this.depthWrite=!1,this.stencilWrite=!0,this.stencilRef=0,this.stencilFunc=514,this.stencilFail=We,this.stencilZFail=We,this.stencilZPass=7682,this.setValues(e)}ml.prototype=Object.create(On.prototype),ml.prototype.constructor=ml,ml.prototype.isShadowMaterial=!0,ml.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.color.copy(e.color),this},vl.prototype=Object.create(Ri.prototype),vl.prototype.constructor=vl,vl.prototype.isRawShaderMaterial=!0,gl.prototype=Object.create(On.prototype),gl.prototype.constructor=gl,gl.prototype.isMeshStandardMaterial=!0,gl.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},yl.prototype=Object.create(gl.prototype),yl.prototype.constructor=yl,yl.prototype.isMeshPhysicalMaterial=!0,yl.prototype.copy=function(e){return gl.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearcoat=e.clearcoat,this.clearcoatRoughness=e.clearcoatRoughness,e.sheen?this.sheen=(this.sheen||new Fn).copy(e.sheen):this.sheen=null,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.transparency=e.transparency,this},wl.prototype=Object.create(On.prototype),wl.prototype.constructor=wl,wl.prototype.isMeshPhongMaterial=!0,wl.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},xl.prototype=Object.create(wl.prototype),xl.prototype.constructor=xl,xl.prototype.isMeshToonMaterial=!0,xl.prototype.copy=function(e){return wl.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},bl.prototype=Object.create(On.prototype),bl.prototype.constructor=bl,bl.prototype.isMeshNormalMaterial=!0,bl.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Ml.prototype=Object.create(On.prototype),Ml.prototype.constructor=Ml,Ml.prototype.isMeshLambertMaterial=!0,Ml.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Cl.prototype=Object.create(On.prototype),Cl.prototype.constructor=Cl,Cl.prototype.isMeshMatcapMaterial=!0,Cl.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Bl.prototype=Object.create(Do.prototype),Bl.prototype.constructor=Bl,Bl.prototype.isLineDashedMaterial=!0,Bl.prototype.copy=function(e){return Do.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},El.prototype=Object.create(On.prototype),El.prototype.constructor=El,El.prototype.isAMRTBasicMaterial=!0,El.prototype.clone=function(){return(new this.constructor).copy(this)},El.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.albedo=e.albedo,this.albedoUV=e.albedoUV,this.normalMap=e.normalMap,this.normalScale=e.normalScale,this.normalMap2=e.normalMap2,this.normalScale2=e.normalScale2,this.metallicMap=e.metallicMap,this.metallic=e.metallic,this.roughnessMap=e.roughnessMap,this.smoothness=e.smoothness,this.aoMap=e.aoMap,this.aoScale=e.aoScale,this.aoUV=e.aoUV,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveUV=e.emissiveUV,this.reflectMap=e.reflectMap,this.reflectIntensity=e.reflectIntensity,this.cutout=e.cutout,this.reflectivity=e.reflectivity,this.transparency=e.transparency,this.opacity=e.opacity,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.vertexTangents=e.vertexTangents,this.normalMapType=e.normalMapType,this.envRotateY=e.envRotateY,this.envYMatrix=e.envYMatrix,this.reflectRotateY=e.reflectRotateY,this.reflecYMatrix=e.reflecYMatrix,this},El.prototype.dispose=function(){On.prototype.dispose.call(this),this.albedo&&this.albedo.dispose(),this.metallicMap&&this.metallicMap.dispose(),this.roughnessMap&&this.roughnessMap.dispose(),this.aoMap&&this.aoMap.dispose(),this.emissiveMap&&this.emissiveMap.dispose(),this.reflectMap&&this.reflectMap.dispose(),this.envMap&&this.envMap.dispose()},Object.defineProperty(El.prototype,"alphaMap",{get(){return this._alphaMap||null},set(e){this._alphaMap=e,e&&(this.transparent=!0)}}),Sl.prototype=Object.create(On.prototype),Sl.prototype.constructor=Sl,Sl.prototype.isAMRTShadowMaterial=!0,Sl.prototype.clone=function(){return(new this.constructor).copy(this)},Sl.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.color.copy(e.color),this.shadowPlane=e.shadowPlane.clone(),this.lightDirection.copy(e.lightDirection),this.shadowLength=e.shadowLength,this.shadowStrength=e.shadowStrength,this.center.copy(e.center),this};var Tl=Object.freeze({__proto__:null,ShadowMaterial:ml,SpriteMaterial:ro,RawShaderMaterial:vl,ShaderMaterial:Ri,PointsMaterial:Xo,MeshPhysicalMaterial:yl,MeshStandardMaterial:gl,MeshPhongMaterial:wl,MeshToonMaterial:xl,MeshNormalMaterial:bl,MeshLambertMaterial:Ml,MeshDepthMaterial:Ra,MeshDistanceMaterial:Oa,MeshBasicMaterial:Nn,MeshMatcapMaterial:Cl,LineDashedMaterial:Bl,LineBasicMaterial:Do,AMRTBasicMaterial:El,AMRTShadowMaterial:Sl,Material:On}),_l={arraySlice:function(e,t,n){return _l.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}},subclip:function(e,t,n,i,r){r=r||30;var a=e.clone();a.name=t;for(var o=[],s=0;s=i)){c.push(l.times[u]);for(var f=0;fa.tracks[s].times[0]&&(p=a.tracks[s].times[0]);for(s=0;s=r)break e;var s=t[1];e=(r=t[--n-1]))break t}a=n,n=0}for(;n>>1;et;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=_l.arraySlice(n,r,a),this.values=_l.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&_l.isTypedArray(i)){o=0;for(var l=i.length;o!==l;++o){var A=i[o];if(isNaN(A)){console.error("KeyframeTrack: Value is not a valid number.",this,o,A),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=this.getInterpolation()===Pe,r=1,a=e.length-1,o=1;o0){e[r]=e[a];for(f=a*n,p=r*n,u=0;u!==n;++u)t[p+u]=t[f+u];++r}return r!==e.length&&(this.times=_l.arraySlice(e,0,r),this.values=_l.arraySlice(t,0,r*n)),this},clone:function(){var e=_l.arraySlice(this.times,0),t=_l.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),Ul.prototype=Object.assign(Object.create(Pl.prototype),{constructor:Ul,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Fe,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Dl.prototype=Object.assign(Object.create(Pl.prototype),{constructor:Dl,ValueTypeName:"color"}),Rl.prototype=Object.assign(Object.create(Pl.prototype),{constructor:Rl,ValueTypeName:"number"}),Ol.prototype=Object.assign(Object.create(Il.prototype),{constructor:Ol,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(n-t)/(i-t),A=s+o;s!==A;s+=4)nt.slerpFlat(r,0,a,s-o,a,s,l);return r}}),Nl.prototype=Object.assign(Object.create(Pl.prototype),{constructor:Nl,ValueTypeName:"quaternion",DefaultInterpolation:ke,InterpolantFactoryMethodLinear:function(e){return new Ol(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),zl.prototype=Object.assign(Object.create(Pl.prototype),{constructor:zl,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Fe,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ql.prototype=Object.assign(Object.create(Pl.prototype),{constructor:Ql,ValueTypeName:"vector"}),Object.assign(Gl,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(Hl(n[r]).scale(i));return new Gl(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},r=0,a=n.length;r!==a;++r)t.push(Pl.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o1){var A=i[h=l[1]];A||(i[h]=A=[]),A.push(s)}}var c=[];for(var h in i)c.push(Gl.CreateFromMorphTargetSequence(h,i[h],t,n));return c},parseAnimation:function(e,t){if(!e)return console.error("AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];_l.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],l=0;l-1&&(e=e.substring(0,e.indexOf("?time="))),this.files[e]=t)},get:function(e){if(!1!==this.enabled)return e.indexOf("?time=")>-1&&(e=e.substring(0,e.indexOf("?time="))),this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Yl={};function Kl(e){Wl.call(this,e)}function Zl(e){Wl.call(this,e)}function Jl(e){Wl.call(this,e)}function ql(e){Wl.call(this,e)}function $l(e){Wl.call(this,e)}function eA(e){Wl.call(this,e)}function tA(e){Wl.call(this,e)}function nA(){this.type="Curve",this.arcLengthDivisions=200}function iA(e,t,n,i,r,a,o,s){nA.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function rA(e,t,n,i,r,a){iA.call(this,e,t,n,n,i,r,a),this.type="ArcCurve"}function aA(){var e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){var l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,A=(n-t)/o-(i-t)/(o+s)+(i-n)/s;r(t,n,l*=o,A*=o)},calc:function(r){var a=r*r;return e+t*r+n*a+i*(a*r)}}}Kl.prototype=Object.assign(Object.create(Wl.prototype),{constructor:Kl,load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this;if(void 0===Yl[e]){var a=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(a){var o=a[1],s=!!a[2],l=a[3];l=decodeURIComponent(l),s&&(l=atob(l));try{var A,c=(this.responseType||"").toLowerCase();switch(c){case"arraybuffer":case"blob":for(var h=new Uint8Array(l.length),u=0;u0||0===e.search(/^data\:image\/jpeg/);r.format=i?Ae:ce,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}),Object.assign(nA.prototype,{getPoint:function(){return console.warn("Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),a=0;for(i.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(r),i.push(a),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var A=i[r];return(r+(n-A)/(i[r+1]-A))/(a-1)},getTangent:function(e){var t=1e-4,n=e-t,i=e+t;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n);return this.getPoint(i).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,r,a=new at,o=[],s=[],l=[],A=new at,c=new bt;for(n=0;n<=e;n++)i=n/e,o[n]=this.getTangentAt(i),o[n].normalize();s[0]=new at,l[0]=new at;var h=Number.MAX_VALUE,u=Math.abs(o[0].x),d=Math.abs(o[0].y),f=Math.abs(o[0].z);for(u<=h&&(h=u,a.set(1,0,0)),d<=h&&(h=d,a.set(0,1,0)),f<=h&&a.set(0,0,1),A.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],A),l[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),A.crossVectors(o[n-1],o[n]),A.length()>Number.EPSILON&&(A.normalize(),r=Math.acos(et.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(c.makeRotationAxis(A,r))),l[n].crossVectors(o[n],s[n]);if(!0===t)for(r=Math.acos(et.clamp(s[0].dot(s[e]),-1,1)),r/=e,o[0].dot(A.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(c.makeRotationAxis(o[n],r*n)),l[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),iA.prototype=Object.create(nA.prototype),iA.prototype.constructor=iA,iA.prototype.isEllipseCurve=!0,iA.prototype.getPoint=function(e,t){for(var n=t||new tt,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(c)/l)+1)*l:0===h&&c===l-1&&(c=l-2,h=1),this.closed||c>0?n=s[(c-1)%l]:(oA.subVectors(s[0],s[1]).add(s[0]),n=oA),i=s[c%l],r=s[(c+1)%l],this.closed||c+2i.length-2?i.length-1:a+1],c=i[a>i.length-3?i.length-1:a+2];return n.set(hA(o,s.x,l.x,A.x,c.x),hA(o,s.y,l.y,A.y,c.y)),n},wA.prototype.copy=function(e){nA.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var r=n[i]-t,a=this.curves[i],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.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 e=[],t=0,n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){nA.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t0){var A=l.getPoint(0);A.equals(this.currentPoint)||this.lineTo(A.x,A.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this},copy:function(e){return bA.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=bA.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return bA.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),CA.prototype=Object.assign(Object.create(MA.prototype),{constructor:CA,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n0){var a=new $l(new Vl(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o0?new Bo(o,s):new Ei(o,s);break;case"InstancedMesh":o=r(e.geometry),s=a(e.material);var l=e.count,A=e.instanceMatrix;(i=new Uo(o,s,l)).instanceMatrix=new zn(new Float32Array(A.array),16);break;case"LOD":i=new bo;break;case"Line":i=new Go(r(e.geometry),a(e.material),e.mode);break;case"LineLoop":i=new Wo(r(e.geometry),a(e.material));break;case"LineSegments":i=new jo(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":i=new qo(r(e.geometry),a(e.material));break;case"Sprite":i=new go(a(e.material));break;case"Group":i=new ja;break;default:i=new zt}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.drawMode&&i.setDrawMode(e.drawMode),void 0!==e.children)for(var c=e.children,h=0;hNumber.EPSILON){if(A<0&&(o=t[a],l=-l,s=t[r],A=-A),e.ys.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var c=A*(e.x-o.x)-l*(e.y-o.y);if(0===c)return!0;if(c<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var r=Vs.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,l,A=[];if(1===a.length)return s=a[0],(l=new CA).curves=s.curves,A.push(l),A;var c=!r(a[0].getPoints());c=e?!c:c;var h,u,d=[],f=[],p=[],m=0;f[m]=void 0,p[m]=[];for(var v=0,g=a.length;v1){for(var y=!1,w=[],x=0,b=f.length;x0&&(y||(p=d))}v=0;for(var T=f.length;v0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){nt.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}}});var bc="\\[\\]\\.:\\/",Mc=new RegExp("[\\[\\]\\.:\\/]","g"),Cc="[^\\[\\]\\.:\\/]",Bc="[^"+bc.replace("\\.","")+"]",Ec=/((?:WC+[\/:])*)/.source.replace("WC",Cc),Sc=/(WCOD+)?/.source.replace("WCOD",Bc),Tc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Cc),_c=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Cc),Ic=new RegExp("^"+Ec+Sc+Tc+_c+"$"),Lc=["material","materials","bones"];function Fc(e,t,n){var i=n||kc.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function kc(e,t,n){this.path=t,this.parsedPath=n||kc.parseTrackName(t),this.node=kc.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Pc(){this.uuid=et.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function Uc(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var i=t.tracks,r=i.length,a=new Array(r),o={endingStart:Ue,endingEnd:Ue},s=0;s!==r;++s){var l=i[s].createInterpolant(null);a[s]=l,l.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Le,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 Dc(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Rc(e){"string"==typeof e&&(console.warn("Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Oc(e,t,n){no.call(this,e,t),this.meshPerAttribute=n||1}function Nc(e,t,n,i){this.ray=new dn(e,t),this.near=n||0,this.far=i||1/0,this.camera=null,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function zc(e,t){return e.distance-t.distance}function Qc(e,t,n,i){if(!1!==e.visible&&!e.locked&&(e.raycast(t,n),!0===i))for(var r=e.children,a=0,o=r.length;a=t){var c=t++,h=e[c];n[h.uuid]=A,e[A]=h,n[l]=c,e[c]=s;for(var u=0,d=r;u!==d;++u){var f=i[u],p=f[c],m=f[A];f[A]=p,f[c]=m}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],A=l.uuid,c=i[A];if(void 0!==c)if(delete i[A],c0)for(var l=this._interpolants,A=this._propertyBindings,c=0,h=l.length;c!==h;++c)l[c].evaluate(o),A[c].accumulate(i,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,a=2202===i;if(0===e)return-1===r?t:a&&1==(1&r)?n-t:t;if(i===Ie){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&r))return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=De,i.endingEnd=De):(i.endingStart=e?this.zeroSlopeAtStart?De:Ue:Re,i.endingEnd=t?this.zeroSlopeAtEnd?De:Ue:Re)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}),Dc.prototype=Object.assign(Object.create(Je.prototype),{constructor:Dc,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,A=l[s];void 0===A&&(A={},l[s]=A);for(var c=0;c!==r;++c){var h=i[c],u=h.name,d=A[u];if(void 0!==d)a[c]=d;else{if(void 0!==(d=a[c])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,u));continue}var f=t&&t._propertyBindings[c].binding.parsedPath;++(d=new xc(kc.create(n,u,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(d,s,u),a[c]=d}o[c].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&tthis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(t=new tt),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return void 0===t&&(t=new tt),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Vc.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Wc=new at,Xc=new at;function Yc(e,t){this.start=void 0!==e?e:new at,this.end=void 0!==t?t:new at}function Kc(e){zt.call(this),this.material=e,this.render=function(){}}Object.assign(Yc.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("Line3: .getCenter() target is now required"),e=new at),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("Line3: .delta() target is now required"),e=new at),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("Line3: .at() target is now required"),t=new at),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Wc.subVectors(e,this.start),Xc.subVectors(this.end,this.start);var n=Xc.dot(Xc),i=Xc.dot(Wc)/n;return t&&(i=et.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("Line3: .closestPointToPoint() target is now required"),n=new at),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Kc.prototype=Object.create(zt.prototype),Kc.prototype.constructor=Kc,Kc.prototype.isImmediateRenderObject=!0;var Zc=new at,Jc=new at,qc=new lt,$c=["a","b","c"];function eh(e,t,n,i){this.object=e,this.size=void 0!==t?t:1;var r=void 0!==n?n:16711680,a=void 0!==i?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var l=new si,A=new Yn(2*o*3,3);l.setAttribute("position",A),jo.call(this,l,new Do({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}eh.prototype=Object.create(jo.prototype),eh.prototype.constructor=eh,eh.prototype.update=function(){this.object.updateMatrixWorld(!0),qc.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,t=this.geometry.attributes.position,n=this.object.geometry;if(n&&n.isGeometry)for(var i=n.vertices,r=n.faces,a=0,o=0,s=r.length;o1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}},Ah.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()};var ch=new at,hh=new Fn,uh=new Fn;function dh(e,t,n){zt.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var i=new hs(t);i.rotateY(.5*Math.PI),this.material=new Nn({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=2);var r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.setAttribute("color",new zn(a,3)),this.add(new Ei(i,this.material)),this.update()}function fh(e,t){this.lightProbe=e,this.size=t;var n={GAMMA_OUTPUT:""},i=new Ri({defines:n,uniforms:{sh:{value:this.lightProbe.sh.coefficients},intensity:{value:this.lightProbe.intensity}},vertexShader:["varying vec3 vNormal;","void main() {","\tvNormal = normalize( normalMatrix * normal );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI 0.318309886","vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {","\t// matrix is assumed to be orthogonal","\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );","}","vec3 linearToOutput( in vec3 a ) {","\t#ifdef GAMMA_OUTPUT","\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );","\t#else","\t\treturn a;","\t#endif","}","// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf","vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {","\t// normal is assumed to have unit length","\tfloat x = normal.x, y = normal.y, z = normal.z;","\t// band 0","\tvec3 result = shCoefficients[ 0 ] * 0.886227;","\t// band 1","\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;","\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;","\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;","\t// band 2","\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;","\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;","\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );","\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;","\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );","\treturn result;","}","uniform vec3 sh[ 9 ]; // sh coefficients","uniform float intensity; // light probe intensity","varying vec3 vNormal;","void main() {","\tvec3 normal = normalize( vNormal );","\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );","\tvec3 irradiance = shGetIrradianceAt( worldNormal, sh );","\tvec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;","\toutgoingLight = linearToOutput( outgoingLight );","\tgl_FragColor = vec4( outgoingLight, 1.0 );","}"].join("\n")}),r=new el(1,32,16);Ei.call(this,r,i),this.onBeforeRender()}function ph(e,t,n,i){e=e||10,t=t||10,n=new Fn(void 0!==n?n:4473924),i=new Fn(void 0!==i?i:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],l=[],A=0,c=0,h=-o;A<=t;A++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var u=A===r?n:i;u.toArray(l,c),c+=3,u.toArray(l,c),c+=3,u.toArray(l,c),c+=3,u.toArray(l,c),c+=3}var d=new si;d.setAttribute("position",new Yn(s,3)),d.setAttribute("color",new Yn(l,3));var f=new Do({vertexColors:2});jo.call(this,d,f)}function mh(e,t,n,i,r,a){e=e||10,t=t||16,n=n||8,i=i||64,r=new Fn(void 0!==r?r:4473924),a=new Fn(void 0!==a?a:8947848);var o,s,l,A,c,h,u,d=[],f=[];for(A=0;A<=t;A++)l=A/t*(2*Math.PI),o=Math.sin(l)*e,s=Math.cos(l)*e,d.push(0,0,0),d.push(o,0,s),u=1&A?r:a,f.push(u.r,u.g,u.b),f.push(u.r,u.g,u.b);for(A=0;A<=n;A++)for(u=1&A?r:a,h=e-e/n*A,c=0;c.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Dh.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Dh,t)}},Rh.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},Rh.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},Rh.prototype.copy=function(e){return zt.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Rh.prototype.clone=function(){return(new this.constructor).copy(this)},Oh.prototype=Object.create(jo.prototype),Oh.prototype.constructor=Oh;var Nh=function(e){ql.call(this,e),this.type=$};Nh.prototype=Object.assign(Object.create(ql.prototype),{constructor:Nh,parse:function(e){var t=function(e,t){switch(e){case 1:console.error("RGBELoader Read Error: "+(t||""));break;case 2:console.error("RGBELoader Write Error: "+(t||""));break;case 3:console.error("RGBELoader Bad File Format: "+(t||""));break;default:console.error("RGBELoader: Error: "+(t||""))}return-1},n=function(e,t,n){t=t||1024;for(var i=e.pos,r=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));0>(r=s.indexOf("\n"))&&a>16&32768,a=i>>12&2047,o=i>>23&255;return o<103?r:o>142?(r|=31744,r|=(255==o?0:1)&&8388607&i):o<113?r|=((a|=2048)>>114-o)+(a>>113-o&1):(r|=o-112<<10|a>>1,r+=1&a)}return function(e,t,i,r){var a=e[t+3],o=Math.pow(2,a-128)/255;i[r+0]=n(e[t+0]*o),i[r+1]=n(e[t+1]*o),i[r+2]=n(e[t+2]*o)}}(),a=new Uint8Array(e);a.pos=0;var o=function(e){var i,r,a=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,A={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(i=n(e)))return t(1,"no header found");if(!(r=i.match(/^#\?(\S+)$/)))return t(3,"bad initial token");for(A.valid|=1,A.programtype=r[1],A.string+=i+"\n";!1!==(i=n(e));)if(A.string+=i+"\n","#"!==i.charAt(0)){if((r=i.match(a))&&(A.gamma=parseFloat(r[1],10)),(r=i.match(o))&&(A.exposure=parseFloat(r[1],10)),(r=i.match(s))&&(A.valid|=2,A.format=r[1]),(r=i.match(l))&&(A.valid|=4,A.height=parseInt(r[1],10),A.width=parseInt(r[2],10)),2&A.valid&&4&A.valid)break}else A.comments+=i+"\n";return 2&A.valid?4&A.valid?A:t(3,"missing image size specifier"):t(3,"missing format specifier")}(a);if(-1!==o){var s=o.width,l=o.height,A=function(e,n,i){var r,a,o,s,l,A,c,h,u,d,f,p,m,v=n,g=i;if(v<8||v>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(v!==(e[2]<<8|e[3]))return t(3,"wrong scanline width");if(!(r=new Uint8Array(4*n*i))||!r.length)return t(4,"unable to allocate buffer space");for(a=0,o=0,h=4*v,m=new Uint8Array(4),A=new Uint8Array(h);g>0&&oe.byteLength)return t(1);if(m[0]=e[o++],m[1]=e[o++],m[2]=e[o++],m[3]=e[o++],2!=m[0]||2!=m[1]||(m[2]<<8|m[3])!=v)return t(3,"bad rgbe scanline format");for(c=0;c128)&&(s-=128),0===s||c+s>h)return t(3,"bad scanline data");if(p)for(l=e[o++],u=0;u>8&255]+zh[e>>16&255]+zh[e>>24&255]+"-"+zh[255&t]+zh[t>>8&255]+"-"+zh[t>>16&15|64]+zh[t>>24&255]+"-"+zh[63&n|128]+zh[n>>8&255]+"-"+zh[n>>16&255]+zh[n>>24&255]+zh[255&i]+zh[i>>8&255]+zh[i>>16&255]+zh[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){return void 0!==e&&(Gh=e%2147483647),((Gh=16807*Gh%2147483647)-1)/2147483646},degToRad:function(e){return e*Hh.DEG2RAD},radToDeg:function(e){return e*Hh.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),A=a((t+i)/2),c=o((t+i)/2),h=a((t-i)/2),u=o((t-i)/2),d=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*c,l*h,l*u,s*A);break;case"YZY":e.set(l*u,s*c,l*h,s*A);break;case"ZXZ":e.set(l*h,l*u,s*c,s*A);break;case"XZX":e.set(s*c,l*f,l*d,s*A);break;case"YXY":e.set(l*d,s*c,l*f,s*A);break;case"ZYZ":e.set(l*f,l*d,s*c,s*A);break;default:console.warn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};function Vh(e){return void 0===e&&(e=[]),console.warn("MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function jh(e){console.warn("ClosedSplineCurve3 has been deprecated. Use CatmullRomCurve3 instead."),cA.call(this,e),this.type="catmullrom",this.closed=!0}function Wh(e){console.warn("SplineCurve3 has been deprecated. Use CatmullRomCurve3 instead."),cA.call(this,e),this.type="catmullrom"}function Xh(e){console.warn("Spline has been removed. Use CatmullRomCurve3 instead."),cA.call(this,e),this.type="catmullrom"}nA.create=function(e,t){return console.log("Curve.create() has been deprecated"),e.prototype=Object.create(nA.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(bA.prototype,{createPointsGeometry:function(e){console.warn("CurvePath: .createPointsGeometry() has been removed. Use new Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("CurvePath: .createSpacedPointsGeometry() has been removed. Use new Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("CurvePath: .createGeometry() has been removed. Use new Geometry().setFromPoints( points ) instead.");for(var t=new Li,n=0,i=e.length;nNumber.EPSILON){var u=Math.sqrt(c),d=Math.sqrt(l*l+A*A),f=t.x-s/u,p=t.y+o/u,m=((n.x-A/d-f)*A-(n.y+l/d-p)*l)/(o*A-s*l),v=(i=f+o*m-e.x)*i+(r=p+s*m-e.y)*r;if(v<=2)return new tt(i,r);a=Math.sqrt(v/2)}else{var g=!1;o>Number.EPSILON?l>Number.EPSILON&&(g=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(g=!0):Math.sign(s)===Math.sign(A)&&(g=!0),g?(i=-s,r=o,a=Math.sqrt(c)):(i=o,r=s,a=Math.sqrt(c/2))}return new tt(i/a,r/a)}for(var N=[],z=0,Q=_.length,G=Q-1,H=z+1;z=0;L--){for(k=L/d,P=c*Math.cos(k*Math.PI/2),F=h*Math.sin(k*Math.PI/2)+u,z=0,Q=_.length;z=0;){n=z,(i=z-1)<0&&(i=e.length-1);var r=0,a=s+2*d;for(r=0;r=t&&(f=t-1);var p=e[f];u.push(p[r?2:0]+n),u.push(p[1]+n),u.push(p[r?0:2]+n)}o%2==1&&(o+=2);for(var m=0;mS&&(S=I,l=x,A=b,c=M,h=C);break}}}if(S>0)J(T-6,T-5,T-4,l,A,!0),J(T-3,T-2,T-1,c,h,!1);else{console.log("Error: 没有找到平行边!!!");var k=[];for(_=0;_<3;_++){g=2==_?T-6:T-6+_+1,x=new tt(i[3*(v=T-6+_)],i[3*v+1]),b=new tt(i[3*g],i[3*g+1]);I=(B=new tt(b.x-x.x,b.y-x.y)).length();k.push([I,x,b])}var P=function(e,t){return e[0]t[0]?1:0};k.sort(P),J(T-6,T-5,T-4,k[1][1],k[1][2],!0),k=[];for(L=3;L<6;L++){w=5==L?T-3:T-6+L+1,M=new tt(i[3*(y=T-6+L)],i[3*y+1]),C=new tt(i[3*w],i[3*w+1]),E=new tt(C.x-M.x,C.y-M.y);I=B.length();k.push([I,M,C])}k.sort(P),J(T-3,T-2,T-1,k[1][1],k[1][2],!1)}}}function J(e,t,r,a,o,s){var l=p.generateTopUV(n,i,e,t,r,a,o,s);ee(l[0]),ee(l[1]),ee(l[2])}function q(e,t,r,a){$(e),$(t),$(a),$(t),$(r),$(a);var o=i.length/3,s=p.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function $(e){i.push(a[3*e+0]),i.push(a[3*e+1]),i.push(a[3*e+2])}function ee(e){r.push(e.x),r.push(e.y)}!function(){var e=i.length/3;if(A){var t=0;Z(T,R,D*t,!0),Z(T,R,D*(t=s+2*d),!1)}else{Z(T,R,0,!0),Z(T,R,D*s,!1)}n.addGroup(e,i.length/3-e,0)}(),function(){var e=i.length/3,t=0;for(Y(_,t),t+=_.length,b=0,M=S.length;b0;(M&&x>Math.PI/2||!M&&xt?1:0}));for(var l=[],A=0;A<2;A++)for(var c=0;c=0&&(h=!0);var f=(u=Math.abs(u))+(d=Math.abs(d)),p=d/f,m=u/f;if(h)return[new tt(t[o[0]]*m+t[o[0]+1]*p,1-t[o[0]+2]),new tt(t[o[1]]*m+t[o[1]+1]*p,1-t[o[1]+2]),new tt(t[o[2]]*m+t[o[2]+1]*p,1-t[o[2]+2]),new tt(t[o[3]]*m+t[o[3]+1]*p,1-t[o[3]+2])];for(c=0;c>2]>>8*(3-i%4)+4&15)+t.charAt(e[i>>2]>>8*(3-i%4)&15);return n}(function(e){for(var t=e,n=Array(80),i=1732584193,r=-271733879,a=-1732584194,o=271733878,s=-1009589776,l=0;l>6),n=new Array(16*t),i=0;i<16*t;i++)n[i]=0;for(i=0;i>2]|=e.charCodeAt(i)<<24-8*(3&i);return n[i>>2]|=128<<24-8*(3&i),n[16*t-1]=8*e.length,n}(e)))}function tu(e,t,n,i){return e<20?t&n|~t&i:e<40?t^n^i:e<60?t&n|t&i|n&i:t^n^i}function nu(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function iu(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function ru(e,t){return e<>>32-t}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:T}}));var au={};function ou(){}ou.prototype=Object.assign(ou.prototype,{constructor:ou,load:function(e,t,n,i){if(void 0===au[e]){au[e]=[],au[e].push({onLoad:t,onProgress:n,onError:i});var r=new XMLHttpRequest;return r.open("GET",e,!0),r.addEventListener("load",(function(t){var n=this.response,i=au[e];if(delete au[e],200===this.status||0===this.status)for(var a=0,o=i.length;a0&&void 0!==arguments[0]?arguments[0]:{};void 0===e.async&&(e.async=!0);var t=new XMLHttpRequest;if(e.async&&(t.responseType="json"),t.open("POST",e.url,e.async),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){4==t.readyState&&200==t.status&&e.onSuccess&&e.onSuccess(t.response)},t.onerror=function(t){e.onFaild&&e.onFaild(t)},t.send(e.body),!e.async)return JSON.parse(t.response)}},{key:"get",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};void 0===e.async&&(e.async=!0);var t=new XMLHttpRequest;if(e.async&&(t.responseType="json"),t.open("GET",e.url,e.async),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){4===t.readyState&&200===t.status&&e.onSuccess&&e.onSuccess(t.response)},t.onerror=function(t){e.onFaild&&e.onFaild(t)},t.send(),!e.async)try{return JSON.parse(t.response)}catch(e){return 4===t.readyState&&200===t.status}}},{key:"setLocalPath",value:function(e,t){return e.m.forEach((function(n,i){e.m[i]=t+"m/"+n})),e.mat.forEach((function(n,i){e.mat[i]=t+"mat/"+n})),void 0!==e.scene&&""!=e.scene&&(e.scene=t+e.scene),void 0!==e.nodes&&""!=e.nodes&&(e.nodes=t+"nodes/"+e.nodes),void 0!==e.i&&""!=e.i&&(e.i=t+"instance/"+e.i),void 0!==e.ii&&e.ii.forEach((function(n,i){e.ii[i]=t+"instance/"+n})),e.localPath=t+"Texture/",e.bim&&(e.bim=t+e.bim),e}},{key:"setOnlinePath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:su;return e.m.forEach((function(n,i){e.m[i]=t+n})),e.mat.forEach((function(n,i){e.mat[i]=t+n})),void 0!==e.scene&&""!=e.scene&&(e.scene=t+e.scene),void 0!==e.nodes&&""!=e.nodes&&(e.nodes=t+e.nodes),void 0!==e.i&&""!=e.i&&(e.i=t+e.i),void 0!==e.ii&&e.ii.forEach((function(n,i){e.ii[i]=t+n})),e.localPath=t,e}},{key:"getFileList",value:function(e){try{var t=this.get({url:e+"fileList.json",method:"GET",async:!1});return Array.isArray(t.addition)&&(t.addition=t.addition.map((function(t){return e+t}))),Array.isArray(t.a)&&(t.a=t.a.map((function(t){return e+t}))),Array.isArray(t.m)&&(t.m=t.m.map((function(t){return e+t}))),Array.isArray(t.mat)&&(t.mat=t.mat.map((function(t){return e+t}))),Array.isArray(t.instance)&&(t.instance=t.instance.map((function(t){return e+t}))),Array.isArray(t.skin)&&(t.skin=t.skin.map((function(t){return e+t}))),Array.isArray(t.bone)&&(t.bone=t.bone.map((function(t){return e+t}))),t.scene&&(t.scene=e+t.scene),t.sky&&(t.sky.a=e+t.sky.a,t.sky.b=e+t.sky.b),t.bim&&(t.bim=e+t.bim),t.sceneData&&(t.sceneData=e+t.sceneData),t}catch(e){console.error("获取本地fileList.json失败")}}},{key:"hasMRCBFile",value:function(e){try{return this.get({url:e+"conf.mrcb",method:"GET",async:!1})}catch(e){}}},{key:"getCoordsByAddressOrCityCode",value:function(t,n,i){var r='https://api.tianditu.gov.cn/administrative?postStr={"searchWord":"'.concat(void 0!==t?t:n,'","searchType":"').concat(void 0!==t?1:0,'","needSubInfo":"false","needAll":"false","needPolygon":"true","needPre":"true"}&tk=')+Ck.token;e.get({url:r,async:!0,onSuccess:function(e){"ok"===e.msg&&(e.data[0].coord=[e.data[0].lnt,e.data[0].lat],i(e.data[0]))}})}},{key:"getCoordsByCityCode",value:function(t,n){e.getCoordsByAddressOrCityCode(void 0,t,n)}},{key:"getCoordsByAddress",value:function(t,n){e.getCoordsByAddressOrCityCode(t,void 0,n)}}]),e}(),Au=function(){function e(){s(this,e),this.token=null}return A(e,[{key:"init",value:function(e){this.options=e}},{key:"checkDevloper",value:function(){if(!this.options.appkey||""===this.options.appkey)throw new Error("开发者参数[appkey]缺失!");if(!this.options.appsecret||""===this.options.appsecret)throw new Error("开发者参数[appsecret]缺失!");var e=(new Date).getTime(),t=parseInt(1e6*Math.random()),n=eu(this.options.appsecret+e+t),i="appkey="+this.options.appkey+"&random="+t+"&sign="+n+"&source=3&timeStamp="+e;return lu.authorization(i)}},{key:"offlineValidation",value:function(e){var t=this;try{callRuntimeCallbacks&&callRuntimeCallbacks([function(n){n.onRuntimeInitialized=function(){var i=0;n&&n.ccall&&(i=n.ccall("WEB_API_CheckLicenseData","number",["string","string","string","string"],[t.options.developerID,t.options.appID,t.options.secretKey,t.options.offlinekey])),e(i)}}])}catch(t){e(0)}}}]),e}(),cu=new Au;function hu(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}Object.assign(hu.prototype,{setSize:function(){},render:function(){console.error("Pass: .render() must be implemented in derived pass.")}}),hu.FullScreenQuad=function(){var e=new FA(-1,1,1,-1,0,1),t=new $i(2,2),n=function(e){this._mesh=new Ei(t,e)};return Object.defineProperty(n.prototype,"material",{get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}),Object.assign(n.prototype,{render:function(t){t.render(this._mesh,e)}}),n}();var uu=function(e,t,n,i,r){hu.call(this),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=void 0!==r?r:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1};uu.prototype=Object.assign(Object.create(hu.prototype),{constructor:uu,render:function(e,t,n){var i,r,a=e.autoClear;e.autoClear=!1,this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(i=e.getClearColor().getHex(),r=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(i,r),this.scene.overrideMaterial=null,e.autoClear=a}}),"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:T}}));var du={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tgl_FragColor = opacity * texel;","}"].join("\n")},fu=function(e,t){hu.call(this),this.textureID=void 0!==t?t:"tDiffuse",e instanceof Ri?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Di.clone(e.uniforms),this.material=new Ri({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new hu.FullScreenQuad(this.material)};fu.prototype=Object.assign(Object.create(hu.prototype),{constructor:fu,render:function(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}});var pu=function(e,t){hu.call(this),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1};pu.prototype=Object.assign(Object.create(hu.prototype),{constructor:pu,render:function(e,t,n){var i,r,a=e.getContext(),o=e.state;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0),this.inverse?(i=0,r=1):(i=1,r=0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),o.buffers.stencil.setFunc(a.ALWAYS,i,4294967295),o.buffers.stencil.setClear(r),o.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.stencil.setLocked(!1),o.buffers.stencil.setFunc(a.EQUAL,1,4294967295),o.buffers.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),o.buffers.stencil.setLocked(!0)}});var mu=function(){hu.call(this),this.needsSwap=!1};mu.prototype=Object.create(hu.prototype),Object.assign(mu.prototype,{render:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}});var vu=function(e,t){if(this.renderer=e,void 0===t){var n={minFilter:Z,magFilter:Z,format:ce,stencilBuffer:!0},i=e.getSize(new tt);this._pixelRatio=e.getPixelRatio(),this._width=i.width,this._height=i.height,(t=new dt(this._width*this._pixelRatio,this._height*this._pixelRatio,n)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===du&&console.error("EffectComposer relies on CopyShader"),void 0===fu&&console.error("EffectComposer relies on ShaderPass"),this.copyPass=new fu(du),this.clock=new lc};Object.assign(vu.prototype,{swapBuffers:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e},addPass:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)},insertPass:function(e,t){this.passes.splice(t,0,e)},isLastEnabledPass:function(e){for(var t=e+1;t= edgeVert;"," FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;","/*--------------------------------------------------------------------------*/"," if(!horzSpan) lumaN = lumaW;"," if(!horzSpan) lumaS = lumaE;"," if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;"," FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;","/*--------------------------------------------------------------------------*/"," FxaaFloat gradientN = lumaN - lumaM;"," FxaaFloat gradientS = lumaS - lumaM;"," FxaaFloat lumaNN = lumaN + lumaM;"," FxaaFloat lumaSS = lumaS + lumaM;"," FxaaBool pairN = abs(gradientN) >= abs(gradientS);"," FxaaFloat gradient = max(abs(gradientN), abs(gradientS));"," if(pairN) lengthSign = -lengthSign;"," FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posB;"," posB.x = posM.x;"," posB.y = posM.y;"," FxaaFloat2 offNP;"," offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;"," offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;"," if(!horzSpan) posB.x += lengthSign * 0.5;"," if( horzSpan) posB.y += lengthSign * 0.5;","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posN;"," posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;"," posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;"," FxaaFloat2 posP;"," posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;"," posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;"," FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;"," FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));"," FxaaFloat subpixE = subpixC * subpixC;"," FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));","/*--------------------------------------------------------------------------*/"," if(!pairN) lumaNN = lumaSS;"," FxaaFloat gradientScaled = gradient * 1.0/4.0;"," FxaaFloat lumaMM = lumaM - lumaNN * 0.5;"," FxaaFloat subpixF = subpixD * subpixE;"," FxaaBool lumaMLTZero = lumaMM < 0.0;","/*--------------------------------------------------------------------------*/"," lumaEndN -= lumaNN * 0.5;"," lumaEndP -= lumaNN * 0.5;"," FxaaBool doneN = abs(lumaEndN) >= gradientScaled;"," FxaaBool doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;"," FxaaBool doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;","/*--------------------------------------------------------------------------*/"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 3)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 4)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 5)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 6)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 7)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 8)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 9)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 10)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 11)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 12)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }","/*--------------------------------------------------------------------------*/"," FxaaFloat dstN = posM.x - posN.x;"," FxaaFloat dstP = posP.x - posM.x;"," if(!horzSpan) dstN = posM.y - posN.y;"," if(!horzSpan) dstP = posP.y - posM.y;","/*--------------------------------------------------------------------------*/"," FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;"," FxaaFloat spanLength = (dstP + dstN);"," FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;"," FxaaFloat spanLengthRcp = 1.0/spanLength;","/*--------------------------------------------------------------------------*/"," FxaaBool directionN = dstN < dstP;"," FxaaFloat dst = min(dstN, dstP);"," FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;"," FxaaFloat subpixG = subpixF * subpixF;"," FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;"," FxaaFloat subpixH = subpixG * fxaaQualitySubpix;","/*--------------------------------------------------------------------------*/"," FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;"," FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);"," if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;"," if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;"," #if (FXAA_DISCARD == 1)"," return FxaaTexTop(tex, posM);"," #else"," return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);"," #endif","}","/*==========================================================================*/","#endif","","void main() {"," gl_FragColor = FxaaPixelShader("," vUv,"," vec4(0.0),"," tDiffuse,"," tDiffuse,"," tDiffuse,"," resolution,"," vec4(0.0),"," vec4(0.0),"," vec4(0.0),"," 0.75,"," 0.166,"," 0.0833,"," 0.0,"," 0.0,"," 0.0,"," vec4(0.0)"," );",""," // TODO avoid querying texture twice for same texel"," gl_FragColor.a = texture2D(tDiffuse, vUv).a;","}"].join("\n")},wu={defines:{SMAA_THRESHOLD:"0.1"},uniforms:{tDiffuse:{value:null},resolution:{value:new tt(1/1024,1/512)}},vertexShader:["uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[ 3 ];","void SMAAEdgeDetectionVS( vec2 texcoord ) {","\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );","\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );","\tvOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 );","}","void main() {","\tvUv = uv;","\tSMAAEdgeDetectionVS( vUv );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","varying vec2 vUv;","varying vec4 vOffset[ 3 ];","vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {","\tvec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );","\tvec4 delta;","\tvec3 C = texture2D( colorTex, texcoord ).rgb;","\tvec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;","\tvec3 t = abs( C - Cleft );","\tdelta.x = max( max( t.r, t.g ), t.b );","\tvec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;","\tt = abs( C - Ctop );","\tdelta.y = max( max( t.r, t.g ), t.b );","\tvec2 edges = step( threshold, delta.xy );","\tif ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )","\t\tdiscard;","\tvec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;","\tt = abs( C - Cright );","\tdelta.z = max( max( t.r, t.g ), t.b );","\tvec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;","\tt = abs( C - Cbottom );","\tdelta.w = max( max( t.r, t.g ), t.b );","\tfloat maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );","\tvec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;","\tt = abs( C - Cleftleft );","\tdelta.z = max( max( t.r, t.g ), t.b );","\tvec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;","\tt = abs( C - Ctoptop );","\tdelta.w = max( max( t.r, t.g ), t.b );","\tmaxDelta = max( max( maxDelta, delta.z ), delta.w );","\tedges.xy *= step( 0.5 * maxDelta, delta.xy );","\treturn vec4( edges, 0.0, 0.0 );","}","void main() {","\tgl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );","}"].join("\n")},xu={defines:{SMAA_MAX_SEARCH_STEPS:"8",SMAA_AREATEX_MAX_DISTANCE:"16",SMAA_AREATEX_PIXEL_SIZE:"( 1.0 / vec2( 160.0, 560.0 ) )",SMAA_AREATEX_SUBTEX_SIZE:"( 1.0 / 7.0 )"},uniforms:{tDiffuse:{value:null},tArea:{value:null},tSearch:{value:null},resolution:{value:new tt(1/1024,1/512)}},vertexShader:["uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[ 3 ];","varying vec2 vPixcoord;","void SMAABlendingWeightCalculationVS( vec2 texcoord ) {","\tvPixcoord = texcoord / resolution;","\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );","\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );","\tvOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );","}","void main() {","\tvUv = uv;","\tSMAABlendingWeightCalculationVS( vUv );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define SMAASampleLevelZeroOffset( tex, coord, offset ) texture2D( tex, coord + float( offset ) * resolution, 0.0 )","uniform sampler2D tDiffuse;","uniform sampler2D tArea;","uniform sampler2D tSearch;","uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[3];","varying vec2 vPixcoord;","#if __VERSION__ == 100","vec2 round( vec2 x ) {","\treturn sign( x ) * floor( abs( x ) + 0.5 );","}","#endif","float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {","\te.r = bias + e.r * scale;","\treturn 255.0 * texture2D( searchTex, e, 0.0 ).r;","}","float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {","\tvec2 e = vec2( 0.0, 1.0 );","\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {","\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;","\t\ttexcoord -= vec2( 2.0, 0.0 ) * resolution;","\t\tif ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;","\t}","\ttexcoord.x += 0.25 * resolution.x;","\ttexcoord.x += resolution.x;","\ttexcoord.x += 2.0 * resolution.x;","\ttexcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);","\treturn texcoord.x;","}","float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {","\tvec2 e = vec2( 0.0, 1.0 );","\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {","\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;","\t\ttexcoord += vec2( 2.0, 0.0 ) * resolution;","\t\tif ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;","\t}","\ttexcoord.x -= 0.25 * resolution.x;","\ttexcoord.x -= resolution.x;","\ttexcoord.x -= 2.0 * resolution.x;","\ttexcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );","\treturn texcoord.x;","}","float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {","\tvec2 e = vec2( 1.0, 0.0 );","\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {","\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;","\t\ttexcoord += vec2( 0.0, 2.0 ) * resolution;","\t\tif ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;","\t}","\ttexcoord.y -= 0.25 * resolution.y;","\ttexcoord.y -= resolution.y;","\ttexcoord.y -= 2.0 * resolution.y;","\ttexcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );","\treturn texcoord.y;","}","float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {","\tvec2 e = vec2( 1.0, 0.0 );","\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {","\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;","\t\ttexcoord -= vec2( 0.0, 2.0 ) * resolution;","\t\tif ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;","\t}","\ttexcoord.y += 0.25 * resolution.y;","\ttexcoord.y += resolution.y;","\ttexcoord.y += 2.0 * resolution.y;","\ttexcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );","\treturn texcoord.y;","}","vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {","\tvec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;","\ttexcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );","\ttexcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;","\treturn texture2D( areaTex, texcoord, 0.0 ).rg;","}","vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {","\tvec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );","\tvec2 e = texture2D( edgesTex, texcoord ).rg;","\tif ( e.g > 0.0 ) {","\t\tvec2 d;","\t\tvec2 coords;","\t\tcoords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );","\t\tcoords.y = offset[ 1 ].y;","\t\td.x = coords.x;","\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).r;","\t\tcoords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );","\t\td.y = coords.x;","\t\td = d / resolution.x - pixcoord.x;","\t\tvec2 sqrt_d = sqrt( abs( d ) );","\t\tcoords.y -= 1.0 * resolution.y;","\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;","\t\tweights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );","\t}","\tif ( e.r > 0.0 ) {","\t\tvec2 d;","\t\tvec2 coords;","\t\tcoords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );","\t\tcoords.x = offset[ 0 ].x;","\t\td.x = coords.y;","\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).g;","\t\tcoords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );","\t\td.y = coords.y;","\t\td = d / resolution.y - pixcoord.y;","\t\tvec2 sqrt_d = sqrt( abs( d ) );","\t\tcoords.y -= 1.0 * resolution.y;","\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;","\t\tweights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );","\t}","\treturn weights;","}","void main() {","\tgl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );","}"].join("\n")},bu={uniforms:{tDiffuse:{value:null},tColor:{value:null},resolution:{value:new tt(1/1024,1/512)}},vertexShader:["uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[ 2 ];","void SMAANeighborhoodBlendingVS( vec2 texcoord ) {","\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );","\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );","}","void main() {","\tvUv = uv;","\tSMAANeighborhoodBlendingVS( vUv );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform sampler2D tColor;","uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[ 2 ];","vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {","\tvec4 a;","\ta.xz = texture2D( blendTex, texcoord ).xz;","\ta.y = texture2D( blendTex, offset[ 1 ].zw ).g;","\ta.w = texture2D( blendTex, offset[ 1 ].xy ).a;","\tif ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {","\t\treturn texture2D( colorTex, texcoord, 0.0 );","\t} else {","\t\tvec2 offset;","\t\toffset.x = a.a > a.b ? a.a : -a.b;","\t\toffset.y = a.g > a.r ? -a.g : a.r;","\t\tif ( abs( offset.x ) > abs( offset.y )) {","\t\t\toffset.y = 0.0;","\t\t} else {","\t\t\toffset.x = 0.0;","\t\t}","\t\tvec4 C = texture2D( colorTex, texcoord, 0.0 );","\t\ttexcoord += sign( offset ) * resolution;","\t\tvec4 Cop = texture2D( colorTex, texcoord, 0.0 );","\t\tfloat s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );","\t\tC.xyz = pow(C.xyz, vec3(2.2));","\t\tCop.xyz = pow(Cop.xyz, vec3(2.2));","\t\tvec4 mixed = mix(C, Cop, s);","\t\tmixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));","\t\treturn mixed;","\t}","}","void main() {","\tgl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );","}"].join("\n")},Mu=function(e,t){hu.call(this),this.edgesRT=new dt(e,t,{depthBuffer:!1,generateMipmaps:!1,minFilter:Z,format:Ae}),this.edgesRT.texture.name="SMAAPass.edges",this.weightsRT=new dt(e,t,{depthBuffer:!1,generateMipmaps:!1,minFilter:Z,format:ce}),this.weightsRT.texture.name="SMAAPass.weights";var n,i,r=this;(n=new Image).src=this.getAreaTexture(),n.onload=function(){r.areaTexture.needsUpdate=!0},this.areaTexture=new ht,this.areaTexture.name="SMAAPass.area",this.areaTexture.image=n,this.areaTexture.format=Ae,this.areaTexture.minFilter=Z,this.areaTexture.generateMipmaps=!1,this.areaTexture.flipY=!1,(i=new Image).src=this.getSearchTexture(),i.onload=function(){r.searchTexture.needsUpdate=!0},this.searchTexture=new ht,this.searchTexture.name="SMAAPass.search",this.searchTexture.image=i,this.searchTexture.magFilter=X,this.searchTexture.minFilter=X,this.searchTexture.generateMipmaps=!1,this.searchTexture.flipY=!1,void 0===wu&&console.error("SMAAPass relies on SMAAShader"),this.uniformsEdges=Di.clone(wu.uniforms),this.uniformsEdges.resolution.value.set(1/e,1/t),this.materialEdges=new Ri({defines:Object.assign({},wu.defines),uniforms:this.uniformsEdges,vertexShader:wu.vertexShader,fragmentShader:wu.fragmentShader}),this.uniformsWeights=Di.clone(xu.uniforms),this.uniformsWeights.resolution.value.set(1/e,1/t),this.uniformsWeights.tDiffuse.value=this.edgesRT.texture,this.uniformsWeights.tArea.value=this.areaTexture,this.uniformsWeights.tSearch.value=this.searchTexture,this.materialWeights=new Ri({defines:Object.assign({},xu.defines),uniforms:this.uniformsWeights,vertexShader:xu.vertexShader,fragmentShader:xu.fragmentShader}),this.uniformsBlend=Di.clone(bu.uniforms),this.uniformsBlend.resolution.value.set(1/e,1/t),this.uniformsBlend.tDiffuse.value=this.weightsRT.texture,this.materialBlend=new Ri({uniforms:this.uniformsBlend,vertexShader:bu.vertexShader,fragmentShader:bu.fragmentShader}),this.needsSwap=!1,this.fsQuad=new hu.FullScreenQuad(null)};Mu.prototype=Object.assign(Object.create(hu.prototype),{constructor:Mu,render:function(e,t,n){this.uniformsEdges.tDiffuse.value=n.texture,this.fsQuad.material=this.materialEdges,e.setRenderTarget(this.edgesRT),this.clear&&e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialWeights,e.setRenderTarget(this.weightsRT),this.clear&&e.clear(),this.fsQuad.render(e),this.uniformsBlend.tColor.value=n.texture,this.fsQuad.material=this.materialBlend,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))},setSize:function(e,t){this.edgesRT.setSize(e,t),this.weightsRT.setSize(e,t),this.materialEdges.uniforms.resolution.value.set(1/e,1/t),this.materialWeights.uniforms.resolution.value.set(1/e,1/t),this.materialBlend.uniforms.resolution.value.set(1/e,1/t)},getAreaTexture:function(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAIAAACOVPcQAACBeklEQVR42u39W4xlWXrnh/3WWvuciIzMrKxrV8/0rWbY0+SQFKcb4owIkSIFCjY9AC1BT/LYBozRi+EX+cV+8IMsYAaCwRcBwjzMiw2jAWtgwC8WR5Q8mDFHZLNHTarZGrLJJllt1W2qKrsumZWZcTvn7L3W54e1vrXX3vuciLPPORFR1XE2EomorB0nVuz//r71re/y/1eMvb4Cb3N11xV/PP/2v4UBAwJG/7H8urx6/25/Gf8O5hypMQ0EEEQwAqLfoN/Z+97f/SW+/NvcgQk4sGBJK6H7N4PFVL+K+e0N11yNfkKvwUdwdlUAXPHHL38oa15f/i/46Ih6SuMSPmLAYAwyRKn7dfMGH97jaMFBYCJUgotIC2YAdu+LyW9vvubxAP8kAL8H/koAuOKP3+q6+xGnd5kdYCeECnGIJViwGJMAkQKfDvB3WZxjLKGh8VSCCzhwEWBpMc5/kBbjawT4HnwJfhr+pPBIu7uu+OOTo9vsmtQcniMBGkKFd4jDWMSCRUpLjJYNJkM+IRzQ+PQvIeAMTrBS2LEiaiR9b/5PuT6Ap/AcfAFO4Y3dA3DFH7/VS+M8k4baEAQfMI4QfbVDDGIRg7GKaIY52qAjTAgTvGBAPGIIghOCYAUrGFNgzA7Q3QhgCwfwAnwe5vDejgG44o/fbm1C5ZlYQvQDARPAIQGxCWBM+wWl37ZQESb4gImexGMDouhGLx1Cst0Saa4b4AqO4Hk4gxo+3DHAV/nx27p3JziPM2pVgoiia5MdEzCGULprIN7gEEeQ5IQxEBBBQnxhsDb5auGmAAYcHMA9eAAz8PBol8/xij9+C4Djlim4gJjWcwZBhCBgMIIYxGAVIkH3ZtcBuLdtRFMWsPGoY9rN+HoBji9VBYdwD2ZQg4cnO7OSq/z4rU5KKdwVbFAjNojCQzTlCLPFSxtamwh2jMUcEgg2Wm/6XgErIBhBckQtGN3CzbVacERgCnfgLswhnvqf7QyAq/z4rRZm1YglYE3affGITaZsdIe2FmMIpnOCap25I6jt2kCwCW0D1uAD9sZctNGXcQIHCkINDQgc78aCr+zjtw3BU/ijdpw3zhCwcaONwBvdeS2YZKkJNJsMPf2JKEvC28RXxxI0ASJyzQCjCEQrO4Q7sFArEzjZhaFc4cdv+/JFdKULM4px0DfUBI2hIsy06BqLhGTQEVdbfAIZXYMPesq6VoCHICzUyjwInO4Y411//LYLs6TDa9wvg2CC2rElgAnpTBziThxaL22MYhzfkghz6GAs2VHbbdM91VZu1MEEpupMMwKyVTb5ij9+u4VJG/5EgEMMmFF01cFai3isRbKbzb+YaU/MQbAm2XSMoUPAmvZzbuKYRIFApbtlrfFuUGd6vq2hXNnH78ZLh/iFhsQG3T4D1ib7k5CC6vY0DCbtrohgLEIClXiGtl10zc0CnEGIhhatLBva7NP58Tvw0qE8yWhARLQ8h4+AhQSP+I4F5xoU+VilGRJs6wnS7ruti/4KvAY/CfdgqjsMy4pf8fodQO8/gnuX3f/3xi3om1/h7THr+co3x93PP9+FBUfbNUjcjEmhcrkT+8K7ml7V10Jo05mpIEFy1NmCJWx9SIKKt+EjAL4Ez8EBVOB6havuT/rByPvHXK+9zUcfcbb254+9fydJknYnRr1oGfdaiAgpxu1Rx/Rek8KISftx3L+DfsLWAANn8Hvw0/AFeAGO9DFV3c6D+CcWbL8Dj9e7f+T1k8AZv/d7+PXWM/Z+VvdCrIvuAKO09RpEEQJM0Ci6+B4xhTWr4cZNOvhktabw0ta0rSJmqz3Yw5/AKXwenod7cAhTmBSPKf6JBdvH8IP17h95pXqw50/+BFnj88fev4NchyaK47OPhhtI8RFSvAfDSNh0Ck0p2gLxGkib5NJj/JWCr90EWQJvwBzO4AHcgztwAFN1evHPUVGwfXON+0debT1YeGON9Yy9/63X+OguiwmhIhQhD7l4sMqlG3D86Suc3qWZ4rWjI1X7u0Ytw6x3rIMeIOPDprfe2XzNgyj6PahhBjO4C3e6puDgXrdg+/5l948vF3bqwZetZ+z9Rx9zdIY5pInPK4Nk0t+l52xdK2B45Qd87nM8fsD5EfUhIcJcERw4RdqqH7Yde5V7m1vhNmtedkz6EDzUMF/2jJYWbC+4fzzA/Y+/8PPH3j9dcBAPIRP8JLXd5BpAu03aziOL3VVHZzz3CXWDPWd+SH2AnxIqQoTZpo9Ckc6HIrFbAbzNmlcg8Ag8NFDDAhbJvTBZXbC94P7t68EXfv6o+21gUtPETU7bbkLxvNKRFG2+KXzvtObonPP4rBvsgmaKj404DlshFole1Glfh02fE7bYR7dZ82oTewIBGn1Md6CG6YUF26X376oevOLzx95vhUmgblI6LBZwTCDY7vMq0op5WVXgsObOXJ+1x3qaBl9j1FeLxbhU9w1F+Wiba6s1X/TBz1LnUfuYDi4r2C69f1f14BWfP+p+W2GFKuC9phcELMYRRLur9DEZTUdEH+iEqWdaM7X4WOoPGI+ZYD2+wcQ+y+ioHUZ9dTDbArzxmi/bJI9BND0Ynd6lBdve/butBw8+f/T9D3ABa3AG8W3VPX4hBin+bj8dMMmSpp5pg7fJ6xrBFE2WQQEWnV8Qg3FbAWzYfM1rREEnmvkN2o1+acG2d/9u68GDzx91v3mAjb1zkpqT21OipPKO0b9TO5W0nTdOmAQm0TObts3aBKgwARtoPDiCT0gHgwnbArzxmtcLc08HgF1asN0C4Ms/fvD5I+7PhfqyXE/b7RbbrGyRQRT9ARZcwAUmgdoz0ehJ9Fn7QAhUjhDAQSw0bV3T3WbNa59jzmiP6GsWbGXDX2ytjy8+f9T97fiBPq9YeLdBmyuizZHaqXITnXiMUEEVcJ7K4j3BFPurtB4bixW8wTpweL8DC95szWMOqucFYGsWbGU7p3TxxxefP+r+oTVktxY0v5hbq3KiOKYnY8ddJVSBxuMMVffNbxwIOERShst73HZ78DZrHpmJmH3K6sGz0fe3UUj0eyRrSCGTTc+rjVNoGzNSv05srAxUBh8IhqChiQgVNIIBH3AVPnrsnXQZbLTm8ammv8eVXn/vWpaTem5IXRlt+U/LA21zhSb9cye6jcOfCnOwhIAYXAMVTUNV0QhVha9xjgA27ODJbLbmitt3tRN80lqG6N/khgot4ZVlOyO4WNg3OIMzhIZQpUEHieg2im6F91hB3I2tubql6BYNN9Hj5S7G0G2tahslBWKDnOiIvuAEDzakDQKDNFQT6gbn8E2y4BBubM230YIpBnDbMa+y3dx0n1S0BtuG62lCCXwcY0F72T1VRR3t2ONcsmDjbmzNt9RFs2LO2hQNyb022JisaI8rAWuw4HI3FuAIhZdOGIcdjLJvvObqlpqvWTJnnQbyi/1M9O8UxWhBs//H42I0q1Yb/XPGONzcmm+ri172mHKvZBpHkJaNJz6v9jxqiklDj3U4CA2ugpAaYMWqNXsdXbmJNd9egCnJEsphXNM+MnK3m0FCJ5S1kmJpa3DgPVbnQnPGWIDspW9ozbcO4K/9LkfaQO2KHuqlfFXSbdNzcEcwoqNEFE9zcIXu9/6n/ym/BC/C3aJLzEKPuYVlbFnfhZ8kcWxV3dbv4bKl28566wD+8C53aw49lTABp9PWbsB+knfc/Li3eVizf5vv/xmvnPKg5ihwKEwlrcHqucuVcVOxEv8aH37E3ZqpZypUulrHEtIWKUr+txHg+ojZDGlwnqmkGlzcVi1dLiNSJiHjfbRNOPwKpx9TVdTn3K05DBx4psIk4Ei8aCkJahRgffk4YnEXe07T4H2RR1u27E6wfQsBDofUgjFUFnwC2AiVtA+05J2zpiDK2Oa0c5fmAecN1iJzmpqFZxqYBCYhFTCsUNEmUnIcZ6aEA5rQVhEywG6w7HSW02XfOoBlQmjwulOFQAg66SvJblrTEX1YtJ3uG15T/BH1OfOQeuR8g/c0gdpT5fx2SKbs9EfHTKdM8A1GaJRHLVIwhcGyydZsbifAFVKl5EMKNU2Hryo+06BeTgqnxzYjThVySDikbtJPieco75lYfKAJOMEZBTjoITuWHXXZVhcUDIS2hpiXHV9Ku4u44bN5OYLDOkJo8w+xJSMbhBRHEdEs9JZUCkQrPMAvaHyLkxgkEHxiNkx/x2YB0mGsQ8EUWj/stW5YLhtS5SMu+/YBbNPDCkGTUybN8krRLBGPlZkVOA0j+a1+rkyQKWGaPHPLZOkJhioQYnVZ2hS3zVxMtgC46KuRwbJNd9nV2PHgb36F194ecf/Yeu2vAFe5nm/bRBFrnY4BauE8ERmZRFUn0k8hbftiVYSKMEme2dJCJSCGYAlNqh87bXOPdUkGy24P6d1ll21MBqqx48Fvv8ZHH8HZFY7j/uAq1xMJUFqCSUlJPmNbIiNsmwuMs/q9CMtsZsFO6SprzCS1Z7QL8xCQClEelpjTduDMsmWD8S1PT152BtvmIGvUeDA/yRn83u/x0/4qxoPHjx+PXY9pqX9bgMvh/Nz9kpP4pOe1/fYf3axUiMdHLlPpZCNjgtNFAhcHEDxTumNONhHrBduW+vOyY++70WWnPXj98eA4kOt/mj/5E05l9+O4o8ePx67HFqyC+qSSnyselqjZGaVK2TadbFLPWAQ4NBhHqDCCV7OTpo34AlSSylPtIdd2AJZlyzYQrDJ5lcWGNceD80CunPLGGzsfD+7wRb95NevJI5docQ3tgCyr5bGnyaPRlmwNsFELViOOx9loebGNq2moDOKpHLVP5al2cymWHbkfzGXL7kfRl44H9wZy33tvt+PB/Xnf93e+nh5ZlU18wCiRUa9m7kib9LYuOk+hudQNbxwm0AQqbfloimaB2lM5fChex+ylMwuTbfmXQtmWlenZljbdXTLuOxjI/fDDHY4Hjx8/Hrse0zXfPFxbUN1kKqSCCSk50m0Ajtx3ub9XHBKHXESb8iO6E+qGytF4nO0OG3SXzbJlhxBnKtKyl0NwybjvYCD30aMdjgePHz8eu56SVTBbgxJMliQ3Oauwg0QHxXE2Ez/EIReLdQj42Gzb4CLS0YJD9xUx7bsi0vJi5mUbW1QzL0h0PFk17rtiIPfJk52MB48fPx67npJJwyrBa2RCCQRTbGZSPCxTPOiND4G2pYyOQ4h4jINIJh5wFU1NFZt+IsZ59LSnDqBjZ2awbOku+yInunLcd8VA7rNnOxkPHj9+PGY9B0MWJJNozOJmlglvDMXDEozdhQWbgs/U6oBanGzLrdSNNnZFjOkmbi5bNt1lX7JLLhn3vXAg9/h4y/Hg8ePHI9dzQMEkWCgdRfYykYKnkP7D4rIujsujaKPBsB54vE2TS00ccvFY/Tth7JXeq1hz+qgVy04sAJawTsvOknHfCwdyT062HA8eP348Zj0vdoXF4pilKa2BROed+9fyw9rWRXeTFXESMOanvDZfJuJaSXouQdMdDJZtekZcLLvEeK04d8m474UDuaenW44Hjx8/Xns9YYqZpszGWB3AN/4VHw+k7WSFtJ3Qicuqb/NlVmgXWsxh570xg2UwxUw3WfO6B5nOuO8aA7lnZxuPB48fPx6znm1i4bsfcbaptF3zNT78eFPtwi1OaCNOqp1x3zUGcs/PN++AGD1+fMXrSVm2baTtPhPahbPhA71wIHd2bXzRa69nG+3CraTtPivahV/55tXWg8fyRY/9AdsY8VbSdp8V7cKrrgdfM//z6ILQFtJ2nxHtwmuoB4/kf74+gLeRtvvMaBdeSz34+vifx0YG20jbfTa0C6+tHrwe//NmOG0L8EbSdp8R7cLrrQe/996O+ai3ujQOskpTNULa7jOjXXj99eCd8lHvoFiwsbTdZ0a78PrrwTvlo966pLuRtB2fFe3Cm6oHP9kNH/W2FryxtN1nTLvwRurBO+Kj3pWXHidtx2dFu/Bm68Fb81HvykuPlrb7LGkX3mw9eGs+6h1Y8MbSdjegXcguQLjmevDpTQLMxtJ2N6NdyBZu9AbrwVvwUW+LbteULUpCdqm0HTelXbhNPe8G68Gb8lFvVfYfSNuxvrTdTWoXbozAzdaDZzfkorOj1oxVxlIMlpSIlpLrt8D4hrQL17z+c3h6hU/wv4Q/utps4+bm+6P/hIcf0JwQ5oQGPBL0eKPTYEXTW+eL/2DKn73J9BTXYANG57hz1cEMviVf/4tf5b/6C5pTQkMIWoAq7hTpOJjtAM4pxKu5vg5vXeUrtI09/Mo/5H+4z+Mp5xULh7cEm2QbRP2tFIKR7WM3fPf/jZ3SWCqLM2l4NxID5zB72HQXv3jj/8mLR5xXNA5v8EbFQEz7PpRfl1+MB/hlAN65qgDn3wTgH13hK7T59bmP+NIx1SHHU84nLOITt3iVz8mNO+lPrjGAnBFqmioNn1mTyk1ta47R6d4MrX7tjrnjYUpdUbv2rVr6YpVfsGG58AG8Ah9eyUN8CX4WfgV+G8LVWPDGb+Zd4cU584CtqSbMKxauxTg+dyn/LkVgA+IR8KHtejeFKRtTmLLpxN6mYVLjYxwXf5x2VofiZcp/lwKk4wGOpYDnoIZPdg/AAbwMfx0+ge9dgZvYjuqKe4HnGnykYo5TvJbG0Vj12JagRhwKa44H95ShkZa5RyLGGdfYvG7aw1TsF6iapPAS29mNS3NmsTQZCmgTzFwgL3upCTgtBTRwvGMAKrgLn4evwin8+afJRcff+8izUGUM63GOOuAs3tJkw7J4kyoNreqrpO6cYLQeFUd7TTpr5YOTLc9RUUogUOVJQ1GYJaFLAW0oTmKyYS46ZooP4S4EON3xQ5zC8/CX4CnM4c1PE8ApexpoYuzqlP3d4S3OJP8ZDK7cKWNaTlqmgDiiHwl1YsE41w1zT4iRTm3DBqxvOUsbMKKDa/EHxagtnta072ejc3DOIh5ojvh8l3tk1JF/AV6FU6jh3U8HwEazLgdCLYSQ+MYiAI2ltomkzttUb0gGHdSUUgsIYjTzLG3mObX4FBRaYtpDVNZrih9TgTeYOBxsEnN1gOCTM8Bsw/ieMc75w9kuAT6A+/AiHGvN/+Gn4KRkiuzpNNDYhDGFndWRpE6SVfm8U5bxnSgVV2jrg6JCKmneqey8VMFgq2+AM/i4L4RUbfSi27lNXZ7R7W9RTcq/q9fk4Xw3AMQd4I5ifAZz8FcVtm9SAom/dyN4lczJQW/kC42ZrHgcCoIf1oVMKkVItmMBi9cOeNHGLqOZk+QqQmrbc5YmYgxELUUN35z2iohstgfLIFmcMV7s4CFmI74L9+EFmGsi+tGnAOD4Yk9gIpo01Y4cA43BWGygMdr4YZekG3OBIUXXNukvJS8tqa06e+lSDCtnqqMFu6hWHXCF+WaYt64m9QBmNxi7Ioy7D+fa1yHw+FMAcPt7SysFLtoG4PXAk7JOA3aAxBRqUiAdU9Yp5lK3HLSRFtOim0sa8euEt08xvKjYjzeJ2GU7YawexrnKI9tmobInjFXCewpwriY9+RR4aaezFhMhGCppKwom0ChrgFlKzyPKkGlTW1YQrE9HJqu8hKGgMc6hVi5QRq0PZxNfrYNgE64utmRv6KKHRpxf6VDUaOvNP5jCEx5q185My/7RKz69UQu2im5k4/eownpxZxNLwiZ1AZTO2ZjWjkU9uaB2HFn6Q3u0JcsSx/qV9hTEApRzeBLDJQXxYmTnq7bdLa3+uqFrxLJ5w1TehnNHx5ECvCh2g2c3hHH5YsfdaSKddztfjQ6imKFGSyFwlLzxEGPp6r5IevVjk1AMx3wMqi1NxDVjLBiPs9tbsCkIY5we5/ML22zrCScFxnNtzsr9Wcc3CnD+pYO+4VXXiDE0oc/vQQ/fDK3oPESJMYXNmJa/DuloJZkcTpcYE8lIH8Dz8DJMiynNC86Mb2lNaaqP/+L7f2fcE/yP7/Lde8xfgSOdMxvOixZf/9p3+M4hT1+F+zApxg9XfUvYjc8qX2lfOOpK2gNRtB4flpFu9FTKCp2XJRgXnX6olp1zyYjTKJSkGmLE2NjUr1bxFM4AeAAHBUFIeSLqXR+NvH/M9fOnfHzOD2vCSyQJKzfgsCh+yi/Mmc35F2fUrw7miW33W9hBD1vpuUojFphIyvg7aTeoymDkIkeW3XLHmguMzbIAJejN6B5MDrhipE2y6SoFRO/AK/AcHHZHNIfiWrEe/C6cr3f/yOvrQKB+zMM55/GQdLDsR+ifr5Fiuu+/y+M78LzOE5dsNuXC3PYvYWd8NXvphLSkJIasrlD2/HOqQ+RjcRdjKTGWYhhVUm4yxlyiGPuMsZR7sMCHUBeTuNWA7if+ifXgc/hovftHXs/DV+Fvwe+f8shzMiMcweFgBly3//vwJfg5AN4450fn1Hd1Rm1aBLu22Dy3y3H2+OqMemkbGZ4jozcDjJf6596xOLpC0eMTHbKnxLxH27uZ/bMTGs2jOaMOY4m87CfQwF0dw53oa1k80JRuz/XgS+8fX3N9Af4qPIMfzKgCp4H5TDGe9GGeFPzSsZz80SlPTxXjgwJmC45njzgt2vbQ4b4OAdUK4/vWhO8d8v6EE8fMUsfakXbPpFJeLs2ubM/qdm/la3WP91uWhxXHjoWhyRUq2iJ/+5mA73zwIIo+LoZ/SgvIRjAd1IMvvn98PfgOvAJfhhm8scAKVWDuaRaK8aQ9f7vuPDH6Bj47ZXau7rqYJ66mTDwEDU6lLbCjCK0qTXyl5mnDoeNRxanj3FJbaksTk0faXxHxLrssgPkWB9LnA/MFleXcJozzjwsUvUG0X/QCve51qkMDXp9mtcyOy3rwBfdvVJK7D6/ACSzg3RoruIq5UDeESfEmVclDxnniU82vxMLtceD0hGZWzBNPMM/jSPne2OVatiTKUpY5vY7gc0LdUAWeWM5tH+O2I66AOWw9xT2BuyRVLGdoDHUsVRXOo/c+ZdRXvFfnxWyIV4upFLCl9eAL7h8Zv0QH8Ry8pA2cHzQpGesctVA37ZtklBTgHjyvdSeKY/RZw/kJMk0Y25cSNRWSigQtlULPTw+kzuJPeYEkXjQRpoGZobYsLF79pyd1dMRHInbgFTZqNLhDqiIsTNpoex2WLcy0/X6rHcdMMQvFSd5dWA++4P7xv89deACnmr36uGlL69bRCL6BSZsS6c0TU2TKK5gtWCzgAOOwQcurqk9j8whvziZSMLcq5hbuwBEsYjopUBkqw1yYBGpLA97SRElEmx5MCInBY5vgLk94iKqSWmhIGmkJ4Bi9m4L645J68LyY4wsFYBfUg5feP/6gWWm58IEmKQM89hq7KsZNaKtP5TxxrUZZVkNmMJtjbKrGxLNEbHPJxhqy7lAmbC32ZqeF6lTaknRWcYaFpfLUBh/rwaQycCCJmW15Kstv6jRHyJFry2C1ahkkIW0LO75s61+owxK1y3XqweX9m5YLM2DPFeOjn/iiqCKJ+yKXF8t5Yl/kNsqaSCryxPq5xWTFIaP8KSW0RYxqupaUf0RcTNSSdJZGcKYdYA6kdtrtmyBckfKXwqk0pHpUHlwWaffjNRBYFPUDWa8e3Lt/o0R0CdisKDM89cX0pvRHEfM8ca4t0s2Xx4kgo91MPQJ/0c9MQYq0co8MBh7bz1fio0UUHLR4aAIOvOmoYO6kwlEVODSSTliWtOtH6sPkrtctF9ZtJ9GIerBskvhdVS5cFNv9s1BU0AbdUgdK4FG+dRnjFmDTzniRMdZO1QhzMK355vigbdkpz9P6qjUGE5J2qAcXmwJ20cZUiAD0z+pGMx6xkzJkmEf40Hr4qZfVg2XzF9YOyoV5BjzVkUJngKf8lgNYwKECEHrCNDrWZzMlflS3yBhr/InyoUgBc/lKT4pxVrrC6g1YwcceK3BmNxZcAtz3j5EIpqguh9H6wc011YN75cKDLpFDxuwkrPQmUwW4KTbj9mZTwBwLq4aQMUZbHm1rylJ46dzR0dua2n3RYCWZsiHROeywyJGR7mXKlpryyCiouY56sFkBWEnkEB/raeh/Sw4162KeuAxMQpEkzy5alMY5wamMsWKKrtW2WpEWNnReZWONKWjrdsKZarpFjqCslq773PLmEhM448Pc3+FKr1+94vv/rfw4tEcu+lKTBe4kZSdijBrykwv9vbCMPcLQTygBjzVckSLPRVGslqdunwJ4oegtFOYb4SwxNgWLCmD7T9kVjTv5YDgpo0XBmN34Z/rEHp0sgyz7lngsrm4lvMm2Mr1zNOJYJ5cuxuQxwMGJq/TP5emlb8fsQBZviK4t8hFL+zbhtlpwaRSxQRWfeETjuauPsdGxsBVdO7nmP4xvzSoT29pRl7kGqz+k26B3Oy0YNV+SXbbQas1ctC/GarskRdFpKczVAF1ZXnLcpaMuzVe6lZ2g/1ndcvOVgRG3sdUAY1bKD6achijMPdMxV4muKVorSpiDHituH7rSTs7n/4y5DhRXo4FVBN4vO/zbAcxhENzGbHCzU/98Mcx5e7a31kWjw9FCe/zNeYyQjZsWb1uc7U33pN4Mji6hCLhivqfa9Ss6xLg031AgfesA/l99m9fgvnaF9JoE6bYKmkGNK3aPbHB96w3+DnxFm4hs0drLsk7U8kf/N/CvwQNtllna0rjq61sH8L80HAuvwH1tvBy2ChqWSCaYTaGN19sTvlfzFD6n+iKTbvtayfrfe9ueWh6GJFoxLdr7V72a5ZpvHcCPDzma0wTO4EgbLyedxstO81n57LYBOBzyfsOhUKsW1J1BB5vr/tz8RyqOFylQP9Tvst2JALsC5lsH8PyQ40DV4ANzYa4dedNiKNR1s+x2wwbR7q4/4cTxqEk4LWDebfisuo36JXLiWFjOtLrlNWh3K1rRS4xvHcDNlFnNmWBBAl5SWaL3oPOfnvbr5pdjVnEaeBJSYjuLEkyLLsWhKccadmOphZkOPgVdalj2QpSmfOsADhMWE2ZBu4+EEJI4wKTAuCoC4xwQbWXBltpxbjkXJtKxxabo9e7tyhlgb6gNlSbUpMh+l/FaqzVwewGu8BW1Zx7pTpQDJUjb8tsUTW6+GDXbMn3mLbXlXJiGdggxFAoUrtPS3wE4Nk02UZG2OOzlk7fRs7i95QCLo3E0jtrjnM7SR3uS1p4qtS2nJ5OwtQVHgOvArLBFijZUV9QtSl8dAY5d0E0hM0w3HS2DpIeB6m/A1+HfhJcGUq4sOxH+x3f5+VO+Ds9rYNI7zPXOYWPrtf8bYMx6fuOAX5jzNR0PdsuON+X1f7EERxMJJoU6GkTEWBvVolVlb5lh3tKCg6Wx1IbaMDdJ+9sUCc5KC46hKGCk3IVOS4TCqdBNfUs7Kd4iXf2RjnT/LLysJy3XDcHLh/vde3x8DoGvwgsa67vBk91G5Pe/HbOe7xwym0NXbtiuuDkGO2IJDh9oQvJ4cY4vdoqLDuoH9Zl2F/ofsekn8lkuhIlhQcffUtSjytFyp++p6NiE7Rqx/lodgKVoceEp/CP4FfjrquZaTtj2AvH5K/ywpn7M34K/SsoYDAdIN448I1/0/wveW289T1/lX5xBzc8N5IaHr0XMOQdHsIkDuJFifj20pBm5jzwUv9e2FhwRsvhAbalCIuIw3bhJihY3p6nTFFIZgiSYjfTf3aXuOjmeGn4bPoGvwl+CFzTRczBIuHBEeImHc37/lGfwZR0cXzVDOvaKfNHvwe+suZ771K/y/XcBlsoN996JpBhoE2toYxOznNEOS5TJc6Id5GEXLjrWo+LEWGNpPDU4WAwsIRROu+1vM+0oW37z/MBN9kqHnSArwPfgFJ7Cq/Ai3Ie7g7ncmI09v8sjzw9mzOAEXoIHxURueaAce5V80f/DOuuZwHM8vsMb5wBzOFWM7wymTXPAEvm4vcFpZ2ut0VZRjkiP2MlmLd6DIpbGSiHOjdnUHN90hRYmhTnmvhzp1iKDNj+b7t5hi79lWGwQ+HN9RsfFMy0FXbEwhfuczKgCbyxYwBmcFhhvo/7a44v+i3XWcwDP86PzpGQYdWh7csP5dBvZ1jNzdxC8pBGuxqSW5vw40nBpj5JhMwvOzN0RWqERHMr4Lv1kWX84xLR830G3j6yqZ1a8UstTlW+qJPOZ+sZ7xZPKTJLhiNOAFd6tk+jrTH31ncLOxid8+nzRb128HhUcru/y0Wn6iT254YPC6FtVSIMoW2sk727AhvTtrWKZTvgsmckfXYZWeNRXx/3YQ2OUxLDrbHtN11IwrgXT6c8dATDwLniYwxzO4RzuQqTKSC5gAofMZ1QBK3zQ4JWobFbcvJm87FK+6JXrKahLn54m3p+McXzzYtP8VF/QpJuh1OwieElEoI1pRxPS09FBrkq2tWCU59+HdhNtTIqKm8EBrw2RTOEDpG3IKo2Y7mFdLm3ZeVjYwVw11o/oznceMve4CgMfNym/utA/d/ILMR7gpXzRy9eDsgLcgbs8O2Va1L0zzIdwGGemTBuwROHeoMShkUc7P+ISY3KH5ZZeWqO8mFTxQYeXTNuzvvK5FGPdQfuu00DwYFY9dyhctEt+OJDdnucfpmyhzUJzfsJjr29l8S0bXBfwRS9ZT26tmMIdZucch5ZboMz3Nio3nIOsYHCGoDT4kUA9MiXEp9Xsui1S8th/kbWIrMBxDGLodWUQIWcvnXy+9M23xPiSMOiRPqM+YMXkUN3gXFrZJwXGzUaMpJfyRS9ZT0lPe8TpScuRlbMHeUmlaKDoNuy62iWNTWNFYjoxFzuJs8oR+RhRx7O4SVNSXpa0ZJQ0K1LAHDQ+D9IepkMXpcsq5EVCvClBUIzDhDoyKwDw1Lc59GbTeORivugw1IcuaEOaGWdNm+Ps5fQ7/tm0DjMegq3yM3vb5j12qUId5UZD2oxDSEWOZMSqFl/W+5oynWDa/aI04tJRQ2eTXusg86SQVu/nwSYwpW6wLjlqIzwLuxGIvoAvul0PS+ZNz0/akp/pniO/8JDnGyaCkzbhl6YcqmK/69prxPqtpx2+Km9al9sjL+rwMgHw4jE/C8/HQ3m1vBuL1fldbzd8mOueVJ92syqdEY4KJjSCde3mcRw2TA6szxedn+zwhZMps0XrqEsiUjnC1hw0TELC2Ek7uAAdzcheXv1BYLagspxpzSAoZZUsIzIq35MnFQ9DOrlNB30jq3L4pkhccKUAA8/ocvN1Rzx9QyOtERs4CVsJRK/DF71kPYrxYsGsm6RMh4cps5g1DOmM54Ly1ii0Hd3Y/BMk8VWFgBVmhqrkJCPBHAolwZaWzLR9Vb7bcWdX9NyUYE+uB2BKfuaeBUcjDljbYVY4DdtsVWvzRZdWnyUzDpjNl1Du3aloAjVJTNDpcIOVVhrHFF66lLfJL1zJr9PQ2nFJSBaKoDe+sAvLufZVHVzYh7W0h/c6AAZ+7Tvj6q9j68G/cTCS/3n1vLKHZwNi+P+pS0WkZNMBMUl+LDLuiE4omZy71r3UFMwNJV+VJ/GC5ixVUkBStsT4gGKh0Gm4Oy3qvq7Lbmq24nPdDuDR9deR11XzP4vFu3TYzfnIyiSVmgizUYGqkIXNdKTY9pgb9D2Ix5t0+NHkVzCdU03suWkkVZAoCONCn0T35gAeW38de43mf97sMOpSvj4aa1KYUm58USI7Wxxes03bAZdRzk6UtbzMaCQ6IxO0dy7X+XsjoD16hpsBeGz9dfzHj+R/Hp8nCxZRqkEDTaCKCSywjiaoMJ1TITE9eg7Jqnq8HL6gDwiZb0u0V0Rr/rmvqjxKuaLCX7ZWXTvAY+uvm3z8CP7nzVpngqrJpZKwWnCUjIviYVlirlGOzPLI3SMVyp/elvBUjjDkNhrtufFFErQ8pmdSlbK16toBHlt/HV8uHMX/vEGALkV3RJREiSlopxwdMXOZPLZ+ix+kAHpMKIk8UtE1ygtquttwxNhphrIZ1IBzjGF3IIGxGcBj6q8bHJBG8T9vdsoWrTFEuebEZuVxhhClH6P5Zo89OG9fwHNjtNQTpD0TG9PJLEYqvEY6Rlxy+ZZGfL0Aj62/bnQCXp//eeM4KzfQVJbgMQbUjlMFIm6TpcfWlZje7NBSV6IsEVmumWIbjiloUzQX9OzYdo8L1wjw2PrrpimONfmfNyzKklrgnEkSzT5QWYQW40YShyzqsRmMXbvVxKtGuYyMKaU1ugenLDm5Ily4iT14fP11Mx+xJv+zZ3MvnfdFqxU3a1W/FTB4m3Qfsyc1XUcdVhDeUDZXSFHHLQj/Y5jtC7ZqM0CXGwB4bP11i3LhOvzPGygYtiUBiwQV/4wFO0majijGsafHyRLu0yG6q35cL1rOpVxr2s5cM2jJYMCdc10Aj6q/blRpWJ//+dmm5psMl0KA2+AFRx9jMe2WbC4jQxnikd4DU8TwUjRVacgdlhmr3bpddzuJ9zXqr2xnxJfzP29RexdtjDVZqzkqa6PyvcojGrfkXiJ8SEtml/nYskicv0ivlxbqjemwUjMw5evdg8fUX9nOiC/lf94Q2i7MURk9nW1MSj5j8eAyV6y5CN2S6qbnw3vdA1Iwq+XOSCl663udN3IzLnrt+us25cI1+Z83SXQUldqQq0b5XOT17bGpLd6ssN1VMPf8c+jG8L3NeCnMdF+Ra3fRa9dft39/LuZ/3vwHoHrqGmQFafmiQw6eyzMxS05K4bL9uA+SKUQzCnSDkqOGokXyJvbgJ/BHI+qvY69//4rl20NsmK2ou2dTsyIALv/91/8n3P2Aao71WFGi8KKv1fRC5+J67Q/507/E/SOshqN5TsmYIjVt+kcjAx98iz/4SaojbIV1rexE7/C29HcYD/DX4a0rBOF5VTu7omsb11L/AWcVlcVZHSsqGuXLLp9ha8I//w3Mv+T4Ew7nTBsmgapoCrNFObIcN4pf/Ob/mrvHTGqqgAupL8qWjWPS9m/31jAe4DjA+4+uCoQoT/zOzlrNd3qd4SdphFxsUvYwGWbTWtISc3wNOWH+kHBMfc6kpmpwPgHWwqaSUG2ZWWheYOGQGaHB+eQ/kn6b3pOgLV+ODSn94wDvr8Bvb70/LLuiPPEr8OGVWfDmr45PZyccEmsVXZGe1pRNX9SU5+AVQkNTIVPCHF/jGmyDC9j4R9LfWcQvfiETmgMMUCMN1uNCakkweZsowdYobiMSlnKA93u7NzTXlSfe+SVbfnPQXmg9LpYAQxpwEtONyEyaueWM4FPjjyjG3uOaFmBTWDNgBXGEiQpsaWhnAqIijB07Dlsy3fUGeP989xbWkyf+FF2SNEtT1E0f4DYYVlxFlbaSMPIRMk/3iMU5pME2SIWJvjckciebkQuIRRyhUvkHg/iUljG5kzVog5hV7vIlCuBrmlhvgPfNHQM8lCf+FEGsYbMIBC0qC9a0uuy2wLXVbLBaP5kjHokCRxapkQyzI4QEcwgYHRZBp+XEFTqXFuNVzMtjXLJgX4gAid24Hjwc4N3dtVSe+NNiwTrzH4WVUOlDobUqr1FuAgYllc8pmzoVrELRHSIW8ViPxNy4xwjBpyR55I6J220qQTZYR4guvUICJiSpr9gFFle4RcF/OMB7BRiX8sSfhpNSO3lvEZCQfLUVTKT78Ek1LRLhWN+yLyTnp8qWUZ46b6vxdRGXfHVqx3eI75YaLa4iNNiK4NOW7wPW6lhbSOF9/M9qw8e/aoB3d156qTzxp8pXx5BKAsYSTOIIiPkp68GmTq7sZtvyzBQaRLNxIZ+paozHWoLFeExIhRBrWitHCAHrCF7/thhD8JhYz84wg93QRV88wLuLY8zF8sQ36qF1J455bOlgnELfshKVxYOXKVuKx0jaj22sczTQqPqtV/XDgpswmGTWWMSDw3ssyUunLLrVPGjYRsH5ggHeHSWiV8kT33ycFSfMgkoOK8apCye0J6VW6GOYvffgU9RWsukEi2kUV2nl4dOYUzRik9p7bcA4ggdJ53LxKcEe17B1R8eqAd7dOepV8sTXf5lhejoL85hUdhDdknPtKHFhljOT+bdq0hxbm35p2nc8+Ja1Iw+tJykgp0EWuAAZYwMVwac5KzYMslhvgHdHRrxKnvhTYcfKsxTxtTETkjHO7rr3zjoV25lAQHrqpV7bTiy2aXMmUhTBnKS91jhtR3GEoF0oLnWhWNnYgtcc4N0FxlcgT7yz3TgNIKkscx9jtV1ZKpWW+Ub1tc1eOv5ucdgpx+FJy9pgbLE7xDyXb/f+hLHVGeitHOi6A7ybo3sF8sS7w7cgdk0nJaOn3hLj3uyD0Zp5pazFIUXUpuTTU18d1EPkDoX8SkmWTnVIozEdbTcZjoqxhNHf1JrSS/AcvHjZ/SMHhL/7i5z+POsTUh/8BvNfYMTA8n+yU/MlTZxSJDRStqvEuLQKWwDctMTQogUDyQRoTQG5Kc6oQRE1yV1jCA7ri7jdZyK0sYTRjCR0Hnnd+y7nHxNgTULqw+8wj0mQKxpYvhjm9uSUxg+TTy7s2GtLUGcywhXSKZN275GsqlclX90J6bRI1aouxmgL7Q0Nen5ziM80SqMIo8cSOo+8XplT/5DHNWsSUr/6lLN/QQ3rDyzLruEW5enpf7KqZoShEduuSFOV7DLX7Ye+GmXb6/hnNNqKsVXuMDFpb9Y9eH3C6NGEzuOuI3gpMH/I6e+zDiH1fXi15t3vA1czsLws0TGEtmPEJdiiFPwlwKbgLHAFk4P6ZyPdymYYHGE0dutsChQBl2JcBFlrEkY/N5bQeXQ18gjunuMfMfsBlxJSx3niO485fwO4fGD5T/+3fPQqkneWVdwnw/3bMPkW9Wbqg+iC765Zk+xcT98ibKZc2EdgHcLoF8cSOo/Oc8fS+OyEULF4g4sJqXVcmfMfsc7A8v1/yfGXmL9I6Fn5pRwZhsPv0TxFNlAfZCvG+Oohi82UC5f/2IsJo0cTOm9YrDoKhFPEUr/LBYTUNht9zelHXDqwfPCIw4owp3mOcIQcLttWXFe3VZ/j5H3cIc0G6oPbCR+6Y2xF2EC5cGUm6wKC5tGEzhsWqw5hNidUiKX5gFWE1GXh4/Qplw4sVzOmx9QxU78g3EF6wnZlEN4FzJ1QPSLEZz1KfXC7vd8ssGdIbNUYpVx4UapyFUHzJoTOo1McSkeNn1M5MDQfs4qQuhhX5vQZFw8suwWTcyYTgioISk2YdmkhehG4PkE7w51inyAGGaU+uCXADabGzJR1fn3lwkty0asIo8cROm9Vy1g0yDxxtPvHDAmpu+PKnM8Ix1wwsGw91YJqhteaWgjYBmmQiebmSpwKKzE19hx7jkzSWOm66oPbzZ8Yj6kxVSpYjVAuvLzYMCRo3oTQecOOjjgi3NQ4l9K5/hOGhNTdcWVOTrlgYNkEXINbpCkBRyqhp+LdRB3g0OU6rMfW2HPCFFMV9nSp+uB2woepdbLBuJQyaw/ZFysXrlXwHxI0b0LovEkiOpXGA1Ijagf+KUNC6rKNa9bQnLFqYNkEnMc1uJrg2u64ELPBHpkgWbmwKpJoDhMwNbbGzAp7Yg31wS2T5rGtzit59PrKhesWG550CZpHEzpv2NGRaxlNjbMqpmEIzygJqQfjypycs2pg2cS2RY9r8HUqkqdEgKTWtWTKoRvOBPDYBltja2SO0RGjy9UHtxwRjA11ujbKF+ti5cIR9eCnxUg6owidtyoU5tK4NLji5Q3HCtiyF2IqLGYsHViOXTXOYxucDqG0HyttqYAKqYo3KTY1ekyDXRAm2AWh9JmsVh/ccg9WJ2E8YjG201sPq5ULxxX8n3XLXuMInbft2mk80rRGjCGctJ8/GFdmEQ9Ug4FlE1ll1Y7jtiraqm5Fe04VV8lvSVBL8hiPrfFVd8+7QH3Qbu2ipTVi8cvSGivc9cj8yvH11YMHdNSERtuOslM97feYFOPKzGcsI4zW0YGAbTAOaxCnxdfiYUmVWslxiIblCeAYr9VYR1gM7GmoPrilunSxxeT3DN/2eBQ9H11+nk1adn6VK71+5+Jfct4/el10/7KBZfNryUunWSCPxPECk1rdOv1WVSrQmpC+Tl46YD3ikQYcpunSQgzVB2VHFhxHVGKDgMEY5GLlQnP7FMDzw7IacAWnO6sBr12u+XanW2AO0wQ8pknnFhsL7KYIqhkEPmEXFkwaN5KQphbkUmG72wgw7WSm9RiL9QT925hkjiVIIhphFS9HKI6/8QAjlpXqg9W2C0apyaVDwKQwrwLY3j6ADR13ZyUNByQXHQu6RY09Hu6zMqXRaNZGS/KEJs0cJEe9VH1QdvBSJv9h09eiRmy0V2uJcqHcShcdvbSNg5fxkenkVprXM9rDVnX24/y9MVtncvbKY706anNl3ASll9a43UiacVquXGhvq4s2FP62NGKfQLIQYu9q1WmdMfmUrDGt8eDS0cXozH/fjmUH6Jruvm50hBDSaEU/2Ru2LEN/dl006TSc/g7tfJERxGMsgDUEr104pfWH9lQaN+M4KWQjwZbVc2rZVNHsyHal23wZtIs2JJqtIc/WLXXRFCpJkfE9jvWlfFbsNQ9pP5ZBS0zKh4R0aMFj1IjTcTnvi0Zz2rt7NdvQb2mgbju1plsH8MmbnEk7KbK0b+wC2iy3aX3szW8xeZvDwET6hWZYwqTXSSG+wMETKum0Dq/q+x62gt2ua2ppAo309TRk9TPazfV3qL9H8z7uhGqGqxNVg/FKx0HBl9OVUORn8Q8Jx9gFttGQUDr3tzcXX9xGgN0EpzN9mdZ3GATtPhL+CjxFDmkeEU6x56kqZRusLzALXVqkCN7zMEcqwjmywDQ6OhyUe0Xao1Qpyncrg6wKp9XfWDsaZplElvQ/b3sdweeghorwBDlHzgk1JmMc/wiERICVy2VJFdMjFuLQSp3S0W3+sngt2njwNgLssFGVQdJ0tu0KH4ky1LW4yrbkuaA6Iy9oz/qEMMXMMDWyIHhsAyFZc2peV9hc7kiKvfULxCl9iddfRK1f8kk9qvbdOoBtOg7ZkOZ5MsGrSHsokgLXUp9y88smniwWyuFSIRVmjplga3yD8Uij5QS1ZiM4U3Qw5QlSm2bXjFe6jzzBFtpg+/YBbLAWG7OPynNjlCw65fukGNdkJRf7yM1fOxVzbxOJVocFoYIaGwH22mIQkrvu1E2nGuebxIgW9U9TSiukPGU+Lt++c3DJPKhyhEEbXCQLUpae2exiKy6tMPe9mDRBFCEMTWrtwxN8qvuGnt6MoihKWS5NSyBhbH8StXoAz8PLOrRgLtOT/+4vcu+7vDLnqNvztOq7fmd8sMmY9Xzn1zj8Dq8+XVdu2Nv0IIySgEdQo3xVHps3Q5i3fLFsV4aiqzAiBhbgMDEd1uh8qZZ+lwhjkgokkOIv4xNJmyncdfUUzgB4oFMBtiu71Xumpz/P+cfUP+SlwFExwWW62r7b+LSPxqxn/gvMZ5z9C16t15UbNlq+jbGJtco7p8wbYlL4alSyfWdeuu0j7JA3JFNuVAwtst7F7FhWBbPFNKIUORndWtLraFLmMu7KFVDDOzqkeaiN33YAW/r76wR4XDN/yN1z7hejPau06EddkS/6XThfcz1fI/4K736fO48vlxt2PXJYFaeUkFS8U15XE3428xdtn2kc8GQlf1vkIaNRRnOMvLTWrZbElEHeLWi1o0dlKPAh1MVgbbVquPJ5+Cr8LU5/H/+I2QlHIU2ClXM9G8v7Rr7oc/hozfUUgsPnb3D+I+7WF8kNO92GY0SNvuxiE+2Bt8prVJTkzE64sfOstxuwfxUUoyk8VjcTlsqe2qITSFoSj6Epd4KsT6BZOWmtgE3hBfir8IzZDwgV4ZTZvD8VvPHERo8v+vL1DASHTz/i9OlKueHDjK5Rnx/JB1Vb1ioXdBra16dmt7dgik10yA/FwJSVY6XjA3oy4SqM2frqDPPSRMex9qs3XQtoWxMj7/Er8GWYsXgjaVz4OYumP2+9kbxvny/6kvWsEBw+fcb5bInc8APdhpOSs01tEqIkoiZjbAqKMruLbJYddHuHFRIyJcbdEdbl2sVLaySygunutBg96Y2/JjKRCdyHV+AEFtTvIpbKIXOamknYSiB6KV/0JetZITgcjjk5ZdaskBtWO86UF0ap6ozGXJk2WNiRUlCPFir66lzdm/SLSuK7EUdPz8f1z29Skq6F1fXg8+5UVR6bszncP4Tn4KUkkdJ8UFCY1zR1i8RmL/qQL3rlei4THG7OODlnKko4oI01kd3CaM08Ia18kC3GNoVaO9iDh+hWxSyTXFABXoau7Q6q9OxYg/OVEMw6jdbtSrJ9cBcewGmaZmg+bvkUnUUaGr+ZfnMH45Ivevl61hMcXsxYLFTu1hTm2zViCp7u0o5l+2PSUh9bDj6FgYypufBDhqK2+oXkiuHFHR3zfj+9PtA8oR0xnqX8qn+sx3bFODSbbF0X8EUvWQ8jBIcjo5bRmLOljDNtcqNtOe756h3l0VhKa9hDd2l1eqmsnh0MNMT/Cqnx6BInumhLT8luljzQ53RiJeA/0dxe5NK0o2fA1+GLXr6eNQWHNUOJssQaTRlGpLHKL9fD+IrQzTOMZS9fNQD4AnRNVxvTdjC+fJdcDDWQcyB00B0t9BDwTxXgaAfzDZ/DBXzRnfWMFRwuNqocOmX6OKNkY63h5n/fFcB28McVHqnXZVI27K0i4rDLNE9lDKV/rT+udVbD8dFFu2GGZ8mOt0kAXcoX3ZkIWVtw+MNf5NjR2FbivROHmhV1/pj2egv/fMGIOWTIWrV3Av8N9imV9IWml36H6cUjqEWNv9aNc+veb2sH46PRaHSuMBxvtW+twxctq0z+QsHhux8Q7rCY4Ct8lqsx7c6Sy0dl5T89rIeEuZKoVctIk1hNpfavER6yyH1Vvm3MbsUHy4ab4hWr/OZPcsRBphnaV65/ZcdYPNNwsjN/djlf9NqCw9U5ExCPcdhKxUgLSmfROpLp4WSUr8ojdwbncbvCf+a/YzRaEc6QOvXcGO256TXc5Lab9POvB+AWY7PigWYjzhifbovuunzRawsO24ZqQQAqguBtmpmPB7ysXJfyDDaV/aPGillgz1MdQg4u5MYaEtBNNHFjkRlSpd65lp4hd2AVPTfbV7FGpyIOfmNc/XVsPfg7vzaS/3nkvLL593ANLvMuRMGpQIhiF7kUEW9QDpAUbTWYBcbp4WpacHHY1aacqQyjGZS9HI3yCBT9kUZJhVOD+zUDvEH9ddR11fzPcTDQ5TlgB0KwqdXSavk9BC0pKp0WmcuowSw07VXmXC5guzSa4p0UvRw2lbDiYUx0ExJJRzWzi6Gm8cnEkfXXsdcG/M/jAJa0+bmCgdmQ9CYlNlSYZOKixmRsgiFxkrmW4l3KdFKv1DM8tk6WxPYJZhUUzcd8Kdtgrw/gkfXXDT7+avmfVak32qhtkg6NVdUS5wgkru1YzIkSduTW1FDwVWV3JQVJVuieTc0y4iDpFwc7/BvSalvKdQM8sv662cevz/+8sQVnjVAT0W2wLllw1JiMhJRxgDjCjLQsOzSFSgZqx7lAW1JW0e03yAD3asC+GD3NbQhbe+mN5GXH1F83KDOM4n/e5JIuH4NpdQARrFPBVptUNcjj4cVMcFSRTE2NpR1LEYbYMmfWpXgP9KejaPsLUhuvLCsVXznAG9dfx9SR1ud/3hZdCLHb1GMdPqRJgqDmm76mHbvOXDtiO2QPUcKo/TWkQ0i2JFXpBoo7vij1i1Lp3ADAo+qvG3V0rM//vFnnTE4hxd5Ka/Cor5YEdsLVJyKtDgVoHgtW11pWSjolPNMnrlrVj9Fv2Qn60twMwKPqr+N/wvr8z5tZcDsDrv06tkqyzESM85Ycv6XBWA2birlNCXrI6VbD2lx2L0vQO0QVTVVLH4SE67fgsfVXv8n7sz7/85Z7cMtbE6f088wSaR4kCkCm10s6pKbJhfqiUNGLq+0gLWC6eUAZFPnLjwqtKd8EwGvWX59t7iPW4X/eAN1svgRVSY990YZg06BD1ohLMtyFTI4pKTJsS9xREq9EOaPWiO2gpms7397x6nQJkbh+Fz2q/rqRROX6/M8bJrqlVW4l6JEptKeUFuMYUbtCQ7CIttpGc6MY93x1r1vgAnRXvY5cvwWPqb9uWQm+lP95QxdNMeWhOq1x0Db55C7GcUv2ZUuN6n8iKzsvOxibC//Yfs9Na8r2Rlz02vXXDT57FP/zJi66/EJSmsJKa8QxnoqW3VLQ+jZVUtJwJ8PNX1NQCwfNgdhhHD9on7PdRdrdGPF28rJr1F+3LBdeyv+8yYfLoMYet1vX4upNAjVvwOUWnlNXJXlkzk5Il6kqeoiL0C07qno+/CYBXq/+utlnsz7/Mzvy0tmI4zm4ag23PRN3t/CWryoUVJGm+5+K8RJ0V8Hc88/XHUX/HfiAq7t+BH+x6v8t438enWmdJwFA6ZINriLGKv/95f8lT9/FnyA1NMVEvQyaXuu+gz36f/DD73E4pwqpLcvm/o0Vle78n//+L/NPvoefp1pTJye6e4A/D082FERa5/opeH9zpvh13cNm19/4v/LDe5xMWTi8I0Ta0qKlK27AS/v3/r+/x/2GO9K2c7kVMonDpq7//jc5PKCxeNPpFVzaRr01wF8C4Pu76hXuX18H4LduTr79guuFD3n5BHfI+ZRFhY8w29TYhbbLi/bvBdqKE4fUgg1pBKnV3FEaCWOWyA+m3WpORZr/j+9TKJtW8yBTF2/ZEODI9/QavHkVdGFp/Pjn4Q+u5hXapsP5sOH+OXXA1LiKuqJxiMNbhTkbdJTCy4llEt6NnqRT4dhg1V3nbdrm6dYMecA1yTOL4PWTE9L5VzPFlLBCvlG58AhehnN4uHsAYinyJ+AZ/NkVvELbfOBUuOO5syBIEtiqHU1k9XeISX5bsimrkUUhnGDxourN8SgUsCZVtKyGbyGzHXdjOhsAvOAswSRyIBddRdEZWP6GZhNK/yjwew9ehBo+3jEADu7Ay2n8mDc+TS7awUHg0OMzR0LABhqLD4hJEh/BEGyBdGlSJoXYXtr+3HS4ijzVpgi0paWXtdruGTknXBz+11qT1Q2inxaTzQCO46P3lfLpyS4fou2PH/PupwZgCxNhGlj4IvUuWEsTkqMWm6i4xCSMc9N1RDQoCVcuGItJ/MRWefais+3synowi/dESgJjkilnWnBTGvRWmaw8oR15257t7CHmCf8HOn7cwI8+NQBXMBEmAa8PMRemrNCEhLGEhDQKcGZWS319BX9PFBEwGTbRBhLbDcaV3drFcDqk5kCTd2JF1Wp0HraqBx8U0wwBTnbpCadwBA/gTH/CDrcCs93LV8E0YlmmcyQRQnjBa8JESmGUfIjK/7fkaDJpmD2QptFNVJU1bbtIAjjWQizepOKptRjbzR9Kag6xZmMLLjHOtcLT3Tx9o/0EcTT1XN3E45u24AiwEypDJXihKjQxjLprEwcmRKclaDNZCVqr/V8mYWyFADbusiY5hvgFoU2vio49RgJLn5OsReRFN6tabeetiiy0V7KFHT3HyZLx491u95sn4K1QQSPKM9hNT0wMVvAWbzDSVdrKw4zRjZMyJIHkfq1VAVCDl/bUhNKlGq0zGr05+YAceXVPCttVk0oqjVwMPt+BBefx4yPtGVkUsqY3CHDPiCM5ngupUwCdbkpd8kbPrCWHhkmtIKLEetF2499eS1jZlIPGYnlcPXeM2KD9vLS0bW3ktYNqUllpKLn5ZrsxlIzxvDu5eHxzGLctkZLEY4PgSOg2IUVVcUONzUDBEpRaMoXNmUc0tFZrTZquiLyKxrSm3DvIW9Fil+AkhXu5PhEPx9mUNwqypDvZWdKlhIJQY7vn2OsnmBeOWnYZ0m1iwbbw1U60by5om47iHRV6fOgzjMf/DAZrlP40Z7syxpLK0lJ0gqaAK1c2KQKu7tabTXkLFz0sCftuwX++MyNeNn68k5Buq23YQhUh0SNTJa1ioQ0p4nUG2y0XilF1JqODqdImloPS4Bp111DEWT0jJjVv95uX9BBV7eB3bUWcu0acSVM23YZdd8R8UbQUxJ9wdu3oMuhdt929ME+mh6JXJ8di2RxbTi6TbrDquqV4aUKR2iwT6aZbyOwEXN3DUsWr8Hn4EhwNyHuXHh7/pdaUjtR7vnDh/d8c9xD/s5f501eQ1+CuDiCvGhk1AN/4Tf74RfxPwD3toLarR0zNtsnPzmS64KIRk861dMWCU8ArasG9T9H0ZBpsDGnjtAOM2+/LuIb2iIUGXNgl5ZmKD/Tw8TlaAuihaFP5yrw18v4x1898zIdP+DDAX1bM3GAMvPgRP/cJn3zCW013nrhHkrITyvYuwOUkcHuKlRSW5C6rzIdY4ppnF7J8aAJbQepgbJYBjCY9usGXDKQxq7RZfh9eg5d1UHMVATRaD/4BHK93/1iAgYZ/+jqPn8Dn4UExmWrpa3+ZOK6MvM3bjwfzxNWA2dhs8+51XHSPJiaAhGSpWevEs5xHLXcEGFXYiCONySH3fPWq93JIsBiSWvWyc3CAN+EcXoT7rCSANloPPoa31rt/5PUA/gp8Q/jDD3hyrjzlR8VkanfOvB1XPubt17vzxAfdSVbD1pzAnfgyF3ycadOTOTXhpEUoLC1HZyNGW3dtmjeXgr2r56JNmRwdNNWaQVBddd6rh4MhviEB9EFRD/7RGvePvCbwAL4Mx/D6M541hHO4D3e7g6PafdcZVw689z7NGTwo5om7A8sPhccT6qKcl9NJl9aM/9kX+e59Hh1yPqGuCCZxuITcsmNaJ5F7d0q6J3H48TO1/+M57085q2icdu2U+W36Ldllz9Agiv4YGljoEN908EzvDOrBF98/vtJwCC/BF2AG75xxEmjmMIcjxbjoaxqOK3/4hPOZzhMPBpYPG44CM0dTVm1LjLtUWWVz1Bcf8tEx0zs8O2A2YVHRxKYOiy/aOVoAaMu0i7ubu43njjmd4ibMHU1sIDHaQNKrZND/FZYdk54oCXetjq7E7IVl9eAL7t+oHnwXXtLx44czzoRFHBztYVwtH1d+NOMkupZ5MTM+gUmq90X+Bh9zjRlmaQ+m7YMqUL/veemcecAtOJ0yq1JnVlN27di2E0+Klp1tAJ4KRw1eMI7aJjsO3R8kPSI3fUFXnIOfdQe86sIIVtWDL7h//Ok6vj8vwDk08NEcI8zz7OhBy+WwalzZeZ4+0XniRfst9pAJqQHDGLzVQ2pheZnnv1OWhwO43/AgcvAEXEVVpa4db9sGvNK8wjaENHkfFQ4Ci5i7dqnQlPoLQrHXZDvO3BIXZbJOBrOaEbML6sFL798I4FhKihjHMsPjBUZYCMFr6nvaArxqXPn4lCa+cHfSa2cP27g3Z3ziYTRrcbQNGLQmGF3F3cBdzzzX7AILx0IB9rbwn9kx2G1FW3Inic+ZLIsVvKR8Zwfj0l1fkqo8LWY1M3IX14OX3r9RKTIO+d9XzAI8qRPGPn/4NC2n6o4rN8XJ82TOIvuVA8zLKUHRFgBCetlDZlqR1gLKjS39xoE7Bt8UvA6BxuEDjU3tFsEijgA+615tmZkXKqiEENrh41iLDDZNq4pKTWR3LZfnos81LOuNa15cD956vLMsJd1rqYp51gDUQqMYm2XsxnUhD2jg1DM7SeuJxxgrmpfISSXVIJIS5qJJSvJPEQ49DQTVIbYWJ9QWa/E2+c/oPK1drmC7WSfJRNKBO5Yjvcp7Gc3dmmI/Xh1kDTEuiSnWqQf37h+fTMhGnDf6dsS8SQfQWlqqwXXGlc/PEZ/SC5mtzIV0nAshlQdM/LvUtYutrEZ/Y+EAFtq1k28zQhOwLr1AIeANzhF8t9qzTdZf2qRKO6MWE9ohBYwibbOmrFtNmg3mcS+tB28xv2uKd/agYCvOP+GkSc+0lr7RXzyufL7QbkUpjLjEWFLqOIkAGu2B0tNlO9Eau2W1qcOUvVRgKzypKIQZ5KI3q0MLzqTNRYqiZOqmtqloIRlmkBHVpHmRYV6/HixbO6UC47KOFJnoMrVyr7wYz+SlW6GUaghYbY1I6kkxA2W1fSJokUdSh2LQ1GAimRGm0MT+uu57H5l7QgOWxERpO9moLRPgTtquWCfFlGlIjQaRly9odmzMOWY+IBO5tB4sW/0+VWGUh32qYk79EidWKrjWuiLpiVNGFWFRJVktyeXWmbgBBzVl8anPuXyNJlBJOlKLTgAbi/EYHVHxWiDaVR06GnHQNpJcWcK2jJtiCfG2sEHLzuI66sGrMK47nPIInPnu799935aOK2cvmvubrE38ZzZjrELCmXM2hM7UcpXD2oC3+ECVp7xtIuxptJ0jUr3sBmBS47TVxlvJ1Sqb/E0uLdvLj0lLr29ypdd/eMX3f6lrxGlKwKQxEGvw0qHbkbwrF3uHKwVENbIV2wZ13kNEF6zD+x24aLNMfDTCbDPnEikZFyTNttxWBXDaBuM8KtI2rmaMdUY7cXcUPstqTGvBGSrFWIpNMfbdea990bvAOC1YX0qbc6smDS1mPxSJoW4fwEXvjMmhlijDRq6qale6aJEuFGoppYDoBELQzLBuh/mZNx7jkinv0EtnUp50lO9hbNK57lZaMAWuWR5Yo9/kYwcYI0t4gWM47Umnl3YmpeBPqSyNp3K7s2DSAS/39KRuEN2bS4xvowV3dFRMx/VFcp2Yp8w2nTO9hCXtHG1kF1L4KlrJr2wKfyq77R7MKpFKzWlY9UkhYxyHWW6nBWPaudvEAl3CGcNpSXPZ6R9BbBtIl6cHL3gIBi+42CYXqCx1gfGWe7Ap0h3luyXdt1MKy4YUT9xSF01G16YEdWsouW9mgDHd3veyA97H+Ya47ZmEbqMY72oPztCGvK0onL44AvgC49saZKkWRz4veWljE1FHjbRJaWv6ZKKtl875h4CziFCZhG5rx7tefsl0aRT1bMHZjm8dwL/6u7wCRysaQblQoG5yAQN5zpatMNY/+yf8z+GLcH/Qn0iX2W2oEfXP4GvwQHuIL9AYGnaO3zqAX6946nkgqZNnUhx43DIdQtMFeOPrgy/y3Yd85HlJWwjLFkU3kFwq28xPnuPhMWeS+tDLV9Otllq7pQCf3uXJDN9wFDiUTgefHaiYbdfi3b3u8+iY6TnzhgehI1LTe8lcd7s1wJSzKbahCRxKKztTLXstGAiu3a6rPuQs5pk9TWAan5f0BZmGf7Ylxzzk/A7PAs4QPPPAHeFQ2hbFHszlgZuKZsJcUmbDC40sEU403cEjczstOEypa+YxevL4QBC8oRYqWdK6b7sK25tfE+oDZgtOQ2Jg8T41HGcBE6fTWHn4JtHcu9S7uYgU5KSCkl/mcnq+5/YBXOEr6lCUCwOTOM1taOI8mSxx1NsCXBEmLKbMAg5MkwbLmpBaFOPrNSlO2HnLiEqW3tHEwd8AeiQLmn+2gxjC3k6AxREqvKcJbTEzlpLiw4rNZK6oJdidbMMGX9FULKr0AkW+2qDEPBNNm5QAt2Ik2nftNWHetubosHLo2nG4vQA7GkcVCgVCgaDixHqo9UUn1A6OshapaNR/LPRYFV8siT1cCtJE0k/3WtaNSuUZYKPnsVIW0xXWnMUxq5+En4Kvw/MqQmVXnAXj9Z+9zM98zM/Agy7F/qqj2Nh67b8HjFnPP3iBn/tkpdzwEJX/whIcQUXOaikeliCRGUk7tiwF0rItwMEhjkZ309hikFoRAmLTpEXWuHS6y+am/KB/fM50aLEhGnSMwkpxzOov4H0AvgovwJ1iGzDLtJn/9BU+fAINfwUe6FHSLhu83viV/+/HrOePX+STT2B9uWGbrMHHLldRBlhS/CJQmcRxJFqZica01XixAZsYiH1uolZxLrR/SgxVIJjkpQP4PE9sE59LKLr7kltSBogS5tyszzH8Fvw8/AS8rNOg0xUS9fIaHwb+6et8Q/gyvKRjf5OusOzGx8evA/BP4IP11uN/grca5O0lcsPLJ5YjwI4QkJBOHa0WdMZYGxPbh2W2nR9v3WxEWqgp/G3+6VZbRLSAAZ3BhdhAaUL33VUSw9yjEsvbaQ9u4A/gGXwZXoEHOuU1GSj2chf+Mo+f8IcfcAxfIKVmyunRbYQVnoevwgfw3TXXcw++xNuP4fhyueEUNttEduRVaDttddoP0eSxLe2LENk6itYxlrxBNBYrNNKSQmeaLcm9c8UsaB5WyO6675yyQIAWSDpBVoA/gxmcwEvwoDv0m58UE7gHn+fJOa8/Ywan8EKRfjsopF83eCglX/Sfr7OeaRoQfvt1CGvIDccH5BCvw1sWIzRGC/66t0VTcLZQZtm6PlAasbOJ9iwWtUo7biktTSIPxnR24jxP1ZKaqq+2RcXM9OrBAm/AAs7hDJ5bNmGb+KIfwCs8a3jnjBrOFeMjHSCdbKr+2uOLfnOd9eiA8Hvvwwq54VbP2OqwkB48Ytc4YEOiH2vTXqodabfWEOzso4qxdbqD5L6tbtNPECqbhnA708DZH4QOJUXqScmUlks7Ot6FBuZw3n2mEbaUX7kDzxHOOQk8nKWMzAzu6ZZ8sOFw4RK+6PcuXo9tB4SbMz58ApfKDXf3szjNIIbGpD5TKTRxGkEMLjLl+K3wlWXBsCUxIDU+jbOiysESqAy1MGUJpXgwbTWzNOVEziIXZrJ+VIztl1PUBxTSo0dwn2bOmfDRPD3TRTGlfbCJvO9KvuhL1hMHhB9wPuPRLGHcdOWG2xc0U+5bQtAJT0nRTewXL1pgk2+rZAdeWmz3jxAqfNQQdzTlbF8uJ5ecEIWvTkevAHpwz7w78QujlD/Lr491bD8/1vhM2yrUQRrWXNQY4fGilfctMWYjL72UL/qS9eiA8EmN88nbNdour+PBbbAjOjIa4iBhfFg6rxeKdEGcL6p3EWR1Qq2Qkhs2DrnkRnmN9tG2EAqmgPw6hoL7Oza7B+3SCrR9tRftko+Lsf2F/mkTndN2LmzuMcKTuj/mX2+4Va3ki16+nnJY+S7MefpkidxwnV+4wkXH8TKnX0tsYzYp29DOOoSW1nf7nTh2akYiWmcJOuTidSaqESrTYpwjJJNVGQr+rLI7WsqerHW6Kp/oM2pKuV7T1QY9gjqlZp41/WfKpl56FV/0kvXQFRyeQ83xaTu5E8p5dNP3dUF34ihyI3GSpeCsywSh22ZJdWto9winhqifb7VRvgktxp13vyjrS0EjvrRfZ62uyqddSWaWYlwTPAtJZ2oZ3j/Sgi/mi+6vpzesfAcWNA0n8xVyw90GVFGuZjTXEQy+6GfLGLMLL523f5E0OmxVjDoOuRiH91RKU+vtoCtH7TgmvBLvtFXWLW15H9GTdVw8ow4IlRLeHECN9ym1e9K0I+Cbnhgv4Yu+aD2HaQJ80XDqOzSGAV4+4yCqBxrsJAX6ZTIoX36QnvzhhzzMfFW2dZVLOJfo0zbce5OvwXMFaZ81mOnlTVXpDZsQNuoYWveketKb5+6JOOsgX+NTm7H49fUTlx+WLuWL7qxnOFh4BxpmJx0p2gDzA/BUARuS6phR+pUsY7MMboAHx5xNsSVfVZcYSwqCKrqon7zM+8ecCkeS4nm3rINuaWvVNnMRI1IRpxTqx8PZUZ0Br/UEduo3B3hNvmgZfs9gQPj8vIOxd2kndir3awvJ6BLvoUuOfFWNYB0LR1OQJoUySKb9IlOBx74q1+ADC2G6rOdmFdJcD8BkfualA+BdjOOzP9uUhGUEX/TwhZsUduwRr8wNuXKurCixLBgpQI0mDbJr9dIqUuV+92ngkJZ7xduCk2yZKbfWrH1VBiTg9VdzsgRjW3CVXCvAwDd+c1z9dWw9+B+8MJL/eY15ZQ/HqvTwVdsZn5WQsgRRnMaWaecu3jFvMBEmgg+FJFZsnSl0zjB9OqPYaBD7qmoVyImFvzi41usesV0julaAR9dfR15Xzv9sEruRDyk1nb+QaLU67T885GTls6YgcY+UiMa25M/pwGrbCfzkvR3e0jjtuaFtnwuagHTSb5y7boBH119HXhvwP487jJLsLJ4XnUkHX5sLbS61dpiAXRoZSCrFJ+EjpeU3puVfitngYNo6PJrAigKktmwjyQdZpfq30mmtulaAx9Zfx15Xzv+cyeuiBFUs9zq8Kq+XB9a4PVvph3GV4E3y8HENJrN55H1X2p8VyqSKwVusJDKzXOZzplWdzBUFK9e+B4+uv468xvI/b5xtSAkBHQaPvtqWzllVvEOxPbuiE6+j2pvjcKsbvI7txnRErgfH7LdXqjq0IokKzga14GzQ23SSbCQvO6r+Or7SMIr/efOkkqSdMnj9mBx2DRsiY29Uj6+qK9ZrssCKaptR6HKURdwUYeUWA2kPzVKQO8ku2nU3Anhs/XWkBx3F/7wJtCTTTIKftthue1ty9xvNYLY/zo5KSbIuKbXpbEdSyeRyYdAIwKY2neyoc3+k1XUaufYga3T9daMUx/r8z1s10ITknIO0kuoMt+TB8jK0lpayqqjsJ2qtXAYwBU932zinimgmd6mTRDnQfr88q36NAI+tv24E8Pr8zxtasBqx0+xHH9HhlrwsxxNUfKOHQaZBITNf0uccj8GXiVmXAuPEAKSdN/4GLHhs/XWj92dN/uetNuBMnVR+XWDc25JLjo5Mg5IZIq226tmCsip2zZliL213YrTlL2hcFjpCduyim3M7/eB16q/blQsv5X/esDRbtJeabLIosWy3ycavwLhtxdWzbMmHiBTiVjJo6lCLjXZsi7p9PEPnsq6X6wd4bP11i0rD5fzPm/0A6brrIsllenZs0lCJlU4abakR59enZKrKe3BZihbTxlyZ2zl1+g0wvgmA166/bhwDrcn/7Ddz0eWZuJvfSESug6NzZsox3Z04FIxz0mUjMwVOOVTq1CQ0AhdbBGVdjG/CgsfUX7esJl3K/7ytWHRv683praW/8iDOCqWLLhpljDY1ZpzK75QiaZoOTpLKl60auHS/97oBXrv+umU9+FL+5+NtLFgjqVLCdbmj7pY5zPCPLOHNCwXGOcLquOhi8CmCWvbcuO73XmMUPab+ug3A6/A/78Bwe0bcS2+tgHn4J5pyS2WbOck0F51Vq3LcjhLvZ67p1ABbaL2H67bg78BfjKi/jr3+T/ABV3ilLmNXTI2SpvxWBtt6/Z//D0z/FXaGbSBgylzlsEGp+5//xrd4/ae4d8DUUjlslfIYS3t06HZpvfQtvv0N7AHWqtjP2pW08QD/FLy//da38vo8PNlKHf5y37Dxdfe/oj4kVIgFq3koLReSR76W/bx//n9k8jonZxzWTANVwEniDsg87sOSd/z7//PvMp3jQiptGVWFX2caezzAXwfgtzYUvbr0iozs32c3Uge7varH+CNE6cvEYmzbPZ9hMaYDdjK4V2iecf6EcEbdUDVUARda2KzO/JtCuDbNQB/iTeL0EG1JSO1jbXS+nLxtPMDPw1fh5+EPrgSEKE/8Gry5A73ui87AmxwdatyMEBCPNOCSKUeRZ2P6Myb5MRvgCHmA9ywsMifU+AYXcB6Xa5GibUC5TSyerxyh0j6QgLVpdyhfArRTTLqQjwe4HOD9s92D4Ap54odXAPBWLAwB02igG5Kkc+piN4lvODIFGAZgT+EO4Si1s7fjSR7vcQETUkRm9O+MXyo9OYhfe4xt9STQ2pcZRLayCV90b4D3jR0DYAfyxJ+eywg2IL7NTMXna7S/RpQ63JhWEM8U41ZyQGjwsVS0QBrEKLu8xwZsbi4wLcCT+OGidPIOCe1PiSc9Qt+go+vYqB7cG+B9d8cAD+WJPz0Am2gxXgU9IneOqDpAAXOsOltVuMzpdakJXrdPCzXiNVUpCeOos5cxnpQT39G+XVLhs1osQVvJKPZyNq8HDwd4d7pNDuWJPxVX7MSzqUDU6gfadKiNlUFTzLeFHHDlzO4kpa7aiKhBPGKwOqxsBAmYkOIpipyXcQSPlRTf+Tii0U3EJGaZsDER2qoB3h2hu0qe+NNwUooYU8y5mILbJe6OuX+2FTKy7bieTDAemaQyQ0CPthljSWO+xmFDIYiESjM5xKd6Ik5lvLq5GrQ3aCMLvmCA9wowLuWJb9xF59hVVP6O0CrBi3ZjZSNOvRy+I6klNVRJYRBaEzdN+imiUXQ8iVF8fsp+W4JXw7WISW7fDh7lptWkCwZ4d7QTXyBPfJMYK7SijjFppGnlIVJBJBYj7eUwtiP1IBXGI1XCsjNpbjENVpSAJ2hq2LTywEly3hUYazt31J8w2+aiLx3g3fohXixPfOMYm6zCGs9LVo9MoW3MCJE7R5u/WsOIjrqBoHUO0bJE9vxBpbhsd3+Nb4/vtPCZ4oZYCitNeYuC/8UDvDvy0qvkiW/cgqNqRyzqSZa/s0mqNGjtKOoTm14zZpUauiQgVfqtQiZjq7Q27JNaSK5ExRcrGCXO1FJYh6jR6CFqK7bZdQZ4t8g0rSlPfP1RdBtqaa9diqtzJkQ9duSryi2brQXbxDwbRUpFMBHjRj8+Nt7GDKgvph9okW7LX47gu0SpGnnFQ1S1lYldOsC7hYteR574ZuKs7Ei1lBsfdz7IZoxzzCVmmVqaSySzQbBVAWDek+N4jh9E/4VqZrJjPwiv9BC1XcvOWgO8275CVyBPvAtTVlDJfZkaZGU7NpqBogAj/xEHkeAuJihWYCxGN6e8+9JtSegFXF1TrhhLGP1fak3pebgPz192/8gB4d/6WT7+GdYnpH7hH/DJzzFiYPn/vjW0SgNpTNuPIZoAEZv8tlGw4+RLxy+ZjnKa5NdFoC7UaW0aduoYse6+bXg1DLg6UfRYwmhGEjqPvF75U558SANrElK/+MdpXvmqBpaXOa/MTZaa1DOcSiLaw9j0NNNst3c+63c7EKTpkvKHzu6bPbP0RkuHAVcbRY8ijP46MIbQeeT1mhA+5PV/inyDdQipf8LTvMXbwvoDy7IruDNVZKTfV4CTSRUYdybUCnGU7KUTDxLgCknqUm5aAW6/1p6eMsOYsphLzsHrE0Y/P5bQedx1F/4yPHnMB3/IOoTU9+BL8PhtjuFKBpZXnYNJxTuv+2XqolKR2UQgHhS5novuxVySJhBNRF3SoKK1XZbbXjVwWNyOjlqWJjrWJIy+P5bQedyldNScP+HZ61xKSK3jyrz+NiHG1hcOLL/+P+PDF2gOkekKGiNWKgJ+8Z/x8Iv4DdQHzcpZyF4v19I27w9/yPGDFQvmEpKtqv/TLiWMfn4sofMm9eAH8Ao0zzh7h4sJqYtxZd5/D7hkYPneDzl5idlzNHcIB0jVlQ+8ULzw/nc5/ojzl2juE0apD7LRnJxe04dMz2iOCFNtGFpTuXA5AhcTRo8mdN4kz30nVjEC4YTZQy4gpC7GlTlrePKhGsKKgeXpCYeO0MAd/GH7yKQUlXPLOasOH3FnSphjHuDvEu4gB8g66oNbtr6eMbFIA4fIBJkgayoXriw2XEDQPJrQeROAlY6aeYOcMf+IVYTU3XFlZufMHinGywaW3YLpObVBAsbjF4QJMsVUSayjk4voPsHJOQfPWDhCgDnmDl6XIRerD24HsGtw86RMHOLvVSHrKBdeVE26gKB5NKHzaIwLOmrqBWJYZDLhASG16c0Tn+CdRhWDgWXnqRZUTnPIHuMJTfLVpkoYy5CzylHVTGZMTwkGAo2HBlkQplrJX6U+uF1wZz2uwS1SQ12IqWaPuO4baZaEFBdukksJmkcTOm+YJSvoqPFzxFA/YUhIvWxcmSdPWTWwbAKVp6rxTtPFUZfKIwpzm4IoMfaYQLWgmlG5FME2gdBgm+J7J+rtS/XBbaVLsR7bpPQnpMFlo2doWaVceHk9+MkyguZNCJ1He+kuHTWyQAzNM5YSUg/GlTk9ZunAsg1qELVOhUSAK0LABIJHLKbqaEbHZLL1VA3VgqoiOKXYiS+HRyaEKgsfIqX64HYWbLRXy/qWoylIV9gudL1OWBNgBgTNmxA6b4txDT4gi3Ri7xFSLxtXpmmYnzAcWDZgY8d503LFogz5sbonDgkKcxGsWsE1OI+rcQtlgBBCSOKD1mtqYpIU8cTvBmAT0yZe+zUzeY92fYjTtGipXLhuR0ePoHk0ofNWBX+lo8Z7pAZDk8mEw5L7dVyZZoE/pTewbI6SNbiAL5xeygW4xPRuLCGbhcO4RIeTMFYHEJkYyEO9HmJfXMDEj/LaH781wHHZEtqSQ/69UnGpzH7LKIAZEDSPJnTesJTUa+rwTepI9dLJEawYV+ZkRn9g+QirD8vF8Mq0jFQ29js6kCS3E1+jZIhgPNanHdHFqFvPJLHqFwQqbIA4jhDxcNsOCCQLDomaL/dr5lyJaJU6FxPFjO3JOh3kVMcROo8u+C+jo05GjMF3P3/FuDLn5x2M04xXULPwaS6hBYki+MrMdZJSgPHlcB7nCR5bJ9Kr5ACUn9jk5kivdd8tk95SOGrtqu9lr2IhK65ZtEl7ZKrp7DrqwZfRUSN1el7+7NJxZbywOC8neNKTch5vsTEMNsoCCqHBCqIPRjIPkm0BjvFODGtto99rCl+d3wmHkW0FPdpZtC7MMcVtGFQjJLX5bdQ2+x9ypdc313uj8xlsrfuLgWXz1cRhZvJYX0iNVBRcVcmCXZs6aEf3RQF2WI/TcCbKmGU3IOoDJGDdDub0+hYckt6PlGu2BcxmhbTdj/klhccLGJMcqRjMJP1jW2ETqLSWJ/29MAoORluJ+6LPffBZbi5gqi5h6catQpmOT7/OFf5UorRpLzCqcMltBLhwd1are3kztrSzXO0LUbXRQcdLh/RdSZ+swRm819REDrtqzC4es6Gw4JCKlSnjYVpo0xeq33PrADbFLL3RuCmObVmPN+24kfa+AojDuM4umKe2QwCf6EN906HwjujaitDs5o0s1y+k3lgbT2W2i7FJdnwbLXhJUBq/9liTctSmFC/0OqUinb0QddTWamtjbHRFuWJJ6NpqZ8vO3fZJ37Db+2GkaPYLGHs7XTTdiFQJ68SkVJFVmY6McR5UycflNCsccHFaV9FNbR4NttLxw4pQ7wJd066Z0ohVbzihaxHVExd/ay04oxUKWt+AsdiQ9OUyZ2krzN19IZIwafSTFgIBnMV73ADj7V/K8u1MaY2sJp2HWm0f41tqwajEvdHWOJs510MaAqN4aoSiPCXtN2KSi46dUxHdaMquar82O1x5jqhDGvqmoE9LfxcY3zqA7/x3HA67r9ZG4O6Cuxu12/+TP+eLP+I+HErqDDCDVmBDO4larujNe7x8om2rMug0MX0rL1+IWwdwfR+p1TNTyNmVJ85ljWzbWuGv8/C7HD/izjkHNZNYlhZcUOKVzKFUxsxxN/kax+8zPWPSFKw80rJr9Tizyj3o1gEsdwgWGoxPezDdZ1TSENE1dLdNvuKL+I84nxKesZgxXVA1VA1OcL49dFlpFV5yJMhzyCmNQ+a4BqusPJ2bB+xo8V9u3x48VVIEPS/mc3DvAbXyoYr6VgDfh5do5hhHOCXMqBZUPhWYbWZECwVJljLgMUWOCB4MUuMaxGNUQDVI50TQ+S3kFgIcu2qKkNSHVoM0SHsgoZxP2d5HH8B9woOk4x5bPkKtAHucZsdykjxuIpbUrSILgrT8G7G5oCW+K0990o7E3T6AdW4TilH5kDjds+H64kS0mz24grtwlzDHBJqI8YJQExotPvoC4JBq0lEjjQkyBZ8oH2LnRsQ4Hu1QsgDTJbO8fQDnllitkxuVskoiKbRF9VwzMDvxHAdwB7mD9yCplhHFEyUWHx3WtwCbSMMTCUCcEmSGlg4gTXkHpZXWQ7kpznK3EmCHiXInqndkQjunG5kxTKEeGye7jWz9cyMR2mGiFQ15ENRBTbCp+Gh86vAyASdgmJq2MC6hoADQ3GosP0QHbnMHjyBQvQqfhy/BUbeHd5WY/G/9LK/8Ka8Jd7UFeNWEZvzPb458Dn8DGLOe3/wGL/4xP+HXlRt+M1PE2iLhR8t+lfgxsuh7AfO2AOf+owWhSZRYQbd622hbpKWKuU+XuvNzP0OseRDa+mObgDHJUSc/pKx31QdKffQ5OIJpt8GWjlgTwMc/w5MPCR/yl1XC2a2Yut54SvOtMev55Of45BOat9aWG27p2ZVORRvnEk1hqWMVUmqa7S2YtvlIpspuF1pt0syuZS2NV14mUidCSfzQzg+KqvIYCMljIx2YK2AO34fX4GWdu5xcIAb8MzTw+j/lyWM+Dw/gjs4GD6ehNgA48kX/AI7XXM/XAN4WHr+9ntywqoCakCqmKP0rmQrJJEErG2Upg1JObr01lKQy4jskWalKYfJ/EDLMpjNSHFEUAde2fltaDgmrNaWQ9+AAb8I5vKjz3L1n1LriB/BXkG/wwR9y/oRX4LlioHA4LzP2inzRx/DWmutRweFjeP3tNeSGlaE1Fde0OS11yOpmbIp2u/jF1n2RRZviJM0yBT3IZl2HWImKjQOxIyeU325b/qWyU9Moj1o07tS0G7qJDoGHg5m8yeCxMoEH8GU45tnrNM84D2l297DQ9t1YP7jki/7RmutRweEA77/HWXOh3HCxkRgldDQkAjNTMl2Iloc1qN5JfJeeTlyTRzxURTdn1Ixv2uKjs12AbdEWlBtmVdk2k7FFwj07PCZ9XAwW3dG+8xKzNFr4EnwBZpy9Qzhh3jDXebBpYcpuo4fQ44u+fD1dweEnHzI7v0xuuOALRUV8rXpFyfSTQYkhd7IHm07jpyhlkCmI0ALYqPTpUxXS+z4jgDj1Pflvmz5ecuItpIBxyTHpSTGWd9g1ApfD/bvwUhL4nT1EzqgX7cxfCcNmb3mPL/qi9SwTHJ49oj5ZLjccbTG3pRmlYi6JCG0mQrAt1+i2UXTZ2dv9IlQpN5naMYtviaXlTrFpoMsl3bOAFEa8sqPj2WCMrx3Yjx99qFwO59Aw/wgx+HlqNz8oZvA3exRDvuhL1jMQHPaOJ0+XyA3fp1OfM3qObEVdhxjvynxNMXQV4+GJyvOEFqeQBaIbbO7i63rpxCltdZShPFxkjM2FPVkn3TG+Rp9pO3l2RzFegGfxGDHIAh8SteR0C4HopXzRF61nheDw6TFN05Ebvq8M3VKKpGjjO6r7nhudTEGMtYM92HTDaR1FDMXJ1eThsbKfywyoWwrzRSXkc51flG3vIid62h29bIcFbTGhfV+faaB+ohj7dPN0C2e2lC96+XouFByen9AsunLDJZ9z7NExiUc0OuoYW6UZkIyx2YUR2z6/TiRjyKMx5GbbjLHvHuf7YmtKghf34LJfx63Yg8vrvN2zC7lY0x0tvKezo4HmGYDU+Gab6dFL+KI761lDcNifcjLrrr9LWZJctG1FfU1uwhoQE22ObjdfkSzY63CbU5hzs21WeTddH2BaL11Gi7lVdlxP1nkxqhnKhVY6knS3EPgVGg1JpN5cP/hivujOelhXcPj8HC/LyI6MkteVjlolBdMmF3a3DbsuAYhL44dxzthWSN065xxUd55Lmf0wRbOYOqH09/o9WbO2VtFdaMb4qBgtFJoT1SqoN8wPXMoXLb3p1PUEhxfnnLzGzBI0Ku7FxrKsNJj/8bn/H8fPIVOd3rfrklUB/DOeO+nkghgSPzrlPxluCMtOnDL4Yml6dK1r3vsgMxgtPOrMFUZbEUbTdIzii5beq72G4PD0DKnwjmBULUVFmy8t+k7fZ3pKc0Q4UC6jpVRqS9Umv8bxw35flZVOU1X7qkjnhZlsMbk24qQ6Hz7QcuL6sDC0iHHki96Uh2UdvmgZnjIvExy2TeJdMDZNSbdZyAHe/Yd1xsQhHiKzjh7GxQ4yqMPaywPkjMamvqrYpmO7Knad+ZQC5msCuAPWUoxrxVhrGv7a+KLXFhyONdTMrZ7ke23qiO40ZJUyzgYyX5XyL0mV7NiUzEs9mjtbMN0dERqwyAJpigad0B3/zRV7s4PIfXSu6YV/MK7+OrYe/JvfGMn/PHJe2fyUdtnFrKRNpXV0Y2559aWPt/G4BlvjTMtXlVIWCnNyA3YQBDmYIodFz41PvXPSa6rq9lWZawZ4dP115HXV/M/tnFkkrBOdzg6aP4pID+MZnTJ1SuuB6iZlyiox4HT2y3YBtkUKWooacBQUDTpjwaDt5poBHl1/HXltwP887lKKXxNUEyPqpGTyA699UqY/lt9yGdlUKra0fFWS+36iylVWrAyd7Uw0CZM0z7xKTOduznLIjG2Hx8cDPLb+OvK6Bv7n1DYci4CxUuRxrjBc0bb4vD3rN5Zz36ntLb83eVJIB8LiIzCmn6SMPjlX+yNlTjvIGjs+QzHPf60Aj62/jrzG8j9vYMFtm1VoRWCJdmw7z9N0t+c8cxZpPeK4aTRicS25QhrVtUp7U578chk4q04Wx4YoQSjFryUlpcQ1AbxZ/XVMknIU//OGl7Q6z9Zpxi0+3yFhSkjUDpnCIUhLWVX23KQ+L9vKvFKI0ZWFQgkDLvBoylrHNVmaw10zwCPrr5tlodfnf94EWnQ0lFRWy8pW9LbkLsyUVDc2NSTHGDtnD1uMtchjbCeb1mpxFP0YbcClhzdLu6lfO8Bj6q+bdT2sz/+8SZCV7VIxtt0DUn9L7r4cLYWDSXnseEpOGFuty0qbOVlS7NNzs5FOGJUqQpl2Q64/yBpZf90sxbE+//PGdZ02HSipCbmD6NItmQ4Lk5XUrGpDMkhbMm2ZVheNYV+VbUWTcv99+2NyX1VoafSuC+AN6q9bFIMv5X/eagNWXZxEa9JjlMwNWb00akGUkSoepp1/yRuuqHGbUn3UdBSTxBU6SEVklzWRUkPndVvw2PrrpjvxOvzPmwHc0hpmq82npi7GRro8dXp0KXnUQmhZbRL7NEVp1uuZmO45vuzKsHrktS3GLWXODVjw+vXXLYx4Hf7njRPd0i3aoAGX6W29GnaV5YdyDj9TFkakje7GHYzDoObfddHtOSpoi2SmzJHrB3hM/XUDDEbxP2/oosszcRlehWXUvzHv4TpBVktHqwenFo8uLVmy4DKLa5d3RtLrmrM3aMFr1183E4sewf+85VWeg1c5ag276NZrM9IJVNcmLEvDNaV62aq+14IAOGFsBt973Ra8Xv11YzXwNfmft7Jg2oS+XOyoC8/cwzi66Dhmgk38kUmP1CUiYWOX1bpD2zWXt2FCp7uq8703APAa9dfNdscR/M/bZLIyouVxqJfeWvG9Je+JVckHQ9+CI9NWxz+blX/KYYvO5n2tAP/vrlZ7+8/h9y+9qeB/Hnt967e5mevX10rALDWK//FaAT5MXdBXdP0C/BAes792c40H+AiAp1e1oH8HgH94g/Lttx1gp63op1eyoM/Bvw5/G/7xFbqJPcCXnmBiwDPb/YKO4FX4OjyCb289db2/Noqicw4i7N6TVtoz8tNwDH+8x/i6Ae7lmaQVENzJFb3Di/BFeAwz+Is9SjeQySpPqbLFlNmyz47z5a/AF+AYFvDmHqibSXTEzoT4Gc3OALaqAP4KPFUJ6n+1x+rGAM6Zd78bgJ0a8QN4GU614vxwD9e1Amy6CcskNrczLx1JIp6HE5UZD/DBHrFr2oNlgG4Odv226BodoryjGJ9q2T/AR3vQrsOCS0ctXZi3ruLlhpFDJYl4HmYtjQCP9rhdn4suySLKDt6wLcC52h8xPlcjju1fn+yhuw4LZsAGUuo2b4Fx2UwQu77uqRHXGtg92aN3tQCbFexc0uk93vhTXbct6y7MulLycoUljx8ngDMBg1tvJjAazpEmOtxlzclvj1vQf1Tx7QlPDpGpqgtdSKz/d9/hdy1vTfFHSmC9dGDZbLiezz7Ac801HirGZsWjydfZyPvHXL/Y8Mjzg8BxTZiuwKz4Eb8sBE9zznszmjvFwHKPIWUnwhqfVRcd4Ck0K6ate48m1oOfrX3/yOtvAsJ8zsPAM89sjnddmuLuDPjX9Bu/L7x7xpMzFk6nWtyQfPg278Gn4Aekz2ZgOmU9eJ37R14vwE/BL8G3aibCiWMWWDQ0ZtkPMnlcGeAu/Ag+8ZyecU5BPuy2ILD+sQqyZhAKmn7XZd+jIMTN9eBL7x95xVLSX4On8EcNlXDqmBlqS13jG4LpmGbkF/0CnOi3H8ETOIXzmnmtb0a16Tzxj1sUvQCBiXZGDtmB3KAefPH94xcUa/6vwRn80GOFyjEXFpba4A1e8KQfFF+259tx5XS4egYn8fQsLGrqGrHbztr+uByTahWuL1NUGbDpsnrwBfePPwHHIf9X4RnM4Z2ABWdxUBlqQ2PwhuDxoS0vvqB1JzS0P4h2nA/QgTrsJFn+Y3AOjs9JFC07CGWX1oNX3T/yHOzgDjwPn1PM3g9Jk9lZrMEpxnlPmBbjyo2+KFXRU52TJM/2ALcY57RUzjObbjqxVw++4P6RAOf58pcVsw9Daje3htriYrpDOonre3CudSe6bfkTEgHBHuDiyu5MCsc7BHhYDx7ePxLjqigXZsw+ijMHFhuwBmtoTPtOxOrTvYJDnC75dnUbhfwu/ZW9AgYd+peL68HD+0emKquiXHhWjJg/UrkJYzuiaL3E9aI/ytrCvAd4GcYZMCkSQxfUg3v3j8c4e90j5ZTPdvmJJGHnOCI2nHS8081X013pHuBlV1gB2MX1YNmWLHqqGN/TWmG0y6clJWthxNUl48q38Bi8vtMKyzzpFdSDhxZ5WBA5ZLt8Jv3895DduBlgbPYAj8C4B8hO68FDkoh5lydC4FiWvBOVqjYdqjiLv92t8yPDjrDaiHdUD15qkSURSGmXJwOMSxWAXYwr3zaAufJ66l+94vv3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/wHuD9tQd4f+0B3l97gPfXHuD9tQd4f+0B3l97gG8LwP8G/AL8O/A5OCq0Ys2KIdv/qOIXG/4mvFAMF16gZD+2Xvu/B8as5+8bfllWyg0zaNO5bfXj6vfhhwD86/Aq3NfRS9t9WPnhfnvCIw/CT8GLcFTMnpntdF/z9V+PWc/vWoIH+FL3Znv57PitcdGP4R/C34avw5fgRVUInCwbsn1yyA8C8zm/BH8NXoXnVE6wVPjdeCI38kX/3+Ct9dbz1pTmHFRu+Hm4O9Ch3clr99negxfwj+ER/DR8EV6B5+DuQOnTgUw5rnkY+FbNU3gNXh0o/JYTuWOvyBf9FvzX663HH/HejO8LwAl8Hl5YLTd8q7sqA3wbjuExfAFegQdwfyDoSkWY8swzEf6o4Qyewefg+cHNbqMQruSL/u/WWc+E5g7vnnEXgDmcDeSGb/F4cBcCgT+GGRzDU3hZYburAt9TEtHgbM6JoxJ+6NMzzTcf6c2bycv2+KK/f+l6LBzw5IwfqZJhA3M472pWT/ajKxnjv4AFnMEpnBTPND6s2J7qHbPAqcMK74T2mZ4VGB9uJA465It+/eL1WKhYOD7xHOkr1ajK7d0C4+ke4Hy9qXZwpgLr+Znm/uNFw8xQOSy8H9IzjUrd9+BIfenYaylf9FsXr8fBAadnPIEDna8IBcwlxnuA0/Wv6GAWPd7dDIKjMdSWueAsBj4M7TOd06qBbwDwKr7oleuxMOEcTuEZTHWvDYUO7aHqAe0Bbq+HEFRzOz7WVoTDQkVds7A4sIIxfCQdCefFRoIOF/NFL1mPab/nvOakSL/Q1aFtNpUb/nFOVX6gzyg/1nISyDfUhsokIzaBR9Kxm80s5mK+6P56il1jXic7nhQxsxSm3OwBHl4fFdLqi64nDQZvqE2at7cWAp/IVvrN6/BFL1mPhYrGMBfOi4PyjuSGf6wBBh7p/FZTghCNWGgMzlBbrNJoPJX2mW5mwZfyRffXo7OFi5pZcS4qZUrlViptrXtw+GQoyhDPS+ANjcGBNRiLCQDPZPMHuiZfdFpPSTcQwwKYdRNqpkjm7AFeeT0pJzALgo7g8YYGrMHS0iocy+YTm2vyRUvvpXCIpQ5pe666TJrcygnScUf/p0NDs/iAI/nqDHC8TmQT8x3NF91l76oDdQGwu61Z6E0ABv7uO1dbf/37Zlv+Zw/Pbh8f1s4Avur6657/+YYBvur6657/+YYBvur6657/+YYBvur6657/+aYBvuL6657/+VMA8FXWX/f8zzcN8BXXX/f8zzcNMFdbf93zP38KLPiK6697/uebtuArrr/u+Z9vGmCusP6653/+1FjwVdZf9/zPN7oHX339dc//fNMu+irrr3v+50+Bi+Zq6697/uebA/jz8Pudf9ht/fWv517J/XUzAP8C/BAeX9WCDrUpZ3/dEMBxgPcfbtTVvsYV5Yn32u03B3Ac4P3b8I+vxNBKeeL9dRMAlwO83959qGO78sT769oB7g3w/vGVYFzKE++v6wV4OMD7F7tckFkmT7y/rhHgpQO8b+4Y46XyxPvrugBeNcB7BRiX8sT767oAvmCA9woAHsoT76+rBJjLBnh3txOvkifeX1dswZcO8G6N7sXyxPvr6i340gHe3TnqVfLE++uKAb50gHcXLnrX8sR7gNdPRqwzwLu7Y/FO5Yn3AK9jXCMGeHdgxDuVJ75VAI8ljP7PAb3/RfjcZfePHBB+79dpfpH1CanN30d+mT1h9GqAxxJGM5LQeeQ1+Tb+EQJrElLb38VHQ94TRq900aMIo8cSOo+8Dp8QfsB8zpqE1NO3OI9Zrj1h9EV78PqE0WMJnUdeU6E+Jjyk/hbrEFIfeWbvId8H9oTRFwdZaxJGvziW0Hn0gqYB/wyZ0PwRlxJST+BOw9m77Amj14ii1yGM/txYQudN0qDzGe4EqfA/5GJCagsHcPaEPWH0esekSwmjRxM6b5JEcZ4ww50ilvAOFxBSx4yLW+A/YU8YvfY5+ALC6NGEzhtmyZoFZoarwBLeZxUhtY4rc3bKnjB6TKJjFUHzJoTOozF2YBpsjcyxDgzhQ1YRUse8+J4wenwmaylB82hC5w0zoRXUNXaRBmSMQUqiWSWkLsaVqc/ZE0aPTFUuJWgeTei8SfLZQeMxNaZSIzbII4aE1Nmr13P2hNHjc9E9guYNCZ032YlNwESMLcZiLQHkE4aE1BFg0yAR4z1h9AiAGRA0jyZ03tyIxWMajMPWBIsxYJCnlITU5ShiHYdZ94TR4wCmSxg9jtB5KyPGYzymAYexWEMwAPIsAdYdV6aObmNPGD0aYLoEzaMJnTc0Ygs+YDw0GAtqxBjkuP38bMRWCHn73xNGjz75P73WenCEJnhwyVe3AEe8TtKdJcYhBl97wuhNAObK66lvD/9J9NS75v17wuitAN5fe4D31x7g/bUHeH/tAd5fe4D3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/w/toDvAd4f/24ABzZ8o+KLsSLS+Pv/TqTb3P4hKlQrTGh+fbIBT0Axqznnb+L/V2mb3HkN5Mb/nEHeK7d4IcDld6lmDW/iH9E+AH1MdOw/Jlu2T1xNmY98sv4wHnD7D3uNHu54WUuOsBTbQuvBsPT/UfzNxGYzwkP8c+Yz3C+r/i6DcyRL/rZ+utRwWH5PmfvcvYEt9jLDS/bg0/B64DWKrQM8AL8FPwS9beQCe6EMKNZYJol37jBMy35otdaz0Bw2H/C2Smc7+WGB0HWDELBmOByA3r5QONo4V+DpzR/hFS4U8wMW1PXNB4TOqYz9urxRV++ntWCw/U59Ty9ebdWbrgfRS9AYKKN63ZokZVygr8GZ/gfIhZXIXPsAlNjPOLBby5c1eOLvmQ9lwkOy5x6QV1j5TYqpS05JtUgUHUp5toHGsVfn4NX4RnMCe+AxTpwmApTYxqMxwfCeJGjpXzRF61nbcHhUBPqWze9svwcHJ+S6NPscKrEjug78Dx8Lj3T8D4YxGIdxmJcwhi34fzZUr7olevZCw5vkOhoClq5zBPZAnygD/Tl9EzDh6kl3VhsHYcDEb+hCtJSvuiV69kLDm+WycrOTArHmB5/VYyP6jOVjwgGawk2zQOaTcc1L+aLXrKeveDwZqlKrw8U9Y1p66uK8dEzdYwBeUQAY7DbyYNezBfdWQ97weEtAKYQg2xJIkuveAT3dYeLGH+ShrWNwZgN0b2YL7qznr3g8JYAo5bQBziPjx7BPZ0d9RCQp4UZbnFdzBddor4XHN4KYMrB2qHFRIzzcLAHQZ5the5ovui94PCWAPefaYnxIdzRwdHCbuR4B+tbiy96Lzi8E4D7z7S0mEPd+eqO3cT53Z0Y8SV80XvB4Z0ADJi/f7X113f+7p7/+UYBvur6657/+YYBvur6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+VMA8FXWX/f8z58OgK+y/rrnf75RgLna+uue//lTA/CV1V/3/M837aKvvv6653++UQvmauuve/7nTwfAV1N/3fM/fzr24Cuuv+75nz8FFnxl9dc9//MOr/8/glixwRuUfM4AAAAASUVORK5CYII="},getSearchTexture:function(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII="}});var Cu=A((function e(){s(this,e)}));Cu.FXAA="FXAA",Cu.SMAA="SMAA",Cu.MSAA="MSAA",Cu.SSAA="SSAA";var Bu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,e),this.options=t,this.pass={enabled:!0},this.antiAliasing=t.antialias||Cu.FXAA,this.isPostProcessing=!0}return A(e,[{key:"init",value:function(){}},{key:"render",value:function(){}},{key:"enabled",get:function(){this.pass.enabled},set:function(e){this.pass.enabled=e}},{key:"setSize",value:function(e,t){}}]),e}(),Eu=function(e,t,n,i){this.renderScene=t,this.renderCamera=n,this.selectedObjects=void 0!==i?i:[],this.visibleEdgeColor=new Fn(1,1,1),this.hiddenEdgeColor=new Fn(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=2,this.pulsePeriod=0,hu.call(this),this.resolution=void 0!==e?new tt(e.x,e.y):new tt(256,256);var r={minFilter:Z,magFilter:Z,format:ce},a=Math.round(this.resolution.x/this.downSampleRatio),o=Math.round(this.resolution.y/this.downSampleRatio);this.maskBufferMaterial=new Nn({color:16777215}),this.maskBufferMaterial.side=2,this.renderTargetMaskBuffer=new dt(this.resolution.x,this.resolution.y,r),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.depthMaterial=new Ra,this.depthMaterial.side=2,this.depthMaterial.depthPacking=je,this.depthMaterial.blending=0,this.prepareMaskMaterial=this.getPrepareMaskMaterial(),this.prepareMaskMaterial.side=2,this.prepareMaskMaterial.fragmentShader=function(e,t){var n=t.isPerspectiveCamera?"perspective":"orthographic";return e.replace(/DEPTH_TO_VIEW_Z/g,n+"DepthToViewZ")}(this.prepareMaskMaterial.fragmentShader,this.renderCamera),this.renderTargetDepthBuffer=new dt(this.resolution.x,this.resolution.y,r),this.renderTargetDepthBuffer.texture.name="OutlinePass.depth",this.renderTargetDepthBuffer.texture.generateMipmaps=!1,this.renderTargetMaskDownSampleBuffer=new dt(a,o,r),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new dt(a,o,r),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new dt(Math.round(a/2),Math.round(o/2),r),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this.getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new dt(a,o,r),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new dt(Math.round(a/2),Math.round(o/2),r),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1;this.separableBlurMaterial1=this.getSeperableBlurMaterial(4),this.separableBlurMaterial1.uniforms.texSize.value=new tt(a,o),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this.getSeperableBlurMaterial(4),this.separableBlurMaterial2.uniforms.texSize.value=new tt(Math.round(a/2),Math.round(o/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=4,this.overlayMaterial=this.getOverlayMaterial(),void 0===du&&console.error("OutlinePass relies on CopyShader");var s=du;this.copyUniforms=Di.clone(s.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new Ri({uniforms:this.copyUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,blending:0,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new Fn,this.oldClearAlpha=1,this.fsQuad=new hu.FullScreenQuad(null),this.tempPulseColor1=new Fn,this.tempPulseColor2=new Fn,this.textureMatrix=new bt};Eu.prototype=Object.assign(Object.create(hu.prototype),{constructor:Eu,dispose:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()},setSize:function(e,t){this.renderTargetMaskBuffer.setSize(e,t);var n=Math.round(e/this.downSampleRatio),i=Math.round(t/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(n,i),this.renderTargetBlurBuffer1.setSize(n,i),this.renderTargetEdgeBuffer1.setSize(n,i),this.separableBlurMaterial1.uniforms.texSize.value=new tt(n,i),n=Math.round(n/2),i=Math.round(i/2),this.renderTargetBlurBuffer2.setSize(n,i),this.renderTargetEdgeBuffer2.setSize(n,i),this.separableBlurMaterial2.uniforms.texSize.value=new tt(n,i)},changeVisibilityOfSelectedObjects:function(e){function t(t){t.isMesh&&(e?(t.visible=t.userData.oldVisible,delete t.userData.oldVisible):(t.userData.oldVisible=t.visible,t.visible=e))}for(var n=0;n0){this.showTransform=!1,this.renderScene.getObjectByName("ObjectControls")&&this.renderScene.getObjectByName("ObjectControls").visible&&(this.showTransform=!0,this.renderScene.getObjectByName("ObjectControls").visible=!1),this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha();var a=e.autoClear;e.autoClear=!1,r&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1);var o=this.renderScene.background;if(this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value=new tt(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),this.toggleVisibleOfSelectedObjects(!0),e.render(this.renderScene,this.renderCamera),this.toggleVisibleOfSelectedObjects(!1),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this.renderScene.background=o,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),this.pulsePeriod>0){var s=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2;this.tempPulseColor1.multiplyScalar(s),this.tempPulseColor2.multiplyScalar(s)}this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value=new tt(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Eu.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Eu.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=Eu.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=Eu.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,r&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=a}this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=n.texture,e.setRenderTarget(null),this.fsQuad.render(e)),this.showTransform&&(this.renderScene.getObjectByName("ObjectControls").visible=!0)},getPrepareMaskMaterial:function(){return new Ri({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new tt(.5,.5)},textureMatrix:{value:new bt}},vertexShader:["varying vec4 projTexCoord;","varying vec4 vPosition;","uniform mat4 textureMatrix;","void main() {","\tvPosition = modelViewMatrix * vec4( position, 1.0 );","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tprojTexCoord = textureMatrix * worldPosition;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include ","varying vec4 vPosition;","varying vec4 projTexCoord;","uniform sampler2D depthTexture;","uniform vec2 cameraNearFar;","void main() {","\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));","\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );","\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;","\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);","}"].join("\n")})},getEdgeDetectionMaterial:function(){return new Ri({uniforms:{maskTexture:{value:null},texSize:{value:new tt(.5,.5)},visibleEdgeColor:{value:new at(1,1,1)},hiddenEdgeColor:{value:new at(1,1,1)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\t\t\t\tuniform sampler2D maskTexture;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec3 visibleEdgeColor;\t\t\t\tuniform vec3 hiddenEdgeColor;\t\t\t\t\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\t\t\t\t}"})},getSeperableBlurMaterial:function(e){return new Ri({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new tt(.5,.5)},direction:{value:new tt(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include \t\t\t\tvarying vec2 vUv;\t\t\t\tuniform sampler2D colorTexture;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\tuniform float kernelRadius;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, kernelRadius);\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\t\t\t\t\tvec2 uvOffset = delta;\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\t\t\t\t\t\tfloat w = gaussianPdf(uvOffset.x, kernelRadius);\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\t\t\t\t\t\tweightSum += (2.0 * w);\t\t\t\t\t\tuvOffset += delta;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\t\t\t\t}"})},getOverlayMaterial:function(){return new Ri({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\t\t\t\tuniform sampler2D maskTexture;\t\t\t\tuniform sampler2D edgeTexture1;\t\t\t\tuniform sampler2D edgeTexture2;\t\t\t\tuniform sampler2D patternTexture;\t\t\t\tuniform float edgeStrength;\t\t\t\tuniform float edgeGlow;\t\t\t\tuniform bool usePatternTexture;\t\t\t\t\t\t\t\tvoid main() {\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\t\t\t\t\tif(usePatternTexture)\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\t\t\t\t\tgl_FragColor = finalColor;\t\t\t\t}",blending:2,depthTest:!1,depthWrite:!1,transparent:!0})}}),Eu.BlurDirectionX=new tt(1,0),Eu.BlurDirectionY=new tt(0,1);var Su=function(e,t,n,i){this.renderScene=t,this.renderCamera=n,this.selectedObjects=void 0!==i?i:[],this.visibleEdgeColor=new Fn(1,1,1),this.hiddenEdgeColor=new Fn(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=2,this.pulsePeriod=0,hu.call(this),this.resolution=void 0!==e?new tt(e.x,e.y):new tt(256,256);var r={minFilter:Z,magFilter:Z,format:ce},a=Math.round(this.resolution.x/this.downSampleRatio),o=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetMaskBuffer=new dt(this.resolution.x,this.resolution.y,r),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.prepareMaskMaterial=this.getPrepareMaskMaterial(),this.prepareMaskMaterial.side=2,this.prepareMaskMaterial.fragmentShader=function(e,t){var n=t.isPerspectiveCamera?"perspective":"orthographic";return e.replace(/DEPTH_TO_VIEW_Z/g,n+"DepthToViewZ")}(this.prepareMaskMaterial.fragmentShader,this.renderCamera),this.renderTargetMaskDownSampleBuffer=new dt(a,o,r),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new dt(a,o,r),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new dt(Math.round(a/2),Math.round(o/2),r),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this.getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new dt(a,o,r),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new dt(Math.round(a/2),Math.round(o/2),r),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1;this.separableBlurMaterial1=this.getSeperableBlurMaterial(4),this.separableBlurMaterial1.uniforms.texSize.value=new tt(a,o),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this.getSeperableBlurMaterial(4),this.separableBlurMaterial2.uniforms.texSize.value=new tt(Math.round(a/2),Math.round(o/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=4,this.overlayMaterial=this.getOverlayMaterial(),void 0===du&&console.error("OutlinePass relies on CopyShader");var s=du;this.copyUniforms=Di.clone(s.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new Ri({uniforms:this.copyUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,blending:0,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new Fn,this.oldClearAlpha=1,this.fsQuad=new hu.FullScreenQuad(null),this.tempPulseColor1=new Fn,this.tempPulseColor2=new Fn,this.textureMatrix=new bt};Su.prototype=Object.assign(Object.create(hu.prototype),{constructor:Su,dispose:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()},setSize:function(e,t){this.renderTargetMaskBuffer.setSize(e,t);var n=Math.round(e/this.downSampleRatio),i=Math.round(t/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(n,i),this.renderTargetBlurBuffer1.setSize(n,i),this.renderTargetEdgeBuffer1.setSize(n,i),this.separableBlurMaterial1.uniforms.texSize.value=new tt(n,i),n=Math.round(n/2),i=Math.round(i/2),this.renderTargetBlurBuffer2.setSize(n,i),this.renderTargetEdgeBuffer2.setSize(n,i),this.separableBlurMaterial2.uniforms.texSize.value=new tt(n,i)},changeVisibilityOfSelectedObjects:function(e){function t(t){t.isMesh&&(e?(t.visible=t.userData.oldVisible,delete t.userData.oldVisible):(t.userData.oldVisible=t.visible,t.visible=e))}for(var n=0;n0){this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha();var a=e.autoClear;e.autoClear=!1,r&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1);var o=this.renderScene.background;if(this.renderScene.background=null,this.renderScene.overrideMaterial=this.prepareMaskMaterial,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.renderArray(this.selectedObjects,this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.renderScene.background=o,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),this.pulsePeriod>0){var s=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2;this.tempPulseColor1.multiplyScalar(s),this.tempPulseColor2.multiplyScalar(s)}this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value=new tt(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Su.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Su.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=Su.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=Su.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,r&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=a}this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=n.texture,e.setRenderTarget(null),this.fsQuad.render(e)),this.showTransform&&(this.renderScene.getObjectByName("ObjectControls").visible=!0)},getPrepareMaskMaterial:function(){return new Ri({uniforms:{},vertexShader:["#include ","void main() {","\t#include ","\t#include ","\t#include ","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( transformed, 1.0 );","}"].join("\n"),fragmentShader:["void main() {","\tgl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);","}"].join("\n")})},getEdgeDetectionMaterial:function(){return new Ri({uniforms:{maskTexture:{value:null},texSize:{value:new tt(.5,.5)},visibleEdgeColor:{value:new at(1,1,1)},hiddenEdgeColor:{value:new at(1,1,1)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\t\t\t\tuniform sampler2D maskTexture;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec3 visibleEdgeColor;\t\t\t\tuniform vec3 hiddenEdgeColor;\t\t\t\t\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\t\t\t\t}"})},getSeperableBlurMaterial:function(e){return new Ri({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new tt(.5,.5)},direction:{value:new tt(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include \t\t\t\tvarying vec2 vUv;\t\t\t\tuniform sampler2D colorTexture;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\tuniform float kernelRadius;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, kernelRadius);\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\t\t\t\t\tvec2 uvOffset = delta;\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\t\t\t\t\t\tfloat w = gaussianPdf(uvOffset.x, kernelRadius);\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\t\t\t\t\t\tweightSum += (2.0 * w);\t\t\t\t\t\tuvOffset += delta;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\t\t\t\t}"})},getOverlayMaterial:function(){return new Ri({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\t\t\t\tuniform sampler2D maskTexture;\t\t\t\tuniform sampler2D edgeTexture1;\t\t\t\tuniform sampler2D edgeTexture2;\t\t\t\tuniform sampler2D patternTexture;\t\t\t\tuniform float edgeStrength;\t\t\t\tuniform float edgeGlow;\t\t\t\tuniform bool usePatternTexture;\t\t\t\t\t\t\t\tvoid main() {\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\t\t\t\t\tif(usePatternTexture)\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\t\t\t\t\tgl_FragColor = finalColor;\t\t\t\t}",blending:2,depthTest:!1,depthWrite:!1,transparent:!0})}}),Su.BlurDirectionX=new tt(1,0),Su.BlurDirectionY=new tt(0,1);var Tu=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this,e)).antiAliasing=Cu.SMAA,i.selectedColor=e.color||"#fff709",i.objects=[],null==e.strength&&(e.strength=6.5),null==e.glow&&(e.glow=1),null==e.thickness&&(e.thickness=2),i}return A(n,[{key:"init",value:function(e){this.pass=new Su(new tt(e.width,e.height),e.scene,e.camera),this.pass.edgeStrength=this.options.strength,this.pass.edgeGlow=this.options.glow,this.pass.edgeThickness=this.options.thickness,this.pass.visibleEdgeColor.set(this.selectedColor),this.pass.hiddenEdgeColor.set(this.selectedColor),this.pass.downSampleRatio=window.devicePixelRatio,this.pass.selectedObjects=this.objects,b(u(n.prototype),"init",this).call(this)}},{key:"add",value:function(e){var t=this;this.objects.includes(e)||(this.objects.push(e),e.traverse((function(e){e.isMesh&&!t.pass.selectedObjects.includes(e)&&t.pass.selectedObjects.push(e)})))}},{key:"remove",value:function(e){if(this.objects.includes(e)){this.objects.splice(this.objects.indexOf(e),1);var t=[];e.traverse((function(e){e.isMesh&&t.push(e)}));for(var n=this.pass.selectedObjects.length-1;n>=0;n--)t.includes(this.pass.selectedObjects[n])&&this.pass.selectedObjects.splice(n,1)}}},{key:"clear",value:function(){this.objects=[],this.pass.selectedObjects&&(this.pass.selectedObjects=[])}}]),n}(Bu),_u={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new Fn(0)},defaultOpacity:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 defaultColor;","uniform float defaultOpacity;","uniform float luminosityThreshold;","uniform float smoothWidth;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tvec3 luma = vec3( 0.299, 0.587, 0.114 );","\tfloat v = dot( texel.xyz, luma );","\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );","\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );","\tgl_FragColor = mix( outputColor, texel, alpha );","}"].join("\n")},Iu=function(e,t,n,i){hu.call(this),this.strength=void 0!==t?t:1,this.radius=n,this.threshold=i,this.resolution=void 0!==e?new tt(e.x,e.y):new tt(256,256),this.clearColor=new Fn(0,0,0);var r={minFilter:Z,magFilter:Z,format:ce};this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;var a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);this.renderTargetBright=new dt(a,o,r),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(var s=0;s\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat fSigma = float(SIGMA);\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\t\t\t\t\t\tfloat x = float(i);\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\t\t\t\t\t\tweightSum += 2.0 * w;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})},getCompositeMaterial:function(e){return new Ri({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\t\t\t\tuniform sampler2D blurTexture1;\t\t\t\tuniform sampler2D blurTexture2;\t\t\t\tuniform sampler2D blurTexture3;\t\t\t\tuniform sampler2D blurTexture4;\t\t\t\tuniform sampler2D blurTexture5;\t\t\t\tuniform sampler2D dirtTexture;\t\t\t\tuniform float bloomStrength;\t\t\t\tuniform float bloomRadius;\t\t\t\tuniform float bloomFactors[NUM_MIPS];\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\t\t\t\t\t\t\t\tfloat lerpBloomFactor(const in float factor) { \t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\t\t\t\t}\t\t\t\t\t\t\t\tvoid main() {\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\t\t\t\t}"})}}),Iu.BlurDirectionX=new tt(1,0),Iu.BlurDirectionY=new tt(0,1);var Lu=function(e,t,n,i){hu.call(this),this.scene=e,this.camera=t,this.sampleLevel=4,this.unbiased=!0,this.clearColor=void 0!==n?n:0,this.clearAlpha=void 0!==i?i:0,void 0===du&&console.error("SSAARenderPass relies on CopyShader");var r=du;this.copyUniforms=Di.clone(r.uniforms),this.copyMaterial=new Ri({uniforms:this.copyUniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,premultipliedAlpha:!0,transparent:!0,blending:2,depthTest:!1,depthWrite:!1}),this.fsQuad=new hu.FullScreenQuad(this.copyMaterial)};Lu.prototype=Object.assign(Object.create(hu.prototype),{constructor:Lu,dispose:function(){this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)},setSize:function(e,t){this.sampleRenderTarget&&this.sampleRenderTarget.setSize(e,t)},render:function(e,t,n){this.sampleRenderTarget||(this.sampleRenderTarget=new dt(n.width,n.height,{minFilter:Z,magFilter:Z,format:ce}),this.sampleRenderTarget.texture.name="SSAARenderPass.sample");var i=Lu.JitterVectors[Math.max(0,Math.min(this.sampleLevel,5))],r=e.autoClear;e.autoClear=!1;var a=e.getClearColor().getHex(),o=e.getClearAlpha(),s=1/i.length;this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,n.width,n.height;for(var l=0;lo&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),"Y"!==r.name&&"XYZY"!==r.name||Math.abs(R.copy(V).applyQuaternion(t).dot(this.eye))>o&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),"Z"!==r.name&&"XYZZ"!==r.name||Math.abs(R.copy(j).applyQuaternion(t).dot(this.eye))>o&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),"XY"===r.name&&Math.abs(R.copy(j).applyQuaternion(t).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),"YZ"===r.name&&Math.abs(R.copy(H).applyQuaternion(t).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),"XZ"===r.name&&Math.abs(R.copy(V).applyQuaternion(t).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),-1!==r.name.search("X")&&(R.copy(H).applyQuaternion(t).dot(this.eye)<0?"fwd"===r.tag?r.visible=!1:r.scale.x*=-1:"bwd"===r.tag&&(r.visible=!1)),-1!==r.name.search("Y")&&(R.copy(V).applyQuaternion(t).dot(this.eye)<0?"fwd"===r.tag?r.visible=!1:r.scale.y*=-1:"bwd"===r.tag&&(r.visible=!1)),-1!==r.name.search("Z")&&(R.copy(j).applyQuaternion(t).dot(this.eye)<0?"fwd"===r.tag?r.visible=!1:r.scale.z*=-1:"bwd"===r.tag&&(r.visible=!1))}else"rotate"===this.mode&&(Q.copy(t),R.copy(this.eye).applyQuaternion(z.copy(t).inverse()),-1!==r.name.search("E")&&r.quaternion.setFromRotationMatrix(N.lookAt(this.eye,O,V)),"X"===r.name&&(z.setFromAxisAngle(H,Math.atan2(-R.y,R.z)),z.multiplyQuaternions(Q,z),r.quaternion.copy(z)),"Y"===r.name&&(z.setFromAxisAngle(V,Math.atan2(R.x,R.z)),z.multiplyQuaternions(Q,z),r.quaternion.copy(z)),"Z"===r.name&&(z.setFromAxisAngle(j,Math.atan2(R.y,R.x)),z.multiplyQuaternions(Q,z),r.quaternion.copy(z)));r.visible=r.visible&&(-1===r.name.indexOf("X")||this.showX),r.visible=r.visible&&(-1===r.name.indexOf("Y")||this.showY),r.visible=r.visible&&(-1===r.name.indexOf("Z")||this.showZ),r.visible=r.visible&&(-1===r.name.indexOf("E")||this.showX&&this.showY&&this.showZ),r.material._opacity=r.material._opacity||r.material.opacity,r.material._color=r.material._color||r.material.color.clone(),r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled?this.axis&&(r.name===this.axis||this.axis.split("").some((function(e){return r.name===e}))?(r.material.opacity=1,r.material.color.lerp(new Fn(1,1,1),.5)):(r.material.opacity*=.25,r.material.color.lerp(new Fn(1,1,1),.5))):(r.material.opacity*=.5,r.material.color.lerp(new Fn(1,1,1),.5))}else r.visible=!1,"AXIS"===r.name?(r.position.copy(this.worldPositionStart),r.visible=!!this.axis,"X"===this.axis&&(z.setFromEuler(D.set(0,0,0)),r.quaternion.copy(t).multiply(z),Math.abs(R.copy(H).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),"Y"===this.axis&&(z.setFromEuler(D.set(0,0,Math.PI/2)),r.quaternion.copy(t).multiply(z),Math.abs(R.copy(V).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),"Z"===this.axis&&(z.setFromEuler(D.set(0,Math.PI/2,0)),r.quaternion.copy(t).multiply(z),Math.abs(R.copy(j).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),"XYZE"===this.axis&&(z.setFromEuler(D.set(0,Math.PI/2,0)),R.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(N.lookAt(O,R,V)),r.quaternion.multiply(z),r.visible=this.dragging),"E"===this.axis&&(r.visible=!1)):"START"===r.name?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):"END"===r.name?(r.position.copy(this.worldPosition),r.visible=this.dragging):"DELTA"===r.name?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),U.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),U.applyQuaternion(this.worldQuaternionStart.clone().inverse()),r.scale.copy(U),r.visible=this.dragging):(r.quaternion.copy(t),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=-1!==this.axis.search(r.name)))}zt.prototype.updateMatrixWorld.call(this)}};ku.prototype=Object.assign(Object.create(zt.prototype),{constructor:ku,isTransformControlsGizmo:!0});var Pu=function(){Ei.call(this,new $i(1e5,1e5,2,2),new Nn({visible:!1,wireframe:!0,side:2,transparent:!0,opacity:.1})),this.type="TransformControlsPlane";var e=new at(1,0,0),t=new at(0,1,0),n=new at(0,0,1),i=new at,r=new at,a=new at,o=new bt,s=new nt;this.updateMatrixWorld=function(){var l=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(l="local"),e.set(1,0,0).applyQuaternion("local"===l?this.worldQuaternion:s),t.set(0,1,0).applyQuaternion("local"===l?this.worldQuaternion:s),n.set(0,0,1).applyQuaternion("local"===l?this.worldQuaternion:s),a.copy(t),this.mode){case"translate":case"scale":switch(this.axis){case"X":a.copy(this.eye).cross(e),r.copy(e).cross(a);break;case"Y":a.copy(this.eye).cross(t),r.copy(t).cross(a);break;case"Z":a.copy(this.eye).cross(n),r.copy(n).cross(a);break;case"XY":r.copy(n);break;case"YZ":r.copy(e);break;case"XZ":a.copy(n),r.copy(t);break;case"XYZ":case"E":r.set(0,0,0)}break;default:r.set(0,0,0)}0===r.length()?this.quaternion.copy(this.cameraQuaternion):(o.lookAt(i.set(0,0,0),r,a),this.quaternion.setFromRotationMatrix(o)),zt.prototype.updateMatrixWorld.call(this)}};Pu.prototype=Object.assign(Object.create(Ei.prototype),{constructor:Pu,isTransformControlsPlane:!0});var Uu,Du=function(e){h(n,e);var t=y(n);function n(e,i){var r;return s(this,n),(r=t.call(this,e))._hideObjects=[],r.antiAliasing=Cu.SMAA,r.options.strength=void 0!==r.options.strength?r.options.strength:1,r.options.radius=void 0!==r.options.radius?r.options.radius:0,r.options.threshold=void 0!==r.options.threshold?r.options.threshold:0,r._bloomPass={},r._materials={},r._darkMaterial=new Nn({color:"black"}),r._lastSelected=null,r._objects=[],r.isUnrealBloom=!0,r.viewer=i,r}return A(n,[{key:"init",value:function(e){var t=new tt(e.width,e.height);this._bloomPass=new Iu(t,this.options.strength,this.options.radius,this.options.threshold),this._bloomLayer=new Et,this._bloomLayer.set(1),this._composer=new vu(e.renderer),this._composer.renderToScreen=!1;var i=new Lu(e.scene,e.camera);i.sampleLevel=4,this._composer.addPass(i),this._composer.addPass(new fu(du)),this._composer.addPass(this._bloomPass),this.pass=new fu(new Ri({uniforms:{baseTexture:{value:null},bloomTexture:{value:this._composer.renderTarget2.texture}},vertexShader:"varying vec2 vUv;\n\t\t\t void main() {\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t }",fragmentShader:"uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n varying vec2 vUv;\n vec4 getTexture( sampler2D texelToLinearTexture ) {\n return mapTexelToLinear( texture2D( texelToLinearTexture , vUv ) );\n }\n void main() {\n gl_FragColor = ( getTexture( baseTexture ) + vec4( 1.0 ) * getTexture( bloomTexture ) );\n }",defines:{}}),"baseTexture"),this.pass.needsSwap=!0,b(u(n.prototype),"init",this).call(this)}},{key:"setSize",value:function(e,t){this._composer.setSize(e,t)}},{key:"setStrength",value:function(e){this._bloomPass.strength=e,this.viewer.renderManager.render()}},{key:"getStrength",value:function(){return this._bloomPass.strength}},{key:"setRadius",value:function(e){this._bloomPass.radius=e,this.viewer.renderManager.render()}},{key:"getRadius",value:function(){return this._bloomPass.radius}},{key:"setThreshold",value:function(e){this._bloomPass.threshold=e,this.viewer.renderManager.render()}},{key:"getThreshold",value:function(){return this._bloomPass.threshold}},{key:"setExposure",value:function(e){this._bloomPass.exposure=e}},{key:"getExposure",value:function(){return this._bloomPass.exposure||1}},{key:"add",value:function(e){console.log(e);var t=this._objects;function n(e){t.includes(e)||(e.layers.mask=3,e.bloom=!0,t.push(e))}this._lastSelected=e,"Mesh"!==e.type&&"SkinnedMesh"!==e.type||n(e),"Object3D"!==e.type&&"Group"!==e.type||e.traverse((function(e){("Mesh"===e.type||"SkinnedMesh"===e.type)&&n(e)}))}},{key:"remove",value:function(e){var t=this._objects;function n(e){t.includes(e)&&(e.layers.mask=1,delete e.bloom,t.splice(t.indexOf(e),1))}"Mesh"!==e.type&&"SkinnedMesh"!==e.type||n(e),"Object3D"!==e.type&&"Group"!==e.type||e.traverse((function(e){("Mesh"===e.type||"SkinnedMesh"===e.type)&&n(e)}))}},{key:"clear",value:function(){this._objects.map((function(e){e.layers.mask=1,delete e.bloom})),this._objects=[]}},{key:"render",value:function(){var e,t,n=this;this.viewer.scene.traverse((function(i){n._darkenNonBloomed(i),"_shadow.mesh"==i.name&&(e=i),i.constructor===Fu&&i.visible&&(t=i)}));var i=this.viewer.scene.background;this.viewer.scene.background=null,e&&(e.visible=!1),t&&this.viewer.root.remove(t),this._composer.render(),this.viewer.scene.background=i,e&&(e.visible=!0),t&&this.viewer.root.add(t),this.viewer.scene.traverse((function(e){n._restoreMaterial(e)})),this._hideObjects.map((function(e){return e.visible=!0})),this._hideObjects.length=0}},{key:"_darkenNonBloomed",value:function(e){if(e.isAmrtAlphaHotSpotEntity&&e.isAmrtAlphaHotSpotEntity.visible)return e.visible=!1,void this._hideObjects.push(e);if((e.isMesh||e.isSprite)&&!1===this._bloomLayer.test(e.layers)){if(Array.isArray(e.material)){if(e.material.find((function(e){return e.transparent}))&&e.visible)return e.visible=!1,void this._hideObjects.push(e)}else if(e.material.opacity<1&&e.visible)return e.visible=!1,void this._hideObjects.push(e);this._materials[e.uuid]=e.material,e.material=this._darkMaterial}}},{key:"_restoreMaterial",value:function(e){this._materials[e.uuid]&&(e.material=this._materials[e.uuid],delete this._materials[e.uuid])}}]),n}(Bu),Ru={defines:{DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},aspect:{value:1},aperture:{value:.025},maxblur:{value:.01},nearClip:{value:1},farClip:{value:1e3}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include ","varying vec2 vUv;","uniform sampler2D tColor;","uniform sampler2D tDepth;","uniform float maxblur;","uniform float aperture;","uniform float nearClip;","uniform float farClip;","uniform float focus;","uniform float aspect;","#include ","float getDepth( const in vec2 screenPosition ) {","\t#if DEPTH_PACKING == 1","\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );","\t#else","\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, nearClip, farClip );","\t#else","\treturn orthographicDepthToViewZ( depth, nearClip, farClip );","\t#endif","}","void main() {","\tvec2 aspectcorrect = vec2( 1.0, aspect );","\tfloat viewZ = getViewZ( getDepth( vUv ) );","\tfloat factor = ( focus + viewZ );","\tvec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );","\tvec2 dofblur9 = dofblur * 0.9;","\tvec2 dofblur7 = dofblur * 0.7;","\tvec2 dofblur4 = dofblur * 0.4;","\tvec4 col = vec4( 0.0 );","\tcol += texture2D( tColor, vUv.xy );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );","\tgl_FragColor = col / 41.0;","\tgl_FragColor.a = 1.0;","}"].join("\n")},Ou=function(e,t,n){hu.call(this),this.scene=e,this.camera=t,this.apertureScale=1,this.focus=void 0!==n.focus?n.focus:1,this.aspect=void 0!==n.aspect?n.aspect:t.aspect,this.aperture=void 0!==n.aperture?n.aperture:.025,this.maxblur=void 0!==n.maxblur?n.maxblur:1;var i=n.width||window.innerWidth||1,r=n.height||window.innerHeight||1;this.renderTargetDepth=new dt(i,r,{minFilter:X,magFilter:X}),this.renderTargetDepth.texture.name="BokehPass.depth",this.materialDepth=new Ra,this.materialDepth.depthPacking=je,this.materialDepth.blending=0,void 0===Ru&&console.error("BokehPass relies on BokehShader");var a=Ru,o=Di.clone(a.uniforms);o.tDepth.value=this.renderTargetDepth.texture,o.focus.value=this.focus,o.aspect.value=this.aspect,o.aperture.value=this.aperture,o.maxblur.value=this.maxblur,o.nearClip.value=t.near,o.farClip.value=t.far,this.materialBokeh=new Ri({defines:Object.assign({},a.defines),uniforms:o,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}),this.uniforms=o,this.needsSwap=!1,this.fsQuad=new hu.FullScreenQuad(this.materialBokeh),this.oldClearColor=new Fn};Ou.prototype=Object.assign(Object.create(hu.prototype),{constructor:Ou,render:function(e,t,n){this.scene.overrideMaterial=this.materialDepth,this.oldClearColor.copy(e.getClearColor());var i=e.getClearAlpha(),r=e.autoClear;e.autoClear=!1,e.setClearColor(16777215),e.setClearAlpha(1),e.setRenderTarget(this.renderTargetDepth),e.clear(),e.render(this.scene,this.camera),this.uniforms.focus.value=this.focus,this.focus>.1?this.apertureScale=.1/this.focus:this.apertureScale=1,this.uniforms.aspect.value=this.aspect,this.uniforms.aperture.value=this.aperture*this.apertureScale,this.uniforms.maxblur.value=this.maxblur,this.uniforms.tColor.value=n.texture,this.uniforms.nearClip.value=this.camera.near,this.uniforms.farClip.value=this.camera.far,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),e.clear(),this.fsQuad.render(e)),this.scene.overrideMaterial=null,e.setClearColor(this.oldClearColor),e.setClearAlpha(i),e.autoClear=r}});var Nu=function(e){h(n,e);var t=y(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,n),(e=t.call(this)).antiAliasing=null,e.focus=i.focus||500,e.aperture=i.aperture||1,e.maxblur=i.maxblur||.01,e.apertureScale=1,e}return A(n,[{key:"init",value:function(e){Uu||(Uu=new Ou(e.scene,e.camera,{focus:this.focus,aperture:this.aperture,maxblur:this.maxblur}),this.pass=Uu),b(u(n.prototype),"init",this).call(this)}},{key:"setFocus",value:function(e){this.focus=e,this.pass.focus=e}},{key:"setAperture",value:function(e){this.aperture=e,this.pass.aperture=e}},{key:"setMaxblur",value:function(e){this.maxblur=e,this.pass.maxblur=.001*e}},{key:"setAspect",value:function(e){this.pass.uniforms.aspect.value=e}}]),n}(Bu),zu=function(e,t,n){hu.call(this),this.h=e,this.s=t,this.v=n,this.uniform={h:{value:0},s:{value:0},v:{value:0},t2D:{value:null}},this.material=new Ri({uniforms:this.uniform,vertexShader:"\nvarying vec2 vUv;\n//uniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = uv;\n\t//vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n\n",fragmentShader:"\n\n float lerpFloat(float a,float b,float f){\n return a * (1.0 - f) + b * f;\n }\n\n vec3 lerp(vec3 a,vec3 b,float f){\n vec3 final = vec3(0.0,0.0,0.0);\n final.x = lerpFloat(a.x,b.x,f);\n final.y = lerpFloat(a.y,b.y,f);\n final.z = lerpFloat(a.z,b.z,f);\n return final;\n }\n\n vec4 lerp4(vec4 a,vec4 b,float f){\n vec4 final = vec4(0.0,0.0,0.0,0.0);\n final.x = lerpFloat(a.x,b.x,f);\n final.y = lerpFloat(a.y,b.y,f);\n final.z = lerpFloat(a.z,b.z,f);\n final.w = lerpFloat(a.w,b.w,f);\n return final;\n }\n\n vec3 HSV2RGB(vec3 c)\n {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);\n }\n\n vec3 RgbToHsv(vec3 c)\n {\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = lerp4(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = lerp4(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n }\n\n float RotateHue(float value, float low, float hi)\n {\n return (value < low)? value + hi : (value > hi)? value - hi : value;\n }\n\n float Luminance(vec3 linearRgb)\n {\n return dot(linearRgb, vec3(0.2126729, 0.7151522, 0.0721750));\n } \n\n vec3 Saturation(vec3 c, float sat)\n {\n vec3 satV = vec3(sat,sat,sat);\n float luma = Luminance(c);\n vec3 lumaV = vec3(luma,luma,luma);\n return lumaV.xxx + satV.xxx * (c - lumaV.xxx);\n }\n\n uniform sampler2D t2D;\n\n uniform float h;\n uniform float s;\n uniform float v;\n\n varying vec2 vUv;\n\n\n void main() {\n\n vec4 texColor = texture2D( t2D, vUv );\n\n vec3 hsv = RgbToHsv(texColor.rgb);\n float hue = hsv.x + h;\n hsv.x = RotateHue(hue, 0.0, 1.0);\n //hsv.y+=s;\n hsv.z+=v;\n texColor.rgb = HSV2RGB(hsv);\n texColor.rgb = Saturation(texColor.rgb, 1.0 + s);\n\n gl_FragColor = mapTexelToLinear( texColor );\n\n #include \n #include \n\n }\n\n"}),this.fsQuad=new hu.FullScreenQuad(this.material)};zu.prototype=Object.assign(Object.create(hu.prototype),{constructor:zu,render:function(e,t,n,i){this.uniform.h.value=this.h,this.uniform.s.value=this.s,this.uniform.v.value=this.v,this.uniform.t2D.value=n.texture,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))}});var Qu=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this,e)).h=0,i.s=0,i.v=0,i.pass=new zu(i.h,i.s,i.v),i}return A(n,[{key:"getHue",value:function(){return this.pass.h}},{key:"setHue",value:function(e){this.pass.h=e}},{key:"getContrast",value:function(){return this.pass.s}},{key:"setContrast",value:function(e){this.pass.s=e}},{key:"getVibrance",value:function(){return this.pass.v}},{key:"setVibrance",value:function(e){this.pass.v=e}}]),n}(Bu),Gu=function(e){null==e&&(e=Math),this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.grad4=[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]],this.p=[];for(var t=0;t<256;t++)this.p[t]=Math.floor(256*e.random());this.perm=[];for(t=0;t<512;t++)this.perm[t]=this.p[255&t];this.simplex=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]};Gu.prototype.dot=function(e,t,n){return e[0]*t+e[1]*n},Gu.prototype.dot3=function(e,t,n,i){return e[0]*t+e[1]*n+e[2]*i},Gu.prototype.dot4=function(e,t,n,i,r){return e[0]*t+e[1]*n+e[2]*i+e[3]*r},Gu.prototype.noise=function(e,t){var n,i,r=(e+t)*(.5*(Math.sqrt(3)-1)),a=Math.floor(e+r),o=Math.floor(t+r),s=(3-Math.sqrt(3))/6,l=(a+o)*s,A=e-(a-l),c=t-(o-l);A>c?(n=1,i=0):(n=0,i=1);var h=A-n+s,u=c-i+s,d=A-1+2*s,f=c-1+2*s,p=255&a,m=255&o,v=this.perm[p+this.perm[m]]%12,g=this.perm[p+n+this.perm[m+i]]%12,y=this.perm[p+1+this.perm[m+1]]%12,w=.5-A*A-c*c,x=.5-h*h-u*u,b=.5-d*d-f*f;return 70*((w<0?0:(w*=w)*w*this.dot(this.grad3[v],A,c))+(x<0?0:(x*=x)*x*this.dot(this.grad3[g],h,u))+(b<0?0:(b*=b)*b*this.dot(this.grad3[y],d,f)))},Gu.prototype.noise3d=function(e,t,n){var i,r,a,o,s,l,A=(e+t+n)*(1/3),c=Math.floor(e+A),h=Math.floor(t+A),u=Math.floor(n+A),d=1/6,f=(c+h+u)*d,p=e-(c-f),m=t-(h-f),v=n-(u-f);p>=m?m>=v?(i=1,r=0,a=0,o=1,s=1,l=0):p>=v?(i=1,r=0,a=0,o=1,s=0,l=1):(i=0,r=0,a=1,o=1,s=0,l=1):mT?32:0)+(S>_?16:0)+(T>_?8:0)+(S>I?4:0)+(T>I?2:0)+(_>I?1:0),F=S-(r=v[L][0]>=3?1:0)+w,k=T-(a=v[L][1]>=3?1:0)+w,P=_-(o=v[L][2]>=3?1:0)+w,U=I-(s=v[L][3]>=3?1:0)+w,D=S-(l=v[L][0]>=2?1:0)+2*w,R=T-(A=v[L][1]>=2?1:0)+2*w,O=_-(c=v[L][2]>=2?1:0)+2*w,N=I-(h=v[L][3]>=2?1:0)+2*w,z=S-(u=v[L][0]>=1?1:0)+3*w,Q=T-(d=v[L][1]>=1?1:0)+3*w,G=_-(f=v[L][2]>=1?1:0)+3*w,H=I-(p=v[L][3]>=1?1:0)+3*w,V=S-1+4*w,j=T-1+4*w,W=_-1+4*w,X=I-1+4*w,Y=255&b,K=255&M,Z=255&C,J=255&B,q=g[Y+g[K+g[Z+g[J]]]]%32,$=g[Y+r+g[K+a+g[Z+o+g[J+s]]]]%32,ee=g[Y+l+g[K+A+g[Z+c+g[J+h]]]]%32,te=g[Y+u+g[K+d+g[Z+f+g[J+p]]]]%32,ne=g[Y+1+g[K+1+g[Z+1+g[J+1]]]]%32,ie=.6-S*S-T*T-_*_-I*I,re=.6-F*F-k*k-P*P-U*U,ae=.6-D*D-R*R-O*O-N*N,oe=.6-z*z-Q*Q-G*G-H*H,se=.6-V*V-j*j-W*W-X*X;return 27*((ie<0?0:(ie*=ie)*ie*this.dot4(m[q],S,T,_,I))+(re<0?0:(re*=re)*re*this.dot4(m[$],F,k,P,U))+(ae<0?0:(ae*=ae)*ae*this.dot4(m[ee],D,R,O,N))+(oe<0?0:(oe*=oe)*oe*this.dot4(m[te],z,Q,G,H))+(se<0?0:(se*=se)*se*this.dot4(m[ne],V,j,W,X)))};var Hu={defines:{PERSPECTIVE_CAMERA:1,KERNEL_SIZE:32},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},tNoise:{value:null},kernel:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new tt},cameraProjectionMatrix:{value:new bt},cameraInverseProjectionMatrix:{value:new bt},kernelRadius:{value:8},minDistance:{value:.005},maxDistance:{value:.05}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform sampler2D tNormal;","uniform sampler2D tDepth;","uniform sampler2D tNoise;","uniform vec3 kernel[ KERNEL_SIZE ];","uniform vec2 resolution;","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float kernelRadius;","uniform float minDistance;","uniform float maxDistance;","varying vec2 vUv;","#include ","float getDepth( const in vec2 screenPosition ) {","\treturn texture2D( tDepth, screenPosition ).x;","}","float getLinearDepth( const in vec2 screenPosition ) {","\t#if PERSPECTIVE_CAMERA == 1","\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;","\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );","\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );","\t#else","\t\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {","\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];","\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );","\tclipPosition *= clipW; // unprojection.","\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec2 screenPosition ) {","\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );","}","void main() {","\tfloat depth = getDepth( vUv );","\tfloat viewZ = getViewZ( depth );","\tvec3 viewPosition = getViewPosition( vUv, depth, viewZ );","\tvec3 viewNormal = getViewNormal( vUv );"," vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );","\tvec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;","\tvec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );","\tvec3 bitangent = cross( viewNormal, tangent );","\tmat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );"," float occlusion = 0.0;"," for ( int i = 0; i < KERNEL_SIZE; i ++ ) {","\t\tvec3 sampleVector = kernelMatrix * kernel[ i ];","\t\tvec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );","\t\tvec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );","\t\tsamplePointNDC /= samplePointNDC.w;","\t\tvec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;","\t\tfloat realDepth = getLinearDepth( samplePointUv );","\t\tfloat sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );","\t\tfloat delta = sampleDepth - realDepth;","\t\tif ( delta > minDistance && delta < maxDistance ) {","\t\t\tocclusion += 1.0;","\t\t}","\t}","\tocclusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );","\tgl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );","}"].join("\n")},Vu={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","varying vec2 vUv;","#include ","float getLinearDepth( const in vec2 screenPosition ) {","\t#if PERSPECTIVE_CAMERA == 1","\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;","\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );","\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );","\t#else","\t\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","void main() {","\tfloat depth = getLinearDepth( vUv );","\tgl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );","}"].join("\n")},ju={uniforms:{tDiffuse:{value:null},resolution:{value:new tt}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","void main() {","\tvec2 texelSize = ( 1.0 / resolution );","\tfloat result = 0.0;","\tfor ( int i = - 2; i <= 2; i ++ ) {","\t\tfor ( int j = - 2; j <= 2; j ++ ) {","\t\t\tvec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;","\t\t\tresult += texture2D( tDiffuse, vUv + offset ).r;","\t\t}","\t}","\tgl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );","}"].join("\n")},Wu=function(e,t,n,i){hu.call(this),this.width=void 0!==n?n:512,this.height=void 0!==i?i:512,this.clear=!0,this.camera=t,this.scene=e,this.kernelRadius=8,this.kernelSize=32,this.kernel=[],this.noiseTexture=null,this.output=0,this.minDistance=.005,this.maxDistance=.1,this.generateSampleKernel(),this.generateRandomKernelRotations();var r=new ns;r.type=ee,r.minFilter=X,r.maxFilter=X,this.beautyRenderTarget=new dt(this.width,this.height,{minFilter:Z,magFilter:Z,format:ce,depthTexture:r,depthBuffer:!0,stencilBuffer:!0}),this.normalRenderTarget=new dt(this.width,this.height,{minFilter:X,magFilter:X,format:ce,stencilBuffer:!0}),this.ssaoRenderTarget=new dt(this.width,this.height,{minFilter:Z,magFilter:Z,format:ce,stencilBuffer:!0}),this.blurRenderTarget=this.ssaoRenderTarget.clone(),this.ssaoMaterial=new Ri({defines:Object.assign({},Hu.defines),uniforms:Di.clone(Hu.uniforms),vertexShader:Hu.vertexShader,fragmentShader:Hu.fragmentShader,blending:0,stencilWrite:!0}),this.ssaoMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssaoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssaoMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.ssaoMaterial.uniforms.tNoise.value=this.noiseTexture,this.ssaoMaterial.uniforms.kernel.value=this.kernel,this.ssaoMaterial.uniforms.cameraNear.value=this.camera.near,this.ssaoMaterial.uniforms.cameraFar.value=this.camera.far,this.ssaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.getInverse(this.camera.projectionMatrix),this.normalMaterial=new bl,this.normalMaterial.blending=0,this.normalMaterial.stencilWrite=!0,this.blurMaterial=new Ri({defines:Object.assign({},ju.defines),uniforms:Di.clone(ju.uniforms),vertexShader:ju.vertexShader,fragmentShader:ju.fragmentShader,stencilWrite:!0}),this.blurMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new Ri({defines:Object.assign({},Vu.defines),uniforms:Di.clone(Vu.uniforms),vertexShader:Vu.vertexShader,fragmentShader:Vu.fragmentShader,blending:0,stencilWrite:!0}),this.depthRenderMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new Ri({uniforms:Di.clone(du.uniforms),vertexShader:du.vertexShader,fragmentShader:du.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:R,blendDst:L,blendEquation:I,blendSrcAlpha:D,blendDstAlpha:L,blendEquationAlpha:I,stencilWrite:!0}),this.fsQuad=new hu.FullScreenQuad(null),this.originalClearColor=new Fn};Wu.prototype=Object.assign(Object.create(hu.prototype),{constructor:Wu,dispose:function(){this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.ssaoRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.quad.geometry.dispose(),this.normalMaterial.dispose(),this.blurMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose()},toggleBackgroundVisible:function(e){e?(this.scene.background=this.scene._background,this.scene._shadow&&(this.scene._shadow.visible=!0),delete this.scene._background,delete this.scene._shadow):(this.scene._background=this.scene.background,this.scene.background=null,this.scene._shadow&&(this.scene._shadow.visible=!1))},render:function(e,t,n,i,r){switch(this.beautyRenderTarget=n,this.toggleBackgroundVisible(!1),this.renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this.toggleBackgroundVisible(!0),this.ssaoMaterial.uniforms.kernelRadius.value=this.kernelRadius,this.ssaoMaterial.uniforms.minDistance.value=this.minDistance,this.ssaoMaterial.uniforms.maxDistance.value=this.maxDistance,this.renderPass(e,this.ssaoMaterial,this.ssaoRenderTarget),this.renderPass(e,this.blurMaterial,this.blurRenderTarget),this.output){case Wu.OUTPUT.SSAO:this.copyMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Wu.OUTPUT.Blur:this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Wu.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Wu.OUTPUT.Depth:this.renderPass(e,this.depthRenderMaterial,this.renderToScreen?null:t);break;case Wu.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Wu.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=5,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;default:console.warn("SSAOPass: Unknown output type.")}},renderPass:function(e,t,n,i,r){this.originalClearColor.copy(e.getClearColor());var a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,null!=i&&(e.setClearColor(i),e.setClearAlpha(r||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)},renderOverride:function(e,t,n,i,r){this.originalClearColor.copy(e.getClearColor());var a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,i=t.clearColor||i,r=t.clearAlpha||r,null!=i&&(e.setClearColor(i),e.setClearAlpha(r||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)},setSize:function(e,t){this.width=e,this.height=t,this.beautyRenderTarget.setSize(e,t),this.ssaoRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.blurRenderTarget.setSize(e,t),this.ssaoMaterial.uniforms.resolution.value.set(e,t),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.getInverse(this.camera.projectionMatrix),this.blurMaterial.uniforms.resolution.value.set(e,t)},generateSampleKernel:function(){for(var e=this.kernelSize,t=this.kernel,n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return s(this,n),e=t.call(this,i),null==i.darkness&&(i.darkness=.5),null==i.offset&&(i.offset=.5),e}return A(n,[{key:"init",value:function(e){this.pass=new Yu(Ku),this.pass.enabled=!0,this.pass.uniforms.darkness.value=this.options.darkness,this.pass.uniforms.offset.value=this.options.offset,b(u(n.prototype),"init",this).call(this)}},{key:"getDarkness",value:function(){return this.pass.uniforms.darkness.value}},{key:"setDarkness",value:function(e){this.pass.uniforms.darkness.value=e}},{key:"getOffset",value:function(){return this.pass.uniforms.offset.value}},{key:"setOffset",value:function(e){this.pass.uniforms.offset.value=e}}]),n}(Bu),Ju=function(e,t,n,i){hu.call(this),this.renderScene=e,this.renderCamera=t,this.oldClearColor=new Fn,this.oldClearAlpha=1,i=i||{},this.center=i.center?(new at).copy(i.center):new at(0,0,0),this.maxRange=i.maxRange?i.maxRange:50;var r=i.speed?i.speed:30;this.frameSpeed=r/60,this.radius=i.radius?i.radius:5,this.innerRadius=-this.radius,this.outerRadius=0,this.fillType=0==i.fillType?0:1,this.fillColor=i.fillColor?i.fillColor:new Fn("#ffff00");var a={minFilter:Z,magFilter:Z,format:ce,stencilBuffer:!0};n.antialias=!0,n.alpha=!0;var o=n.getSize(new tt),s=n.getPixelRatio(),l=o.width,A=o.height;this.depthTarget=new dt(l*s,A*s,a),this.depthTarget.depthBuffer=!0,this.depthTarget.depthTexture=new ns;var c=this.getShaderOptions();this.depthMaterial=new Ri(c),this.fsQuad=new hu.FullScreenQuad(this.depthMaterial)};Ju.prototype=Object.assign(Object.create(hu.prototype),{constructor:Ju,render:function(e,t,n,i,r){this.updateUniforms(n),this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha();var a=e.autoClear;e.autoClear=!1,e.setRenderTarget(t),this.fsQuad.render(e),e.setRenderTarget(this.depthTarget),e.render(this.renderScene,this.renderCamera),e.setRenderTarget(null),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=a},calCameraVectors:function(){var e=this.renderCamera,t=e.near,n=e.fov,i=e.aspect,r=Math.tan(this.ang2rad(n/2))*t,a=r*i,o=new at(0,0,1).applyMatrix4(e.matrixWorld.clone());o.sub(e.position.clone()),o.normalize();var s=new at(-1,0,0).applyMatrix4(e.matrixWorld.clone());s.sub(e.position.clone()),s.normalize();var l=new at(0,-1,0).applyMatrix4(e.matrixWorld.clone());l.sub(e.position.clone()),l.normalize();var A=s.multiplyScalar(a),c=l.multiplyScalar(r),h=o.clone().multiplyScalar(t).add(c.clone()).sub(A.clone()),u=h.length()/t;h.normalize(),h.multiplyScalar(-u);var d=o.clone().multiplyScalar(t).add(A.clone()).add(c.clone());d.normalize(),d.multiplyScalar(-u);var f=o.clone().multiplyScalar(t).sub(c.clone()).sub(A.clone());f.normalize(),f.multiplyScalar(-u);var p=o.clone().multiplyScalar(t).add(A.clone()).sub(c.clone());p.normalize(),p.multiplyScalar(-u),this.topLeftVec=h,this.topRightVec=d,this.bottomLeftVec=f,this.bottomRightVec=p},updateUniforms:function(e){this.calCameraVectors(),this.depthMaterial.uniforms.colorTexture.value=e.texture,this.depthMaterial.uniforms.cameraPos.value=this.renderCamera.position,this.depthMaterial.uniforms.topLeftVec.value=this.topLeftVec,this.depthMaterial.uniforms.topRightVec.value=this.topRightVec,this.depthMaterial.uniforms.bottomLeftVec.value=this.bottomLeftVec,this.depthMaterial.uniforms.bottomRightVec.value=this.bottomRightVec,this.depthMaterial.uniforms.center.value=this.center,this.depthMaterial.uniforms.fillType.value=this.fillType,this.depthMaterial.uniforms.fillColor.value=this.fillColor,this.depthMaterial.uniforms.innerRadius.value>this.maxRange&&(this.depthMaterial.uniforms.innerRadius.value=-this.radius,this.depthMaterial.uniforms.outerRadius.value=0),this.depthMaterial.uniforms.innerRadius.value+=this.frameSpeed,this.depthMaterial.uniforms.outerRadius.value=this.depthMaterial.uniforms.innerRadius.value+this.radius},ang2rad:function(e){return e*Math.PI/180},getShaderOptions:function(){var e={transparent:!0};return e.uniforms={colorTexture:{value:null},depthTexture:{value:this.depthTarget.depthTexture},cameraFar:{value:this.renderCamera.far},cameraNear:{value:this.renderCamera.near},cameraPos:{value:this.renderCamera.position.clone()},topLeftVec:{value:this.topLeftVec},topRightVec:{value:this.topRightVec},bottomLeftVec:{value:this.bottomLeftVec},bottomRightVec:{value:this.bottomRightVec},center:{value:this.center.clone()},innerRadius:{value:this.innerRadius},outerRadius:{value:this.outerRadius},fillType:{value:this.fillType},fillColor:{value:this.fillColor}},e.vertexShader="\n precision highp float;\n uniform vec3 topLeftVec;\n uniform vec3 topRightVec;\n uniform vec3 bottomLeftVec;\n uniform vec3 bottomRightVec;\n \n varying vec2 vUv;\n varying vec3 cameraVec;\n \n void main() {\n vUv = uv;\n if(uv.x < 0.5 && uv.y < 0.5) { // bottom left \n cameraVec = bottomLeftVec;\n }else if(uv.x < 0.5 && uv.y > 0.5) { // top left\n cameraVec = topLeftVec;\n }else if(uv.x > 0.5 && uv.y > 0.5) { // top right\n cameraVec = topRightVec;\n }else { // bottom right \n cameraVec = bottomRightVec;\n }\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",e.fragmentShader="\n #include \n varying vec2 vUv;\n varying vec3 cameraVec;\n \n uniform float cameraFar;\n uniform float cameraNear;\n uniform vec3 cameraPos;\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n \n uniform vec3 center;\n uniform float innerRadius;\n uniform float outerRadius;\n uniform int fillType;\n uniform vec3 fillColor;\n \n float readClipZ( sampler2D depthSampler, vec2 coord ) {\n float fragCoordZ = texture2D( depthSampler, coord ).x;\n return perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar ); // 返回相机空间的 viewZ(相对于相机空间的实际z)\n }\n \n void main() {\n // gl_FragColor = vec4(1.0,0.0,0.0,1.0);\n // return;\n float clipZ = readClipZ( depthTexture, vUv );\n \n vec4 diff = texture2D( colorTexture, vUv);\n vec3 wP = cameraPos + (cameraVec)*abs(clipZ);\n \n float dis = distance(wP, center);\n float circleWidth = outerRadius - innerRadius;\n if(dis < outerRadius && dis > innerRadius) {\n if(fillType == 1) { // pure: 0 - linear: 1\n gl_FragColor = vec4(mix(diff.xyz, fillColor, (dis - innerRadius)/circleWidth), 1.0);\n }else {\n gl_FragColor = vec4(mix(diff.xyz, fillColor, 0.5), 1.0);\n }\n }else {\n gl_FragColor = diff;\n }\n }",e}});var qu=function(e){h(n,e);var t=y(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,n),t.call(this,e)}return A(n,[{key:"init",value:function(e){this.pass=new Ju(e.scene,e.camera,e.renderer,this.options),this.pass.enabled=!0,b(u(n.prototype),"init",this).call(this)}},{key:"getSpeed",value:function(){return this.pass.frameSpeed}},{key:"setSpeed",value:function(e){if(e){var t=e/60;this.pass.frameSpeed=t}}},{key:"getRadius",value:function(){return this.pass.radius}},{key:"setRadius",value:function(e){e&&(this.pass.radius=e)}},{key:"getMaxRange",value:function(){return this.pass.maxRange}},{key:"setMaxRange",value:function(e){e&&(this.pass.maxRange=e)}},{key:"getCenter",value:function(){return this.pass.radius}},{key:"setCenter",value:function(e){e&&(this.pass.center=(new at).copy(e))}},{key:"getFillType",value:function(){return this.pass.fillType}},{key:"setFillType",value:function(e){this.pass.fillType=0==e?0:1}},{key:"getFillColor",value:function(){return this.pass.fillColor}},{key:"setFillColor",value:function(e){e&&(this.pass.fillColor=new Fn(e))}}]),n}(Bu),$u=function(e){h(n,e);var t=y(n);function n(e){var i,r=e.renderer,a=e.scene,o=e.camera,l=e.groundReflector;return s(this,n),(i=t.call(this)).renderer=r,i.scene=a,i.camera=o,i.groundReflector=l,i.needsSwap=!1,i}return A(n,[{key:"dispose",value:function(){}},{key:"render",value:function(e,t,n,i,r){this.groundReflector.doRender(this.renderer,this.scene,this.camera),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(n),e.render(this.scene,this.camera)}},{key:"setSize",value:function(e,t){this.width=e,this.height=t,this.groundReflector.resize(e,t)}}]),n}(hu),ed=5+[.125,.215,.35,.446,.526,.582].length,td=new FA,nd=[.0205,.0855,.232,.324,.232,.0855,.0205],id=function(){function e(t){s(this,e),this._renderer=t,this._oldTarget=null,this.srcWidth=512,this.srcHeight=512,this.renderTexture=null,this._pingPongRenderTexture=null,this._lodPlanes=[],this._sizeLods=[],this.isInit=!1}return A(e,[{key:"init",value:function(){this.isInit||(this.isInit=!0,this._createPlanes(),this._blurMaterial=this._getTextureBlurShader(7),this._compileMaterial(this._blurMaterial),this._material=this._getTextureShader(),this._compileMaterial(this._material))}},{key:"dispose",value:function(){this.renderTexture&&this.renderTexture.dispose(),this._pingPongRenderTexture&&this._pingPongRenderTexture.dispose(),this._lodPlanes=[],this._sizeLods=[],this.isInit=!1,this._blurMaterial&&this._blurMaterial.dispose(),this._material&&this._material.dispose()}},{key:"fromTexture",value:function(e){return this._oldTarget=this._renderer.getRenderTarget(),this.srcWidth=e.image.width,this.srcHeight=this.srcWidth,this.init(),this.createTargets(e),this.textureUV(e),this._applyMipmap(),this.renderTexture}},{key:"textureUV",value:function(e){var t=new Qt;t.add(new Ei(this._lodPlanes[0],this._material)),this._material.uniforms.envMap.value=e,this._setViewport(this.renderTexture,0,0,this.srcWidth,this.srcHeight),this._renderer.setRenderTarget(this.renderTexture),this._renderer.render(t,td)}},{key:"_applyMipmap",value:function(){var e=this._renderer.autoClear;this._renderer.autoClear=!1;for(var t=1;t=9?t/10:t>=6?.4+(t-6)/3*.5:t>=5?.305+.095*(t-5):t>=4?.21+.095*(t-4):t/4*.21}},{key:"_halfBlur",value:function(e,t,n,i,r){var a=new Qt;a.add(new Ei(this._lodPlanes[i],this._blurMaterial));var o=this._blurMaterial.uniforms;o.envMap.value=e.texture,o.weights.value=nd,o.mipInt.value=n,o.isVertical.value=r,o.roughness.value=this.getRoughness(n)/this.getRoughness(n-1);var s=this._sizeLods[i];o.texSize.value=this._sizeLods[n],o.maxSize.value=this.srcWidth;var l=Math.max(0,this.srcWidth-2*s),A=(0===i?0:this.srcWidth)+s*(i>4?i-8+4:0);this._setViewport(t,l,A,s,s),this._renderer.setRenderTarget(t),this._renderer.render(a,td)}},{key:"_createPlanes",value:function(){for(var e=this.srcWidth,t=0;tthis.srcWidth/16&&(e/=2)}}},{key:"createTargets",value:function(e){var t={magFilter:X,minFilter:X,generateMipmaps:!1,type:e?e.type:$,format:e?e.format:de,encoding:e?e.encoding:Qe,depthBuffer:!1,stencilBuffer:!1};this.renderTexture||(this.renderTexture=this.createRenderTexture(t),this.renderTexture.depthBuffer=!e),this._pingPongRenderTexture||(this._pingPongRenderTexture=this.createRenderTexture(t))}},{key:"createRenderTexture",value:function(e){var t=new dt(this.srcWidth,this.srcWidth+this.srcWidth/2,e);return t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}},{key:"_setViewport",value:function(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}},{key:"_compileMaterial",value:function(e){var t=new Qt;t.add(new Ei(this._lodPlanes[0],e)),this._renderer.compile(t,td)}},{key:"_getTextureBlurShader",value:function(e){var t=new vl({uniforms:{envMap:{value:null},weights:{value:new Float32Array(e)},mipInt:{value:0},texSize:{value:0},maxSize:{value:0},isVertical:{value:0},roughness:{value:1}},vertexShader:this._getTextureCommonVertex(),fragmentShader:"\n precision mediump float;\n precision mediump int;\n varying vec2 vUv;\n uniform sampler2D envMap;\n uniform float weights[7];\n uniform float mipInt;\n uniform float texSize;\n uniform float maxSize;\n uniform int isVertical;\n uniform float roughness;\n\n vec3 sampleTexture(sampler2D envMap,vec2 uv,vec2 xRange,vec2 yRange){\n\n float xpercent = 1.0 / maxSize;\n float maxY = (maxSize + maxSize / 2.0);\n float ypercent = 1.0 / maxY;\n if(uv.x > xRange.y){\n uv.x = xRange.y - xpercent;\n }\n if(uv.x < xRange.x){\n uv.x = xRange.x + xpercent;\n }\n if(uv.y > yRange.y){\n uv.y = yRange.y - ypercent;;// - ypercent;\n }\n if(uv.y < yRange.x){\n uv.y = yRange.x + ypercent;\n }\n\n return texture2D(envMap,uv).rgb;\n }\n \n vec3 bilinearCubeUV(sampler2D envMap, float mipInt) {\n\n float maxY = (maxSize + maxSize / 2.0);\n vec2 uv = vUv;\n vec2 xRange = vec2(0.0,1.0);\n vec2 yRange = vec2(0.0,1.0);\n if(mipInt == 0.0 ){\n float uvx = vUv.x;\n float uvy = vUv.y * (texSize / maxY);\n uv = vec2(uvx,uvy);\n yRange.y = texSize / maxY;\n }\n else\n {\n xRange.x = (maxSize - 2.0 * texSize) / maxSize;\n xRange.y = xRange.x + texSize / maxSize;\n\n float uvx = xRange.x + (texSize / maxSize) * vUv.x;\n float uvy = vUv.y;\n if(mipInt < 5.0){\n yRange.x = maxSize / maxY;\n yRange.y = maxSize / maxY + texSize / maxY;\n uvy = yRange.x + texSize / maxY * vUv.y;\n }\n if(mipInt > 4.0){\n yRange.x = (maxSize + (mipInt - 4.0) * texSize) / maxY;\n yRange.y = (maxSize + (mipInt - 4.0) * texSize) / maxY + texSize / maxY;\n uvy = yRange.x + texSize / maxY * vUv.y;\n }\n uv = vec2(uvx,uvy);\n }\n\n float xpercent = 1.0 / maxSize;\n float ypercent = 1.0 / maxY;\n vec3 finalCol = vec3(0.0,0.0,0.0);\n float offset = 1.0;\n if(isVertical == 1){\n finalCol += sampleTexture(envMap, uv - vec2(0.0,ypercent * offset * 3.0),xRange,yRange).rgb * weights[0];\n finalCol += sampleTexture(envMap, uv - vec2(0.0,ypercent * offset * 2.0),xRange,yRange).rgb * weights[1];\n finalCol += sampleTexture(envMap, uv - vec2(0.0,ypercent * offset * 1.0),xRange,yRange).rgb * weights[2];\n finalCol += sampleTexture(envMap, uv,xRange,yRange).rgb * weights[3];\n finalCol += sampleTexture(envMap, uv + vec2(0.0,ypercent * offset * 3.0),xRange,yRange).rgb * weights[4];\n finalCol += sampleTexture(envMap, uv + vec2(0.0,ypercent * offset * 2.0),xRange,yRange).rgb * weights[5];\n finalCol += sampleTexture(envMap, uv + vec2(0.0,ypercent * offset * 1.0),xRange,yRange).rgb * weights[6];\n }else{\n finalCol += sampleTexture(envMap, uv - vec2(xpercent * offset * 3.0,0.0),xRange,yRange).rgb * weights[0];\n finalCol += sampleTexture(envMap, uv - vec2(xpercent * offset * 2.0,0.0),xRange,yRange).rgb * weights[1];\n finalCol += sampleTexture(envMap, uv - vec2(xpercent * offset * 1.0,0.0),xRange,yRange).rgb * weights[2];\n finalCol += sampleTexture(envMap, uv,xRange,yRange).rgb * weights[3];\n finalCol += sampleTexture(envMap, uv + vec2(xpercent * offset * 3.0,0.0),xRange,yRange).rgb * weights[4];\n finalCol += sampleTexture(envMap, uv + vec2(xpercent * offset * 2.0,0.0),xRange,yRange).rgb * weights[5];\n finalCol += sampleTexture(envMap, uv + vec2(xpercent * offset * 1.0,0.0),xRange,yRange).rgb * weights[6];\n }\n // finalCol = texture2D(envMap,uv).rgb;\n return finalCol * roughness;\n }\n \n void main() {\n gl_FragColor = vec4(1.0,1.0,1.0,1.0);\n gl_FragColor.rgb = bilinearCubeUV(envMap, mipInt);\n return;\n \n }\n ",blending:0,side:2,depthTest:!1,depthWrite:!1});return t.type="SphericalGaussianBlur",t}},{key:"_getTextureShader",value:function(){var e=new vl({uniforms:{envMap:{value:null},texelSize:{value:new tt(1,1)}},vertexShader:this._getTextureCommonVertex(),fragmentShader:"\n precision mediump float;\n precision mediump int;\n varying vec2 vUv;\n uniform sampler2D envMap;\n void main() {\n gl_FragColor = texture2D(envMap, vUv);\n }\n ",blending:0,depthTest:!1,depthWrite:!1});return e.type="EquirectangularToCubeUV",e}},{key:"_getTextureCommonVertex",value:function(){return"\n precision mediump float;\n precision mediump int;\n attribute vec3 position;\n attribute vec2 uv;\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4( position, 1.0 );\n }\n "}}]),e}(),rd=A((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,e),this.type="ReflectorForSSRPass",this.renderer=t.renderer,this.scene=t.scene;var n=this,i=t.textureWidth||512,r=t.textureHeight||512,a=!0===t.useDepthTexture,o=new at(0,1,0),l=new at,A=new at;this.pmremGenerator=new id(this.renderer),this.maxDistance=180,this.opacity=1,n.resolution=t.resolution||new tt(window.innerWidth,window.innerHeight);var c,h=new at,u=new at,d=new at,f=new bt,p=new at(0,0,-1),m=new at,v=new at,g=new bt,y=new Ni;a&&((c=new ns).type=ee,c.minFilter=X,c.magFilter=X);var w={depthTexture:a?c:null,magFilter:X,minFilter:X,generateMipmaps:!1},x=new dt(i,r,w);this.reflectTexture=null,this.objects=[],this.planes=[],this.mainPlane=null;var b=new at;this.doRender=function(e,t,n){if(this.mainPlane&&(l.copy(n.position).normalize(),A.copy(l).reflect(o),u.setFromMatrixPosition(this.mainPlane.matrixWorld),d.setFromMatrixPosition(n.matrixWorld),f.extractRotation(this.mainPlane.matrixWorld),h.set(0,0,1),h.applyMatrix4(f),m.subVectors(u,d),!(m.dot(h)>0))){m.reflect(h).negate(),m.add(u),f.extractRotation(n.matrixWorld),p.set(0,0,-1),p.applyMatrix4(f),p.add(d),v.subVectors(u,p),v.reflect(h).negate(),v.add(u),y.position.copy(m),y.up.set(0,1,0),y.up.applyMatrix4(f),y.up.reflect(h),y.lookAt(v),y.far=n.far,y.updateMatrixWorld(),y.projectionMatrix.copy(n.projectionMatrix),g.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),g.multiply(y.projectionMatrix),g.multiply(y.matrixWorldInverse),g.multiply(this.mainPlane.matrixWorld);var i=e.getRenderTarget();this.setPlaneVisible(!1),e.setRenderTarget(x),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),this.visibleObject(t,!1),e.render(t,y),this.visibleObject(t,!0),this.reflectTexture=this.pmremGenerator.fromTexture(x.texture).texture,this.setPlaneVisible(!0),this.refreshPlaneMaterial(n,y),e.setRenderTarget(i);var r=n.viewport;void 0!==r&&e.state.viewport(r)}},this.visibleObject=function(e,t){var n=this;0!==this.objects.length&&e.traverse((function(e){e.isMesh&&!n.objects.includes(e)&&(t?e.visible=e.cacheVisible:(e.cacheVisible=e.visible,e.visible=!1))}))},this.getRenderTarget=function(){return x},this.setPlaneVisible=function(e){for(var t=0;t0}},{key:"domElement",get:function(){return this.composer.renderer.domElement}},{key:"enableOutline",get:function(){return this._enableOutline},set:function(e){this.enableDof||this._enableOutline!=Boolean(e)&&(e?(this.add(this.outline),this.outline.clear()):this.remove(this.outline),this._enableOutline=e)}},{key:"enableUnrealBloom",get:function(){return this._enableUnrealBloom},set:function(e){this._enableUnrealBloom!=Boolean(e)&&(e?(this.add(this.unrealBloom),this.unrealBloom.clear()):this.remove(this.unrealBloom),this._enableUnrealBloom=e)}},{key:"enableDof",get:function(){return this._enableDof},set:function(e){this._enableDof!=Boolean(e)&&(e?this.add(this.dof):this.remove(this.dof),this._enableDof=e)}},{key:"enableColorAdjustment",get:function(){return this._enableColorAdjustment},set:function(e){this._enableColorAdjustment!==Boolean(e)&&(e?this.add(this.colorAdjustment):this.remove(this.colorAdjustment),this._enableColorAdjustment=Boolean(e))}},{key:"enableSSAO",get:function(){return this._enableSSAO},set:function(e){this._enableSSAO!==Boolean(e)&&(this.ssao.setMaxDistance(.001),this.ssao.setMinDistance(1e-4),this.ssao.setRadius(16),e?this.add(this.ssao):this.remove(this.ssao),this._enableSSAO=Boolean(e))}},{key:"enableVignette",get:function(){return this._enableVignette},set:function(e){this._enableVignette!=Boolean(e)&&(e?this.add(this.vignette):this.remove(this.vignette),this._enableVignette=e)}},{key:"enableCircleSweep",get:function(){return this._enableCircleSweep},set:function(e){this._enableCircleSweep!=Boolean(e)&&(e?this.add(this.circleSweep):this.remove(this.circleSweep),this._enableCircleSweep=e)}},{key:"enableSSR",get:function(){return this._enableSSR},set:function(e){this._enableSSR!=Boolean(e)&&(e?this.add(this.ssr):this.remove(this.ssr),this._enableSSR=e)}},{key:"_initComposer",value:function(){this.renderPass=new uu(this.scene,this.camera),this.composer=new vu(this.renderer),this.FXAA=new fu(yu),this.FXAA.uniforms.resolution.value.set(1/this.width,1/this.height);var e=this.renderer.getPixelRatio();this.SMAA=new Mu(this.width*e,this.height*e)}},{key:"add",value:function(e){var t;e&&this.processArray.indexOf(e)<0&&(this.composer||this._initComposer(),e.inited||(e.init({camera:this.camera,renderer:this.renderer,scene:this.scene,width:this.width,height:this.height,viewer:this.viewer}),e.inited=!0),this.composer.passes.length=0,this.composer.addPass(this.renderPass),(this.processArray.includes(this.ssao)||e===this.ssao)&&this.composer.addPass(this.ssao.pass),(this.processArray.includes(this.ssr)||e===this.ssr)&&this.composer.addPass(this.ssr.pass),(this.processArray.includes(this.colorAdjustment)||e===this.colorAdjustment)&&this.composer.addPass(this.colorAdjustment.pass),(this.processArray.includes(this.colorGradient)||e===this.colorGradient)&&this.composer.addPass(this.colorGradient.pass),(this.processArray.includes(this.outline)||e===this.outline)&&this.composer.addPass(this.outline.pass),(this.processArray.includes(this.unrealBloom)||e===this.unrealBloom)&&this.composer.addPass(this.unrealBloom.pass),(this.processArray.includes(this.vignette)||e===this.vignette)&&this.composer.addPass(this.vignette.pass),(this.processArray.includes(this.circleSweep)||e===this.circleSweep)&&this.composer.addPass(this.circleSweep.pass),(this.processArray.includes(this.dof)||e===this.dof)&&(this.composer.addPass(this.dof.pass),t=!0),t||this.composer.addPass(this.FXAA),this.processArray.push(e));this.enabled&&this.viewer.renderManager.setRenderer(this),setTimeout(this.viewer.renderManager.render,20)}},{key:"remove",value:function(e){e&&this.processArray.includes(e)&&(this.composer.passes.remove(e.pass),this.processArray.remove(e),e.dispose&&e.dispose()),this.enabled||this.viewer.renderManager.setRenderer(),this.viewer.renderManager.render()}},{key:"render",value:function(){this.onBeforeRender(),this.processArray.forEach((function(e){e.render()})),this.composer.render(),this.onAfterRender()}},{key:"onBeforeRender",value:function(){this.processArray.includes(this.ssao)&&(this.shadow=!1)}},{key:"onAfterRender",value:function(){this.processArray.includes(this.ssao)}},{key:"resize",value:function(e,t){this.width=e,this.height=t,this.composer.setSize(e,t),this.processArray.forEach((function(n){n.setSize(e,t)})),this.FXAA&&this.FXAA.uniforms.resolution.value.set(1/e,1/t),this.SMAA&&this.SMAA.setSize(e,t)}},{key:"dispose",value:function(){this.processArray.length=0,this.composer=null}}]),e}();function sd(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)}var ld={UPDATE:"update",CHANGE:"change",ENDED:"ended",LOOP:"loop",MAP_INIT:"map_init",MAP_LOADED:"map_loaded",MESH_LOADED:"mesh_loaded",MESH_LOAD_ERROR:"mesh_load_error"};ld.MESH_LOAD_ERROR="mesh_load_error",ld.MATERIAL_LOADED="material_loaded",ld.MATERIAL_LOAD_ERROR="material_load_error",ld.ANIMATION_LOADED="animation_loaded",ld.ANIMATION_LOAD_ERROR="animation_load_error",ld.MODEL_UPDATE="model_update",ld.START=sd()?"touchstart":"mousedown",ld.MOVE=sd()?"touchmove":"mousemove",ld.END=sd()?"touchend":"mouseup",ld.MESSAGE="message",ld.TEXTURE_LOADED="texture_loaded",ld.CLICK="click",ld.CAMERA_MOVED="camera-moved";var Ad={click:"click",rightClick:"rightClick",centerClick:"centerClick",doubleClick:"doubleClick",mousemove:"mousemove",mouseDown:"mousedown",mouseUp:"mouseup"},cd=function(){this._tweens={},this._tweensAddedDuringUpdate={},this._tweens={},this._tweensAddedDuringUpdate={}};cd.prototype={getAll:function(){return Object.keys(this._tweens).map(function(e){return this._tweens[e]}.bind(this))},removeAll:function(){this._tweens={}},add:function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},remove:function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},update:function(e,t){var n=Object.keys(this._tweens);if(0===n.length)return!1;for(e=void 0!==e?e:ud.now();n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i1?1:n,i=this._easingFunction(n),this._valuesEnd)if(void 0!==this._valuesStart[t]){var r=this._valuesStart[t]||0,a=this._valuesEnd[t];a instanceof Array?this._object[t]=this._interpolationFunction(a,i):("string"==typeof a&&(a="+"===a.charAt(0)||"-"===a.charAt(0)?r+parseFloat(a):parseFloat(a)),"number"==typeof a&&(this._object[t]=r+(a-r)*i))}if(null!==this._onUpdateCallback&&this._onUpdateCallback(this._object,n),1===n){if(this._repeat>0){for(t in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat){if("string"==typeof this._valuesEnd[t]&&(this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(this._valuesEnd[t])),this._yoyo){var o=this._valuesStartRepeat[t];this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=o}this._valuesStart[t]=this._valuesStartRepeat[t]}return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,null!==this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var s=0,l=this._chainedTweens.length;s1?a(e[n],e[n-1],n-i):a(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,a=ud.Interpolation.Utils.Bernstein,o=0;o<=i;o++)n+=r(1-t,i-o)*r(t,o)*e[o]*a(i,o);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),a=ud.Interpolation.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),a(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(a(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):a(e[r?r-1:0],e[r],e[n1;n--)t*=n;return hd[e]=t,t}),CatmullRom:function(e,t,n,i,r){var a=.5*(n-e),o=.5*(i-t),s=r*r;return(2*t-2*n+a+o)*(r*s)+(-3*t+3*n-2*a-o)*s+a*r+t}}};var dd=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,n),(i=t.call(this)).clock=new lc,i._renderer=null,i._defaultRenderer=null,i.container=null,i.containerRect=null,i.renderEnabled=!1,i.scene=null,i.camera=null,i.defaultCamera=null,i.animationFrameHandler=null,i.beforeRenderQueue=[],i.afterRenderQueue=[],i.needsUpdate=!0,i.loop=!0,i.viewer=e,i.needsUpdate=!0,i.loop=!0,i.container=e.container,i.containerRect=i.container.getBoundingClientRect();var a={antialias:!0,alpha:!0,logarithmicDepthBuffer:Boolean(r.logarithmicDepthBuffer)};return(i.container.nodeName&&"CANVAS"===i.container.nodeName.toUpperCase()||i.container.tagName&&"CANVAS"===i.container.tagName.toUpperCase())&&(a.canvas=i.container),i._renderer=new $a(a),i._renderer.setClearAlpha(0),i._renderer.setPixelRatio(window.devicePixelRatio),i._renderer.setSize(i.containerRect.width,i.containerRect.height),i._defaultRenderer=i._renderer,i.domElement.style.backgroundColor="#000",void 0===a.canvas&&i.container.appendChild(i.domElement),i}return A(n,[{key:"domElement",get:function(){return this.getRenderer().domElement}},{key:"defaultRenderer",get:function(){return this._defaultRenderer}},{key:"renderer",get:function(){return this._renderer}},{key:"setRenderer",value:function(e){this._renderer=void 0!==e?e:this._defaultRenderer}},{key:"getRenderer",value:function(){return this._renderer||(this._renderer=this.defaultRenderer),this._renderer.isPostProcessingManager?this._renderer.composer.renderer:this._renderer}},{key:"setCamera",value:function(e){this.camera=void 0!==e?e:this.defaultCamera}},{key:"setLoop",value:function(e){this.loop=e,this.animate()}},{key:"render",value:function(e){this.renderEnabled=!0,e&&this.animate()}},{key:"render2",value:function(e,t){var n=this;e||(e=this.scene),t||(t=this.camera);var i=this.clock.getDelta();this.moduleManager.update(i),this._onBeforeRender(i),this.beforeRenderQueue.map((function(r){"function"==typeof r&&r(n._renderer,e,t,i)})),this._renderer.render(e,t),this.afterRenderQueue.map((function(r){"function"==typeof r&&r(n._renderer,e,t,i)})),ud.update(),this._onAfterRender(i),this.animationFrameHandler&&cancelAnimationFrame(this.animationFrameHandler),this.loop&&(this.animationFrameHandler=requestAnimationFrame((function(){n.animate()}))),this.dispatchEvent({type:ld.UPDATE})}},{key:"animate",value:function(){var e=this;if(this.renderEnabled&&this.needsUpdate){var t=this.clock.getDelta();this.moduleManager.update(t),this._onBeforeRender(t),this.beforeRenderQueue.map((function(n){"function"==typeof n&&n(e._renderer,e.scene,e.camera,t)})),this._renderer.render(this.scene,this.camera),this.afterRenderQueue.map((function(n){"function"==typeof n&&n(e._renderer,e.scene,e.camera,t)})),ud.update(),this._onAfterRender(t),this.animationFrameHandler&&cancelAnimationFrame(this.animationFrameHandler),this.loop&&(this.animationFrameHandler=requestAnimationFrame((function(){e.animate()}))),this.dispatchEvent({type:ld.UPDATE})}}},{key:"addBeforeRenderTask",value:function(e){this.beforeRenderQueue.includes(e)||this.beforeRenderQueue.push(e)}},{key:"removeBeforeRenderTask",value:function(e){this.beforeRenderQueue.includes(e)&&this.beforeRenderQueue.remove(e)}},{key:"addAfterRenderTask",value:function(e){this.afterRenderQueue.includes(e)||this.afterRenderQueue.push(e)}},{key:"removeAfterRenderTask",value:function(e){this.afterRenderQueue.includes(e)&&this.afterRenderQueue.remove(e)}},{key:"_onBeforeRender",value:function(e){var t=this,n=this.getRenderer();this.scene.getObjectByName("root").traverse((function(i){i.onBeforeRender&&i.onBeforeRender(n,t.scene,t.camera,e)}))}},{key:"_onAfterRender",value:function(e){var t=this,n=this.getRenderer();this.scene.getObjectByName("root").traverse((function(i){i.update&&i.update(e),i.onAfterRender&&i.onAfterRender(n,t.scene,t.camera,e)}))}},{key:"resize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=this.container.getBoundingClientRect(),this.containerRect=e,this.getRenderer().setSize(e.width,e.height),this._renderer.composer&&this._renderer.resize(e.width,e.height),this.render()}},{key:"disabled",value:function(){this.needsUpdate=!1}},{key:"dispose",value:function(){cancelAnimationFrame(this.animationFrameHandler),this.setRenderer(),this._renderer.dispose(),this._renderer.forceContextLoss(),this._renderer=null,this.disabled()}}]),n}(Je),fd=function(){function e(){s(this,e)}return A(e,null,[{key:"create",value:function(t,n){var i=new dd(t,n);return e.RenderManagerArray.push(i),i}},{key:"render",value:function(t){for(var n=0;n=this._endTime&&(this.setCurrentTime(this._endTime),this.pause(),this._playTime=this._startTime)),this._mixer.update(e)}}},{key:"hasAnimation",value:function(){return this._animNameList.length>0}},{key:"list",value:function(){return this._animNameList}},{key:"playByTime",value:function(e,t,n){this._startTime=t,this._endTime=n,this._playTime=this._startTime,this._isSection=!0,this._play(e,this._loop,this._speed),this.setCurrentTime(this._startTime)}},{key:"clone",value:function(e){var t=this,i=new n(e);return i._speed=this._speed,i._paused=this._paused,i._clock=new lc,i._stopped=this._stopped,i.loop=this.loop,i.setAnimationList(this.getList()),this._clipMap.forEach((function(n){var r=n._clip;i.addClip(t.cloneAnimationClip(r,e))})),i}},{key:"cloneAnimationClip",value:function(e,t){if(e&&e.tracks){var n="BinLoader";n=t.modelPath.indexOf(".mbin")>-1||t.modelPath.indexOf(".mrmb")>-1?"BinLoader":"NewLoader";for(var i=[],r=0;r4&&void 0!==arguments[4]?arguments[4]:"#FFFFFF";return s(this,n),(o=t.call(this)).length=i,o.width=r,o.height=a,o.color=l,e&&(o.object=e,o._draw(i,r,a)),o}return A(n,[{key:"_draw",value:function(e,t,n){var i;i=this.object.isBox3?this.object:(new tn).setFromObject(this.object);var r=new at;i.getSize(r),this.maxLength=Math.max(r.x,r.y,r.z),this.textScale=2,this.textMeshScale=.002*this.maxLength,this.fontSize=20*this.textScale;var a=new at;i.getCenter(a);var o=.03*this.maxLength,s=.2*this.maxLength,l=.5*this.fontSize*this.textMeshScale/this.textScale,A=new at(i.min.x,i.max.y+s,a.z),c=new at(i.max.x,i.max.y+s,a.z);void 0!==e&&""!==e||(e=A.distanceTo(c).toFixed(4));var h=this._drawLine(A,c);h.rotation.z=Math.PI/2;var u=new at(A.x,A.y+l,A.z),d=new at(A.x,A.y-l,A.z);h=this._drawLine(u,d),u.set(c.x,c.y+l,c.z),d.set(c.x,c.y-l,c.z),h=this._drawLine(u,d);var f=this._drawText(e,new at(a.x,i.max.y+o+s,a.z)),p=f.clone();this.add(p),p.rotation.y=Math.PI,this.lengthMesh=f,this.lengthMesh.back=p,A.set(i.min.x-s,i.min.y,(i.max.z+i.min.z)/2),c.set(i.min.x-s,i.max.y,(i.max.z+i.min.z)/2),h=this._drawLine(A,c),void 0!==n&&""!==n||(n=A.distanceTo(c).toFixed(4)),u.set(A.x+l,A.y,A.z),d.set(A.x-l,A.y,A.z),(h=this._drawLine(u,d)).rotation.z=Math.PI/2,u.set(c.x+l,c.y,c.z),d.set(c.x-l,c.y,c.z),(h=this._drawLine(u,d)).rotation.z=Math.PI/2;var m=this._drawText(n,new at(i.min.x-o-s,a.y,a.z)),v=m.clone();this.add(v),v.position.x-=o/2,m.rotation.z=v.rotation.z=Math.PI/2,v.rotation.y=Math.PI,this.heightMesh=m,this.heightMesh.back=v,A.set(i.max.x+s,a.y,i.min.z),c.set(i.max.x+s,a.y,i.max.z),(h=this._drawLine(A,c)).rotation.x=Math.PI/2,void 0!==t&&""!==t||(t=A.distanceTo(c).toFixed(4)),u.set(A.x,A.y+l,A.z),d.set(A.x,A.y-l,A.z),h=this._drawLine(u,d),u.set(c.x,c.y+l,c.z),d.set(c.x,c.y-l,c.z),h=this._drawLine(u,d);var g=this._drawText(t,new at(i.max.x+s,a.y+o,a.z)),y=g.clone();this.add(y),g.rotation.y=y.rotation.y=Math.PI/2,y.rotation.y=-Math.PI/2,this.widthMesh=g,this.widthMesh.back=y}},{key:"updateSize",value:function(e,t,n){this.lengthMesh&&void 0!==e&&""!==e&&this._updateTextMesh(this.lengthMesh,e),this.widthMesh&&void 0!==t&&""!==t&&this._updateTextMesh(this.widthMesh,t),this.heightMesh&&void 0!==n&&""!==n&&this._updateTextMesh(this.heightMesh,n)}},{key:"_updateTextMesh",value:function(e,t){var n=e.material,i=n.map.image;this._fillText(n.map.image,t),n.map.needsUpdate=!0,n.needsUpdate=!0,e.back.material.map.needsUpdate=!0,e.back.material.needsUpdate=!0,e.back.geometry.dispose(),e.geometry.dispose(),e.back.geometry=e.geometry=new $i(i.width*this.textMeshScale/this.textScale,i.height*this.textMeshScale/this.textScale)}},{key:"_drawLine",value:function(e,t){var n=.005*this.maxLength*.5,i=new Ei(new ki(n,e.distanceTo(t),n),new Nn({color:this.color,side:2}));return i.position.copy(e.clone().add(t).multiplyScalar(.5)),i.renderOrder=5e3,this.add(i),i}},{key:"_drawText",value:function(e,t){var n=document.createElement("canvas");n.height=this.fontSize,this._fillText(n,e);var i=new $i(n.width*this.textMeshScale/this.textScale,n.height*this.textMeshScale/this.textScale),r=new ts(n);r.anisotropy=16;var a=new Nn({map:r,transparent:!0});a.depthTest=!1;var o=new Ei(i,a);return o.position.copy(t),this.add(o),o}},{key:"_fillText",value:function(e,t){var n=this.fontSize+"px 宋体";e.width=this._measureTextWidth(n,t);var i=e.getContext("2d");i.clearRect(0,0,e.width,e.height),i.font=n,i.fillStyle=this.color,i.textAlign="left",i.textBaseline="top",i.fillText(t,0,0)}},{key:"_measureTextWidth",value:function(e,t){this._measureCanvas||(this._measureCanvas=document.createElement("canvas"),this._measureCanvas.height=100,this._measureCanvas.width=100);var n=this._measureCanvas.getContext("2d");return n.font=e,n.measureText(t).width}},{key:"show",value:function(e,t,n,i){e&&this.object!==e&&(this.object=e),this.object&&this._draw(t,n,i),this.object.viewer.renderManager.render(!0)}},{key:"dispose",value:function(){}}]),n}(zt),Ld=function(e){h(n,e);var t=y(n);function n(e,i){var r;s(this,n),(r=t.call(this)).object=e,r.options=i||{},void 0===r.options.exposeFactor&&(r.options.exposeFactor=2),void 0===r.options.exposeByPart&&(r.options.exposeByPart=!1),void 0===r.options.exposeType&&(r.options.exposeType="NORMAL"),r.segments=3,r.prePercent=0,r.allModels=[];var a=r.object.getObjectByName("shadow");return r.options.exposeByPart?a.parent.children.forEach((function(e){e===a||e.isHotSpotEntity||e.children.forEach((function(e){r.allModels.push(e)}))})):r.object.traverse((function(e){e.geometry&&"shadow"!==e.name&&!e.isHotSpotEntity&&r.allModels.push(e)})),r.setMode(r.options.exposeType),r.object.viewer.renderManager.render(),r.exposeType=r.options.exposeType,r}return A(n,[{key:"setMode",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"NORMAL",n=new at,i=new at,r=(new tn).setFromObject(this.object);switch(r.getCenter(n),r.getSize(i),t){case"SPHERE":var a=this.allModels.length,o=Math.ceil(Math.sqrt(a)),s=this._genSphereGeo(o,a),l=s.length,A=[],c=Math.max(i.x,i.y,i.z);this.allModels.forEach((function(t){var n=e._getRandom(l,A);A.push(n);var i=s[n].clone().normalize();t.direct=i.clone().multiplyScalar(c*e.options.exposeFactor)}));break;case"SEGMENT":var h=i.y/this.segments;this.allModels.forEach((function(t){var n=(new tn).setFromObject(t);t.direct||(t.direct=new at),n.getCenter(t.direct),n&&n.getCenter&&t.direct.set(0,h*Math.floor(t.direct.y/h),0).multiplyScalar(e.options.exposeFactor)}));break;default:this.allModels.forEach((function(i){var r=(new tn).setFromObject(i);i.direct||(i.direct=new at),r.getCenter(i.direct),r&&r.getCenter&&(i.direct.sub(n).multiplyScalar(e.options.exposeFactor),"VERTICAL"===t&&(i.direct.x=i.direct.z=0),"HORIZONTAL"===t&&(i.direct.y=i.direct.z=0))}))}this.exposeType=t}},{key:"applyScalar",value:function(e){var t=e-this.prePercent;this.prePercent=e,this.allModels.forEach((function(e){if(e.parent&&e.direct&&!e.isAmrtAlphaHotSpotEntity){var n=e.getWorldPosition(new at);n.add(e.direct.clone().multiplyScalar(t));var i=e.parent.worldToLocal(n);e.position.copy(i)}})),this.object.viewer.renderManager.render(),this.dispatchEvent(ld.CHANGE,e)}},{key:"setSegment",value:function(e){this.stop(),this.segments=e,"SEGMENT"==this.exposeType&&this.setMode(this.exposeType)}},{key:"play",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.stop();var n={t:0};this.tween=new ud.Tween(n).to({t:1},t.time||3e3).onUpdate((function(){e.applyScalar(n.t)})).onComplete((function(){t.onComplete&&t.onComplete()})).repeat(void 0!==t.loop&&null!==t.loop?t.loop-1:0).start()}},{key:"stop",value:function(){this.tween&&this.tween.stop(),this.applyScalar(0)}},{key:"_getRandom",value:function(e,t){var n=Math.floor(Math.random()*e);return t.indexOf(n)>-1?this._getRandom(e,t):n}},{key:"_genSphereGeo",value:function(e,t){var n=new $s(1,e,e),i=this._removeRepeat(n.vertices);return i.length=45*et.DEG2RAD&&(r.isPen=!0)}else{var a=this.getEdgeKey(t,e),o={normal:n,startPoint:e,endPoint:t,isRecommend:1};this.triangleMap.set(i,o),this.triangleMap.set(a,o)}}},{key:"getEdgeKey",value:function(e,t){return e.x+"_"+e.y+"_"+e.z+"_"+t.x+"_"+t.y+"_"+t.z}},{key:"getPenEdge",value:function(){var e=[];return this.triangleMap.forEach((function(t){if(!t.isResolve&&(t.isPen||1===t.isRecommend)){t.isResolve=!0;e.push({s:t.startPoint,p:[t.startPoint.x,t.startPoint.y,t.startPoint.z,t.endPoint.x,t.endPoint.y,t.endPoint.z],e:t.endPoint})}})),e}}]),e}(),Pd=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this,e))._isCombine=!0,i.lineRoots=[],i._color=null,i._isHideModel=!1,i}return A(n,[{key:"init",value:function(){b(u(n.prototype),"init",this).call(this),this.lineMat=new Do({color:this._color||255}),this.setFromObject()}},{key:"isCombine",set:function(e){this._isCombine=e,this._isInit&&this.setFromObject()}},{key:"isHideModel",set:function(e){this._isHideModel=e,this._isInit&&this.visible&&this.setModelActive(this._isHideModel)}},{key:"color",set:function(e){this._color=e,this._isInit&&(this.lineMat.color.set(this._color),this.lineMat.needsUpdate=!0)}},{key:"setFromObject",value:function(){this.destory();for(var e=[],t=0;t1&&void 0!==arguments[1]?arguments[1]:{};if(s(this,n),(i=t.call(this,e)).lineRoots=[],i._color=null,i._isHideModel=!1,r.width||(r.width=100),r.height||(r.height=100),r.radius||(r.radius=10),r.colorStops||(r.colorStops={1:"#f00",.8:"#e2fa00",.6:"#33f900",.3:"#0349df",0:"#fff"}),!r.data){r.data=[];for(var a=0;a<100;a++)r.data.push({coord:[100*Math.random()-50,0,100*Math.random()-50],value:20*Math.random()})}return i.options=r,i}return A(n,[{key:"init",value:function(){b(u(n.prototype),"init",this).call(this),this.streamerMaterial=this.getMaterial(),this.destory()}},{key:"setVisible",value:function(e){var t=this;b(u(n.prototype),"setVisible",this).call(this,e),this.objects.forEach((function(n){e?t._setMat(n):t._resetMat(n)}))}},{key:"_setMat",value:function(e){var t=this;if(e.material1=e.material,Array.isArray(e.material)){var n=[];e.material.forEach((function(e){n.push(t.streamerMaterial.clone())})),e.material=n}else e.material=this.streamerMaterial.clone()}},{key:"_resetMat",value:function(e){e.material=e.material1,e.material1=null}},{key:"getMaterial",value:function(e){if(!this._streamerMaterial||e){var t=this.getMap();t.wrapS=t.wrapT=V,t.repeat.set(1,1),t.needsUpdate=!0,this._streamerMaterial=new Nn({map:t,transparent:!0}),this._color&&(this._streamerMaterial.color=new Fn(this._color))}return this._streamerMaterial}},{key:"getMap",value:function(){return new ts(this.draw())}},{key:"draw",value:function(){var e=this,t=this.options.radius,n=this.options.data;this._convertPoints(n);var i=this.options.width,r=this.options.height,a=document.createElement("canvas");a.width=i,a.height=r;var o=a.getContext("2d");o.fillStyle="#00ff00",o.fillRect(0,0,i,r),o.clearRect(0,0,i,r);var s=n.reduce((function(e,t){return Math.max(e,t.value)}),0);n.forEach((function(n){e._drawRadiation(o,{x:n.x,y:n.y,radius:t,weight:Math.max(Math.min((n.value-0)/(s-0),1),0),value:n.value})}));for(var l=this._createPalette(),A=o.getImageData(0,0,i,r),c=A.data,h=3;h0?t.x+=50:0==t.x?t.x=50:t.x<0&&(t.x=50+t.x),t.y>0?t.y+=50:0==t.y?t.y=50:t.y<0&&(t.y=50+t.y),e[n]=t}))}},{key:"_drawRadiation",value:function(e,t){var n=t.x,i=t.y,r=t.radius,a=t.weight;r=Math.round(r*a);var o=e.createRadialGradient(n,i,0,n,i,r);o.addColorStop(0,"rgba(25, 0, 0, 1)"),o.addColorStop(1,"rgba(0, 255, 0, 0)"),e.fillStyle=o,e.beginPath(),e.arc(n,i,r,0,2*Math.PI),e.closePath(),e.fill()}},{key:"start",value:function(){b(u(n.prototype),"start",this).call(this)}},{key:"disable",value:function(){b(u(n.prototype),"disable",this).call(this)}},{key:"setObjects",value:function(e){b(u(n.prototype),"setObjects",this).call(this,e)}},{key:"destory",value:function(){b(u(n.prototype),"destory",this).call(this),this._isInit&&this.setVisible(!1)}}]),n}(Fd),Dd=0,Rd=1,Od=2,Nd=3,zd=4,Qd=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this,e)).lineRoots=[],i._color=null,i._isHideModel=!1,i}return A(n,[{key:"init",value:function(){b(u(n.prototype),"init",this).call(this),this.uvSpeed=.01,this.speed=1,this.texture="img/streamer.png",this.destory()}},{key:"color",set:function(e){this._color=e,this._isInit&&(this.streamerMaterial.color.set(this._color),this.streamerMaterial.needsUpdate=!0)}},{key:"speed",get:function(){return this._speed},set:function(e){this._speed=e?e*this.uvSpeed:this.uvSpeed}},{key:"texture",get:function(){return this._texture},set:function(e){e&&(this._texture=e,this.streamerMaterial=this.getMaterial(!0))}},{key:"setVisible",value:function(e){var t=this;b(u(n.prototype),"setVisible",this).call(this,e),this.objects.forEach((function(n){e?t._moveUv(n):t._resetUv(n)}))}},{key:"_moveUv",value:function(e){var t=this;if(e.material1=e.material,Array.isArray(e.material)){var n=[];e.material.forEach((function(e){n.push(t.streamerMaterial.clone())})),e.material=n}else e.material=this.streamerMaterial.clone();e.onBeforeRender1=e.onBeforeRender,e.onBeforeRender=function(e,n,i,r,a){a&&a.map&&(a.map.offset.x-=t.speed)}}},{key:"onBeforeRenderFunc",value:function(e,t,n,i,r){r&&r.map&&(r.map.offset.x-=this.speed)}},{key:"_resetUv",value:function(e){e.material=e.material1,e.material1=null,e.onBeforeRender1?(e.onBeforeRender=e.onBeforeRender1,e.onBeforeRender1=null):e.onBeforeRender=function(){}}},{key:"getMaterial",value:function(e){if(!this._streamerMaterial||e){var t=(new tA).load(this.texture);t.wrapS=t.wrapT=V,t.repeat.set(1,1),t.needsUpdate=!0,this._streamerMaterial=new Nn({map:t,transparent:!0}),this._color&&(this._streamerMaterial.color=new Fn(this._color))}return this._streamerMaterial}},{key:"start",value:function(){b(u(n.prototype),"start",this).call(this)}},{key:"disable",value:function(){b(u(n.prototype),"disable",this).call(this)}},{key:"setObjects",value:function(e){b(u(n.prototype),"setObjects",this).call(this,e)}},{key:"destory",value:function(){b(u(n.prototype),"destory",this).call(this),this._isInit&&this.setVisible(!1)}}]),n}(Fd),Gd=null;var Hd,Vd,jd,Wd,Xd,Yd=function(){function e(){s(this,e),this.material=new Ri,this.material.data=this,this.initParams(),this.initMaterial()}return A(e,[{key:"transparent",set:function(e){this.material.transparent=e,this.material.depthWrite=!e}},{key:"initParams",value:function(){}},{key:"initMaterial",value:function(){}},{key:"updateMaterial",value:function(){}}]),e}(),Kd=function(e){h(n,e);var t=y(n);function n(){return s(this,n),t.call(this)}return A(n,[{key:"initParams",value:function(){this.t2D=null,this.color=new Fn(1,1,1),this.alpha=1}},{key:"initMaterial",value:function(){var e={};e.t2D={value:this.t2D},e.color={value:this.color},e.alpha={value:this.alpha},this.material.uniforms=e,this.material.vertexShader="\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n\n }\n\n",this.material.fragmentShader="\n uniform sampler2D t2D;\n uniform vec3 color;\n uniform float alpha;\n varying vec2 vUv;\n\n void main() {\n\n vec4 texColor = texture2D( t2D, vUv );\n gl_FragColor = vec4(texColor.rgb * color,alpha * texColor.a);\n\n }\n\n"}},{key:"updateMaterial",value:function(){b(u(n.prototype),"updateMaterial",this).call(this),this.t2D?this.material.uniforms.t2D.value=this.t2D:this.material.uniforms.t2D.value=Gd||(Gd=(new tA).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE6WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyMi0wOC0xMFQxNzo0NDozOSswODowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAyMi0wOC0xMFQxNzo0NDozOSswODowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjItMDgtMTBUMTc6NDQ6MzkrMDg6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjRmYWM2NzA4LWI3YjYtMzI0Ny05NzIxLTAwZGI4NjY5MTI4OSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo0ZmFjNjcwOC1iN2I2LTMyNDctOTcyMS0wMGRiODY2OTEyODkiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo0ZmFjNjcwOC1iN2I2LTMyNDctOTcyMS0wMGRiODY2OTEyODkiIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjRmYWM2NzA4LWI3YjYtMzI0Ny05NzIxLTAwZGI4NjY5MTI4OSIgc3RFdnQ6d2hlbj0iMjAyMi0wOC0xMFQxNzo0NDozOSswODowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4LrjbLAAAAEklEQVQI12P8//8/AwwwEscBAG1XC/mlMMwsAAAAAElFTkSuQmCC")),this.material.uniforms.color.value=this.color,this.material.uniforms.alpha.value=this.alpha,this.material.needsUpdate=!0}}]),n}(Yd),Zd=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this,e)).edgeEffect=new Pd(i.model),i._lineColor=5371391,i._color=5422335,i._alpha=.3,i._texture=null,i}return A(n,[{key:"setObjects",value:function(e){b(u(n.prototype),"setObjects",this).call(this,e),this.edgeEffect.setObjects(this.objects)}},{key:"init",value:function(){b(u(n.prototype),"init",this).call(this),this.material=new Kd,this.material.transparent=!0,this.edgeEffect.color=this._lineColor,this.material.color.set(this._color),this.material.alpha=this._alpha,this.material.t2D=this._texture,this.material.updateMaterial()}},{key:"start",value:function(){b(u(n.prototype),"start",this).call(this),this.replaceMaterial(!1)}},{key:"disable",value:function(){b(u(n.prototype),"disable",this).call(this),this.replaceMaterial(!0)}},{key:"destory",value:function(){b(u(n.prototype),"destory",this).call(this),this.edgeEffect.destory(),this.replaceMaterial(!0),this.material=null}},{key:"setVisible",value:function(e){this.edgeEffect.visible=this._visible}},{key:"replaceMaterial",value:function(e){for(var t=0;t0){n.material=[];for(var i=0;i0&&(this.mesh=this.objects[0],this.video=document.createElement("video"),this.video.src=this._url,this.video.loop=this.isLoop,this._coverTexUrl&&(console.log(this._coverTexUrl),this.video.poster=this._coverTexUrl),this.videoTexture=new li(this.video),this.videoTexture.minFilter=Z,this.videoTexture.magFilter=Z,this.videoTexture.format=Ae,this.videoTexture.image.setAttribute("crossorigin","anonymous"),Array.isArray(this.mesh.material)?this.material=this.mesh.material[0]:this.material=this.mesh.material,this._srcTexture=this.material.albedo,this._srcColor=this.material.color.getHex(),this.material.color.setRGB(this._brightness,this._brightness,this._brightness),this._coverTexture&&(this.material.albedo=this._coverTexture),this.material.needsUpdate=!0)}},{key:"disable",value:function(){this.reset()}},{key:"destory",value:function(){this.videoTexture&&this.videoTexture.dispose(),this._coverTexture&&this._coverTexture.dispose(),this.videoTexture=null,this.video=null}},{key:"setUrl",value:function(e,t){if(this._coverTexUrl!==t&&(this._coverTexUrl=t,this._coverTexture&&this._coverTexture.dispose(),this._coverTexUrl)){var n=new tA;this._coverTexture=n.load(this._coverTexUrl)}this._url!==e&&(this._url=e,this.video&&(this.video.src=this._url))}},{key:"play",value:function(){this.visible=!0,this.video&&(this.material&&(this.material.color.setRGB(this._brightness,this._brightness,this._brightness),this.material.albedo=this.videoTexture,this.material.needsUpdate=!0),this.video.currentTime=0,this.video.play())}},{key:"pause",value:function(){this.video&&this.video.pause()}},{key:"resume",value:function(){this.video&&this.video.play()}},{key:"stop",value:function(){this._coverTexture&&(this.material.albedo=this._coverTexture),this.video&&(this.video.pause(),this.video.currentTime=0)}},{key:"reset",value:function(){this.material&&(this.material.color.set(this._srcColor),this.material.albedo=this._srcTexture,this.material.needsUpdate=!0),this.video&&(this.video.pause(),this.video.currentTime=0)}},{key:"clear",value:function(){this.visible=!1}}]),n}(Fd),qd=function(){function e(t){s(this,e),this.model=t,this.effectMap=new Map,this.effectNodeArray=[],this.effectLifeTime=10}return A(e,[{key:"tick",value:function(e){var t=this;this.effectMap.forEach((function(n,i){!n.visible&&n.IsInit&&(n.time+=e,n.time>=t.effectLifeTime&&n.destory())}));for(var n=0;n=this.effectLifeTime&&(i.destory(),this.effectNodeArray.splice(n,1),n--))}}},{key:"getEffect",value:function(e){var t=this.effectMap.get(e);return t||(t=this.createEffect(e),this.effectMap.set(e,t)),t}},{key:"createEffect",value:function(e){var t={};return e===Dd?t=new Pd(this.model):e===Rd?t=new Zd(this.model):e===Od?t=new Qd(this.model):e===Nd?t=new Jd(this.model):e===zd&&(t=new Ud(this.model,this.heatMapData)),t.type=t,t}},{key:"getMeshByNames",value:function(e){var t=[];if(Array.isArray(e))for(var n=0;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}\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}\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t","\n#define 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\n\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// These defines must match with PMREMGenerator\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);// 1.16 = 1.79^0.25\n }\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}\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",Xd),of=null,sf=null,lf=function(){for(var e=[],t=[],n=[],i=8,r=0;r4?o=ef[r-8+4-1]:0==r&&(o=0),n.push(o);for(var s=1/(a-1),l=-s/2,A=1+s/2,c=[l,l,A,l,A,A,l,l,A,A,l,A],h=new Float32Array(108),u=new Float32Array(72),d=new Float32Array(36),f=0;f<6;f++){var p=f%3*2/3-1,m=f>2?0:-1,v=[p,m,0,p+2/3,m,0,p+2/3,m+1,0,p,m,0,p+2/3,m+1,0,p,m+1,0];h.set(v,18*f),u.set(c,12*f);var g=[f,f,f,f,f,f];d.set(g,6*f)}var y=new si;y.setAttribute("position",new zn(h,3)),y.setAttribute("uv",new zn(u,2)),y.setAttribute("faceIndex",new zn(d,1)),e.push(y),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),Af=lf._lodPlanes,cf=lf._sizeLods,hf=lf._sigmas,uf=null,df=null,ff=null,pf=(1+Math.sqrt(5))/2,mf=1/pf,vf=[new at(1,1,1),new at(-1,1,1),new at(1,1,-1),new at(-1,1,-1),new at(0,pf,mf),new at(0,pf,-mf),new at(mf,0,pf),new at(-mf,0,pf),new at(pf,mf,0),new at(-pf,mf,0)];function gf(e){df=e,bf(af)}function yf(e){var t={magFilter:X,minFilter:X,generateMipmaps:!1,type:e?e.type:$,format:e?e.format:de,encoding:e?e.encoding:Qe,depthBuffer:!1,stencilBuffer:!1},n=Mf(t);return n.depthBuffer=!e,uf=Mf(t),n}function wf(e){uf.dispose(),df.setRenderTarget(ff),e.scissorTest=!1,e.setSize(e.width,e.height)}function xf(e,t,n,i){var r=new Ni(90,1,t,n),a=[1,1,1,1,-1,1],o=[1,1,-1,-1,-1,1],s=df.outputEncoding,l=df.toneMapping,A=df.toneMappingExposure,c=df.getClearColor(),h=df.getClearAlpha();df.toneMapping=1,df.toneMappingExposure=1,df.outputEncoding=Oe,e.scale.z*=-1;var u=e.background;if(u&&u.isColor){u.convertSRGBToLinear();var d=Math.max(u.r,u.g,u.b),f=Math.min(Math.max(Math.ceil(Math.log2(d)),-128),127);u=u.multiplyScalar(Math.pow(2,-f));var p=(f+128)/255;df.setClearColor(u,p),e.background=null}for(var m=0;m<6;m++){var v=m%3;0==v?(r.up.set(0,a[m],0),r.lookAt(o[m],0,0)):1==v?(r.up.set(0,0,a[m]),r.lookAt(0,o[m],0)):(r.up.set(0,a[m],0),r.lookAt(0,0,o[m])),Cf(i,v*$d,m>2?$d:0,$d,$d),df.setRenderTarget(i),df.render(e,r)}df.toneMapping=l,df.toneMappingExposure=A,df.outputEncoding=s,df.setClearColor(c,h),e.scale.z*=-1}function bf(e){var t=new Qt;t.add(new Ei(Af[0],e)),df.compile(t,rf)}function Mf(e){var t=new dt(3*$d,3*$d,e);return t.texture.mapping=G,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Cf(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Bf(e){var t=df.autoClear;df.autoClear=!1;for(var n=1;n8&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(u," samples when the maximum is set to ").concat(8));for(var d=[],f=0,p=0;p<8;++p){var m=p/h,v=Math.exp(-m*m/2);d.push(v),0==p?f+=v:p4?i-8+4:0),3*g,2*g),df.setRenderTarget(t),df.render(s,rf)}function Tf(){var e=new vl({uniforms:{envMap:{value:null},texelSize:{value:new tt(1,1)},inputEncoding:{value:nf[3e3]},outputEncoding:{value:nf[3e3]}},vertexShader:"\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",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n".concat("\nuniform int inputEncoding;\nuniform int outputEncoding;\n#include \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}\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}\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t","\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\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 e.type="EquirectangularToCubeUV",e}function _f(){var e=new vl({uniforms:{envMap:{value:null},inputEncoding:{value:nf[3e3]},outputEncoding:{value:nf[3e3]}},vertexShader:"\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",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n".concat("\nuniform int inputEncoding;\nuniform int outputEncoding;\n#include \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}\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}\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t","\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 e.type="CubemapToCubeUV",e}gf.prototype={constructor:gf,fromScene:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;ff=df.getRenderTarget();var r=yf();return xf(e,n,i,r),t>0&&Ef(r,0,0,t),Bf(r),wf(r),r},fromEquirectangular:function(e){return e.magFilter=X,e.minFilter=X,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){ff=df.getRenderTarget();var t=yf(e);return function(e,t){var n=new Qt;e.isCubeTexture?null==sf&&(sf=_f()):null==of&&(of=Tf());var i=e.isCubeTexture?sf:of;n.add(new Ei(Af[0],i));var r=i.uniforms;r.envMap.value=e,e.isCubeTexture||r.texelSize.value.set(1/e.image.width,1/e.image.height);r.inputEncoding.value=nf[e.encoding],r.outputEncoding.value=nf[e.encoding],Cf(t,0,0,3*$d,2*$d),df.setRenderTarget(t),df.render(n,rf)}(e,t),Bf(t),wf(t),t},compileCubemapShader:function(){null==sf&&bf(sf=_f())},compileEquirectangularShader:function(){null==of&&bf(of=Tf())},dispose:function(){af.dispose(),null!=sf&&sf.dispose(),null!=of&&of.dispose();for(var e=0;e0?e.touches[0]:e.changedTouches&&e.changedTouches.length>0?e.changedTouches[0]:e}},{key:"isIOS",get:function(){return navigator.userAgent.indexOf("Android")>-1||navigator.userAgent.indexOf("Adr")>-1}},{key:"isAndroid",get:function(){return!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)}},{key:"isMobile",get:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)}},{key:"stringToArrayBuffer",value:function(e){for(var t=new ArrayBuffer(2*e.length),n=new Uint16Array(t),i=0,r=e.length;i1&&void 0!==arguments[1]?arguments[1]:256,n="rgba("+255*(e=new Fn(e)).r+","+255*e.g+","+255*e.b+",",i=document.createElement("canvas");i.width=i.height=t;var r=i.getContext("2d"),a=t/2;r.beginPath(),r.arc(a,a,a,0,2*Math.PI,!0),r.closePath();var o=r.createRadialGradient(a,a,1,a,a,a);o.addColorStop(0,n+"1)"),o.addColorStop(.2,n+"0)"),o.addColorStop(.4,n+"1)"),o.addColorStop(.6,n+"0)"),o.addColorStop(.8,n+"1)"),o.addColorStop(1,n+"0)"),r.fillStyle=o,r.fill();var s=new ts(i);return s.minFilter=Z,s.needsUpdate=!0,s}},{key:"segmentIntersection",value:function(e,t,n,i){e=new tt(e.x,e.z),t=new tt(t.x,t.z),n=new tt(n.x,n.z),i=new tt(i.x,i.z);var r=(t.y-e.y)/(t.x-e.x),a=t.y-r*t.x,o=(i.y-n.y)/(i.x-n.x),s=i.y-o*i.x;return{x:(s-a)/(r-o),y:r*((s-a)/(r-o))+a}}},{key:"convertTexture",value:function(e,t){if(!t)return e;var n=new gf(t),i=e.image.src;return e.constructor===hr?(n.compileCubemapShader(),e=n.fromCubemap(e).texture):(n.compileEquirectangularShader(),e=n.fromEquirectangular(e).texture),n.dispose(),e.image.src=i,e}},{key:"getDecoderPath",value:function(){var e="js/";if(document.getElementById("AMRT")){var t=document.getElementById("AMRT").src;e=t.slice(0,t.lastIndexOf("/"))+"/"}else for(var n=0;ne}}]),e}();function Lf(e,t,n){this.objects=[],this.tmpGeometry=e.clone(),Uo.call(this,e,t,n),this.frustumCulled=!1}Lf.prototype=Object.assign(Object.create(Uo.prototype),{constructor:Lf,isInstancedMesh:!0,deleteItem:function(e){if(e&&0!=e.length){var t=new Float32Array(16*(this.count-e.length));e.push(this.count);for(var n=0,i=0,r=0;r0&&void 0!==arguments[0])||arguments[0];e?this.materialViewer.applyWireFrame.bind(this._materialViewer)():this.materialViewer.resetMaterial.bind(this._materialViewer)()}},{key:"update",value:function(){this.effect.tick(this.clock.getDelta())}},{key:"recalculationBound",value:function(){this.boundingBox.setFromObject(this),this.boundingBox.getBoundingSphere(this.boundingSphere)}},{key:"add",value:function(e){b(u(i.prototype),"add",this).call(this,e)}},{key:"remove",value:function(e){b(u(i.prototype),"remove",this).call(this,e)}},{key:"replace",value:function(e,t){e.position.copy(t.localToWorld(t.position.clone())),e.rotation.copy(t.rotation),t.parent.add(e),t.parent.remove(t)}},{key:"setPosition",value:function(e,t,n){this.position.set(e,t,n)}},{key:"setRotation",value:function(e,t,n){this.rotation.set(e,t,n)}},{key:"setScale",value:function(e,t,n){this.scale.set(e,t,n)}},{key:"setEnvMap",value:function(e,t,n){var i=this;return e?e.isTexture?(this.envMap=e,this.materials.forEach((function(t){t.envMap=e,t.needsUpdate=!0})),t&&t(),e):this.mapLoader.loadEnvMap(e,(function(e){i.envMap=e,i.materials.forEach((function(t){t.envMap=e,t.needsUpdate=!0})),t&&t()}),n):(this.envMap=null,this.materials.forEach((function(e){e.envMap=null,e.needsUpdate=!0})),null)}},{key:"getEnvMap",value:function(){if(this.envMap)return this.envMap.image.src}},{key:"setEnvMapRotation",value:function(e){this.envMapRotation=e,this.materials.forEach((function(t){t.envMap&&(t.envRotateY=Math.PI/180*e,t.needsUpdate=!0)}))}},{key:"getEnvMapRotation",value:function(){return this.envMapRotation||0}},{key:"setEnvMapIntensity",value:function(e){null==e||null==e?(e=.7,this.materials.forEach((function(t){t.envMapIntensity=e,t.needsUpdate=!0}))):(this.materials.forEach((function(t){t.envMapIntensity=e,t.needsUpdate=!0})),this.envMapIntensity=e)}},{key:"getEnvMapIntensity",value:function(){return null==this.envMapIntensity||null==this.envMapIntensity?.7:this.envMapIntensity}},{key:"clearEnvMap",value:function(){this.envMap=null,this.materials.forEach((function(e){e.envMap=null,e.needsUpdate=!0}))}},{key:"hasAnimation",value:function(){return this.animation.hasAnimation()}},{key:"adapt",value:function(){this.update(),this.updateWorldMatrix(!1,!0);var e=(new at).subVectors(this.boundingBox.getCenter(),this.position);this.children.forEach((function(t){t.position.x-=e.x,t.position.y-=e.y,t.position.z-=e.z})),this.update(),this.viewer.sceneManager.fitCamera(this,this.boundingBox)}},{key:"getSize",value:function(){return this.boundingBox.getSize()}},{key:"showDimension",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#FFFFFF";this.dimension&&this.viewer.sceneManager.root.remove(this.dimension),this.dimension=new Id(this,e,t,n,i),this.viewer.sceneManager.root.add(this.dimension)}},{key:"hideDimension",value:function(){this.dimension&&(this.viewer.sceneManager.root.remove(this.dimension),this.dimension=null)}},{key:"exploding",get:function(){return this._exploding||(this._exploding=new Ld(this)),this._exploding}},{key:"setExploding",value:function(e){this.exploding.applyScalar(parseFloat(e))}},{key:"setExplodingMode",value:function(e){this.exploding.applyScalar(0),this.exploding.setMode(e)}},{key:"onBeforeRender",value:function(e,t,n){}},{key:"onAfterRender",value:function(e,t,n){}},{key:"on",value:function(e,t){"click"==e&&(this.clickCallback.push(t),this.viewer.modelManager.intersectObjects.click.includes(this)||this.viewer.modelManager.intersectObjects.click.push(this)),"dblclick"==e&&(this.dblclickCallback.push(t),this.viewer.modelManager.intersectObjects.dblclick.includes(this)||this.viewer.modelManager.intersectObjects.dblclick.push(this)),"mousedown"==e&&(this.mousedownCallback.push(t),this.viewer.modelManager.intersectObjects.mousedown.includes(this)||this.viewer.modelManager.intersectObjects.mousedown.push(this)),"mousemove"==e&&(this.mousemoveCallback.push(t),this.viewer.modelManager.intersectObjects.mousemove.includes(this)||this.viewer.modelManager.intersectObjects.mousemove.push(this))}},{key:"off",value:function(e,t){"click"==e&&(this.clickCallback.includes(t)&&this.clickCallback.remove(t),0==this.clickCallback.length&&this.viewer.modelManager.intersectObjects.click.includes(this)&&this.viewer.modelManager.intersectObjects.click.remove(this)),"dblclick"==e&&(this.dblclickCallback.includes(t)&&this.dblclickCallback.remove(t),0==this.dblclickCallback.length&&this.viewer.modelManager.intersectObjects.dblclick.includes(this)&&this.viewer.modelManager.intersectObjects.dblclick.remove(this)),"mousedown"==e&&(this.mousedownCallback.includes(t)&&this.mousedownCallback.remove(t),0==this.mousedownCallback.length&&this.viewer.modelManager.intersectObjects.mousedown.includes(this)&&this.viewer.modelManager.intersectObjects.mousedown.remove(this)),"mousemove"==e&&(this.mousemoveCallback.includes(t)&&this.mousemoveCallback.remove(t),0==this.mousemoveCallback.length&&this.viewer.modelManager.intersectObjects.mousemove.includes(this)&&this.viewer.modelManager.intersectObjects.mousemove.remove(this))}},{key:"clear",value:function(){var e=this;this.clickCallback.map((function(t){e.viewer.modelManager.intersectObjects.click.remove(t)})),this.dblclickCallback.map((function(t){e.viewer.modelManager.intersectObjects.dblclick.remove(t)})),this.mousemoveCallback.map((function(t){e.viewer.modelManager.intersectObjects.mousemove.remove(t)})),this.mousedownCallback.map((function(t){e.viewer.modelManager.intersectObjects.mousedown.remove(t)})),this.clickCallback=[],this.dblclickCallback=[],this.mousemoveCallback=[],this.mousedownCallback=[]}},{key:"dispose",value:function(){this.traverse((function(e){if(e.isMesh){e.geometry&&e.geometry.dispose(),e.geometry=null;for(var t=Array.isArray(e.material)?e.material:[e.material],n=0;n1&&void 0!==arguments[1]?arguments[1]:1;this.selectedMaterial=this._getMaterialByName(e),this._applyParams("opacity",t),this._updateTransparent()}},{key:"setAlbedoMap",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.selectedMaterial=this._getMaterialByName(e),this._applyParams("albedo",t,"map"),this.selectedMaterial.albedo&&(this.selectedMaterial.albedo.repeat.set(i,i),this.selectedMaterial.albedo.offset.set(n,n),this.selectedMaterial.needsUpdate=!0)}},{key:"setNormalMap",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;this.selectedMaterial=this._getMaterialByName(e),this._applyParams("normalMap",t,"map"),this._applyParams("normalScale",n),this.selectedMaterial.normalMap&&(this.selectedMaterial.normalMap.repeat.set(r,r),this.selectedMaterial.normalMap.offset.set(i,i),this.selectedMaterial.needsUpdate=!0)}},{key:"_updateTransparent",value:function(){this.selectedMaterial&&(this.selectedMaterial.opacity<1||this.selectedMaterial.transparency>0?this.selectedMaterial.transparent=!0:1==this.selectedMaterial.opacity&&0==this.selectedMaterial.transparency&&(this.selectedMaterial.transparent=!1))}},{key:"_getMaterialByName",value:function(e){var t=this.materials.find((function(t){return t.sname==e}));if(!t)throw new Error("找不到该材质");return t}},{key:"_applyParams",value:function(e,t,n){var i=this;if(this._cacheMaterials[this.selectedMaterial.name]||(this._cacheMaterials[this.selectedMaterial.name]=this.selectedMaterial.clone()),"map"===n){var r=this.selectedMaterial[e];if(void 0===this.selectedMaterial[e+"0"]&&(this.selectedMaterial[e+"0"]=r||null),t){var a=t;t=this.mapLoader.load(t,(function(t){"reflectMap"!==e&&"envMap"!==e||((t=i.mapLoader.convertTexture(t)).image.src=a,i.selectedMaterial[e]=t,i.selectedMaterial.needsUpdate=!0)})),"envMap"===e?t.custom=!0:t.wrapS=t.wrapT=1e3}else t=null;this.selectedMaterial[e]=t}else"color"===n?this.selectedMaterial[e].set(t):this.selectedMaterial[e]=t;this.selectedMaterial.needsUpdate=!0}},{key:"applyMaterialFile",value:function(e){var t=this,n=e.url,i=e.onTextureLoad,r=e.env,a=e.fromOthers,o=e.localPath;this.loader&&(this.splitCache&&(this.splitCache.map((function(e){var n=t.objects.find((function(t){return t.id===e.a})),i=t.materials.find((function(t){return t.name===e.c}));i&&(n.material[e.b]=i)})),this.splitCache=[]),this.loader.loader.extraMaterial={},o&&this.loader.mapLoader.setBaseUrl(o),this.loader.loader.replaceMaterials({url:n,fromOthers:a,onTextureLoad:i,onLoad:function(){t.mapLoader.setBaseUrl(!1),r&&t.setEnvMap(t.envMap)}}))}},{key:"dissolve",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this,n=this.viewer,i=e.target,r=e.speed,a=e.type,o=e.color,s=e.onComplete,l=e.start,A=e.end;if(void 0===i&&(i=this.objects),!Array.isArray(i))return new Error("param.target 必须为一个节点/网格类型数组, 默认使用整个Model下所有子节点");void 0===a&&(a="Perlin");var c=["Perlin","Radial","Linner"].includes(a)?Ff[a]:a;if(!c.isTexture)return new Error("param.type 必须为一'Perlin', 'Radial', 'Linner'中一个, 或者使用自定义Texture对象");r=r||1,l=l||0,A=A||1,o=new Fn(o||16774921);var h=[],u=new WeakMap,d=[];Array.isArray(i)&&i.map((function(e){e.isMesh&&!h.includes(e)&&h.push(e),e.isObject3D&&e.traverse((function(e){e.isMesh&&!h.includes(e)&&h.push(e)}))})),h.map((function(e){return m(e)})),n.addEventListener(ld.UPDATE,p);var f=l;function p(){f>=A&&(n.removeEventListener(ld.UPDATE,p),s&&s(),p=null),f+=.005*r,d.map((function(e){u.get(e).dissolveRatio=f}))}function m(e){e.material=e.material.map((function(e){if(e.isAMRTShadowMaterial)return e;if(e.dissolveMap&&(e=t._cache.get(e)),u.has(e))return u.get(e);var n=(new El).copy(e);return n.dissolveMap=c,n.dissolveRatio=l,n.dissolveColor=o,t._cache.set(n,e),u.set(e,n),d.push(e),n}))}}},{key:"clearDissolve",value:function(){var e=this;this.objects.map((function(t){t.material=t.material.map((function(t){return e._cache.has(t)?e._cache.get(t):t}))})),this._cache=new WeakMap}},{key:"showSkeleton",value:function(){this.skeleton?this.skeleton.visible=!0:(this.skeleton=new sh(this),this.skeleton.visible=!0,this.add(this.skeleton))}},{key:"hideSkeleton",value:function(){this.skeleton&&(this.skeleton.visible=!1),this.skeleton=null}},{key:"getNodeTree",value:function(){var e={};return this._getNodeTree(this.children[0],e),e}},{key:"_getNodeTree",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n.ID=e.ID,n.id=e.id,n.name=e.name,n.children=[],e.children&&e.children.length>0&&e.children.forEach((function(e){n.children.push(t._getNodeTree(e))})),n}},{key:"onMouseOver",value:function(e,t){e&&t&&(this._findListener(this.mouseoverListeners,e,t)||(e._targetRoot=!0,this.mouseoverListeners.push({target:e,handle:t})))}},{key:"offMouseOver",value:function(e,t){var n=this._findListener(this.mouseoverListeners,e,t);n&&(this.mouseoverListeners.remove(n),delete n.target._targetRoot)}},{key:"onMouseOut",value:function(e,t){e&&t&&(this._findListener(this.mouseoutListeners,e,t)||(e._targetRoot=!0,this.mouseoutListeners.push({target:e,handle:t})))}},{key:"offMouseOut",value:function(e,t){var n=this._findListener(this.mouseoutListeners,e,t);n&&(this.mouseoutListeners.remove(n),delete n.target._targetRoot)}},{key:"_mousemoveHandler",value:function(e){var t=this;if(this.mouseoverListeners.length+this.mouseoutListeners.length>0){var n=[];this.mouseoverListeners.forEach((function(e){n.includes(e.target)||n.push(e.target)}));var i=this.viewer.modelManager.picker.intersectObject(e,n,!0),r=null;if(i){var a=function(e){e._targetRoot&&(t.mouseoverListeners.forEach((function(n){n.target===e&&n.target!==t.currentIntersectTarget&&n.handle(n.target)})),r=e)};i.object._targetRoot?a(i.object):i.object.traverseAncestors(a)}for(var o=0;o-1&&this.loadComponentFile(i,t)}}},{key:"loadComponentFile",value:function(e,t){var n=this,i="gz"===this.extension?e.a+"."+this.extension:e.a;(new Uf).load(this.basePath+i,(function(e){n.parseComponentFile(JSON.parse(e)),t()})),e.loaded=!0}},{key:"parseComponentFile",value:function(e,t){var n=this;e.forEach((function(e){var t={id:e.a,pid:e.b,name:e.c,data:e.d};if(n.nodeTree){var i=n.nodeArray.find((function(t){return t.CID==e.a}));i&&(i.bim=t)}else{var r=n.getObjectByProperty("CID",e.a);r&&(r.userData.bim=t)}}))}},{key:"onComplete",value:function(){var e=this;this.objects=[],this.traverse((function(t){if(t.isMesh&&e.objects.push(t),t.name.indexOf("##")>-1){var n=t.name.split("##");t.name=n[0],t.CID=parseInt(n[1])}}))}},{key:"getNodeByFace",value:function(e){return this.nodeArray.find((function(t){return e>=t.face[0]&&e<=t.face[1]}))}},{key:"getComponentInfoByFace",value:function(e,t){var n=this.faceMap.find((function(t){return t.a==e.object.ID}));if(n){for(var i=null,r=0,a=n.b.length;r=n.b[r]&&e.faceIndex<=n.b[r+1]){i=n.b[r+2];break}if(null!==i)return this.nodeArray.find((function(e){return e.a==i}))}}},{key:"getFaceRange",value:function(e){var t=this.faceMap.find((function(t){return t.a==e.object.ID}));if(t){for(var n=0,i=t.b.length;n=t.b[n]&&e.faceIndex<=t.b[n+1])return{face:[t.b[n],t.b[n+1]],id:t.b[n+2],node:this.nodeTree[t.b[n+2]]};return null}}},{key:"setMaterialByFace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#00f9ff",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=this.getFaceRange(e),r=e.object,a=r.material[0].clone();a.color.setStyle(t),a.opacity=n,r.changeNodes[i.id]={node:i,mat:a},this._resetMaterial(r)}},{key:"_resetMaterial",value:function(e){var t=e.geometry.index.count,n=[],i=[];e.geometry.index.array=[],e.material=[e.material[0]];var r=Object.values(e.changeNodes),a=r.length;r.forEach((function(e){n.push([]),n[n.length-1].mat=e.mat}));for(var o=0;o=c&&o=h&&s1){var r=n._findNodeParent(i.nodes[0].node);i.nodes=[{mesh:i.mesh,id:r.a,node:r,face:[i.nodes[0].face[0],i.nodes[i.nodes.length-1].face[1]]}]}n.setNodeVisible(i.mesh,i.nodes,t),t||n.hideNodes[e].push(i)})),console.timeEnd("setFace"),console.timeEnd("总耗时")}}},{key:"_findNodeByCID",value:function(e){return this.nodeArray.find((function(t){return t.CID==e}))}},{key:"_findMeshByCID",value:function(e){var t=this._findNodeByCID(e);return t?this._findMeshByNode(t):null}},{key:"_findMeshByNode",value:function(e){var t=e.target||this._findMeshByNodeID(e.a);if(t)return e.target=t,t.node=e,t;e.children||this._findNodeChildren(e);for(var n=0,i=e.children.length;n0)for(var i=0,r=n.children.length;i6&&void 0!==arguments[6]&&arguments[6];n||(n=Rf(matName)),void 0!==e.a&&(n.name=e.a,n.ID=e.a,n.sname=e.ee);var s=0,l=0;function A(){++s===l&&(n.needsUpdate=!0,r&&r instanceof Function&&r())}if(!o)if(void 0!==e.b?n.color=(new Fn).fromArray(e.b):n.color.set(16777215),void 0!==e.c&&t[e.c]){l++;var c=t[e.c];a.load(c,(function(t){null!=e.t&&t.repeat.set(e.t[0],e.t[1]),null!=e.x&&t.offset.set(e.x[0],e.x[1]),null!=e.ff&&(t.rotation=e.ff),null!=e.ad&&(n.albedoUV=e.ad),n.albedo=t,void 0!==e.c?n.useDefault=e.useDefault:n.useDefault=!0,A()}),null,(function(e){console.error("贴图加载出错"),A()}))}else n.albedo=null,n.albedoUV=null,n.needsUpdate=!0;if(e.d){var h=(new Fn).fromArray(e.d);n.emissive=h}if(void 0!==e.e&&(n.aoScale=parseFloat(e.e)),void 0!==e.f&&n.color.multiplyScalar(parseFloat(e.f)),void 0!==e.g&&(n.smoothness=parseFloat(e.g)),void 0!==e.h&&(n.metallic=parseFloat(e.h)),void 0!==e.i&&(n.normalScale=parseFloat(e.i)),void 0!==e.j&&(n.opacity=parseFloat(e.j)),void 0!==e.gg&&(n.transparency=parseFloat(e.gg)),(n.opacity<1||n.transparency>0)&&(n.transparent=!0),void 0!==e.hh&&(n.alphaTest=parseFloat(e.hh)),void 0!==e.ii&&(n.reflectIntensity=parseFloat(e.ii)),void 0!==e.si&&(n.side=e.si),void 0!==e.q&&t[e.q]?(l++,a.load(t[e.q],(function(t){void 0!==e.u?t.repeat.set(e.u[0],e.u[1]):t.repeat.set(1,1),void 0!==e.mm&&t.offset.set(e.mm[0],e.mm[1]),void 0!==e.nn&&(t.rotation=e.nn),n.normalMap=t,A()}),null,(function(e){console.error("贴图加载出错"),A()}))):(n.normalMap=null,n.needsUpdate=!0),void 0!==e.cf&&t[e.cf]?(l++,a.load(t[e.cf],(function(t){void 0!==e.cb?t.repeat.set(e.cb[0],e.cb[1]):t.repeat.set(1,1),void 0!==e.cg&&t.offset.set(e.cg[0],e.cg[1]),void 0!==e.cn&&(t.rotation=e.cn),void 0!==e.ca&&(n.normalScale2=parseFloat(e.ca)),n.normalMap2=t,A()}),null,(function(e){console.error("贴图加载出错"),A()}))):(n.normalMap2=null,n.needsUpdate=!0),void 0!==e.r&&t[e.r]&&void 0!==e.fd){l++;var u=t[e.r];Of[u]?(n.aoMap=Of[u],n.aoUV=e.fd,Of[u+"_mats"].push(n),A()):(n.aoMap=Of[u]=a.load(t[e.r],(function(t){void 0!==e.v?t.repeat.set(e.v[0],e.v[1]):t.repeat.set(1,1),void 0!==e.oo&&t.offset.set(e.oo[0],e.oo[1]),void 0!==e.ss&&(t.rotation=e.ss),n.aoUV=e.fd,Of[u+"_mats"]&&Of[u+"_mats"].map((function(e){return e.needsUpdate=!0})),A()}),null,(function(e){console.error("贴图加载出错"),A()})),Of[u+"_mats"]=[n])}else n.aoMap=null,n.needsUpdate=!0;if(void 0!==e.y&&t[e.y]?(l++,a.load(t[e.y],(function(t){void 0!==e.bb?t.repeat.set(e.bb[0],e.bb[1]):t.repeat.set(1,1),void 0!==e.pp&&t.offset.set(e.pp[0],e.pp[1]),void 0!==e.tt&&(t.rotation=e.tt),n.metallicMap=t,A()}),null,(function(e){console.error("贴图加载出错"),A()}))):(n.metallicMap=null,n.needsUpdate=!0),void 0!==e.z&&t[e.z]?(l++,a.load(t[e.z],(function(t){void 0!==e.cc?t.repeat.set(e.cc[0],e.cc[1]):t.repeat.set(1,1),void 0!==e.qq&&t.offset.set(e.qq[0],e.qq[1]),void 0!==e.uu&&(t.rotation=e.uu),n.roughnessMap=t,A()}),null,(function(e){console.error("贴图加载出错"),A()}))):(n.roughnessMap=null,n.needsUpdate=!0),void 0!==e.aa&&t[e.aa]?(l++,a.load(t[e.aa],(function(t){void 0!==e.dd?t.repeat.set(e.dd[0],e.dd[1]):t.repeat.set(1,1),void 0!==e.rr&&t.offset.set(e.rr[0],e.rr[1]),void 0!==e.vv&&(t.rotation=e.vv),void 0!==e.gd&&(n.emissiveUV=e.gd),n.emissiveMap=t,A()}),null,(function(e){console.error("贴图加载出错"),A()}))):(n.emissiveMap=null,n.needsUpdate=!0),void 0!==e.ll&&t[e.ll]){l++;var d=t[e.ll];void 0!==e.yy&&(n.reflectRotateY=e.yy),a.load(d,(function(e){var t=e.image;e.wrapS=e.wrapT=1e3,0===e.image.width||0===e.image.height?setTimeout((function(){e=a.convertTexture(e),n.reflectMap=e,e.image=t,A()}),500):(e=a.convertTexture(e),n.reflectMap=e,e.image=t,A())}),null,(function(e){console.error("贴图加载出错"),A()}))}else n.reflectMap=null,n.needsUpdate=!0;if(void 0!==e.zz&&t[e.zz]){l++;var f=t[e.zz];a.load(f,(function(t){void 0!==e.bb?t.repeat.set(e.zx[0],e.zx[1]):t.repeat.set(1,1),void 0!==e.pp&&t.offset.set(e.zc[0],e.zc[1]),void 0!==e.zv&&(t.rotation=e.zv),n.alphaMap=t,A()}),null,(function(e){console.error("贴图加载出错"),A()}))}else n.reflectMap=null,n.needsUpdate=!0;return n.retainMap=!0,void 0!==e.jj&&(n.retainMap=Boolean(e.ii)),void 0!==e.kk&&!0!==e.kk?n.renderOrder=Number(e.kk):n.renderOrder=n.opacity<1?Ke:Ze,null!=e.jr&&(n.reflectivity=e.jr),null!=e.l&&(n.wireframe=e.l),null!=e.o&&(n.skinning=e.o),null!=e.p&&(n.vertexTangents=e.p),null!=e.qn&&(n.normalMapType=e.qn),null!=e.rm&&(n.morphTargets=e.rm),null!=e.transparent&&(n.transparent=e.transparent),void 0!==e.re&&(n.re=e.re),void 0!==e.dt&&(n.depthTest=e.dt),void 0!==e.dw&&(n.depthWrite=e.dw),n.needsUpdate=!0,i&&i instanceof Function&&i(n),0===l&&r&&r instanceof Function&&r(n),n}},{key:"export",value:function(e,t){if(void 0!==e.re)return{a:e.ID||e.name,re:e.re};var n=Object.keys(t).length,i={a:e.ID||e.name,b:e.color.toArray(),d:e.emissive.toArray(),e:e.aoScale,g:e.smoothness,h:e.metallic,i:e.normalScale,j:e.opacity,gg:e.transparency,hh:e.alphaTest,ii:e.reflectIntensity,jj:e.retainMap,kk:e.renderOrder,ee:e.sname,useDefault:e.useDefault,transparent:e.transparent,si:e.side,jr:e.reflectivity,lw:e.wireframe,os:e.skinning,pv:e.vertexTangents,qn:e.normalMapType,rm:e.morphTargets,dw:e.depthWrite,dt:e.depthTest};return e.albedo&&(i.t=e.albedo.repeat.toArray(),i.x=e.albedo.offset.toArray(),i.ff=e.albedo.rotation,i.ad=e.albedoUV,e.albedo.image&&(i.c=n,t[n]=e.albedo.image.src,n++)),e.normalMap&&(i.u=e.normalMap.repeat.toArray(),i.mm=e.normalMap.offset.toArray(),i.nn=e.normalMap.rotation,e.normalMap.image&&(i.q=n,t[n]=e.normalMap.image.src,n++)),e.normalMap2&&(i.cb=e.normalMap2.repeat.toArray(),i.cg=e.normalMap2.offset.toArray(),i.cn=e.normalMap2.rotation,i.ca=e.normalMap2.normalScale2,e.normalMap2.image&&(i.cf=n,t[n]=e.normalMap2.image.src,n++)),e.aoMap&&(i.v=e.aoMap.repeat.toArray(),i.oo=e.aoMap.offset.toArray(),i.ss=e.aoMap.rotation,i.fd=e.aoUV,e.aoMap.image&&(i.r=n,t[n]=e.aoMap.image.src,n++)),e.metallicMap&&(i.bb=e.metallicMap.repeat.toArray(),i.pp=e.metallicMap.offset.toArray(),i.tt=e.metallicMap.rotation,e.metallicMap.image&&(i.y=n,t[n]=e.metallicMap.image.src,n++)),e.roughnessMap&&(i.cc=e.roughnessMap.repeat.toArray(),i.qq=e.roughnessMap.offset.toArray(),i.uu=e.roughnessMap.rotation,e.roughnessMap.image&&(i.z=n,t[n]=e.roughnessMap.image.src,n++)),e.emissiveMap&&(i.dd=e.emissiveMap.repeat.toArray(),i.rr=e.emissiveMap.offset.toArray(),i.vv=e.emissiveMap.rotation,i.gd=e.emissiveUV,e.emissiveMap.image&&(i.aa=n,t[n]=e.emissiveMap.image.src,n++)),e.reflectMap&&e.reflectMap.image&&(i.yy=e.reflectRotateY,i.ll=n,t[n]=e.reflectMap.image.src,n++),e.alphaMap&&(i.zx=e.alphaMap.repeat.toArray(),i.zc=e.alphaMap.offset.toArray(),i.zv=e.alphaMap.rotation,e.alphaMap.image&&(i.zz=n,t[n]=e.alphaMap.image.src,n++)),i}},{key:"merge",value:function(e,t){var n=0;if(e.b&&(n=Object.keys(e.b).length,t.b))for(var i in t.b)i=parseInt(i),e.b[i+n]=t.b[i];Array.isArray(t.a)&&(t.a=t.a.filter((function(e){return void 0===e.re})),e.a.map((function(i,r){if(i.ee){var a=t.a.find((function(e){return e.ee===i.ee}));for(var o in a)["c","q","cf","r","y","z","aa","ll","zz"].includes(o)&&(a[o]=a[o]+n);a&&(a.a=i.a,e.a[r]=Object.assign({},a))}})))}}]),e}(),zf=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;s(this,e),this.viewer=n,this.cacheMats=[],this.queryMats={},this.cacheMeshes=[],this.cacheMesheIds=[],this.cacheAnimations=[],this.cacheActions=[],this.cacheSkyboxs={},this.cacheSkinnedMeshs=[],this.cacheSkinnedMeshIds=[],this.cacheEnvMap={},this.cacheAoMap={},this.instances=null,this.extraMaterial={},this.cacheExtraMat=[],this.scene=null,this.hasSkinnedAnimation=!1,this.model=t.isBIM?new Df(this.viewer):new kf(this.viewer),this.model.objects=this.cacheMeshes,this.model.materials=this.cacheMats,this.animNameMap=new Map}return A(e,[{key:"load",value:function(e,t,n,i){var r=this;"undefined"!=typeof Worker?(this.workerLoader=new Md,this.workerLoader.loadMesh(e,(function(e){t(r.parse(e))}),n,(function(e){console.error("网格文件解析出错!"),i&&i(e)}))):(new Kl).load(e,(function(e){try{r.parse(JSON.parse(e))}catch(e){console.error("网格文件解析出错!",e),i&&i(e)}t(r.model)}),n,i)}},{key:"loadNodes",value:function(e,t,n){var i=this;(new Kl).load(e,(function(e){i.generateNodes(JSON.parse(e)),t()}),void 0,(function(t){console.error("节点文件加载失败:"+e,t)}))}},{key:"generateNodes",value:function(e){var t=this;e.forEach((function(e){var n=new ja;if(n.ID=e.a,n.name=e.b,-1==e.c)t.model.add(n);else{var i=t.model.getObjectByProperty("ID",e.c);i&&i.add(n)}n.applyMatrix((new bt).fromArray(e.d)),t.addToCache(n)}))}},{key:"bindSkeleton",value:function(){}},{key:"initSkeletonTransform",value:function(){}},{key:"loadMeshComplete",value:function(){}},{key:"parse",value:function(e){var t=this.model;Array.isArray(e)||(e=[e]);for(var n=[],i=function(t){e.find((function(n,i){return n.a===e[t].a&&t!=i}))&&(e[t].a+=e[t].b)},r=0;r0){var n=this.generateGeometry(e);t=new Ei(n,this.generateMaterial(n))}else t=new zt;return t.name=e.a,t.ID=e.b,t.parentID=e.c,t.applyMatrix((new bt).fromArray(e.d)),t}},{key:"generateSkinnedMesh",value:function(e){var t;if(e.h){var n=this.generateGeometry(e),i=this.generateMaterial(n,!0);e.ff&&e.ff.length>0?(i.skinning=!0,n.setAttribute("skinIndex",new jn(e.ff,4)),n.setAttribute("skinWeight",new Yn(e.gg,4)),(t=new Bo(n,i)).xIDs=e.hh):t=new Ei(n,i)}else t=new _o;return t.name=e.a,t.ID=e.b,t.applyMatrix((new bt).fromArray(e.d)),this.cacheSkinnedMeshs[e.b]=t,this.model.add(t),this.model.updateMatrixWorld(!0),t}},{key:"generateGeometry",value:function(e){var t=new si;t.name=e.a;var n=new bt;if(e.e&&n.fromArray(e.e),!(e.h&&e.h.length>0))return null;var i=new Yn(e.h,3);if(n.applyToBufferAttribute(i),t.setAttribute("position",i),e.j&&e.j.length>0){var r=new Yn(e.j,3);(new lt).getNormalMatrix(n).applyToBufferAttribute(r),t.setAttribute("normal",r)}else console.warn("无法线");e.k&&e.k.length>0?t.setAttribute("uv",new Yn(e.k,2)):console.warn("无UV"),e.l&&e.l.length>0&&t.setAttribute("uv2",new Yn(e.l,2)),t.setIndex(e.i),e.j&&0!=e.j.length||t.computeVertexNormals(),t.clearGroups(),e.k&&e.k.length>0&&pd(t);for(var a=[],o=0;o0){var a=0,o=0,s=e.a.length;e.a.forEach((function(l){r.parseMaterial({config:l,maps:e.b,onLoad:function(){++a===s&&(r._initMaterial(),t&&t instanceof Function&&t())},onTextureLoad:function(){++o===s&&n&&n instanceof Function&&n()},onError:i,edited:!1})}))}else t&&t instanceof Function&&t()}},{key:"parseMaterial",value:function(e){var t=e.config,n=e.maps,i=e.onLoad,r=e.onTextureLoad;e.onError;var a=e.edited,o=t.a,s=this.queryMats[o];if(void 0===s&&o&&o.toString().indexOf("_")>-1){var l=o.split("_")[0],A=this.queryMats[l],c=this.cacheMats[A],h=this.cacheMeshes.find((function(e){return e.name===t.mn})),u=c.clone();u.name=t.ee||o,u.sname=c.sname,u.ID=o,this.cacheMats.push(u),s=this.cacheMats.length-1,this.queryMats[o]=s,h.material[h.material.indexOf(c)]=u}var d=this.cacheMats[s];d||(d=this._createBaseMaterial(o),this.cacheMats.push(d),this.queryMats[o]=this.cacheMats.length-1),Nf.parseAmrtMaterial(t,n,d,i,r,this.mapLoader,a)}},{key:"loadAnimationComplete",value:function(e){this.model.animation.setAnimationList(["take 01"])}},{key:"loadAnimation",value:function(e,t){var n=this;(new Kl).load(e,(function(e){try{n.hasSkinnedAnimation?n.parseSkinnedAnimation(JSON.parse(e)):n.parseAnimation(JSON.parse(e))}catch(e){console.error("动画文件解析出错!",e)}t&&t()}))}},{key:"parseAnimation",value:function(e){for(var t=0,n=[],i=0;it&&(t=o)}var s=new Gl("take 01",t,n);this.model.animation.addClip(s)}},{key:"parseSkinnedAnimation",value:function(e){for(var t=[],n=0,i=0;in&&(n=r.d);for(var c=0;ct&&(t=e[n]);return t},_createGeometry:function(e,t,n){if("mbin"===n.fileType){if(n.bComplete&&(this.workerStateById[t]=1),null===(c=n.geometry)||null==c)return;if(c.chunkType,2===c.chunkType){var i=new si;if(i.custom_data={},i.custom_data.id=c.id,i.custom_data.parentId=c.parentId,i.custom_data.matrix=c.matrix,i.custom_data.bIsNodel=c.bIsNodel,i.custom_data.nodeType=c.nodeType,i.custom_data.version=c.version,void 0!==c.materialIndex){i.clearGroups(),i.custom_data.materialIndex=[];for(var r=c.materialIndex.length/3,a=0;a65535?Xn:jn)(c.index.array,1),delete c.index.array,c.index=null);for(a=0;at._taskLoad?-1:1}));return(i=n.workerPool[n.workerPool.length-1])._taskCosts[e]=t,i._taskLoad+=t,i})).catch((function(e){console.log(e)}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))},dispose:function(){for(var e=0;e0){var x;this.dracoLoadCount++;var b=e.getArrayBuffer(w);s.Init(new Int8Array(b),b.byteLength),t.decodeType=4;for(var M,C=f(n,i,s,t),B=C.attributes.length,E=0;EA&&(A=M.length)}}else for(var L=0;LA&&(A=F.frameNum),null!==F&&l.boneId2Anim.push(F)}e.setOffset(y+g)}else{for(var k=e.getUint32(),P=(g=e.getUint32(),y=e.getOffset(),0);PA&&(A=D.frameNum),D.meshId=U,null!==D&&(5==m?l.animType2Anim.transAnim.push(D):7==m&&l.animType2Anim.scaleAnim.push(D));else if(6==m){var D;(D=o(e,d,t,n,i,s)).frameNum>A&&(A=D.frameNum),D.meshId=U,null!==D&&l.animType2Anim.rotAnim.push(D)}else console.log("Error: chunkType errror!!!!")}e.setOffset(y+g)}}return e.setOffset(h+c),A<2?null:l}function r(e){var t={};t.boneId=e.getUint32(),t.frameNum=e.getUint32(),t.frameTimes=e.getFloat32Array(t.frameNum),t.frameVals=new Array(t.frameNum);for(var n=0;n=5){var s=e.getUint32();if(s>0){var l=e.getArrayBuffer(s);a.Init(new Int8Array(l),l.byteLength),n.decodeType=5;var A=f(i,r,a,n);o.frameTimes=A.attributes[0].array,o.frameVals=A.attributes[1].array}}else o.frameTimes=e.getFloat32Array(o.frameNum),o.frameVals=e.getFloat32Array(3*o.frameNum);return o}function o(e,t,n,i,r,a){var o={};if(o.frameNum=e.getUint32(),t&&o.frameNum>=5){var s=e.getUint32(),l=e.getArrayBuffer(s);a.Init(new Int8Array(l),l.byteLength),n.decodeType=5;var A=f(i,r,a,n);o.frameTimes=A.attributes[0].array,o.frameVals=A.attributes[1].array}else o.frameTimes=e.getFloat32Array(o.frameNum),o.frameVals=e.getFloat32Array(4*o.frameNum);return o}function s(e,t,n,i,r,a){var o={meshId:0,boneIds:[],boneIndices:[],boneWeights:[]},s=e.getUint32(),l=e.getOffset();o.meshId=e.getUint32();for(var A=e.getUint32(),c=[],h=0;h0?parseInt(b/4)+1:parseInt(b/4));if(t){var C=e.getUint32();if(C>0){var B=e.getArrayBuffer(C);a.Init(new Int8Array(B),B.byteLength),n.decodeType=3;var E=f(i,r,a,n),S=E.attributes[0].array,T=E.attributes[1].array;S.length;for(var _=0;_0){o.loadedState[0]=0;var u=e.getArrayBuffer(m);r.Init(new Int8Array(u),u.byteLength),t.decodeType=1,(d=f(n,i,r,t)).attributes[0].name="position",o.attributes.push(d.attributes[0])}else o.vertexNum=0,o.loadedState[0]=1;if((m=e.getUint32())>0){o.loadedState[1]=0;u=e.getArrayBuffer(m);r.Init(new Int8Array(u),u.byteLength),t.decodeType=2;var d=f(n,i,r,t);o.index={array:d.attributes[0].array},o.faceNum=d.attributes[0].array.length/3}else o.faceNum=0,o.loadedState[1]=1}else o.vertexNum=e.getUint32(),o.vertexs=e.getFloat32Array(3*o.vertexNum),o.attributes.push({name:"position",array:o.vertexs,itemSize:3}),o.faceNum=e.getUint32(),o.faceVerIndexs=e.getUint32Array(3*o.faceNum),o.index={array:o.faceVerIndexs};if(o.bHaveUVData)if(o.bUseDraco){if((m=e.getUint32())>0){o.loadedState[2]=0;u=e.getArrayBuffer(m);r.Init(new Int8Array(u),u.byteLength),t.decodeType=1,(d=f(n,i,r,t)).attributes[0].name="uv",o.attributes.push(d.attributes[0])}else o.UVNum=0,o.loadedState[2]=1;if(o.bUseCompose)if((m=e.getUint32())>0){o.loadedState[3]=0;u=e.getArrayBuffer(m);this.dracoLoadCount++,dracoLoader.decodeDracoFile(u,(function(e){o.faceComposedUVIndexs=e.attributes[0].array,o.loadedState[3]=1,a.dracoOnLoad()}),null,null,2)}else o.loadedState[3]=1;else o.loadedState[3]=1}else o.UVNum=e.getUint32(),o.uvData=e.getFloat32Array(2*o.UVNum),o.attributes.push({name:"uv",array:o.uvData,itemSize:2}),o.bUseCompose&&(o.faceComposedUVIndexs=e.getUint32Array(3*o.faceNum)),o.loadedState[3]=1;else o.loadedState[2]=1,o.loadedState[3]=1;if(o.bHaveUV2Data)if(o.bUseDraco){if((m=e.getUint32())>0){o.loadedState[4]=0;u=e.getArrayBuffer(m);r.Init(new Int8Array(u),u.byteLength),t.decodeType=1,(d=f(n,i,r,t)).attributes[0].name="uv2",o.attributes.push(d.attributes[0])}else o.UV2Num=0,o.loadedState[4]=1;if(o.bUseCompose)if((m=e.getUint32())>0){o.loadedState[5]=0;u=e.getArrayBuffer(m);this.dracoLoadCount++,dracoLoader.decodeDracoFile(u,(function(e){o.faceComposedUV2Indexs=e.attributes[0].array,o.loadedState[5]=1,a.dracoOnLoad()}),null,null,2)}else o.loadedState[5]=1;else o.loadedState[5]=1}else o.UV2Num=e.getUint32(),o.uv2Data=e.getFloat32Array(2*o.UV2Num),o.loadedState[4]=1,o.attributes.push({name:"uv2",array:o.uv2Data,itemSize:2}),o.bUseCompose&&(o.faceComposedUV2Indexs=e.getUint32Array(3*o.faceNum)),o.loadedState[5]=1;else o.loadedState[4]=1,o.loadedState[5]=1;o.materialNum=e.getUint32(),o.materialIndex=new Array(o.materialNum);for(var p=0;p0){o.loadedState[6]=0;u=e.getArrayBuffer(m);r.Init(new Int8Array(u),u.byteLength),t.decodeType=1,(d=f(n,i,r,t)).attributes[0].name="normal",o.attributes.push(d.attributes[0])}else o.normalNum=0,o.loadedState[6]=1;if(o.bUseCompose)if((m=e.getUint32())>0){o.loadedState[7]=0;u=e.getArrayBuffer(m);this.dracoLoadCount++,dracoLoader.decodeDracoFile(u,(function(e){o.faceComposedNormalIndexs=e.attributes[0].array,o.loadedState[7]=1,a.dracoOnLoad()}),null,null,2)}else o.loadedState[7]=1;else o.loadedState[7]=1}else o.normalNum=e.getUint32(),o.normals=e.getFloat32Array(3*o.normalNum),o.loadedState[6]=1,o.attributes.push({name:"normal",array:o.normals,itemSize:3}),o.bUseCompose&&(o.faceComposedNormalIndexs=e.getUint32Array(3*o.faceNum)),o.loadedState[7]=1;else o.loadedState[6]=1,o.loadedState[7]=1}var v=e.getUint8();return o.name=e.getString(v),function(e){var t=e.getUint8();e.getString(t)}(e),o}onmessage=function(r){var a=r.data;switch(a.type){case"init":e=a.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"clear_data":console.log("clear_data");break;case"decode":var o=a.buffer,u=a.taskConfig;t.then((function(e){var t=e.draco,r=new t.Decoder,p=new t.DecoderBuffer;try{var m=c(o,0,4);if("MBIN"===m)(function(e,t,i,r,a,o){if(function(e){var t="MBIN",n=4,i=c(e,0,n);return e.byteLength>=n&&t===i}(t)){var u=new d(t);for(u.skip(4),n=u.getUint32();u.offset=5){var k=u.getUint32();B.newBoneData=[];for(var P=0;P=5){var W=u.getUint32();if(W>0){var X=u.getArrayBuffer(W);o.Init(new Int8Array(X),X.byteLength),i.decodeType=6;var Y=(B=f(r,a,o,i)).attributes[0].array;for(y=0;y=4)0!==u.getUint8()&&(se.matrix=u.getMatrix4());B.packdata.push(se)}self.postMessage({type:"decode",id:e.id,fileType:"addbin",bComplete:!0,geometry:B})}else u.skip(v);u.setOffset(g+v)}}u=null}else console.log("mbin file format error!!!!!!!!")})(a,o,u,t,r,p);else if("ABIN"===m)(function(e,t,n,r,a,o){if(function(e){var t="ABIN",n=4,i=c(e,0,n);return e.byteLength>=n&&t===i}(t)){var s=new d(t);if(s.skip(4),s.getUint32(),8===s.getUint32()){var l=s.getUint32(),A=s.getUint32(),h=s.getOffset();if(0==l)return void self.postMessage({type:"decode",id:e.id,fileType:"abin",bComplete:!0,geometry:null});for(var u=0;u=0&&(t=t.slice(0,i)),t}}},e.taskCache=new WeakMap,e.setDecoderPath=function(){console.warn("DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},e.setDecoderConfig=function(){console.warn("DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},e.releaseDecoderModule=function(){console.warn("DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},e.getDecoderModule=function(){console.warn("DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")},t.prototype={constructor:t,getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],n=0;n=0&&(t=t.slice(0,i)),OA.decodeText(new Uint8Array(t))}},e}();function Gf(e){On.call(this),this.defines={STANDARD:""},this.type="AMRTBasicMaterial",this.color=new Fn(16777215),this.albedo=null,this.albedoUV=0,this.normalMap=null,this.normalScale=1,this.normalMap2=null,this.normalScale2=1,this.metallicMap=null,this.metallic=0,this.roughnessMap=null,this.smoothness=0,this.aoMap=null,this.aoScale=1,this.aoUV=0,this.emissive=new Fn(0),this.emissiveMap=null,this.emissiveUV=0,this.reflectMap=null,this.reflectIntensity=0,this.cutout=.5,this.reflectivity=1,this.transparency=0,this.opacity=1,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.vertexTangents=!0,this.normalMapType=0,this.envRotateY=0,this.envYMatrix=new lt,this.reflectRotateY=0,this.reflecYMatrix=new lt,this.dissolveMap=null,this.dissolveRatio=0,this.dissolveColor=new Fn(16774921),this.ssrTextureMatrix=new bt,this.ssrTexture=null,this.maxDistance=10,this.ssrOpacity=1,this.fresnelCoe=0,this.depthTexture=null,this.planeOffset=0,this.virtualCameraNear=.1,this.virtualCameraFar=1e3,this.virtualCameraMatrixWorld=new bt,this.virtualCameraProjectionMatrix=new bt,this.virtualCameraProjectionMatrixInverse=new bt,this.resolution=new tt,this.setValues(e),this.__defineSetter__("envRotateY",(function(e){this.envYMatrix=(new lt).rotateY(e)})),this.__defineSetter__("reflectRotateY",(function(e){this.reflecYMatrix=(new lt).rotateY(e)}))}Gf.prototype=Object.create(On.prototype),Gf.prototype.constructor=Gf,Gf.prototype.isAMRTBasicMaterial=!0,Gf.prototype.clone=function(){return(new this.constructor).copy(this)},Gf.prototype.copy=function(e){return On.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.albedo=e.albedo,this.albedoUV=e.albedoUV,this.normalMap=e.normalMap,this.normalScale=e.normalScale,this.normalMap2=e.normalMap2,this.normalScale2=e.normalScale2,this.metallicMap=e.metallicMap,this.metallic=e.metallic,this.roughnessMap=e.roughnessMap,this.smoothness=e.smoothness,this.aoMap=e.aoMap,this.aoScale=e.aoScale,this.aoUV=e.aoUV,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveUV=e.emissiveUV,this.reflectMap=e.reflectMap,this.reflectIntensity=e.reflectIntensity,this.cutout=e.cutout,this.reflectivity=e.reflectivity,this.transparency=e.transparency,this.opacity=e.opacity,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.vertexTangents=e.vertexTangents,this.normalMapType=e.normalMapType,this.envRotateY=e.envRotateY,this.envYMatrix=e.envYMatrix,this.reflectRotateY=e.reflectRotateY,this.reflecYMatrix=e.reflecYMatrix,this},Gf.prototype.dispose=function(){On.prototype.dispose.call(this),this.albedo&&this.albedo.dispose(),this.metallicMap&&this.metallicMap.dispose(),this.roughnessMap&&this.roughnessMap.dispose(),this.aoMap&&this.aoMap.dispose(),this.emissiveMap&&this.emissiveMap.dispose(),this.reflectMap&&this.reflectMap.dispose(),this.envMap&&this.envMap.dispose()},Object.defineProperty(Gf.prototype,"alphaMap",{get:function(){return this._alphaMap||null},set:function(e){this._alphaMap=e,e&&(this.transparent=!0)}});var Hf=[];function Vf(){this.geometry=null,this._material=null,this.instanceIndex=0,this._instanceMesh=null,this.rootInverse=new bt,this.material0=null,this._mesh=null,zt.call(this),Object.defineProperty(this,"instanceMesh",{get:function(){return this._instanceMesh},set:function(e){this._instanceMesh!=e&&(this._instanceMesh=e,this.geometry=this._instanceMesh.tmpGeometry,this._material=this._instanceMesh.material[0],this.material0=this._material,this._mesh=new Ei(this.geometry,this._material),this._mesh.name=this.name)}}),Object.defineProperty(this,"material",{get:function(){return null==this._instanceMesh?null:(this._material===this._instanceMesh.material[0]&&this.createMesh(),this._material)},set:function(e){console.log("set"),this._material=e,this._mesh.material=this._material,this._mesh.material0=this._material,null==this._mesh.parent&&this.add(this._mesh)}})}Vf.prototype=Object.assign(Object.create(zt.prototype),{constructor:Vf,intanceObject:!0,setDirty:function(){this.refreshInstanceMesh()},refreshInstanceMesh:function(){null!=this._instanceMesh&&(this._instanceMesh.updateMatrixWorld(!0),this.rootInverse.getInverse(this._instanceMesh.matrixWorld),this._instanceMesh.setMatrixAt(this.instanceIndex,this.rootInverse.multiply(this.matrixWorld)),this._instanceMesh.instanceMatrix.needsUpdate=!0)},createMesh:function(){if(null==this._mesh.parent){var e=new Gf;e.copy(this._material),this._material=e,this.material0=this._material,this._mesh.material=this._material,this._mesh.material0=this._material,this._instanceMesh.deleteItem([this.instanceIndex]),this.add(this._mesh)}},raycast:function(e,t){null!=this._mesh&&(this._mesh.matrixWorld=this.matrixWorld,this._mesh.raycast(e,Hf),Hf.length>0&&(this.createMesh(),Hf[0].object=this,t.push(Hf[0])),Hf.length=0)}});var jf=function(e){Wl.call(this,e)};jf.prototype=Object.assign(Object.create(Wl.prototype),{constructor:jf,load:function(e,t,n,i){var r=this,a=new ht,o=new Kl(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,(function(e){a.image=r.parse(e),a.needsUpdate=!0,void 0!==t&&t(a)}),n,i),a},parse:function(e){var t=0,n=1,i=2,r=3,a=9,o=10,s=11,l=48,A=4,c=0,h=1,u=2,d=3;e.length<19&&console.error("TGALoader: Not enough data to contain header.");var f=new Uint8Array(e),p=0,m={id_length:f[p++],colormap_type:f[p++],image_type:f[p++],colormap_index:f[p++]|f[p++]<<8,colormap_length:f[p++]|f[p++]<<8,colormap_size:f[p++],origin:[f[p++]|f[p++]<<8,f[p++]|f[p++]<<8],width:f[p++]|f[p++]<<8,height:f[p++]|f[p++]<<8,pixel_size:f[p++],flags:f[p++]};!function(e){switch(e.image_type){case n:case a:(e.colormap_length>256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("TGALoader: Invalid type colormap data for indexed type.");break;case i:case r:case o:case s:e.colormap_type&&console.error("TGALoader: Invalid type colormap data for colormap type.");break;case t:console.error("TGALoader: No data.");default:console.error('TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('TGALoader: Invalid pixel size "%s".',e.pixel_size)}(m),m.id_length+p>e.length&&console.error("TGALoader: No data."),p+=m.id_length;var v=!1,g=!1,y=!1;switch(m.image_type){case a:v=!0,g=!0;break;case n:g=!0;break;case o:v=!0;break;case i:break;case s:v=!0,y=!0;break;case r:y=!0}var w=document.createElement("canvas");w.width=m.width,w.height=m.height;var x=w.getContext("2d"),b=x.createImageData(m.width,m.height),M=function(e,t,n,i,r){var a,o,s,l;if(o=n.pixel_size>>3,s=n.width*n.height*o,t&&(l=r.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),e){var A,c,h;a=new Uint8Array(s);for(var u=0,d=new Uint8Array(o);u>A){default:case u:a=0,s=1,p=t,o=0,f=1,v=n;break;case c:a=0,s=1,p=t,o=n-1,f=-1,v=-1;break;case d:a=t-1,s=-1,p=-1,o=0,f=1,v=n;break;case h:a=t-1,s=-1,p=-1,o=n-1,f=-1,v=-1}if(y)switch(m.pixel_size){case 8:!function(e,t,n,i,r,a,o,s){var l,A,c,h=0,u=m.width;for(c=t;c!==i;c+=n)for(A=r;A!==o;A+=a,h++)l=s[h],e[4*(A+u*c)+0]=l,e[4*(A+u*c)+1]=l,e[4*(A+u*c)+2]=l,e[4*(A+u*c)+3]=255}(e,o,f,v,a,s,p,i);break;case 16:!function(e,t,n,i,r,a,o,s){var l,A,c=0,h=m.width;for(A=t;A!==i;A+=n)for(l=r;l!==o;l+=a,c+=2)e[4*(l+h*A)+0]=s[c+0],e[4*(l+h*A)+1]=s[c+0],e[4*(l+h*A)+2]=s[c+0],e[4*(l+h*A)+3]=s[c+1]}(e,o,f,v,a,s,p,i);break;default:console.error("TGALoader: Format not supported.")}else switch(m.pixel_size){case 8:!function(e,t,n,i,r,a,o,s,l){var A,c,h,u=l,d=0,f=m.width;for(h=t;h!==i;h+=n)for(c=r;c!==o;c+=a,d++)A=s[d],e[4*(c+f*h)+3]=255,e[4*(c+f*h)+2]=u[3*A+0],e[4*(c+f*h)+1]=u[3*A+1],e[4*(c+f*h)+0]=u[3*A+2]}(e,o,f,v,a,s,p,i,r);break;case 16:!function(e,t,n,i,r,a,o,s){var l,A,c,h=0,u=m.width;for(c=t;c!==i;c+=n)for(A=r;A!==o;A+=a,h+=2)l=s[h+0]+(s[h+1]<<8),e[4*(A+u*c)+0]=(31744&l)>>7,e[4*(A+u*c)+1]=(992&l)>>2,e[4*(A+u*c)+2]=(31&l)>>3,e[4*(A+u*c)+3]=32768&l?0:255}(e,o,f,v,a,s,p,i);break;case 24:!function(e,t,n,i,r,a,o,s){var l,A,c=0,h=m.width;for(A=t;A!==i;A+=n)for(l=r;l!==o;l+=a,c+=3)e[4*(l+h*A)+3]=255,e[4*(l+h*A)+2]=s[c+0],e[4*(l+h*A)+1]=s[c+1],e[4*(l+h*A)+0]=s[c+2]}(e,o,f,v,a,s,p,i);break;case 32:!function(e,t,n,i,r,a,o,s){var l,A,c=0,h=m.width;for(A=t;A!==i;A+=n)for(l=r;l!==o;l+=a,c+=4)e[4*(l+h*A)+2]=s[c+0],e[4*(l+h*A)+1]=s[c+1],e[4*(l+h*A)+0]=s[c+2],e[4*(l+h*A)+3]=s[c+3]}(e,o,f,v,a,s,p,i);break;default:console.error("TGALoader: Format not supported.")}}(b.data,m.width,m.height,M.pixel_data,M.palettes),x.putImageData(b,0,0),w}});var Wf=new WeakMap,Xf=function(e){h(i,e);var t=y(i);function i(e){var n;return s(this,i),(n=t.call(this,e)).transcoderPath="",n.transcoderBinary=null,n.transcoderPending=null,n.workerLimit=4,n.workerPool=[],n.workerNextTaskID=1,n.workerSourceURL="",n.workerConfig=null,n}return A(i,[{key:"setTranscoderPath",value:function(e){return this.transcoderPath=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"detectSupport",value:function(e){return this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}},{key:"load",value:function(e,t,n,i){var r=this,a=new Kl(this.manager);a.setResponseType("arraybuffer"),a.setWithCredentials(this.withCredentials);var o=new es;return a.load(e,(function(e){r.loadFromBuffer(e,t,i,o)}),n,i),o}},{key:"loadFromBuffer",value:function(e,t,n,i){return void 0===i&&(i=new es),Wf.has(e)?Wf.get(e).promise.then(t).catch(n):(this._createTexture([e]).then((function(e){i.copy(e),i.needsUpdate=!0,t&&t(i)})).catch(n),i)}},{key:"parseInternalAsync",value:function(e){for(var t=e.levels,i=new Set,r=0;r1&&void 0!==arguments[1]?arguments[1]:{},a=r,o=0,s=0;st._taskLoad?-1:1}));return(n=t.workerPool[t.workerPool.length-1])._taskLoad+=e,n}))}},{key:"dispose",value:function(){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:function(){},i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,s=function(t){console.error("贴图加载失败:"+e,t),r&&r(t)};if(e.constructor===String){if(6===e.split(",").length){e=e.split(",");for(var l=0;l-1||navigator.userAgent.indexOf("Firefox")>-1||navigator.userAgent.indexOf("Safari")>-1&&-1==navigator.userAgent.indexOf("Chrome"))&&(c=$),e=this._rebuildUrl(e),(new Nh).setDataType(o||c).load(e,(function(t){t.image.src=e,n(t)}),i,s);case"TGA":return e=this._rebuildUrl(e),(new jf).load(e,(function(t){t.image.src=e,n(t)}),i,s);case"BASIS":case"MRTB":return e=this._rebuildUrl(e),this.basisLoader||(this.basisLoader=new Xf,this.basisLoader.setWorkerLimit(8),this.basisLoader.setTranscoderPath(If.getDecoderPath()),this.basisLoader.detectSupport(this.renderer),Yf.push(this.basisLoader)),this.count++,this.basisLoader.load(e,(function(i){i.wrapS=V,i.wrapT=V,n(i),i.image.src=e,i.flipY=!0,t.loaded++,t.loaded>=t.count&&t.basisLoader.dispose()}),(function(e){}),(function(e){console.error(e)}));default:var h=e;return h=this.RESIZE?this._resize(h,a):this._rebuildUrl(h),(new tA).load(h,(function(e){et.isPowerOfTwo(e.image.width)&&et.isPowerOfTwo(e.image.height),e.wrapS=V,e.wrapT=V,n(e)}),i,s)}}else if(Array.isArray(e)&&6===e.length){for(var u=0;u-1?e+="&"+n:e+="?"+n,e}if(If.isMobile){var i="x-image-process=image/resize,w_"+(t=2048)+",h_"+t+"/quality,q_100/marker,u_plus";e.indexOf("?")>-1?e+="&"+i:e+="?"+i}return e}},{key:"_rename",value:function(e){return e=e.split("?")[0],encodeURIComponent(e.slice(e.lastIndexOf("/")+1))}},{key:"_rebuildUrl",value:function(e){return this.RENAME&&(e=this._rename(e)),e.startsWith("http")||e.startsWith("data:")?e:this.BASE_URL+e}}]),e}(),Zf=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;s(this,e),this.viewer=n,this.cacheMats=[],this.queryMats={},this.cacheMeshes=[],this.cacheMesheIds=[],this.cacheAnimations=[],this.cacheActions=[],this.cacheSkinnedMeshs=[],this.cacheSkinnedMeshIds=[],this.cacheEnvMap={},this.cacheAoMap={},this.hasSkinnedAnimation=!1,this.model=t.isBIM?new Df(this.viewer):new kf(this.viewer),this.model.objects=this.cacheMeshes,this.model.materials=this.cacheMats,this.instances=null,this.ref=[],this.sref=[],this.boneListByMeshMap=new Map,this.boneListMap=new Map,this.meshLoader=new Qf,this.extraMaterial={},this.cacheExtraMat=[],this.instanceMap=new Map,this.loadCount=0,this.currentLoadCount=0,this.meshLoader.setDecoderPath(If.getDecoderPath()),this.meshLoader.setWorkerLimit(8),this.isOpenInstance=t.instance||!1,this.isOpenInstance&&console.log("开启实例化"),this.meshGroupDic=new Map,this.materialConfig=null,this.animNameMap=new Map,this.mapLoader=new Kf(this.viewer),this.additionPackData={}}return A(e,[{key:"setLoadCount",value:function(e){this.loadCount=e}},{key:"load",value:function(e,t,n,i){var r=this;this.meshLoader.load(e,(function(e){if(e){var t;e.attributes.normal||e.computeVertexNormals(),e.attributes.uv&&pd(e);var n=r.instanceMap.get(e.custom_data.id);if(n){if(!0!==r.isOpenInstance){for(var i=0;i=5?(t.initMatrix=s,t.visible=!1):t.offsetMatrix&&t.version>=3?(t.hasPose=!0,t.initMatrix=s,t.visible=!1):t.applyMatrix(s)}t.sid=e.custom_data.id,t.parentId=n?-1:e.custom_data.parentId,t.materialIndex=e.custom_data.materialIndex,t.nodeType=e.custom_data.nodeType,t.name=e.name,delete e.custom_data,r._assembly(t)}}),(function(){if(r.currentLoadCount++,r.loadCount===r.currentLoadCount&&!0===r.isOpenInstance){var e=new bt;e.getInverse(r.model.matrixWorld);var n,i=S(r.instanceMap);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(r.ref[a[0]]){var o=r.ref[a[0]],s=a[1];if(s){for(var l=0;l0&&i.groups.length>0){var v=n.groups[n.groups.length-1];if(e.materialIndex[v.materialIndex]==t.materialIndex[0])v.count+=i.groups[0].count;else{e.material.push(t.material[0]),e.materialIndex.push(t.materialIndex[0]);var g=v.start+v.count;n.addGroup(g,i.groups[0].count,e.materialIndex.length-1)}}}},{key:"mergeBufferGeometry",value:function(e,t,n){for(var i=e.getAttribute(n).array,r=t.getAttribute(n).array,a=i.length,o=r.length,s=new Float32Array(a+o),l=0;l0){var a=0,o=0,s=e.a.length,l=new Map;e.a.forEach((function(A){var c=A;if(void 0!==c.re){var h=c.a,u=c.re;(c=l.get(u))?(c=JSON.parse(JSON.stringify(c))).re=u:c={},c.a=h}else l.set(c.a,c);r.parseMaterial({config:c,maps:e.b,onLoad:function(){++a===s&&(r._initMaterial(),t&&t instanceof Function&&t())},onTextureLoad:function(){++o===s&&n&&n instanceof Function&&n()},onError:i,edited:!1})})),l.clear()}else t&&t instanceof Function&&t()}},{key:"parseMaterial",value:function(e){var t=e.config,n=e.maps,i=e.onLoad,r=e.onTextureLoad;e.onError,e.edited;var a=t.a,o=this.queryMats[a];if(void 0===o&&a&&a.toString().indexOf("_")>-1){var s=a.split("_")[0],l=this.queryMats[s],A=this.cacheMats[l],c=this.cacheMeshes.find((function(e){return e.name===t.mn})),h=A.clone();h.name=t.ee||a,h.sname=A.sname,h.ID=a,this.cacheMats.push(h),o=this.cacheMats.length-1,this.queryMats[a]=o,c.material[c.material.indexOf(A)]=h}var u=this.cacheMats[o];u||(u=this._createBaseMaterial(a),this.cacheMats.push(u),this.queryMats[a]=this.cacheMats.length-1),Nf.parseAmrtMaterial(t,n,u,i,r,this.mapLoader)}},{key:"addToCache",value:function(e){this.cacheMeshes.push(e),this.cacheMesheIds.push(e.ID)}},{key:"loadAnimationComplete",value:function(e){for(var t=[],n=0;n0&&(r=r.concat(n.parseSkinAnimation(i)));var o=new Gl(i.name,i.Duration,r);n.model.animation.addClip(o),n.animNameMap.set(e,i.name)}}catch(e){console.error("动画文件解析出错!",e)}t&&t()}),(function(){i.dispose()}))}},{key:"parseSkinAnimation",value:function(e){if(e.boneId2Anim){var t=new bt,n=new at,i=new nt,r=new at;e.Duration;for(var a=[],o=0;oi&&(i=a.d);for(var h=0;h=0&&this.cacheMats.splice(o,1)}}}},{key:"replaceMaterials",value:function(e){var t=e.url,n=e.onload,i=e.onTextureLoad;this.extraMaterial={},this.loadMaterials({url:t,onload:n,onTextureLoad:i})}},{key:"_createDracoLoader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4,t=new Qf;return t.setDecoderPath(If.getDecoderPath()),t.setWorkerLimit(e),t}}]),e}(),Jf=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this)).logId="",i.viewer=e,i.mapLoader=new Kf(e),i}return A(n,[{key:"load",value:function(e,t,n,i){var r=this,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return this.paths=e,void 0!==e.localPath&&this.mapLoader.setBaseUrl(e.localPath),this._onLoad=t,this._onProgress=n,this._onError=i,this.logId=!!a.log&&a.log.toString(),e.m[0].indexOf(".mbin")>-1||e.m[0].indexOf(".mrmb")>-1?this.loader=new Zf(a,this.viewer):this.loader=new zf(a,this.viewer),this.loader.mapLoader=this.mapLoader,this.paths.nodes?this.loader.loadNodes(this.paths.nodes,(function(){r._loadMultiMesh()})):this._loadAdditionPack((function(){if(r.paths.instance&&r.paths.instance.length>0)for(var e=0;e0)for(var t=0;t0?this.paths.addition.forEach((function(n){n&&t.loader.loadAdditionPack(n,e)})):e()}},{key:"_loadComplete",value:function(e){var t=this;e.objects=[],e.traverse((function(t){t.isMesh&&e.objects.push(t)})),e.recalculationBound(),e.update(),this.loader.bindSkeleton(),this.loader.loadMeshComplete();var n=!1;this.paths.skin&&this.paths.skin.length>0?(n=!0,this._loadSkin(this.paths.skin,(function(){t.loader.initSkeletonTransform(),t._loadAnimations(),t._loadMaterials(t.paths.mat),t._onProgress&&t._onProgress(100),t.dispatchEvent(ld.MESH_LOADED,e),t._onLoad&&t._onLoad(e)}))):this._loadAnimations(),this.paths.a&&this.paths.a.length,n||(this._loadMaterials(this.paths.mat),this._onProgress&&this._onProgress(100),this.dispatchEvent(ld.MESH_LOADED,e),this._onLoad&&this._onLoad(e)),this.loader.meshLoader&&this.loader.meshLoader.dispose()}},{key:"_loadSkin",value:function(e,t){for(var n=0;n=t&&(e.logId&&console.timeEnd("网格加载用时(".concat(e.logId,")")),e.paths.i&&e.paths.ii?e.loadInstanceMesh((function(){e._loadComplete(e.loader.model)})):e._loadComplete(e.loader.model))},l=function(t){e._onError&&e._onError(t),e.dispatchEvent(ld.MESH_LOAD_ERROR)},A=function(n){e.loader.setLoadCount&&e.loader.setLoadCount(t);for(var A=function(t){var n=e.paths.m[o];e.loader.load(n,s,(function(n){!function(t,n){var o=e.paths.ms&&e.paths.ms[n];if(e._onProgress){if(r[n]=o||t.total,!r[n])return;i[n]=t.loaded,a[n]=i[n]/r[n];var s=a.reduce((function(e,t){return e+t}),0)/a.length;e._onProgress(parseInt(100*s))}}(n,t)}),l),o++},c=0;c0?A(Math.min(t,20)):s()}},{key:"_preloadMaterial",value:function(){var e=this;void 0!==this.paths.localPath&&(this.mapLoader.RESIZE=!1),this.paths.mat.forEach((function(t){(new Kl).load(t,(function(t){for(var n in(t=JSON.parse(t)).b)e.mapLoader.load(t.b[n])}))}))}},{key:"loadInstanceMesh",value:function(e){var t=this;(new Kl).load(this.paths.i,(function(n){var i=JSON.parse(n);t.loader.instances=i;var r=t.paths.ii.length,a=0;t.paths.ii.forEach((function(n){t.loader.load(n,(function(n){(n=n[0]).parent&&n.parent.remove(n);var o=[];i.forEach((function(e,t){e.c==n.iid&&o.push(e)}));var s=new El;s.name=name,s.color=new Fn("#cccccc");var l=[s],A=new Lf(n.geometry,l,o.length);t.loader.model.add(A);var c=new bt;c.getInverse(t.loader.model.matrixWorld),o.forEach((function(e,n){var i=new Vf;i.name=e.b,i.instanceMesh=A,i.instanceIndex=n,i.applyMatrix((new bt).fromArray(e.d));var r=t.loader.model.getObjectByProperty("ID",e.e)||t.loader.model;r&&(r.add(i),t.loader.addToCache(i)),i.updateMatrixWorld(!0);var a=new bt;A.setMatrixAt(n,a.multiplyMatrices(c,i.matrixWorld)),A.objects.push(i)})),A.instanceMatrix.needsUpdate=!0,++a>=r&&e()}))}))}),void 0,(function(){console.error("实例化数据文件加载失败"),e()}))}},{key:"preloadMap",value:function(e,t,n){this.loader.preloadMap(e,t,void 0,n)}},{key:"dispatchEvent",value:function(e,t){b(u(n.prototype),"dispatchEvent",this).call(this,{type:e,data:t})}},{key:"addEventListener",value:function(e,t){return b(u(n.prototype),"addEventListener",this).call(this,e,t),this}}]),n}(Je),qf=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this,e)).isBIMLoader=!0,i}return A(n,[{key:"load",value:function(e,t,i,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return a.isBIM=!0,b(u(n.prototype),"load",this).call(this,e,t,i,r,a),this.loadConfig(this.paths.bim),this.paths.bimNode&&this.loadNodeTree(this.paths.bimNode),this.loader.model}},{key:"loadNodeTree",value:function(e){var t=this;(new Kl).setResponseType("json").load(e,(function(e){console.time("nodeTree");var n={};e.forEach((function(e){if(e.b.indexOf("##")>-1){var t=e.b.split("##");e.b=t[0],e.CID=parseInt(t[1])}n[e.a]=e}));for(var i={},r={children:{}},a=0;a1&&void 0!==arguments[1]?arguments[1]:{};this.modelGroup.add(e),this.dispatchEvent({type:ld.MODEL_UPDATE}),(1===this.modelGroup.children.length||t.fitCamera||void 0===t.fitCamera)&&(e.boundingBox?this.viewer.sceneManager.fitCamera(e):(t.box&&!t.box.isBox3&&(t.box=(new tn).setFromArray(t.box.min.concat(t.box.max))),this.viewer.sceneManager.fitCamera(e,t.box))),this.viewer.renderManager.render()}},{key:"fitCamera",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.dispatchEvent({type:ld.MODEL_UPDATE}),(1===this.modelGroup.children.length||t.fitCamera||void 0===t.fitCamera)&&(e.boundingBox||t.box&&!t.box.isBox3&&(t.box=(new tn).setFromArray(t.box.min.concat(t.box.max)))),this.viewer.renderManager.render()}},{key:"removeModel",value:function(e){e.parent&&e.parent.remove(e),this.dispatchEvent({type:ld.MODEL_UPDATE}),this.viewer.renderManager.render()}},{key:"removeCache",value:function(e){this.cacheModels.delete(e)}},{key:"modelClone",value:function(e,t){var n=t.model,i=t.options;n.copy(e),n.visible=0!=e.initVisible,i.onLoad&&i.onLoad(n),i.onProgress&&i.onProgress(),i.onError&&i.onError(),i.onMatLoad&&i.onMatLoad(),i.onAnimeLoad&&i.onAnimeLoad(n),i.onSceneLoad&&i.onSceneLoad(),i.onTextureLoad&&i.onTextureLoad(n),i.onPostProcessingLoad&&i.onPostProcessingLoad(),i.onComplete&&i.onComplete(n)}},{key:"actionClone",value:function(e){var t=e.get("model"),n=e.get("optionsList");e.set("optionsList",[]);for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{},i={},r=new Map;if(this.cacheModels.get(e)){r=this.cacheModels.get(e);var a=new kf(this.viewer);if(r.get("model")){var o=r.get("model"),s={options:n,model:a};this.modelClone(o,s)}else{var l=r.get("optionsList"),A={options:n,model:a};l.push(A)}return a}r.set("path",e),r.set("optionsList",[]),this.cacheModels.set(e,r);var c=e;if(n.background=n.background||void 0===n.background,n.env=n.env||void 0===n.env,n.focus=n.focus||void 0===n.focus,n.addModel=n.addModel||void 0===n.addModel,n.postprocessing=n.postprocessing||void 0===n.postprocessing,e&&n.offline){if(!(c=lu.getFileList(e)))return(c=lu.hasMRCBFile(e))?(i.onload=0,this.viewer.largeSceneLoader2.load(e,(function(e){e.coordinate=c.coordinate,n.onLoad&&n.onLoad(e),i.onload=1,t.actionComplete(e,n.onComplete,i)}),n)):(this.actionComplete(null,n.onComplete,i),null);c.localPath=e+"Texture/"}else{if(/^\d{19}/.test(e)){n.id=n.id||e;try{c=n.local?lu.getLocalModelById(e):lu.getModelById(e),n.local&&lu.setOnlinePath(c)}catch(e){return n.onError&&n.onError(e),void this.actionComplete(e,n.onComplete,i)}}n.baseURL&&(c=lu.setLocalPath(c,n.baseURL))}if(cu.options&&cu.options.offline){var h=!1,u=function(e){var t=c[e];if(Array.isArray(t)){if(t.find((function(e){return t&&t.includes&&e.includes("https://laozi-auto-east.obs.cn-east-2.myhuaweicloud.com")})))throw h=!0,new Error("离线模式下不允许加载线上资源")}else if(t&&t.includes&&t.includes("https://laozi-auto-east.obs.cn-east-2.myhuaweicloud.com"))throw h=!0,new Error("离线模式下不允许加载线上资源")};for(var d in c)u(d);if(h)return}if(c.levelUrl)return this.cacheModels.delete(e),c.levelUrl.endsWith("AMRT-L")?(i.onload=0,this.viewer.largeSceneLoader2.load(c.levelUrl,(function(e){e.coordinate=c.coordinate,n.onLoad&&n.onLoad(e),i.onload=1,t.actionComplete(e,n.onComplete,i)}),{focus:n.focus,doubeside:n.doubeside,transparent:n.transparent,alhpaTest:n.alhpaTest,isOnline:!0})):(i.onload=0,this.viewer.largeSceneLoader.load(c.levelUrl,(function(e){e.coordinate=c.coordinate,n.onLoad&&n.onLoad(e),i.onload=1,t.actionComplete(e,n.onComplete,i)})));i.onload=0,i.onPostProcessingLoad=0;var f=c.bim?new qf(this.viewer):new Jf(this.viewer),p=f.load(c,(function(e){if(c.fitCamera=n.focus,n.addModel&&(t.modelGroup.add(e),e.initVisible=e.visible,e.visible=!1),n.offline||c.sceneData&&c.sceneData.endsWith(".json"))c.sceneData?t.loadSceneData(p,c.sceneData,c):t.setCameraView(e,null,c);else if(c.sceneData){var r=JSON.parse(c.sceneData);if(r.rotation&&(e.rotation.fromArray(r.rotation),e.updateMatrix(),e.boundingBox.setFromObject(e)),!r.shadow)return;t.viewer.sceneManager.enableShadow=r.shadow.visible,t.viewer.sceneManager.shadowDecay=r.shadow.decay||1,t.viewer.sceneManager.shadowStrength=r.shadow.strength/10,t.viewer.sceneManager.shadowOffset=(r.shadow.offset||0)*e.boundingBox.getSize(new at).y*2,t.setCameraView(e,r,c)}else t.setCameraView(e,null,c);n.onLoad&&n.onLoad(e),e.onComplete&&e.onComplete(),i.onload=1,t.actionComplete(e,n.onComplete,i)}),(function(e){n.onProgress&&n.onProgress(e)}),(function(e){n.onError&&n.onError(e),t.actionComplete(e,n.onComplete,i)}),n);p.viewer=this.viewer,p.modelPath=c.m[0],i.onSceneLoad=0;var v=n.localPath||c.localPath||"";return f.addEventListener(ld.MATERIAL_LOADED,(function(){c.scene?t.viewer.sceneManager.loadSceneFile(c.scene,{localPath:v,onLoad:function(e){n.env&&e.e?(t.mapLoader.loadEnvMap(v+e.e,(function(r){p.materials.map((function(t){t.envMap=r,t.envMapIntensity=null==e.ei||null==e.ei?.7:e.ei,t.envRotateY=Math.PI/180*(e.ea||0),t.needsUpdate=!0})),n.onSceneLoad&&n.onSceneLoad(e),i.onSceneLoad=1,t.actionComplete(p,n.onComplete,i),setTimeout((function(){n.postprocessing&&t.viewer.sceneManager.loadPostProcessing(p),n.onPostProcessingLoad&&n.onPostProcessingLoad(),i.onPostProcessingLoad=1,t.actionComplete(p,n.onComplete,i)}),1e3)})),t.viewer.sceneManager.setEnvMapIntensity(e.ei),t.viewer.sceneManager.setEnvMapRotation(e.ea||0),t.viewer.sceneManager.envMapUrl=e.e):(n.onSceneLoad&&n.onSceneLoad(e),i.onSceneLoad=1,t.actionComplete(p,n.onComplete,i),setTimeout((function(){n.postprocessing&&t.viewer.sceneManager.loadPostProcessing(p),n.onPostProcessingLoad&&n.onPostProcessingLoad(),i.onPostProcessingLoad=1,t.actionComplete(p,n.onComplete,i)}),1e3))},background:n.background},p):c.sky?(c.sky.b&&n.background&&t.viewer.sceneManager.setSkyBox(c.sky.b),c.sky.a&&n.env?(t.mapLoader.loadEnvMap(c.sky.a,(function(e){p.setEnvMap(e),n.onSceneLoad&&n.onSceneLoad({a:{aa:"#FFFFFF",ab:.7},b:{ba:"#FFFFFF",bb:.7,bc:[0,.7,.7]},c:1,ca:c.sky.b,cb:.5,e:c.sky.a,ea:0,ei:.7}),i.onSceneLoad=1,t.actionComplete(p,n.onComplete,i)})),t.viewer.sceneManager.envMapUrl=c.sky.a):(i.onSceneLoad=1,t.actionComplete(p,n.onComplete,i)),n.onPostProcessingLoad&&n.onPostProcessingLoad(null),i.onPostProcessingLoad=1,t.actionComplete(p,n.onComplete,i)):(n.onSceneLoad&&n.onSceneLoad({a:{aa:"#FFFFFF",ab:.7},b:{ba:"#FFFFFF",bb:.7,bc:[0,.7,.7]},c:2,ca:"#000000"}),n.onPostProcessingLoad&&n.onPostProcessingLoad(null),i.onSceneLoad=1,t.actionComplete(p,n.onComplete,i),i.onPostProcessingLoad=1,t.actionComplete(p,n.onComplete,i)),!n.env&&t.viewer.sceneManager.envMapUrl&&n.onLoad&&n.onLoad(m).setEnvMap(t.viewer.sceneManager.envMapUrl),n.onMatLoad&&n.onMatLoad()})),c.a&&c.a.length>0&&(i.onAnimeLoad=0),f.addEventListener(ld.ANIMATION_LOADED,(function(){n.onAnimeLoad&&n.onAnimeLoad(p),i.onAnimeLoad=1,t.actionComplete(p,n.onComplete,i)})),i.onTextureLoad=0,f.addEventListener(ld.TEXTURE_LOADED,(function(){r.set("model",p),p.cacheKey=r.get("path"),t.actionClone(r),n.onTextureLoad&&n.onTextureLoad(p),i.onTextureLoad=1,t.actionComplete(p,n.onComplete,i)})),p.options=n,p.loader=f,p}},{key:"loadModel_miniprogram",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={},r=e,a=this;if(n.background=n.background||void 0===n.background,n.env=n.env||void 0===n.env,n.focus=n.focus||void 0===n.focus,n.addModel=n.addModel||void 0===n.addModel,n.postprocessing=n.postprocessing||void 0===n.postprocessing,e.constructor!==String&&isNaN(e))n.baseURL&&(r=lu.setLocalPath(e,n.baseURL)),s();else{n.id=n.id||e;var o=n.local?lu.getLocalModelById:lu.getModelById;o(e).then((function(t){if(r=t,"无权访问该模型"!=t){if("token不存在或已失效"===t)return cu.token=cu.checkDevloper(),void(cu.token&&lu.getModelById(e).then((function(e){r=e,n.local&&lu.setOnlinePath(r),s()})));n.local&&lu.setOnlinePath(r),s()}})).catch((function(e){n.onError&&n.onError(e),t.actionComplete(e,n.onComplete,i)}))}function s(){var e=r.bim?new qf(a.viewer):new Jf(a.viewer);i.onLoad=0,i.onPostProcessingLoad=0;var t=e.load(r,(function(e){r.fitCamera=void 0===n.focus||n.focus,!1!==n.addModel&&(a.modelGroup.add(e),e.visible=!1),n.onLoad&&n.onLoad(e),i.onLoad=1,a.actionComplete(e,n.onComplete,i)}),(function(e){n.onProgress&&n.onProgress(e)}),(function(e){n.onError&&n.onError(e),a.actionComplete(e,n.onComplete,i)}),n);return t.viewer=a.viewer,i.onMatLoad=0,e.addEventListener(ld.MATERIAL_LOADED,(function(){n.onMatLoad&&n.onMatLoad(),i.onMatLoad=1,a.actionComplete(t,n.onComplete,i),r.scene?(i.onSceneLoad=0,a.viewer.sceneManager.loadSceneFile(r.scene,{onLoad:function(e){n.env&&e.e?(a.mapLoader.loadEnvMap(e.e,(function(n){t.materials.map((function(t){t.envMap=n,null==e.ei||null==e.ei?t.envMapIntensity=.7:t.envMapIntensity=Number(e.ei),e.ea&&0!==e.ea?t.envRotateY=Math.PI/180*Number(e.ea):t.envRotateY=0,t.needsUpdate=!0}))})),n.onSceneLoad&&n.onSceneLoad(e),i.onSceneLoad=1,a.actionComplete(t,n.onComplete,i),setTimeout((function(){n.postprocessing&&a.viewer.sceneManager.loadPostProcessing(t),n.onPostProcessingLoad&&n.onPostProcessingLoad(),i.onPostProcessingLoad=1,a.actionComplete(t,n.onComplete,i)}),1e3)):setTimeout((function(){n.postprocessing&&a.viewer.sceneManager.loadPostProcessing(t),n.onPostProcessingLoad&&n.onPostProcessingLoad(),i.onPostProcessingLoad=1,a.actionComplete(t,n.onComplete,i)}),1e3)},background:n.background})):r.sky?(r.sky.b&&n.background&&a.viewer.sceneManager.setSkyBox(r.sky.b),r.sky.a&&n.env?(a.mapLoader.loadEnvMap(r.sky.a,(function(e){t.setEnvMap(e)})),n.onSceneLoad&&n.onSceneLoad(config),setTimeout((function(){n.postprocessing&&a.viewer.sceneManager.loadPostProcessing(t),n.onPostProcessingLoad&&n.onPostProcessingLoad(),i.onPostProcessingLoad=1,a.actionComplete(t,n.onComplete,i)}),1e3)):setTimeout((function(){n.postprocessing&&a.viewer.sceneManager.loadPostProcessing(t),n.onPostProcessingLoad&&n.onPostProcessingLoad(),i.onPostProcessingLoad=1,a.actionComplete(t,n.onComplete,i)}),1e3)):setTimeout((function(){n.postprocessing&&a.viewer.sceneManager.loadPostProcessing(t),n.onPostProcessingLoad&&n.onPostProcessingLoad(),i.onPostProcessingLoad=1,a.actionComplete(t,n.onComplete,i)}),1e3),!n.env&&a.viewer.sceneManager.envMapUrl&&m.setEnvMap(a.viewer.sceneManager.envMapUrl)})),r.a&&r.a.length>0&&(i.onAnimeLoad=0),e.addEventListener(ld.ANIMATION_LOADED,(function(){n.onAnimeLoad&&n.onAnimeLoad(t),i.onAnimeLoad=1,a.actionComplete(error,n.onComplete,i)})),t.loader=e,t}}},{key:"loadSingleMaterial",value:function(e,t){var n=new Zf(this,this.viewer);if(t.mapRoot){var i=e.b;for(var r in i)i[r].startsWith("http")&&(i[r]=i[r].slice(i[r].lastIndexOf("/")+1)),i[r]=t.mapRoot+i[r]}n.parseMaterials(e,(function(){t.onLoad&&t.onLoad(n.cacheMats)}))}},{key:"loadSceneData",value:function(e,t,n){var i=this;(new ou).load(t,(function(t){try{var r=JSON.parse(t);if(r.rotation&&(e.rotation.fromArray(r.rotation),e.updateMatrix(),e.boundingBox.setFromObject(e)),!r.shadow)return;i.viewer.sceneManager.enableShadow=r.shadow.visible,i.viewer.sceneManager.shadowDecay=r.shadow.decay||1,i.viewer.sceneManager.shadowStrength=r.shadow.strength/10,i.viewer.sceneManager.shadowOffset=(r.shadow.offset||0)*Math.ceil(e.boundingBox.getSize(new at).y)*2,i.setCameraView(e,r,n)}catch(e){console.warn("加载配置数据出错")}}))}},{key:"setCameraView",value:function(e,t,n){if(this.dispatchEvent({type:ld.MODEL_UPDATE}),n.fitCamera||void 0===n.fitCamera)if(t&&t.view){var i=t.view.target,r=t.view.position,a=e.boundingBox.getSize(new at),o=1.5*a.length(),s=e.boundingBox.getCenter(new at),l=s.x-i[0],A=s.y-i[1],c=s.z-i[2],h=[r[0]+l,r[1]+A,r[2]+c],u=[s.x,s.y,s.z],d=new at(h[0]-u[0],h[1]-u[1],h[2]-u[2]).normalize(),f=s.clone().addScaledVector(d,o),p=[f.x,f.y,f.z];this.viewer.controls.setView({position:p,target:u});var m=Math.max(a.x,a.y,a.z),v=Math.min(a.x,a.y,a.z);this.viewer.camera.near=.05*v,20*m>this.viewer.camera.far&&(this.viewer.camera.far=20*m),this.viewer.camera.far<5e3&&(this.viewer.camera.far=5e3),this.viewer.camera.updateProjectionMatrix()}else e.boundingBox?this.viewer.sceneManager.fitCamera(e):(n.box&&!n.box.isBox3&&(n.box=(new tn).setFromArray(n.box.min.concat(n.box.max))),this.viewer.sceneManager.fitCamera(e,n.box));this.viewer.renderManager.render(!0)}}]),n}(Je);function tp(e){var t=new Qt;t.viewer=e;var n=new ki;n.deleteAttribute("uv");var i=new gl({side:1}),r=new gl,a=new LA(16777215,5,28,2);a.position.set(.418,16.199,.3),t.add(a);var o=new Ei(n,i);o.position.set(-.757,13.219,.717),o.scale.set(31.713,28.305,28.591),t.add(o);var s=new Ei(n,r);s.position.set(-10.906,2.009,1.846),s.rotation.set(0,-.195,0),s.scale.set(2.328,7.905,4.651),t.add(s);var l=new Ei(n,r);l.position.set(-5.607,-.754,-.758),l.rotation.set(0,.994,0),l.scale.set(1.97,1.534,3.955),t.add(l);var A=new Ei(n,r);A.position.set(6.167,.857,7.803),A.rotation.set(0,.561,0),A.scale.set(3.927,6.285,3.687),t.add(A);var c=new Ei(n,r);c.position.set(-2.017,.018,6.124),c.rotation.set(0,.333,0),c.scale.set(2.002,4.566,2.064),t.add(c);var h=new Ei(n,r);h.position.set(2.291,-.756,-2.621),h.rotation.set(0,-.286,0),h.scale.set(1.546,1.552,1.496),t.add(h);var u=new Ei(n,r);u.position.set(-2.193,-.369,-5.547),u.rotation.set(0,.516,0),u.scale.set(3.875,3.487,2.986),t.add(u);var d=new Ei(n,y(50));d.position.set(-16.116,14.37,8.208),d.scale.set(.1,2.428,2.739),t.add(d);var f=new Ei(n,y(50));f.position.set(-16.109,18.021,-8.207),f.scale.set(.1,2.425,2.751),t.add(f);var p=new Ei(n,y(17));p.position.set(14.904,12.198,-1.832),p.scale.set(.15,4.265,6.331),t.add(p);var m=new Ei(n,y(43));m.position.set(-.462,8.89,14.52),m.scale.set(4.38,5.441,.088),t.add(m);var v=new Ei(n,y(20));v.position.set(3.235,11.486,-12.541),v.scale.set(2.5,2,.1),t.add(v);var g=new Ei(n,y(100));function y(e){var t=new Nn;return t.color.setScalar(e),t}return g.position.set(0,20,0),g.scale.set(1,.1,1),t.add(g),t}function np(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;zt.call(this),this.name="BoxClippingHelper",this.box=e,this.boxSize=new at,this.line=new Fh(e,t),this.add(this.line);var n=new ki(1,1,1);this.mesh=new Ei(n,new Nn({transparent:!0,opacity:.25,color:t})),this.box.getSize(this.boxSize),this.mesh.scale.set(this.boxSize.x,this.boxSize.y,this.boxSize.z),this.box.getCenter(this.mesh.position),this.add(this.mesh)}np.prototype=Object.create(zt.prototype),np.prototype.update=function(){this.box.getSize(this.boxSize),this.mesh.scale.set(this.boxSize.x,this.boxSize.y,this.boxSize.z),this.box.getCenter(this.mesh.position)};var ip=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return s(this,n),(i=t.call(this))._mode=-1,i._enabled=!1,i._empty=Object.freeze([]),i._clipPlane=new vn(new at(-1,0,0),0),i._boxClipPlane=[],i._root=new zt,i._showHelper=!0,i.target=r||e.modelGroup,i.viewer=e,i.viewer.renderer.localClippingEnabled=!0,i.viewer.add(i._root),i._init(),i.mode=n.Mode.Plane,i}return A(n,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e=Boolean(e),this.mode==n.Mode.Plane&&(this._control.visible=e),this._root.visible=e,this._updateClippingPlanes()}},{key:"mode",get:function(){return this._mode},set:function(e){var t,i;if(e!==this._mode){switch(e){case n.Mode.Plane:this._control.enabled=!0,(t=this._root).remove.apply(t,C(this._root.children)),this._root.add(this._planeHelper),this.viewer.add(this._control),this._clipPlanes=[this._clipPlane],this._updateClippingPlanes();break;case n.Mode.Box:this._control.enabled=!1,this.viewer.remove(this._control),(i=this._root).remove.apply(i,C(this._root.children)),this._root.add(this._boxHelper),this._clipPlanes=this._boxClipPlane,this._updateClippingPlanes()}this._mode=e}}},{key:"showHelper",get:function(){return this._showHelper},set:function(e){(e=Boolean(e))!==this._showHelper&&(this._boxHelper.visible=e,this._planeHelper.visible=e,this._showHelper=e)}},{key:"_init",value:function(){var e=this;this.target.traverse((function(t){t.isMesh&&(Array.isArray(t.material)?t.material:[t.material]).forEach((function(t){t.clippingPlanes=e._empty}))})),this._initPlaneHelper(),this._initBoxHelper()}},{key:"_initBoxHelper",value:function(){var e=this,t=(new tn).setFromObject(this.target),i=new at;t.getSize(i),t.expandByVector(new at(i.x/100,i.y/100,i.z/100));var r=(new tn).copy(t);this._boxClipPlane.push(new vn(new at(1,0,0),-t.min.x)),this._boxClipPlane.push(new vn(new at(-1,0,0),t.max.x)),this._boxClipPlane.push(new vn(new at(0,1,0),-t.min.y)),this._boxClipPlane.push(new vn(new at(0,-1,0),t.max.y)),this._boxClipPlane.push(new vn(new at(0,0,1),-t.min.z)),this._boxClipPlane.push(new vn(new at(0,0,-1),t.max.z)),this._boxHelper=new np(t,this.color);var a,o=new Nc,s=new at,l={},A=new tt,c=new tt,h=new ut,u=!1;this.viewer.domElement.addEventListener("mousedown",(function(i){if(e.mode===n.Mode.Box&&(o.setFromCamera(If.getDomMouse(i,e.viewer.domElement),e.viewer.camera),o.ray.intersectBox(t,s))){switch(a=e._getIntersectFaceInBox(t,s),l.pageX=i.pageX,l.pageY=i.pageY,u=!0,e.viewer.controls.enabled=!1,a){case 0:h.set(1,0,0,0);break;case 1:h.set(-1,0,0,0);break;case 2:h.set(0,1,0,0);break;case 3:h.set(0,-1,0,0);break;case 4:h.set(0,0,1,0);break;case 5:h.set(0,0,-1,0)}h.applyMatrix4(e.viewer.camera.matrixWorldInverse).applyMatrix4(e.viewer.camera.projectionMatrix),A.set(-h.x,h.y)}})),this.viewer.domElement.addEventListener("mousemove",(function(h){if(e.mode===n.Mode.Box){if(c.set(h.pageX-l.pageX,h.pageY-l.pageY).normalize(),u){var d=0;switch(a){case 0:if(d=c.dot(A)*i.x/100,t.min.x-d>=r.max.x||t.min.x-d=r.max.x||t.max.x+d=r.max.y||t.min.y-d=r.max.y||t.max.y+d=r.max.z||t.min.z-d=r.max.z||t.max.z+d2&&void 0!==arguments[2]?arguments[2]:"";e&&(0===e.indexOf("#")?(this.scene.background=(new Fn).setStyle(e),t&&t()):(new tA).setPath(i).load(e,(function(e){e.minFilter=Z,n.scene.background=e,t&&t()})))}},{key:"clearBackground",value:function(){this.scene.background=null,this.viewer.renderManager.render()}},{key:"setLightness",value:function(e){this.ambientLight.intensity=e,this.viewer.renderManager.render()}},{key:"getLightness",value:function(){return this.ambientLight.intensity}},{key:"getLightColor",value:function(){return"#"+this.ambientLight.color.getHexString()}},{key:"setLightColor",value:function(e){this.ambientLight.color.setStyle(e),this.viewer.renderManager.render()}},{key:"setDirectLightLightness",value:function(e){this.directLight.intensity=e,this.viewer.renderManager.render()}},{key:"getDirectLightLightness",value:function(){return this.directLight.intensity}},{key:"getDirectLightColor",value:function(){return"#"+this.directLight.color.getHexString()}},{key:"setDirectLightPosition",value:function(e,t,n){e.isVector3?this.directLight.position.copy(e):(void 0!==e&&(this.directLight.position.x=e),void 0!==t&&(this.directLight.position.y=t),void 0!==n&&(this.directLight.position.z=n)),this.viewer.renderManager.render(),this.enableShadow&&this.updateShadowMaterial()}},{key:"getDirectLightPosition",value:function(){return this.directLight.position}},{key:"setDirectLightColor",value:function(e){this.directLight.color.setStyle(e),this.viewer.renderManager.render()}},{key:"addSpotLight",value:function(e){if(e.position){var t=new _A(e.color||16777215,e.intensity||1,e.distance||100,e.angle||Math.PI/8,e.penumbra||.5,e.decay||.5);return Array.isArray(e.position)?t.position.fromArray(e.position):t.position.copy(e.position),e.target&&(t.target=e.target),this.root.add(t),t}console.warn("addSpotLight需要指定position")}},{key:"saveSceneData",value:function(){var e={};e.a={aa:this.getLightColor(),ab:this.getLightness()},e.b={ba:this.getDirectLightColor(),bb:this.getDirectLightLightness()},this.lightFollow||(e.b.bc=this.directLight.position.toArray()),e.b.bv=this.directLight.visible;var t=this.scene.background||this._prevBackground;return t&&(t.sky?(e.c=1,e.ca=t.sky,e.cb=this.backgroundBrightness):t.isTexture?(e.c=2,e.ca=[t.image.src,t.image.src].join(",")):t.isColor&&(e.c=2,e.ca="#"+t.getHexString())),this.envMapUrl&&(e.e=this.envMapUrl,e.ea=this.envMapRotation||0,e.ei=this.envMapIntensity),e.v=Boolean(this.backgroundVisible),e.u={v:!1,s:0,r:0},this.viewer.composer.enableUnrealBloom&&(e.u.v=!0,e.u.s=this.viewer.composer.unrealBloom.getStrength(),e.u.r=this.viewer.composer.unrealBloom.getRadius(),e.u.t=this.viewer.composer.unrealBloom.getThreshold(),this.viewer.composer.unrealBloom._lastSelected&&this.viewer.composer.unrealBloom._lastSelected.isMesh&&(e.u.o=this.viewer.composer.unrealBloom._objects.map((function(e){return e.ID})))),e.k={v:!1,h:0,s:0,b:0},this.viewer.composer.enableColorAdjustment&&(e.k.v=!0,e.k.h=this.viewer.composer.colorAdjustment.getHue(),e.k.s=this.viewer.composer.colorAdjustment.getContrast(),e.k.b=this.viewer.composer.colorAdjustment.getVibrance()),e.f={v:!1,a:0,b:0},this.viewer.composer.enableDof&&(e.f.v=!0,e.f.a=this.viewer.composer.dof.aperture,e.f.b=this.viewer.composer.dof.maxblur),e.s={v:!1,r:0,s:0},this.viewer.composer.enableSSAO&&(e.s.v=!0,e.s.r=this.viewer.composer.ssao.getRadius(),e.s.s=this.viewer.composer.ssao.getStrength()),e.g={v:!1,d:0,o:0},this.viewer.composer.enableVignette&&(e.g.v=!0,e.g.d=this.viewer.composer.vignette.getDarkness(),e.g.o=this.viewer.composer.vignette.getOffset()),e.q={v:!1,c:[],r:[],d:0,o:1},this.viewer.composer.enableSSR&&(e.q.v=!0,e.q.c=this.viewer.composer.ssr.objects.map((function(e){return e.ID})),e.q.r=this.viewer.composer.ssr.planeObjects.map((function(e){return e.ID})),e.q.d=this.viewer.composer.ssr.maxDistance,e.q.o=this.viewer.composer.ssr.opacity),e}},{key:"loadSceneData",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,r=void 0===n.background||n.background,a=n.localPath||"";e=JSON.parse(e);var o=Boolean(e.v)||void 0===e.v;return this._data=e,r?(this.setLightColor(e.a.aa),this.setLightness(e.a.ab),this.setDirectLightColor(e.b.ba),this.setDirectLightLightness(e.b.bb),Array.isArray(e.b.bc)?this.directLight.position.fromArray(e.b.bc):this.lightFollow=!0,!1===e.b.bv&&(this.directLight.visible=!1),1==e.c&&this.setSkyBox(a+e.ca,(function(){t.backgroundVisible=o,t.backgroundBrightness=e.cb||.5,i&&i(e)})),2==e.c&&(Array.isArray(e.ca)||(e.ca=e.ca.split(",")),1==e.ca.length?(this.setBackground(e.ca[0]),e.ca=e.ca[0],this.backgroundVisible=o,i&&i(e)):2==e.ca.length&&(If.isMobile?this.setBackground(e.ca[1]+"?time="+Date.now(),(function(){t.backgroundVisible=o,i&&i(e)}),a):this.setBackground(e.ca[0]+"?time="+Date.now(),(function(){t.backgroundVisible=o,i&&i(e)}),a)))):i&&i(e),e}},{key:"loadSceneFile",value:function(e,t){var n=this;(new Kl).load(e,(function(e){n.loadSceneData(e,t,(function(e){n._sceneData=e,t.onLoad&&t.onLoad(e)}))}))}},{key:"loadPostProcessing",value:function(e){var t=this,n=this._sceneData;if(n)return n.k&&n.k.v&&(this.viewer.composer.enableColorAdjustment=!0,this.viewer.composer.colorAdjustment.setHue(n.k.h),this.viewer.composer.colorAdjustment.setContrast(n.k.s),this.viewer.composer.colorAdjustment.setVibrance(n.k.b)),n.f&&n.f.v&&(this.viewer.composer.enableDof=!0,this.viewer.composer.dof.setAperture(n.f.a),this.viewer.composer.dof.setMaxblur(n.f.b),this.enableClickDof=!0),n.s&&n.s.v&&(this.viewer.composer.enableSSAO=!0,this.viewer.composer.ssao.setStrength(n.s.s),this.viewer.composer.ssao.setRadius(n.s.r)),n.u&&n.u.v&&(this.viewer.composer.enableUnrealBloom=!0,this.viewer.composer.unrealBloom.setStrength(n.u.s),this.viewer.composer.unrealBloom.setRadius(n.u.r),this.viewer.composer.unrealBloom.setThreshold(n.u.t),n.u.o?n.u.o.map((function(n){return t.viewer.composer.unrealBloom.add(e.getObjectByID(n))})):this.viewer.composer.unrealBloom.add(e)),n.g&&n.g.v&&(this.viewer.composer.enableVignette=!0,this.viewer.composer.vignette.setDarkness(n.g.d),this.viewer.composer.vignette.setOffset(n.g.o)),n.q&&n.q.v&&(this.viewer.composer.enableSSR=!0,n.q.c&&n.q.c.length>0&&n.q.c.map((function(n){return t.viewer.composer.ssr.addObject(e.getObjectByID(n))})),n.q.r&&n.q.r.length>0&&n.q.r.map((function(n){return t.viewer.composer.ssr.addPlane(e.getObjectByID(n))})),this.viewer.composer.ssr.maxDistance=n.q.d,this.viewer.composer.ssr.opacity=n.q.o),{colorAdjustment:this.viewer.composer.enableColorAdjustment,dof:this.viewer.composer.enableDof,ssao:this.viewer.composer.enableSSAO,unrealBloom:this.viewer.composer.enableUnrealBloom}}},{key:"hidePostprocessing",value:function(){this.viewer.composer.enableUnrealBloom=!1,this.viewer.composer.enableColorAdjustment=!1,this.viewer.composer.enableDof=!1,this.viewer.composer.enableSSAO=!1,this.viewer.composer.enableVignette=!1,this.enableClickDof=!1}},{key:"showFog",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#ffffff",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;this.scene.fog=new to(e,t,n)}},{key:"showFogExp",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#ffffff",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;t*=5e-5,this.scene.fog=new eo(e,t)}},{key:"setFogDensity",value:function(e){this.scene.fog&&(this.scene.fog.density=5e-5*e)}},{key:"clearFog",value:function(){this.scene.fog=null}},{key:"showGridHelp",value:function(e,t,n){this.gridHelp?this.gridHelp.visible=!0:(this.gridHelp=new ph(e,t,n,n),this.root.add(this.gridHelp))}},{key:"hideGridHelp",value:function(){this.gridHelp&&(this.gridHelp.visible=!1)}},{key:"showAxesHelper",value:function(e){if(this.axesHelper&&this.root.remove(this.axesHelper),!e){var t=(new tn).setFromObject(this.modelGroup);e=Math.max(t.getSize().x,t.getSize().y,t.getSize().z)}this.axesHelper=new Oh(e),this.root.add(this.axesHelper)}},{key:"hideAxesHelper",value:function(){this.axesHelper&&this.root.remove(this.axesHelper)}},{key:"fitCamera",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.modelGroup,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n&&n.isBox3?e=n:(e=new tn).expandByObject(t);var i=e.getCenter(new at);t===this.modelGroup&&(t.translateX(-i.x),t.translateY(-i.y),t.translateZ(-i.z),i.x=i.y=i.z=0),this.modelGroup.traverse((function(e){e._shadow&&(t.updateMatrixWorld(),t.matrixWorld.decompose(e._shadow.parent.position,e._shadow.parent.quaternion,e._shadow.parent.scale))}));var r=1.5,a=.8,o=.05,s=this.viewer.renderManager.container.getBoundingClientRect();s.widththis.camera.far&&(this.camera.far=20*A),this.camera.far<5e3&&(this.camera.far=5e3),this.camera.near<.01&&(this.camera.near=.01),this.camera.defaultPos.copy(this.camera.position);var d=new at(i.x,i.y+h*a,i.z+h*r);this.camera.controller?(this.camera.controller.setPosition(d.x,d.y,d.z),this.camera.controller.setTarget(i.x,i.y,i.z)):(this.camera.position.z=d.z,this.camera.position.y=d.y,this.camera.lookAt(i.x,i.y,i.z)),this.camera.updateProjectionMatrix()}},{key:"dispose",value:function(){this.scene.traverse((function(e){e.isMesh&&(e.geometry&&e.geometry.dispose(),(Array.isArray(e.material)?e.material:[e.material]).forEach((function(e){e.map&&e.map.dispose(),e.dispose()})))})),this.scene.background&&this.scene.background.dispose&&this.scene.background.dispose(),this.scene.dispose(),this.scene.background=null}},{key:"updateShadowMaterial",value:function(){var e=this;op.setFromObject(this.modelGroup);var t=new ut(0,-1,0,-op.min.y+this.shadowOffset),n=this.shadowDecay,i=this.shadowStrength;this.modelGroup.traverse((function(r){r.isModel&&(e._enableShadow?(op.setFromObject(r),r.shadowMaterial?(r.shadowMaterial.lightDirection.copy((new at).sub(e.directLight.position)),r.shadowMaterial.shadowPlane=t,r.shadowMaterial.shadowLength=op.getSize(sp).length()*n,r.shadowMaterial.shadowStrength=i,op.getCenter(r.shadowMaterial.center)):r.shadowMaterial=new Sl({lightDirection:(new at).sub(e.directLight.position),shadowPlane:t,shadowLength:op.getSize(sp).length()*n,color:new Fn(0),shadowStrength:i,center:op.getCenter(sp)})):r.shadowMaterial=null)}))}}]),n}(Je);function up(e){var t=this;if(cp&&!(Date.now()-cp>200)){var n=e.offsetX,i=e.offsetY;this.icon.style.left=n-15+"px",this.icon.style.top=i-15+"px",this.icon.style.opacity=1,this.icon.style["-webkit-user-drag"]="none",Ap&&clearTimeout(Ap),Ap=setTimeout((function(){return t.icon.style.opacity=0}),1e3);var r=If.getDomMouse(e,this.viewer.domElement);ap.setFromCamera(r,this.viewer.renderManager.camera);var a=ap.intersectObject(this.modelGroup,!0);if(a[0]){var o=a[0].distance;this.viewer.composer.dof.setFocus(o)}}}function dp(e){cp=Date.now()}function fp(e){this.viewer=e;var t=this.object=e.camera;this.domElement=void 0!==e.renderer.domElement?e.renderer.domElement:document,this.enabled=!0,this.target=new at,this._minDistance=0,this.minDistance=0,this._maxDistance=1/0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this._minPolarAngle=0,this._maxPolarAngle=Math.PI,this._minAzimuthAngle=-1/0,this._maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this._enableZoom=!0,this.zoomSpeed=1,this._enableRotate=!0,this.rotateSpeed=1,this._enablePan=!0,this.leftPan=!1,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!1,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:_.LEFT,MIDDLE:_.MIDDLE,RIGHT:_.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._rotateLeft=function(e){C(e)},this._rotateUp=function(e){B(e)},this.panLeft=function(e){S(e,n.object.matrix)},this.panRight=function(e){S(-e,n.object.matrix)},this.panUp=function(e){T(e,n.object.matrix)},this.panDown=function(e){T(-e,n.object.matrix)},this.dollyIn=function(t){L(t,!0),e.renderManager.render()},this.dollyOut=function(t){F(t,!0),e.renderManager.render()},this.zoom=function(e){e<0?F(M()):e>0&&L(M()),n._update()},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){u.set(0,0,0),n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n._update(),s=o.NONE},this._update=function(){var e=new at,r=(new nt).setFromUnitVectors(t.up,new at(0,1,0)),a=r.clone().inverse(),f=new at,p=new nt;return function(){n.cachePosition&&(n.setPosition(n.cachePosition.x,n.cachePosition.y,n.cachePosition.z),n.cachePosition=null),n.cacheTarget&&(n.setTarget(n.cacheTarget.x,n.cacheTarget.y,n.cacheTarget.z),n.cacheTarget=null);var t=n.object.position;e.copy(t).sub(n.target),e.applyQuaternion(r),A.setFromVector3(e),n.autoRotate&&s===o.NONE&&C(2*Math.PI/60/60*n.autoRotateSpeed),A.theta+=c.theta,A.phi+=c.phi,A.theta=Math.max(n._minAzimuthAngle,Math.min(n._maxAzimuthAngle,A.theta)),A.phi=Math.max(n._minPolarAngle,Math.min(n._maxPolarAngle,A.phi)),A.makeSafe(),A.radius*=h,A.radius=Math.max(n.minDistance,Math.min(n.maxDistance,A.radius)),n.target.add(u),e.setFromSpherical(A),e.applyQuaternion(a),t.equals(n.target.clone().add(e))||t.copy(n.target).add(e),n.object.lookAt(n.target);var m=!1;return u.equals(new at)||(m=!0),!0===n.enableDamping?(c.theta*=1-n.dampingFactor,c.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(c.set(0,0,0),u.set(0,0,0)),h=1,!!(d||f.distanceToSquared(n.object.position)>l||8*(1-p.dot(n.object.quaternion))>l)&&(m?i.data="pan":delete i.data,n.dispatchEvent(i),f.copy(n.object.position),p.copy(n.object.quaternion),d=!1,!0)}}(),this.computePosition=function(e,t,i,r){var a=(new nt).setFromUnitVectors(n.object.up,new at(0,1,0)),o=a.clone().inverse(),s=new at;return s.copy(e).sub(t),s.applyQuaternion(a),A.setFromVector3(s),void 0!==i?A.theta=i:A.theta+=c.theta,void 0!==r?A.phi=r:A.phi+=c.phi,A.theta=Math.max(n._minAzimuthAngle,Math.min(n._maxAzimuthAngle,A.theta)),A.phi=Math.max(n._minPolarAngle,Math.min(n._maxPolarAngle,A.phi)),A.makeSafe(),A.radius*=h,A.radius=Math.max(n.minDistance,Math.min(n.maxDistance,A.radius)),s.setFromSpherical(A),s.applyQuaternion(o),e.copy(t).add(s),e},this.dispose=function(){n.domElement.removeEventListener("contextmenu",G,!1),n.domElement.removeEventListener("mousedown",P,!1),n.domElement.removeEventListener("wheel",R,!1),n.domElement.removeEventListener("touchstart",N,!1),n.domElement.removeEventListener("touchend",Q,!1),n.domElement.removeEventListener("touchmove",z,!1),document.removeEventListener("mousemove",U,!1),document.removeEventListener("mouseup",D,!1),window.removeEventListener("keydown",O,!1)};var n=this,i={type:"change"},r={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY_PAN:4},s=o.NONE,l=1e-6,A=new Gc,c=new Gc;this.sphericalDelta=c;var h=1,u=new at,d=!1,f=new tt,p=new tt,m=new tt,v=new tt,g=new tt,y=new tt,w=new tt,x=new tt,b=new tt;function M(){return Math.pow(.95,n.zoomSpeed)}function C(t){c.theta-=t,e.renderManager.render()}function B(t){c.phi-=t,e.renderManager.render()}this.spherical=A;var E,S=function(){var t=new at;return function(n,i){t.setFromMatrixColumn(i,0),t.multiplyScalar(-n),u.add(t),e.renderManager.render()}}(),T=function(){var t=new at;return function(i,r){!0===n.screenSpacePanning?t.setFromMatrixColumn(r,1):(t.setFromMatrixColumn(r,0),t.crossVectors(n.object.up,t)),t.multiplyScalar(i),u.add(t),e.renderManager.render()}}(),I=(E=new at,function(e,t){var i=n.domElement===document?n.domElement.body:n.domElement;if(n.object.isPerspectiveCamera){var r=n.object.position;E.copy(r).sub(n.target);var a=E.length();a*=Math.tan(n.object.fov/2*Math.PI/180),S(2*e*a/i.clientHeight,n.object.matrix),T(2*t*a/i.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(S(e*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),T(t*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n._enablePan=!1)});function L(e,t){n.object.isPerspectiveCamera?t?h=e:h/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n._enableZoom=!1)}function F(e,t){n.object.isPerspectiveCamera?t?h=e:h*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n._enableZoom=!1)}function k(e){v.set(e.clientX,e.clientY)}function P(e){if(!1!==n.enabled){switch(e.preventDefault(),n.domElement.focus?n.domElement.focus():window.focus(),e.button){case n.mouseButtons.LEFT:if(e.ctrlKey||e.metaKey||e.shiftKey||n.leftPan){if(!1===n._enablePan)return;k(e),s=o.PAN}else{if(!1===n._enableRotate)return;!function(e){f.set(e.clientX,e.clientY)}(e),s=o.ROTATE}break;case n.mouseButtons.MIDDLE:if(!1===n._enableZoom)return;!function(e){w.set(e.clientX,e.clientY)}(e),s=o.DOLLY;break;case n.mouseButtons.RIGHT:if(!1===n._enablePan)return;k(e),s=o.PAN}s!==o.NONE&&(document.addEventListener("mousemove",U,!1),document.addEventListener("mouseup",D,!1),n.dispatchEvent(r))}}function U(e){if(!1!==n.enabled)switch(e.preventDefault(),s){case o.ROTATE:if(!1===n._enableRotate)return;!function(e){p.set(e.clientX,e.clientY),m.subVectors(p,f).multiplyScalar(n.rotateSpeed);var t=n.domElement===document?n.domElement.body:n.domElement;C(2*Math.PI*m.x/t.clientHeight),B(2*Math.PI*m.y/t.clientHeight),f.copy(p),n._update()}(e);break;case o.DOLLY:if(!1===n._enableZoom)return;!function(e){x.set(e.clientX,e.clientY),b.subVectors(x,w),b.y>0?L(M()):b.y<0&&F(M()),w.copy(x),n._update()}(e);break;case o.PAN:if(!1===n._enablePan)return;!function(e){g.set(e.clientX,e.clientY),y.subVectors(g,v).multiplyScalar(n.panSpeed),I(y.x,y.y),v.copy(g),n._update()}(e)}}function D(e){!1!==n.enabled&&(document.removeEventListener("mousemove",U,!1),document.removeEventListener("mouseup",D,!1),n.dispatchEvent(a),s=o.NONE)}function R(e){!1===n.enabled||!1===n._enableZoom||s!==o.NONE&&s!==o.ROTATE||(e.preventDefault(),n.dispatchEvent(r),function(e){e.deltaY<0?F(M()):e.deltaY>0&&L(M()),n._update()}(e),n.dispatchEvent(a))}function O(e){!1!==n.enabled&&!1!==n.enableKeys&&!1!==n._enablePan&&function(e){var t=!1;switch(e.keyCode){case n.keys.UP:I(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:I(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:I(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:I(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n._update())}(e)}function N(e){if(!1!==n.enabled){switch(e.preventDefault(),e.touches.length){case 1:if(!1===n._enableRotate)return;!function(e){f.set(e.touches[0].pageX,e.touches[0].pageY)}(e),s=o.TOUCH_ROTATE;break;case 2:if(!1===n._enableZoom&&!1===n._enablePan)return;!function(e){if(n._enableZoom){var t=e.touches[0].pageX-e.touches[1].pageX,i=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+i*i);w.set(0,r)}if(n._enablePan){var a=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);v.set(a,o)}}(e),s=o.TOUCH_DOLLY_PAN;break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(r)}}function z(e){if(!1!==n.enabled)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:if(!1===n._enableRotate)return;if(s!==o.TOUCH_ROTATE)return;!function(e){p.set(e.touches[0].pageX,e.touches[0].pageY),m.subVectors(p,f).multiplyScalar(n.rotateSpeed);var t=n.domElement===document?n.domElement.body:n.domElement;C(2*Math.PI*m.x/t.clientHeight),B(2*Math.PI*m.y/t.clientHeight),f.copy(p),n._update()}(e);break;case 2:if(!1===n._enableZoom&&!1===n._enablePan)return;if(s!==o.TOUCH_DOLLY_PAN)return;!function(e){if(n._enableZoom){var t=e.touches[0].pageX-e.touches[1].pageX,i=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+i*i);x.set(0,r),b.set(0,Math.pow(x.y/w.y,n.zoomSpeed)),L(b.y),w.copy(x)}if(n._enablePan){var a=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);g.set(a,o),y.subVectors(g,v).multiplyScalar(n.panSpeed),I(y.x,y.y),v.copy(g)}n._update()}(e);break;default:s=o.NONE}}function Q(e){s=o.NONE,!1!==n.enabled&&(n.dispatchEvent(a),s=o.NONE)}function G(e){!1!==n.enabled&&e.preventDefault()}n.domElement.addEventListener("contextmenu",G,!1),n.domElement.addEventListener("mousedown",P,!1),n.domElement.addEventListener("wheel",R,!1),n.domElement.addEventListener("touchstart",N,!1),n.domElement.addEventListener("touchend",Q,!1),n.domElement.addEventListener("touchmove",z,!1),window.addEventListener("keydown",O,!1),this._update()}fp.prototype=Object.create(Je.prototype),fp.prototype.constructor=fp,Object.defineProperties(fp.prototype,{center:{get:function(){return console.warn("OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this._enableZoom},set:function(e){console.warn("OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this._enableZoom=!e}},noRotate:{get:function(){return console.warn("OrbitControls: .noRotate has been deprecated. Use ._enableRotate instead."),!this._enableRotate},set:function(e){console.warn("OrbitControls: .noRotate has been deprecated. Use ._enableRotate instead."),this._enableRotate=!e}},noPan:{get:function(){return console.warn("OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(e){console.warn("OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor},set:function(e){console.warn("OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor=e}},minDistance:{set:function(e){isNaN(e)&&(e=0),this._minDistance=e},get:function(){return isNaN(this._minDistance)&&(this._minDistance=0),this._minDistance}},maxDistance:{set:function(e){isNaN(e)&&(e=1/0),this._maxDistance=e},get:function(){return isNaN(this._maxDistance)&&(this._maxDistance=1/0),this._maxDistance}}});var pp={TOP:"top",NORMAL:"normal",MAP:"map",ROAM_FREE:"roam_free",ROAM_AUTO:"roam_auto",ORBIT:"orbit",GLOBE:"globe",PLANAR:"planar",FLY:"fly",DRIVE:"drive"},mp=function(e){h(n,e);var t=y(n);function n(e,i,r,a){var o;return s(this,n),(o=t.call(this)).object=e,o.camera=i,o.tween=r,o.controls=a,o}return A(n,[{key:"setCameraFloor",value:function(e){this.cameraPos=this.camera.position.clone(),this.controls.enabled=!1,e&&(e.z*=-1,this.camera.position.copy(e)),this.camera.lookAt(new at),this.object.add(this.camera)}},{key:"stopCameraFloor",value:function(){this.controls.enabled=!0,this.camera.parent==this.object&&this.object.remove(this.camera),this.cameraPos&&this.camera.position.copy(this.cameraPos)}},{key:"stopMoving",value:function(){this.tween.stop(),this.stopCameraFloor()}}]),n}(Je),vp={type:ld.CHANGE},gp={type:"move"},yp=function(e){h(n,e);var t=y(n);function n(e){var i,r,a;return s(this,n),(a=t.call(this,e))._viewMode=pp.NORMAL,a._rotateTween=null,a.viewer=e,a.object=e.camera,a.camera=e.camera,e.camera.controller=v(a),b((i=v(a),u(n.prototype)),"addEventListener",i).call(i,"change",(function(){return a.dispatchEvent(gp)})),b((r=v(a),u(n.prototype)),"addEventListener",r).call(r,"end",(function(){return a.dispatchEvent(vp)})),a}return A(n,[{key:"viewMode",get:function(){return this._viewMode},set:function(e){this._viewMode=e,this.dispatchEvent({type:"view_change",data:e})}},{key:"getView",value:function(){return{position:this.object.position.toArray(),target:this.target.toArray()}}},{key:"setView",value:function(e){void 0!==e&&(void 0!==e.position&&(Array.isArray(e.position)?this.object.position.fromArray(e.position):this.object.position.copy(e.position)),void 0!==e.target&&this.target&&(Array.isArray(e.position)?this.target.fromArray(e.target):this.target.copy(e.target))),this.viewer.renderManager.render(!0)}},{key:"enablePan",get:function(){return this._enablePan},set:function(e){this._enablePan=e}},{key:"enableRotate",get:function(){return this._enableRotate},set:function(e){this._enableRotate=e}},{key:"enableZoom",get:function(){return this._enableZoom},set:function(e){this._enableZoom=e}},{key:"maxPolarAngle",get:function(){return this._maxPolarAngle/(Math.PI/180)},set:function(e){this._maxPolarAngle=Math.PI/180*e}},{key:"minPolarAngle",get:function(){return this._minPolarAngle/(Math.PI/180)},set:function(e){this._minPolarAngle=Math.PI/180*e}},{key:"maxAzimuthAngle",get:function(){return this._maxAzimuthAngle/(Math.PI/180)},set:function(e){this._maxAzimuthAngle=Math.PI/180*e}},{key:"minAzimuthAngle",get:function(){return this._minAzimuthAngle/(Math.PI/180)},set:function(e){this._minAzimuthAngle=Math.PI/180*e}},{key:"flyTo",value:function(e){var t,n,i=this,r=[ud.Easing.Linear.None,ud.Easing.Quadratic.InOut,ud.Easing.Quadratic.Out,ud.Easing.Cubic.InOut,ud.Easing.Cubic.Out,ud.Easing.Sinusoidal.InOut,ud.Easing.Sinusoidal.Out,ud.Easing.Exponential.InOut,ud.Easing.Exponential.Out,ud.Easing.Circular.InOut,ud.Easing.Circular.Out,ud.Easing.Elastic.InOut,ud.Easing.Elastic.Out,ud.Easing.Back.InOut,ud.Easing.Back.Out,ud.Easing.Bounce.InOut,ud.Easing.Bounce.Out],a=e&&e.type?r[e.type]:r[10];if(void 0!==(e=e||{}).position&&(t=Array.isArray(e.position)?(new at).fromArray(e.position):(new at).copy(e.position)),void 0!==e.target&&(n=Array.isArray(e.target)?(new at).fromArray(e.target):(new at).copy(e.target)),e.object&&(e.object.isObject3D||e.object.isMesh)&&(n=e.object.parent.localToWorld(e.object.position.clone()),t=this._fitCamera(e.object).add(n),e.yAngle&&(t.x=0,t.applyAxisAngle(new at(0,1,0),Math.PI/180*e.yAngle).add(n)),e.xAngle)){var o=this._fitCamera(e.object).add(n);o.applyAxisAngle(new at(1,0,0),Math.PI/180*e.xAngle*-1),t.copy(o),e.yAngle&&(t.x=0,t.applyAxisAngle(new at(0,1,0),Math.PI/180*e.yAngle).add(n))}if(t){if(this.viewer.firstPersonControls.enabled&&this.object.isCamera){var s=this.object.getWorldPosition(),l=this.object.getWorldDirection();this.target=s.clone().addScaledVector(l,10)}n&&n.distanceTo(this.target)>0&&new ud.Tween(this.target).easing(a).to(n,e.time+100||600).onUpdate((function(){i.object.lookAt(i.target)})).start(),new ud.Tween(this.object.position).easing(a).to(t,e.time||500).onUpdate((function(){i._dispatchEvent(vp)})).onComplete((function(){e.complete&&e.complete()})).start()}}},{key:"fit",value:function(e){if(e.isMesh||e.isObject3D){this.viewer.renderManager.render(!0);var t=e.parent.localToWorld(e.position.clone()),n=this._fitCamera(e).add(t);this.object.position.copy(n),this.target.copy(t),this._dispatchEvent(vp)}}},{key:"setPosition",value:function(e,t,n){this.object.position.set(e,t,n),this._dispatchEvent(vp)}},{key:"setTarget",value:function(e,t,n){this.target.set(e,t,n),this._dispatchEvent(vp)}},{key:"moveForward",value:function(e){var t=new at;this.object.getWorldDirection(t),this.object.position.add(t.multiplyScalar(e)),this._dispatchEvent(vp)}},{key:"moveBackward",value:function(e){var t=new at;this.object.getWorldDirection(t),this.object.position.add(t.multiplyScalar(-e)),this._dispatchEvent(vp)}},{key:"moveLeft",value:function(e){this.panLeft(e)}},{key:"moveRight",value:function(e){this.panRight(e)}},{key:"moveUp",value:function(e){this.panUp(e)}},{key:"moveDown",value:function(e){this.panDown(e)}},{key:"rotateLeft",value:function(e){e=Math.PI/180*e,this._rotateLeft(e)}},{key:"rotateUp",value:function(e){e=Math.PI/180*e,this._rotateUp(e)}},{key:"zoomIn",value:function(){this.zoom(-1)}},{key:"zoomOut",value:function(){this.zoom(1)}},{key:"rotateAround",value:function(e){var t,n=this,i=e.target,r=e.object;r&&(r.isMesh||r.isObject3D)?t=r.parent.localToWorld(r.position.clone()):i&&void 0!==i.x&&void 0!==i.y&&void 0!==i.z&&(t=(new at).copy(i)),this.stopRotateAround();var a=function(){if(e.yAngle){var t=0,i={angle:0};n._rotateTween=new ud.Tween(i).to({angle:e.yAngle},e.time).onUpdate((function(){n.rotateLeft(i.angle-t),t=i.angle})).start().repeat(e.loop||1)}if(e.xAngle){var r=0,a={angle:0};n._rotateTween=new ud.Tween(a).to({angle:e.xAngle},e.time).onUpdate((function(){n.rotateUp(a.angle-r),r=a.angle})).start().repeat(e.loop||1)}};t.distanceTo(this.target)>0?new ud.Tween(this.target).to(t,500).onUpdate((function(){n.object.lookAt(n.target),n._dispatchEvent(vp)})).onComplete((function(){a()})).start():a()}},{key:"stopRotateAround",value:function(){this._rotateTween&&this._rotateTween.stop()}},{key:"movePath",value:function(e){var t,n=[];e.path.forEach((function(e){n.push((new at).copy(e))}));var i=new cA(n);i.curveType="catmullrom",i.tension=0,i.getPoints(50);var r,a={t:0},o=new at,s=new ud.Tween(a).to({t:1},e.time).onUpdate((function(){var t=new at;i.getPoint(a.t,t),o.copy(t),r&&i.getPoint(a.t+.01,o),r=a.t,e.object.lookAt(o.clone()),e.object.position.copy(t.clone())})).onComplete((function(){t.stopCameraFloor()})).repeat(e.loop||1).start();return t=new mp(e.object,this.object,s,this)}},{key:"_fitCamera",value:function(e){var t=new tn;t.makeEmpty(),t.expandByObject(e);var n=1.5;this.viewer.containerRect.width0&&void 0!==arguments[0]?arguments[0]:2;this.autoRotateSpeed=e,this.autoRotate=!0}},{key:"stopAutoRotate",value:function(){this.autoRotate=!1}},{key:"follow",value:function(e,t){var n=this;e||console.error("缺少参数object"),this.followTask=function(){var i=n._fitCamera(e),r=new at(0,0,0);t&&(i.add(t),r.add(t)),n.setPosition(e.position.x+i.x,e.position.y+i.y,e.position.z+i.z),n.setTarget(e.position.x+r.x,e.position.y+r.y,e.position.z+r.z)}.bind(this),this.viewer.addEventListener("update",this.followTask)}},{key:"stopFollow",value:function(){this.viewer.removeEventListener("update",this.followTask)}}]),n}(fp);yp.VIEW_CHANGE="view_change";var wp="#DDDDDD",xp="#F2F5CE",bp="#FFFFFF",Mp=256,Cp=[],Bp=[],Ep=[],Sp=[],Tp=[],_p=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,o=arguments.length>3?arguments[3]:void 0;s(this,n),A(),(i=t.call(this)).cubeSize=r,i.edgeSize=a,i._cube=new Ip({size:i.cubeSize,edge:i.edgeSize,outline:!0,bgColor:wp,hoverColor:xp,outlineColor:bp}),i._animation=null,i._handleMouseMove=i._handleMouseMove.bind(v(i)),i._handleMouseClick=i._handleMouseClick.bind(v(i)),i._controls=o,i._renderer=new $a({antialias:!0,alpha:!0}),i._renderer.setPixelRatio(window.devicePixelRatio),i._renderer.setSize(150,150),i._renderer.setClearAlpha(0),i._renderer.domElement.style.position="absolute",i._renderer.domElement.style.right="0px",i._renderer.domElement.style.top="0px",e.appendChild(i._renderer.domElement),i.domElement=i._renderer.domElement,i._listen(),i._scene=new Qt,i._scene.add(i._cube),i._camera=new Ni(50,1,.1,1e3);var l=new UA(16777215,1);function A(){Bp=[{name:Up.FRONT,map:Pp("前",{fontSize:Mp,font:"Arial Narrow, sans-serif"})},{name:Up.RIGHT,map:Pp("右",{fontSize:Mp,font:"Arial Narrow, sans-serif"})},{name:Up.BACK,map:Pp("后",{fontSize:Mp,font:"Arial Narrow, sans-serif"})},{name:Up.LEFT,map:Pp("左",{fontSize:Mp,font:"Arial Narrow, sans-serif"})},{name:Up.TOP,map:Pp("上",{fontSize:Mp,font:"Arial Narrow, sans-serif"})},{name:Up.BOTTOM,map:Pp("下",{fontSize:Mp,font:"Arial Narrow, sans-serif"})}],Ep=[{name:Up.TOP_FRONT_RIGHT_CORNER},{name:Up.TOP_BACK_RIGHT_CORNER},{name:Up.TOP_BACK_LEFT_CORNER},{name:Up.TOP_FRONT_LEFT_CORNER},{name:Up.BOTTOM_BACK_RIGHT_CORNER},{name:Up.BOTTOM_FRONT_RIGHT_CORNER},{name:Up.BOTTOM_FRONT_LEFT_CORNER},{name:Up.BOTTOM_BACK_LEFT_CORNER}],Sp=[{name:Up.TOP_FRONT_EDGE},{name:Up.TOP_RIGHT_EDGE},{name:Up.TOP_BACK_EDGE},{name:Up.TOP_LEFT_EDGE},{name:Up.BOTTOM_BACK_EDGE},{name:Up.BOTTOM_RIGHT_EDGE},{name:Up.BOTTOM_FRONT_EDGE},{name:Up.BOTTOM_LEFT_EDGE}],Tp=[{name:Up.FRONT_RIGHT_EDGE},{name:Up.BACK_RIGHT_EDGE},{name:Up.BACK_LEFT_EDGE},{name:Up.FRONT_LEFT_EDGE}],Cp=[].concat(C(Bp),C(Ep),C(Sp),C(Tp))}return i._scene.add(l),i._camera.position.set(0,0,70),i._camera.lookAt(0,0,0),i}return A(n,[{key:"_listen",value:function(){var e=this;this.domElement.addEventListener("mousemove",this._handleMouseMove),this.domElement.addEventListener("click",this._handleMouseClick),this._controls.addEventListener(ld.CHANGE,(function(){var t=-1*(e._controls.spherical.phi-Math.PI/2),n=-e._controls.spherical.theta;e._cube.rotation.set(t,n,0)}))}},{key:"_handleMouseClick",value:function(e){var t=e.offsetX/e.target.clientWidth*2-1,n=-e.offsetY/e.target.clientHeight*2+1;this._checkSideTouch(t,n)}},{key:"_checkSideTouch",value:function(e,t){var n=this,i=new Nc;i.setFromCamera({x:e,y:t},this._camera);var r=[];this._cube.children.forEach((function(e){e!=n._cube.model&&r.push(e)}));var a=i.intersectObjects(r,!0);if(a.length){var o,s=S(a);try{for(s.s();!(o=s.n()).done;){var l=o.value.object;if(l.name){this._rotateTheCube(l.name),this._rotateTheCamera(l.name);break}}}catch(e){s.e(e)}finally{s.f()}}}},{key:"_rotateTheCamera",value:function(e){var t=new at;switch(e){case Up.FRONT:t.set(0,0,1);break;case Up.BACK:t.set(0,0,-1);break;case Up.LEFT:t.set(-1,0,0);break;case Up.RIGHT:t.set(1,0,0);break;case Up.TOP:t.set(0,1,0);break;case Up.BOTTOM:t.set(0,-1,0);break;case Up.TOP_FRONT_EDGE:t.set(0,1,1);break;case Up.TOP_BACK_EDGE:t.set(0,1,-1);break;case Up.TOP_RIGHT_EDGE:t.set(1,1,0);break;case Up.TOP_LEFT_EDGE:t.set(-1,1,0);break;case Up.BOTTOM_FRONT_EDGE:t.set(0,-1,1);break;case Up.BOTTOM_BACK_EDGE:t.set(0,-1,-1);break;case Up.BOTTOM_RIGHT_EDGE:t.set(1,-1,0);break;case Up.BOTTOM_LEFT_EDGE:t.set(-1,-1,0);break;case Up.FRONT_RIGHT_EDGE:t.set(1,0,1);break;case Up.FRONT_LEFT_EDGE:t.set(-1,0,1);break;case Up.BACK_RIGHT_EDGE:t.set(1,0,-1);break;case Up.BACK_LEFT_EDGE:t.set(-1,0,-1);break;case Up.TOP_FRONT_RIGHT_CORNER:t.set(1,1,1);break;case Up.TOP_FRONT_LEFT_CORNER:t.set(-1,1,1);break;case Up.TOP_BACK_RIGHT_CORNER:t.set(1,1,-1);break;case Up.TOP_BACK_LEFT_CORNER:t.set(-1,1,-1);break;case Up.BOTTOM_FRONT_RIGHT_CORNER:t.set(1,-1,1);break;case Up.BOTTOM_FRONT_LEFT_CORNER:t.set(-1,-1,1);break;case Up.BOTTOM_BACK_RIGHT_CORNER:t.set(1,-1,-1);break;case Up.BOTTOM_BACK_LEFT_CORNER:t.set(-1,-1,-1)}t.clone();var n=this._controls.target.distanceTo(this._controls.object.position),i=t.normalize().multiplyScalar(n).add(this._controls.target);this._controls.camera.rotation.set(0,0,0),this._controls.flyTo({position:i,rotation:new at})}},{key:"_rotateTheCube",value:function(e){switch(e){case Up.FRONT:this._setCubeAngles(0,0,0);break;case Up.RIGHT:this._setCubeAngles(0,-90,0);break;case Up.BACK:this._setCubeAngles(0,-180,0);break;case Up.LEFT:this._setCubeAngles(0,-270,0);break;case Up.TOP:this._setCubeAngles(90,0,0);break;case Up.BOTTOM:this._setCubeAngles(-90,0,0);break;case Up.TOP_FRONT_EDGE:this._setCubeAngles(45,0,0);break;case Up.TOP_RIGHT_EDGE:this._setCubeAngles(45,-90,0);break;case Up.TOP_BACK_EDGE:this._setCubeAngles(45,-180,0);break;case Up.TOP_LEFT_EDGE:this._setCubeAngles(45,-270,0);break;case Up.BOTTOM_FRONT_EDGE:this._setCubeAngles(-45,0,0);break;case Up.BOTTOM_RIGHT_EDGE:this._setCubeAngles(-45,-90,0);break;case Up.BOTTOM_BACK_EDGE:this._setCubeAngles(-45,-180,0);break;case Up.BOTTOM_LEFT_EDGE:this._setCubeAngles(-45,-270,0);break;case Up.FRONT_RIGHT_EDGE:this._setCubeAngles(0,-45,0);break;case Up.BACK_RIGHT_EDGE:this._setCubeAngles(0,-135,0);break;case Up.BACK_LEFT_EDGE:this._setCubeAngles(0,-225,0);break;case Up.FRONT_LEFT_EDGE:this._setCubeAngles(0,-315,0);break;case Up.TOP_FRONT_RIGHT_CORNER:this._setCubeAngles(45,-45,0);break;case Up.TOP_BACK_RIGHT_CORNER:this._setCubeAngles(45,-135,0);break;case Up.TOP_BACK_LEFT_CORNER:this._setCubeAngles(45,-225,0);break;case Up.TOP_FRONT_LEFT_CORNER:this._setCubeAngles(45,-315,0);break;case Up.BOTTOM_FRONT_RIGHT_CORNER:this._setCubeAngles(-45,-45,0);break;case Up.BOTTOM_BACK_RIGHT_CORNER:this._setCubeAngles(-45,-135,0);break;case Up.BOTTOM_BACK_LEFT_CORNER:this._setCubeAngles(-45,-225,0);break;case Up.BOTTOM_FRONT_LEFT_CORNER:this._setCubeAngles(-45,-315,0)}}},{key:"_setCubeAngles",value:function(e,t,n){var i=this._cube.rotation;this._animation={base:{x:i.x,y:i.y,z:i.z},delta:{x:kp(i.x,e*Lp),y:kp(i.y,t*Lp),z:kp(i.z,n*Lp)},duration:500,time:Date.now()}}},{key:"_handleMouseMove",value:function(e){var t=e.offsetX/e.target.clientWidth*2-1,n=-e.offsetY/e.target.clientHeight*2+1;this._checkSideOver(t,n)}},{key:"_checkSideOver",value:function(e,t){var n=this,i=new Nc;i.setFromCamera({x:e,y:t},this._camera);var r=[],a=this._cube.model;this._cube.children.forEach((function(e){e!=n._cube.model&&r.push(e)}));var o=i.intersectObjects(r,!0);if(this._cube.children.forEach((function(e){e!=a&&e.traverse((function(e){e.name&&e.material.color.setStyle(e.material.color0)}))})),o.length){var s,l=S(o);try{var A=function(){var e=s.value.object;if(e.name){Cp.find((function(t){return t.name===e.name}));return e.parent.children.forEach((function(t){t!=a&&t.name===e.name&&(t.material.color0||(t.material.color0="#"+t.material.color.getHexString()),t.material.color.setStyle(xp))})),"break"}};for(l.s();!(s=l.n()).done;){if("break"===A())break}}catch(e){l.e(e)}finally{l.f()}}}},{key:"update",value:function(){this._animate(),this._renderer.render(this._scene,this._camera)}},{key:"_animate",value:function(){if(this._animation){var e=Date.now(),t=this._animation,n=t.duration,i=t.time,r=Math.min((e-i)/n,1);this._animateCubeRotation(this._animation,r),1==r&&(this._animation=null),this.dispatchEvent({type:"angle-change",quaternion:this._cube.quaternion.clone()})}}},{key:"_animateCubeRotation",value:function(e,t){var n=e.base,i=e.delta,r=.5*(Math.sin((2*t-1)*Math.PI*.5)+1),a=-Fp+n.x+i.x*r,o=-Fp+n.y+i.y*r,s=-Fp+n.z+i.z*r;this._cube.rotation.set(a%Fp,o%Fp,s%Fp)}},{key:"setQuaternion",value:function(e){this._cube.setRotationFromQuaternion(e)}},{key:"getObject",value:function(){return this._cube}}]),n}(Je),Ip=function(e){h(n,e);var t=y(n);function n(e){var i,r=e.size,a=void 0===r?60:r,o=e.edge,l=void 0===o?5:o,A=e.outline,c=void 0===A||A,h=e.bgColor,u=void 0===h?"#CCCCCC":h,d=e.hoverColor,f=void 0===d?"#FFFFFF":d,p=e.outlineColor,m=void 0===p?"#999999":p,v=e.cornerColor,g=void 0===v?"#ffffff":v;return s(this,n),(i=t.call(this))._cubeSize=a,i._edgeSize=l,i._outline=c,i._bgColor=u,i._hoverColor=f,i._outlineColor=m,i._cornerColor=g,i._build(),i}return A(n,[{key:"_build",value:function(){var e,t=this._cubeSize-2*this._edgeSize,n=this._cubeSize/2,i=this._edgeSize,r=this._createCubeFaces(t,n),a=S(Bp.entries());try{for(a.s();!(e=a.n()).done;){var o=M(e.value,2),s=o[0],l=o[1];r.children[s].name=l.name,r.children[s].material.color.setStyle(this._bgColor),r.children[s].material.map=l.map}}catch(e){a.e(e)}finally{a.f()}this.add(r);var A,c=[],h=S(Ep.entries());try{for(h.s();!(A=h.n()).done;){var u=M(A.value,2),d=u[0],f=u[1],p=this._createCornerFaces(i,n,f.name,{color:this._bgColor});p.rotateOnAxis(new at(0,1,0),d%4*90*Lp),c.push(p)}}catch(e){h.e(e)}finally{h.f()}var m=new ja,v=new ja;this.add(m.add.apply(m,C(c.slice(0,4)))),this.add(v.add.apply(v,C(c.slice(4))).rotateOnAxis(new at(1,0,0),180*Lp));var g,y=[],w=S(Sp.entries());try{for(w.s();!(g=w.n()).done;){var x=M(g.value,2),b=x[0],B=x[1],E=this._createHorzEdgeFaces(t,i,n,B.name,{color:this._bgColor});E.rotateOnAxis(new at(0,1,0),b%4*90*Lp),y.push(E)}}catch(e){w.e(e)}finally{w.f()}var T=new ja,_=new ja;this.add(T.add.apply(T,C(y.slice(0,4)))),this.add(_.add.apply(_,C(y.slice(4))).rotateOnAxis(new at(1,0,0),180*Lp));var I,L=new ja,F=S(Tp.entries());try{for(F.s();!(I=F.n()).done;){var k=M(I.value,2),P=k[0],U=k[1],D=this._createVertEdgeFaces(i,t,n,U.name,{color:this._bgColor});D.rotateOnAxis(new at(0,1,0),90*P*Lp),L.add(D)}}catch(e){F.e(e)}finally{F.f()}this.add(L),this._outline&&this.add(this._createCubeOutline(this._cubeSize))}},{key:"addModel",value:function(e){if(this.removeModel(),this.traverse((function(e){"Mesh"==e.type?(e.material.transparent=!0,e.material.opacity=.01):"LineSegments"==e.type&&(e.material.transparent=!0,e.material.opacity=.1)})),e){e.scale1=e.scale.clone(),e.position1=e.position.clone();var t=this._cubeSize/(2*e.boundingSphere.radius);e.scale.set(t,t,t);var n=e.boundingSphere.center.clone().negate().multiplyScalar(t);e.position.copy(n),this.add(e),this.model=e}}},{key:"removeModel",value:function(){this.model&&(model.scale.copy(model.scale1),model.position.copy(model.position1),model.scale1=null,model.position1=null,this.remove(this.model),this.model=null),this.traverse((function(e){("Mesh"==e.type||"LineSegments"==e.type)&&(e.material.transparent=!1,e.material.opacity=1)}))}},{key:"_createFace",value:function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.axis,a=void 0===r?[0,1,0]:r,o=i.angle,s=void 0===o?0:o,l=i.name,A=void 0===l?"":l,c=i.matProps,h=void 0===c?{}:c;Array.isArray(e)||(e=[e,e]);var u=new Nn(h),d=new qi(e[0],e[1]),f=new Ei(d,u);return f.name=A,f.rotateOnAxis(p(at,C(a)),s*Lp),(n=f.position).set.apply(n,C(t)),f}},{key:"_createCubeFaces",value:function(e,t){var n=new zt;return n.add(this._createFace(e,[0,0,t],{axis:[0,1,0],angle:0})),n.add(this._createFace(e,[t,0,0],{axis:[0,1,0],angle:90})),n.add(this._createFace(e,[0,0,-t],{axis:[0,1,0],angle:180})),n.add(this._createFace(e,[-t,0,0],{axis:[0,1,0],angle:270})),n.add(this._createFace(e,[0,t,0],{axis:[1,0,0],angle:-90})),n.add(this._createFace(e,[0,-t,0],{axis:[1,0,0],angle:90})),n}},{key:"_createCornerFaces",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=new zt,a=t-e/2;return r.add(this._createFace(e,[a,a,t],{axis:[0,1,0],angle:0,matProps:i,name:n})),r.add(this._createFace(e,[t,a,a],{axis:[0,1,0],angle:90,matProps:i,name:n})),r.add(this._createFace(e,[a,t,a],{axis:[1,0,0],angle:-90,matProps:i,name:n})),r}},{key:"_createHorzEdgeFaces",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=new zt,o=n-t/2;return a.add(this._createFace([e,t],[0,o,n],{axis:[0,1,0],angle:0,name:i,matProps:r})),a.add(this._createFace([e,t],[0,n,o],{axis:[1,0,0],angle:-90,name:i,matProps:r})),a}},{key:"_createVertEdgeFaces",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=new zt,o=n-e/2;return a.add(this._createFace([e,t],[o,0,n],{axis:[0,1,0],angle:0,name:i,matProps:r})),a.add(this._createFace([e,t],[n,0,o],{axis:[0,1,0],angle:90,name:i,matProps:r})),a}},{key:"_createCubeOutline",value:function(e){return new jo(new ll(new Fi(e,e,e)),new Do({color:this._outlineColor,linewidth:1}))}},{key:"_createCubeOutline2",value:function(e){return new jo(new ll(new Fi(e.x,e.y,e.z)),new Do({color:this._outlineColor,linewidth:1}))}}]),n}(zt),Lp=Math.PI/180,Fp=2*Math.PI;function kp(e,t){var n=t-e,i=n-Fp,r=n+Fp;return Math.abs(n)>Math.abs(i)?i:Math.abs(n)>Math.abs(r)?r:n}function Pp(e,t){var n=t.font||"Helvetica",i=t.fontSize||30,r=t.width||512,a=t.height||512,o=t.color?t.bgColor.join(", "):"255, 255, 255, 1.0",s=t.color?t.color.join(", "):"0, 0, 0, 1.0",l=document.createElement("canvas");l.width=r,l.height=a;var A=l.getContext("2d");A.font="bold ".concat(i,"px ").concat(n),A.fillStyle="rgba(".concat(o,")"),A.fillRect(0,0,r,a);var c=A.measureText(e).width;A.fillStyle="rgba(".concat(s,")"),A.fillText(e,r/2-c/2,a/2+i/2-2);var h=new ts(l);return h.minFilter=1008,h.needsUpdate=!0,h.anisotropy=2,h}var Up={TOP:1,FRONT:2,RIGHT:3,BACK:4,LEFT:5,BOTTOM:6,TOP_FRONT_EDGE:7,TOP_RIGHT_EDGE:8,TOP_BACK_EDGE:9,TOP_LEFT_EDGE:10,FRONT_RIGHT_EDGE:11,BACK_RIGHT_EDGE:12,BACK_LEFT_EDGE:13,FRONT_LEFT_EDGE:14,BOTTOM_FRONT_EDGE:15,BOTTOM_RIGHT_EDGE:16,BOTTOM_BACK_EDGE:17,BOTTOM_LEFT_EDGE:18,TOP_FRONT_RIGHT_CORNER:19,TOP_BACK_RIGHT_CORNER:20,TOP_BACK_LEFT_CORNER:21,TOP_FRONT_LEFT_CORNER:22,BOTTOM_FRONT_RIGHT_CORNER:23,BOTTOM_BACK_RIGHT_CORNER:24,BOTTOM_BACK_LEFT_CORNER:25,BOTTOM_FRONT_LEFT_CORNER:26},Dp=function(){function e(t){s(this,e),this.viewer=t}return A(e,[{key:"init",value:function(){}},{key:"update",value:function(e){}},{key:"destory",value:function(){}}]),e}(),Rp=function(){function e(t,n){s(this,e),this.isHotSpotEntity=!0,this.options=n,this.name=t,this.init(),this.load()}return A(e,[{key:"init",value:function(){this.object=null,this.material=null,this.name=this.name,this.position=new at(0,0,0),this.options.pos&&3===this.options.pos.length?this.localPosition=new at(this.options.pos[0],this.options.pos[1],this.options.pos[2]):this.localPosition=new at(0,0,0),this.scale=new at(1,1,1),this.color=new ut(1,1,1),this.width=0,this.height=0,this.hoverColor=null}},{key:"load",value:function(){this.object=new zt}},{key:"setColor",value:function(e,t,n){this.color.x=e,this.color.y=t,this.color.z=n,this.material&&(this.material.needsUpdate=!0)}},{key:"setAlpha",value:function(e){this.color.w=e,this.material&&(this.material.needsUpdate=!0)}},{key:"onEnterHover",value:function(){this.hoverColor&&this.material&&(this.material.uniforms.color.value=this.hoverColor,this.material.needsUpdate=!0)}},{key:"onExitHover",value:function(){this.hoverColor&&this.material&&(this.material.uniforms.color.value=this.color,this.material.needsUpdate=!0)}},{key:"dispose",value:function(){this.material&&this.material.dispose(),this.material=null,this.object&&this.object.parent&&this.object.parent.remove(this.object),this.object=null}}]),e}(),Op=function(e){h(n,e);var t=y(n);function n(e,i){return s(this,n),t.call(this,e,i)}return A(n,[{key:"init",value:function(){b(u(n.prototype),"init",this).call(this),this.width=this.options.scale[0],this.height=this.options.scale[1],this.url=this.options.url,this.options.color&&4===this.options.color.length&&(this.color=new ut(this.options.color[0],this.options.color[1],this.options.color[2],this.options.color[3])),this.options.hoverColor&&4===this.options.hoverColor.length&&(this.hoverColor=new ut(this.options.hoverColor[0],this.options.hoverColor[1],this.options.hoverColor[2],this.options.hoverColor[3]))}},{key:"load",value:function(){this.createMesh(this.width,this.height,this.url)}},{key:"createMesh",value:function(e,t,n){var i=(new tA).load(n),r=e/2,a=t/2,o=[-r,-a,0,-r,a,0,r,a,0,r,-a,0],s=new si;s.setAttribute("position",new Yn(o,3)),s.setAttribute("uv",new Yn([0,0,0,1,1,1,1,0],2)),s.setIndex([0,1,2,2,3,0]);var l={};l.mainTex={value:i},l.color={value:this.color},this.material=new Ri({uniforms:l,vertexShader:this.getVertShader(),fragmentShader:this.getFragmentShader(),transparent:!0,depthWrite:!1,side:2}),s.addGroup(0,6,0),this.object=new Ei(s,[this.material]),this.object.isHotSpotEntity=!0,this.object.position.set(this.localPosition.x,this.localPosition.y,this.localPosition.z)}},{key:"getVertShader",value:function(){return"\n varying vec2 vUv;\n void main()\n {\n vUv = uv;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n }\n "}},{key:"getFragmentShader",value:function(){return"\n uniform sampler2D mainTex;\n uniform vec4 color;\n varying vec2 vUv;\n void main()\n {\n vec4 texColor = texture2D(mainTex,vUv.xy);\n vec4 col = texColor * color;\n gl_FragColor = col;\n }\n "}},{key:"dispose",value:function(){this.material&&(this.material.uniforms.mainTex&&this.material.uniforms.mainTex.value.dispose(),this.material.dispose()),this.material=null,this.object&&this.object.parent&&this.object.parent.remove(this.object),this.object=null}}]),n}(Rp),Np=function(e){h(n,e);var t=y(n);function n(e,i){return s(this,n),t.call(this,e,i)}return A(n,[{key:"init",value:function(){b(u(n.prototype),"init",this).call(this),this.backMaterial=null,this.options.backColor&&4===this.options.backColor.length?this.backColor=new ut(this.options.backColor[0],this.options.backColor[1],this.options.backColor[2],this.options.backColor[3]):this.backColor=new ut(1,1,1,1),this.options.backHoverColor&&4===this.options.backHoverColor.length&&(this.backHoverColor=new ut(this.options.backHoverColor[0],this.options.backHoverColor[1],this.options.backHoverColor[2],this.options.backHoverColor[3]))}},{key:"load",value:function(){b(u(n.prototype),"load",this).call(this);var e={};e.mainTex={value:this.material.uniforms.mainTex.value},e.color={value:this.backColor},this.backMaterial=new Ri({uniforms:e,vertexShader:this.getVertShader(),fragmentShader:this.getFragmentShader(),transparent:!0,depthWrite:!1,side:2,depthFunc:6}),this.object.geometry.addGroup(0,6,1),this.object.material.push(this.backMaterial)}},{key:"onEnterHover",value:function(){b(u(n.prototype),"onEnterHover",this).call(this),this.backHoverColor&&this.backMaterial&&(this.backMaterial.uniforms.color.value=this.backHoverColor,this.backMaterial.needsUpdate=!0)}},{key:"onExitHover",value:function(){b(u(n.prototype),"onExitHover",this).call(this),this.backHoverColor&&this.backMaterial&&(this.backMaterial.uniforms.color.value=this.backColor,this.backMaterial.needsUpdate=!0)}},{key:"dispose",value:function(){this.material&&(this.material.uniforms.mainTex&&this.material.uniforms.mainTex.value.dispose(),this.material.dispose()),this.material=null,this.backMaterial&&this.backMaterial.dispose(),this.backMaterial=null,this.object&&this.object.parent&&this.object.parent.remove(this.object),this.object=null}}]),n}(Op),zp=new(function(){function e(){s(this,e),this.fontDic=new Map}return A(e,[{key:"getFont",value:function(e,t){var n=this,i=this.fontDic.get(e);i?t(i):(new qA).load(e,(function(i){return n.fontDic.set(e,i),t(i),i}))}}]),e}()),Qp=function(e){h(n,e);var t=y(n);function n(e,i){var r;return s(this,n),(r=t.call(this,e,i)).texObj=null,r}return A(n,[{key:"init",value:function(){b(u(n.prototype),"init",this).call(this),this.text="",this.font=null,this.length=0,this.options.size?this.fontSize=this.options.size:this.fontSize=1,this.options.color&&4===this.options.color.length&&(this.color=new ut(this.options.color[0],this.options.color[1],this.options.color[2],this.options.color[3])),this.options.hoverColor&&4===this.options.hoverColor.length&&(this.hoverColor=new ut(this.options.hoverColor[0],this.options.hoverColor[1],this.options.hoverColor[2],this.options.hoverColor[3]))}},{key:"load",value:function(){this.object=new zt,this.object.name=this.name,this.refresh()}},{key:"setText",value:function(e){this.text=e+"",this.refresh()}},{key:"setFont",value:function(e){var t=this;this.fontPath=e,zp.getFont(this.fontPath,(function(e){t.font=e,t.refresh()}))}},{key:"setFontSize",value:function(e){this.fontSize=e,this.refresh()}},{key:"refresh",value:function(){if(this.font){var e=new ol(this.font.generateShapes(this.text,this.fontSize),void 0,!0);e.computeBoundingBox(),this.refreshGeometry(e),this.length=e.boundingBox.max.x-e.boundingBox.min.x,this.texObj?this.texObj.geometry=e:this.createTextMesh(e);var t=-this.length/2-e.boundingBox.min.x,n=-this.fontSize/2;this.texObj.position.set(t,n,this.fontSize/100),this.width=e.boundingBox.max.x-e.boundingBox.min.x,this.height=e.boundingBox.max.y-e.boundingBox.min.y}else this.setFont("https://sdk-localresource.laozicloud.com/helvetiker_regular.typeface.json")}},{key:"createTextMesh",value:function(e){var t={};t.color={value:this.color},this.material=new Ri({uniforms:t,vertexShader:this.getVertShader(),fragmentShader:this.getFragmentShader(),side:2,transparent:!0}),this.texObj=new Ei(e,[this.material]),this.texObj.isHotSpotEntity=!0,this.object.add(this.texObj),this.object.position.set(this.localPosition.x,this.localPosition.y,this.localPosition.z)}},{key:"refreshGeometry",value:function(e){e.addGroup(0,e.index.count,0)}},{key:"getVertShader",value:function(){return"\n varying vec2 vUv;\n void main()\n {\n vUv = uv;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n }\n "}},{key:"getFragmentShader",value:function(){return"\n uniform vec4 color;\n void main()\n {\n gl_FragColor = color;\n //gl_FragColor = vec4(1.0,0.0,0.0,1.0);\n }\n "}}]),n}(Rp),Gp=function(e){h(n,e);var t=y(n);function n(e,i){return s(this,n),t.call(this,e,i)}return A(n,[{key:"init",value:function(){b(u(n.prototype),"init",this).call(this),this.backMaterial=null,this.options.backColor&&4===this.options.backColor.length?this.backColor=new ut(this.options.backColor[0],this.options.backColor[1],this.options.backColor[2],this.options.backColor[3]):this.backColor=new ut(1,1,1,1),this.options.backHoverColor&&4===this.options.backHoverColor.length&&(this.backHoverColor=new ut(this.options.backHoverColor[0],this.options.backHoverColor[1],this.options.backHoverColor[2],this.options.backHoverColor[3]))}},{key:"createTextMesh",value:function(e){b(u(n.prototype),"createTextMesh",this).call(this,e);var t={};t.color={value:this.backColor},this.backMaterial=new Ri({uniforms:t,vertexShader:this.getVertShader(),fragmentShader:this.getFragmentShader(),transparent:!0,depthWrite:!1,side:2,depthFunc:6}),this.texObj.material.push(this.backMaterial)}},{key:"refreshGeometry",value:function(e){b(u(n.prototype),"refreshGeometry",this).call(this,e),e.addGroup(0,e.index.count,1)}},{key:"onEnterHover",value:function(){b(u(n.prototype),"onEnterHover",this).call(this),this.backHoverColor&&this.backMaterial&&(this.backMaterial.uniforms.color.value=this.backHoverColor,this.backMaterial.needsUpdate=!0)}},{key:"onExitHover",value:function(){b(u(n.prototype),"onExitHover",this).call(this),this.backHoverColor&&this.backMaterial&&(this.backMaterial.uniforms.color.value=this.backColor,this.backMaterial.needsUpdate=!0)}},{key:"dispose",value:function(){b(u(n.prototype),"dispose",this).call(this),this.backMaterial&&this.backMaterial.dispose(),this.backMaterial=null}}]),n}(Qp),Hp=new at,Vp=new bt,jp=new at,Wp=new at,Xp=function(e){h(n,e);var t=y(n);function n(){var e;return s(this,n),(e=t.call(this)).objects=[],e.click=null,e.viewMatrx=new bt,e.isAutoScale=!1,e.autoZ=0,e.ishover=!1,e.box=new tn(new at(0,0,0),new at(1,1,1)),e.hotRaycast=new Nc,e.depth=0,e.isBulletionBoard=!0,e.bindMesh=null,e.bindMeshIndex=0,e.bindOffsetPoint=null,e._tmpBindPosition=new at,e}return A(n,[{key:"getObjectByName",value:function(e){for(var t=0;t=jp.x&&t.x<=Wp.x&&t.y>=jp.y&&t.y<=Wp.y}}},{key:"onclick",value:function(){this.click&&this.click()}},{key:"onEnterHover",value:function(){this.ishover=!0;for(var e=0;e0?(m=!1,v=!0):(m=!0,v=!1),o.y<0?(p=!1,f=!0):(p=!0,f=!1),o.multiplyScalar(50),i.style.left=o.x+50+"px",i.style.top=o.y+50+"px")}))}():D&&(D.style.display="none")}}});var A=this,c={type:"change"},h=new Bt(0,0,0,"YXZ"),u=Math.PI/2,d=new at,f=!1,p=!1,m=!1,v=!1,g=!1,y=!1,w=performance.now(),x=new at,b=new at,M=new Nc;function C(){A.character.min.set(-1,-a/2,-1),A.character.max.set(1,a/2,1),A.character.translate(t.position)}function B(e){switch(e.keyCode){case 38:case 87:f=!0;break;case 37:case 65:m=!0;break;case 40:case 83:p=!0;break;case 39:case 68:v=!0;break;case 82:g=!0;break;case 70:y=!0;break;case 32:A.jump()}}function E(e){switch(e.keyCode){case 38:case 87:f=!1;break;case 37:case 65:m=!1;break;case 40:case 83:p=!1;break;case 39:case 68:v=!1;break;case 82:g=!1;break;case 70:y=!1}}function S(e){0===e.button&&document.addEventListener(ld.MOVE,_,!1)}function T(){document.removeEventListener(ld.MOVE,_,!1)}function _(e){if(!1!==A.enabled){var n=e.movementX||e.mozMovementX||e.webkitMovementX||0,i=e.movementY||e.mozMovementY||e.webkitMovementY||0;l.set(n,i,0),0!=A.rotationAngle&&l.applyAxisAngle(new AMRT.Vector3(0,0,1),A.rotationAngle*Hh.DEG2RAD),h.setFromQuaternion(t.quaternion),h.y-=l.x*A.rotateSpeed,h.x-=l.y*A.rotateSpeed,h.x=Math.max(-u,Math.min(u,h.x)),t.quaternion.setFromEuler(h),A.dispatchEvent(c)}}C();var I=new tn,L=new at;function F(e,n){if(Math.abs(n)>0){var i=t.position.clone();i.addScaledVector(e,n),L.set(0,0,0),L.addScaledVector(e,n),I.copy(A.character),I.translate(L);var r=(new at).subVectors(i,t.position).normalize();return!(A.detectEnabled&&A.collider&&function(e,t){if(M.set(e.clone(),t),M.far=A.detectDistance,(Array.isArray(A.collider)?M.intersectObjects(A.collider,!0):M.intersectObject(A.collider,!0)).length>0)return!0}(i.clone(),r))&&(t.position.copy(i),A.useGravity&&I.intersectsPlane(A.floor)?(t.position.y=-A.floor.constant+A.height/2+.1,!1):(A.movingRegion&&(t.position.x=Math.max(Math.min(t.position.x,A.movingRegion.max.x),A.movingRegion.min.x),t.position.z=Math.max(Math.min(t.position.z,A.movingRegion.max.z),A.movingRegion.min.z)),C(),!0))}}function k(e){this.preX=e.targetTouches[0].clientX,this.preY=e.targetTouches[0].clientY,document.addEventListener("touchmove",U,!1)}function P(){document.removeEventListener("touchmove",U,!1)}function U(e){if(!1!==A.enabled){var n=e.targetTouches[0].clientX-this.preX||0,i=e.targetTouches[0].clientY-this.preY||0;l.set(n,i,0),0!=A.rotationAngle&&l.applyAxisAngle(new AMRT.Vector3(0,0,1),A.rotationAngle*Hh.DEG2RAD),h.setFromQuaternion(t.quaternion),h.y-=l.x*A.rotateSpeed,h.x-=l.y*A.rotateSpeed,h.x=Math.max(-u,Math.min(u,h.x)),t.quaternion.setFromEuler(h),A.dispatchEvent(c),this.preX=e.targetTouches[0].clientX,this.preY=e.targetTouches[0].clientY}}this.setCollider=function(e){var t=this;this.collider=e;var n=Array.isArray(this.collider)?this.collider:[this.collider];this.targets=[],n.forEach((function(e){e.traverse((function(e){e.isMesh&&t.targets.push(e)}))}))},this.setRegion=function(e){A.movingRegion.setFromArray(e)},this.setFloorHeight=function(e){A.floor.constant=-e},this.setView=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};void 0!==e.position&&(Array.isArray(e.position)?t.position.fromArray(e.position):t.position.copy(e.position)),void 0!==e.rotation&&(Array.isArray(e.rotation)?t.rotation.fromArray(e.rotation):t.rotation.setFromVector3(e.rotation)),C()},this.getView=function(){return{position:t.position.toArray(),rotation:t.rotation.toArray()}},this.connect=function(){document.addEventListener(ld.START,S,!1),document.addEventListener(ld.END,T,!1),document.addEventListener("keydown",B,!1),document.addEventListener("keyup",E,!1),document.addEventListener("touchstart",k,!1),document.addEventListener("touchend",P,!1)},this.disconnect=function(){document.removeEventListener(ld.START,S,!1),document.removeEventListener(ld.END,T,!1),document.removeEventListener("keydown",B,!1),document.removeEventListener("keyup",E,!1),document.removeEventListener("touchstart",k,!1),document.removeEventListener("touchend",P,!1)},this.getDirection=function(){var e=new at(0,0,-1);return function(n){return n.copy(e).applyQuaternion(t.quaternion)}}(),this.moveForward=function(e){d.setFromMatrixColumn(t.matrix,0),d.crossVectors(t.up,d),F(d,e)},this.moveRight=function(e){d.setFromMatrixColumn(t.matrix,0),F(d,e)},this.moveUp=function(e){return d.copy(t.up),F(d,e)},this.jump=function(){x.y+=50};var D,R=function(){if(!0===A.enabled){var e=performance.now(),n=(e-w)/1e3;x.x-=10*x.x*n,x.z-=10*x.z*n,x.y-=10*x.y*n,b.z=Number(f)-Number(p),b.x=Number(v)-Number(m),b.y=Number(y)-Number(g),b.normalize(),(f||p)&&(x.z-=b.z*A.moveSpeed*n,this.moveForward(-x.z*n)),(m||v)&&(x.x-=b.x*A.moveSpeed*n,this.moveRight(-x.x*n)),this.useGravity?(x.y-=98*n,this.moveUp(x.y*n)||(x.y=0)):(g||y)&&(x.y-=b.y*A.moveSpeed*n,this.lockHeight||(t.position.y+=x.y*n,t.position.y0?(C=!1,B=!0):(C=!0,B=!1),o.y<0?(M=!1,b=!0):(M=!0,b=!1),o.multiplyScalar(50),i.style.left=o.x+50+"px",i.style.top=o.y+50+"px")}))}():Y&&(Y.style.display="none")}}});var v=this,g={type:"change"},y=new Bt(0,0,0,"YXZ"),w=Math.PI/2,x=new at,b=!1,M=!1,C=!1,B=!1,E=!1,S=!1,T=performance.now(),_=new at,I=new at,L=new Nc;function F(){v.character.min.set(-1,-d/2,-1),v.character.max.set(1,d/2,1),v.character.translate(s.position)}function k(e){switch(e.keyCode){case 38:case 87:b=!0;break;case 37:case 65:C=!0;break;case 40:case 83:M=!0;break;case 39:case 68:B=!0;break;case 82:E=!0;break;case 70:S=!0;break;case 32:v.jump()}}function P(e){switch(e.keyCode){case 38:case 87:b=!1;break;case 37:case 65:C=!1;break;case 40:case 83:M=!1;break;case 39:case 68:B=!1;break;case 82:E=!1;break;case 70:S=!1}}function U(e){0===e.button&&document.addEventListener(ld.MOVE,R,!1)}function D(){document.removeEventListener(ld.MOVE,R,!1)}function R(e){if(!1!==v.enabled){var n=e.movementX||e.mozMovementX||e.webkitMovementX||0,i=e.movementY||e.mozMovementY||e.webkitMovementY||0;m.set(n,i,0),0!=v.rotationAngle&&m.applyAxisAngle(new AMRT.Vector3(0,0,1),v.rotationAngle*Hh.DEG2RAD),y.setFromQuaternion(t.quaternion),y.y+=m.x*v.rotateSpeed,y.x-=m.y*v.rotateSpeed,y.x=Math.max(-w,Math.min(w,y.x)),t.quaternion.setFromEuler(y);var r=t.getWorldDirection(new at),a=s.getWorldPosition(new at).clone().addScaledVector(r,-l);v.dispatchEvent(g),t.position.copy(a)}}function O(e){!1!==v.enabled&&(e.deltaY<0?(--l0&&(++l>c&&(l=c),N()))}function N(e){e||(e=t.getWorldDirection(new at).negate());var n=s.getWorldPosition(new at),i=n.clone().addScaledVector(e,l);t.position.copy(i),t.lookAt(n)}F(),new tn;var z,Q=new at,G=new at;function H(e,n,i){if(Math.abs(n)>0){i=i||e,s.recalculationBound();var r=s.boundingBox,a=s.position.clone(),o=a.clone().addScaledVector(i,n*l*1e4);a.addScaledVector(e,n),Q.set(0,0,0),Q.addScaledVector(e,n),r.copy(v.character),r.translate(Q);var A=(new at).subVectors(a,s.position).normalize();if(v.detectEnabled&&v.collider&&function(e,t){if(L.set(e.clone(),t),L.far=v.detectDistance,(Array.isArray(v.collider)?L.intersectObjects(v.collider,!0):L.intersectObject(v.collider,!0)).length>0)return!0}(a.clone(),A))return!1;var c=a.clone().sub(s.position);return s.position.copy(a),t.position.add(c),t.lookAt(a),v.useGravity&&r.intersectsPlane(v.floor)?(s.position.y=-v.floor.constant+v.height/2+.1,!1):(v.movingRegion&&(s.position.x=Math.max(Math.min(s.position.x,v.movingRegion.max.x),v.movingRegion.min.x),s.position.z=Math.max(Math.min(s.position.z,v.movingRegion.max.z),v.movingRegion.min.z)),s.lookAt(o),F(),!0)}}function V(e){this.preX=e.targetTouches[0].clientX,this.preY=e.targetTouches[0].clientY,document.addEventListener("touchmove",W,!1)}function j(){document.removeEventListener("touchmove",W,!1)}function W(e){if(!1!==v.enabled){var n=e.targetTouches[0].clientX-this.preX||0,i=e.targetTouches[0].clientY-this.preY||0;m.set(n,i,0),0!=v.rotationAngle&&m.applyAxisAngle(new AMRT.Vector3(0,0,1),v.rotationAngle*Hh.DEG2RAD),y.setFromQuaternion(t.quaternion),y.y-=m.x*v.rotateSpeed,y.x-=m.y*v.rotateSpeed,y.x=Math.max(-w,Math.min(w,y.x)),t.quaternion.setFromEuler(y);var r=t.getWorldDirection(new at),a=s.getWorldPosition(new at).clone().addScaledVector(r,-l);v.dispatchEvent(g),t.position.copy(a),this.preX=e.targetTouches[0].clientX,this.preY=e.targetTouches[0].clientY}}function X(e){if(s)if(e){if(e!=z)switch(e){case"run":s.animation.play(i);break;case"up":s.animation.play(a);break;case"down":s.animation.play(o);break;case"jump":s.animation.play(r);break;default:s.animation.stop()}}else s.animation.stop();z=e}this.setCollider=function(e){var t=this;this.collider=e;var n=Array.isArray(this.collider)?this.collider:[this.collider];this.targets=[],n.forEach((function(e){e.traverse((function(e){e.isMesh&&t.targets.push(e)}))}))},this.setRegion=function(e){v.movingRegion.setFromArray(e)},this.setFloorHeight=function(e){v.floor.constant=-e},this.setView=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};void 0!==t.position&&(Array.isArray(t.position)?s.position.fromArray(t.position):s.position.copy(t.position)),void 0!==t.rotation&&(Array.isArray(t.rotation)?s.rotation.fromArray(t.rotation):s.rotation.setFromVector3(t.rotation)),void 0!==t.cameraDirection?(e=Array.isArray(t.cameraDirection)?(new at).fromArray(t.cameraDirection):(new at).copy(t.cameraDirection)).normalize().negate():((e=s.getWorldDirection(new at)).y-=.4,e.normalize().negate()),t.distance&&(l=t.distance),t.minDistance&&(A=t.minDistance),t.maxDistance&&(c=t.maxDistance),N(e),F()},this.getView=function(){return{position:s.position.toArray(),rotation:s.rotation.toArray(),cameraDirection:t.getWorldDirection(new at),distance:l,minDistance:A,maxDistance:c}},this.connect=function(){document.addEventListener(ld.START,U,!1),document.addEventListener(ld.END,D,!1),document.addEventListener("keydown",k,!1),document.addEventListener("keyup",P,!1),document.addEventListener("touchstart",V,!1),document.addEventListener("touchend",j,!1),document.addEventListener("wheel",O,!1)},this.disconnect=function(){document.removeEventListener(ld.START,U,!1),document.removeEventListener(ld.END,D,!1),document.removeEventListener("keydown",k,!1),document.removeEventListener("keyup",P,!1),document.removeEventListener("touchstart",V,!1),document.removeEventListener("touchend",j,!1),document.removeEventListener("wheel",O,!1)},this.getDirection=function(){var e=new at(0,0,-1);return function(n){return n.copy(e).applyQuaternion(t.quaternion)}}(),this.moveForward=function(e){x.setFromMatrixColumn(t.matrix,2),x.y=0,x.normalize().negate(),H(x,e)},this.moveRight=function(e){x.setFromMatrixColumn(t.matrix,0),x.y=0,x.normalize().negate(),H(x,-e)},this.moveUp=function(e){return x.set(0,1,0),G.setFromMatrixColumn(t.matrix,2),G.y=0,G.normalize().negate(),H(x,e,G)},this.jump=function(){_.y+=50};var Y,K=function(){if(!0===v.enabled){var e=performance.now(),t=(e-T)/1e3;_.x-=10*_.x*t,_.z-=10*_.z*t,_.y-=10*_.y*t,I.z=Number(b)-Number(M),I.x=Number(B)-Number(C),I.y=Number(S)-Number(E),I.normalize(),b||M||C||B?((b||M)&&(_.z-=I.z*v.moveSpeed*t,this.moveForward(-_.z*t)),(C||B)&&(_.x-=I.x*v.moveSpeed*t,this.moveRight(-_.x*t)),X("run")):this.useGravity||E||S?this.useGravity?(_.y-=98*t,this.moveUp(_.y*t)||(_.y=0),X("jump")):(E||S)&&(_.y-=I.y*v.moveSpeed*t,this.lockHeight||(this.moveUp(_.y*t),s.position.y0?X("up"):X("down"))):X("stop"),T=e}}.bind(this)}$p.prototype=Object.create(Je.prototype),$p.prototype.constructor=$p,em.prototype=Object.create(Je.prototype),em.prototype.constructor=em;var tm=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s(this,n),(i=t.call(this)).containerRect=null,i.camera=null,i.renderManager=null,i.sceneManager=null,i.disposed=!1,i.composer=null,i.moduleManager=null,i.controls=null,i.onControlsChange=null,i._options=r,e.constructor===String&&(e=document.querySelector("#"+e)||document.querySelector("."+e)),i.container=e||document.body,!r.nv){if(cu.init(r),r.offline)return g(i);if(void 0!==r.offlinekey)cu.offlineValidation((function(e){if(!e)throw new Error("授权失败!请检查您的开发者凭证。")}));else{var a=cu.checkDevloper();a?cu.token=a:i.dispose()}}return Object.defineProperty(window,"__viewer",{writable:!0,value:v(i)}),i}return A(n,[{key:"renderer",get:function(){return this.renderManager.defaultRenderer}},{key:"render",get:function(){return this.renderManager.render.bind(this.renderManager)}},{key:"domElement",get:function(){return this.renderManager.domElement}},{key:"scene",get:function(){return this.sceneManager.scene}},{key:"root",get:function(){return this.sceneManager.root}},{key:"modelGroup",get:function(){return this.sceneManager.modelGroup}},{key:"setSkyBox",get:function(){return this.sceneManager.setSkyBox.bind(this.sceneManager)}},{key:"setBackground",get:function(){return this.sceneManager.setBackground.bind(this.sceneManager)}},{key:"clearBackground",get:function(){return this.sceneManager.clearBackground.bind(this.sceneManager)}},{key:"loadSceneData",get:function(){return this.sceneManager.loadSceneData.bind(this.sceneManager)}},{key:"saveSceneData",get:function(){return this.sceneManager.saveSceneData.bind(this.sceneManager)}},{key:"fitCamera",get:function(){return this.sceneManager.fitCamera.bind(this.sceneManager)}},{key:"add",get:function(){return this.modelManager.add.bind(this.modelManager)}},{key:"remove",get:function(){return this.modelManager.remove.bind(this.modelManager)}},{key:"loadModel",get:function(){return this.modelManager.loadModel.bind(this.modelManager)}},{key:"initialize",value:function(e){var t=this;this.containerRect=this.container.getBoundingClientRect(),this.camera=new Ni(50,this.containerRect.width/this.containerRect.height,1,5e3),this.camera.position.set(0,0,1),this.renderManager=fd.create(this,e),this.renderManager.setCamera(this.camera),this.moduleManager=new qp(this),this.moduleManager.init(),this.renderManager.moduleManager=this.moduleManager,this.sceneManager=lp.create(this),this.modelManager=$f.create(this),this.renderManager.scene=this.scene,this.renderManager.camera=this.camera,this.renderManager.defaultCamera=this.camera,this.sceneManager.camera=this.camera,this.composer=new od(this),e.isMap?(this.renderer.domElement.style.pointerEvents="none",this.renderer.domElement.style.position="absolute",this.renderer.domElement.style.top=0,this.renderer.domElement.style.left=0,this.renderManager.setLoop(!1)):(this.renderManager.render(!0),this._initControls(),window.addEventListener("resize",(function(){t.resize()}),!1),this.container.addEventListener("resize",(function(){t.resize()}),!1)),this._proxyEvent()}},{key:"_initControls",value:function(){var e=this;this.controls=new yp(this),this.controls.screenSpacePanning=!0,this.controls.addEventListener(ld.CHANGE,(function(){e.sceneManager.lightFollow&&(e.sceneManager.directLight.position.copy(e.camera.position),e.sceneManager.updateShadowMaterial()),e.onControlsChange&&e.onControlsChange()})),this.controls.addEventListener(yp.VIEW_CHANGE,(function(t){e.controls.setViewMode(t.data)})),this.camera.defaultPos=this.camera.position.clone(),this.renderManager.addAfterRenderTask(this.controls.update.bind(this.controls)),this.firstPersonControls=new $p(this),this.threePersonControls=new em(this),this.viewCubeControls=new _p(this.container,30,5,this.controls),this.viewCubeControlsUpdate=this.viewCubeControls.update.bind(this.viewCubeControls),this.hideViewCube()}},{key:"_proxyEvent",value:function(){var e=this;this.renderManager.addEventListener(ld.UPDATE,(function(){e.controls.update(),e.dispatchEvent(ld.UPDATE)})),this.modelManager.addEventListener(ld.MODEL_UPDATE,(function(){e.dispatchEvent(ld.MODEL_UPDATE)}));var t=new tt,n=new tt;this.domElement.addEventListener("mousedown",(function(e){t.set(e.clientX,e.clientY)})),this.domElement.addEventListener("mouseup",(function(i){n.set(i.clientX,i.clientY),t.distanceTo(n)<5&&e.dispatchEvent(ld.CLICK,i)}))}},{key:"resize",value:function(){this.containerRect=this.container.getBoundingClientRect(),this.camera.aspect=this.containerRect.width/this.containerRect.height,this.camera.updateProjectionMatrix(),this.domElement.style.width=this.containerRect.width+"px",this.domElement.style.height=this.containerRect.height+"px",this.renderManager.resize()}},{key:"dispatchEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;b(u(n.prototype),"dispatchEvent",this).call(this,{type:e,data:t})}},{key:"getComponentInfo",value:function(e,t){e.traverseAncestors((function(n){n.isBIM&&n.getComponentInfo(e,t)}))}},{key:"showViewCube",value:function(){this.viewCubeControls.domElement.style.display="block",this.renderManager.addAfterRenderTask(this.viewCubeControlsUpdate)}},{key:"hideViewCube",value:function(){this.viewCubeControls.domElement.style.display="none",this.renderManager.removeAfterRenderTask(this.viewCubeControlsUpdate)}},{key:"setViewCube",value:function(e){this.viewCubeControls._cube.addModel(e)}},{key:"resetViewCube",value:function(){this.viewCubeControls._cube.removeModel()}},{key:"dispose",value:function(){this.sceneManager.dispose(),this.renderManager.dispose(),this.controls.dispose(),this.composer.dispose(),this.disposed=!0,this.container.innerHTML=""}}]),n}(Je);function nm(e,t,n,i){if(e instanceof Oi){console.warn("DragControls: Constructor now expects ( objects, camera, domElement )");var r=e;e=t,t=r}var a=new vn,o=new Nc;new tt;var s=new at,l=new at,A=new at,c=new bt,h=null,u=this;function d(){n.addEventListener("mousemove",p,!1),n.addEventListener("mousedown",m,!1),n.addEventListener("mouseup",v,!1),n.addEventListener("mouseleave",v,!1),n.addEventListener("touchmove",p,!1),n.addEventListener("touchstart",m,!1),n.addEventListener("touchend",v,!1)}function f(){n.removeEventListener("mousemove",p,!1),n.removeEventListener("mousedown",m,!1),n.removeEventListener("mouseup",v,!1),n.removeEventListener("mouseleave",v,!1),n.removeEventListener("touchmove",p,!1),n.removeEventListener("touchstart",m,!1),n.removeEventListener("touchend",v,!1)}function p(e){if(e.preventDefault(),g(e),h&&u.enabled)return o.ray.intersectPlane(a,l)&&h.position.copy(l.sub(s).applyMatrix4(c)),void u.dispatchEvent({type:"drag",object:h})}function m(e){e.preventDefault(),g(e),function(e,i){e.length>0&&(h=e[0].object,r=h,d=A.setFromMatrixPosition(r.matrixWorld),a.setFromNormalAndCoplanarPoint(t.getWorldDirection(a.normal),d),o.ray.intersectPlane(a,l)&&(c.getInverse(h.parent.matrixWorld),s.copy(l).sub(A.setFromMatrixPosition(h.matrixWorld))),n.style.cursor="move",u.dispatchEvent({type:"dragstart",object:h}));var r,d}(i.intersectModels(e))}function v(e){e.preventDefault(),u.dispatchEvent({type:"dragend",object:h}),h=null,n.style.cursor="auto"}function g(e){e=If.getTouchByEvent(e);var i=If.getDomMouse(e,n);o.setFromCamera(i,t)}d(),this.enabled=!0,this.activate=d,this.deactivate=f,this.dispose=function(){f()}}nm.prototype=Object.create(Je.prototype),nm.prototype.constructor=nm;var im,rm,am,om=new at,sm=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this)).viewer=e,i._enabled=!1,i._enableDrag=!1,i._startPoint=new tt,i._selected=null,i.selectedColor="#b2ac00",i.objects=[],i.dragControls=new nm(i.viewer.modelGroup,i.viewer.camera,i.viewer.domElement,i.viewer),i.dragControls.deactivate(),i.dragControls.enabled=!1,i.onChange=function(){},i._initEvents(),i}return A(n,[{key:"single",set:function(e){this._single=!!e}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e,this._initData()}},{key:"enableDrag",get:function(){return this._enableDrag},set:function(e){this._enableDrag=e,this.dragControls.enabled=e,this._enableDrag?this.dragControls.activate():this.dragControls.deactivate()}},{key:"_initEvents",value:function(){var e=this;this.viewer.domElement.addEventListener(ld.START,(function(t){t.constructor===MouseEvent&&0!==t.button||(t=If.getTouchByEvent(t),e._startPoint.set(t.clientX,t.clientY))})),this.viewer.domElement.addEventListener(ld.END,(function(t){if(t.constructor!==MouseEvent||0===t.button){t=If.getTouchByEvent(t);var n=e._startPoint.distanceTo(new tt(t.clientX,t.clientY));e.enabled&&!e._enableDrag&&n<5&&e.viewer.intersectModels(t,e._rayCasterHandler,e,e.viewer.scene)}})),this.dragControls.addEventListener("dragstart",(function(t){e.enableDrag&&(e.selected=t.object,e.viewer.controls.enabled=!1,e.selected&&om.copy(e.selected.position))})),this.dragControls.addEventListener("dragend",(function(t){e.enableDrag&&(e.viewer.controls.enabled=!0,e.selected&&!om.equals(e.selected.position)&&(e.onChange(),om.copy(e.selected.position)))})),this.viewer.addEventListener(ld.MODEL_UPDATE,(function(){e._enabled&&e._initData()}))}},{key:"_rayCasterHandler",value:function(e){e.length>0&&this.selected!=e[0].object?e[0].object.isHotSpotEntity||(this.selected=e[0].object,this.dispatchEvent(ld.CHANGE,this.selected)):0===e.length&&this.selected&&(this.selected=null,this.dispatchEvent(ld.CHANGE,this.selected))}},{key:"selected",get:function(){return this._selected},set:function(e){var t=this;if(this.selected&&(this.selected.material=this.selected.material0,this.selected.transparent&&(this.selected.material=this._cloneMate(this.selected.material),this.transparent(this.selected))),this._selected=e,!this._selected)return this.viewer.composer.enableOutline=!1,this.viewer.composer.outline.pass.edgeThickness=2,void(this.viewer.composer.outline.pass.edgeStrength=6.5);(this.viewer.composer.enableOutline||(this.viewer.composer.enableOutline=!0,this.viewer.composer.outline.pass.edgeThickness=1,this.viewer.composer.outline.pass.edgeStrength=4.5),this._selected.isMesh||this._selected.intanceObject)&&(this._selected.material=this._cloneMate(this._selected.material),(Array.isArray(this._selected.material)?this._selected.material:[this._selected.material]).forEach((function(e){e.isAMRTBasicMaterial&&e.color.setStyle(t.selectedColor)})),this._selected.transparent&&this.transparent(this._selected),this.viewer.composer.outline.pass.selectedObjects=[this._selected])}},{key:"unSelected",value:function(e){e.isMesh&&(e.material=e.material0)}},{key:"toggleDisplay",value:function(){this.objects.forEach((function(e){e.visible=!e.visible})),this.viewer.renderManager.render(),this.onChange()}},{key:"hide",value:function(){this.selected&&(this.selected&&(this.selected.visible=!1),this.onChange())}},{key:"showAlone",value:function(){this.selected&&(this.objects.forEach((function(e){e.visible=!1})),this.selected.visible=!0,this.onChange())}},{key:"showAll",value:function(){this.objects.forEach((function(e){e.visible=!0})),this.onChange()}},{key:"transparent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selected;if(e){e.transparent=!0;var t=Array.isArray(e.material)?e.material:[e.material];t.forEach((function(e){e.isAMRTBasicMaterial&&(e.opacity0=void 0!==e.opacity0?e.opacity0:e.opacity,e.transparent0=void 0!==e.transparent0?e.transparent0:e.transparent,e.opacity=.15,e.transparent=!0)}))}this.onChange()}},{key:"unTransparent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selected;e&&(Array.isArray(e.material)?e.material.forEach((function(e){e.isAMRTBasicMaterial&&(e.opacity=e.opacity0,e.transparent=e.transparent0)})):(e.material.opacity=void 0!==e.material.opacity0?e.material.opacity0:1,e.material.transparent=e.material.transparent0),e.transparent=!1),this.onChange()}},{key:"translucenceOthers",value:function(e){var t=this;this.objects.forEach((function(n){n!==e&&n.visible&&t.transparent(n)}))}},{key:"restore",value:function(){var e=this;this.objects.forEach((function(t){e.restoreObject(t)})),this.onChange(),this.selected=null}},{key:"restoreObject",value:function(e){e&&(e.visible||(e.visible=!0),this.restoreMaterial(e),this.restorePosition(e),e.transparent=e.transparent0,e==this.selected&&(this.selected=null))}},{key:"restoreMaterial",value:function(e){e&&(e.material=e.material0,(Array.isArray(e.material)?e.material:[e.material]).forEach((function(e){e.isAMRTBasicMaterial&&(e.opacity=e.opacity0,e.transparent=e.transparent0)})),this.viewer.renderManager.render())}},{key:"restorePosition",value:function(e){e&&e.position.copy(e.position0)}},{key:"dispose",value:function(){this.dragControls.enabled=!1,this.dragControls.deactivate()}},{key:"_initData",value:function(){var e=this;this.objects=[],this.viewer.modelGroup.traverse((function(t){t.isMesh&&(e.objects.push(t),t.material0||(t.position0=t.position.clone(),(Array.isArray(t.material)?t.material:[t.material]).forEach((function(e){e.isAMRTBasicMaterial&&(e.opacity0=e.opacity,e.transparent0=e.transparent)})),t.material0=t.material))}))}},{key:"_cloneMate",value:function(e){var t;return Array.isArray(e)?(t=[],e.forEach((function(e){if(e.isAMRTBasicMaterial){var n=e.clone();n.opacity0=e.opacity0,n.transparent0=e.transparent0,t.push(n)}else t.push(e)}))):((t=e.clone()).opacity0=e.opacity0,t.transparent0=e.transparent0),t}}]),n}(Cd),lm=function(){var e=new Wi,t=new at,n=new at,i=new at,r=new at,a=new at,o=new at,s=new at,l=new at,A=new at,c=new at,h=new at,u=new at,d=new at,f=new at;function p(e,t,n){this.camera=e,this.scene=t,this.startPoint=new at,this.endPoint=new at,this.collection=[],this.deep=n||Number.MAX_VALUE}return p.prototype.select=function(t,n){return this.startPoint=t||this.startPoint,this.endPoint=n||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(e,this.scene),this.collection},p.prototype.updateFrustum=function(t,p){if(t=t||this.startPoint,p=p||this.endPoint,t.x===p.x&&(p.x+=Number.EPSILON),t.y===p.y&&(p.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera)n.copy(t),n.x=Math.min(t.x,p.x),n.y=Math.max(t.y,p.y),p.x=Math.max(t.x,p.x),p.y=Math.min(t.y,p.y),i.setFromMatrixPosition(this.camera.matrixWorld),r.copy(n),a.set(p.x,n.y,0),o.copy(p),s.set(n.x,p.y,0),r.unproject(this.camera),a.unproject(this.camera),o.unproject(this.camera),s.unproject(this.camera),u.copy(r).sub(i),d.copy(a).sub(i),f.copy(o).sub(i),u.normalize(),d.normalize(),f.normalize(),u.multiplyScalar(this.deep),d.multiplyScalar(this.deep),f.multiplyScalar(this.deep),u.add(i),d.add(i),f.add(i),(m=e.planes)[0].setFromCoplanarPoints(i,r,a),m[1].setFromCoplanarPoints(i,a,o),m[2].setFromCoplanarPoints(o,s,i),m[3].setFromCoplanarPoints(s,r,i),m[4].setFromCoplanarPoints(a,o,s),m[5].setFromCoplanarPoints(f,d,u),m[5].normal.multiplyScalar(-1);else if(this.camera.isOrthographicCamera){var m,v=Math.min(t.x,p.x),g=Math.max(t.y,p.y),y=Math.max(t.x,p.x),w=Math.min(t.y,p.y);r.set(v,g,-1),a.set(y,g,-1),o.set(y,w,-1),s.set(v,w,-1),l.set(v,g,1),A.set(y,g,1),c.set(y,w,1),h.set(v,w,1),r.unproject(this.camera),a.unproject(this.camera),o.unproject(this.camera),s.unproject(this.camera),l.unproject(this.camera),A.unproject(this.camera),c.unproject(this.camera),h.unproject(this.camera),(m=e.planes)[0].setFromCoplanarPoints(r,l,A),m[1].setFromCoplanarPoints(a,A,c),m[2].setFromCoplanarPoints(c,h,s),m[3].setFromCoplanarPoints(h,l,r),m[4].setFromCoplanarPoints(a,o,s),m[5].setFromCoplanarPoints(c,A,l),m[5].normal.multiplyScalar(-1)}else console.error("SelectionBox: Unsupported camera type.")},p.prototype.searchChildInFrustum=function(e,n){if("_shadow.mesh"!=n.name&&((n.isMesh||n.isLine||n.isPoints)&&void 0!==n.material&&(null===n.geometry.boundingSphere&&n.geometry.computeBoundingSphere(),t.copy(n.geometry.boundingSphere.center),t.applyMatrix4(n.matrixWorld),e.containsPoint(t)&&this.collection.push(n)),n.children.length>0))for(var i=0;i0&&(r.boxSelected.length=0,r.clearBoxSelected()),im.intersectModels(e,(function(e){if(r.enableMutilpeSelection){r._onChange(null);var t=e[0]?e[0].object:null;t&&(r.boxSelected.includes(t)?(t.material=t.material_0,r.boxSelected.remove(t)):(t.material=t.material.map((function(e){return e.isAMRTShadowMaterial?e:ym})),r.boxSelected.push(t)))}else r._onChange(e.length>0?e[0]:null)}),v(r)))}})),n&&n.isModel&&r.setTarget(n),r}return A(i,[{key:"newMaterials",get:function(){return um}},{key:"materials",get:function(){return dm}},{key:"mode",get:function(){return cm},set:function(e){cm=e,this.selectedMaterial=null,this.selected=null,im.composer.outline.pass.selectedObjects=pm=[]}},{key:"enabled",get:function(){return hm},set:function(e){hm!=e&&(e?(im.composer.enableOutline=!0,im.composer.outline.pass.edgeGlow=0,im.composer.outline.pass.edgeThickness=1,im.composer.outline.pass.edgeStrength=4.5):(im.composer.enableOutline=!1,im.composer.outline.pass.edgeGlow=1,im.composer.outline.pass.edgeThickness=2,im.composer.outline.pass.edgeStrength=6.5,this.selected=null,this.selectedMaterial=null,fm=[],dm=[],pm=[],mm={}),hm=e)}},{key:"enableBoxSelection",get:function(){return vm},set:function(e){e!==vm&&(e?(rm||(rm=new lm(im.camera,im.modelGroup)),am||(am=new Am(rm,im.renderer,"selectBox")),this.selectionBox=rm,am.enabled=!0,am.element.style.display="block",im.controls.enabled=!1):(am.enabled=!1,im.controls.enabled=!0,am.element.style.display="none"),vm=e)}},{key:"enableMutilpeSelection",get:function(){return gm},set:function(e){e!==gm&&(gm=e)}},{key:"clearBoxSelected",value:function(){fm.map((function(e){e.material[0]===ym&&e.material_0&&(e.material=e.material_0)}))}},{key:"_onChange",value:function(e){var t=e?e.object:null;if(t){var n,i=e.faceIndex;t.geometry.groups.forEach((function(e){i>=e.start&&i0&&this.boxSelected.map((function(e){return e.visible=!1})),e&&fm.map((function(t){t.material.forEach((function(n){e.id!==n.id&&e.ID!==n.re||(t.visible=!1)}))}))}},{key:"show",value:function(e){(this.selectedMaterial||e)&&(e=e?dm.find((function(t){return t.id===e.id})):this.selectedMaterial,fm.forEach((function(t){t.material.find((function(t){return t.id===e.id||t.re===e.ID}))&&(t.visible=!0,t.material.map((function(e){return e.visible=!0})))})))}},{key:"showAll",value:function(){fm.forEach((function(e){e.visible||(e.visible=!0)}))}},{key:"showIndependent",value:function(e){(this.selectedMaterial||e)&&(e=e?dm.find((function(t){return t.id===e.id})):this.selectedMaterial,fm.forEach((function(t){t.visible=Boolean(t.material.find((function(t){return t.id===e.id||t.re===e.ID})))})))}},{key:"toggleDisplay",value:function(){fm.forEach((function(e){e.visible=!e.visible}))}},{key:"setColor",value:function(e){this._applyParams("color",e,"color")}},{key:"getColor",value:function(){return this._getParams("color")}},{key:"setRepeat",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.albedo&&this.selectedMaterial.albedo.repeat.set(e,t),im.renderManager.render()}},{key:"getRepeat",value:function(){if(this.selectedMaterial&&this.selectedMaterial.albedo)return this.selectedMaterial.albedo.repeat}},{key:"setRotation",value:function(e){this.selectedMaterial&&this.selectedMaterial.albedo&&(this.selectedMaterial.albedo.rotation=Math.PI/180*e),im.renderManager.render()}},{key:"getRotation",value:function(){if(this.selectedMaterial&&this.selectedMaterial.albedo)return 180*this.selectedMaterial.albedo.rotation/Math.PI}},{key:"setOffset",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.albedo&&this.selectedMaterial.albedo.offset.set(e,t),im.renderManager.render()}},{key:"getOffset",value:function(e){if(this.selectedMaterial&&this.selectedMaterial.albedo)return this.selectedMaterial.albedo.offset}},{key:"setAlbedoMap",value:function(e){this._applyParams("albedo",e,"map"),im.renderManager.render()}},{key:"getAlbedoMap",value:function(){return this._getParams("albedo")}},{key:"clearAlbedoMap",value:function(){this.selectedMaterial&&(this.selectedMaterial.albedo=null,this.selectedMaterial.needsUpdate=!0,im.renderManager.render())}},{key:"setAlbedoUV",value:function(e){this._applyParams("albedoUV",parseInt(e)),im.renderManager.render()}},{key:"getAlbedoUV",value:function(){return Number(this._getParams("albedoUV"))}},{key:"setNormalMap",value:function(e){this._applyParams("normalMap",e,"map")}},{key:"getNormalMap",value:function(){return this._getParams("normalMap")}},{key:"setNormalScale",value:function(e){this._applyParams("normalScale",e)}},{key:"getNormalScale",value:function(){return this._getParams("normalScale")}},{key:"setNormalRepeat",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.normalMap&&this.selectedMaterial.normalMap.repeat.set(e,t),im.renderManager.render()}},{key:"getNormalRepeat",value:function(){if(this.selectedMaterial&&this.selectedMaterial.normalMap)return this.selectedMaterial.normalMap.repeat}},{key:"setNormalRotation",value:function(e){this.selectedMaterial&&this.selectedMaterial.normalMap&&(this.selectedMaterial.normalMap.rotation=Math.PI/180*e),im.renderManager.render()}},{key:"getNormalRotation",value:function(){if(this.selectedMaterial&&this.selectedMaterial.normalMap)return 180*this.selectedMaterial.normalMap.rotation/Math.PI}},{key:"setNormalOffset",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.normalMap&&this.selectedMaterial.normalMap.offset.set(e,t),im.renderManager.render()}},{key:"getNormalOffset",value:function(e){if(this.selectedMaterial&&this.selectedMaterial.normalMap)return this.selectedMaterial.normalMap.offset}},{key:"setNormal2Map",value:function(e){this._applyParams("normalMap2",e,"map")}},{key:"getNormal2Map",value:function(){return this._getParams("normalMap2")}},{key:"setNormal2Scale",value:function(e){this._applyParams("normalScale2",e)}},{key:"getNormal2Scale",value:function(){return this._getParams("normalScale2")}},{key:"setNormal2Repeat",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.normalMap2&&this.selectedMaterial.normalMap2.repeat.set(e,t),im.renderManager.render()}},{key:"getNormal2Repeat",value:function(){if(this.selectedMaterial&&this.selectedMaterial.normalMap2)return this.selectedMaterial.normalMap2.repeat}},{key:"setNormal2Rotation",value:function(e){this.selectedMaterial&&this.selectedMaterial.normalMap2&&(this.selectedMaterial.normalMap2.rotation=Math.PI/180*e),im.renderManager.render()}},{key:"setSide",value:function(e){e<0||e>2||this._applyParams("side",e)}},{key:"getSide",value:function(){return this.selectedMaterial.side}},{key:"getNormal2Rotation",value:function(){if(this.selectedMaterial&&this.selectedMaterial.normalMap2)return 180*this.selectedMaterial.normalMap2.rotation/Math.PI}},{key:"setNormal2Offset",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.normalMap2&&this.selectedMaterial.normalMap2.offset.set(e,t),im.renderManager.render()}},{key:"getNormal2Offset",value:function(e){if(this.selectedMaterial&&this.selectedMaterial.normalMap2)return this.selectedMaterial.normalMap2.offset}},{key:"setMetallicMap",value:function(e){this._applyParams("metallicMap",e,"map")}},{key:"setMetallicRepeat",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.metallicMap&&this.selectedMaterial.metallicMap.repeat.set(e,t),im.renderManager.render()}},{key:"getMetallicRepeat",value:function(){if(this.selectedMaterial&&this.selectedMaterial.metallicMap)return this.selectedMaterial.metallicMap.repeat}},{key:"setMetallicRotation",value:function(e){this.selectedMaterial&&this.selectedMaterial.metallicMap&&(this.selectedMaterial.metallicMap.rotation=Math.PI/180*e),im.renderManager.render()}},{key:"getMetallicRotation",value:function(){if(this.selectedMaterial&&this.selectedMaterial.metallicMap)return 180*this.selectedMaterial.metallicMap.rotation/Math.PI}},{key:"setMetallicOffset",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.metallicMap&&this.selectedMaterial.metallicMap.offset.set(e,t),im.renderManager.render()}},{key:"getMetallicOffset",value:function(e){this.selectedMaterial&&this.selectedMaterial.metallicMap&&this.selectedMaterial.metallicMap.offset}},{key:"setMetallic",value:function(e){this._applyParams("metallic",e)}},{key:"getMetallic",value:function(){return this._getParams("metallic")}},{key:"setRoughnessMap",value:function(e){this._applyParams("roughnessMap",e,"map")}},{key:"setRoughnessRepeat",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.roughnessMap&&this.selectedMaterial.roughnessMap.repeat.set(e,t),im.renderManager.render()}},{key:"getRoughnessRepeat",value:function(){if(this.selectedMaterial&&this.selectedMaterial.roughnessMap)return this.selectedMaterial.roughnessMap.repeat}},{key:"setRoughnessRotation",value:function(e){this.selectedMaterial&&this.selectedMaterial.roughnessMap&&(this.selectedMaterial.roughnessMap.rotation=Math.PI/180*e),im.renderManager.render()}},{key:"getRoughnessRotation",value:function(){return this.selectedMaterial&&this.selectedMaterial.roughnessMap?180*this.selectedMaterial.roughnessMap.rotation/Math.PI:null}},{key:"setRoughnessOffset",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.roughnessMap&&this.selectedMaterial.roughnessMap.offset.set(e,t),im.renderManager.render()}},{key:"getRoughnessOffset",value:function(){return this.selectedMaterial&&this.selectedMaterial.roughnessMap?this.selectedMaterial.roughnessMap.offset:null}},{key:"setSmoothness",value:function(e){this._applyParams("smoothness",e)}},{key:"getSmoothness",value:function(){return this._getParams("smoothness")}},{key:"setAOMap",value:function(e,t){this._applyParams("aoMap",e,"map")}},{key:"clearAOMap",value:function(){this.selectedMaterial?(this.selectedMaterial.aoMap=null,this.selectedMaterial.needsUpdate=!0,im.renderManager.render()):this.onError("未选择材质对象")}},{key:"getAOMap",value:function(){return this._getParams("aoMap")}},{key:"setAORepeat",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.aoMap&&this.selectedMaterial.aoMap.repeat.set(e,t),im.renderManager.render()}},{key:"getAORepeat",value:function(){if(this.selectedMaterial&&this.selectedMaterial.aoMap)return this.selectedMaterial.aoMap.repeat}},{key:"setAORotation",value:function(e){this.selectedMaterial&&this.selectedMaterial.aoMap&&(this.selectedMaterial.aoMap.rotation=Math.PI/180*e),im.renderManager.render()}},{key:"getAORotation",value:function(){if(this.selectedMaterial&&this.selectedMaterial.aoMap)return 180*this.selectedMaterial.aoMap.rotation/Math.PI}},{key:"setAOOffset",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.aoMap&&this.selectedMaterial.aoMap.offset.set(e,t),im.renderManager.render()}},{key:"getAOOffset",value:function(e){if(this.selectedMaterial&&this.selectedMaterial.aoMap)return this.selectedMaterial.aoMap.offset}},{key:"setAOScale",value:function(e){this._applyParams("aoScale",e)}},{key:"getAOScale",value:function(){return this._getParams("aoScale")}},{key:"setAOUV",value:function(e){this._applyParams("aoUV",parseInt(e))}},{key:"getAOUV",value:function(){return this._getParams("aoUV")}},{key:"setEmissiveMap",value:function(e){this._applyParams("emissiveMap",e,"map")}},{key:"setEmissiveRepeat",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.emissiveMap&&this.selectedMaterial.emissiveMap.repeat.set(e,t),im.renderManager.render()}},{key:"getEmissiveRepeat",value:function(){if(this.selectedMaterial&&this.selectedMaterial.emissiveMap)return this.selectedMaterial.emissiveMap.repeat}},{key:"setEmissiveRotation",value:function(e){this.selectedMaterial&&this.selectedMaterial.emissiveMap&&(this.selectedMaterial.emissiveMap.rotation=Math.PI/180*e),im.renderManager.render()}},{key:"getEmissiveRotation",value:function(){if(this.selectedMaterial&&this.selectedMaterial.emissiveMap)return 180*this.selectedMaterial.emissiveMap.rotation/Math.PI}},{key:"setEmissiveOffset",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.emissiveMap&&this.selectedMaterial.emissiveMap.offset.set(e,t),im.renderManager.render()}},{key:"getEmissiveOffset",value:function(e){if(this.selectedMaterial&&this.selectedMaterial.emissiveMap)return this.selectedMaterial.emissiveMap.offset}},{key:"setEmissiveColor",value:function(e){this._applyParams("emissive",e,"color")}},{key:"getEmissiveColor",value:function(){return this._getParams("emissive")}},{key:"setEmissiveUV",value:function(e){this._applyParams("emissiveUV",e)}},{key:"getEmissiveUV",value:function(){return this._getParams("emissiveUV")}},{key:"setReflectMap",value:function(e){this._applyParams("reflectMap",e,"map")}},{key:"setReflectRepeat",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.reflectMap&&this.selectedMaterial.reflectMap.repeat.set(e,t),im.renderManager.render()}},{key:"getReflectRepeat",value:function(){if(this.selectedMaterial&&this.selectedMaterial.reflectMap)return this.selectedMaterial.reflectMap.repeat}},{key:"setReflectRotation",value:function(e){this.selectedMaterial&&this.selectedMaterial.reflectMap&&(this.selectedMaterial.reflectMap.rotation=Math.PI/180*e),im.renderManager.render()}},{key:"getReflectRotation",value:function(){if(this.selectedMaterial&&this.selectedMaterial.reflectMap)return 180*this.selectedMaterial.reflectMap.rotation/Math.PI}},{key:"setReflectOffset",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.reflectMap&&this.selectedMaterial.reflectMap.offset.set(e,t),im.renderManager.render()}},{key:"getReflectOffset",value:function(e){if(this.selectedMaterial&&this.selectedMaterial.reflectMap)return this.selectedMaterial.reflectMap.offset}},{key:"setReflectIntensity",value:function(e){this._applyParams("reflectIntensity",e)}},{key:"getReflectIntensity",value:function(){return this._getParams("reflectIntensity")}},{key:"setReflectivity",value:function(e){this._applyParams("reflectivity",e)}},{key:"getReflectivity",value:function(){return this._getParams("reflectivity")}},{key:"setAlphaMap",value:function(e){this._applyParams("alphaMap",e,"map")}},{key:"setAlphaMapRepeat",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.alphaMap&&this.selectedMaterial.alphaMap.repeat.set(e,t)}},{key:"getAlphaMapRepeat",value:function(){if(this.selectedMaterial&&this.selectedMaterial.alphaMap)return this.selectedMaterial.alphaMap.repeat}},{key:"setAlphaMapRotation",value:function(e){this.selectedMaterial&&this.selectedMaterial.alphaMap&&(this.selectedMaterial.alphaMap.rotation=Math.PI/180*e)}},{key:"getAlphaMapRotation",value:function(){if(this.selectedMaterial&&this.selectedMaterial.alphaMap)return 180*this.selectedMaterial.alphaMap.rotation/Math.PI}},{key:"setAlphaMapOffset",value:function(e,t){this.selectedMaterial&&this.selectedMaterial.alphaMap&&this.selectedMaterial.alphaMap.offset.set(e,t)}},{key:"getAlphaMapOffset",value:function(){if(this.selectedMaterial&&this.selectedMaterial.alphaMap)return this.selectedMaterial.alphaMap.offset}},{key:"setRefractionRatio",value:function(e){this._applyParams("refractionRatio",e)}},{key:"getRefractionRatio",value:function(){return this._getParams("refractionRatio")}},{key:"setTransparency",value:function(e){this._applyParams("transparency",e),this._updateTransparent()}},{key:"_updateTransparent",value:function(){this.selectedMaterial&&(this.selectedMaterial.opacity<1||this.selectedMaterial.transparency>0||this.selectedMaterial.alphaMap?this.selectedMaterial.transparent=!0:1!=this.selectedMaterial.opacity||0!=this.selectedMaterial.transparency||this.selectedMaterial.alphaMap||(this.selectedMaterial.transparent=!1))}},{key:"getTransparency",value:function(){return this._getParams("transparency")}},{key:"setOpacity",value:function(e){this._applyParams("opacity",e),this._updateTransparent()}},{key:"getOpacity",value:function(){return this._getParams("opacity")}},{key:"setTransparent",value:function(e){this._applyParams("transparent",Boolean(e))}},{key:"getTransparent",value:function(){return this._getParams("transparent")}},{key:"getAlphaTest",value:function(){return this._getParams("alphaTest")}},{key:"setAlphaTest",value:function(e){this._applyParams("alphaTest",e)}},{key:"getRetainMap",value:function(){if(this.selectedMaterial)return this.selectedMaterial.retainMap}},{key:"setRetainMap",value:function(e){if(this.selectedMaterial)return this.selectedMaterial.retainMap=e}},{key:"setRenderOrder",value:function(e){this.selectedMaterial&&(this._updateRenderOrderByMaterial(this.selectedMaterial,e),this.selectedMaterial.renderOrder=e,im.renderManager.render())}},{key:"getRenderOrder",value:function(){if(this.selected)return this.selected.renderOrder}},{key:"_getMeshByMaterial",value:function(e){var t=[];return fm.forEach((function(n){var i=n.material;(Array.isArray(i)?i:[i]).forEach((function(i){i==e&&t.push(n)}))})),t}},{key:"_updateRenderOrderByMaterial",value:function(e,t){e&&this._getMeshByMaterial(this.selectedMaterial).forEach((function(e){return e.renderOrder=t}))}},{key:"_applyParams",value:function(e,t,n){var i=this;if(this.selectedMaterial){if(mm[this.selectedMaterial.name]||(mm[this.selectedMaterial.name]=this.selectedMaterial.clone()),"map"===n){if(t){var r=t;this.mapLoader.setBaseUrl(""),t=this.mapLoader.load(t,(function(t){var n=r.substr(r.lastIndexOf(".")+1).split("?")[0].toUpperCase();"reflectMap"===e||"envMap"===e?((t=i.mapLoader.convertTexture(t)).image.src=r,i.selectedMaterial[e]=t,i.selectedMaterial.needsUpdate=!0):"BASIS"===n&&(i.selectedMaterial[e]=t,i.selectedMaterial.needsUpdate=!0)})),"envMap"===e?t.custom=!0:t.wrapS=t.wrapT=1e3}else t=null;this.selectedMaterial[e]=t,this.selectedMaterial.needsUpdate=!0}else"color"===n?this.selectedMaterial[e].setStyle(t):this.selectedMaterial[e]=t;this.selectedMaterial.needsUpdate=!0,dm.map((function(e){void 0!==e.re&&e.re===i.selectedMaterial.ID&&(e.copy(i.selectedMaterial),e.needsUpdate=!0)})),this.onEdit&&this.onEdit()}else this.onError("未选择材质对象")}},{key:"_getParams",value:function(e){if(this.selectedMaterial)return this.selectedMaterial[e]&&this.selectedMaterial[e].constructor===Fn?"#"+this.selectedMaterial[e].getHexString():this.selectedMaterial[e]&&this.selectedMaterial[e].constructor===ht?this.selectedMaterial[e].image.currentSrc||this.selectedMaterial[e].image.src:this.selectedMaterial[e];this.onError("未选择材质对象")}},{key:"replace",value:function(e,t){var i=this,r=this.selectedMaterial;if(r){mm[r.name]||(mm[r.name]=r.clone());for(var a=e.lod1,o={},s=0;st&&e.material[t].ID!==e.materialIndex[t]){var n=e.material[t].ID;r[n]||(r[n]=[]),r[n].push({a:e.ID,b:t})}}));var a={};for(var o in e){var s=e[o];".basis"!=s.slice(s.lastIndexOf("."))&&".mrtb"!=s.slice(s.lastIndexOf("."))||(s=this.model.originMaps[s]||""),e[o]&&e[o].startsWith("data:image")?e[o]="":a[o]=s}var l={a:t,b:e,c:r,ed:!0,z:a};return JSON.stringify(l)}},{key:"exportSingleMaterial",value:function(e){var t={},i=n({},e);delete i.re;var r=Nf.export(i,t);for(var a in delete r.a,delete r.ee,t)t[a]&&t[a].startsWith("data:image")&&(t[a]="");return{a:r,b:t}}},{key:"importSingleMaterial",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(n||(n=this.selectedMaterial),!n)return this.onError("请选则材质");Nf.parseAmrtMaterial(e.a,e.b,n,null,i,this.mapLoader,r),this.materials.map((function(a){return a.re===n.ID&&Nf.parseAmrtMaterial(e.a,e.b,a,null,i,t.mapLoader,r)}))}},{key:"rename",value:function(e,t){return t||(t=this.selectedMaterial),t?(t.sname=e,!0):(this.onError("请选则材质"),!1)}}]),i}(Cd),xm=function(){function e(t){s(this,e),this._rayCaster=null,this.viewer=t}return A(e,[{key:"rayCaster",get:function(){return this._rayCaster||(this._rayCaster=new Nc),this._rayCaster}},{key:"rayIntersect",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=t||this.viewer.sceneManager.root;var i=If.getDomMouse(e,this.viewer.domElement);return this.rayCaster.setFromCamera(i,this.viewer.renderManager.camera),Array.isArray(t)?this.rayCaster.intersectObjects(t,n):this.rayCaster.intersectObject(t,n)}},{key:"intersectObject",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return console.error("缺少事件对象: MouseEvent"),!1;t=t||this.viewer.sceneManager.modelGroup;var i=this.rayIntersect(e,t,n);return i.length>0?i[0]:null}},{key:"intersectObjects",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return console.error("缺少事件对象: MouseEvent"),!1;t=t||this.viewer.sceneManager.modelGroup;var i=this.rayIntersect(e,t,n);return i}},{key:"intersectModels",value:function(e,t,n,i){var r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(!e)return console.error("缺少事件对象: MouseEvent"),!1;if(i=i||this.viewer.sceneManager.modelGroup,this.rayCaster.constructor===Nc){var a=this.rayIntersect(e,i,r);return t&&(n?t.call(n,a):t(a)),a}this.rayCaster.executeTest((function(e){t&&(n?t.call(n,e.intersects):t(e.intersects))}),!0)}},{key:"intersectBox",value:function(e,t){if(!e)return console.error("缺少事件对象: MouseEvent"),!1;var n=If.getDomMouse(e,this.viewer.domElement);this.rayCaster.setFromCamera(n,this.viewer.renderManager.camera);var i=(new tn).setFromObject(t);return this.rayCaster.ray.intersectBox(i)}},{key:"screenToVector",value:function(e){var t=this.intersectObject(e,this.viewer.sceneManager.root);return t?t.point:null}},{key:"vectorToScreen",value:function(e){var t=this.viewer.renderManager.container.getBoundingClientRect(),n=t.width/2,i=t.height/2,r=e.clone();return r.project(this.viewer.renderManager.camera),new tt(r.x*n+n,-r.y*i+i)}}]),e}(),bm=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),e.transform?g(i,e.transform):((i=t.call(this)).viewer=e,i._controls=new Fu(e.camera,e.container,!1),i._controls.addEventListener("dragging-changed",(function(e){i.viewer.controls.enabled=!e.value,i.dispatchEvent({type:"dragging-changed",data:i.target})})),i._controls.addEventListener("mouseDown",(function(){i.dispatchEvent({type:"mouseDown",data:i.target})})),i._controls.addEventListener("mouseUp",(function(){i.dispatchEvent({type:"mouseUp",data:i.target})})),i._controls.addEventListener("objectChange",(function(e){i.dispatchEvent({type:ld.CHANGE,data:i.target})})),i.target=null,e.transform=v(i),i)}return A(n,[{key:"setTarget",value:function(e){this.target=e,e?this._controls.attach(this.target):this._controls.detach(),this.viewer.renderManager.render()}},{key:"remove",value:function(){this._controls.detach(),this.target=null,this.viewer.renderManager.render()}},{key:"getTarget",value:function(){return this.target}},{key:"getMode",value:function(e){return this._controls.mode}},{key:"setMode",value:function(e){this._controls.setMode(e),this.viewer.renderManager.render()}},{key:"size",get:function(){return this._controls.size},set:function(e){this._controls.setSize(e),this.viewer.renderManager.render()}},{key:"enabled",get:function(){return this._controls.enabled},set:function(e){e?this.viewer.root.add(this._controls):this.viewer.root.remove(this._controls),this._controls.enabled=e,this.viewer.renderManager.render()}},{key:"showX",get:function(){return this._controls.showX},set:function(e){this._controls.showX=e,this.viewer.renderManager.render()}},{key:"showY",get:function(){return this._controls.showY},set:function(e){this._controls.showY=e,this.viewer.renderManager.render()}},{key:"showZ",get:function(){return this._controls.showZ},set:function(e){this._controls.showZ=e,this.viewer.renderManager.render()}},{key:"dispose",value:function(){this._controls.dispose(),this.viewer.renderManager.render()}}]),n}(Je),Mm=A((function e(){s(this,e)}));Mm.TRANSLATE="translate",Mm.ROTATE="rotate",Mm.SCALE="scale";var Cm=function(e){h(n,e);var t=y(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(this,n),(e=t.call(this)).options=i,e.isEffect=!0,e.init(),e}return A(n,[{key:"init",value:function(){}},{key:"update",value:function(){}}]),n}(zt),Bm=" \n uniform float size; \n uniform float time; \n uniform float u_len; \n attribute float u_index;\n varying float u_opacitys;\n void main() { \n if( u_index < time + u_len && u_index > time){\n float u_scale = 1.0 - (time + u_len - u_index) /u_len;\n u_opacitys = u_scale;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n gl_PointSize = size * u_scale * 1.0;\n } \n }\n ",Em=" \n uniform sampler2D u_map;\n uniform float u_opacity;\n uniform vec3 color;\n uniform float isTexture;\n varying float u_opacitys;\n void main() {\n vec4 u_color = vec4(color,u_opacity * u_opacitys);\n gl_FragColor = u_color;\n }",Sm=function(e){h(n,e);var t=y(n);function n(e,i,r,a){var o;return s(this,n),(o=t.call(this)).flyId=0,o.flyArr=[],o.baicSpeed=1,e=Array.isArray(e)?(new at).fromArray(e):(new at).copy(e),i=Array.isArray(i)?(new at).fromArray(i):(new at).copy(i),o.start=e,o.end=i,o.height=r||.3*e.distanceTo(i),o.color=a||"#02E6FF",o._baseScale=.1,o._opacity=1,o._init(),o}return A(n,[{key:"_initCurve",value:function(){var e=new yA(this.start,new at((this.start.x+this.end.x)/2,2*this.height,(this.start.z+this.end.z)/2),this.end);return this.curveLength=e.getLength(),e.getPoints(40*this.start.distanceTo(this.end))}},{key:"_init",value:function(){var e=this,t=this._initCurve(),n=new Li;n.vertices=t,this.baseLine=new Go(n,new Do({color:this.color})),this.add(this.baseLine),this._createFlyLine(t,this.color,{}),this.timer=setInterval((function(){e._createFlyLine(e._initCurve(),e.color,{}),e.flyArr.length>=3&&clearInterval(e.timer)}),3e3),this.pointMaterial=new Nn({map:If.createCircleMap(this.color),side:2,transparent:!0}),this.startPoint=new Ei(new dl(1,32),this.pointMaterial),this.startPoint.rotation.x=Math.PI/2,this.startPoint.position.copy(this.start),this.endPoint=new Ei(new dl(1,32),this.pointMaterial),this.endPoint.position.copy(this.end),this.endPoint.rotation.x=Math.PI/2,this.add(this.startPoint),this.add(this.endPoint)}},{key:"pointVisible",set:function(e){e=!!e,this.startPoint.visible=e,this.endPoint.visible=e}},{key:"_createGeometry",value:function(e,t){t=t||new si;var n=[],i=[];return e.forEach((function(e,t){n.push(e.x,e.y,e.z),i.push(t)})),t.setAttribute("position",new Yn(n,3)),t.setAttribute("u_index",new Yn(i,1)),t}},{key:"_createFlyLine",value:function(e,t,n){var i=n.width,r=void 0===i?3:i;n.length,n.speed;var a=n.repeat,o=void 0===a?1/0:a,s=new Ri({uniforms:{color:{value:new Fn(t).lerp(new Fn(1,1,1),.3),type:"v3"},size:{value:r,type:"f"},u_len:{value:10*this.curveLength,type:"f"},u_opacity:{value:.7,type:"f"},time:{value:-10*this.curveLength,type:"f"}},transparent:!0,depthTest:!1,vertexShader:Bm,fragmentShader:Em,defaultAttributeValues:{}}),l=this._createGeometry(e);this.points=new qo(l,s),this.points._speed=this.curveLength/3,this.points._repeat=o,this.points._been=0,this.points._total=e.length,this.flyId++,this.flyArr.push(this.points),this.add(this.points)}},{key:"update",value:function(e){var t=this;e>.2||(this.flyArr.forEach((function(n){if(n.parent)if(n._been>n._repeat)n.visible=!1,"function"==typeof n._callback&&n._callback(n),t.remove(n);else{var i=n.material.uniforms;i.time.value1?.2:this._baseScale,this.startPoint.scale.set(this._baseScale,this._baseScale,this._baseScale),this.endPoint.scale.copy(this.startPoint.scale))}},{key:"_updateLine",value:function(){var e=this;this.startPoint.position.copy(this.start),this.endPoint.position.copy(this.end);var t=this._initCurve(),n=new Li;n.vertices=t,this.baseLine.geometry.dispose(),this.baseLine.geometry=n,this.flyArr.forEach((function(n){e._createGeometry(t,n.geometry),n.geometry.verticesNeedUpdate=!0}))}},{key:"onAfterRender",value:function(){AMRT.needsUpdate=!0}},{key:"setHeight",value:function(e){e!=this.height&&(this.height=e,this._updateLine())}},{key:"setStartPoint",value:function(e){this.start=e,this._updateLine()}},{key:"setEndPoint",value:function(e){this.end=e,this._updateLine()}},{key:"setColor",value:function(e){this.color=e,this.baseLine.material.color.setStyle(this.color);var t=new Fn(e).lerp(new Fn(1,1,1),.3);this.flyArr.forEach((function(e){e.material.uniforms.color.value.copy(t)})),this.pointMaterial.map=If.createCircleMap(this.color),this.pointMaterial.map.needsUpdate=!0}},{key:"toJSON",value:function(){return{start:this.start,end:this.end,height:this.height,color:this.color}}},{key:"dispose",value:function(){for(;00&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#FFFF00";s(this,n),(e=t.call(this)).viewer=null,e.dotIndex=0,e.path=i,e.longlats=[],e.isClose=!1,e.lineColor=r;var a=new Li;return e.lineMaterial=new Do({color:r,depthTest:!1,depthWrite:!1}),e.line=new Go(a,e.lineMaterial),e.line.renderOrder=5e3,e.add(e.line),e.dotGroup=new zt,e.add(e.dotGroup),e.dotMaterial=e.createDotMaterial(),e}return A(n,[{key:"path",get:function(){return this._path},set:function(e){if(e){this._path=[];for(var t=0;t0&&(e.forEach((function(e){e&&t.pathPush(e)})),this.updateDot())}},{key:"addLongLats",value:function(e){var t=this;e&&e.length>0&&(e.forEach((function(n){n&&Array.isArray(n)&&t.viewer&&t.viewer.isGISViewer&&(t.longlats.push(e),t.pathPush(t.viewer.coordinatesToVector3(n)))})),this.updateDot())}},{key:"pathPush",value:function(e){var t=(new at).copy(e);this._path.push(t)}},{key:"removePoint",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.path.length>0&&(null!=e&&this.path[e]||(e=this.path.length-1),this.path.splice(e,1),this.longlats&&this.longlats[e]&&this.longlats.splice(e,1),this.updateDot())}},{key:"updatePath",value:function(){var e=this,t=[];if(this.dotGroup.children.forEach((function(e){t.push(e.position.clone())})),this.path=t,this.viewer&&this.viewer.isGISViewer){var n=[];this.path.forEach((function(t){n.push(e.viewer.coordinatesToVector3(t))})),this.longlats=n}this.updateLine()}},{key:"updateDot",value:function(){for(var e=this.path,t=this.dotGroup.children,n=Math.max(e.length,t.length),i=0;i0&&void 0!==arguments[0]?arguments[0]:null;e&&(this.path=e);var t=new Li;if(this.longlats&&this.longlats.length>0)t.vertices=this.detVector3();else{var n=[];this.path.forEach((function(e){n.push(e)})),this.isClose&&n.push(n[0]),t.vertices=n}this.line.geometry.dispose(),this.line.geometry=t,this.line.geometry.verticesNeedUpdate=!0}},{key:"createDot",value:function(e,t){var n=new go(this.dotMaterial.clone());return n.isPathPoint=!0,n.renderOrder=5e3,n.scale.set(.04,.04,1),e&&n.position.copy(e),n}},{key:"createDotMaterial",value:function(){var e=document.createElement("canvas");e.width=e.height=32;var t=e.getContext("2d");return t.beginPath(),t.arc(16,16,4,0,2*Math.PI),t.fillStyle=this.lineColor,t.fill(),new ro({map:new ts(e),sizeAttenuation:!1,depthTest:!1,depthWrite:!1})}},{key:"show",value:function(){this.visible=!0}},{key:"hide",value:function(){this.visible=!1}},{key:"detVector3",value:function(){var e=[];if(1===this.longlats.length)e.push(this.viewer.coordinatesToVector3(this.longlats[0]));else{var t=[];this.longlats.forEach((function(e){t.push(e)})),this.isClose&&t.push(t[0]);for(var n=0;n=2&&this.addDistancePanel();else if(this.type===n.TYPE_HEIGHT){this.pathEditor.isClose=!1;var i=this.computeHeightPoint(e,t);i&&this.pathEditor.addPoint(i),this.pathEditor.path.length>=2&&this.addHeightPanel()}else this.type===n.TYPE_ANGLE?(this.pathEditor.isClose=!1,e&&this.pathEditor.addPoint(e),this.pathEditor.path.length>=3&&this.addAnglePanel()):this.type===n.TYPE_AREA&&(this.pathEditor.isClose=!0,e&&this.pathEditor.addPoint(e),this.pathEditor.path.length>=3&&this.addAreaPanel())}},{key:"addPoints",value:function(e){var t=this;e.forEach((function(e){t.addPoint(e)}))}},{key:"addAreaPanel",value:function(){var e=this.pathEditor.path;this.clearPanel();var t=e[0],n=e[1],i=e[2],r=this.computePolyArea(e),a=new tn;a.setFromPoints(e);var o=a.getCenter(),s=a.max.distanceTo(a.min);this.maxLength=s,this.textScale=2,this.textMeshScale=.002*this.maxLength,this.fontSize=20*this.textScale;var l=n.distanceTo(t),A=n.distanceTo(i),c=.005*this.maxLength*.5*30,h=Math.min(l,A);c=c>3*h/4?3*h/4:c;var u=t.clone().sub(n).normalize(),d=i.clone().sub(n).normalize(),f=n.clone().addScaledVector(u,c),p=n.clone().addScaledVector(d,c),m=new at((f.x+p.x)/2,(f.y+p.y)/2,(f.z+p.z)/2).clone().sub(n),v=this._drawText2((r*this.magnification*this.magnification).toFixed(this.decimalPlaces)+this.showUnit+"2"),g=v.clone();g.geometry=v.geometry.clone(),g.selectMat=v.selectMat.clone(),g.unselectMat=v.unselectMat.clone(),this.panelNode.add(g);var y=m.clone().normalize(),w=u.clone().cross(d).normalize(),x=w.clone().cross(y);x.y<0&&(x.negate(),w.negate());var b=new bt;b.makeBasis(y,x,w),b.setPosition(o),v.geometry.applyMatrix(b);var M=new bt;M.makeBasis(y.clone().negate(),x.clone(),w.clone().negate()),M.setPosition(o.clone()),g.geometry.applyMatrix(M),this.lengthMesh=v,this.lengthMesh.back=g}},{key:"addAnglePanel",value:function(){var e=this.pathEditor.path;this.clearPanel();for(var t=0;t3*A/4?3*A/4:l;var c=n.clone().sub(i).normalize(),h=r.clone().sub(i).normalize(),u=180*c.angleTo(h)/Math.PI,d=i.clone().addScaledVector(c,l),f=i.clone().addScaledVector(h,l),p=new at((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2),m=p.clone().sub(i),v=p.addScaledVector(m,2),g=this._drawText2(u.toFixed(this.decimalPlaces)+"度"),y=g.clone();y.geometry=g.geometry.clone(),y.selectMat=g.selectMat.clone(),y.unselectMat=g.unselectMat.clone(),this.panelNode.add(y);var w=m.clone().normalize(),x=c.clone().cross(h).normalize(),b=x.clone().cross(w);b.y<0&&(b.negate(),x.negate());var M=new bt;M.makeBasis(w,b,x),M.setPosition(v),g.geometry.applyMatrix(M);var C=new bt;C.makeBasis(w.clone().negate(),b.clone(),x.clone().negate()),C.setPosition(v.clone()),y.geometry.applyMatrix(C),this.lengthMesh=g,this.lengthMesh.back=y}}},{key:"addHeightPanel",value:function(){var e=this.pathEditor.path;this.clearPanel();for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:null;this.pathEditor.removePoint(e)}},{key:"updatePath",value:function(){this.pathEditor.updatePath(),this.updatePanel()}},{key:"clearPanel",value:function(){for(;this.panelNode.children.length>0;)this.panelNode.remove(this.panelNode.children[0])}},{key:"updatePanel",value:function(){this.clearPanel();this.addPoint(null)}},{key:"_onComplete",value:function(){this.onComplete&&this.onComplete()}},{key:"close",value:function(e){e&&e()}},{key:"hide",value:function(){this.visible=!1}},{key:"show",value:function(){this.visible=!0}},{key:"_drawText2",value:function(e,t){var n=document.createElement("canvas"),i=this._getMaterial(n,e,this.unselectColor),r=document.createElement("canvas"),a=this._getMaterial(r,e,_m),o=new Ei(new $i(n.width*this.textMeshScale/this.textScale,n.height*this.textMeshScale/this.textScale),i);return o.renderOrder=Ke,o.name="Text",t&&o.position.copy(t),o.selectMat=a,o.unselectMat=i,this.panelNode.add(o),o}},{key:"_getMaterial",value:function(e,t,n){e.height=this.fontSize,this._fillText(e,t,n);var i=new ts(e);i.anisotropy=16;var r=new Nn({map:i,transparent:!0});return r.depthTest=!1,r}},{key:"_fillText",value:function(e,t,n){var i="normal bolder "+this.fontSize+"px 黑体";e.width=this._measureTextWidth(i,t);var r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.font=i,r.fillStyle=n||this.unselectColor,r.textAlign="left",r.textBaseline="top",r.fillText(t,0,0)}},{key:"_measureTextWidth",value:function(e,t){this._measureCanvas||(this._measureCanvas=document.createElement("canvas"),this._measureCanvas.height=100,this._measureCanvas.width=100);var n=this._measureCanvas.getContext("2d");return n.font=e,n.measureText(t).width}},{key:"computePolyArea",value:function(e){for(var t=0,n=this.getFaces(e),i=0;if&&(n=a.clone().addScaledVector(A,m))}}else e&&(n=(new at).copy(e));return n}},{key:"getFaces",value:function(e){if(e.length<3)return[];for(var t,n,i,r,a,o,s=1e-4,l=!1,A=0;A0&&void 0!==arguments[0]?arguments[0]:"m";Im[e]&&(this._showUnit=e,this.magnification=Im[e])}},{key:"magnification",get:function(){return this._magnification},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this._magnification=e}},{key:"decimalPlaces",get:function(){return this._decimalPlaces},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;"string"==typeof e&&(e=parseInt(e)),"number"==typeof e&&e>=0&&(this._decimalPlaces=Math.round(e))}},{key:"earthsCoreVec",get:function(){return this._earthsCoreVec},set:function(e){e&&(this._earthsCoreVec=(new at).copy(e))}},{key:"toJSON",value:function(){return{type:this.type,points:this.pathEditor.path,color:this.unselectColor}}},{key:"loadJson",value:function(e){this.addPoints(e.points)}},{key:"reset",value:function(){for(var e=this.showUnit,t=this.decimalPlaces,n=this.toJSON();this.children.length>0;)this.remove(this.children[0]);this.init(),this.showUnit=e,this.decimalPlaces=t,this.loadJson(n)}},{key:"destroy",value:function(){}}]),n}(zt);Lm.TYPE_DISTANCE=0,Lm.TYPE_HEIGHT=1,Lm.TYPE_ANGLE=2,Lm.TYPE_AREA=3;var Fm=.001,km=function(e){h(n,e);var t=y(n);function n(e,i){var r;return s(this,n),(r=t.call(this)).unselectColor=i||"#FF4500",r.type=e||n.TYPE_RECT,r.decimalPlaces=3,r.init(),r}return A(n,[{key:"init",value:function(){this.hided=!1,this.pathEditor=new Tm([],this.unselectColor),this.pathEditor.isClose=!0,this.add(this.pathEditor),this.panelNode=new zt,this.add(this.panelNode)}},{key:"addPoint",value:function(e,t){if(this.type===n.TYPE_POLYGON)e&&(Array.isArray(e)?this.pathEditor.addLongLat(e):this.pathEditor.addPoint(e)),this.pathEditor.path.length>=3&&this.addAreaPanel(this.pathEditor.path);else if(this.type===n.TYPE_RECT){if(e)if(this.firstPoint){for(;this.pathEditor.path.length>0;)this.pathEditor.removePoint();if(Array.isArray(e)){var i=this.firstPoint,r=[e[0],e[1]],a=[i[0],e[1]],o=[e[0],i[1]];this.pathEditor.addLongLat(i),this.pathEditor.addLongLat(a),this.pathEditor.addLongLat(r),this.pathEditor.addLongLat(o)}else{var s=this.firstPoint.clone(),l=e,A=new at(s.x,s.y,l.z),c=new at(l.x,l.y,s.z);this.pathEditor.addPoint(s),this.pathEditor.addPoint(A),this.pathEditor.addPoint(l),this.pathEditor.addPoint(c)}this.addAreaPanel(this.pathEditor.path),t&&t()}else Array.isArray(e)?this.firstPoint=[e[0],e[1]]:this.firstPoint=(new at).copy(e)}else if(this.type===n.TYPE_CIRCULAR){if(e)if(this.firstPoint){for(;this.pathEditor.path.length>0;)this.pathEditor.removePoint();if(Array.isArray(e))for(var h=new tt(this.firstPoint[0],this.firstPoint[1]).distanceTo(new tt(e[0],e[1])),u=0;u<=360;u+=10){var d=u/180*Math.PI,f=this.firstPoint[0]+h*Math.cos(d),p=this.firstPoint[1]+h*Math.sin(d);this.pathEditor.addLongLat([f,p])}else{e.y=this.firstPoint.y;for(var m=this.firstPoint.distanceTo(e),v=0;v<=360;v+=10){var g=v/180*Math.PI,y=this.firstPoint.x+m*Math.cos(g),w=this.firstPoint.z+m*Math.sin(g);this.pathEditor.addPoint({x:y,y:this.firstPoint.y,z:w})}}this.addAreaPanel(this.pathEditor.path),t&&t()}else Array.isArray(e)?this.firstPoint=[e[0],e[1]]:this.firstPoint=(new at).copy(e);this.pathEditor.dotGroup.visible=!1}}},{key:"addPoints",value:function(e){var t=this;e.forEach((function(e){t.addPoint(e)}))}},{key:"addLongLats",value:function(e){var t=this;e.forEach((function(e){t.addLongLat(e)}))}},{key:"removePoint",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.pathEditor.removePoint(e)}},{key:"updatePath",value:function(){this.pathEditor.updatePath(),this.updatePanel()}},{key:"clearPanel",value:function(){for(;this.panelNode.children.length>0;)this.panelNode.remove(this.panelNode.children[0])}},{key:"updatePanel",value:function(){this.clearPanel();this.addPoint(null)}},{key:"close",value:function(e){e&&e()}},{key:"hide",value:function(){this.visible=!1}},{key:"show",value:function(){this.visible=!0}},{key:"filter",value:function(e,t){var n=this.getLoop(t);if(n.length>=3){var i=[];Array.isArray(e)?e.forEach((function(e){e.traverse((function(e){e.isMesh&&i.push(e)}))})):e.traverse((function(e){e.isMesh&&i.push(e)}));for(var r=0;rd.next.lineLen?(r.remove(d.next),u--,d.endPoint=d.next.endPoint.clone(),d.next=d.next.next,d.next.pre=d):(r.remove(d),u--,d.next.startPoint=d.startPoint.clone(),d.next.pre=d.pre,d.pre.next=d.next))}}return r}},{key:"pointAtLoop",value:function(e,t){for(var n=t.x,i=t.y,r={},a="out",o=0;oi&&d>i))if(n!=A||n!=u){if(!(n>A&&n>u||ni)){if(p==i)return a=n==A||n==u?"atpoint":"atline";if(n==A){if(s.endPoint.x>n&&s.pre.startPoint.x>n||s.endPoint.xn&&s.next.endPoint.x>n||s.startPoint.xd?(v=c,g=d):(v=d,g=c),i>=g&&i<=v)return a="atline";if(s.pre.startPoint.x>n&&s.next.endPoint.x>n||s.pre.startPoint.x0)this.type===n.TYPE_RECT&&t.length>3?e.longlats=[t[0],t[2]]:this.type===n.TYPE_CIRCULAR&&t.length>1?e.longlats=[this.firstPoint,t[0]]:this.type===n.TYPE_POLYGON&&t.length>3?e.longlats=t:e=null;else{var i=this.pathEditor.path;this.type===n.TYPE_RECT&&i.length>3?e.points=[i[0],i[2]]:this.type===n.TYPE_CIRCULAR&&i.length>1?e.points=[this.firstPoint,i[0]]:this.type===n.TYPE_POLYGON&&i.length>3?e.points=i:e=null}return e}},{key:"loadJson",value:function(e){e.longlats?this.addPoints(e.longlats):this.addPoints(e.points)}},{key:"reset",value:function(){for(var e=this.showUnit,t=this.decimalPlaces,n=this.toJSON();this.children.length>0;)this.remove(this.children[0]);this.init(),this.showUnit=e,this.decimalPlaces=t,this.loadJson(n)}},{key:"destroy",value:function(){}}]),n}(zt);km.TYPE_RECT=0,km.TYPE_CIRCULAR=1,km.TYPE_POLYGON=2;var Pm=function(){function e(t){s(this,e),this.viewer=t,this.modelNode=new zt,this.viewer.modelGroup.add(this.modelNode),this.basicModels=[],this.flyLines=[],this.pathEditors=[],this.measure3Ds=[],this.selections=[],this.allModels=[this.basicModels,this.flyLines,this.pathEditors,this.measure3Ds,this.selections]}return A(e,[{key:"addCube",value:function(e,t,n){var i={width:e,height:t,depth:n};return this.addCube2(i)}},{key:"addCube2",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new kf(this.viewer),n={};e.color&&(n.color=e.color);var i=new Fi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments),r=new Gf(n),a=new Ei(i,r);return t.add(a),e.position&&t.position.copy(e.position),e.parent?e.parent.add(t):this.viewer.modelGroup.add(t),this.basicModels.push(t),t.init(t),t}},{key:"addSphere",value:function(e){var t={radius:e};return this.addSphere2(t)}},{key:"addSphere2",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new kf(this.viewer),n={};e.color&&(n.color=e.color);var i=new $s(e.radius,e.widthSegments,e.heightSegments),r=new Gf(n),a=new Ei(i,r);return t.add(a),e.position&&t.position.copy(e.position),e.parent?e.parent.add(t):this.viewer.modelGroup.add(t),this.basicModels.push(t),t.init(t),t}},{key:"addTorus",value:function(e,t){var n={radius:e,tube:t};return this.addTorus2(n)}},{key:"addTorus2",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new kf(this.viewer),n={};e.color&&(n.color=e.color);var i=new ws(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc),r=new Gf(n),a=new Ei(i,r);return t.add(a),e.position&&t.position.copy(e.position),e.parent?e.parent.add(t):this.viewer.modelGroup.add(t),this.basicModels.push(t),t.init(t),t}},{key:"addCylinder",value:function(e,t,n){var i={radiusTop:e,radiusBottom:t,height:n};return this.addCylinder2(i)}},{key:"addCylinder2",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new kf(this.viewer),n={};e.color&&(n.color=e.color);var i=new Al(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded),r=new Gf(n),a=new Ei(i,r);return t.add(a),e.position&&t.position.copy(e.position),e.parent?e.parent.add(t):this.viewer.modelGroup.add(t),this.basicModels.push(t),t.init(t),t}},{key:"addRectPlane",value:function(e,t){var n={width:e,height:t};return this.addRectPlane2(n)}},{key:"addRectPlane2",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new kf(this.viewer),n={};e.color&&(n.color=e.color),e.doubleSide&&(n.side=2);var i=new qi(e.width,e.height,e.widthSegments,e.heightSegments),r=new Gf(n),a=new Ei(i,r);return t.add(a),e.position&&t.position.copy(e.position),e.parent?e.parent.add(t):this.viewer.modelGroup.add(t),this.basicModels.push(t),t.init(t),t}},{key:"addCirclePlane",value:function(e){var t={radius:e};return this.addCirclePlane2(t)}},{key:"addCirclePlane2",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new kf(this.viewer),n={};e.color&&(n.color=e.color),e.doubleSide&&(n.side=2);var i=new dl(e.radius,e.segments,e.thetaStart,e.thetaLength),r=new Gf(n),a=new Ei(i,r);return t.add(a),e.position&&t.position.copy(e.position),e.parent?e.parent.add(t):this.viewer.modelGroup.add(t),this.basicModels.push(t),t.init(t),t}},{key:"addFlyLine",value:function(e,t,n,i){var r=new kf(this.viewer),a=new Sm(e,t,n,i);return r.add(a),this.viewer.modelGroup.add(r),this.flyLines.push(r),r}},{key:"addPathEditor",value:function(e,t){var n=new kf(this.viewer),i=new Tm([],t);return e&&e.length>0&&i.addPoints(e),n.add(i),this.viewer.modelGroup.add(n),this.pathEditors.push(n),n}},{key:"addMeasure3D",value:function(e,t,n){var i=new kf(this.viewer),r=new Lm(t,n);return e&&e.length>0&&r.addPoints(e),i.add(r),this.viewer.modelGroup.add(i),this.measure3Ds.push(i),i}},{key:"addSelection",value:function(e,t,n){var i=new kf(this.viewer),r=new km(t,n);return e&&e.length>0&&r.addPoints(e),i.add(r),this.viewer.modelGroup.add(i),this.selections.push(i),i}},{key:"show",value:function(){this.allModels.forEach((function(e){e.forEach((function(e){e.visible=!0}))})),this._consoleCallBack&&this._consoleCallBack("显示组")}},{key:"hide",value:function(){this.allModels.forEach((function(e){e.forEach((function(e){e.visible=!1}))})),this._consoleCallBack&&this._consoleCallBack("隐藏组")}},{key:"removeMesh",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(this.basicModels.length>0){-1===e&&(e=this.basicModels.length-1);var t=this.basicModels[e];t.parent.remove(t),this.basicModels.splice(e,1),this._consoleCallBack&&this._consoleCallBack("删除成功!")}}},{key:"clearAll",value:function(){var e=0;this.allModels.forEach((function(t){t.forEach((function(t){t.parent.remove(t),e++})),t.splice(0,t.length)})),this._consoleCallBack&&e>0&&this._consoleCallBack("清空组!")}},{key:"_onMouseUp",value:function(e){}},{key:"_onMouseMove",value:function(e){}},{key:"_onUpdate",value:function(){}},{key:"consoleCallBack",set:function(e){e&&(this._consoleCallBack=e)}}]),e}(),Um=function(){function e(t){s(this,e),this.viewer=t,this.type=e.TYPE_DRAW,this.pathsGroup=new zt,this.viewer.modelGroup.add(this.pathsGroup),this.curPathEditor=null,this.container=document.createElement("div"),this.viewer.container.appendChild(this.container),this._onClick=this._onClick.bind(this),this._onRightClick=this._onRightClick.bind(this),this._onMouseMove=this._onMouseMove.bind(this)}return A(e,[{key:"start",value:function(){this.curPathEditor||this.addPathEditor(),this.viewer.moduleManager.event.addEventListener(Ad.click,this._onClick),this.viewer.moduleManager.event.addEventListener(Ad.rightClick,this._onRightClick),this.viewer.moduleManager.event.addEventListener(Ad.mousemove,this._onMouseMove),this.viewer.domElement.style.cursor="crosshair",this.container.style.display="block",this._consoleCallBack&&this._consoleCallBack("左键点击开始绘制!")}},{key:"end",value:function(){this.viewer.moduleManager.event.removeEventListener(Ad.click,this._onClick),this.viewer.moduleManager.event.removeEventListener(Ad.rightClick,this._onRightClick),this.viewer.moduleManager.event.removeEventListener(Ad.mousemove,this._onMouseMove),this.viewer.domElement.style.cursor="auto",this.container.style.display="none",this.curPathEditor&&(this.curPathEditor.path.length<2&&this.pathsGroup.remove(this.curPathEditor),this.curPathEditor=null),this.viewer.enableTransform&&(this.viewer.enableTransform=!0),this.viewer.transform&&this.viewer.transform.setTarget(null),this.type=e.TYPE_DRAW,this._consoleCallBack&&this._consoleCallBack("结束绘制!")}},{key:"show",value:function(){!1===this.pathsGroup.visible&&(this.pathsGroup.visible=!0,this._consoleCallBack&&this._consoleCallBack("显示路径!"))}},{key:"hide",value:function(){!0===this.pathsGroup.visible&&(this.pathsGroup.visible=!1,this._consoleCallBack&&this._consoleCallBack("隐藏路径!"))}},{key:"addPathEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t||this.pathEditorColor;return this.curPathEditor=new Tm([],n),this.curPathEditor.addPoints(e),this.pathsGroup.add(this.curPathEditor),this.curPathEditor}},{key:"getPathEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=null;return this.pathsGroup.children.length>0&&(-1==e&&(e=this.pathsGroup.children.length-1),t=this.pathsGroup.children[e]),t}},{key:"updatePathEditor",value:function(){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:-1;this.pathsGroup.children.length>0&&(-1===e&&(e=this.pathsGroup.children.length-1),this.pathsGroup.children.splice(e,1),this.curPathEditor=null,this._consoleCallBack&&this._consoleCallBack("删除成功!"))}},{key:"clearPathEditor",value:function(){this.pathsGroup.children.splice(0,this.pathsGroup.children.length)}},{key:"enableEditor",value:function(){this.viewer.moduleManager.event.addEventListener(Ad.click,this._onClick),this.viewer.moduleManager.event.addEventListener(Ad.rightClick,this._onRightClick),this.viewer.moduleManager.event.addEventListener(Ad.mousemove,this._onMouseMove),this.container.style.display="block",this.type=e.TYPE_EDIT,this._consoleCallBack&&this._consoleCallBack("选择路径节点进行编辑!右键结束编辑")}},{key:"loadJson",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"PathEditorData",t=localStorage.getItem(e);if(t){t=JSON.parse(t);for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"PathEditorData",t=[],n=0;n0){var r={points:i.path,color:i.lineColor};t.push(r)}}return localStorage.setItem(e,JSON.stringify(t)),this._consoleCallBack&&this._consoleCallBack("保存路径!"),t}},{key:"_onClick",value:function(t){var n=this;if(this.type===e.TYPE_EDIT){var i=[];this.pathsGroup.children.forEach((function(e){i=i.concat(e.dotGroup)}));var r=this.viewer.picker.intersectModels(t.point,null,null,i);r&&r.length>0?(this.viewer.enableTransform||(this.viewer.enableTransform=!0),this.viewer.transform.setTarget(r[0].object)):this.viewer.transform&&this.viewer.transform.setTarget(null)}else if(this.curPathEditor){var a=[];this.viewer.modelGroup.children.forEach((function(e){e!=n.pathsGroup&&a.push(e)}));var o=this.viewer.picker.intersectObject(t.point,a);o&&this.curPathEditor.addPoint(o.point)}}},{key:"_onRightClick",value:function(){this.end()}},{key:"_onMouseMove",value:function(e){}},{key:"_onUpdate",value:function(){}},{key:"pathEditorColor",get:function(){return this._pathEditorColor},set:function(e){e&&(this._pathEditorColor=e)}},{key:"consoleCallBack",set:function(e){e&&(this._consoleCallBack=e)}}]),e}();Um.TYPE_DRAW=0,Um.TYPE_EDIT=1;var Dm=function(){function e(t){s(this,e),this.viewer=t,this.measuresGroup=new zt,this.viewer.modelGroup.add(this.measuresGroup),this.curMeasure3D=null,this.container=document.createElement("div"),this.viewer.container.appendChild(this.container),this.earthsCoreVec=new at,this._onClick=this._onClick.bind(this),this._onRightClick=this._onRightClick.bind(this),this._onMouseMove=this._onMouseMove.bind(this)}return A(e,[{key:"distanceMeasure",value:function(){this.start(Lm.TYPE_DISTANCE),this._consoleCallBack&&this._consoleCallBack("开始距离测量,点击右键即可完成!")}},{key:"heightMeasure",value:function(){this.start(Lm.TYPE_HEIGHT),this._consoleCallBack&&this._consoleCallBack("开始高度测量,点击右键即可完成!")}},{key:"angleMeasure",value:function(){this.start(Lm.TYPE_ANGLE),this._consoleCallBack&&this._consoleCallBack("开始角度测量,点击右键即可完成!")}},{key:"areaMeasure",value:function(){this.start(Lm.TYPE_AREA),this._consoleCallBack&&this._consoleCallBack("开始面积测量,点击右键即可完成!")}},{key:"start",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Lm.TYPE_DISTANCE;this.curMeasure3D?this.curMeasure3D.type!=e&&(this.removeMeasure(),this.addMeasure(e)):this.addMeasure(e),this.viewer.moduleManager.event.addEventListener(Ad.click,this._onClick),this.viewer.moduleManager.event.addEventListener(Ad.rightClick,this._onRightClick),this.viewer.moduleManager.event.addEventListener(Ad.mousemove,this._onMouseMove),this.viewer.domElement.style.cursor="crosshair",this.container.style.display="block"}},{key:"end",value:function(){if(this.viewer.moduleManager.event.removeEventListener(Ad.click,this._onClick),this.viewer.moduleManager.event.removeEventListener(Ad.rightClick,this._onRightClick),this.viewer.moduleManager.event.removeEventListener(Ad.mousemove,this._onMouseMove),this.viewer.domElement.style.cursor="auto",this.container.style.display="none",this.curMeasure3D){var e=this.curMeasure3D.type,t=this.curMeasure3D.pathEditor.path.length;(e===Lm.TYPE_DISTANCE||e===Lm.TYPE_HEIGHT)&&t<2&&this.measuresGroup.remove(this.curMeasure3D),(e===Lm.TYPE_ANGLE||e===Lm.TYPE_AREA)&&t<3&&this.measuresGroup.remove(this.curMeasure3D),this.curMeasure3D=null}}},{key:"show",value:function(){!1===this.measuresGroup.visible&&(this.measuresGroup.visible=!0,this._consoleCallBack&&this._consoleCallBack("显示测量!"))}},{key:"hide",value:function(){!0===this.measuresGroup.visible&&(this.measuresGroup.visible=!1,this._consoleCallBack&&this._consoleCallBack("隐藏测量!"))}},{key:"addMeasure",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Lm.TYPE_DISTANCE,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t||this.measureColor;return this.curMeasure3D=new Lm(e,n),this.curMeasure3D.earthsCoreVec=this.earthsCoreVec,this.curMeasure3D.showUnit=this.measureUnit,this.curMeasure3D.decimalPlaces=this.measureDecimalPlaces,this.measuresGroup.add(this.curMeasure3D),this.curMeasure3D}},{key:"updateMeasure",value:function(){for(var e=[],t=0;t0&&void 0!==arguments[0]?arguments[0]:-1;this.measuresGroup.children.length>0&&(-1===e&&(e=this.measuresGroup.children.length-1),this.measuresGroup.children.splice(e,1),this.curMeasure3D=null,this._consoleCallBack&&this._consoleCallBack("删除成功!"))}},{key:"clearMeasure",value:function(){this.measuresGroup.children.splice(0,this.measuresGroup.children.length)}},{key:"loadJson",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"MeasureData",t=localStorage.getItem(e);if(t){t=JSON.parse(t);for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"MeasureData",t=[],n=0;n0&&void 0!==arguments[0]?arguments[0]:km.TYPE_POLYGON;this.curSelection?this.curSelection.type!=e&&(this.removeSelection(),this.addSelection(e)):this.addSelection(e),this.viewer.moduleManager.event.addEventListener(Ad.click,this._onClick),this.viewer.moduleManager.event.addEventListener(Ad.rightClick,this._onRightClick),this.viewer.moduleManager.event.addEventListener(Ad.mousemove,this._onMouseMove),this.viewer.domElement.style.cursor="crosshair",this.container.style.display="block"}},{key:"end",value:function(){this._endCallBack&&this._endCallBack(this.curSelection),this.curSelection&&(this.curSelection.pathEditor.path.length<3&&this.selectionsGroup.remove(this.curSelection),this.curSelection=null),this.viewer.moduleManager.event.removeEventListener(Ad.click,this._onClick),this.viewer.moduleManager.event.removeEventListener(Ad.rightClick,this._onRightClick),this.viewer.moduleManager.event.removeEventListener(Ad.mousemove,this._onMouseMove),this.viewer.domElement.style.cursor="auto",this.container.style.display="none"}},{key:"filter",value:function(e){if(e=e||this.viewer.sceneManager.modelGroup,this.curSelection&&this.end(),this.selectionsGroup.children.length>0){var t=this.selectionsGroup.children[this.selectionsGroup.children.length-1],n=this.viewer.camera.matrix.clone();n.setPosition(0,0,0);var i=(new bt).getInverse(n);t.filter(e,i)}this._consoleCallBack&&this._consoleCallBack("框选过滤完成!")}},{key:"show",value:function(){!1===this.selectionsGroup.visible&&(this.selectionsGroup.visible=!0,this._consoleCallBack&&this._consoleCallBack("显示框选!"))}},{key:"hide",value:function(){!0===this.selectionsGroup.visible&&(this.selectionsGroup.visible=!1,this._consoleCallBack&&this._consoleCallBack("隐藏框选!"))}},{key:"addSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:km.TYPE_POLYGON,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t||this.selectionColor;return this.curSelection=new km(e,n),this.curSelection.viewer=this.viewer,this.selectionsGroup.add(this.curSelection),this.curSelection}},{key:"removeSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this.selectionsGroup.children.length>0&&(-1===e&&(e=this.selectionsGroup.children.length-1),this.selectionsGroup.children.splice(e,1),this.curSelection=null,this._consoleCallBack&&this._consoleCallBack("删除成功!"))}},{key:"clearSelection",value:function(){this.selectionsGroup.children.splice(0,this.selectionsGroup.children.length)}},{key:"loadJson",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"SelectionData",t=localStorage.getItem(e);if(t){t=JSON.parse(t);for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"SelectionData",t=[],n=0;n0&&void 0!==arguments[0]?arguments[0]:-1;this.flyLinesGroup.children.length>0&&(-1===e&&(e=this.flyLinesGroup.children.length-1),this.flyLinesGroup.children.splice(e,1),this.curFlyLine=null,this._consoleCallBack&&this._consoleCallBack("删除成功!"))}},{key:"clearFlyLine",value:function(){this.flyLinesGroup.children.splice(0,this.flyLinesGroup.children.length)}},{key:"loadJson",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"FlyLineData",t=localStorage.getItem(e);if(t){t=JSON.parse(t);for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"FlyLineData",t=[],n=0;n=3){var n=new kf(this.viewer),i=new CA;i.moveTo(t[0].x,t[0].z);for(var r=1;r=i?(r=o)*i>a.height&&(r=s):(r=s)*e>a.width&&(r=o)}n.orthographicCamera=new FA(n.viewer.domElement.width/-2,n.viewer.domElement.width/2,n.viewer.domElement.height/2,n.viewer.domElement.height/-2,.1,1e7),n.orthographicCamera.zoom=r,n.orthographicCamera.updateProjectionMatrix(),n.targetMesh=new Ei(new $i(e,i),new Nn({map:n.texture,transparent:!0})),t.renderer.render(n.targetMesh,n.orthographicCamera);var l=t.renderer.domElement.toDataURL(),A=new Image;A.src=l;var c=window.open("","_blank");c.document.write(A.outerHTML),c.document.close()}}}return A(e,[{key:"addPanel",value:function(t,n){var i=new e.Panel(t,n,"#0ff");return this.container.appendChild(i.dom),i}},{key:"update",value:function(){Gm++;var e=0,t=0,n=0,i=0,r=0,a=0,o=[],s=[];this.visible&&(this.viewer.scene.traverse((function(l){(n++,l.isMesh)&&(e++,l.isSkinnedMesh&&t++,s.includes(l.geometry)||s.push(l.geometry),l.geometry.attributes&&l.geometry.attributes.position?i+=l.geometry.attributes.position.count:l.geometry.vertices&&(i+=l.geometry.vertices.length),l.geometry.index?r+=l.geometry.index.count:l.geometry.faces&&(r+=l.geometry.faces.length),l.material&&(Array.isArray(l.material)?l.material:[l.material]).forEach((function(e){o.includes(e.id)||(a++,o.push(e.id))})))})),this.facePanel.update(r),this.verticesPanel.update(i),this.meshPanel.update(e),this.skinnedMeshPanel.update(t),this.materialPanel.update(a),this.nodePanel.update(n));var l=(performance||Date).now();if(this.msPanel.update(l-zm,!0),l>=Qm+1e3&&(this.fpsPanel.update(1e3*Gm/(l-Qm),!0),Qm=l,Gm=0,this.memPanel)){var A=performance.memory;this.memPanel.update(A.usedJSHeapSize/1048576,!0)}this.targetPanel.update(this.texture?"展示纹理":void 0),zm=l}},{key:"visible",get:function(){return this._visible},set:function(e){this._visible=e,this.container.style.display=e?"flex":"none"}},{key:"formatBytes",value:function(e,t){if(0===e)return"0 bytes";var n=t<0?0:t,i=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,i)).toFixed(n))+" "+["bytes","KB","MB"][i]}}]),e}();Hm.Panel=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,i=1/0,r=0,a=Math.round,o=a(window.devicePixelRatio||1),s=140*o,l=20*o,A=3*o,c=4*o,h=document.createElement("canvas");h.width=s,h.height=l,h.style.cssText="width:140px;height:20px;";var u=h.getContext("2d");return u.font=12*o+"px Helvetica,Arial,sans-serif",u.textBaseline="top",u.clearRect(0,0,s,l),u.fillStyle=n,u.fillText(e,A,c),{dom:h,update:function(o,h){i=Math.min(i,o),r=Math.max(r,o),u.globalAlpha=1,u.clearRect(0,0,s,l),u.fillStyle=n,u.fillText((void 0!==o?e+(isNaN(o)?o:a(o)):"")+" "+t+(h?" ("+a(i)+"-"+a(r)+")":""),A,c)}}};var Vm,jm,Wm=function(){function e(t){var n=this;s(this,e),this.stream=t.captureStream(60),this.recorder=new MediaRecorder(this.stream,{mimeType:"video/webm;codecs=h264"}),this.allChunks=[],this.recorder.ondataavailable=function(e){n.allChunks.push(e.data)},this.element=document.createElement("div"),t.parentElement.appendChild(this.element),this.element.style.cssText="display: none;flex-direction: row;align-items: center;gap: 5px;background: #000000b5;position: absolute;top:0px;padding: 5px;left: 50%;transform: translateX(-50%);font-size: 12px;color: white;",this.element.innerHTML='正在录制 00:00',this.tip=this.element.querySelector("#label"),this.interval=null,this._timer=this._timer.bind(this),this.duration=0,this.timeLabel=""}return A(e,[{key:"start",value:function(){this._stop(),this.interval=setInterval(this._timer,1e3),this.tip.innerHTML="正在录制 00:00",this.duration=0,this.tipVisible=!0,this.allChunks=[],this.recorder.start(10)}},{key:"stop",value:function(){this._stop(),this.tip.innerHTML="录制完成 "+this.timeLabel}},{key:"_stop",value:function(){this.interval&&clearInterval(this.interval),"recording"===this.recorder.state&&this.recorder.stop()}},{key:"download",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"录屏";if(this.allChunks.length>0){var t=document.createElement("a");t.style.display="none";var n=new Blob(this.allChunks),i=window.URL.createObjectURL(n);t.href=i,t.download=e+".webm",document.body.appendChild(t),t.click(),t.remove()}else console.warn("无数据")}},{key:"preview",value:function(){if(this.allChunks.length>0){var e=new Blob(this.allChunks),t=window.URL.createObjectURL(e),n=document.createElement("video");n.style.cssText="max-width: 80%;max-height: 80%",n.controls=!0,n.src=t;var i=window.open("","_blank");i.document.write(n.outerHTML),i.document.close()}else console.warn("无数据")}},{key:"exit",value:function(){this.stop(),this.allChunks=[],this.tipVisible=!1}},{key:"_timer",value:function(){this.duration++,this.timeLabel="";var e=parseInt(this.duration/60),t=this.duration%60;this.timeLabel+=(e>9?e:"0"+e)+":",this.timeLabel+=t>9?t:"0"+t,this.tip.innerHTML="正在录制 "+this.timeLabel}},{key:"tipVisible",set:function(e){this.element.style.display=e?"flex":"none"}}]),e}(),Xm=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(this,n),(i=t.call(this,e,r)).isViewer=!0,i._debug=!1,i._mapLoader=null,!r.isMap&&i.initialize(r),i}return A(n,[{key:"screenShot",get:function(){console.warn("viewer.screenShot has been removed, use AMRT.ScreenHelper.screenShot(viewer) instead.")}},{key:"encircleScreenShot",get:function(){console.warn("viewer.screenShot has been removed, use AMRT.ScreenHelper.encircleScreenShot(viewer) instead.")}},{key:"intersectObjects",get:function(){return this.picker.intersectObjects.bind(this.picker)}},{key:"intersectObject",get:function(){return this.picker.intersectObject.bind(this.picker)}},{key:"intersectModels",get:function(){return this.picker.intersectModels.bind(this.picker)}},{key:"screenToVector",get:function(){return this.picker.screenToVector.bind(this.picker)}},{key:"vectorToScreen",get:function(){return this.picker.vectorToScreen.bind(this.picker)}},{key:"enableOutline",get:function(){return this.composer.enableOutline},set:function(e){this.composer.enableOutline=e}},{key:"outline",get:function(){return this.composer.outline}},{key:"enableUnrealBloom",get:function(){return this.composer.enableUnrealBloom},set:function(e){this.composer.enableUnrealBloom=e}},{key:"unrealBloom",get:function(){return this.composer.unrealBloom}},{key:"enableDof",get:function(){return this.composer.enableDof},set:function(e){this.composer.enableDof=e}},{key:"dof",get:function(){return this.composer.dof}},{key:"enableSSAO",get:function(){return this.composer.enableSSAO},set:function(e){this.composer.enableSSAO=e}},{key:"ssao",get:function(){return this.composer.ssao}},{key:"enableColorAdjustment",get:function(){return this.composer.enableColorAdjustment},set:function(e){this.composer.enableColorAdjustment=e}},{key:"colorAdjustment",get:function(){return this.composer.colorAdjustment}},{key:"enableVignette",get:function(){return this.composer.enableVignette},set:function(e){this.composer.enableVignette=e}},{key:"vignette",get:function(){return this.composer.vignette}},{key:"enableCircleSweep",get:function(){return this.composer.enableCircleSweep},set:function(e){this.composer.enableCircleSweep=e}},{key:"circleSweep",get:function(){return this.composer.circleSweep}},{key:"enableSSR",get:function(){return this.composer.enableSSR},set:function(e){this.composer.enableSSR=e}},{key:"ssr",get:function(){return this.composer.ssr}},{key:"mapLoader",get:function(){return this._mapLoader||(this._mapLoader=new Kf(this)),this._mapLoader}},{key:"materialEditor",get:function(){return Vm||(Vm=new wm(this)),Vm}},{key:"operator",get:function(){return jm||(jm=new sm(this)),jm}},{key:"enableTransform",get:function(){return Boolean(this.transform&&this.transform.enabled)},set:function(e){e?(!this.transform&&(this.transform=new bm(this)),this.transform.enabled=!0,this.transform.setMode(Mm.TRANSLATE)):(this.transform.enabled=!1,this.transform.setTarget(null))}},{key:"hotspot",get:function(){return this.moduleManager.hotspot}},{key:"basicModel",get:function(){return this._basicModel||(this._basicModel=new Pm(this)),this._basicModel}},{key:"basicEditor",get:function(){return this._basicEditor||(this._basicEditor=new Nm(this)),this._basicEditor}},{key:"initialize",value:function(e){this.picker=new xm(this),b(u(n.prototype),"initialize",this).call(this,e)}},{key:"dispose",value:function(){this.enableOutline=!1,this.enableDof=!1,this.enableUnrealBloom=!1,b(u(n.prototype),"dispose",this).call(this)}},{key:"debug",get:function(){return this._debug},set:function(e){var t=this;this.debugPanel||(this.debugPanel=new Hm(this),this.addEventListener("update",(function(){t.debugPanel.update()}))),this.debugPanel.visible=this._debug=e}},{key:"recorder",get:function(){return this._recorder||(this._recorder=new Wm(this.domElement)),this._recorder}}]),n}(tm),Ym=A((function e(){s(this,e)}));Ym.CENTER="center",Ym.LEFT="left",Ym.RIGHT="right",Ym.TOP="top",Ym.BOTTOM="bottom",Ym.TOP_LEFT="top-left",Ym.TOP_RIGHT="top-right",Ym.BOTTOM_LEFT="bottom-left",Ym.BOTTOM_RIGHT="bottom-right";var Km=function(){function e(t){var n=this;s(this,e),this.position=t.position.clone(),this.objectId=t.objectId,this.worldPos=t.worldPos,this.cameraView=t.cameraView,this.cameraView&&this.cameraView.position&&this.cameraView.target&&(this.cameraView.position=Array.isArray(this.cameraView.position)?(new at).fromArray(this.cameraView.position):(new at).copy(this.cameraView.position),this.cameraView.target=Array.isArray(this.cameraView.target)?(new at).fromArray(this.cameraView.target):(new at).copy(this.cameraView.target)),this.element=t.element,this.onUpdate=t.onUpdate,this.userData=t.userData||{},this.screenCoord=void 0,this.onclick=t.onclick,this.anchor=t.anchor||Ym.BOTTOM,this.offset=t.offset||new tt,this.hided=!1,this.focus=function(){},this.complete=t.complete,this.flicker=t.flicker,this.flicker&&this.showFlicker(),this.element.onclick=function(e){n.focus(),n.onclick&&n.onclick(e)}}return A(e,[{key:"showFlicker",value:function(){var e=this;this.interval||(this.interval=setInterval((function(){e.element.parentElement&&!e.hided&&(e.element.style.display="none"==e.element.style.display?"block":"none")}),500))}},{key:"stopFlicker",value:function(){this.interval&&(clearInterval(this.interval),this.interval=null,this.element.style.display=this.hided?"none":"block")}},{key:"updateScreenCoords",value:function(e){if(e){this.screenCoord=e;var t=this._convertAnchor();this.element.style.left=e.x+t.x+this.offset.x+"px",this.element.style.top=e.y+t.y+this.offset.y+"px"}}},{key:"hide",value:function(){this.element.style.display="none",this.hided=!0}},{key:"show",value:function(){this.element.style.display="block",this.hided=!1}},{key:"remove",value:function(){this.element.parentElement&&this.element.parentElement.removeChild(this.element),this.stopFlicker()}},{key:"toJSON",value:function(){return{position:this.worldPos?this.worldPos.toArray():this.position.toArray(),objectId:this.objectId,cameraView:{position:this.cameraView&&this.cameraView.position?this.cameraView.position.toArray():null,target:this.cameraView&&this.cameraView.target?this.cameraView.target.toArray():null},element:(new XMLSerializer).serializeToString(this.element),userData:this.userData}}},{key:"_convertAnchor",value:function(){var e=this.element.getBoundingClientRect(),t=new tt;switch(this.anchor){case"center":t.set(-e.width/2,-e.height/2);break;case"top":t.set(-e.width/2,0);break;case"bottom":t.set(-e.width/2,-e.height);break;case"left":t.set(0,-e.height/2);break;case"right":t.set(-e.width,-e.height/2);break;case"top-left":t.set(0,0);break;case"top-right":t.set(-e.width,0);break;case"bottom-left":t.set(0,-e.height);break;case"bottom-right":t.set(-e.width,-e.height)}return t}}]),e}(),Zm=function(){function e(){s(this,e),this.spots=[],this._visible=!0,this.name=""}return A(e,[{key:"visible",get:function(){return this._visible},set:function(e){this._setVisible(e)}},{key:"hide",value:function(){this._setVisible(0)}},{key:"show",value:function(){this._setVisible(1)}},{key:"add",value:function(e){this.spots.push(e),e.parent=this}},{key:"remove",value:function(e){this.spots.remove(e),e.remove(),e.parent=null}},{key:"removeAll",value:function(){this.spots.forEach((function(e){e.remove()})),this.spots=[]}},{key:"_setVisible",value:function(e){this._visible=e,this.spots.forEach((function(t){e?t.show():t.hide()}))}},{key:"toJSON",value:function(){var e=[];return this.spots.forEach((function(t){e.push(t.toJSON())})),e}}]),e}();"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Jm(e){var t={exports:{}};return e(t,t.exports),t.exports /*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen * Released under MIT License */}var qm=Jm((function(e,t){e.exports=function(){ /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]=55296&&r<=56319&&n>10),o%1024+56320)),(r+1===n||i.length>16384)&&(a+=String.fromCharCode.apply(String,i),i.length=0)}return a},h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="undefined"==typeof Uint8Array?[]:new Uint8Array(256),d=0;d>4,c[l++]=(15&i)<<4|r>>2,c[l++]=(3&r)<<6|63&a;return A},g=function(e){for(var t=e.length,n=[],i=0;i>w,C=(1<>w)+32,E=65536>>x,S=(1<=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>w])<>w)])<>x),t=this.index[t],t+=e>>w&S,t=((t=this.index[t])<U?(r.push(!0),o-=U):r.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return i.push(a),n.push(Z);if(o===N||o===j){if(0===a)return i.push(a),n.push(ce);var s=n[a-1];return-1===ke.indexOf(s)?(i.push(i[a-1]),n.push(s)):(i.push(a),n.push(ce))}return i.push(a),o===he?n.push("strict"===t?te:ve):o===be||o===Ae?n.push(ce):o===Me?e>=131072&&e<=196605||e>=196608&&e<=262141?n.push(ve):n.push(ce):void n.push(o)})),[i,n,r]},Re=function(e,t,n,i){var r=i[n];if(Array.isArray(e)?-1!==e.indexOf(r):e===r)for(var a=n;a<=i.length;){if((l=i[++a])===t)return!0;if(l!==V)break}if(r===V)for(a=n;a>0;){var o=i[--a];if(Array.isArray(e)?-1!==e.indexOf(o):e===o)for(var s=n;s<=i.length;){var l;if((l=i[++s])===t)return!0;if(l!==V)break}if(o!==V)break}return!1},Oe=function(e,t){for(var n=e;n>=0;){var i=t[n];if(i!==V)return i;n--}return 0},Ne=function(e,t,n,i,r){if(0===n[i])return Ee;var a=i-1;if(Array.isArray(r)&&!0===r[a])return Ee;var o=a-1,s=a+1,l=t[a],A=o>=0?t[o]:0,c=t[s];if(l===R&&c===O)return Ee;if(-1!==Ie.indexOf(l))return Be;if(-1!==Ie.indexOf(c))return Ee;if(-1!==Le.indexOf(c))return Ee;if(Oe(a,t)===G)return Se;if(Te.get(e[a])===j)return Ee;if((l===ue||l===de)&&Te.get(e[s])===j)return Ee;if(l===Q||c===Q)return Ee;if(l===H)return Ee;if(-1===[V,X,K].indexOf(l)&&c===H)return Ee;if(-1!==[J,q,$,re,le].indexOf(c))return Ee;if(Oe(a,t)===ne)return Ee;if(Re(ie,ne,a,t))return Ee;if(Re([J,q],te,a,t))return Ee;if(Re(W,W,a,t))return Ee;if(l===V)return Se;if(l===ie||c===ie)return Ee;if(c===Z||l===Z)return Se;if(-1!==[X,K,te].indexOf(c)||l===Y)return Ee;if(A===me&&-1!==Ue.indexOf(l))return Ee;if(l===le&&c===me)return Ee;if(c===ee)return Ee;if(-1!==_e.indexOf(c)&&l===ae||-1!==_e.indexOf(l)&&c===ae)return Ee;if(l===se&&-1!==[ve,ue,de].indexOf(c)||-1!==[ve,ue,de].indexOf(l)&&c===oe)return Ee;if(-1!==_e.indexOf(l)&&-1!==Fe.indexOf(c)||-1!==Fe.indexOf(l)&&-1!==_e.indexOf(c))return Ee;if(-1!==[se,oe].indexOf(l)&&(c===ae||-1!==[ne,K].indexOf(c)&&t[s+1]===ae)||-1!==[ne,K].indexOf(l)&&c===ae||l===ae&&-1!==[ae,le,re].indexOf(c))return Ee;if(-1!==[ae,le,re,J,q].indexOf(c))for(var h=a;h>=0;){if((u=t[h])===ae)return Ee;if(-1===[le,re].indexOf(u))break;h--}if(-1!==[se,oe].indexOf(c))for(h=-1!==[J,q].indexOf(l)?o:a;h>=0;){var u;if((u=t[h])===ae)return Ee;if(-1===[le,re].indexOf(u))break;h--}if(ge===l&&-1!==[ge,ye,fe,pe].indexOf(c)||-1!==[ye,fe].indexOf(l)&&-1!==[ye,we].indexOf(c)||-1!==[we,pe].indexOf(l)&&c===we)return Ee;if(-1!==Pe.indexOf(l)&&-1!==[ee,oe].indexOf(c)||-1!==Pe.indexOf(c)&&l===se)return Ee;if(-1!==_e.indexOf(l)&&-1!==_e.indexOf(c))return Ee;if(l===re&&-1!==_e.indexOf(c))return Ee;if(-1!==_e.concat(ae).indexOf(l)&&c===ne&&-1===Ce.indexOf(e[s])||-1!==_e.concat(ae).indexOf(c)&&l===q)return Ee;if(l===xe&&c===xe){for(var d=n[a],f=1;d>0&&t[--d]===xe;)f++;if(f%2!=0)return Ee}return l===ue&&c===de?Ee:Se},ze=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var n=De(e,t.lineBreak),i=n[0],r=n[1],a=n[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(r=r.map((function(e){return-1!==[ae,ce,be].indexOf(e)?ve:e})));var o="keep-all"===t.wordBreak?a.map((function(t,n){return t&&e[n]>=19968&&e[n]<=40959})):void 0;return[i,r,o]},Qe=function(){function e(e,t,n,i){this.codePoints=e,this.required=t===Be,this.start=n,this.end=i}return e.prototype.slice=function(){return c.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Ge=function(e,t){var n=A(e),i=ze(n,t),r=i[0],a=i[1],o=i[2],s=n.length,l=0,c=0;return{next:function(){if(c>=s)return{done:!0,value:null};for(var e=Ee;c=Ut&&e<=57},Xt=function(e){return e>=55296&&e<=57343},Yt=function(e){return Wt(e)||e>=Qt&&e<=Ht||e>=Dt&&e<=Ot},Kt=function(e){return e>=Dt&&e<=zt},Zt=function(e){return e>=Qt&&e<=jt},Jt=function(e){return Kt(e)||Zt(e)},qt=function(e){return e>=wt},$t=function(e){return e===Xe||e===Ze||e===Je},en=function(e){return Jt(e)||qt(e)||e===ot},tn=function(e){return en(e)||Wt(e)||e===st},nn=function(e){return e>=Tt&&e<=_t||e===It||e>=Lt&&e<=Ft||e===kt},rn=function(e,t){return e===Ke&&t!==Xe},an=function(e,t,n){return e===st?en(t)||rn(t,n):!!en(e)||!(e!==Ke||!rn(e,t))},on=function(e,t,n){return e===Mt||e===st?!!Wt(t)||t===St&&Wt(n):Wt(e===St?t:e)},sn=function(e){var t=0,n=1;e[t]!==Mt&&e[t]!==st||(e[t]===st&&(n=-1),t++);for(var i=[];Wt(e[t]);)i.push(e[t++]);var r=i.length?parseInt(c.apply(void 0,i),10):0;e[t]===St&&t++;for(var a=[];Wt(e[t]);)a.push(e[t++]);var o=a.length,s=o?parseInt(c.apply(void 0,a),10):0;e[t]!==Gt&&e[t]!==Rt||t++;var l=1;e[t]!==Mt&&e[t]!==st||(e[t]===st&&(l=-1),t++);for(var A=[];Wt(e[t]);)A.push(e[t++]);var h=A.length?parseInt(c.apply(void 0,A),10):0;return n*(r+s*Math.pow(10,-o))*Math.pow(10,l*h)},ln={type:2},An={type:3},cn={type:4},hn={type:13},un={type:8},dn={type:21},fn={type:9},pn={type:10},mn={type:11},vn={type:12},gn={type:14},yn={type:23},wn={type:1},xn={type:25},bn={type:24},Mn={type:26},Cn={type:27},Bn={type:28},En={type:29},Sn={type:31},Tn={type:32},_n=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(A(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Tn;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case qe:return this.consumeStringToken(qe);case et:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),i=this.peekCodePoint(2);if(tn(t)||rn(n,i)){var r=an(t,n,i)?Ve:He;return{type:5,value:this.consumeName(),flags:r}}break;case tt:if(this.peekCodePoint(0)===$e)return this.consumeCodePoint(),hn;break;case it:return this.consumeStringToken(it);case rt:return ln;case at:return An;case bt:if(this.peekCodePoint(0)===$e)return this.consumeCodePoint(),gn;break;case Mt:if(on(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Ct:return cn;case st:var a=e,o=this.peekCodePoint(0),s=this.peekCodePoint(1);if(on(a,o,s))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(an(a,o,s))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(o===st&&s===ct)return this.consumeCodePoint(),this.consumeCodePoint(),bn;break;case St:if(on(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Ye:if(this.peekCodePoint(0)===bt)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===bt&&(l=this.consumeCodePoint())===Ye)return this.consumeToken();if(l===Pt)return this.consumeToken()}break;case Bt:return Mn;case Et:return Cn;case At:if(this.peekCodePoint(0)===lt&&this.peekCodePoint(1)===st&&this.peekCodePoint(2)===st)return this.consumeCodePoint(),this.consumeCodePoint(),xn;break;case ht:var A=this.peekCodePoint(0),h=this.peekCodePoint(1),u=this.peekCodePoint(2);if(an(A,h,u))return{type:7,value:this.consumeName()};break;case ut:return Bn;case Ke:if(rn(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case dt:return En;case ft:if(this.peekCodePoint(0)===$e)return this.consumeCodePoint(),un;break;case pt:return mn;case vt:return vn;case Nt:case Vt:var d=this.peekCodePoint(0),f=this.peekCodePoint(1);return d!==Mt||!Yt(f)&&f!==mt||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case gt:if(this.peekCodePoint(0)===$e)return this.consumeCodePoint(),fn;if(this.peekCodePoint(0)===gt)return this.consumeCodePoint(),dn;break;case yt:if(this.peekCodePoint(0)===$e)return this.consumeCodePoint(),pn;break;case Pt:return Tn}return $t(e)?(this.consumeWhiteSpace(),Sn):Wt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):en(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:c(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Yt(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;t===mt&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n)return{type:30,start:parseInt(c.apply(void 0,e.map((function(e){return e===mt?Ut:e}))),16),end:parseInt(c.apply(void 0,e.map((function(e){return e===mt?Ht:e}))),16)};var i=parseInt(c.apply(void 0,e),16);if(this.peekCodePoint(0)===st&&Yt(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var r=[];Yt(t)&&r.length<6;)r.push(t),t=this.consumeCodePoint();return{type:30,start:i,end:parseInt(c.apply(void 0,r),16)}}return{type:30,start:i,end:i}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&this.peekCodePoint(0)===rt?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===rt?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Pt)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===it||t===qe){var n=this.consumeStringToken(this.consumeCodePoint());return 0===n.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Pt||this.peekCodePoint(0)===at)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),yn)}for(;;){var i=this.consumeCodePoint();if(i===Pt||i===at)return{type:22,value:c.apply(void 0,e)};if($t(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Pt||this.peekCodePoint(0)===at?(this.consumeCodePoint(),{type:22,value:c.apply(void 0,e)}):(this.consumeBadUrlRemnants(),yn);if(i===qe||i===it||i===rt||nn(i))return this.consumeBadUrlRemnants(),yn;if(i===Ke){if(!rn(i,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),yn;e.push(this.consumeEscapedCodePoint())}else e.push(i)}},e.prototype.consumeWhiteSpace=function(){for(;$t(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===at||e===Pt)return;rn(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t=5e4,n="";e>0;){var i=Math.min(t,e);n+=c.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),n},e.prototype.consumeStringToken=function(e){for(var t="",n=0;;){var i=this._value[n];if(i===Pt||void 0===i||i===e)return{type:0,value:t+=this.consumeStringSlice(n)};if(i===Xe)return this._value.splice(0,n),wn;if(i===Ke){var r=this._value[n+1];r!==Pt&&void 0!==r&&(r===Xe?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):rn(i,r)&&(t+=this.consumeStringSlice(n),t+=c(this.consumeEscapedCodePoint()),n=-1))}n++}},e.prototype.consumeNumber=function(){var e=[],t=je,n=this.peekCodePoint(0);for(n!==Mt&&n!==st||e.push(this.consumeCodePoint());Wt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(n===St&&Wt(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=We;Wt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),i=this.peekCodePoint(1);var r=this.peekCodePoint(2);if((n===Gt||n===Rt)&&((i===Mt||i===st)&&Wt(r)||Wt(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=We;Wt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[sn(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],i=this.peekCodePoint(0),r=this.peekCodePoint(1),a=this.peekCodePoint(2);return an(i,r,a)?{type:15,number:t,flags:n,unit:this.consumeName()}:i===nt?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Yt(e)){for(var t=c(e);Yt(this.peekCodePoint(0))&&t.length<6;)t+=c(this.consumeCodePoint());$t(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return 0===n||Xt(n)||n>1114111?xt:n}return e===Pt?xt:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(tn(t))e+=c(t);else{if(!rn(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=c(this.consumeEscapedCodePoint())}}},e}(),In=function(){function e(e){this._tokens=e}return e.create=function(t){var n=new _n;return n.write(t),new e(n.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(32===n.type||Nn(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(32===n.type||3===n.type)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?Tn:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Ln=function(e){return 15===e.type},Fn=function(e){return 17===e.type},kn=function(e){return 20===e.type},Pn=function(e){return 0===e.type},Un=function(e,t){return kn(e)&&e.value===t},Dn=function(e){return 31!==e.type},Rn=function(e){return 31!==e.type&&4!==e.type},On=function(e){var t=[],n=[];return e.forEach((function(e){if(4===e.type){if(0===n.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(n),void(n=[])}31!==e.type&&n.push(e)})),n.length&&t.push(n),t},Nn=function(e,t){return 11===t&&12===e.type||28===t&&29===e.type||2===t&&3===e.type},zn=function(e){return 17===e.type||15===e.type},Qn=function(e){return 16===e.type||zn(e)},Gn=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},Hn={type:17,number:0,flags:je},Vn={type:16,number:50,flags:je},jn={type:16,number:100,flags:je},Wn=function(e,t,n){var i=e[0],r=e[1];return[Xn(i,t),Xn(void 0!==r?r:i,n)]},Xn=function(e,t){if(16===e.type)return e.number/100*t;if(Ln(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},Yn="deg",Kn="grad",Zn="rad",Jn="turn",qn={name:"angle",parse:function(e,t){if(15===t.type)switch(t.unit){case Yn:return Math.PI*t.number/180;case Kn:return Math.PI/200*t.number;case Zn:return t.number;case Jn:return 2*Math.PI*t.number}throw new Error("Unsupported angle type")}},$n=function(e){return 15===e.type&&(e.unit===Yn||e.unit===Kn||e.unit===Zn||e.unit===Jn)},ei=function(e){switch(e.filter(kn).map((function(e){return e.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Hn,Hn];case"to top":case"bottom":return ti(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Hn,jn];case"to right":case"left":return ti(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[jn,jn];case"to bottom":case"top":return ti(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[jn,Hn];case"to left":case"right":return ti(270)}return 0},ti=function(e){return Math.PI*e/180},ni={name:"color",parse:function(e,t){if(18===t.type){var n=ci[t.name];if(void 0===n)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return n(e,t.values)}if(5===t.type){if(3===t.value.length){var i=t.value.substring(0,1),r=t.value.substring(1,2),a=t.value.substring(2,3);return ai(parseInt(i+i,16),parseInt(r+r,16),parseInt(a+a,16),1)}if(4===t.value.length){i=t.value.substring(0,1),r=t.value.substring(1,2),a=t.value.substring(2,3);var o=t.value.substring(3,4);return ai(parseInt(i+i,16),parseInt(r+r,16),parseInt(a+a,16),parseInt(o+o,16)/255)}if(6===t.value.length)return i=t.value.substring(0,2),r=t.value.substring(2,4),a=t.value.substring(4,6),ai(parseInt(i,16),parseInt(r,16),parseInt(a,16),1);if(8===t.value.length)return i=t.value.substring(0,2),r=t.value.substring(2,4),a=t.value.substring(4,6),o=t.value.substring(6,8),ai(parseInt(i,16),parseInt(r,16),parseInt(a,16),parseInt(o,16)/255)}if(20===t.type){var s=ui[t.value.toUpperCase()];if(void 0!==s)return s}return ui.TRANSPARENT}},ii=function(e){return 0==(255&e)},ri=function(e){var t=255&e,n=255&e>>8,i=255&e>>16,r=255&e>>24;return t<255?"rgba("+r+","+i+","+n+","+t/255+")":"rgb("+r+","+i+","+n+")"},ai=function(e,t,n,i){return(e<<24|t<<16|n<<8|Math.round(255*i)<<0)>>>0},oi=function(e,t){if(17===e.type)return e.number;if(16===e.type){var n=3===t?1:255;return 3===t?e.number/100*n:Math.round(e.number/100*n)}return 0},si=function(e,t){var n=t.filter(Rn);if(3===n.length){var i=n.map(oi),r=i[0],a=i[1],o=i[2];return ai(r,a,o,1)}if(4===n.length){var s=n.map(oi),l=(r=s[0],a=s[1],o=s[2],s[3]);return ai(r,a,o,l)}return 0};function li(e,t,n){return n<0&&(n+=1),n>=1&&(n-=1),n<1/6?(t-e)*n*6+e:n<.5?t:n<2/3?6*(t-e)*(2/3-n)+e:e}var Ai=function(e,t){var n=t.filter(Rn),i=n[0],r=n[1],a=n[2],o=n[3],s=(17===i.type?ti(i.number):qn.parse(e,i))/(2*Math.PI),l=Qn(r)?r.number/100:0,A=Qn(a)?a.number/100:0,c=void 0!==o&&Qn(o)?Xn(o,1):1;if(0===l)return ai(255*A,255*A,255*A,1);var h=A<=.5?A*(l+1):A+l-A*l,u=2*A-h,d=li(u,h,s+1/3),f=li(u,h,s),p=li(u,h,s-1/3);return ai(255*d,255*f,255*p,c)},ci={hsl:Ai,hsla:Ai,rgb:si,rgba:si},hi=function(e,t){return ni.parse(e,In.create(t).parseComponentValue())},ui={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},di={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(kn(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},fi={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},pi=function(e,t){var n=ni.parse(e,t[0]),i=t[1];return i&&Qn(i)?{color:n,stop:i}:{color:n,stop:null}},mi=function(e,t){var n=e[0],i=e[e.length-1];null===n.stop&&(n.stop=Hn),null===i.stop&&(i.stop=jn);for(var r=[],a=0,o=0;oa?r.push(l):r.push(a),a=l}else r.push(null)}var A=null;for(o=0;oe.optimumDistance)?{optimumCorner:t,optimumDistance:s}:e}),{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},xi=function(e,t,n,i,r){var a=0,o=0;switch(e.size){case 0:0===e.shape?a=o=Math.min(Math.abs(t),Math.abs(t-i),Math.abs(n),Math.abs(n-r)):1===e.shape&&(a=Math.min(Math.abs(t),Math.abs(t-i)),o=Math.min(Math.abs(n),Math.abs(n-r)));break;case 2:if(0===e.shape)a=o=Math.min(yi(t,n),yi(t,n-r),yi(t-i,n),yi(t-i,n-r));else if(1===e.shape){var s=Math.min(Math.abs(n),Math.abs(n-r))/Math.min(Math.abs(t),Math.abs(t-i)),l=wi(i,r,t,n,!0),A=l[0],c=l[1];o=s*(a=yi(A-t,(c-n)/s))}break;case 1:0===e.shape?a=o=Math.max(Math.abs(t),Math.abs(t-i),Math.abs(n),Math.abs(n-r)):1===e.shape&&(a=Math.max(Math.abs(t),Math.abs(t-i)),o=Math.max(Math.abs(n),Math.abs(n-r)));break;case 3:if(0===e.shape)a=o=Math.max(yi(t,n),yi(t,n-r),yi(t-i,n),yi(t-i,n-r));else if(1===e.shape){s=Math.max(Math.abs(n),Math.abs(n-r))/Math.max(Math.abs(t),Math.abs(t-i));var h=wi(i,r,t,n,!1);A=h[0],c=h[1],o=s*(a=yi(A-t,(c-n)/s))}}return Array.isArray(e.size)&&(a=Xn(e.size[0],i),o=2===e.size.length?Xn(e.size[1],r):a),[a,o]},bi=function(e,t){var n=ti(180),i=[];return On(t).forEach((function(t,r){if(0===r){var a=t[0];if(20===a.type&&"to"===a.value)return void(n=ei(t));if($n(a))return void(n=qn.parse(e,a))}var o=pi(e,t);i.push(o)})),{angle:n,stops:i,type:1}},Mi=function(e,t){var n=ti(180),i=[];return On(t).forEach((function(t,r){if(0===r){var a=t[0];if(20===a.type&&-1!==["top","left","right","bottom"].indexOf(a.value))return void(n=ei(t));if($n(a))return void(n=(qn.parse(e,a)+ti(270))%ti(360))}var o=pi(e,t);i.push(o)})),{angle:n,stops:i,type:1}},Ci=function(e,t){var n=ti(180),i=[],r=1,a=0,o=3,s=[];return On(t).forEach((function(t,n){var a=t[0];if(0===n){if(kn(a)&&"linear"===a.value)return void(r=1);if(kn(a)&&"radial"===a.value)return void(r=2)}if(18===a.type)if("from"===a.name){var o=ni.parse(e,a.values[0]);i.push({stop:Hn,color:o})}else if("to"===a.name)o=ni.parse(e,a.values[0]),i.push({stop:jn,color:o});else if("color-stop"===a.name){var s=a.values.filter(Rn);if(2===s.length){o=ni.parse(e,s[1]);var l=s[0];Fn(l)&&i.push({stop:{type:16,number:100*l.number,flags:l.flags},color:o})}}})),1===r?{angle:(n+ti(180))%ti(360),stops:i,type:r}:{size:o,shape:a,stops:i,position:s,type:r}},Bi="closest-side",Ei="farthest-side",Si="closest-corner",Ti="farthest-corner",_i="circle",Ii="ellipse",Li="cover",Fi="contain",ki=function(e,t){var n=0,i=3,r=[],a=[];return On(t).forEach((function(t,o){var s=!0;if(0===o){var l=!1;s=t.reduce((function(e,t){if(l)if(kn(t))switch(t.value){case"center":return a.push(Vn),e;case"top":case"left":return a.push(Hn),e;case"right":case"bottom":return a.push(jn),e}else(Qn(t)||zn(t))&&a.push(t);else if(kn(t))switch(t.value){case _i:return n=0,!1;case Ii:return n=1,!1;case"at":return l=!0,!1;case Bi:return i=0,!1;case Li:case Ei:return i=1,!1;case Fi:case Si:return i=2,!1;case Ti:return i=3,!1}else if(zn(t)||Qn(t))return Array.isArray(i)||(i=[]),i.push(t),!1;return e}),s)}if(s){var A=pi(e,t);r.push(A)}})),{size:i,shape:n,stops:r,position:a,type:2}},Pi=function(e,t){var n=0,i=3,r=[],a=[];return On(t).forEach((function(t,o){var s=!0;if(0===o?s=t.reduce((function(e,t){if(kn(t))switch(t.value){case"center":return a.push(Vn),!1;case"top":case"left":return a.push(Hn),!1;case"right":case"bottom":return a.push(jn),!1}else if(Qn(t)||zn(t))return a.push(t),!1;return e}),s):1===o&&(s=t.reduce((function(e,t){if(kn(t))switch(t.value){case _i:return n=0,!1;case Ii:return n=1,!1;case Fi:case Bi:return i=0,!1;case Ei:return i=1,!1;case Si:return i=2,!1;case Li:case Ti:return i=3,!1}else if(zn(t)||Qn(t))return Array.isArray(i)||(i=[]),i.push(t),!1;return e}),s)),s){var l=pi(e,t);r.push(l)}})),{size:i,shape:n,stops:r,position:a,type:2}},Ui=function(e){return 1===e.type},Di=function(e){return 2===e.type},Ri={name:"image",parse:function(e,t){if(22===t.type){var n={url:t.value,type:0};return e.cache.addImage(t.value),n}if(18===t.type){var i=zi[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return i(e,t.values)}throw new Error("Unsupported image type "+t.type)}};function Oi(e){return!(20===e.type&&"none"===e.value||18===e.type&&!zi[e.name])}var Ni,zi={"linear-gradient":bi,"-moz-linear-gradient":Mi,"-ms-linear-gradient":Mi,"-o-linear-gradient":Mi,"-webkit-linear-gradient":Mi,"radial-gradient":ki,"-moz-radial-gradient":Pi,"-ms-radial-gradient":Pi,"-o-radial-gradient":Pi,"-webkit-radial-gradient":Pi,"-webkit-gradient":Ci},Qi={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var n=t[0];return 20===n.type&&"none"===n.value?[]:t.filter((function(e){return Rn(e)&&Oi(e)})).map((function(t){return Ri.parse(e,t)}))}},Gi={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(kn(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},Hi={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return On(t).map((function(e){return e.filter(Qn)})).map(Gn)}},Vi={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return On(t).map((function(e){return e.filter(kn).map((function(e){return e.value})).join(" ")})).map(ji)}},ji=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}(Ni||(Ni={}));var Wi,Xi={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return On(t).map((function(e){return e.filter(Yi)}))}},Yi=function(e){return kn(e)||Qn(e)},Ki=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Zi=Ki("top"),Ji=Ki("right"),qi=Ki("bottom"),$i=Ki("left"),er=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Gn(t.filter(Qn))}}},tr=er("top-left"),nr=er("top-right"),ir=er("bottom-right"),rr=er("bottom-left"),ar=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},or=ar("top"),sr=ar("right"),lr=ar("bottom"),Ar=ar("left"),cr=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Ln(t)?t.number:0}}},hr=cr("top"),ur=cr("right"),dr=cr("bottom"),fr=cr("left"),pr={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},mr={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},vr={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(kn).reduce((function(e,t){return e|gr(t.value)}),0)}},gr=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},yr={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},wr={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(Wi||(Wi={}));var xr,br={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?Wi.STRICT:Wi.NORMAL}},Mr={name:"line-height",initialValue:"normal",prefix:!1,type:4},Cr=function(e,t){return kn(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:Qn(e)?Xn(e,t):t},Br={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:Ri.parse(e,t)}},Er={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},Sr={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Tr=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},_r=Tr("top"),Ir=Tr("right"),Lr=Tr("bottom"),Fr=Tr("left"),kr={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(kn).map((function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},Pr={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},Ur=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Dr=Ur("top"),Rr=Ur("right"),Or=Ur("bottom"),Nr=Ur("left"),zr={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Qr={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Gr={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&Un(t[0],"none")?[]:On(t).map((function(t){for(var n={color:ui.TRANSPARENT,offsetX:Hn,offsetY:Hn,blur:Hn},i=0,r=0;r1?1:0],this.overflowWrap=xa(e,Pr,t.overflowWrap),this.paddingTop=xa(e,Dr,t.paddingTop),this.paddingRight=xa(e,Rr,t.paddingRight),this.paddingBottom=xa(e,Or,t.paddingBottom),this.paddingLeft=xa(e,Nr,t.paddingLeft),this.paintOrder=xa(e,pa,t.paintOrder),this.position=xa(e,Qr,t.position),this.textAlign=xa(e,zr,t.textAlign),this.textDecorationColor=xa(e,ea,null!==(n=t.textDecorationColor)&&void 0!==n?n:t.color),this.textDecorationLine=xa(e,ta,null!==(i=t.textDecorationLine)&&void 0!==i?i:t.textDecoration),this.textShadow=xa(e,Gr,t.textShadow),this.textTransform=xa(e,Hr,t.textTransform),this.transform=xa(e,Vr,t.transform),this.transformOrigin=xa(e,Yr,t.transformOrigin),this.visibility=xa(e,Kr,t.visibility),this.webkitTextStrokeColor=xa(e,ma,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=xa(e,va,t.webkitTextStrokeWidth),this.wordBreak=xa(e,Zr,t.wordBreak),this.zIndex=xa(e,Jr,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return ii(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return sa(this.display,4)||sa(this.display,33554432)||sa(this.display,268435456)||sa(this.display,536870912)||sa(this.display,67108864)||sa(this.display,134217728)},e}(),ya=function(){function e(e,t){this.content=xa(e,la,t.content),this.quotes=xa(e,ua,t.quotes)}return e}(),wa=function(){function e(e,t){this.counterIncrement=xa(e,Aa,t.counterIncrement),this.counterReset=xa(e,ca,t.counterReset)}return e}(),xa=function(e,t,n){var i=new _n,r=null!=n?n.toString():t.initialValue;i.write(r);var a=new In(i.read());switch(t.type){case 2:var o=a.parseComponentValue();return t.parse(e,kn(o)?o.value:t.initialValue);case 0:return t.parse(e,a.parseComponentValue());case 1:return t.parse(e,a.parseComponentValues());case 4:return a.parseComponentValue();case 3:switch(t.format){case"angle":return qn.parse(e,a.parseComponentValue());case"color":return ni.parse(e,a.parseComponentValue());case"image":return Ri.parse(e,a.parseComponentValue());case"length":var s=a.parseComponentValue();return zn(s)?s:Hn;case"length-percentage":var l=a.parseComponentValue();return Qn(l)?l:Hn;case"time":return qr.parse(e,a.parseComponentValue())}}},ba="data-html2canvas-debug",Ma=function(e){switch(e.getAttribute(ba)){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Ca=function(e,t){var n=Ma(e);return 1===n||t===n},Ba=function(){function e(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Ca(t,3),this.styles=new ga(e,window.getComputedStyle(t,null)),ds(t)&&(this.styles.animationDuration.some((function(e){return e>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=s(this.context,t),Ca(t,4)&&(this.flags|=16)}return e}(),Ea="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Sa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ta="undefined"==typeof Uint8Array?[]:new Uint8Array(256),_a=0;_a>4,c[l++]=(15&i)<<4|r>>2,c[l++]=(3&r)<<6|63&a;return A},La=function(e){for(var t=e.length,n=[],i=0;i>ka,Ra=(1<>ka)+32,Na=65536>>Pa,za=(1<=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>ka])<>ka)])<>Pa),t=this.index[t],t+=e>>ka&za,t=((t=this.index[t])<=55296&&r<=56319&&n>10),o%1024+56320)),(r+1===n||i.length>16384)&&(a+=String.fromCharCode.apply(String,i),i.length=0)}return a},ho=Ha(Ea),uo="×",fo="÷",po=function(e){return ho.get(e)},mo=function(e,t,n){var i=n-2,r=t[i],a=t[n-1],o=t[n];if(a===Za&&o===Ja)return uo;if(a===Za||a===Ja||a===qa)return fo;if(o===Za||o===Ja||o===qa)return fo;if(a===to&&-1!==[to,no,ro,ao].indexOf(o))return uo;if(!(a!==ro&&a!==no||o!==no&&o!==io))return uo;if((a===ao||a===io)&&o===io)return uo;if(o===oo||o===$a)return uo;if(o===eo)return uo;if(a===Ka)return uo;if(a===oo&&o===so){for(;r===$a;)r=t[--i];if(r===so)return uo}if(a===lo&&o===lo){for(var s=0;r===lo;)s++,r=t[--i];if(s%2==0)return uo}return fo},vo=function(e){var t=Ao(e),n=t.length,i=0,r=0,a=t.map(po);return{next:function(){if(i>=n)return{done:!0,value:null};for(var e=uo;io.x||r.y>o.y;return o=r,0===t||s}));return e.body.removeChild(t),s},xo=function(){return void 0!==(new Image).crossOrigin},bo=function(){return"string"==typeof(new XMLHttpRequest).responseType},Mo=function(e){var t=new Image,n=e.createElement("canvas"),i=n.getContext("2d");if(!i)return!1;t.src="data:image/svg+xml,";try{i.drawImage(t,0,0),n.toDataURL()}catch(e){return!1}return!0},Co=function(e){return 0===e[0]&&255===e[1]&&0===e[2]&&255===e[3]},Bo=function(e){var t=e.createElement("canvas"),n=100;t.width=n,t.height=n;var i=t.getContext("2d");if(!i)return Promise.reject(!1);i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,n,n);var r=new Image,a=t.toDataURL();r.src=a;var o=Eo(n,n,0,0,r);return i.fillStyle="red",i.fillRect(0,0,n,n),So(o).then((function(t){i.drawImage(t,0,0);var r=i.getImageData(0,0,n,n).data;i.fillStyle="red",i.fillRect(0,0,n,n);var o=e.createElement("div");return o.style.backgroundImage="url("+a+")",o.style.height=n+"px",Co(r)?So(Eo(n,n,0,0,o)):Promise.reject(!1)})).then((function(e){return i.drawImage(e,0,0),Co(i.getImageData(0,0,n,n).data)})).catch((function(){return!1}))},Eo=function(e,t,n,i,r){var a="http://www.w3.org/2000/svg",o=document.createElementNS(a,"svg"),s=document.createElementNS(a,"foreignObject");return o.setAttributeNS(null,"width",e.toString()),o.setAttributeNS(null,"height",t.toString()),s.setAttributeNS(null,"width","100%"),s.setAttributeNS(null,"height","100%"),s.setAttributeNS(null,"x",n.toString()),s.setAttributeNS(null,"y",i.toString()),s.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(s),s.appendChild(r),o},So=function(e){return new Promise((function(t,n){var i=new Image;i.onload=function(){return t(i)},i.onerror=n,i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(e))}))},To={get SUPPORT_RANGE_BOUNDS(){var e=yo(document);return Object.defineProperty(To,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=To.SUPPORT_RANGE_BOUNDS&&wo(document);return Object.defineProperty(To,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Mo(document);return Object.defineProperty(To,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?Bo(document):Promise.resolve(!1);return Object.defineProperty(To,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=xo();return Object.defineProperty(To,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=bo();return Object.defineProperty(To,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(To,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(To,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},_o=function(){function e(e,t){this.text=e,this.bounds=t}return e}(),Io=function(e,t,n,i){var r=Uo(t,n),a=[],s=0;return r.forEach((function(t){if(n.textDecorationLine.length||t.trim().length>0)if(To.SUPPORT_RANGE_BOUNDS){var r=Fo(i,s,t.length).getClientRects();if(r.length>1){var l=ko(t),A=0;l.forEach((function(t){a.push(new _o(t,o.fromDOMRectList(e,Fo(i,A+s,t.length).getClientRects()))),A+=t.length}))}else a.push(new _o(t,o.fromDOMRectList(e,r)))}else{var c=i.splitText(t.length);a.push(new _o(t,Lo(e,i))),i=c}else To.SUPPORT_RANGE_BOUNDS||(i=i.splitText(t.length));s+=t.length})),a},Lo=function(e,t){var n=t.ownerDocument;if(n){var i=n.createElement("html2canvaswrapper");i.appendChild(t.cloneNode(!0));var r=t.parentNode;if(r){r.replaceChild(i,t);var a=s(e,i);return i.firstChild&&r.replaceChild(i.firstChild,i),a}}return o.EMPTY},Fo=function(e,t,n){var i=e.ownerDocument;if(!i)throw new Error("Node has no owner document");var r=i.createRange();return r.setStart(e,t),r.setEnd(e,t+n),r},ko=function(e){if(To.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map((function(e){return e.segment}))}return go(e)},Po=function(e,t){if(To.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(n.segment(e)).map((function(e){return e.segment}))}return Ro(e,t)},Uo=function(e,t){return 0!==t.letterSpacing?ko(e):Po(e,t)},Do=[32,160,4961,65792,65793,4153,4241],Ro=function(e,t){for(var n,i=Ge(e,{lineBreak:t.lineBreak,wordBreak:"break-word"===t.overflowWrap?"break-word":t.wordBreak}),r=[],a=function(){if(n.value){var e=n.value.slice(),t=A(e),i="";t.forEach((function(e){-1===Do.indexOf(e)?i+=c(e):(i.length&&r.push(i),r.push(c(e)),i="")})),i.length&&r.push(i)}};!(n=i.next()).done;)a();return r},Oo=function(){function e(e,t,n){this.text=No(t.data,n.textTransform),this.textBounds=Io(e,this.text,n,t)}return e}(),No=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(zo,Qo);case 2:return e.toUpperCase();default:return e}},zo=/(^|\s|:|-|\(|\))([a-z])/g,Qo=function(e,t,n){return e.length>0?t+n.toUpperCase():e},Go=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.src=n.currentSrc||n.src,i.intrinsicWidth=n.naturalWidth,i.intrinsicHeight=n.naturalHeight,i.context.cache.addImage(i.src),i}return t(n,e),n}(Ba),Ho=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.canvas=n,i.intrinsicWidth=n.width,i.intrinsicHeight=n.height,i}return t(n,e),n}(Ba),Vo=function(e){function n(t,n){var i=e.call(this,t,n)||this,r=new XMLSerializer,a=s(t,n);return n.setAttribute("width",a.width+"px"),n.setAttribute("height",a.height+"px"),i.svg="data:image/svg+xml,"+encodeURIComponent(r.serializeToString(n)),i.intrinsicWidth=n.width.baseVal.value,i.intrinsicHeight=n.height.baseVal.value,i.context.cache.addImage(i.svg),i}return t(n,e),n}(Ba),jo=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.value=n.value,i}return t(n,e),n}(Ba),Wo=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.start=n.start,i.reversed="boolean"==typeof n.reversed&&!0===n.reversed,i}return t(n,e),n}(Ba),Xo=[{type:15,flags:0,unit:"px",number:3}],Yo=[{type:16,flags:0,number:50}],Ko=function(e){return e.width>e.height?new o(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width0)n.textNodes.push(new Oo(e,r,n.styles));else if(us(r))if(_s(r)&&r.assignedNodes)r.assignedNodes().forEach((function(t){return os(e,t,n,i)}));else{var o=ss(e,r);o.styles.isVisible()&&(As(r,o,i)?o.flags|=4:cs(o.styles)&&(o.flags|=2),-1!==as.indexOf(r.tagName)&&(o.flags|=8),n.elements.push(o),r.slot,r.shadowRoot?os(e,r.shadowRoot,o,i):Ss(r)||ys(r)||Ts(r)||os(e,r,o,i))}},ss=function(e,t){return Ms(t)?new Go(e,t):xs(t)?new Ho(e,t):ys(t)?new Vo(e,t):ps(t)?new jo(e,t):ms(t)?new Wo(e,t):vs(t)?new ts(e,t):Ts(t)?new ns(e,t):Ss(t)?new is(e,t):Cs(t)?new rs(e,t):new Ba(e,t)},ls=function(e,t){var n=ss(e,t);return n.flags|=4,os(e,t,n,n),n},As=function(e,t,n){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||ws(e)&&n.styles.isTransparent()},cs=function(e){return e.isPositioned()||e.isFloating()},hs=function(e){return e.nodeType===Node.TEXT_NODE},us=function(e){return e.nodeType===Node.ELEMENT_NODE},ds=function(e){return us(e)&&void 0!==e.style&&!fs(e)},fs=function(e){return"object"==typeof e.className},ps=function(e){return"LI"===e.tagName},ms=function(e){return"OL"===e.tagName},vs=function(e){return"INPUT"===e.tagName},gs=function(e){return"HTML"===e.tagName},ys=function(e){return"svg"===e.tagName},ws=function(e){return"BODY"===e.tagName},xs=function(e){return"CANVAS"===e.tagName},bs=function(e){return"VIDEO"===e.tagName},Ms=function(e){return"IMG"===e.tagName},Cs=function(e){return"IFRAME"===e.tagName},Bs=function(e){return"STYLE"===e.tagName},Es=function(e){return"SCRIPT"===e.tagName},Ss=function(e){return"TEXTAREA"===e.tagName},Ts=function(e){return"SELECT"===e.tagName},_s=function(e){return"SLOT"===e.tagName},Is=function(e){return e.tagName.indexOf("-")>0},Ls=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},e.prototype.pop=function(e){var t=this;e.forEach((function(e){return t.counters[e].pop()}))},e.prototype.parse=function(e){var t=this,n=e.counterIncrement,i=e.counterReset,r=!0;null!==n&&n.forEach((function(e){var n=t.counters[e.counter];n&&0!==e.increment&&(r=!1,n.length||n.push(1),n[Math.max(0,n.length-1)]+=e.increment)}));var a=[];return r&&i.forEach((function(e){var n=t.counters[e.counter];a.push(e.counter),n||(n=t.counters[e.counter]=[]),n.push(e.reset)})),a},e}(),Fs={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},ks={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Ps={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Us={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Ds=function(e,t,n,i,r,a){return en?Ks(e,r,a.length>0):i.integers.reduce((function(t,n,r){for(;e>=n;)e-=n,t+=i.values[r];return t}),"")+a},Rs=function(e,t,n,i){var r="";do{n||e--,r=i(e)+r,e/=t}while(e*t>=t);return r},Os=function(e,t,n,i,r){var a=n-t+1;return(e<0?"-":"")+(Rs(Math.abs(e),a,i,(function(e){return c(Math.floor(e%a)+t)}))+r)},Ns=function(e,t,n){void 0===n&&(n=". ");var i=t.length;return Rs(Math.abs(e),i,!1,(function(e){return t[Math.floor(e%i)]}))+n},zs=1,Qs=2,Gs=4,Hs=8,Vs=function(e,t,n,i,r,a){if(e<-9999||e>9999)return Ks(e,4,r.length>0);var o=Math.abs(e),s=r;if(0===o)return t[0]+s;for(var l=0;o>0&&l<=4;l++){var A=o%10;0===A&&sa(a,zs)&&""!==s?s=t[A]+s:A>1||1===A&&0===l||1===A&&1===l&&sa(a,Qs)||1===A&&1===l&&sa(a,Gs)&&e>100||1===A&&l>1&&sa(a,Hs)?s=t[A]+(l>0?n[l-1]:"")+s:1===A&&l>0&&(s=n[l-1]+s),o=Math.floor(o/10)}return(e<0?i:"")+s},js="十百千萬",Ws="拾佰仟萬",Xs="マイナス",Ys="마이너스",Ks=function(e,t,n){var i=n?". ":"",r=n?"、":"",a=n?", ":"",o=n?" ":"";switch(t){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var s=Os(e,48,57,!0,i);return s.length<4?"0"+s:s;case 4:return Ns(e,"〇一二三四五六七八九",r);case 6:return Ds(e,1,3999,Fs,3,i).toLowerCase();case 7:return Ds(e,1,3999,Fs,3,i);case 8:return Os(e,945,969,!1,i);case 9:return Os(e,97,122,!1,i);case 10:return Os(e,65,90,!1,i);case 11:return Os(e,1632,1641,!0,i);case 12:case 49:return Ds(e,1,9999,ks,3,i);case 35:return Ds(e,1,9999,ks,3,i).toLowerCase();case 13:return Os(e,2534,2543,!0,i);case 14:case 30:return Os(e,6112,6121,!0,i);case 15:return Ns(e,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Ns(e,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return Vs(e,"零一二三四五六七八九",js,"負",r,Qs|Gs|Hs);case 47:return Vs(e,"零壹貳參肆伍陸柒捌玖",Ws,"負",r,zs|Qs|Gs|Hs);case 42:return Vs(e,"零一二三四五六七八九",js,"负",r,Qs|Gs|Hs);case 41:return Vs(e,"零壹贰叁肆伍陆柒捌玖",Ws,"负",r,zs|Qs|Gs|Hs);case 26:return Vs(e,"〇一二三四五六七八九","十百千万",Xs,r,0);case 25:return Vs(e,"零壱弐参四伍六七八九","拾百千万",Xs,r,zs|Qs|Gs);case 31:return Vs(e,"영일이삼사오육칠팔구","십백천만",Ys,a,zs|Qs|Gs);case 33:return Vs(e,"零一二三四五六七八九","十百千萬",Ys,a,0);case 32:return Vs(e,"零壹貳參四五六七八九","拾百千",Ys,a,zs|Qs|Gs);case 18:return Os(e,2406,2415,!0,i);case 20:return Ds(e,1,19999,Us,3,i);case 21:return Os(e,2790,2799,!0,i);case 22:return Os(e,2662,2671,!0,i);case 22:return Ds(e,1,10999,Ps,3,i);case 23:return Ns(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Ns(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Os(e,3302,3311,!0,i);case 28:return Ns(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Ns(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Os(e,3792,3801,!0,i);case 37:return Os(e,6160,6169,!0,i);case 38:return Os(e,4160,4169,!0,i);case 39:return Os(e,2918,2927,!0,i);case 40:return Os(e,1776,1785,!0,i);case 43:return Os(e,3046,3055,!0,i);case 44:return Os(e,3174,3183,!0,i);case 45:return Os(e,3664,3673,!0,i);case 46:return Os(e,3872,3881,!0,i);default:return Os(e,48,57,!0,i)}},Zs="data-html2canvas-ignore",Js=function(){function e(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new Ls,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var n=this,a=$s(e,t);if(!a.contentWindow)return Promise.reject("Unable to find iframe window");var o=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,l=a.contentWindow,A=l.document,c=nl(a).then((function(){return i(n,void 0,void 0,(function(){var e,n;return r(this,(function(i){switch(i.label){case 0:return this.scrolledElements.forEach(sl),l&&(l.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||l.scrollY===t.top&&l.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(l.scrollX-t.left,l.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(n=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:A.fonts&&A.fonts.ready?[4,A.fonts.ready]:[3,2];case 1:i.sent(),i.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,tl(A)]:[3,4];case 3:i.sent(),i.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then((function(){return e(A,n)})).then((function(){return a}))]:[2,a]}}))}))}));return A.open(),A.write(al(document.doctype)+""),ol(this.referenceElement.ownerDocument,o,s),A.replaceChild(A.adoptNode(this.documentElement),A.documentElement),A.close(),c},e.prototype.createElementClone=function(e){if(Ca(e,2),xs(e))return this.createCanvasClone(e);if(bs(e))return this.createVideoClone(e);if(Bs(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Ms(t)&&(Ms(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),Is(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return rl(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce((function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e}),""),i=e.cloneNode(!1);return i.textContent=n,i}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var n=e.ownerDocument.createElement("img");try{return n.src=e.toDataURL(),n}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var r=e.getContext("2d"),a=i.getContext("2d");if(a)if(!this.options.allowTaint&&r)a.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var o=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(o){var s=o.getContextAttributes();!1===(null==s?void 0:s.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}a.drawImage(e,0,0)}return i}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext("2d");try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},e.prototype.appendChildNode=function(e,t,n){us(t)&&(Es(t)||t.hasAttribute(Zs)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&us(t)&&Bs(t)||e.appendChild(this.cloneNode(t,n))},e.prototype.cloneChildNodes=function(e,t,n){for(var i=this,r=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;r;r=r.nextSibling)if(us(r)&&_s(r)&&"function"==typeof r.assignedNodes){var a=r.assignedNodes();a.length&&a.forEach((function(e){return i.appendChildNode(t,e,n)}))}else this.appendChildNode(t,r,n)},e.prototype.cloneNode=function(e,t){if(hs(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&us(e)&&(ds(e)||fs(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var r=n.getComputedStyle(e),a=n.getComputedStyle(e,":before"),o=n.getComputedStyle(e,":after");this.referenceElement===e&&ds(i)&&(this.clonedReferenceElement=i),ws(i)&&dl(i);var s=this.counters.parse(new wa(this.context,r)),l=this.resolvePseudoContent(e,i,a,Ya.BEFORE);Is(e)&&(t=!0),bs(e)||this.cloneChildNodes(e,i,t),l&&i.insertBefore(l,i.firstChild);var A=this.resolvePseudoContent(e,i,o,Ya.AFTER);return A&&i.appendChild(A),this.counters.pop(s),(r&&(this.options.copyStyles||fs(e))&&!Cs(e)||t)&&rl(r,i),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(Ss(e)||Ts(e))&&(Ss(i)||Ts(i))&&(i.value=e.value),i}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,n,i){var r=this;if(n){var a=n.content,o=t.ownerDocument;if(o&&a&&"none"!==a&&"-moz-alt-content"!==a&&"none"!==n.display){this.counters.parse(new wa(this.context,n));var s=new ya(this.context,n),l=o.createElement("html2canvaspseudoelement");rl(n,l),s.content.forEach((function(t){if(0===t.type)l.appendChild(o.createTextNode(t.value));else if(22===t.type){var n=o.createElement("img");n.src=t.value,n.style.opacity="1",l.appendChild(n)}else if(18===t.type){if("attr"===t.name){var i=t.values.filter(kn);i.length&&l.appendChild(o.createTextNode(e.getAttribute(i[0].value)||""))}else if("counter"===t.name){var a=t.values.filter(Rn),A=a[0],c=a[1];if(A&&kn(A)){var h=r.counters.getCounterValue(A.value),u=c&&kn(c)?Sr.parse(r.context,c.value):3;l.appendChild(o.createTextNode(Ks(h,u,!1)))}}else if("counters"===t.name){var d=t.values.filter(Rn),f=(A=d[0],d[1]);if(c=d[2],A&&kn(A)){var p=r.counters.getCounterValues(A.value),m=c&&kn(c)?Sr.parse(r.context,c.value):3,v=f&&0===f.type?f.value:"",g=p.map((function(e){return Ks(e,m,!1)})).join(v);l.appendChild(o.createTextNode(g))}}}else if(20===t.type)switch(t.value){case"open-quote":l.appendChild(o.createTextNode(da(s.quotes,r.quoteDepth++,!0)));break;case"close-quote":l.appendChild(o.createTextNode(da(s.quotes,--r.quoteDepth,!1)));break;default:l.appendChild(o.createTextNode(t.value))}})),l.className=cl+" "+hl;var A=i===Ya.BEFORE?" "+cl:" "+hl;return fs(t)?t.className.baseValue+=A:t.className+=A,l}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(Ya||(Ya={}));var qs,$s=function(e,t){var n=e.createElement("iframe");return n.className="html2canvas-container",n.style.visibility="hidden",n.style.position="fixed",n.style.left="-10000px",n.style.top="0px",n.style.border="0",n.width=t.width.toString(),n.height=t.height.toString(),n.scrolling="no",n.setAttribute(Zs,"true"),e.body.appendChild(n),n},el=function(e){return new Promise((function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()}))},tl=function(e){return Promise.all([].slice.call(e.images,0).map(el))},nl=function(e){return new Promise((function(t,n){var i=e.contentWindow;if(!i)return n("No window assigned for iframe");var r=i.document;i.onload=e.onload=function(){i.onload=e.onload=null;var n=setInterval((function(){r.body.childNodes.length>0&&"complete"===r.readyState&&(clearInterval(n),t(e))}),50)}}))},il=["all","d","content"],rl=function(e,t){for(var n=e.length-1;n>=0;n--){var i=e.item(n);-1===il.indexOf(i)&&t.style.setProperty(i,e.getPropertyValue(i))}return t},al=function(e){var t="";return e&&(t+=""),t},ol=function(e,t,n){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||n!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,n)},sl=function(e){var t=e[0],n=e[1],i=e[2];t.scrollLeft=n,t.scrollTop=i},ll=":before",Al=":after",cl="___html2canvas___pseudoelement_before",hl="___html2canvas___pseudoelement_after",ul='{\n content: "" !important;\n display: none !important;\n}',dl=function(e){fl(e,"."+cl+ll+ul+"\n ."+hl+Al+ul)},fl=function(e,t){var n=e.ownerDocument;if(n){var i=n.createElement("style");i.textContent=t,e.appendChild(i)}},pl=function(){function e(){}return e.getOrigin=function(t){var n=e._link;return n?(n.href=t,n.href=n.href,n.protocol+n.hostname+n.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),ml=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:Ml(e)||wl(e)?((this._cache[e]=this.loadImage(e)).catch((function(){})),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return i(this,void 0,void 0,(function(){var t,n,i,a,o=this;return r(this,(function(r){switch(r.label){case 0:return t=pl.isSameOrigin(e),n=!xl(e)&&!0===this._options.useCORS&&To.SUPPORT_CORS_IMAGES&&!t,i=!xl(e)&&!t&&!Ml(e)&&"string"==typeof this._options.proxy&&To.SUPPORT_CORS_XHR&&!n,t||!1!==this._options.allowTaint||xl(e)||Ml(e)||i||n?(a=e,i?[4,this.proxy(a)]:[3,2]):[2];case 1:a=r.sent(),r.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise((function(e,t){var i=new Image;i.onload=function(){return e(i)},i.onerror=t,(bl(a)||n)&&(i.crossOrigin="anonymous"),i.src=a,!0===i.complete&&setTimeout((function(){return e(i)}),500),o._options.imageTimeout>0&&setTimeout((function(){return t("Timed out ("+o._options.imageTimeout+"ms) loading image")}),o._options.imageTimeout)}))];case 3:return[2,r.sent()]}}))}))},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise((function(r,a){var o=To.SUPPORT_RESPONSE_TYPE?"blob":"text",s=new XMLHttpRequest;s.onload=function(){if(200===s.status)if("text"===o)r(s.response);else{var e=new FileReader;e.addEventListener("load",(function(){return r(e.result)}),!1),e.addEventListener("error",(function(e){return a(e)}),!1),e.readAsDataURL(s.response)}else a("Failed to proxy resource "+i+" with status code "+s.status)},s.onerror=a;var l=n.indexOf("?")>-1?"&":"?";if(s.open("GET",""+n+l+"url="+encodeURIComponent(e)+"&responseType="+o),"text"!==o&&s instanceof XMLHttpRequest&&(s.responseType=o),t._options.imageTimeout){var A=t._options.imageTimeout;s.timeout=A,s.ontimeout=function(){return a("Timed out ("+A+"ms) proxying "+i)}}s.send()}))},e}(),vl=/^data:image\/svg\+xml/i,gl=/^data:image\/.*;base64,/i,yl=/^data:image\/.*/i,wl=function(e){return To.SUPPORT_SVG_DRAWING||!Cl(e)},xl=function(e){return yl.test(e)},bl=function(e){return gl.test(e)},Ml=function(e){return"blob"===e.substr(0,4)},Cl=function(e){return"svg"===e.substr(-3).toLowerCase()||vl.test(e)},Bl=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,n){return new e(this.x+t,this.y+n)},e}(),El=function(e,t,n){return new Bl(e.x+(t.x-e.x)*n,e.y+(t.y-e.y)*n)},Sl=function(){function e(e,t,n,i){this.type=1,this.start=e,this.startControl=t,this.endControl=n,this.end=i}return e.prototype.subdivide=function(t,n){var i=El(this.start,this.startControl,t),r=El(this.startControl,this.endControl,t),a=El(this.endControl,this.end,t),o=El(i,r,t),s=El(r,a,t),l=El(o,s,t);return n?new e(this.start,i,o,l):new e(l,s,a,this.end)},e.prototype.add=function(t,n){return new e(this.start.add(t,n),this.startControl.add(t,n),this.endControl.add(t,n),this.end.add(t,n))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Tl=function(e){return 1===e.type},_l=function(){function e(e){var t=e.styles,n=e.bounds,i=Wn(t.borderTopLeftRadius,n.width,n.height),r=i[0],a=i[1],o=Wn(t.borderTopRightRadius,n.width,n.height),s=o[0],l=o[1],A=Wn(t.borderBottomRightRadius,n.width,n.height),c=A[0],h=A[1],u=Wn(t.borderBottomLeftRadius,n.width,n.height),d=u[0],f=u[1],p=[];p.push((r+s)/n.width),p.push((d+c)/n.width),p.push((a+f)/n.height),p.push((l+h)/n.height);var m=Math.max.apply(Math,p);m>1&&(r/=m,a/=m,s/=m,l/=m,c/=m,h/=m,d/=m,f/=m);var v=n.width-s,g=n.height-h,y=n.width-c,w=n.height-f,x=t.borderTopWidth,b=t.borderRightWidth,M=t.borderBottomWidth,C=t.borderLeftWidth,B=Xn(t.paddingTop,e.bounds.width),E=Xn(t.paddingRight,e.bounds.width),S=Xn(t.paddingBottom,e.bounds.width),T=Xn(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=r>0||a>0?Il(n.left+C/3,n.top+x/3,r-C/3,a-x/3,qs.TOP_LEFT):new Bl(n.left+C/3,n.top+x/3),this.topRightBorderDoubleOuterBox=r>0||a>0?Il(n.left+v,n.top+x/3,s-b/3,l-x/3,qs.TOP_RIGHT):new Bl(n.left+n.width-b/3,n.top+x/3),this.bottomRightBorderDoubleOuterBox=c>0||h>0?Il(n.left+y,n.top+g,c-b/3,h-M/3,qs.BOTTOM_RIGHT):new Bl(n.left+n.width-b/3,n.top+n.height-M/3),this.bottomLeftBorderDoubleOuterBox=d>0||f>0?Il(n.left+C/3,n.top+w,d-C/3,f-M/3,qs.BOTTOM_LEFT):new Bl(n.left+C/3,n.top+n.height-M/3),this.topLeftBorderDoubleInnerBox=r>0||a>0?Il(n.left+2*C/3,n.top+2*x/3,r-2*C/3,a-2*x/3,qs.TOP_LEFT):new Bl(n.left+2*C/3,n.top+2*x/3),this.topRightBorderDoubleInnerBox=r>0||a>0?Il(n.left+v,n.top+2*x/3,s-2*b/3,l-2*x/3,qs.TOP_RIGHT):new Bl(n.left+n.width-2*b/3,n.top+2*x/3),this.bottomRightBorderDoubleInnerBox=c>0||h>0?Il(n.left+y,n.top+g,c-2*b/3,h-2*M/3,qs.BOTTOM_RIGHT):new Bl(n.left+n.width-2*b/3,n.top+n.height-2*M/3),this.bottomLeftBorderDoubleInnerBox=d>0||f>0?Il(n.left+2*C/3,n.top+w,d-2*C/3,f-2*M/3,qs.BOTTOM_LEFT):new Bl(n.left+2*C/3,n.top+n.height-2*M/3),this.topLeftBorderStroke=r>0||a>0?Il(n.left+C/2,n.top+x/2,r-C/2,a-x/2,qs.TOP_LEFT):new Bl(n.left+C/2,n.top+x/2),this.topRightBorderStroke=r>0||a>0?Il(n.left+v,n.top+x/2,s-b/2,l-x/2,qs.TOP_RIGHT):new Bl(n.left+n.width-b/2,n.top+x/2),this.bottomRightBorderStroke=c>0||h>0?Il(n.left+y,n.top+g,c-b/2,h-M/2,qs.BOTTOM_RIGHT):new Bl(n.left+n.width-b/2,n.top+n.height-M/2),this.bottomLeftBorderStroke=d>0||f>0?Il(n.left+C/2,n.top+w,d-C/2,f-M/2,qs.BOTTOM_LEFT):new Bl(n.left+C/2,n.top+n.height-M/2),this.topLeftBorderBox=r>0||a>0?Il(n.left,n.top,r,a,qs.TOP_LEFT):new Bl(n.left,n.top),this.topRightBorderBox=s>0||l>0?Il(n.left+v,n.top,s,l,qs.TOP_RIGHT):new Bl(n.left+n.width,n.top),this.bottomRightBorderBox=c>0||h>0?Il(n.left+y,n.top+g,c,h,qs.BOTTOM_RIGHT):new Bl(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=d>0||f>0?Il(n.left,n.top+w,d,f,qs.BOTTOM_LEFT):new Bl(n.left,n.top+n.height),this.topLeftPaddingBox=r>0||a>0?Il(n.left+C,n.top+x,Math.max(0,r-C),Math.max(0,a-x),qs.TOP_LEFT):new Bl(n.left+C,n.top+x),this.topRightPaddingBox=s>0||l>0?Il(n.left+Math.min(v,n.width-b),n.top+x,v>n.width+b?0:Math.max(0,s-b),Math.max(0,l-x),qs.TOP_RIGHT):new Bl(n.left+n.width-b,n.top+x),this.bottomRightPaddingBox=c>0||h>0?Il(n.left+Math.min(y,n.width-C),n.top+Math.min(g,n.height-M),Math.max(0,c-b),Math.max(0,h-M),qs.BOTTOM_RIGHT):new Bl(n.left+n.width-b,n.top+n.height-M),this.bottomLeftPaddingBox=d>0||f>0?Il(n.left+C,n.top+Math.min(w,n.height-M),Math.max(0,d-C),Math.max(0,f-M),qs.BOTTOM_LEFT):new Bl(n.left+C,n.top+n.height-M),this.topLeftContentBox=r>0||a>0?Il(n.left+C+T,n.top+x+B,Math.max(0,r-(C+T)),Math.max(0,a-(x+B)),qs.TOP_LEFT):new Bl(n.left+C+T,n.top+x+B),this.topRightContentBox=s>0||l>0?Il(n.left+Math.min(v,n.width+C+T),n.top+x+B,v>n.width+C+T?0:s-C+T,l-(x+B),qs.TOP_RIGHT):new Bl(n.left+n.width-(b+E),n.top+x+B),this.bottomRightContentBox=c>0||h>0?Il(n.left+Math.min(y,n.width-(C+T)),n.top+Math.min(g,n.height+x+B),Math.max(0,c-(b+E)),h-(M+S),qs.BOTTOM_RIGHT):new Bl(n.left+n.width-(b+E),n.top+n.height-(M+S)),this.bottomLeftContentBox=d>0||f>0?Il(n.left+C+T,n.top+w,Math.max(0,d-(C+T)),f-(M+S),qs.BOTTOM_LEFT):new Bl(n.left+C+T,n.top+n.height-(M+S))}return e}();!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(qs||(qs={}));var Il=function(e,t,n,i,r){var a=(Math.sqrt(2)-1)/3*4,o=n*a,s=i*a,l=e+n,A=t+i;switch(r){case qs.TOP_LEFT:return new Sl(new Bl(e,A),new Bl(e,A-s),new Bl(l-o,t),new Bl(l,t));case qs.TOP_RIGHT:return new Sl(new Bl(e,t),new Bl(e+o,t),new Bl(l,A-s),new Bl(l,A));case qs.BOTTOM_RIGHT:return new Sl(new Bl(l,t),new Bl(l,t+s),new Bl(e+o,A),new Bl(e,A));case qs.BOTTOM_LEFT:default:return new Sl(new Bl(l,A),new Bl(l-o,A),new Bl(e,t+s),new Bl(e,t))}},Ll=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Fl=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},kl=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Pl=function(){function e(e,t,n){this.offsetX=e,this.offsetY=t,this.matrix=n,this.type=0,this.target=6}return e}(),Ul=function(){function e(e,t){this.path=e,this.target=t,this.type=1}return e}(),Dl=function(){function e(e){this.opacity=e,this.type=2,this.target=6}return e}(),Rl=function(e){return 0===e.type},Ol=function(e){return 1===e.type},Nl=function(e){return 2===e.type},zl=function(e,t){return e.length===t.length&&e.some((function(e,n){return e===t[n]}))},Ql=function(e,t,n,i,r){return e.map((function(e,a){switch(a){case 0:return e.add(t,n);case 1:return e.add(t+i,n);case 2:return e.add(t+i,n+r);case 3:return e.add(t,n+r)}return e}))},Gl=function(){function e(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Hl=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new _l(this.container),this.container.styles.opacity<1&&this.effects.push(new Dl(this.container.styles.opacity)),null!==this.container.styles.transform){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,r=this.container.styles.transform;this.effects.push(new Pl(n,i,r))}if(0!==this.container.styles.overflowX){var a=Ll(this.curves),o=kl(this.curves);zl(a,o)?this.effects.push(new Ul(a,6)):(this.effects.push(new Ul(a,2)),this.effects.push(new Ul(o,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),n=this.parent,i=this.effects.slice(0);n;){var r=n.effects.filter((function(e){return!Ol(e)}));if(t||0!==n.container.styles.position||!n.parent){if(i.unshift.apply(i,r),t=-1===[2,3].indexOf(n.container.styles.position),0!==n.container.styles.overflowX){var a=Ll(n.curves),o=kl(n.curves);zl(a,o)||i.unshift(new Ul(o,6))}}else i.unshift.apply(i,r);n=n.parent}return i.filter((function(t){return sa(t.target,e)}))},e}(),Vl=function(e,t,n,i){e.container.elements.forEach((function(r){var a=sa(r.flags,4),o=sa(r.flags,2),s=new Hl(r,e);sa(r.styles.display,2048)&&i.push(s);var l=sa(r.flags,8)?[]:i;if(a||o){var A=a||r.styles.isPositioned()?n:t,c=new Gl(s);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var h=r.styles.zIndex.order;if(h<0){var u=0;A.negativeZIndex.some((function(e,t){return h>e.element.container.styles.zIndex.order?(u=t,!1):u>0})),A.negativeZIndex.splice(u,0,c)}else if(h>0){var d=0;A.positiveZIndex.some((function(e,t){return h>=e.element.container.styles.zIndex.order?(d=t+1,!1):d>0})),A.positiveZIndex.splice(d,0,c)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else r.styles.isFloating()?A.nonPositionedFloats.push(c):A.nonPositionedInlineLevel.push(c);Vl(s,c,a?c:n,l)}else r.styles.isInlineLevel()?t.inlineLevel.push(s):t.nonInlineLevel.push(s),Vl(s,t,n,l);sa(r.flags,8)&&jl(r,l)}))},jl=function(e,t){for(var n=e instanceof Wo?e.start:1,i=e instanceof Wo&&e.reversed,r=0;r0&&e.intrinsicHeight>0){var i=eA(e),r=kl(t);this.path(r),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,e.intrinsicWidth,e.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},n.prototype.renderNodeContent=function(e){return i(this,void 0,void 0,(function(){var t,i,a,s,l,A,c,h,u,d,f,p,m,v,g,y,w,x;return r(this,(function(r){switch(r.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,i=e.curves,a=t.styles,s=0,l=t.textNodes,r.label=1;case 1:return s0&&C>0&&(g=i.ctx.createPattern(p,"repeat"),i.renderRepeat(w,g,E,S))):Di(n)&&(y=iA(e,t,[null,null,null]),w=y[0],x=y[1],b=y[2],M=y[3],C=y[4],B=0===n.position.length?[Vn]:n.position,E=Xn(B[0],M),S=Xn(B[B.length-1],C),T=xi(n,E,S,M,C),_=T[0],I=T[1],_>0&&I>0&&(L=i.ctx.createRadialGradient(x+E,b+S,0,x+E,b+S,_),mi(n.stops,2*_).forEach((function(e){return L.addColorStop(e.stop,ri(e.color))})),i.path(w),i.ctx.fillStyle=L,_!==I?(F=e.bounds.left+.5*e.bounds.width,k=e.bounds.top+.5*e.bounds.height,U=1/(P=I/_),i.ctx.save(),i.ctx.translate(F,k),i.ctx.transform(1,0,0,P,0,0),i.ctx.translate(-F,-k),i.ctx.fillRect(x,U*(b-k)+k,M,C*U),i.ctx.restore()):i.ctx.fill())),r.label=6;case 6:return t--,[2]}}))},i=this,a=0,o=e.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return a0?2!==A.style?[3,5]:[4,this.renderDashedDottedBorder(A.color,A.width,o,e.curves,2)]:[3,11]:[3,13];case 4:return r.sent(),[3,11];case 5:return 3!==A.style?[3,7]:[4,this.renderDashedDottedBorder(A.color,A.width,o,e.curves,3)];case 6:return r.sent(),[3,11];case 7:return 4!==A.style?[3,9]:[4,this.renderDoubleBorder(A.color,A.width,o,e.curves)];case 8:return r.sent(),[3,11];case 9:return[4,this.renderSolidBorder(A.color,o,e.curves)];case 10:r.sent(),r.label=11;case 11:o++,r.label=12;case 12:return s++,[3,3];case 13:return[2]}}))}))},n.prototype.renderDashedDottedBorder=function(e,t,n,a,o){return i(this,void 0,void 0,(function(){var i,s,l,A,c,h,u,d,f,p,m,v,g,y,w,x;return r(this,(function(r){return this.ctx.save(),i=Zl(a,n),s=Xl(a,n),2===o&&(this.path(s),this.ctx.clip()),Tl(s[0])?(l=s[0].start.x,A=s[0].start.y):(l=s[0].x,A=s[0].y),Tl(s[1])?(c=s[1].end.x,h=s[1].end.y):(c=s[1].x,h=s[1].y),u=0===n||2===n?Math.abs(l-c):Math.abs(A-h),this.ctx.beginPath(),3===o?this.formatPath(i):this.formatPath(s.slice(0,2)),d=t<3?3*t:2*t,f=t<3?2*t:t,3===o&&(d=t,f=t),p=!0,u<=2*d?p=!1:u<=2*d+f?(d*=m=u/(2*d+f),f*=m):(v=Math.floor((u+f)/(d+f)),g=(u-v*d)/(v-1),f=(y=(u-(v+1)*d)/v)<=0||Math.abs(f-g)'.concat(e.element,"");var t=document.createElement("div");t.innerHTML=e.element,e.element=t.children[0]}return this._addHotSpot(e)}console.error("缺少关键参数:element")}else console.error("缺少关键参数:position")}},{key:"addLayer",value:function(e){this.layers.indexOf(e)<0&&this.layers.push(e)}},{key:"hideAll",value:function(){this.layers.forEach((function(e){e.hide()}))}},{key:"showAll",value:function(){this.layers.forEach((function(e){e.show()}))}},{key:"onlyShow",value:function(e){this.hideAll(),e.show()}},{key:"toJSON",value:function(){var e=[];return this.layers.forEach((function(t){e.push(t.toJSON())})),e}},{key:"loadLayer",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.defaultLayer;viewer.camera.updateProjectionMatrix(),this.addLayer(n),e.forEach((function(e){var i=document.createElement("div");i.innerHTML=e.element,i.className="hot-spot",e.element=i,e.layer=n,t._addHotSpot(e)}))}},{key:"_addHotSpot",value:function(e){var t=this;if(e.element.style.position="absolute",this.container.appendChild(e.element),e.position=Array.isArray(e.position)?(new at).fromArray(e.position):(new at).copy(e.position),void 0!==e.objectId){var n=this.viewer.root.getObjectById(e.objectId);if(!n)return console.error("热点id与模型不匹配"),null;e.worldPos=e.position.clone(),n.worldToLocal(e.position)}var i=new Km(e);return e.layer=e.layer||this.defaultLayer,e.layer.add(i),i.focus=function(n){e.cameraView&&e.cameraView.position&&(i.cameraView.complete=function(){n?n():i.complete&&i.complete()},t.viewer.controls.flyTo(i.cameraView))},i}},{key:"_onUpdate",value:function(){var e=this;this.layers.forEach((function(t){t.visible&&t.spots.forEach((function(t){var n=t.position.clone();void 0!==t.objectId&&(n=e.viewer.root.getObjectById(t.objectId).localToWorld(t.position.clone())),t.updateScreenCoords(e._getProjectHotPos(n)),t.screenCoord?t.hided||(t.element.style.display="block"):t.element.style.display="none"}))}))}},{key:"_getProjectHotPos",value:function(e){var t=this.viewer,n=t.camera.position.clone().sub(e.clone()).normalize(),i=new at;t.camera.getWorldDirection(i).clone();var r=t.renderer.domElement.getBoundingClientRect(),a=t.renderer.domElement.offsetWidth,o=t.renderer.domElement.offsetHeight,s=a/2,l=o/2,A=e.clone();if(A.project(t.camera),i.x=-i.x,i.y=-i.y,i.z=-i.z,n.clone().angleTo(i)>.5*Math.PI)return null;var c=A.x*s+s,h=-A.y*l+l;return a<=Math.round(r.width)&&(c+=r.left),o<=Math.round(r.height)&&(h+=r.top),new tt(c,h)}},{key:"createLayer",value:function(){var e=new Zm;return this.addLayer(e),e}},{key:"deleteLayer",value:function(e){-1!==this.layers.indexOf(e)&&(e.spots.map((function(e){e.element.remove()})),this.layers.splice(this.layers.indexOf(e),1))}},{key:"export",value:function(){return this.toJSON().filter((function(e){return e.length>0}))}},{key:"import",value:function(e,t){var n=this,i=new DOMParser;return e.map((function(e){t=t||n.createLayer(),e.forEach((function(e){e.element=i.parseFromString(e.element,"text/html").body.children[0],e.layer=t,n._addHotSpot(e)}))})),t}},{key:"addSpriteLabel",value:function(e){e.position||console.warn("addSpriteLabel: options.position不能为空!");var t=new $m({position:e.position,html:e.content,userData:e.userData,cameraView:e.cameraView,onclick:e.onclick});return this.spriteRoot.add(t),t}}]),e}(),tv=function(){function e(){s(this,e)}return A(e,[{key:"init",value:function(){this.isActive=!1}},{key:"initParticleItem",value:function(e){}},{key:"update",value:function(e,t){}},{key:"reset",value:function(){}}]),e}(),nv="\nattribute vec4 vertexColor;\nvarying vec4 vColor;\nvarying vec2 vUv;\nvoid main()\n{\n vUv = uv;\n vColor = vertexColor;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n}\n",iv="\n\nuniform sampler2D mainTex;\nvarying vec4 vColor;\nvarying vec2 vUv;\nvoid main()\n{\n vec4 texColor = texture2D(mainTex,vUv.xy);\n vec4 col = texColor * vColor;\n gl_FragColor = col;\n}\n\n",rv="\nattribute vec4 vertexColor;\nuniform vec4 _TintColor;\nvarying vec4 vColor;\nvarying vec2 vUv;\nvoid main()\n{\n vUv = uv;\n vColor = vec4(vertexColor.xyz * _TintColor.xyz,vertexColor.w * _TintColor.w);\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n}\n\n",av="\n\nuniform sampler2D mainTex;\nvarying vec4 vColor;\nvarying vec2 vUv;\nvoid main()\n{\n vec4 texColor = texture2D(mainTex,vUv.xy);\n vec4 col = texColor * vColor * 2.0;\n col.a = clamp(col.a,0.0,1.0);\n gl_FragColor = col;\n}\n\n",ov="\n uniform sampler2D mainTex;\n varying vec4 _TintColor;\n varying vec4 vColor;\n varying vec2 vUv;\n void main()\n {\n vec4 texColor = texture2D(mainTex,vUv.xy);\n vec3 col = texColor.xyz * vColor.xyz * _TintColor.xyz * 2.0;\n float a = (1 - texColor.w) * (_TintColor.w * vColor.w * 2.0);\n gl_FragColor = vec4(col.xyz,a);\n }\n\n",sv="\nuniform sampler2D mainTex;\nvarying vec4 vColor;\nvarying vec2 vUv;\nvoid main()\n{\n vec4 texColor = texture2D(mainTex,vUv.xy);\n vec4 col = texColor * vColor;\n col = lerp(vec4(1,1,1,1),col,col.w);\n gl_FragColor = col;\n}\n \n",lv="\n uniform sampler2D mainTex;\n varying vec4 vColor;\n varying vec2 vUv;\n void main()\n {\n vec4 col;\n vec4 texColor = texture2D(mainTex,vUv.xy);\n col.xyz = texColor.xyz * vColor.xyz * 2;\n col.w = vColor.w * texColor.w;\n col = lerp(vec4(0.5,0.5,0.5,0.5),col,col.a);\n gl_FragColor = col;\n }\n",Av="\n\n uniform sampler2D mainTex;\n varying vec4 vColor;\n varying vec2 vUv;\n void main()\n {\n vec4 texColor = texture2D(mainTex,vUv.xy);\n gl_FragColor = vColor * texColor * vColor.a;\n }\n",cv=function(){function e(){s(this,e)}return A(e,null,[{key:"randomValue",value:function(e,t){var n=Math.random();return Hh.lerp(e,t,n)}},{key:"randomVector3",value:function(e,t){return new at(this.randomValue(e.x,t.x),this.randomValue(e.y,t.y),this.randomValue(e.z,t.z))}},{key:"randomVector4",value:function(e,t){var n=Math.random();return e.lerp(t,n)}},{key:"getShader",value:function(e){return"normal_vertex"===e?nv:"normal_fragment"===e?iv:"normal_legacy_vertex"===e?rv:"normal_legacy_fragment"===e?av:"multily_legacy_fragment"===e?ov:"multipy_fragment"===e?sv:"multiplyDouble_fragment"===e?lv:"premultiplyBlend_fragment"===e?Av:""}},{key:"getShaderBlend",value:function(e){return"SrcAlpha"===e?P:"OneMinusSrcAlpha"===e?U:"One"===e?F:"DstColor"===e?R:"Zero"===e?L:"SrcColor"===e?k:F}}]),e}(),hv=function(){function e(t){s(this,e),null!=t?this.setJsonData(t):(this.times=[],this.values=[],this.currentIndex=0)}return A(e,[{key:"setJsonData",value:function(e){this.times=e.times,this.values=e.values,this.currentIndex=0}},{key:"getValue",value:function(e){var t=this.times.length;if(this.currentIndex=e)return Hh.lerp(this.values[this.currentIndex],this.values[this.currentIndex+1],(e-this.times[this.currentIndex])/(this.times[this.currentIndex+1]-this.times[this.currentIndex]));for(var n=0;n=e)return this.currentIndex=n,Hh.lerp(this.values[n],this.values[n+1],(e-this.times[n])/(this.times[n+1]-this.times[n]))}return 0}}]),e}(),uv=function(){function e(t){s(this,e),null!=t?this.setJsonData(t):(this.m_Mode=e.TYPE.Constant,this.m_ConstantMin=0,this.m_ConstantMax=0,this.m_CurveMin=null,this.m_CurveMax=null)}return A(e,[{key:"setJsonData",value:function(t){this.m_Mode=t.mode,this.m_Mode===e.TYPE.Constant?this.setConstantValue(t.max):this.m_Mode===e.TYPE.TwoConstants?this.setConstantMinMax(t.min,t.max):this.m_Mode===e.TYPE.Curve?this.setCurves(new hv(t.maxCurve)):this.m_Mode===e.TYPE.TwoCurves&&this.setCurvesMinMax(new hv(t.minCurve),new hv(t.maxCurve))}},{key:"setConstantValue",value:function(t){this.m_Mode=e.TYPE.Constant,this.m_ConstantMin=0,this.m_ConstantMax=t,this.m_CurveMin=null,this.m_CurveMax=null}},{key:"setConstantMinMax",value:function(t,n){this.m_Mode=e.TYPE.TwoConstants,this.m_ConstantMin=t,this.m_ConstantMax=n,this.m_CurveMin=null,this.m_CurveMax=null}},{key:"setCurves",value:function(t){this.m_Mode=e.TYPE.Curve,this.m_CurveMax=t,this.m_CurveMin=null}},{key:"setCurvesMinMax",value:function(t,n){this.m_Mode=e.TYPE.TwoCurves,this.m_CurveMin=t,this.m_CurveMax=n}},{key:"getRandomValue",value:function(t){if(this.m_Mode==e.TYPE.Constant)return this.m_ConstantMax;if(this.m_Mode==e.TYPE.TwoConstants)return cv.randomValue(this.m_ConstantMin,this.m_ConstantMax);if(this.m_Mode==e.TYPE.Curve)return this.m_CurveMax.getValue(t);if(this.m_Mode==e.TYPE.TwoCurves){var n=Math.random(),i=this.m_CurveMin.getValue(t),r=this.m_CurveMax.getValue(t);return n>.5?r:i}return 0}}]),e}();uv.TYPE=Object.freeze({Constant:0,Curve:1,TwoCurves:2,TwoConstants:3});var dv=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this)).isActive=!0,null!=e?i.setJsonData(e):(i.rateOverTime=new uv,i.rateOverTime.setConstantValue(5)),i.density=1,i.rateOverTimeResult=i.rateOverTime.getRandomValue(),i.secondParticle=i.rateOverTimeResult*i.density,i.singleTime=1/i.secondParticle,i.playBackTime=0,i.cacheTime=0,i.createParticleCount=0,i}return A(n,[{key:"setJsonData",value:function(e){this.rateOverTime=new uv(e.rateOverTime)}},{key:"setDensity",value:function(e){this.density=e,this.secondParticle=this.rateOverTimeResult*this.density,0==this.secondParticle?this.singleTime=99999999:this.singleTime=1/this.secondParticle}},{key:"update",value:function(e,t){this.playBackTime+=e,this.cacheTime+=e,this.cacheTime>=this.singleTime&&(this.createParticleCount=Math.floor(this.cacheTime/this.singleTime),this.cacheTime=this.cacheTime%this.singleTime)}},{key:"reset",value:function(){b(u(n.prototype),"reset",this).call(this),this.createParticleCount=0}}]),n}(tv),fv=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this)).isActive=!0,null!=e?i.setJsonData(e):(i.shape=n.TYPE.Box,i.angle=25,i.radius=1,i.radiusThickness=1,i.donutRadius=.2,i.position=new at(0,0,0),i.rotation=new Bt(0,0,0),i.scale=new at(1,1,1)),i.startPosition=new at(0,0,0),i.moveDirection=new at(0,0,0),i}return A(n,[{key:"setJsonData",value:function(e){this.shape=e.shapeMode,this.shape===n.TYPE.Cone&&(this.angle=e.cone.angle,this.radius=e.cone.radius,this.radiusThickness=e.cone.radiusThickness),this.position=new at(e.position.x,e.position.y,e.position.z),this.rotation=new Bt(e.rotation.x,e.rotation.y,e.rotation.z),this.scale=new at(e.scale.x,e.scale.y,e.scale.z)}},{key:"update",value:function(e,t){if(b(u(n.prototype),"update",this).call(this,e,t),this.shape==n.TYPE.Cone){var i=Hh.lerp(0,this.angle,1-this.radiusThickness),r=et.degToRad(cv.randomValue(i,this.angle)),a=et.degToRad(cv.randomValue(0,360)),o=Math.sin(r);this.moveDirection=new at(o*Math.cos(a),Math.cos(r),o*Math.sin(a));var s=et.degToRad(cv.randomValue(0,360)),l=cv.randomValue(0,this.radius);this.startPosition=new at(Math.cos(s)*l,0,Math.sin(s)*l),this.startPosition=this.startPosition.multiply(this.scale).add(this.position),this.moveDirection.applyEuler(this.rotation).multiply(this.scale)}else if(this.shape==n.TYPE.Box){var A=this.scale.clone().multiplyScalar(.5);this.startPosition=cv.randomVector3(new at(-A.x,-A.y,-A.z),new at(A.x,A.y,A.z)),this.moveDirection.y=1,this.moveDirection.applyEuler(this.rotation)}}},{key:"reset",value:function(){b(u(n.prototype),"reset",this).call(this),this.startPosition.setScalar(0),this.moveDirection.setScalar(0)}}]),n}(tv);fv.TYPE=Object.freeze({Sphere:0,Hemisphere:2,Cone:4,Box:5,Circle:10});var pv=function(){function e(t){s(this,e),null!=t?this.setJsonData(t):(this.colorLocation=[],this.colors=[],this.alphaLocation=[],this.alphas=[])}return A(e,[{key:"setJsonData",value:function(e){this.colorLocation=e.colorLocation,this.colors=[];for(var t=0;t=e&&0===i)return"number"==typeof n[i]?n[i]:n[i].clone();if(ie){var a=(e-t[i])/(t[i+1]-t[i]);return"number"==typeof n[i]?n[i]+(n[i+1]-n[i])*a:n[i].clone().lerp(n[i+1],a)}}return r("number"==n[n.length-1])?n[n.length-1]:n[n.length-1].clone()}}]),e}(),mv=function(){function e(t){s(this,e),null!=t?this.setJsonData(t):(this.m_mode=e.TYPE.Color,this.minColor=null,this.maxColor=new ut(1,1,1,1),this.minGradient=null,this.maxGradient=null)}return A(e,[{key:"setJsonData",value:function(t){if(this.m_mode=t.m_mode,this.m_mode===e.TYPE.Color)this.setColor(new ut(t.maxColor.r,t.maxColor.g,t.maxColor.b,t.maxColor.a));else if(this.m_mode===e.TYPE.TwoColors){var n=new ut(t.minColor.r,t.minColor.g,t.minColor.b,t.minColor.a),i=new ut(t.maxColor.r,t.maxColor.g,t.maxColor.b,t.maxColor.a);this.setColorMinMax(n,i)}else this.m_mode===e.TYPE.Gradient?this.setGradient(new pv(t.maxGradient)):this.m_mode===e.TYPE.TwoGradients&&this.setMinMaxGradient(new pv(t.minGradient),new pv(t.maxGradient))}},{key:"setColorMinMax",value:function(t,n){this.m_mode=e.TYPE.TwoColors,this.minColor=t,this.maxColor=n}},{key:"setGradient",value:function(t){this.m_mode=e.TYPE.Gradient,this.maxGradient=t}},{key:"setMinMaxGradient",value:function(t,n){this.m_mode=e.TYPE.TwoGradients,this.minGradient=t,this.maxGradient=n}},{key:"setColor",value:function(t){this.m_mode=e.TYPE.Color,this.minColor=null,this.maxColor=t}},{key:"getRandomValue",value:function(){if(this.m_mode==e.TYPE.Color)return this.maxColor;if(this.m_mode==e.TYPE.Gradient)return this.maxGradient.getValue(Math.random());if(this.m_mode==e.TYPE.TwoGradients){var t=Math.random(),n=this.minGradient.getValue(t),i=this.maxGradient.getValue(t);return cv.randomVector4(n,i)}return this.m_mode==e.TYPE.TwoColors?cv.randomVector4(this.minColor,this.maxColor):this.m_mode==e.TYPE.RandomColor?this.maxGradient.getValue(Math.random()):this.maxColor}},{key:"getLerpValue",value:function(t){if(this.m_mode==e.TYPE.Gradient)return this.maxGradient.getValue(t);if(this.m_mode==e.TYPE.TwoGradients){var n=Math.random(),i=this.minGradient.getValue(n),r=this.maxGradient.getValue(n);return n>.5?r:i}return this.maxColor}}]),e}();mv.TYPE=Object.freeze({Color:0,Gradient:1,TwoColors:2,TwoGradients:3,RandomColor:4});var vv=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this)).isActive=!0,i.duration=e.duration,i.isLoop=e.isLoop,i.startDelay=new uv(e.startDelay),i.startLifeTime=new uv(e.startLifeTime),i.startSpeed=new uv(e.startSpeed),i.startSize=new uv(e.startSize),i.startRotation=new uv(e.startRotation),i.startColor=new mv(e.startColor),i.gravityModifier=new uv(e.gravity),i.maxParticles=1e4,i}return A(n,[{key:"initParticleItem",value:function(e){e.startDelay=this.startDelay.getRandomValue(),e.lifeTime=this.startLifeTime.getRandomValue();var t=this.startSpeed.getRandomValue();e.startSpeed=new at(t,t,t),e.startSize=this.startSize.getRandomValue(),e.startRotation=this.startRotation.getRandomValue(),e.startColor=this.startColor.getRandomValue(),e.gravityModifier=this.gravityModifier.getRandomValue(),e.refresh()}},{key:"update",value:function(e,t){b(u(n.prototype),"update",this).call(this,e,t),t.setScaleXYZ(t.startSize,t.startSize,t.startSize),t.color=t.startColor.clone(),t.speed=t.moveDirection.clone().add(t.startSpeed),t.speed.add(new at(0,4.905*-t.gravityModifier*2*t.currentTime,0))}}]),n}(tv),gv=function(){function e(t){s(this,e),this.particleCount=t,this.bufferGeometry=null,this.material=null,this.mesh=null}return A(e,[{key:"init",value:function(){this.bufferGeometry=new si}},{key:"setColor",value:function(e,t){}},{key:"setPosition",value:function(e,t,n,i){}},{key:"setScale",value:function(e,t,n){}},{key:"setRotation",value:function(e,t,n,i){}},{key:"setAlpha",value:function(){}}]),e}();gv.RenderMode=Object.freeze({Billboard:0,StretchedBillboard:1,HorizontalBillboard:2,VerticalBillboard:3});var yv=function(){function e(t){s(this,e),this.particleSystem=t,this.index=0,this.render=null,this.startDelay=0,this.lifeTime=0,this.startSpeed=1,this.startSize=1,this.startColor=new ut(1,1,1,1),this.gravityModifier=0,this.startRotation=0,this.startPosition=new at(0,0,0),this.moveDirection=new at(0,0,0),this.active=!0,this.currentTime=0,this.pos0=new at(0,0,0),this.pos1=new at(0,0,0),this.pos2=new at(0,0,0),this.pos3=new at(0,0,0),this.speed=new at(1,1,1),this.rotationSpeed=new at(0,0,0),this.position=this.startPosition.clone(),this.rotation=new at(0,0,0),this.scale=new at(1,1,1),this.camera=null,this.localMatrix=new bt,this.moveMatrix=new bt,this.scaleMatrix=(new bt).makeScale(1,1,1),this.rotationEuler=new Bt(0,0,0),this.billboardRotationEuler=new Bt(0,0,0),this.startRotationEuler=new Bt(0,0,et.degToRad(this.startRotation)),this.directionEuler=new Bt(0,0,0),this.color=this.startColor.clone(),this.isDirty=!0,this.isColorDirty=!0,this.texStartFrame=0}return A(e,[{key:"setCamera",value:function(e){this.camera=e}},{key:"initRender",value:function(e,t){this.render=e,this.camera=t,this.pos0=new at(-this.render.width,-this.render.height,0),this.pos1=new at(this.render.width,-this.render.height,0),this.pos2=new at(this.render.width,this.render.height,0),this.pos3=new at(-this.render.width,this.render.height,0)}},{key:"refresh",value:function(){this.color=this.startColor.clone(),this.startRotationEuler=new Bt(0,0,et.degToRad(this.startRotation))}},{key:"setStartPosition",value:function(e){this.startPosition=e,this.setRotation(new at(0,0,0)),this.setPosition(this.startPosition.clone())}},{key:"setActive",value:function(e){this.active!=e&&(this.active=e,this.active?this.render.setColor(this.index,this.color):this.render.setColor(this.index,new ut(this.color.x,this.color.y,this.color.z,0)))}},{key:"reset",value:function(){this.currentTime=0,this.scale.set(1,1,1),this.rotation.set(0,0,0),this.rotationEuler.set(0,0,0),this.isDirty=!1,this.isColorDirty=!1,this.position.set(0,0,0),this.texStartFrame=0}},{key:"update",value:function(e){if(this.currentTime+=e,this.currentTime>=this.lifeTime)return this.setActive(!1),void this.reset();this.rotation.addScaledVector(this.rotationSpeed,e),this.setRotationAngleXYZ(this.rotation.x,this.rotation.y,this.rotation.z),this.position.add(this.speed.multiplyScalar(e)),this.setPosition(this.position),this.billboard(),!0===this.isDirty&&this.refreshMatrix(),!0===this.isColorDirty&&this.render.setColor(this.index,this.color)}},{key:"billboard",value:function(){if(null!=this.camera){var e=new at(0,0,0);this.camera.getWorldDirection(e),e.add(this.camera.position),e=this.particleSystem.worldToLocal(e);var t=this.particleSystem.worldToLocal(this.camera.position.clone());this.render.renderMode==gv.RenderMode.StretchedBillboard&&e.setY(t.y);var n=new bt;n.lookAt(t,e,new at(0,1,0));var i=new nt;i.setFromRotationMatrix(n),this.billboardRotationEuler.set(0,0,0),this.billboardRotationEuler.setFromQuaternion(i)}}},{key:"refreshMatrix",value:function(){this.localMatrix=this.scaleMatrix.clone(),this.localMatrix.premultiply(this.moveMatrix);var e=this.pos0.clone().applyEuler(this.startRotationEuler).applyEuler(this.rotationEuler).applyEuler(this.billboardRotationEuler).applyMatrix4(this.localMatrix),t=this.pos1.clone().applyEuler(this.startRotationEuler).applyEuler(this.rotationEuler).applyEuler(this.billboardRotationEuler).applyMatrix4(this.localMatrix),n=this.pos2.clone().applyEuler(this.startRotationEuler).applyEuler(this.rotationEuler).applyEuler(this.billboardRotationEuler).applyMatrix4(this.localMatrix),i=this.pos3.clone().applyEuler(this.startRotationEuler).applyEuler(this.rotationEuler).applyEuler(this.billboardRotationEuler).applyMatrix4(this.localMatrix);this.render.setPosition(4*this.index,e),this.render.setPosition(4*this.index+1,t),this.render.setPosition(4*this.index+2,n),this.render.setPosition(4*this.index+3,i),this.render.refreshPosition()}},{key:"setPosition",value:function(e){this.position.x==e&&this.position.y==e.y&&this.position.z==e.z||(this.position=e,this.moveMatrix.makeTranslation(this.position.x,this.position.y,this.position.z),this.isDirty=!0)}},{key:"setScale",value:function(e){this.setScaleXYZ(e.x,e.y,e.z)}},{key:"setScaleXYZ",value:function(e,t,n){this.scale.x==e&&this.scale.y==t&&this.scale.z==n||(this.scale.set(e,t,n),this.scaleMatrix.makeScale(this.scale.x,this.scale.y,this.scale.z),this.isDirty=!0)}},{key:"setRotationAngleXYZ",value:function(e,t,n){this.setRotationXYZ(et.degToRad(e),et.degToRad(t),et.degToRad(n))}},{key:"setRotation",value:function(e){this.setRotationXYZ(e.x,e.y,e.z)}},{key:"setRotationXYZ",value:function(e,t,n){this.rotationEuler.x==e&&this.rotationEuler.y==t&&this.rotationEuler.z==n||(this.rotation.set(et.radToDeg(e),et.radToDeg(t),et.radToDeg(n)),this.rotationEuler.set(e,t,n),this.isDirty=!0)}},{key:"setColor",value:function(e){this.color.x===e.x&&this.color.y===e.y&&this.color.z===e.z&&this.color.w===e.w||(this.color=e,this.isColorDirty=!0)}},{key:"multiplyColor",value:function(e){this.color.multiply(e),this.isColorDirty=!0}},{key:"setUVs",value:function(e,t){this.render.setUV(this.index,e,t)}}]),e}(),wv=function(e){h(n,e);var t=y(n);function n(e,i){var r;return s(this,n),(r=t.call(this,e)).width=.5,r.height=.5,r.mainTexture=null,r.renderMode=n.RenderMode.Billboard,null!=i?(""==i.texName?r.texPath="glow.png":r.texPath=i.texName,r.vertexShaderName=cv.getShader(i.vertexShaderName),r.fragmentShaderName=cv.getShader(i.fragmentShaderName),r.blendSrc=cv.getShaderBlend(i.blendSrc),r.blendDst=cv.getShaderBlend(i.blendDst),r.renderMode=i.renderMode,r.renderMode==gv.RenderMode.StretchedBillboard?r.lengthScale=i.lengthScale:r.lengthScale=1,null!=i.matColor&&(r.matColor=new ut(i.matColor.r,i.matColor.g,i.matColor.b,i.matColor.a))):(r.texPath="glow.png",r.lengthScale=1,r.vertexShaderName=cv.getShader("normal_vertex"),r.fragmentShaderName=cv.getShader("normal_fragment"),r.blendSrc=cv.getShaderBlend("SrcAlpha"),r.blendDst=cv.getShaderBlend("OneMinusSrcAlpha")),r.height*=r.lengthScale,r.init(),r}return A(n,[{key:"init",value:function(){b(u(n.prototype),"init",this).call(this),this.mainTexture=(new tA).load(this.texPath);for(var e=[],t=[],i=[],r=[],a=0;athis.mainModule.maxParticles&&(this.totalParticleCount=this.mainModule.maxParticles),this.render=new wv(this.totalParticleCount,e.render),this.add(this.render.mesh),this.itemPool=[],this.activeItemArray=[],this.removeItemArray=[],this.totalTime=0}},{key:"init",value:function(e){this.camera=e;for(var t=0;t0?this.itemPool.pop():null}},{key:"pushItemToPool",value:function(e){this.itemPool.push(e)}},{key:"setDensity",value:function(e){this.emissionModule.setDensity(e);var t=this.mainModule.duration*this.emissionModule.secondParticle;if(t>this.mainModule.maxParticles&&(t=this.mainModule.maxParticles),t>this.totalParticleCount){for(var n=this.totalParticleCount;n0)for(var n=0;n=0&&this.nodeArray.get(n.parentId).add(i)}this.data=null}}},{key:"setDensity",value:function(e){this.density=e;for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:{};return s(this,n),(i=t.call(this,r)).mesh=e,i.color=r.color||"#17b2ff",i.distortion=r.distortion||3.7,i.speed=r.speed||1,i.size=r.size||1,i.water=new Rv(i.mesh.geometry,{textureWidth:512,textureHeight:512,waterNormals:(new tA).load(Nv,(function(e){e.wrapS=e.wrapT=V})),alpha:1,sunDirection:new Ov(0,1,0),sunColor:16777215,waterColor:i.color,distortionScale:i.distortion,size:i.size}),i.mesh.material0||(i.mesh.material0=i.mesh.material),i.material=i.mesh.material=i.water.material,i}return A(n,[{key:"setSpeed",value:function(e){this.speed=e,this.material.uniforms.baseSpeed.value=e}},{key:"setDistortion",value:function(e){this.distortion=e,this.material.uniforms.noiseScale.value=e}},{key:"setColor",value:function(e){this.material.uniforms.waterColor.value=new Fn(e)}},{key:"setSize",value:function(e){this.material.uniforms.size.value=e}},{key:"clear",value:function(){this.mesh.material=this.mesh.material0,this.paused=!0,AMRT.render()}},{key:"update",value:function(e){this.paused||(this.water.material.uniforms.time.value+=1/60*this.speed)}},{key:"onBeforeRender",value:function(e,t,n,i){this.water.material.uniforms.sunDirection.value=n.position.clone().normalize(),this.water.onBeforeRender(e,t,n)}},{key:"dispose",value:function(){this.material.dispose()}}]),n}(Cm),Qv=function e(t,n){Ei.call(this,t),this.type="Reflector";var i=this,r=void 0!==(n=n||{}).color?new Fn(n.color):new Fn(8355711),a=n.textureWidth||512,o=n.textureHeight||512,s=n.clipBias||0,l=n.shader||e.ReflectorShader,A=void 0!==n.recursion?n.recursion:0,c=new vn,h=new at,u=new at,d=new at,f=new bt,p=new at(0,0,-1),m=new ut,v=new at,g=new at,y=new ut,w=new bt,x=new Ni,b=new dt(a,o,{minFilter:Z,magFilter:Z,format:Ae,stencilBuffer:!1});et.isPowerOfTwo(a)&&et.isPowerOfTwo(o)||(b.texture.generateMipmaps=!1);var M=new Ri({uniforms:Di.clone(l.uniforms),fragmentShader:l.fragmentShader,vertexShader:l.vertexShader});M.uniforms.tDiffuse.value=b.texture,M.uniforms.color.value=r,M.uniforms.textureMatrix.value=w,this.material=M,this.onBeforeRender=function(e,t,n){if("recursion"in n.userData){if(n.userData.recursion===A)return;n.userData.recursion++}if(u.setFromMatrixPosition(i.matrixWorld),d.setFromMatrixPosition(n.matrixWorld),f.extractRotation(i.matrixWorld),h.set(0,0,1),h.applyMatrix4(f),v.subVectors(u,d),!(v.dot(h)>0)){v.reflect(h).negate(),v.add(u),f.extractRotation(n.matrixWorld),p.set(0,0,-1),p.applyMatrix4(f),p.add(d),g.subVectors(u,p),g.reflect(h).negate(),g.add(u),x.position.copy(v),x.up.set(0,1,0),x.up.applyMatrix4(f),x.up.reflect(h),x.lookAt(g),x.far=n.far,x.updateMatrixWorld(),x.projectionMatrix.copy(n.projectionMatrix),x.userData.recursion=0,w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(x.projectionMatrix),w.multiply(x.matrixWorldInverse),w.multiply(i.matrixWorld),c.setFromNormalAndCoplanarPoint(h,u),c.applyMatrix4(x.matrixWorldInverse),m.set(c.normal.x,c.normal.y,c.normal.z,c.constant);var r=x.projectionMatrix;y.x=(Math.sign(m.x)+r.elements[8])/r.elements[0],y.y=(Math.sign(m.y)+r.elements[9])/r.elements[5],y.z=-1,y.w=(1+r.elements[10])/r.elements[14],m.multiplyScalar(2/m.dot(y)),r.elements[2]=m.x,r.elements[6]=m.y,r.elements[10]=m.z+1-s,r.elements[14]=m.w,i.visible=!1;var a=e.getRenderTarget(),o=e.vr.enabled,l=e.shadowMap.autoUpdate;e.vr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(b),e.clear(),e.render(t,x),e.vr.enabled=o,e.shadowMap.autoUpdate=l,e.setRenderTarget(a);var M=n.viewport;void 0!==M&&e.state.viewport(M),i.visible=!0}},this.getRenderTarget=function(){return b}};(Qv.prototype=Object.create(Ei.prototype)).constructor=Qv,Qv.ReflectorShader={uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:["uniform mat4 textureMatrix;","varying vec4 vUv;","void main() {","\tvUv = textureMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform vec3 color;","uniform sampler2D tDiffuse;","varying vec4 vUv;","float blendOverlay( float base, float blend ) {","\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );","}","vec3 blendOverlay( vec3 base, vec3 blend ) {","\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );","}","void main() {","\tvec4 base = texture2DProj( tDiffuse, vUv );","\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );","}"].join("\n")};var Gv=function(e){h(n,e);var t=y(n);function n(e,i){var r;return s(this,n),(r=t.call(this,i)).mesh=e,r.mirror=new Qv(r.mesh.geometry,{clipBias:.003,textureWidth:1024*window.devicePixelRatio,textureHeight:1024*window.devicePixelRatio,color:"#777777",recursion:1}),r.mesh.material0||(r.mesh.material0=r.mesh.material),r.mirror.position.copy(e.position),r.mirror.rotation.copy(e.rotation),r.mirror.scale.copy(e.scale),r.mirror.updateMatrixWorld(!0),r.mesh.material=r.mirror.material,r}return A(n,[{key:"clear",value:function(){this.mesh.material=this.mesh.material0,this.paused=!0,AMRT.render()}},{key:"update",value:function(e){}},{key:"onBeforeRender",value:function(e,t,n,i){this.mirror.onBeforeRender(e,t,n)}},{key:"dispose",value:function(){this.material.dispose()}}]),n}(Cm),Hv=function(e){h(n,e);var t=y(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,n),e=t.call(this);var r=i.size?i.size:5,a=i.color?i.color:"#00fa00",o=i.speed?i.speed:1,l=i.texture?i.texture:"https://laozicloud-sdk.obs.cn-east-2.myhuaweicloud.com/assets/image/radar.png";return e.map=(new tA).load(l),e.map.center.set(.5,.5),e.circle=new Ei(new fl(r,64),new Nn({color:a,map:e.map,transparent:!0})),e.circle.renderOrder=6e3,e.circle.rotation.x=-Math.PI/2,e.circle.onBeforeRender=function(){e.map.rotation-=et.degToRad(2*o)},e.add(e.circle),e}return A(n)}(zt),Vv=function(e){h(n,e);var t=y(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,n),e=t.call(this);var r=i.startRadius?i.startRadius:2,a=i.endRadius?i.endRadius:8,o=i.color?i.color:"#ffab03",l=i.speed?i.speed:1,A=i.texture?i.texture:"https://laozicloud-sdk.obs.cn-east-2.myhuaweicloud.com/assets/image/tours.png",c=(new tA).load(A),h=new $i(2*r,2*r),u=new Nn({map:c,color:o,transparent:!0,side:2});e.tours=new Ei(h,u);var d=a/r;return e.tours.renderOrder=1e3,e.tours.onAfterRender=function(){this.scale.x+=.01*l,this.scale.y=this.scale.x,this.scale.x>.4*d&&(this.material.opacity-=.005),this.scale.x>=d&&(this.scale.x=this.scale.y=1,this.material.opacity=1)},e.tours.rotation.x=-Math.PI/2,e.add(e.tours),e}return A(n)}(zt),jv=function(e){h(n,e);var t=y(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,n),e=t.call(this),i.width||(i.width=100),i.height||(i.height=100),i.radius||(i.radius=10),e.canvas=document.createElement("canvas"),e.canvas.width=i.width,e.canvas.height=i.height,e.context=e.canvas.getContext("2d"),e.radius=i.radius||10,e.context.fillStyle="#00ff00",e.context.fillRect(0,0,i.width,i.height),e.colorStops=i.colorStops||{1:"#f00",.8:"#e2fa00",.6:"#33f900",.3:"#0349df",0:"#fff"},e.data=i.data||[{coord:[-54,0,-70],value:15},{coord:[-17,21,-52],value:13},{coord:[12,21,-52],value:22}],e.draw(e.data),e.material=new Nn({transparent:!0,map:new ts(e.canvas),side:2});var r=new qi(i.width,i.height);return e.map=new Ei(r,e.material),e.map.rotation.x=Math.PI/180*-90,e}return A(n,[{key:"setColorStops",value:function(e){this.colorStops=e}},{key:"setSource",value:function(e){this.draw(e),this.map.material.map.needsUpdate=!0}},{key:"draw",value:function(e){var t=this;this._convertPoints(e,this.radius),this.dataList=e;var n=this.context;n.clearRect(0,0,this.canvas.width,this.canvas.height);var i=this.dataList.reduce((function(e,t){return Math.max(e,t.value)}),0);this.dataList.forEach((function(e){t._drawRadiation(n,{x:e.x,y:e.y,radius:t.radius,weight:Math.max(Math.min((e.value-0)/(i-0),1),0),value:e.value})}));for(var r=this._createPalette(this.colorStops),a=this.canvas,o=a.width,s=a.height,l=n.getImageData(0,0,o,s),A=l.data,c=3;c0?i.x+=t:0==i.x?i.x=t:i.x<0&&(i.x=t+i.x),i.y>0?i.y+=n:0==i.y?i.y=n:i.y<0&&(i.y=n+i.y),e[r]=i}))}},{key:"_drawRadiation",value:function(e,t){var n=t.x,i=t.y,r=t.radius,a=t.weight;r=Math.round(r*a);var o=e.createRadialGradient(n,i,0,n,i,r);o.addColorStop(0,"rgba(25, 0, 0, 1)"),o.addColorStop(1,"rgba(0, 255, 0, 0)"),e.fillStyle=o,e.beginPath(),e.arc(n,i,r,0,2*Math.PI),e.closePath(),e.fill()}},{key:"_getColorByValue",value:function(e){return e>=0&&e<=5?["rgba("+this.colorStops[1]+",1)","rgba("+this.colorStops[0]+",0)"]:e>5&&e<=10?["rgba("+this.colorStops[2]+",1)","rgba("+this.colorStops[1]+",0)"]:e>10&&e<=20?["rgba("+this.colorStops[3]+",1)","rgba("+this.colorStops[2]+",0)"]:e>20?["rgba("+this.colorStops[4]+",1)","rgba("+this.colorStops[3]+",0)"]:void 0}},{key:"_getColorByValue2",value:function(e){return e>=0&&e<=5?["rgb("+this.colorStops[0]+")","rgba("+this.colorStops[1]+")"]:e>5&&e<=10?["rgb("+this.colorStops[1]+")","rgba("+this.colorStops[2]+")"]:e>10&&e<=20?["rgb("+this.colorStops[2]+")","rgba("+this.colorStops[3]+")"]:e>20?["rgb("+this.colorStops[3]+")","rgba("+this.colorStops[4]+")"]:void 0}},{key:"_createPalette",value:function(e){var t=256,n=document.createElement("canvas");n.width=t,n.height=20;var i=n.getContext("2d");i.fillStyle="#0000ff";var r=i.createLinearGradient(0,0,t,0);for(var a in e)r.addColorStop(a,e[a]);i.fillStyle=r,i.fillRect(0,0,t,20);var o=i.getImageData(0,0,t,1).data;return{canvas:n,pickColor:function(e){return o.slice(4*e,4*e+3)}}}}]),n}(zt),Wv=function(e){h(n,e);var t=y(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,n),(e=t.call(this)).matColor=i.color,e.path=i.path,e.uvSpeed=.01,e.speed=i.speed,e.radius=i.radius,e.texture=i.texture||"https://laozicloud-sdk.obs.cn-east-2.myhuaweicloud.com/assets/image/streamer.png",e.tension=i.tension;var r=(new tA).load(e.texture);r.wrapS=r.wrapT=V,r.repeat.set(1,1),r.needsUpdate=!0;var a=new Nn({map:r,side:1,transparent:!0});e.matColor&&(a.color=new Fn(e.matColor));var o=new cA(e.path);null!=e.tension&&(o.curveType="catmullrom",o.tension=e.tension);var l=new ms(o,20*e.path.length,e.radius);e.lineMesh=new Ei(l,a);var A=v(e);return e.lineMesh.onBeforeRender=function(){r&&(r.offset.x-=A.speed)},e.add(e.lineMesh),e}return A(n,[{key:"radius",get:function(){return this._radius},set:function(e){this._radius=e||.1}},{key:"speed",get:function(){return this._speed},set:function(e){this._speed=e?e*this.uvSpeed:this.uvSpeed}},{key:"matColor",get:function(){return this._matColor},set:function(e){e&&(this._matColor=e,this.lineMesh&&(this.lineMesh.material.color=new Fn(this.matColor)))}},{key:"path",get:function(){return this._path},set:function(e){if(e){this._path=[];for(var t=0;t0){void 0===e.cid&&(e.cid=[]);for(var t=0;t0)for(var n=0;n4&&void 0!==arguments[4]&&arguments[4],a=new Kl(this.manager);a.setResponseType("json");var o=this;a.load(e,(function(e){o.data=e;var n=o.parse(r);t(n)}),n,i)},isInBox:function(e,t,n,i,r,a){return!(er||ta)},parse:function(e){for(var t=[],n=this.data,i=0,r=0,a=0,o=0,s=0;s1)for(var v=1;v=Jv.WHEELMAX&&t()}),Jv.WHEELMAX)}),!1),e.addEventListener("mouseup",(function(e){e.preventDefault(),Jv.detect(),t()}),!1),e.addEventListener("touchend",(function(e){e.preventDefault(),t()}),!1)}},qv=function(e){this.camera=e,this.focusLevels=function(e){for(var t=0,n=0,i=0,r=0,a=0,o=0,s=0,l=0,A=1e-6,c=0;cn&&(n=e[c].center.x,o=e[c].radius),e[c].center.zi&&(i=e[c].center.z,s=e[c].radius));var h=new at(t-a,A/=e.length,r-l),u=new at(n+o,A,i+s),d=new at((h.x+u.x)/2,A,(h.z+u.z)/2),f=Math.abs(h.x-u.x),p=Math.abs(h.z-u.z),m=Math.tan(Math.PI/180*.5*this.camera.fov),v=p/2/m,g=f/this.camera.aspect/2/m,y=(new at).copy(d);return y.y+=v>g?v:g,this.camera.position.copy(y),this.camera.lookAt(d),this.camera.updateProjectionMatrix(),d},this.focusSimple=function(){return this.camera.position.copy(new at(0,1e3,0)),this.camera.lookAt(new at),this.camera.updateProjectionMatrix(),new at}},$v=xd("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewoJJ3VzZSBzdHJpY3QnOwoKCWZ1bmN0aW9uIFZlY3RvcjMoeCwgeSwgeikgewoJICB0aGlzLnggPSB4IHx8IDA7CgkgIHRoaXMueSA9IHkgfHwgMDsKCSAgdGhpcy56ID0geiB8fCAwOwoJfQoKCU9iamVjdC5hc3NpZ24oVmVjdG9yMy5wcm90b3R5cGUsIHsKCSAgaXNWZWN0b3IzOiB0cnVlLAoJICBzZXQ6IGZ1bmN0aW9uIHNldCh4LCB5LCB6KSB7CgkgICAgdGhpcy54ID0geDsKCSAgICB0aGlzLnkgPSB5OwoJICAgIHRoaXMueiA9IHo7CgkgICAgcmV0dXJuIHRoaXM7CgkgIH0sCgkgIGNvcHk6IGZ1bmN0aW9uIGNvcHkodikgewoJICAgIHRoaXMueCA9IHYueDsKCSAgICB0aGlzLnkgPSB2Lnk7CgkgICAgdGhpcy56ID0gdi56OwoJICAgIHJldHVybiB0aGlzOwoJICB9LAoJICBkb3Q6IGZ1bmN0aW9uIGRvdCh2KSB7CgkgICAgcmV0dXJuIHRoaXMueCAqIHYueCArIHRoaXMueSAqIHYueSArIHRoaXMueiAqIHYuejsKCSAgfSwKCSAgbGVuZ3RoU3E6IGZ1bmN0aW9uIGxlbmd0aFNxKCkgewoJICAgIHJldHVybiB0aGlzLnggKiB0aGlzLnggKyB0aGlzLnkgKiB0aGlzLnkgKyB0aGlzLnogKiB0aGlzLno7CgkgIH0sCgkgIGxlbmd0aDogZnVuY3Rpb24gbGVuZ3RoKCkgewoJICAgIHJldHVybiBNYXRoLnNxcnQodGhpcy54ICogdGhpcy54ICsgdGhpcy55ICogdGhpcy55ICsgdGhpcy56ICogdGhpcy56KTsKCSAgfSwKCSAgbWFuaGF0dGFuTGVuZ3RoOiBmdW5jdGlvbiBtYW5oYXR0YW5MZW5ndGgoKSB7CgkgICAgcmV0dXJuIE1hdGguYWJzKHRoaXMueCkgKyBNYXRoLmFicyh0aGlzLnkpICsgTWF0aC5hYnModGhpcy56KTsKCSAgfSwKCSAgbm9ybWFsaXplOiBmdW5jdGlvbiBub3JtYWxpemUoKSB7CgkgICAgcmV0dXJuIHRoaXMuZGl2aWRlU2NhbGFyKHRoaXMubGVuZ3RoKCkgfHwgMSk7CgkgIH0sCgkgIGNyb3NzOiBmdW5jdGlvbiBjcm9zcyh2KSB7CgkgICAgaWYgKHcgIT09IHVuZGVmaW5lZCkgewoJICAgICAgcmV0dXJuIHRoaXMuY3Jvc3NWZWN0b3JzKHYsIHcpOwoJICAgIH0KCgkgICAgcmV0dXJuIHRoaXMuY3Jvc3NWZWN0b3JzKHRoaXMsIHYpOwoJICB9LAoJICBjcm9zc1ZlY3RvcnM6IGZ1bmN0aW9uIGNyb3NzVmVjdG9ycyhhLCBiKSB7CgkgICAgdmFyIGF4ID0gYS54LAoJICAgICAgICBheSA9IGEueSwKCSAgICAgICAgYXogPSBhLno7CgkgICAgdmFyIGJ4ID0gYi54LAoJICAgICAgICBieSA9IGIueSwKCSAgICAgICAgYnogPSBiLno7CgkgICAgdGhpcy54ID0gYXkgKiBieiAtIGF6ICogYnk7CgkgICAgdGhpcy55ID0gYXogKiBieCAtIGF4ICogYno7CgkgICAgdGhpcy56ID0gYXggKiBieSAtIGF5ICogYng7CgkgICAgcmV0dXJuIHRoaXM7CgkgIH0sCgkgIGRpc3RhbmNlVG86IGZ1bmN0aW9uIGRpc3RhbmNlVG8odikgewoJICAgIHJldHVybiBNYXRoLnNxcnQodGhpcy5kaXN0YW5jZVRvU3F1YXJlZCh2KSk7CgkgIH0sCgkgIGRpc3RhbmNlVG9TcXVhcmVkOiBmdW5jdGlvbiBkaXN0YW5jZVRvU3F1YXJlZCh2KSB7CgkgICAgdmFyIGR4ID0gdGhpcy54IC0gdi54LAoJICAgICAgICBkeSA9IHRoaXMueSAtIHYueSwKCSAgICAgICAgZHogPSB0aGlzLnogLSB2Lno7CgkgICAgcmV0dXJuIGR4ICogZHggKyBkeSAqIGR5ICsgZHogKiBkejsKCSAgfSwKCSAgbWFuaGF0dGFuRGlzdGFuY2VUbzogZnVuY3Rpb24gbWFuaGF0dGFuRGlzdGFuY2VUbyh2KSB7CgkgICAgcmV0dXJuIE1hdGguYWJzKHRoaXMueCAtIHYueCkgKyBNYXRoLmFicyh0aGlzLnkgLSB2LnkpICsgTWF0aC5hYnModGhpcy56IC0gdi56KTsKCSAgfSwKCSAgZnJvbUFycmF5OiBmdW5jdGlvbiBmcm9tQXJyYXkoYXJyYXkpIHsKCSAgICB0aGlzLnggPSBhcnJheVswXTsKCSAgICB0aGlzLnkgPSBhcnJheVsxXTsKCSAgICB0aGlzLnogPSBhcnJheVsyXTsKCSAgICByZXR1cm4gdGhpczsKCSAgfSwKCSAgYXBwbHlNYXRyaXg0OiBmdW5jdGlvbiBhcHBseU1hdHJpeDQobSkgewoJICAgIHZhciB4ID0gdGhpcy54LAoJICAgICAgICB5ID0gdGhpcy55LAoJICAgICAgICB6ID0gdGhpcy56OwoJICAgIHZhciBlID0gbS5lbGVtZW50czsKCSAgICB2YXIgdyA9IDEgLyAoZVszXSAqIHggKyBlWzddICogeSArIGVbMTFdICogeiArIGVbMTVdKTsKCSAgICB0aGlzLnggPSAoZVswXSAqIHggKyBlWzRdICogeSArIGVbOF0gKiB6ICsgZVsxMl0pICogdzsKCSAgICB0aGlzLnkgPSAoZVsxXSAqIHggKyBlWzVdICogeSArIGVbOV0gKiB6ICsgZVsxM10pICogdzsKCSAgICB0aGlzLnogPSAoZVsyXSAqIHggKyBlWzZdICogeSArIGVbMTBdICogeiArIGVbMTRdKSAqIHc7CgkgICAgcmV0dXJuIHRoaXM7CgkgIH0KCX0pOwoKCWZ1bmN0aW9uIFBsYW5lKCkgewoJICB0aGlzLm5vcm1hbCA9IG5ldyBWZWN0b3IzKDEsIDAsIDApOwoJICB0aGlzLmNvbnN0YW50ID0gMDsKCX0KCglPYmplY3QuYXNzaWduKFBsYW5lLnByb3RvdHlwZSwgewoJICBzZXQ6IGZ1bmN0aW9uIHNldChub3JtYWwsIGNvbnN0YW50KSB7CgkgICAgdGhpcy5ub3JtYWwuZnJvbUFycmF5KG5vcm1hbCk7CgkgICAgdGhpcy5jb25zdGFudCA9IGNvbnN0YW50OwoJICAgIHJldHVybiB0aGlzOwoJICB9LAoJICBkaXN0YW5jZVRvUG9pbnQ6IGZ1bmN0aW9uIGRpc3RhbmNlVG9Qb2ludChwb2ludCkgewoJICAgIHJldHVybiB0aGlzLm5vcm1hbC5kb3QocG9pbnQpICsgdGhpcy5jb25zdGFudDsKCSAgfSwKCSAgZGlzdGFuY2VUb1NwaGVyZTogZnVuY3Rpb24gZGlzdGFuY2VUb1NwaGVyZShzcGhlcmUpIHsKCSAgICByZXR1cm4gdGhpcy5kaXN0YW5jZVRvUG9pbnQoc3BoZXJlLmNlbnRlcikgLSBzcGhlcmUucmFkaXVzOwoJICB9LAoJICBpbnRlcnNlY3RzU3BoZXJlOiBmdW5jdGlvbiBpbnRlcnNlY3RzU3BoZXJlKHNwaGVyZSkgewoJICAgIHJldHVybiBzcGhlcmUuaW50ZXJzZWN0c1BsYW5lKHRoaXMpOwoJICB9Cgl9KTsKCglmdW5jdGlvbiBGcnVzdHVtKCkgewoJICB0aGlzLnBsYW5lcyA9IFtuZXcgUGxhbmUoKSwgbmV3IFBsYW5lKCksIG5ldyBQbGFuZSgpLCBuZXcgUGxhbmUoKSwgbmV3IFBsYW5lKCksIG5ldyBQbGFuZSgpXTsKCX0KCglPYmplY3QuYXNzaWduKEZydXN0dW0ucHJvdG90eXBlLCB7CgkgIGludGVyc2VjdHNTcGhlcmU6IGZ1bmN0aW9uIGludGVyc2VjdHNTcGhlcmUoc3BoZXJlKSB7CgkgICAgdmFyIHBsYW5lcyA9IHRoaXMucGxhbmVzOwoJICAgIHZhciBjZW50ZXIgPSBzcGhlcmUuY2VudGVyOwoJICAgIHZhciBuZWdSYWRpdXMgPSAtc3BoZXJlLnJhZGl1czsKCgkgICAgZm9yICh2YXIgaSA9IDA7IGkgPCA2OyBpKyspIHsKCSAgICAgIHZhciBkaXN0YW5jZSA9IHBsYW5lc1tpXS5kaXN0YW5jZVRvUG9pbnQoY2VudGVyKTsKCgkgICAgICBpZiAoZGlzdGFuY2UgPCBuZWdSYWRpdXMpIHsKCSAgICAgICAgcmV0dXJuIGZhbHNlOwoJICAgICAgfQoJICAgIH0KCgkgICAgcmV0dXJuIHRydWU7CgkgIH0KCX0pOwoKCWZ1bmN0aW9uIHNvcnRCeURpcyhhLCBiKSB7CgkgIHJldHVybiBiLmQgLSBhLmQ7Cgl9CgoJdmFyIHJycnIgPSBbXTsKCXZhciBsZXZlbHM7Cgl2YXIgRF9MRVZFTFMgPSBbNTAwLCAyMDAsIDEwMCwgLUluZmluaXR5XTsKCXZhciBVX0xFVkVMUyA9IFtJbmZpbml0eSwgNTAwLCAyMDAsIDEwMF07IC8v5paw5aKe77yI5pyA5aSn57qn5Yir5Yik5pat6Zeu6aKY77yJLS3lvIDlp4sKCgl2YXIgZF9sYXN0ID0gRF9MRVZFTFMubGVuZ3RoIC0gMTsKCXZhciBtYXhfbGV2ZWwgPSAwOyAvL+aWsOWinu+8iOacgOWkp+e6p+WIq+WIpOaWremXrumimO+8iS0t57uT5p2fCgoJdmFyIHYxID0gbmV3IFZlY3RvcjMoKTsKCglmdW5jdGlvbiBmaW5kU3ViQ2h1bmsoZiwgdCwgY3AsIGMpIHsKCSAgLy/kuI3lpITnkIbop4bph47lpJbnmoTlv6sKCSAgaWYgKGYuaW50ZXJzZWN0c1NwaGVyZSh0KSkgewoJICAgIHYxLmNvcHkodC5jZW50ZXIpOwoJICAgIHYxLnkgKz0gYy55OwoJICAgIHZhciBkaXMgPSBjcC5kaXN0YW5jZVRvKHYxKTsgLy/mlrDlop7vvIjmnIDlpKfnuqfliKvliKTmlq3pl67popjvvIktLeW8gOWniwoKCSAgICB2YXIgZF9sID0gdC5hY2ZsOwoJICAgIGlmIChkX2wgPT0gbWF4X2xldmVsKSBkX2wgPSBkX2xhc3Q7IC8v5paw5aKe77yI5pyA5aSn57qn5Yir5Yik5pat6Zeu6aKY77yJLS3nu5PmnZ8KCgkgICAgaWYgKGRpcyA+IFVfTEVWRUxTW3QuYWNmbF0pIHsKCSAgICAgIC8v5peg5pWI5Z2XCgkgICAgICBpZiAodC5hY2ZsID4gMCkgewoJICAgICAgICB2MS5jb3B5KGxldmVsc1t0LnBpZF0uY2VudGVyKTsKCSAgICAgICAgdjEueSArPSBjLnk7CgoJICAgICAgICBpZiAoY3AuZGlzdGFuY2VUbyh2MSkgPD0gRF9MRVZFTFNbdC5hY2ZsIC0gMV0pIHsKCSAgICAgICAgICB2YXIgcmUgPSB7fTsKCSAgICAgICAgICByZS5pID0gdC5hY2ZpOwoJICAgICAgICAgIHJlLmwgPSB0LmFjZmw7CgkgICAgICAgICAgcmUucCA9IHQucGlkOwoJICAgICAgICAgIHJlLmMgPSB0LmNpZDsKCSAgICAgICAgICByZS5kID0gZGlzOwoJICAgICAgICAgIHJlLnYgPSB0LmlkOwoJICAgICAgICAgIHJycnIucHVzaChyZSk7CgkgICAgICAgIH0KCSAgICAgIH0gLy/kv67mlLnvvIjmnIDlpKfnuqfliKvliKTmlq3pl67popjvvIktLeW8gOWniwoKCSAgICB9IGVsc2UgaWYgKGRpcyA8PSBEX0xFVkVMU1tkX2xdKSB7CgkgICAgICAvL+S/ruaUue+8iOacgOWkp+e6p+WIq+WIpOaWremXrumimO+8iS0t57uT5p2fCgkgICAgICAvL+afpeaJvuWtkOWdlwoJICAgICAgaWYgKHQuY2lkKSB7CgkgICAgICAgIGZvciAodmFyIHRpID0gMCwgdGMgPSB0LmNpZC5sZW5ndGg7IHRpIDwgdGM7IHRpKyspIHsKCSAgICAgICAgICBmaW5kU3ViQ2h1bmsoZiwgbGV2ZWxzW3QuY2lkW3RpXV0sIGNwLCBjKTsKCSAgICAgICAgfQoJICAgICAgfQoJICAgIH0gZWxzZSB7CgkgICAgICAvL+acieaViOWdlwoJICAgICAgdmFyIHJlID0ge307CgkgICAgICByZS5pID0gdC5hY2ZpOwoJICAgICAgcmUubCA9IHQuYWNmbDsKCSAgICAgIHJlLnAgPSB0LnBpZDsKCSAgICAgIHJlLmMgPSB0LmNpZDsKCSAgICAgIHJlLmQgPSBkaXM7CgkgICAgICByZS52ID0gdC5pZDsKCSAgICAgIHJycnIucHVzaChyZSk7CgkgICAgfQoJICB9Cgl9CgoJZnVuY3Rpb24gTENEZXRlY3QoKSB7CgkgIC8v57qn5Yir5Y+C5pWw77yM5a6e6ZmF6aG555uu5Lit5Y+v5Lul6Ieq55Sx6YWN572u77yM55uu5YmN5pSv5oyB5Yiw56ys5LiJ57qn5YirCgkgIHRoaXMuY3BvcyA9IG5ldyBWZWN0b3IzKCk7CgkgIHRoaXMuZnJ1c3R1bSA9IG5ldyBGcnVzdHVtKCk7CgkgIHRoaXMuY2VudGVyID0gbmV3IFZlY3RvcjMoKTsKCgkgIHRoaXMuc2V0TGV2ZWxzID0gZnVuY3Rpb24gKHRsZXZlbHMpIHsKCSAgICBsZXZlbHMgPSB0bGV2ZWxzOwoJICAgIHRoaXMuY291bnQgPSBsZXZlbHMubGVuZ3RoOwoJICAgIHRoaXMuYmFzZUxldmVscyA9IFtdOwoKCSAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRoaXMuY291bnQ7IGkrKykgewoJICAgICAgaWYgKGxldmVsc1tpXS5hY2ZsID09IDApIHsKCSAgICAgICAgdGhpcy5iYXNlTGV2ZWxzLnB1c2goaSk7CgkgICAgICB9IC8v5paw5aKe77yI5pyA5aSn57qn5Yir5Yik5pat6Zeu6aKY77yJLS3lvIDlp4sKCgoJICAgICAgaWYgKGxldmVsc1tpXS5hY2ZsID4gbWF4X2xldmVsKSBtYXhfbGV2ZWwgPSBsZXZlbHNbaV0uYWNmbDsgLy/mlrDlop7vvIjmnIDlpKfnuqfliKvliKTmlq3pl67popjvvIktLee7k+adnwoJICAgIH0KCgkgICAgdGhpcy5iYXNlTGV2ZWxzQ291bnQgPSB0aGlzLmJhc2VMZXZlbHMubGVuZ3RoOwoJICB9OwoKCSAgdGhpcy5zZXRDYW1lcmFQb3MgPSBmdW5jdGlvbiAoY3BvcykgewoJICAgIHRoaXMuY3Bvcy5mcm9tQXJyYXkoY3Bvcyk7CgkgIH07CgoJICB0aGlzLnNldEZydXN0dW0gPSBmdW5jdGlvbiAoZnJ1c3R1bVN0YXRlKSB7CgkgICAgZm9yICh2YXIgaSA9IDA7IGkgPCA2OyBpKyspIHsKCSAgICAgIHZhciBiYXNlID0gaSAqIDQ7CgkgICAgICB0aGlzLmZydXN0dW0ucGxhbmVzW2ldLnNldChbZnJ1c3R1bVN0YXRlW2Jhc2VdLCBmcnVzdHVtU3RhdGVbYmFzZSArIDFdLCBmcnVzdHVtU3RhdGVbYmFzZSArIDJdXSwgZnJ1c3R1bVN0YXRlW2Jhc2UgKyAzXSk7CgkgICAgfQoJICB9OwoKCSAgdGhpcy5zZXRDb21wbGV0ZSA9IGZ1bmN0aW9uIChjYWxsYmFjaykgewoJICAgIHRoaXMuY29tcGxldGUgPSBjYWxsYmFjazsKCSAgfTsKCgkgIHRoaXMuc2V0Q2VudGVyID0gZnVuY3Rpb24gKGNlbnRlcikgewoJICAgIHRoaXMuY2VudGVyLnNldChjZW50ZXIueCwgY2VudGVyLnksIGNlbnRlci56KTsKCSAgfTsKCgkgIHRoaXMuZGV0ZWN0ID0gZnVuY3Rpb24gKCkgewoJICAgIHJycnIgPSBbXTsKCgkgICAgZm9yICh2YXIgaSA9IDA7IGkgPCB0aGlzLmJhc2VMZXZlbHNDb3VudDsgaSsrKSB7CgkgICAgICBmaW5kU3ViQ2h1bmsodGhpcy5mcnVzdHVtLCBsZXZlbHNbdGhpcy5iYXNlTGV2ZWxzW2ldXSwgdGhpcy5jcG9zLCB0aGlzLmNlbnRlcik7CgkgICAgfQoKCSAgICBycnJyLnNvcnQoc29ydEJ5RGlzKTsKCgkgICAgaWYgKHRoaXMuY29tcGxldGUpIHsKCSAgICAgIHRoaXMuY29tcGxldGUocnJycik7CgkgICAgfQoKCSAgICBycnJyID0gbnVsbDsKCSAgfTsKCX0KCgl2YXIgZGV0ZWN0ID0gbmV3IExDRGV0ZWN0KCk7CglkZXRlY3Quc2V0Q29tcGxldGUoZnVuY3Rpb24gKHIpIHsKCSAgc2VsZi5wb3N0TWVzc2FnZShyKTsKCX0pOwoKCXNlbGYub25tZXNzYWdlID0gZnVuY3Rpb24gKGV2dCkgewoJICBzd2l0Y2ggKGV2dC5kYXRhLnR5cGUpIHsKCSAgICBjYXNlICJpbml0IjoKCSAgICAgIGRldGVjdC5zZXRMZXZlbHMoZXZ0LmRhdGEuZGF0YSk7CgkgICAgICBkZXRlY3Quc2V0Q2VudGVyKGV2dC5kYXRhLmNlbnRlcik7CgkgICAgICBicmVhazsKCgkgICAgY2FzZSAiZGV0ZWN0IjoKCSAgICAgIGRldGVjdC5zZXRDYW1lcmFQb3MoZXZ0LmRhdGEucG9zKTsKCSAgICAgIGRldGVjdC5zZXRGcnVzdHVtKGV2dC5kYXRhLnN0YXRlKTsKCSAgICAgIGRldGVjdC5kZXRlY3QoKTsKCSAgICAgIGV2dC5kYXRhLnBvcyA9IG51bGw7CgkgICAgICBldnQuZGF0YS5zdGF0ZSA9IG51bGw7CgkgICAgICBicmVhazsKCSAgfQoKCSAgZGVsZXRlIGV2dC5kYXRhOwoJfTsKCn0pKCk7Cgo=",null,!1),eg=xd("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewoJJ3VzZSBzdHJpY3QnOwoKCXZhciBsb2FkaW5nJDEgPSB7fTsKCglmdW5jdGlvbiBGaWxlTG9hZGVyKCkge30KCglGaWxlTG9hZGVyLnByb3RvdHlwZSA9IE9iamVjdC5hc3NpZ24oRmlsZUxvYWRlci5wcm90b3R5cGUsIHsKCSAgY29uc3RydWN0b3I6IEZpbGVMb2FkZXIsCgkgIGxvYWQ6IGZ1bmN0aW9uIGxvYWQodXJsLCBvbkxvYWQsIG9uUHJvZ3Jlc3MsIG9uRXJyb3IpIHsKCSAgICBpZiAobG9hZGluZyQxW3VybF0gIT09IHVuZGVmaW5lZCkgewoJICAgICAgbG9hZGluZyQxW3VybF0ucHVzaCh7CgkgICAgICAgIG9uTG9hZDogb25Mb2FkLAoJICAgICAgICBvblByb2dyZXNzOiBvblByb2dyZXNzLAoJICAgICAgICBvbkVycm9yOiBvbkVycm9yCgkgICAgICB9KTsKCSAgICAgIHJldHVybjsKCSAgICB9CgoJICAgIGxvYWRpbmckMVt1cmxdID0gW107CgkgICAgbG9hZGluZyQxW3VybF0ucHVzaCh7CgkgICAgICBvbkxvYWQ6IG9uTG9hZCwKCSAgICAgIG9uUHJvZ3Jlc3M6IG9uUHJvZ3Jlc3MsCgkgICAgICBvbkVycm9yOiBvbkVycm9yCgkgICAgfSk7CgkgICAgdmFyIHJlcXVlc3QgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKCSAgICByZXF1ZXN0Lm9wZW4oJ0dFVCcsIHVybCwgdHJ1ZSk7CgkgICAgcmVxdWVzdC5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgZnVuY3Rpb24gKGV2ZW50KSB7CgkgICAgICB2YXIgcmVzcG9uc2UgPSB0aGlzLnJlc3BvbnNlOwoJICAgICAgdmFyIGNhbGxiYWNrcyA9IGxvYWRpbmckMVt1cmxdOwoJICAgICAgZGVsZXRlIGxvYWRpbmckMVt1cmxdOwoKCSAgICAgIGlmICh0aGlzLnN0YXR1cyA9PT0gMjAwIHx8IHRoaXMuc3RhdHVzID09PSAwKSB7CgkgICAgICAgIGZvciAodmFyIGkgPSAwLCBpbCA9IGNhbGxiYWNrcy5sZW5ndGg7IGkgPCBpbDsgaSsrKSB7CgkgICAgICAgICAgdmFyIGNhbGxiYWNrID0gY2FsbGJhY2tzW2ldOwoJICAgICAgICAgIGlmIChjYWxsYmFjay5vbkxvYWQpIGNhbGxiYWNrLm9uTG9hZChyZXNwb25zZSk7CgkgICAgICAgIH0KCSAgICAgIH0gZWxzZSB7CgkgICAgICAgIGZvciAodmFyIGkgPSAwLCBpbCA9IGNhbGxiYWNrcy5sZW5ndGg7IGkgPCBpbDsgaSsrKSB7CgkgICAgICAgICAgdmFyIGNhbGxiYWNrID0gY2FsbGJhY2tzW2ldOwoJICAgICAgICAgIGlmIChjYWxsYmFjay5vbkVycm9yKSBjYWxsYmFjay5vbkVycm9yKGV2ZW50KTsKCSAgICAgICAgfQoJICAgICAgfQoKCSAgICAgIHJlcXVlc3QuZW5kID0gdHJ1ZTsKCSAgICB9LCBmYWxzZSk7CgkgICAgcmVxdWVzdC5hZGRFdmVudExpc3RlbmVyKCdwcm9ncmVzcycsIGZ1bmN0aW9uIChldmVudCkgewoJICAgICAgdmFyIGNhbGxiYWNrcyA9IGxvYWRpbmckMVt1cmxdOwoKCSAgICAgIGZvciAodmFyIGkgPSAwLCBpbCA9IGNhbGxiYWNrcy5sZW5ndGg7IGkgPCBpbDsgaSsrKSB7CgkgICAgICAgIHZhciBjYWxsYmFjayA9IGNhbGxiYWNrc1tpXTsKCSAgICAgICAgaWYgKGNhbGxiYWNrLm9uUHJvZ3Jlc3MpIGNhbGxiYWNrLm9uUHJvZ3Jlc3MoZXZlbnQpOwoJICAgICAgfQoJICAgIH0sIGZhbHNlKTsKCSAgICByZXF1ZXN0LmFkZEV2ZW50TGlzdGVuZXIoJ2Vycm9yJywgZnVuY3Rpb24gKGV2ZW50KSB7CgkgICAgICB2YXIgY2FsbGJhY2tzID0gbG9hZGluZyQxW3VybF07CgkgICAgICBkZWxldGUgbG9hZGluZyQxW3VybF07CgoJICAgICAgZm9yICh2YXIgaSA9IDAsIGlsID0gY2FsbGJhY2tzLmxlbmd0aDsgaSA8IGlsOyBpKyspIHsKCSAgICAgICAgdmFyIGNhbGxiYWNrID0gY2FsbGJhY2tzW2ldOwoJICAgICAgICBpZiAoY2FsbGJhY2sub25FcnJvcikgY2FsbGJhY2sub25FcnJvcihldmVudCk7CgkgICAgICB9CgoJICAgICAgcmVxdWVzdC5lbmQgPSB0cnVlOwoJICAgIH0sIGZhbHNlKTsKCSAgICByZXF1ZXN0LmFkZEV2ZW50TGlzdGVuZXIoJ2Fib3J0JywgZnVuY3Rpb24gKGV2ZW50KSB7CgkgICAgICB2YXIgY2FsbGJhY2tzID0gbG9hZGluZyQxW3VybF07CgkgICAgICBkZWxldGUgbG9hZGluZyQxW3VybF07CgoJICAgICAgZm9yICh2YXIgaSA9IDAsIGlsID0gY2FsbGJhY2tzLmxlbmd0aDsgaSA8IGlsOyBpKyspIHsKCSAgICAgICAgdmFyIGNhbGxiYWNrID0gY2FsbGJhY2tzW2ldOwoJICAgICAgICBpZiAoY2FsbGJhY2sub25FcnJvcikgY2FsbGJhY2sub25FcnJvcihldmVudCk7CgkgICAgICB9CgoJICAgICAgcmVxdWVzdC5lbmQgPSB0cnVlOwoJICAgIH0sIGZhbHNlKTsKCSAgICBpZiAodGhpcy5yZXNwb25zZVR5cGUgIT09IHVuZGVmaW5lZCkgcmVxdWVzdC5yZXNwb25zZVR5cGUgPSB0aGlzLnJlc3BvbnNlVHlwZTsKCSAgICByZXF1ZXN0LnNlbmQobnVsbCk7CgkgICAgcmV0dXJuIHJlcXVlc3Q7CgkgIH0sCgkgIHNldFJlc3BvbnNlVHlwZTogZnVuY3Rpb24gc2V0UmVzcG9uc2VUeXBlKHZhbHVlKSB7CgkgICAgdGhpcy5yZXNwb25zZVR5cGUgPSB2YWx1ZTsKCSAgICByZXR1cm4gdGhpczsKCSAgfQoJfSk7CgoJZnVuY3Rpb24gTW9kZWxMb2FkZXIoKSB7fQoKCU1vZGVsTG9hZGVyLnByb3RvdHlwZSA9IE9iamVjdC5hc3NpZ24oTW9kZWxMb2FkZXIucHJvdG90eXBlLCB7CgkgIGNvbnN0cnVjdG9yOiBNb2RlbExvYWRlciwKCSAgbG9hZDogZnVuY3Rpb24gbG9hZCh1cmwsIG9uTG9hZCwgb25Qcm9ncmVzcywgb25FcnJvcikgewoJICAgIHZhciBsb2FkZXIgPSBuZXcgRmlsZUxvYWRlcigpOwoJICAgIGxvYWRlci5zZXRSZXNwb25zZVR5cGUoJ2pzb24nKTsKCSAgICB2YXIgc2NvcGUgPSB0aGlzOwoJICAgIHZhciByZXEgPSBsb2FkZXIubG9hZCh1cmwsIGZ1bmN0aW9uIChqc29uKSB7CgkgICAgICByZXEuZW5kID0gdHJ1ZTsKCSAgICAgIHZhciBkYXRhID0gc2NvcGUucGFyc2UoanNvbik7CgkgICAgICBvbkxvYWQoZGF0YSk7CgkgICAgICBkYXRhLnAgPSBudWxsOyAvLyBkYXRhLm4gPSBudWxsOwoKCSAgICAgIGRhdGEudSA9IG51bGw7CgkgICAgICBkYXRhLmkgPSBudWxsOwoJICAgICAgZGF0YSA9IG51bGw7CgkgICAgICBqc29uID0gbnVsbDsKCSAgICB9LCBvblByb2dyZXNzLCBvbkVycm9yKTsKCSAgICByZXR1cm4gcmVxOwoJICB9LAoJICBwYXJzZTogZnVuY3Rpb24gcGFyc2UoanNvbikgewoJICAgIHZhciBnZW8gPSB0aGlzLnBhcnNlR2VvbWV0cnkoanNvbik7CgkgICAgZ2VvLmEgPSBqc29uLmE7CgkgICAgZ2VvLmIgPSBqc29uLmI7CgkgICAgZ2VvLmMgPSBqc29uLmM7CgkgICAgcmV0dXJuIGdlbzsKCSAgfSwKCSAgcGFyc2VHZW9tZXRyeTogZnVuY3Rpb24gcGFyc2VHZW9tZXRyeShnZW9EYXRhKSB7CgkgICAgdmFyIGdlbyA9IHt9OwoJICAgIGdlby5wID0gbmV3IEZsb2F0MzJBcnJheShnZW9EYXRhLmQpOyAvLyBnZW8ubiA9IG5ldyBGbG9hdDMyQXJyYXkoZ2VvRGF0YS5lKTsKCgkgICAgZ2VvLnUgPSBuZXcgRmxvYXQzMkFycmF5KGdlb0RhdGEuZik7CgoJICAgIGlmICh0aGlzLmFycmF5TWF4KGdlb0RhdGEuZykgPiA2NTUzNSkgewoJICAgICAgZ2VvLmkgPSBuZXcgVWludDMyQXJyYXkoZ2VvRGF0YS5nKTsKCSAgICB9IGVsc2UgewoJICAgICAgZ2VvLmkgPSBuZXcgVWludDE2QXJyYXkoZ2VvRGF0YS5nKTsKCSAgICB9CgoJICAgIHJldHVybiBnZW87CgkgIH0sCgkgIGFycmF5TWF4OiBmdW5jdGlvbiBhcnJheU1heChhcnJheSkgewoJICAgIGlmIChhcnJheS5sZW5ndGggPT09IDApIHJldHVybiAtSW5maW5pdHk7CgkgICAgdmFyIG1heCA9IGFycmF5WzBdOwoKCSAgICBmb3IgKHZhciBpID0gMSwgbCA9IGFycmF5Lmxlbmd0aDsgaSA8IGw7ICsraSkgewoJICAgICAgaWYgKGFycmF5W2ldID4gbWF4KSBtYXggPSBhcnJheVtpXTsKCSAgICB9CgoJICAgIHJldHVybiBtYXg7CgkgIH0KCX0pOwoKCXZhciBwcmVsb2FkaW5nID0gW107Cgl2YXIgbG9hZGluZyA9IFtdOwoKCXNlbGYub25tZXNzYWdlID0gZnVuY3Rpb24gKGV2dCkgewoJICBzd2l0Y2ggKGV2dC5kYXRhLnR5cGUpIHsKCSAgICBjYXNlICJsb2FkIjoKCSAgICAgIHZhciBjb3VudCA9IHByZWxvYWRpbmcubGVuZ3RoOwoKCSAgICAgIGlmIChjb3VudCA+IDApIHsKCSAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CgkgICAgICAgICAgdmFyIHIgPSBwcmVsb2FkaW5nLnBvcCgpOwoKCSAgICAgICAgICBpZiAoci5lbmQpIDsgZWxzZSB7CgkgICAgICAgICAgICBzZWxmLnBvc3RNZXNzYWdlKHsKCSAgICAgICAgICAgICAgYTogci5pbmRleAoJICAgICAgICAgICAgfSk7CgkgICAgICAgICAgICByLmFib3J0KCk7CgkgICAgICAgICAgICByLmluZGV4ID0gbnVsbDsKCSAgICAgICAgICAgIHIgPSBudWxsOwoJICAgICAgICAgIH0KCSAgICAgICAgfQoJICAgICAgfQoKCSAgICAgIHZhciBsZXZlbCA9IGV2dC5kYXRhLmxldmVsOwoJICAgICAgdmFyIGluZGV4ID0gZXZ0LmRhdGEuaW5kZXg7CgkgICAgICB2YXIgbHIgPSBuZXcgTW9kZWxMb2FkZXIoKS5sb2FkKGV2dC5kYXRhLm11cmwsIGZ1bmN0aW9uIChnZW9EYXRhKSB7CgkgICAgICAgIHNlbGYucG9zdE1lc3NhZ2UoewoJICAgICAgICAgIGE6IGdlb0RhdGEuYSwKCSAgICAgICAgICBiOiBsZXZlbCwKCSAgICAgICAgICBjOiBnZW9EYXRhLmMsCgkgICAgICAgICAgZDogaW5kZXgsCgkgICAgICAgICAgcDogZ2VvRGF0YS5wLAoKCSAgICAgICAgICAvKm46Z2VvRGF0YS5uLCovCgkgICAgICAgICAgdTogZ2VvRGF0YS51LAoJICAgICAgICAgIGk6IGdlb0RhdGEuaQoJICAgICAgICB9LCBbZ2VvRGF0YS5wLmJ1ZmZlciwKCSAgICAgICAgLypnZW9EYXRhLm4uYnVmZmVyLCovCgkgICAgICAgIGdlb0RhdGEudS5idWZmZXIsIGdlb0RhdGEuaS5idWZmZXJdKTsKCSAgICAgICAgbG9hZGluZ1tpbmRleF0gPSB1bmRlZmluZWQ7CgkgICAgICB9LCBmdW5jdGlvbiAobSkge30sIGZ1bmN0aW9uIChtKSB7CgkgICAgICAgIGxvYWRpbmdbaW5kZXhdID0gdW5kZWZpbmVkOwoJICAgICAgICBzZWxmLnBvc3RNZXNzYWdlKHsKCSAgICAgICAgICB4OiBpbmRleAoJICAgICAgICB9KTsKCSAgICAgIH0pOwoJICAgICAgbHIuZW5kID0gZmFsc2U7CgkgICAgICBsci5pbmRleCA9IGluZGV4OwoJICAgICAgbG9hZGluZ1tpbmRleF0gPSBscjsKCSAgICAgIGJyZWFrOwoKCSAgICBjYXNlICJjYW5jZWwiOgoJICAgICAgdmFyIGNpbmRleCA9IGV2dC5kYXRhLmRhdGE7CgoJICAgICAgZm9yICh2YXIgX2kgPSAwLCBjID0gY2luZGV4Lmxlbmd0aDsgX2kgPCBjOyBfaSsrKSB7CgkgICAgICAgIHZhciBzZCA9IGNpbmRleFtfaV07CgoJICAgICAgICBpZiAobG9hZGluZ1tzZF0gJiYgIWxvYWRpbmdbc2RdLmVuZCkgewoJICAgICAgICAgIHNlbGYucG9zdE1lc3NhZ2UoewoJICAgICAgICAgICAgeDogbG9hZGluZ1tzZF0uaW5kZXgKCSAgICAgICAgICB9KTsKCSAgICAgICAgICBsb2FkaW5nW3NkXS5hYm9ydCgpOwoJICAgICAgICAgIGxvYWRpbmdbc2RdID0gdW5kZWZpbmVkOwoJICAgICAgICB9CgkgICAgICB9CgoJICAgICAgYnJlYWs7CgkgIH0KCX07Cgp9KSgpOwoK",null,!1),tg="load",ng="init",ig="detect",rg="cancel";function ag(e){var t=this;this.scene=e,this.loadNum=3,this.loadMaxPT=2,this.currentNum=0,this.pLoadMaxPT=3,this.detectNum=1,this.loadWorkers=[],this.detectWorkers=[],this.todol=[],this.todod=[];for(var n=this,i=function(e){var i=new eg;i.isLoader=!0,i.num=0,i.onmessage=function(e){n.currentNum--,i.num--,n.loadEnd&&e.data&&(void 0!==e.data.d?n.loadEnd(e.data):void 0!==e.data.x&&(n.scene.loading[e.data.x]=void 0))},i.sendMessage=function(e){n.currentNum++,i.num++,i.postMessage(e)},t.loadWorkers.push(i)},r=0;r0)for(var e=0;e0)for(var n=0;n0&&i.applyMatrix4((new bt).fromArray(e.c)),i},parseTextureUrl:function(e){return this.pathUtil.generatePicturePath(e.b,e.a)},parseGeometry:function(e){var t=new si;return t.name=e.a,t.setAttribute("position",new Zn(e.p,3)),t.setAttribute("uv",new Zn(e.u,2)),t.setIndex(new Zn(e.i,1)),t.clearGroups(),t.addGroup(0,e.i.length,0),t}}),lg.prototype=Object.assign(lg.prototype,{constructor:lg,load:function(e){for(var t=0;t0&&this.manager.setTask(a);var s={};s.type=tg,s.data=[];var l=this.pathUtil;this.scene.toload=[];for(var A=0;A0;){for(var m=[],v=0,g=f.length;v0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.isLocal=t,(e.mb||e.cb||e.tb)&&(e.mb?this.GlobalParams.mbase=e.mb:e.cb?this.GlobalParams.mbase=e.cb:e.tb&&(this.GlobalParams.mbase=e.tb),e.cb?this.GlobalParams.cbase=e.cb:e.mb?this.GlobalParams.cbase=e.mb:e.tb&&(this.GlobalParams.cbase=e.tb),e.tb?this.GlobalParams.tbase=e.tb:e.mb?this.GlobalParams.tbase=e.mb:e.cb&&(this.GlobalParams.tbase=e.cb)),this},generateModelPath:function(e,t){return this.GlobalParams.mbase+e+"/"+t+(this.isLocal?".json":".json.gz")},generatePicturePath:function(e,t){return this.GlobalParams.tbase+e+"/maps/"+t+".jpg"},generateConfigPath:function(e){return this.GlobalParams.cbase+e}},new Nc;var cg=new bt,hg=new Wi,ug=function(){function e(t){s(this,e),this.baseUrl=t}return A(e,[{key:"init",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.viewer=e,this.scene=e.scene,this.camera=e.camera,this.renderer=e.renderer,this.sceneGroup=n.root,this.render=e.render,this.initCamera=n.initCamera,this.center={x:0,y:0,z:0},this.pathUtil=(new Ag).config(this.baseUrl,n.isLocal||!1),this.sources={loaded:[],loading:[],nlp:[],levels:[]},this.currCount=0,this.currLoaded=0;var i=new ag(this.sources);this.workerManager=i,n&&(og.pflag=void 0!==n.preloading&&n.preloading,i.loadNum=void 0!==n.concurrency?n.concurrency:i.loadNum,i.loadMaxPT=void 0!==n.capacity?n.capacity:i.loadMaxPT),i.setLoadEnd((function(e){if(t.currLoaded++,t.currLoaded>=t.currCount&&t.loadEnd&&t.loadEnd(),t.initLoad&&(t.initLoad(),t.initLoad=null),t.sources.loaded[e.d]);else{var n=new sg(t.pathUtil).load(e),i=t.sources,r=t.center.y;n.position.y=-r,n.keep=!0,t.sceneGroup.add(n),i.loading[n.index]=void 0,i.loaded[n.index]=n;for(var a=!1,o=i.levels[n.index];o.pid;){if(i.loaded[o.pid]&&!i.loaded[o.pid].keep){for(var s=[],l=0;l0;){for(var A=[],c=0,h=s.length;c0;){for(var g=[],y=0,w=m.length;y=0&&(t=t.slice(0,i)),LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),pg=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n=0&&(t=t.slice(0,i)),pg(new Uint8Array(t))}};var vg=1,gg=2,yg=3,wg=4;var xg=function(){function e(t){var n=this;s(this,e),this.sceneManager=t,this.path="",this.loadingTasks={},this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerSourceURL="",this.currentNum=0,this.loadNum=3,this.loadMaxPT=2,this.loadWorkers=[],this.basisLoader=void 0,this.haveNewLoadTaskFlag=!1,this.cachePrioLoadTaskList=[],this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},this.setDecoderPath(If.getDecoderPath()),this._initDecoder().then((function(){n._initWorkers()}))}return A(e,[{key:"dispose",value:function(){this.sceneManager=null,this.path="",this.loadingTasks={},this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerSourceURL="",this.basisLoader.dispose(),this.basisLoader=null,this.loadWorkers.forEach((function(e){return e.terminate()})),this.loadWorkers=[],this.cachePrioLoadTaskList=[],this.haveNewLoadTaskFlag=!1}},{key:"setPath",value:function(e){this.path=e}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"_loadLibrary",value:function(e,t){var n=new Kl(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),new Promise((function(t,i){n.load(e,t,void 0,i)}))}},{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"_initDecoder",value:function(){var t=this;if(this.decoderPending)return this.decoderPending;var n="object"!==("undefined"==typeof WebAssembly?"undefined":r(WebAssembly))||"js"===this.decoderConfig.type,i=[];return n?i.push(this._loadLibrary("../amrt_decoder.js","text")):(i.push(this._loadLibrary("../amrt_wasm_wrapper.js","text")),i.push(this._loadLibrary("../../amrt_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(i).then((function(i){var r=i[0];n||(t.decoderConfig.wasmBinary=i[1]);var a=e.MrbsLoaderWorker.toString(),o=["/* draco decoder */",r,"","/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}},{key:"_initWorkers",value:function(){for(var e=this,t=0;t0?t.retData.texs.forEach((function(a){void 0===n.basisLoader&&(n.basisLoader=new Xf,n.basisLoader.setTranscoderPath(function(){var e="js/";if(document.getElementById("AMRT")){var t=document.getElementById("AMRT").src;e=t.slice(0,t.lastIndexOf("/"))+"/"}else for(var n=0;n=i&&n.sceneManager.onCompleteFileLoad(t.retData,e)}),(function(e){console.log("Error: Load basisu texture failed!!! errorCode: "+e)}))})):this.sceneManager.onCompleteFileLoad(t.retData,e)}},{key:"HandleFrameFileLoad",value:function(){var e=this;if(this.haveNewLoadTaskFlag){this.haveNewLoadTaskFlag=!1,this.cachePrioLoadTaskList=[];var t=!1;for(var n in this.loadingTasks){var i=this.loadingTasks[n];void 0!==i&&(i.state!==wg&&(i.priority=this.sceneManager.GetFilePriority(n,i.prioLevel,i.bReplace),i.state===gg?(i.priority,Number.MAX_VALUE):i.state===vg?(this.sceneManager.loadedAllInitChunkComplete||t||0===i.prioLevel&&(t=!0),i.priority===Number.MAX_VALUE&&i.prioLevel>0&&this.sceneManager.CheckIsFixedCamera()?this.sceneManager.CancelLoadingTask(n):this.cachePrioLoadTaskList.push(i)):i.state===yg&&this.sceneManager.CancelLoadingTask(n)))}this.sceneManager.loadedAllInitChunkComplete||t||(this.sceneManager.loadedAllInitChunkComplete=!0),this.cachePrioLoadTaskList.sort((function(e,t){return t.priority-e.priority}))}if([].forEach((function(t){var n={type:"cancel"};n.file=t.file,t.state=yg,e.loadWorkers[t.loaderInx].postMessage(n)})),this.cachePrioLoadTaskList.length>0)for(var r=0;r=n&&t===i}(t)){var c=new o(t);c.skip(4),c.getUint32();var h=0;try{h=c.getUint32()}catch(e){}for(var u=[],d=[],f=[],p=0;p4;)for(var w=c.getUint32(),x=0;x0){var S=c.getArrayBuffer(I);l.Init(new Int8Array(S),S.byteLength),n.decodeType=1;var T=i(r,s,l,n);b.vertexNum=T.numPoints,b.vertexs=T.attributes[0].array}else b.vertexNum=0,b.vertexs=[];else b.vertexNum=c.getUint32(),b.vertexs=c.getFloat32Array(3*b.vertexNum);b.vertexs.buffer&&f.push(b.vertexs.buffer),b.subMeshNum=c.getUint32(),b.subMeshs=[];for(var _=0;_0){S=c.getArrayBuffer(I);l.Init(new Int8Array(S),S.byteLength),n.decodeType=2;T=i(r,s,l,n);b.subMeshs[_].faces=T.attributes[0].array}else b.subMeshs[_].faces=[];else 4==b.subMeshs[_].itemByteNum?b.subMeshs[_].faces=c.getUint32Array(3*b.subMeshs[_].faceNum):2==b.subMeshs[_].itemByteNum?b.subMeshs[_].faces=c.getUint16Array(3*b.subMeshs[_].faceNum):1==b.subMeshs[_].itemByteNum&&(b.subMeshs[_].faces=c.getUint8Array(3*b.subMeshs[_].faceNum));b.subMeshs[_].faces.buffer&&f.push(b.subMeshs[_].faces.buffer)}if(b.bHaveTexture=1&B,b.bTextureFile=2&B,b.bHaveTexture){var I;if(E)if((I=c.getUint32())>0){S=c.getArrayBuffer(I);l.Init(new Int8Array(S),S.byteLength),n.decodeType=1;T=i(r,s,l,n);b.uvNum=T.numPoints,b.uvs=T.attributes[0].array}else b.uvNum=0,b.uvs=[];else b.uvNum=c.getUint32(),b.uvs=c.getFloat32Array(2*b.uvNum);if(b.uvs.buffer&&f.push(b.uvs.buffer),b.bTextureFile){var L=c.getUint8();b.textureFile=c.getString(L)}else{var F=c.getUint8();if(b.textureFile=c.getString(F),1&c.getUint32()){var k=c.getUint32();if(k>0){var P={};P.image=b.textureFile;var U=c.getArrayBuffer(k),D=new Uint8Array(U);D.buffer&&f.push(D.buffer),P.imageArray=D,d.push(P)}}}}y.geometrys.push(b),C+=M,c.setOffset(C)}u.push(y),v+=m,c.setOffset(v)}A.lods=u,A.texs=d,A.share=f}else console.log("mrbs file format error!!!!!!!!");return A}(0,n,s,l,A,c),t(r)}))}catch(t){console.log("decodeMrbsFile failed!!! File: "+e),console.log(t)}}),n,r);return h}(r.data.murl,(function(e){void 0===e?(n[r.data.file]=void 0,self.postMessage({succ:!1,file:r.data.file})):e.lods&&(self.postMessage({succ:!0,file:r.data.file,retData:{lods:e.lods,texs:e.texs}},e.share),n[r.data.file]=void 0)}),(function(e){}),(function(e){n[r.data.file]=void 0,self.postMessage({succ:!1,file:r.data.file})}),l,t);A.end=!1,n[r.data.file]=A;break;case"cancel":n[r.data.file]&&!n[r.data.file].end&&(self.postMessage({succ:!1,file:r.data.file}),n[r.data.file].abort(),n[r.data.file]=void 0)}};var a={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n=0&&(t=t.slice(0,i)),a.decodeText(new Uint8Array(t))}},s.prototype=Object.assign(s.prototype,{constructor:s,load:function(e,t,i,r){if(void 0===n[e]){n[e]=[],n[e].push({onLoad:t,onProgress:i,onError:r});var a=new XMLHttpRequest;return a.open("GET",e,!0),a.addEventListener("load",(function(t){var i=this.response,r=n[e];if(delete n[e],200===this.status||0===this.status)for(var o=0,s=r.length;o2&&n.root.position.set(Number(a[0]),Number(a[2]),Number(a[1]))}}if(i.coordinate){var o=i.coordinate.split(",");o.length>=2&&(n.coordinate=[Number(o[0]),Number(o[1])])}t&&t()}),null,(function(){t&&t()}))}},{key:"projectBoundingSphere",value:function(e,t,n,i){var r=new at;r.copy(e),r.applyMatrix4(n);var a=t*t,o=r.z*r.z,s=r.lengthSq();return-Math.PI*i*i*a*Math.sqrt(Math.abs((s-a)/(a-o)))/(a-o)}},{key:"computeRangePixels",value:function(e,t){var n=this.camera.fov;return 2*Math.atan(t/e)*180/Math.PI/(Math.max(n,1e-17)/window.innerHeight)}},{key:"GetChildListInNeedForLod",value:function(e){var t=this,n=[];e.isReshowlist=this.InformChildrenLodLoading(e,n),e.reshowlist=n,n.forEach((function(e){e.lastActiveTime=t.curFrameTime})),e.refChildNum=n.length,e.lastShowChildTime=this.curFrameTime,e.fileNode.totalRefChildNum=0,e.fileNode.lods.forEach((function(e){e.refChildNum&&(e.fileNode.totalRefChildNum+=e.refChildNum)}))}},{key:"GetChildListInNeed",value:function(e){var t=this,n=0;e.lods.forEach((function(e){var i=[];e.isReshowlist=t.InformChildrenLodLoading(e,i),e.reshowlist=i,i.forEach((function(e){e.lastActiveTime=t.curFrameTime})),n+=i.length,e.lastShowChildTime=t.curFrameTime})),e.totalRefChildNum=n}},{key:"removeChildListInNeed",value:function(e){e.lods.forEach((function(e){e.isReshowlist=!1,e.reshowlist=void 0,e.lastShowChildTime=void 0})),e.totalRefChildNum=0}},{key:"ShowChildListInNeed",value:function(e){var t=this;(!e.lastShowChildTime||this.curFrameTime-e.lastShowChildTime>=this.updateChildListDeltaTime)&&this.GetChildListInNeedForLod(e);var n=e.isReshowlist;return e.reshowlist&&e.reshowlist.length>0&&e.reshowlist.forEach((function(e){2===e.state&&e.lods.forEach((function(e){t.ShowLod(e)}))})),n}},{key:"traverseMrbsFile",value:function(e){for(var t=this,n=[e],i=[];n.length>0;){var r=n.pop(),a=this.sceneNodeTree[r];if(a)if(a.traverseTwice){a.traverseTwice=!1;for(var o=a.lods.length,s=function(e){var n=a.lods[e],i=0;n.children.forEach((function(e){var n=t.sceneNodeTree[e.file];n&&n.traverseState&&(n.traverseState>i&&(i=n.traverseState),n.traverseState=void 0)})),i!==Bg&&(a.level>=t.minLevelInxForReplaceShow||t.maxLevelAlreadyLoadedForScene-a.level<6&&!t.loadedAllInitChunkComplete)&&(2===a.state?(t.ShowLod(n),t.AddShowedFileNode(a)):(!a.traverseState||i>a.traverseState)&&(a.traverseState=i))},l=0;l=this.maxShowLevel?(a.traverseState=Sg,this.AddShowedFileNode(a)):0===a.lods.length?(this.loadMrbsFile(r,a.level),this.AddShowedFileNode(a)):function(){for(var e=[],o=a.lods.length,s=0,l=0;l=t.minLevelInxForReplaceShow&&i.push(a)),u||-1===a.parentOkLevel)if(-1!==a.parentOkLevel&&a.level-a.parentOkLevel<=2)a.traverseState=Sg;else if(t.ShowChildListInNeed(A))h=!0;else if(-1!==a.parentOkLevel){var d=t.CheckLodIsInFrustumTruly(A);a.traverseState=d?Sg:Eg}else a.traverseState=Eg;else a.traverseState=Sg}else t.ShowLod(A),h=!0;h&&t.AddShowedFileNode(a)}else A.children.forEach((function(t){t.range.x<=s&&s0&&(a.traverseTwice?console.log("Error: sceneTreeFileNode.traverseTwice"):(a.traverseTwice=!0,n.push(r),e.forEach((function(e){n.push(e)})),e=void 0))}()}}i.forEach((function(e){t.LoadReplaceFileNode(e)}))}},{key:"updateFileMaxLoaded",value:function(e,t){e.lods.forEach((function(e){e.maxLoadedLevel=this.minLevelInxForReplaceShow&&e.lastTraverseShowTime!==this.curFrameTime;)t=e,e=e.parentLod?e.parentLod.fileNode:void 0;t&&this.loadMrbsFileByNode(t,t.level,!0)}},{key:"ShowLod",value:function(e){e.subMeshs.forEach((function(e){e.visible=!0})),this.UpdateLod(e)}},{key:"HideLod",value:function(e){e.subMeshs.forEach((function(e){e.visible=!1}))}},{key:"UpdateLod",value:function(e){e.lastActiveTime=this.curFrameTime,this.frameActive.activeLods.push(e),e.fileNode.lastActiveTime=this.curFrameTime}},{key:"updateFrustum",value:function(){Lg.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.frustum.setFromMatrix(Lg)}},{key:"update",value:function(){this.updateFrustum(),this.curFrameTime=this.clock.getElapsedTime(),this.frameActive={},this.frameActive.time=this.curFrameTime,this.frameActive.activeLods=[];for(var e=this.rootMrbsFiles.length,t=0;tthis.hideDeltaTime&&(this.HideLod(s),r.splice(o,1),o--,a--)}this.framesActiveList.splice(i,1),n--}this.DestroyTimeoutFileNode()}},{key:"traverseFileNodeForDestroy",value:function(e){for(var t=this,n=[e];n.length>0;){var i=n.pop(),r=this.sceneNodeTree[i];if(void 0===r||void 0===r.lods||r.level>=this.maxShowLevel)return;var a=r.lods.length;if(2===r.state&&this.curFrameTime-r.lastActiveTime>=this.DestroyDeltaTime){for(var o=0;oA.fileNode.level&&A.children.forEach((function(e){n.push(e.file)}))}}}},{key:"DestroyTimeoutFileNode",value:function(){if(this.curFrameTime-this.lastFileNodeDestroyTime>=10){for(var e=this.rootMrbsFiles.length,t=0;t0;){var a=r.pop();a.maxLoadedLevel<=a.fileNode.level?i=!1:a.children.length>0?a.children.forEach((function(e){var a=n.sceneNodeTree[e.file];void 0===a||void 0===a.lods||a.level>=n.maxShowLevel?i=!1:2===a.state?t.push(a):a.lods.forEach((function(e){r.push(e)}))})):i=!1}return i}},{key:"InformChildrenHaveParentLoading",value:function(e,t){var n=this,i=this.sceneNodeTree[e];if(void 0===i||void 0===i.lods||i.level>=this.maxShowLevel)return!1;var r=!0;return 2===i.state?(t.push(i),r=!0):i.lods.forEach((function(e){n.InformChildrenLodLoading(e,t)||(r=!1)})),r}},{key:"CheckLodIsInFrustum",value:function(e){var t={center:e.center,radius:2*e.radius};return this.frustum.containsPoint(e.center)||this.frustum.intersectsSphere(t)}},{key:"CheckLodIsInFrustumTruly",value:function(e){var t={center:e.center,radius:1.5*e.radius};return this.frustum.containsPoint(e.center)||this.frustum.intersectsSphere(t)}},{key:"CancelLoadingTask",value:function(e){var t=this.sceneNodeTree[e];t.state=3,t.checkedChildLoad=!1,this.loaderManager.loadingTasks[e]=void 0}},{key:"GetFilePriority",value:function(e,t,n){var i=this.sceneNodeTree[e];if(!this.bFixedCamera&&(0===i.level||0===t))return 0;var r=Number.MAX_VALUE;if(!n)//!treeFileNode.totalRefChildNum || treeFileNode.totalRefChildNum < parent_file_ref_child_filenode_limit) {for(var a=!1,o=i.lods.length,s=0;sTg.max.x&&(Tg.max.x=t.max.x),t.max.y>Tg.max.y&&(Tg.max.y=t.max.y),t.max.z>Tg.max.z&&(Tg.max.z=t.max.z)})),n=Tg.getCenter(new at)}this.root.rotateX(-Math.PI/2);var i=Tg;for(var r in this.viewer.isGISViewer?(this.root.position.x-=n.x,this.root.position.y-=n.z,this.root.position.z+=n.y,this.root.position.y=Math.abs(n.z)/2,this.root.updateMatrixWorld(),Tg.applyMatrix4(this.root.matrixWorld),_g=this.root.matrixWorld):(this.root.updateMatrix(),i=Tg.clone().applyMatrix4(this.root.matrix),_g=this.root.matrix),this.isFocus&&this.viewer.fitCamera(this.root,i),setTimeout((function(){t.update()}),1e3),this.viewer.camera.near=1,this.viewer.camera.updateProjectionMatrix(),this.bFixedCamera=!0,this.loaderManager.RefreshLoadFlag(),this.sceneNodeTree){this.sceneNodeTree[r].lods.forEach((function(e){e.center.applyMatrix4(_g)}))}}},{key:"resetGeoCenter",value:function(e){var t=new tn;t.setFromBufferAttribute(e);var n=new at;t.getCenter(n);for(var i=0;ithis.maxLevelAlreadyLoadedForScene&&(this.maxLevelAlreadyLoadedForScene=i.level)}},{key:"setDoubleSide",value:function(e){this.doubeside=e;for(var t=0;t=this.maxShowLevel)){e.state,e.state=1,e.lastActiveTime=this.curFrameTime;var i={};i.chunkIndex=e.chunkIndex,i.level=e.level,i.prioLevel=t,i.level===this.minLevelInxForReplaceShow&&(i.prioLevel=0),i.state=vg,i.file=e.fileName,i.bReplace=!!n,this.loaderManager.AddLoadTask(i)}}},{key:"loadMrbsFile",value:function(e,t){var n=this.sceneNodeTree[e];this.loadMrbsFileByNode(n,t)}},{key:"cancelChildFileLoad",value:function(e){if(!e.checkedChildLoad){e.checkedChildLoad=!0;var t=[];for(e.lods.forEach((function(e){e.children.forEach((function(e){t.push(e.file)}))}));t.length>0;){var n=t.pop(),i=this.sceneNodeTree[n];if(i&&e.level0&&(r.state=yg),i.lods.forEach((function(e){e.children.forEach((function(e){t.push(e.file)}))}))}}}}},{key:"convertArrayBufferToString",value:function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),OA.decodeText(new Uint8Array(e,t,n))}},{key:"isBscbFormatBinary",value:function(e){var t=this.convertArrayBufferToString(e,0,4);return e.byteLength>=4&&"bscb"===t}},{key:"parseTreeFile",value:function(e,t){var n=this;if(this.isBscbFormatBinary(e)){this.rootMrbsFiles=[],this.ChunkRootMrbsFiles=[];var i=new fg(e);i.skip(4),i.getUint32();for(var r=i.getUint32(),a=0;aTg.max.x&&(Tg.max.x=e.center.x+e.radius),e.center.y+e.radius>Tg.max.y&&(Tg.max.y=e.center.y+e.radius),e.center.z+e.radius>Tg.max.z&&(Tg.max.z=e.center.z+e.radius)}}]),e}(),kg=function(){function e(t){s(this,e),void 0===t&&console.error("参数缺少viewer"),this.viewer=t,this.loaders=[],this.largeSceneGroup=this.viewer.modelGroup}return A(e,[{key:"load",value:function(e,t,n,i){var r=!0,a=!1,o=!0,s=0,l=!1;n&&(r=n.focus,a=n.doubeside,null!=n.transparent&&(o=n.transparent),s=n.alphaTest,l=n.isOnline);var A=new Fg(this.viewer,i,this);A.isFocus=r,A.doubeside=a,A.transparent=o,A.alphaTest=s;var c=new zt;return c.path=e,c.isLargeScene=!0,c.loader=A,this.loaders.push(A),c.add(A.root),this.largeSceneGroup.add(c),l?A.load(e+"/conf.mrcb",(function(){t&&t(c)})):A.loadConfig(e+"/confJson.json",(function(){A.load(e+"/conf.mrcb",(function(){c.coordinate=A.coordinate,t&&t(c)}))})),c}},{key:"dispose",value:function(){for(var e=this.loaders.length-1;e>=0;e--){this.loaders[e].dispose()}}}]),e}(),Pg=0,Ug=function(e){h(n,e);var t=y(n);function n(e){var i;s(this,n),(i=t.call(this,e)).enabled=!0,i.viewer=e,i.camera=e.camera,i.viewer.camera.controller=v(i),If.isMobile?i.dblClickHandler=function(e){1===e.touches.length&&(e.timeStamp-Pg<250&&this._dblClickHandler(e.touches[0]),Pg=e.timeStamp)}.bind(v(i)):i.dblClickHandler=i._dblClickHandler.bind(v(i)),e.container.addEventListener("dblclick",i.dblClickHandler),e.container.addEventListener("touchstart",i.dblClickHandler),e.container.position="relative";var r=e.containerRect,a=r.width,o=r.height;return(bg=new Image).src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABcJJREFUaEPVWmtoHFUU/s7djdBqG2i6M7Nb8dkiFqu/pBVfVUGR1AeK/SkqrWl3EgWL+qMFWzB/ov6wm9n04QP9VSoKVaMo+EAtKv6yiiK24gM3M7NNIY02YHbnyJ3d2Uwmuzsz+wjNhYXs3nvPOd+5557XDWGJD1ri8qPjAMw31QsTU+VeEj29RE6vVBCzmGJndqrcm5jSHrb+7aTS2gYgBRZnqR+EfsD99IUIOAlgHIxxZyWPtwuoZQDmy+o1iSTpDmMrEVa1olVmnBGEo+USG9qT1o+t0IgN4MzBzCWzs84gEXQAywNMZwD8CuAkAycJeMY1IWCEgLWofNYBWBbYd44ZRk+PGF01UPgzDpBYAOy89hAY+wFoPia/EHDMcZx31SH7uPf7RE7bnBD4TH4vO7gtPWR+7s1ZOeVGIcS9DNwH4CofLROEJ5Ss+VZUEJEBVIU/6iM8A9Cwok8M12PWDIB/fdHQdjFhFxjp2u+ErVFBRAJQzKd3MPOYx4DBxxzQcFo3v2ukqagA5H4zp14uiHahYpbuIKKdqezEgbCTCAVQNLTnGNjrE/6wqluPhxGOA8CjVcynn2Lml2oggL0p3dzXjFdTAEHhQXhMyZqvhwkv51sBUD2NDULQiaggGgKw89qjYLzmEQpexDAQrQKQdCf3r7m4nCj/5bsTDRVXF4B0laWS863nbYh4eyprvRImtH/eNlJrgYR0qdIPrVP04slY+ysez3MaZjIpNtZzsXUBWKPaCBGerlwmjKWyZjYOc2/t5AFtvfy7b4f5Uyv77VFt1LvYzHhBHTTduOIfCwDICCuSJLUvg9RZAdq0Wp/4uRUB2t3jeqcEHa+62HNOiTcGI/YCAEVDG2NgR4U5Dyu6taddQdrZ78YJ4EXXGoADKd3c2fAECgczyxMl53cCUgCmS0wbMoMTf7QjQCf22oZ2CsAVDBTLSXFZZqBwzuel5lgU81o/M953dQ+O5O87IWAYDWtUPUhEbuwhwpZU1hyvC8AyNIMA98IKh+9YPWR9GkZ8MeYtI3MnwfmooljkVd2ci9h+ASxDs6vmU1B0c81iCBeVh21o0myWSTNSdVNZcAJuYTJN/7gThC+VrHlLVOKLsc42tO8BXCt5OSv4Iq8QqnmhYm51hkXy74rzwRvKoPlIO4IVx9QtThn3uOaYwHupnZZ7t1odtqG9DeABV79OaU1q6HShouvqOG2kr3bAbsBhYJ9wUMvfvTUlABf0wA4LTDLfJyG+8gvLjnOTv16oB0QGvv9mUTMP/xohcLdXIAnQei821QBM5tVNZaavo2moeWqwIAmsaKppZjk/9WguRYL4hr6s9c28E1jyAAImNOI4+LCeHhbLhJIJaclzw2Fslqfo3ql6JjTvEgPvKLr5YDRzqr+qC5dY1iGuY6l7iee5UeCEopvXtQOg03ttQ/sCwM0N3aic8AWyGUU3gy2TTssUi55taNLFZxoGsiqAWirBEHepeuHjWFy6tPh0Tr3dEfRJ1cU3TiXmJXPMh9RBa6BLMsUiaxnqIQJtd+2/WTIXSKd/U3TzylicurC4MJq+NEn8A4AVoem05D+/oKE9jRpXXZC1LknbUJ8HaHc1aDUvaOSiQEk5UwZubdbA6iaQamySEXclgGglpXuZfUW97MKpunV/K4K2W9QX81qeGW4JGbmol4uDbRUGnlV1cyQOiHbbKsW8uo2ZDld5xmuryE3BxhYY/cqg+UFUEO00tvx7XX5NOoLxWovgbYpuvRoFRKsAgooLy2JjN3fDCHrgWgHg9/dVr9Nec9cTJthel906Yso1a3jFATBhaNcL8G4CyQePitV0qr3uEazzwHEW4FyJxeF6vaOoAGwjvRtg6efnnp06/cARABF8Yppm8JGEgyP+Nsx598TkgQh55JOFtuyinWJAdvjcAuS8eeTze58l+8wadKFL9qG7USxYcv9qECWodXNNaCDrJvNO0P4fGKofXnAvUzAAAAAASUVORK5CYII=",bg.style.position="absolute",bg.style.width="30px",bg.style.height="30px",bg.style.top=o/2-15+"px",bg.style.left=a/2-15+"px",bg.style.display="none",(Mg=new Image).src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD8AAAAwCAYAAACmCaIKAAAAAXNSR0IArs4c6QAAAT5JREFUaEPtWsENwjAMvFuHXeAHI/BjBmAFeMEK/GAoxjCKKKgfmrqiVpRcX0i9ND2f7ZrYBAAzOwHYpd8jrw3J20js7DAz2wK4ODZ6kFzRzO4AlgAOYxeTPI7FRuHMbO/YK3E9J/KWiJdIyEHGBe0MdRB5KV9gHLt82QGW26c8p4SnbF/et9sRxi6oYr4X80WVqy4ZJ4A/5TAnrK1michXI6WTiJR3GqwauJSvRkonkVDlzWwNYDHwjk+SVyeHyfBo8unUaPAiGfZOYRslxkP/IL/1tsjn/OM/96X8f+yYf4rc/sfBiWL+bZiwUAzbqJftm/3UtVvk5FNiLCLU7WOp5XcT+byN6kRI+Tp1zbNqW/mu3m6zaaEurbq06tLmU2QFCLWoNZaiIURNYBY3TztXbu0nvHYHj7uztSZHzl/kIiMOWht+IQAAAABJRU5ErkJggg==",Mg.style.position="absolute",Mg.style.width="30px",Mg.style.height="30px",Mg.style.top=o/2-15+"px",Mg.style.left=a/2-15+"px",Mg.style.display="none",e.container.appendChild(bg),e.container.appendChild(Mg),e.container.addEventListener(If.isMobile?"touchstart":"mousedown",(function(e){i.enabled&&(0===e.button||e.touches&&1===e.touches.length)&&(Cg&&clearTimeout(Cg),Cg=setTimeout((function(){bg.style.display="block"}),200))})),e.container.addEventListener(If.isMobile?"touchend":"mouseup",(function(e){i.enabled&&(0===e.button||e.touches)&&(Cg&&(clearTimeout(Cg),Cg=null),bg.style.display="none")})),window.addEventListener("resize",(function(){if(i.enabled){var e=i.viewer.container.getBoundingClientRect(),t=e.width,n=e.height;bg.style.top=n/2+"px",bg.style.left=t/2+"px"}})),i}return A(n,[{key:"update",value:function(){this.enabled&&this._update()}},{key:"_dblClickHandler",value:function(e){var t=this;if(this.enabled){var n=M(this.viewer.picker.rayIntersect(e),1)[0];if(n){var i=n.point,r=this.viewer.picker.vectorToScreen(i),a=(new at).subVectors(this.camera.position,this.target);a=(new at).addScaledVector(a,.8);var o=(new at).addVectors(i,a);this.tween&&this.tween.stop();var s={tx:this.target.x,ty:this.target.y,tz:this.target.z,px:this.camera.position.x,py:this.camera.position.y,pz:this.camera.position.z,cx:r.x-15,cy:r.y-15};this.tween=new ud.Tween(s).to({tx:i.x,ty:i.y,tz:i.z,px:o.x,py:o.y,pz:o.z,cx:this.viewer.containerRect.width/2-15,cy:this.viewer.containerRect.height/2-15},1e3).onUpdate((function(){t.target.set(s.tx,s.ty,s.tz),t.camera.position.set(s.px,s.py,s.pz),Mg.style.top=s.cy+"px",Mg.style.left=s.cx+"px"})).easing(ud.Easing.Cubic.InOut).onComplete((function(){Mg.style.display="none"})).repeat(0).start(),Mg.style.display="block"}}}},{key:"setPosition",value:function(e,t,n){this.object.position.set(e,t,n),this.dispatchEvent("change")}},{key:"setTarget",value:function(e,t,n){this.target.set(e,t,n),this.dispatchEvent("change")}}]),n}(yp),Dg=function(){function e(t,n,i,r){var a=this,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:50,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:50;s(this,e),this.viewer=t,this.camera=new FA(i/-2,i/2,r/2,r/-2,.1,1e3),this.camera.position.set(0,0,1),this.bottom=o,this.left=l;var A=(new tA).load(n,(function(){A.wrapT=A.wrapS=V,A.repeat.multiplyScalar(.994),a.planeWidth=176,a.planeHeight=60;var e=new $i(a.planeWidth,a.planeHeight);a.plane=new Ei(e,new Nn({map:A,transparent:!0})),a.fitCamera(),a.camera.position.y=-r/2+a.bottom+a.planeHeight/2,a.camera.position.x=-i/2+a.left}));this.viewer.renderManager.getRenderer().autoClear=!1,this.viewer.renderManager.addBeforeRenderTask((function(e,t,n){a.onBeforeRender(e,t,n)})),this.viewer.renderManager.addAfterRenderTask((function(e,t,n){a.onAfterRender(e,t,n)}))}return A(e,[{key:"onBeforeRender",value:function(e,t,n){this.viewer.renderManager.getRenderer().clear(),this.plane&&e.domElement.width/e.domElement.height!==this.camera.aspect&&this.onResize(e.domElement.width,e.domElement.height)}},{key:"onAfterRender",value:function(){this.plane&&this.viewer.renderManager.getRenderer().render(this.plane,this.camera)}},{key:"fitCamera",value:function(){var e,t=(new tn).setFromObject(this.plane).getSize(new at),n=this.planeWidth/t.x,i=this.planeHeight/t.y;t.x>=t.y?(e=n)*t.y>this.planeHeight&&(e=i):(e=i)*t.x>this.planeWidth&&(e=n),this.camera.zoom=e,this.camera.updateProjectionMatrix()}},{key:"onResize",value:function(e,t){this.camera.aspect=e/t,this.camera.left=e/-2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=t/-2,this.camera.updateProjectionMatrix(),this.camera.position.y=-t/2+this.bottom+this.planeHeight/2,this.camera.position.x=e/2-this.left-this.planeWidth/2}}]),e}(),Rg=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(this,n),(i=t.call(this,e,r))._hotSpotManager=null,i._effectManager=null,i._largeSceneLoader=null,i._largeSceneLoader2=null,i._largeSceneControls=null,i._controls=null,i}return A(n,[{key:"hotSpotManager",get:function(){return this._hotSpotManager||(this._hotSpotManager=new ev(this)),this._hotSpotManager}},{key:"effectManager",get:function(){return this._effectManager||(this._effectManager=new Xv(this)),this._effectManager}},{key:"largeSceneLoader",get:function(){return this._largeSceneLoader||(this._largeSceneLoader=new dg(this)),this._largeSceneLoader}},{key:"largeSceneLoader2",get:function(){return this._largeSceneLoader2||(this._largeSceneLoader2=new kg(this)),this._largeSceneLoader2}},{key:"enableLargeSceneControls",get:function(){return this._enableLargeSceneControls||!1},set:function(e){e!=this._enableLargeSceneControls&&(e?(this._controls=this.controls,this._controls.enabled=!1,this._largeSceneControls||(this._largeSceneControls=new Ug(this),this.renderManager.addAfterRenderTask(this._largeSceneControls.update.bind(this._largeSceneControls))),this._largeSceneControls.enabled=!0,this.controls=this._largeSceneControls):(this.controls=this._controls,this._controls.enabled=!0,this._largeSceneControls.enabled=!1))}},{key:"addWatermark",value:function(e){new Dg(this,e,this.containerRect.width,this.containerRect.height)}}]),n}(Xm);var Og=6378137,Ng=.0066943799901413165,zg=484813681109536e-20,Qg=Math.PI/2,Gg=1e-10,Hg=.017453292519943295,Vg=57.29577951308232,jg=Math.PI/4,Wg=2*Math.PI,Xg=3.14159265359,Yg={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},Kg={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},Zg=/[\s_\-\/\(\)]/g;function Jg(e,t){if(e[t])return e[t];for(var n,i=Object.keys(e),r=t.toLowerCase().replace(Zg,""),a=-1;++a=this.text.length)return;e=this.text[this.place++]}switch(this.state){case 1:return this.neutral(e);case 2:return this.keyword(e);case 4:return this.quoted(e);case 5:return this.afterquote(e);case 3:return this.number(e);case-1:return}},ry.prototype.afterquote=function(e){if('"'===e)return this.word+='"',void(this.state=4);if(ny.test(e))return this.word=this.word.trim(),void this.afterItem(e);throw new Error("havn't handled \""+e+'" in afterquote yet, index '+this.place)},ry.prototype.afterItem=function(e){return","===e?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===e?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},ry.prototype.number=function(e){if(!iy.test(e)){if(ny.test(e))return this.word=parseFloat(this.word),void this.afterItem(e);throw new Error("havn't handled \""+e+'" in number yet, index '+this.place)}this.word+=e},ry.prototype.quoted=function(e){'"'!==e?this.word+=e:this.state=5},ry.prototype.keyword=function(e){if(ty.test(e))this.word+=e;else{if("["===e){var t=[];return t.push(this.word),this.level++,null===this.root?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,void(this.state=1)}if(!ny.test(e))throw new Error("havn't handled \""+e+'" in keyword yet, index '+this.place);this.afterItem(e)}},ry.prototype.neutral=function(e){if(ey.test(e))return this.word=e,void(this.state=2);if('"'===e)return this.word="",void(this.state=4);if(iy.test(e))return this.word=e,void(this.state=3);if(!ny.test(e))throw new Error("havn't handled \""+e+'" in neutral yet, index '+this.place);this.afterItem(e)},ry.prototype.output=function(){for(;this.place0?90:-90),e.lat_ts=e.lat1)}(r),r}function Ay(e){var t=this;if(2===arguments.length){var n=arguments[1];"string"==typeof n?"+"===n.charAt(0)?Ay[e]=qg(arguments[1]):Ay[e]=ly(arguments[1]):Ay[e]=n}else if(1===arguments.length){if(Array.isArray(e))return e.map((function(e){Array.isArray(e)?Ay.apply(t,e):Ay(e)}));if("string"==typeof e){if(e in Ay)return Ay[e]}else"EPSG"in e?Ay["EPSG:"+e.EPSG]=e:"ESRI"in e?Ay["ESRI:"+e.ESRI]=e:"IAU2000"in e?Ay["IAU2000:"+e.IAU2000]=e:console.log(e);return}}!function(e){e("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),e("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),e("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),e.WGS84=e["EPSG:4326"],e["EPSG:3785"]=e["EPSG:3857"],e.GOOGLE=e["EPSG:3857"],e["EPSG:900913"]=e["EPSG:3857"],e["EPSG:102113"]=e["EPSG:3857"]}(Ay);var cy=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var hy=["3857","900913","3785","102113"];function uy(e){if(!function(e){return"string"==typeof e}(e))return e;if(function(e){return e in Ay}(e))return Ay[e];if(function(e){return cy.some((function(t){return e.indexOf(t)>-1}))}(e)){var t=ly(e);if(function(e){var t=Jg(e,"authority");if(t){var n=Jg(t,"epsg");return n&&hy.indexOf(n)>-1}}(t))return Ay["EPSG:3857"];var n=function(e){var t=Jg(e,"extension");if(t)return Jg(t,"proj4")}(t);return n?qg(n):t}return function(e){return"+"===e[0]}(e)?qg(e):void 0}function dy(e,t){var n,i;if(e=e||{},!t)return e;for(i in t)void 0!==(n=t[i])&&(e[i]=n);return e}function fy(e,t,n){var i=e*t;return n/Math.sqrt(1-i*i)}function py(e){return e<0?-1:1}function my(e){return Math.abs(e)<=Xg?e:e-py(e)*Wg}function vy(e,t,n){var i=e*n,r=.5*e;return i=Math.pow((1-i)/(1+i),r),Math.tan(.5*(Qg-t))/i}function gy(e,t){for(var n,i,r=.5*e,a=Qg-2*Math.atan(t),o=0;o<=15;o++)if(n=e*Math.sin(a),a+=i=Qg-2*Math.atan(t*Math.pow((1-n)/(1+n),r))-a,Math.abs(i)<=1e-10)return a;return-9999}function yy(e){return e}var wy=[{init:function(){var e=this.b/this.a;this.es=1-e*e,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=fy(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(e){var t,n,i=e.x,r=e.y;if(r*Vg>90&&r*Vg<-90&&i*Vg>180&&i*Vg<-180)return null;if(Math.abs(Math.abs(r)-Qg)<=Gg)return null;if(this.sphere)t=this.x0+this.a*this.k0*my(i-this.long0),n=this.y0+this.a*this.k0*Math.log(Math.tan(jg+.5*r));else{var a=Math.sin(r),o=vy(this.e,r,a);t=this.x0+this.a*this.k0*my(i-this.long0),n=this.y0-this.a*this.k0*Math.log(o)}return e.x=t,e.y=n,e},inverse:function(e){var t,n,i=e.x-this.x0,r=e.y-this.y0;if(this.sphere)n=Qg-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var a=Math.exp(-r/(this.a*this.k0));if(-9999===(n=gy(this.e,a)))return null}return t=my(this.long0+i/(this.a*this.k0)),e.x=t,e.y=n,e},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:yy,inverse:yy,names:["longlat","identity"]}],xy={},by=[];function My(e,t){var n=by.length;return e.names?(by[n]=e,e.names.forEach((function(e){xy[e.toLowerCase()]=n})),this):(console.log(t),!0)}var Cy={start:function(){wy.forEach(My)},add:My,get:function(e){if(!e)return!1;var t=e.toLowerCase();return void 0!==xy[t]&&by[xy[t]]?by[xy[t]]:void 0}},By={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},Ey=By.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};By.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var Sy={};Sy.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Sy.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Sy.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Sy.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Sy.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Sy.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Sy.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Sy.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},Sy.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Sy.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Sy.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Sy.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Sy.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Sy.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Sy.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Sy.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Sy.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var Ty={};function _y(e){if(0===e.length)return null;var t="@"===e[0];return t&&(e=e.slice(1)),"null"===e?{name:"null",mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:Ty[e]||null,isNull:!1}}function Iy(e){return e/3600*Math.PI/180}function Ly(e,t,n){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,n)))}function Fy(e){return e.map((function(e){return[Iy(e.longitudeShift),Iy(e.latitudeShift)]}))}function ky(e,t,n){return{name:Ly(e,t+8,t+16).trim(),parent:Ly(e,t+24,t+24+8).trim(),lowerLatitude:e.getFloat64(t+72,n),upperLatitude:e.getFloat64(t+88,n),lowerLongitude:e.getFloat64(t+104,n),upperLongitude:e.getFloat64(t+120,n),latitudeInterval:e.getFloat64(t+136,n),longitudeInterval:e.getFloat64(t+152,n),gridNodeCount:e.getInt32(t+168,n)}}function Py(e,t,n,i){for(var r=t+176,a=[],o=0;o3&&(0===s.datum_params[3]&&0===s.datum_params[4]&&0===s.datum_params[5]&&0===s.datum_params[6]||(s.datum_type=2,s.datum_params[3]*=zg,s.datum_params[4]*=zg,s.datum_params[5]*=zg,s.datum_params[6]=s.datum_params[6]/1e6+1))),o&&(s.datum_type=3,s.grids=o),s.a=n,s.b=i,s.es=r,s.ep2=a,s}(n.datumCode,n.datum_params,a.a,a.b,o.es,o.ep2,s);dy(this,n),dy(this,i),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=l,this.init(),t(null,this)}else t(e)}else t(e)}function Dy(e,t,n){var i,r,a,o,s=e.x,l=e.y,A=e.z?e.z:0;if(l<-Qg&&l>-1.001*Qg)l=-Qg;else if(l>Qg&&l<1.001*Qg)l=Qg;else{if(l<-Qg)return{x:-1/0,y:-1/0,z:e.z};if(l>Qg)return{x:1/0,y:1/0,z:e.z}}return s>Math.PI&&(s-=2*Math.PI),r=Math.sin(l),o=Math.cos(l),a=r*r,{x:((i=n/Math.sqrt(1-t*a))+A)*o*Math.cos(s),y:(i+A)*o*Math.sin(s),z:(i*(1-t)+A)*r}}function Ry(e,t,n,i){var r,a,o,s,l,A,c,h,u,d,f,p,m,v,g,y=1e-12,w=e.x,x=e.y,b=e.z?e.z:0;if(r=Math.sqrt(w*w+x*x),a=Math.sqrt(w*w+x*x+b*b),r/n1e-24&&m<30);return{x:v,y:Math.atan(f/Math.abs(d)),z:g}}function Oy(e){return 1===e||2===e}function Ny(e,t,n){if(function(e,t){return e.datum_type===t.datum_type&&!(e.a!==t.a||Math.abs(e.es-t.es)>5e-11)&&(1===e.datum_type?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:2!==e.datum_type||e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6])}(e,t))return n;if(5===e.datum_type||5===t.datum_type)return n;var i=e.a,r=e.es;if(3===e.datum_type){if(0!==zy(e,!1,n))return;i=Og,r=Ng}var a=t.a,o=t.b,s=t.es;if(3===t.datum_type&&(a=Og,o=6356752.314,s=Ng),r===s&&i===a&&!Oy(e.datum_type)&&!Oy(t.datum_type))return n;if((n=Dy(n,r,i),Oy(e.datum_type)&&(n=function(e,t,n){if(1===t)return{x:e.x+n[0],y:e.y+n[1],z:e.z+n[2]};if(2===t){var i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],A=n[6];return{x:A*(e.x-l*e.y+s*e.z)+i,y:A*(l*e.x+e.y-o*e.z)+r,z:A*(-s*e.x+o*e.y+e.z)+a}}}(n,e.datum_type,e.datum_params)),Oy(t.datum_type)&&(n=function(e,t,n){if(1===t)return{x:e.x-n[0],y:e.y-n[1],z:e.z-n[2]};if(2===t){var i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],A=n[6],c=(e.x-i)/A,h=(e.y-r)/A,u=(e.z-a)/A;return{x:c+l*h-s*u,y:-l*c+h+o*u,z:s*c-o*h+u}}}(n,t.datum_type,t.datum_params)),n=Ry(n,s,a,o),3===t.datum_type)&&0!==zy(t,!0,n))return;return n}function zy(e,t,n){if(null===e.grids||0===e.grids.length)return console.log("Grid shift grids not found"),-1;for(var i={x:-n.x,y:n.y},r={x:Number.NaN,y:Number.NaN},a=[],o=0;oi.y||c>i.x||d1e-12&&Math.abs(o.y)>1e-12);if(l<0)return console.log("Inverse grid shift iterator failed to converge."),i;i.x=my(a.x+n.ll[0]),i.y=a.y+n.ll[1]}else isNaN(a.x)||(i.x=e.x+a.x,i.y=e.y+a.y);return i}function Gy(e,t){var n,i={x:e.x/t.del[0],y:e.y/t.del[1]},r=Math.floor(i.x),a=Math.floor(i.y),o=i.x-1*r,s=i.y-1*a,l={x:Number.NaN,y:Number.NaN};if(r<0||r>=t.lim[0])return l;if(a<0||a>=t.lim[1])return l;n=a*t.lim[0]+r;var A=t.cvs[n][0],c=t.cvs[n][1];n++;var h=t.cvs[n][0],u=t.cvs[n][1];n+=t.lim[0];var d=t.cvs[n][0],f=t.cvs[n][1];n--;var p=t.cvs[n][0],m=t.cvs[n][1],v=o*s,g=o*(1-s),y=(1-o)*(1-s),w=(1-o)*s;return l.x=y*A+g*h+w*p+v*d,l.y=y*c+g*u+w*m+v*f,l}function Hy(e,t,n){var i,r,a,o=n.x,s=n.y,l=n.z||0,A={};for(a=0;a<3;a++)if(!t||2!==a||void 0!==n.z)switch(0===a?(i=o,r=-1!=="ew".indexOf(e.axis[a])?"x":"y"):1===a?(i=s,r=-1!=="ns".indexOf(e.axis[a])?"y":"x"):(i=l,r="z"),e.axis[a]){case"e":case"n":A[r]=i;break;case"w":case"s":A[r]=-i;break;case"u":void 0!==n[r]&&(A.z=i);break;case"d":void 0!==n[r]&&(A.z=-i);break;default:return null}return A}function Vy(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function jy(e){if("function"==typeof Number.isFinite){if(Number.isFinite(e))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof e||e!=e||!isFinite(e))throw new TypeError("coordinates must be finite numbers")}function Wy(e,t,n,i){var r;if(Array.isArray(n)&&(n=Vy(n)),function(e){jy(e.x),jy(e.y)}(n),e.datum&&t.datum&&function(e,t){return(1===e.datum.datum_type||2===e.datum.datum_type)&&"WGS84"!==t.datumCode||(1===t.datum.datum_type||2===t.datum.datum_type)&&"WGS84"!==e.datumCode}(e,t)&&(n=Wy(e,r=new Uy("WGS84"),n,i),e=r),i&&"enu"!==e.axis&&(n=Hy(e,!1,n)),"longlat"===e.projName)n={x:n.x*Hg,y:n.y*Hg,z:n.z||0};else if(e.to_meter&&(n={x:n.x*e.to_meter,y:n.y*e.to_meter,z:n.z||0}),!(n=e.inverse(n)))return;if(e.from_greenwich&&(n.x+=e.from_greenwich),n=Ny(e.datum,t.datum,n))return t.from_greenwich&&(n={x:n.x-t.from_greenwich,y:n.y,z:n.z||0}),"longlat"===t.projName?n={x:n.x*Vg,y:n.y*Vg,z:n.z||0}:(n=t.forward(n),t.to_meter&&(n={x:n.x/t.to_meter,y:n.y/t.to_meter,z:n.z||0})),i&&"enu"!==t.axis?Hy(t,!0,n):n}Uy.projections=Cy,Uy.projections.start();var Xy=Uy("WGS84");function Yy(e,t,n,i){var r,a,o;return Array.isArray(n)?(r=Wy(e,t,n,i)||{x:NaN,y:NaN},n.length>2?void 0!==e.name&&"geocent"===e.name||void 0!==t.name&&"geocent"===t.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(n.splice(3)):[r.x,r.y,n[2]].concat(n.splice(3)):[r.x,r.y].concat(n.splice(2)):[r.x,r.y]):(a=Wy(e,t,n,i),2===(o=Object.keys(n)).length||o.forEach((function(i){if(void 0!==e.name&&"geocent"===e.name||void 0!==t.name&&"geocent"===t.name){if("x"===i||"y"===i||"z"===i)return}else if("x"===i||"y"===i)return;a[i]=n[i]})),a)}function Ky(e){return e instanceof Uy?e:e.oProj?e.oProj:Uy(e)}function Zy(e,t,n){e=Ky(e);var i,r=!1;return void 0===t?(t=e,e=Xy,r=!0):(void 0!==t.x||Array.isArray(t))&&(n=t,t=e,e=Xy,r=!0),t=Ky(t),n?Yy(e,t,n):(i={forward:function(n,i){return Yy(e,t,n,i)},inverse:function(n,i){return Yy(t,e,n,i)}},r&&(i.oProj=t),i)}var Jy="AJSAJS",qy="AFAFAF",$y=65,ew=73,tw=79,nw=86,iw=90,rw={forward:aw,inverse:function(e){var t=Aw(uw(e.toUpperCase()));if(t.lat&&t.lon)return[t.lon,t.lat,t.lon,t.lat];return[t.left,t.bottom,t.right,t.top]},toPoint:ow};function aw(e,t){return t=t||5,function(e,t){var n="00000"+e.easting,i="00000"+e.northing;return e.zoneNumber+e.zoneLetter+(r=e.easting,a=e.northing,o=e.zoneNumber,s=hw(o),l=Math.floor(r/1e5),A=Math.floor(a/1e5)%20,function(e,t,n){var i=n-1,r=Jy.charCodeAt(i),a=qy.charCodeAt(i),o=r+e-1,s=a+t,l=!1;return o>iw&&(o=o-iw+$y-1,l=!0),(o===ew||rew||(o>ew||rtw||(o>tw||riw&&(o=o-iw+$y-1),s>nw?(s=s-nw+$y-1,l=!0):l=!1,(s===ew||aew||(s>ew||atw||(s>tw||anw&&(s=s-nw+$y-1),String.fromCharCode(o)+String.fromCharCode(s)}(l,A,s))+n.substr(n.length-5,t)+i.substr(i.length-5,t);var r,a,o,s,l,A}(function(e){var t,n,i,r,a,o,s,l,A=e.lat,c=e.lon,h=6378137,u=.00669438,d=.9996,f=sw(A),p=sw(c);l=Math.floor((c+180)/6)+1,180===c&&(l=60);A>=56&&A<64&&c>=3&&c<12&&(l=32);A>=72&&A<84&&(c>=0&&c<9?l=31:c>=9&&c<21?l=33:c>=21&&c<33?l=35:c>=33&&c<42&&(l=37));s=sw(6*(l-1)-180+3),t=u/(1-u),n=h/Math.sqrt(1-u*Math.sin(f)*Math.sin(f)),i=Math.tan(f)*Math.tan(f),r=t*Math.cos(f)*Math.cos(f),a=Math.cos(f)*(p-s),o=h*((1-u/4-3*u*u/64-5*u*u*u/256)*f-(3*u/8+3*u*u/32+45*u*u*u/1024)*Math.sin(2*f)+(15*u*u/256+45*u*u*u/1024)*Math.sin(4*f)-35*u*u*u/3072*Math.sin(6*f));var m=d*n*(a+(1-i+r)*a*a*a/6+(5-18*i+i*i+72*r-58*t)*a*a*a*a*a/120)+5e5,v=d*(o+n*Math.tan(f)*(a*a/2+(5-i+9*r+4*r*r)*a*a*a*a/24+(61-58*i+i*i+600*r-330*t)*a*a*a*a*a*a/720));A<0&&(v+=1e7);return{northing:Math.round(v),easting:Math.round(m),zoneNumber:l,zoneLetter:cw(A)}}({lat:e[1],lon:e[0]}),t)}function ow(e){var t=Aw(uw(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function sw(e){return e*(Math.PI/180)}function lw(e){return e/Math.PI*180}function Aw(e){var t=e.northing,n=e.easting,i=e.zoneLetter,r=e.zoneNumber;if(r<0||r>60)return null;var a,o,s,l,A,c,h,u,d,f=.9996,p=6378137,m=.00669438,v=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),g=n-5e5,y=t;i<"N"&&(y-=1e7),h=6*(r-1)-180+3,a=.006739496752268451,d=(u=y/f/6367449.145945056)+(3*v/2-27*v*v*v/32)*Math.sin(2*u)+(21*v*v/16-55*v*v*v*v/32)*Math.sin(4*u)+151*v*v*v/96*Math.sin(6*u),o=p/Math.sqrt(1-m*Math.sin(d)*Math.sin(d)),s=Math.tan(d)*Math.tan(d),l=a*Math.cos(d)*Math.cos(d),A=.99330562*p/Math.pow(1-m*Math.sin(d)*Math.sin(d),1.5),c=g/(o*f);var w=d-o*Math.tan(d)/A*(c*c/2-(5+3*s+10*l-4*l*l-9*a)*c*c*c*c/24+(61+90*s+298*l+45*s*s-1.6983531815716497-3*l*l)*c*c*c*c*c*c/720);w=lw(w);var x,b=(c-(1+2*s+l)*c*c*c/6+(5-2*l+28*s-3*l*l+8*a+24*s*s)*c*c*c*c*c/120)/Math.cos(d);if(b=h+lw(b),e.accuracy){var M=Aw({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});x={top:M.lat,right:M.lon,bottom:w,left:b}}else x={lat:w,lon:b};return x}function cw(e){var t="Z";return 84>=e&&e>=72?t="X":72>e&&e>=64?t="W":64>e&&e>=56?t="V":56>e&&e>=48?t="U":48>e&&e>=40?t="T":40>e&&e>=32?t="S":32>e&&e>=24?t="R":24>e&&e>=16?t="Q":16>e&&e>=8?t="P":8>e&&e>=0?t="N":0>e&&e>=-8?t="M":-8>e&&e>=-16?t="L":-16>e&&e>=-24?t="K":-24>e&&e>=-32?t="J":-32>e&&e>=-40?t="H":-40>e&&e>=-48?t="G":-48>e&&e>=-56?t="F":-56>e&&e>=-64?t="E":-64>e&&e>=-72?t="D":-72>e&&e>=-80&&(t="C"),t}function hw(e){var t=e%6;return 0===t&&(t=6),t}function uw(e){if(e&&0===e.length)throw"MGRSPoint coverting from nothing";for(var t,n=e.length,i=null,r="",a=0;!/[A-Z]/.test(t=e.charAt(a));){if(a>=2)throw"MGRSPoint bad conversion from: "+e;r+=t,a++}var o=parseInt(r,10);if(0===a||a+3>n)throw"MGRSPoint bad conversion from: "+e;var s=e.charAt(a++);if(s<="A"||"B"===s||"Y"===s||s>="Z"||"I"===s||"O"===s)throw"MGRSPoint zone letter "+s+" not handled: "+e;i=e.substring(a,a+=2);for(var l=hw(o),A=function(e,t){var n=Jy.charCodeAt(t-1),i=1e5,r=!1;for(;n!==e.charCodeAt(0);){if(++n===ew&&n++,n===tw&&n++,n>iw){if(r)throw"Bad character: "+e;n=$y,r=!0}i+=1e5}return i}(i.charAt(0),l),c=function(e,t){if(e>"V")throw"MGRSPoint given invalid Northing "+e;var n=qy.charCodeAt(t-1),i=0,r=!1;for(;n!==e.charCodeAt(0);){if(++n===ew&&n++,n===tw&&n++,n>nw){if(r)throw"Bad character: "+e;n=$y,r=!0}i+=1e5}return i}(i.charAt(1),l);c0&&(u=1e5/Math.pow(10,p),d=e.substring(a,a+p),m=parseFloat(d)*u,f=e.substring(a+p),v=parseFloat(f)*u),{easting:m+A,northing:v+c,zoneLetter:s,zoneNumber:o,accuracy:u}}function dw(e){var t;switch(e){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+e}function fw(e,t,n){if(!(this instanceof fw))return new fw(e,t,n);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if("object"==typeof e)this.x=e.x,this.y=e.y,this.z=e.z||0;else if("string"==typeof e&&void 0===t){var i=e.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=e,this.y=t,this.z=n||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}fw.fromMGRS=function(e){return new fw(ow(e))},fw.prototype.toMGRS=function(e){return aw([this.x,this.y],e)};var pw=.046875,mw=.01953125,vw=.01068115234375;function gw(e){var t=[];t[0]=1-e*(.25+e*(pw+e*(mw+e*vw))),t[1]=e*(.75-e*(pw+e*(mw+e*vw)));var n=e*e;return t[2]=n*(.46875-e*(.013020833333333334+.007120768229166667*e)),n*=e,t[3]=n*(.3645833333333333-.005696614583333333*e),t[4]=n*e*.3076171875,t}function yw(e,t,n,i){return n*=t,t*=t,i[0]*e-n*(i[1]+t*(i[2]+t*(i[3]+t*i[4])))}function ww(e,t,n){for(var i=1/(1-t),r=e,a=20;a;--a){var o=Math.sin(r),s=1-t*o*o;if(r-=s=(yw(r,o,Math.cos(r),n)-e)*(s*Math.sqrt(s))*i,Math.abs(s)Gg?Math.tan(a):0,f=Math.pow(d,2),p=Math.pow(f,2);t=1-this.es*Math.pow(s,2),A/=Math.sqrt(t);var m=yw(a,s,l,this.en);n=this.a*(this.k0*A*(1+c/6*(1-f+h+c/20*(5-18*f+p+14*h-58*f*h+c/42*(61+179*p-p*f-479*f)))))+this.x0,i=this.a*(this.k0*(m-this.ml0+s*o*A/2*(1+c/12*(5-f+9*h+4*u+c/30*(61+p-58*f+270*h-330*f*h+c/56*(1385+543*p-p*f-3111*f))))))+this.y0}else{var v=l*Math.sin(o);if(Math.abs(Math.abs(v)-1)=1){if(v-1>Gg)return 93;i=0}else i=Math.acos(i);a<0&&(i=-i),i=this.a*this.k0*(i-this.lat0)+this.y0}return e.x=n,e.y=i,e},inverse:function(e){var t,n,i,r,a=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(this.es)if(n=ww(t=this.ml0+o/this.k0,this.es,this.en),Math.abs(n)Gg?Math.tan(n):0,c=this.ep2*Math.pow(l,2),h=Math.pow(c,2),u=Math.pow(A,2),d=Math.pow(u,2);t=1-this.es*Math.pow(s,2);var f=a*Math.sqrt(t)/this.k0,p=Math.pow(f,2);i=n-(t*=A)*p/(1-this.es)*.5*(1-p/12*(5+3*u-9*c*u+c-4*h-p/30*(61+90*u-252*c*u+45*d+46*c-p/56*(1385+3633*u+4095*d+1574*d*u)))),r=my(this.long0+f*(1-p/6*(1+2*u+c-p/20*(5+28*u+24*d+8*c*u+6*c-p/42*(61+662*u+1320*d+720*d*u))))/l)}else i=Qg*py(o),r=0;else{var m=Math.exp(a/this.k0),v=.5*(m-1/m),g=this.lat0+o/this.k0,y=Math.cos(g);t=Math.sqrt((1-Math.pow(y,2))/(1+Math.pow(v,2))),i=Math.asin(t),o<0&&(i=-i),r=0===v&&0===y?0:my(Math.atan2(v,y)+this.long0)}return e.x=r,e.y=i,e},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function bw(e){var t=Math.exp(e);return t=(t-1/t)/2}function Mw(e,t){e=Math.abs(e),t=Math.abs(t);var n=Math.max(e,t),i=Math.min(e,t)/(n||1);return n*Math.sqrt(1+Math.pow(i,2))}function Cw(e){var t=Math.abs(e);return t=function(e){var t=1+e,n=t-1;return 0===n?e:e*Math.log(t)/n}(t*(1+t/(Mw(1,t)+1))),e<0?-t:t}function Bw(e,t){for(var n,i=2*Math.cos(2*t),r=e.length-1,a=e[r],o=0;--r>=0;)n=i*a-o+e[r],o=a,a=n;return t+n*Math.sin(2*t)}function Ew(e,t,n){for(var i,r,a=Math.sin(t),o=Math.cos(t),s=bw(n),l=function(e){var t=Math.exp(e);return(t+1/t)/2}(n),A=2*o*l,c=-2*a*s,h=e.length-1,u=e[h],d=0,f=0,p=0;--h>=0;)i=f,r=d,u=A*(f=u)-i-c*(d=p)+e[h],p=c*f-r+A*d;return[(A=a*l)*u-(c=o*s)*p,A*p+c*u]}var Sw={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(xw.init.apply(this),this.forward=xw.forward,this.inverse=xw.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),n=t;this.cgb[0]=t*(2+t*(-2/3+t*(t*(116/45+t*(26/45+t*(-2854/675)))-2))),this.cbg[0]=t*(t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))-2),n*=t,this.cgb[1]=n*(7/3+t*(t*(-227/45+t*(2704/315+t*(2323/945)))-1.6)),this.cbg[1]=n*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),n*=t,this.cgb[2]=n*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=n*(-26/15+t*(34/21+t*(1.6+t*(-12686/2835)))),n*=t,this.cgb[3]=n*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=n*(1237/630+t*(t*(-24832/14175)-2.4)),n*=t,this.cgb[4]=n*(4174/315+t*(-144838/6237)),this.cbg[4]=n*(-734/315+t*(109598/31185)),n*=t,this.cgb[5]=n*(601676/22275),this.cbg[5]=n*(444337/155925),n=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+n*(1/4+n*(1/64+n/256))),this.utg[0]=t*(t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))-.5),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=n*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=n*(13/48+t*(t*(557/1440+t*(281/630+t*(-1983433/1935360)))-.6)),n*=t,this.utg[2]=n*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=n*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),n*=t,this.utg[3]=n*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=n*(49561/161280+t*(-179/168+t*(6601661/7257600))),n*=t,this.utg[4]=n*(-4583/161280+t*(108847/3991680)),this.gtu[4]=n*(34729/80640+t*(-3418889/1995840)),n*=t,this.utg[5]=n*(-20648693/638668800),this.gtu[5]=.6650675310896665*n;var i=Bw(this.cbg,this.lat0);this.Zb=-this.Qn*(i+function(e,t){for(var n,i=2*Math.cos(t),r=e.length-1,a=e[r],o=0;--r>=0;)n=i*a-o+e[r],o=a,a=n;return Math.sin(t)*n}(this.gtu,2*i))},forward:function(e){var t=my(e.x-this.long0),n=e.y;n=Bw(this.cbg,n);var i=Math.sin(n),r=Math.cos(n),a=Math.sin(t),o=Math.cos(t);n=Math.atan2(i,o*r),t=Math.atan2(a*r,Mw(i,r*o)),t=Cw(Math.tan(t));var s,l,A=Ew(this.gtu,2*n,2*t);return n+=A[0],t+=A[1],Math.abs(t)<=2.623395162778?(s=this.a*(this.Qn*t)+this.x0,l=this.a*(this.Qn*n+this.Zb)+this.y0):(s=1/0,l=1/0),e.x=s,e.y=l,e},inverse:function(e){var t,n,i=(e.x-this.x0)*(1/this.a),r=(e.y-this.y0)*(1/this.a);if(r=(r-this.Zb)/this.Qn,i/=this.Qn,Math.abs(i)<=2.623395162778){var a=Ew(this.utg,2*r,2*i);r+=a[0],i+=a[1],i=Math.atan(bw(i));var o=Math.sin(r),s=Math.cos(r),l=Math.sin(i),A=Math.cos(i);r=Math.atan2(o*A,Mw(l,A*s)),t=my((i=Math.atan2(l,A*s))+this.long0),n=Bw(this.cgb,r)}else t=1/0,n=1/0;return e.x=t,e.y=n,e},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"]};var Tw={init:function(){var e=function(e,t){if(void 0===e){if((e=Math.floor(30*(my(t)+Math.PI)/Math.PI)+1)<0)return 0;if(e>60)return 60}return e}(this.zone,this.long0);if(void 0===e)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(e)-183)*Hg,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Sw.init.apply(this),this.forward=Sw.forward,this.inverse=Sw.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function _w(e,t){return Math.pow((1-e)/(1+e),t)}var Iw={init:function(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+jg)/(Math.pow(Math.tan(.5*this.lat0+jg),this.C)*_w(this.e*e,this.ratexp))},forward:function(e){var t=e.x,n=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*n+jg),this.C)*_w(this.e*Math.sin(n),this.ratexp))-Qg,e.x=this.C*t,e},inverse:function(e){for(var t=e.x/this.C,n=e.y,i=Math.pow(Math.tan(.5*n+jg)/this.K,1/this.C),r=20;r>0&&(n=2*Math.atan(i*_w(this.e*Math.sin(e.y),-.5*this.e))-Qg,!(Math.abs(n-e.y)<1e-14));--r)e.y=n;return r?(e.x=t,e.y=n,e):null},names:["gauss"]};var Lw={init:function(){Iw.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(e){var t,n,i,r;return e.x=my(e.x-this.long0),Iw.forward.apply(this,[e]),t=Math.sin(e.y),n=Math.cos(e.y),i=Math.cos(e.x),r=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*n*i),e.x=r*n*Math.sin(e.x),e.y=r*(this.cosc0*t-this.sinc0*n*i),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e},inverse:function(e){var t,n,i,r,a;if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,a=Math.sqrt(e.x*e.x+e.y*e.y)){var o=2*Math.atan2(a,this.R2);t=Math.sin(o),n=Math.cos(o),r=Math.asin(n*this.sinc0+e.y*t*this.cosc0/a),i=Math.atan2(e.x*t,a*this.cosc0*n-e.y*this.sinc0*t)}else r=this.phic0,i=0;return e.x=i,e.y=r,Iw.inverse.apply(this,[e]),e.x=my(e.x+this.long0),e},names:["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};var Fw={init:function(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Gg&&(this.k0=.5*(1+py(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=Gg&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Gg&&(this.k0=.5*this.cons*fy(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/vy(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=fy(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-Qg,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(e){var t,n,i,r,a,o,s=e.x,l=e.y,A=Math.sin(l),c=Math.cos(l),h=my(s-this.long0);return Math.abs(Math.abs(s-this.long0)-Math.PI)<=Gg&&Math.abs(l+this.lat0)<=Gg?(e.x=NaN,e.y=NaN,e):this.sphere?(t=2*this.k0/(1+this.sinlat0*A+this.coslat0*c*Math.cos(h)),e.x=this.a*t*c*Math.sin(h)+this.x0,e.y=this.a*t*(this.coslat0*A-this.sinlat0*c*Math.cos(h))+this.y0,e):(n=2*Math.atan(this.ssfn_(l,A,this.e))-Qg,r=Math.cos(n),i=Math.sin(n),Math.abs(this.coslat0)<=Gg?(a=vy(this.e,l*this.con,this.con*A),o=2*this.a*this.k0*a/this.cons,e.x=this.x0+o*Math.sin(s-this.long0),e.y=this.y0-this.con*o*Math.cos(s-this.long0),e):(Math.abs(this.sinlat0)0?my(this.long0+Math.atan2(e.x,-1*e.y)):my(this.long0+Math.atan2(e.x,e.y)):my(this.long0+Math.atan2(e.x*Math.sin(s),o*this.coslat0*Math.cos(s)-e.y*this.sinlat0*Math.sin(s))),e.x=t,e.y=n,e)}if(Math.abs(this.coslat0)<=Gg){if(o<=Gg)return n=this.lat0,t=this.long0,e.x=t,e.y=n,e;e.x*=this.con,e.y*=this.con,i=o*this.cons/(2*this.a*this.k0),n=this.con*gy(this.e,i),t=this.con*my(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else r=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=Gg?a=this.X0:(a=Math.asin(Math.cos(r)*this.sinX0+e.y*Math.sin(r)*this.cosX0/o),t=my(this.long0+Math.atan2(e.x*Math.sin(r),o*this.cosX0*Math.cos(r)-e.y*this.sinX0*Math.sin(r)))),n=-1*gy(this.e,Math.tan(.5*(Qg+a)));return e.x=t,e.y=n,e},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],ssfn_:function(e,t,n){return t*=n,Math.tan(.5*(Qg+e))*Math.pow((1-t)/(1+t),.5*n)}};var kw={init:function(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),n=this.a,i=1/this.rf,r=2*i-Math.pow(i,2),a=this.e=Math.sqrt(r);this.R=this.k0*n*Math.sqrt(1-r)/(1-r*Math.pow(t,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),s=Math.log(Math.tan(Math.PI/4+e/2)),l=Math.log((1+a*t)/(1-a*t));this.K=o-this.alpha*s+this.alpha*a/2*l},forward:function(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),n=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),i=-this.alpha*(t+n)+this.K,r=2*(Math.atan(Math.exp(i))-Math.PI/4),a=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(a))),s=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(a));return e.y=this.R/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))+this.y0,e.x=this.R*o+this.x0,e},inverse:function(e){for(var t=e.x-this.x0,n=e.y-this.y0,i=t/this.R,r=2*(Math.atan(Math.exp(n/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(i)),o=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(r))),s=this.lambda0+o/this.alpha,l=0,A=a,c=-1e3,h=0;Math.abs(A-c)>1e-7;){if(++h>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(A))/2)),c=A,A=2*Math.atan(Math.exp(l))-Math.PI/2}return e.x=s,e.y=A,e},names:["somerc"]},Pw=1e-7;var Uw={init:function(){var e,t,n,i,r,a,o,s,l,A,c,h,u,d=0,f=0,p=0,m=0,v=0,g=0,y=0;this.no_off=(u="object"==typeof(h=this).PROJECTION?Object.keys(h.PROJECTION)[0]:h.PROJECTION,"no_uoff"in h||"no_off"in h||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(u)),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var x=!1;if("rectified_grid_angle"in this&&(x=!0),w&&(y=this.alpha),x&&(d=this.rectified_grid_angle*Hg),w||x)f=this.longc;else if(p=this.long1,v=this.lat1,m=this.long2,g=this.lat2,Math.abs(v-g)<=Pw||(e=Math.abs(v))<=Pw||Math.abs(e-Qg)<=Pw||Math.abs(Math.abs(this.lat0)-Qg)<=Pw||Math.abs(Math.abs(g)-Qg)<=Pw)throw new Error;var b=1-this.es;t=Math.sqrt(b),Math.abs(this.lat0)>Gg?(s=Math.sin(this.lat0),n=Math.cos(this.lat0),e=1-this.es*s*s,this.B=n*n,this.B=Math.sqrt(1+this.es*this.B*this.B/b),this.A=this.B*this.k0*t/e,(r=(i=this.B*t/(n*Math.sqrt(e)))*i-1)<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=i,this.E*=Math.pow(vy(this.e,this.lat0,s),this.B)):(this.B=1/t,this.A=this.k0,this.E=i=r=1),w||x?(w?(c=Math.asin(Math.sin(y)/i),x||(d=y)):(c=d,y=Math.asin(i*Math.sin(c))),this.lam0=f-Math.asin(.5*(r-1/r)*Math.tan(c))/this.B):(a=Math.pow(vy(this.e,v,Math.sin(v)),this.B),o=Math.pow(vy(this.e,g,Math.sin(g)),this.B),r=this.E/a,l=(o-a)/(o+a),A=((A=this.E*this.E)-o*a)/(A+o*a),(e=p-m)<-Math.pi?m-=Wg:e>Math.pi&&(m+=Wg),this.lam0=my(.5*(p+m)-Math.atan(A*Math.tan(.5*this.B*(p-m))/l)/this.B),c=Math.atan(2*Math.sin(this.B*my(p-this.lam0))/(r-1/r)),d=y=Math.asin(i*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(d),this.cosrot=Math.cos(d),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.A,this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(y))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(jg-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(jg+r))},forward:function(e){var t,n,i,r,a,o,s,l,A={};if(e.x=e.x-this.lam0,Math.abs(Math.abs(e.y)-Qg)>Gg){if(t=.5*((a=this.E/Math.pow(vy(this.e,e.y,Math.sin(e.y)),this.B))-(o=1/a)),n=.5*(a+o),r=Math.sin(this.B*e.x),i=(t*this.singam-r*this.cosgam)/n,Math.abs(Math.abs(i)-1)0?this.v_pole_n:this.v_pole_s,s=this.ArB*e.y;return this.no_rot?(A.x=s,A.y=l):(s-=this.u_0,A.x=l*this.cosrot+s*this.sinrot,A.y=s*this.cosrot-l*this.sinrot),A.x=this.a*A.x+this.x0,A.y=this.a*A.y+this.y0,A},inverse:function(e){var t,n,i,r,a,o,s,l={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(n=e.y,t=e.x):(n=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),r=.5*((i=Math.exp(-this.BrA*n))-1/i),a=.5*(i+1/i),s=((o=Math.sin(this.BrA*t))*this.cosgam+r*this.singam)/a,Math.abs(Math.abs(s)-1)Gg?this.ns=Math.log(i/s)/Math.log(r/l):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(A,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(e){var t=e.x,n=e.y;Math.abs(2*Math.abs(n)-Math.PI)<=Gg&&(n=py(n)*(Qg-2e-10));var i,r,a=Math.abs(Math.abs(n)-Qg);if(a>Gg)i=vy(this.e,n,Math.sin(n)),r=this.a*this.f0*Math.pow(i,this.ns);else{if((a=n*this.ns)<=0)return null;r=0}var o=this.ns*my(t-this.long0);return e.x=this.k0*(r*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-r*Math.cos(o))+this.y0,e},inverse:function(e){var t,n,i,r,a,o=(e.x-this.x0)/this.k0,s=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+s*s),n=1):(t=-Math.sqrt(o*o+s*s),n=-1);var l=0;if(0!==t&&(l=Math.atan2(n*o,n*s)),0!==t||this.ns>0){if(n=1/this.ns,i=Math.pow(t/(this.a*this.f0),n),-9999===(r=gy(this.e,i)))return null}else r=-Qg;return a=my(l/this.ns+this.long0),e.x=a,e.y=r,e},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]};var Rw={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(e){var t,n,i,r,a,o,s,l=e.x,A=e.y,c=my(l-this.long0);return t=Math.pow((1+this.e*Math.sin(A))/(1-this.e*Math.sin(A)),this.alfa*this.e/2),n=2*(Math.atan(this.k*Math.pow(Math.tan(A/2+this.s45),this.alfa)/t)-this.s45),i=-c*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(n)+Math.sin(this.ad)*Math.cos(n)*Math.cos(i)),a=Math.asin(Math.cos(n)*Math.sin(i)/Math.cos(r)),o=this.n*a,s=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),e.y=s*Math.cos(o)/1,e.x=s*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e},inverse:function(e){var t,n,i,r,a,o,s,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),a=Math.sqrt(e.x*e.x+e.y*e.y),r=Math.atan2(e.y,e.x)/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/a,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),n=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(t)),e.x=this.long0-n/this.alfa,o=t,s=0;var A=0;do{e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-e.y)<1e-10&&(s=1),o=e.y,A+=1}while(0===s&&A<15);return A>=15?null:e},names:["Krovak","krovak"]};function Ow(e,t,n,i,r){return e*r-t*Math.sin(2*r)+n*Math.sin(4*r)-i*Math.sin(6*r)}function Nw(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function zw(e){return.375*e*(1+.25*e*(1+.46875*e))}function Qw(e){return.05859375*e*e*(1+.75*e)}function Gw(e){return e*e*e*(35/3072)}function Hw(e,t,n){var i=t*n;return e/Math.sqrt(1-i*i)}function Vw(e){return Math.abs(e)1e-7?(1-e*e)*(t/(1-(n=e*t)*n)-.5/e*Math.log((1-n)/(1+n))):2*t}var Yw=.3333333333333333,Kw=.17222222222222222,Zw=.10257936507936508,Jw=.06388888888888888,qw=.0664021164021164,$w=.016415012942191543;var ex={init:function(){var e,t=Math.abs(this.lat0);if(Math.abs(t-Qg)0)switch(this.qp=Xw(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(e){var t,n=[];return n[0]=e*Yw,t=e*e,n[0]+=t*Kw,n[1]=t*Jw,t*=e,n[0]+=t*Zw,n[1]+=t*qw,n[2]=t*$w,n}(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Xw(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(e){var t,n,i,r,a,o,s,l,A,c,h=e.x,u=e.y;if(h=my(h-this.long0),this.sphere){if(a=Math.sin(u),c=Math.cos(u),i=Math.cos(h),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((n=this.mode===this.EQUIT?1+c*i:1+this.sinph0*a+this.cosph0*c*i)<=Gg)return null;t=(n=Math.sqrt(2/n))*c*Math.sin(h),n*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*c*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(u+this.lat0)=0?(t=(A=Math.sqrt(o))*r,n=i*(this.mode===this.S_POLE?A:-A)):t=n=0}}return e.x=this.a*t+this.x0,e.y=this.a*n+this.y0,e},inverse:function(e){e.x-=this.x0,e.y-=this.y0;var t,n,i,r,a,o,s,l,A,c,h=e.x/this.a,u=e.y/this.a;if(this.sphere){var d,f=0,p=0;if((n=.5*(d=Math.sqrt(h*h+u*u)))>1)return null;switch(n=2*Math.asin(n),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(p=Math.sin(n),f=Math.cos(n)),this.mode){case this.EQUIT:n=Math.abs(d)<=Gg?0:Math.asin(u*p/d),h*=p,u=f*d;break;case this.OBLIQ:n=Math.abs(d)<=Gg?this.lat0:Math.asin(f*this.sinph0+u*p*this.cosph0/d),h*=p*this.cosph0,u=(f-Math.sin(n)*this.sinph0)*d;break;case this.N_POLE:u=-u,n=Qg-n;break;case this.S_POLE:n-=Qg}t=0!==u||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(h,u):0}else{if(s=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(h/=this.dd,u*=this.dd,(o=Math.sqrt(h*h+u*u))1&&(e=e>1?1:-1),Math.asin(e)}var nx={init:function(){Math.abs(this.lat1+this.lat2)Gg?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(e){var t=e.x,n=e.y;this.sin_phi=Math.sin(n),this.cos_phi=Math.cos(n);var i=Xw(this.e3,this.sin_phi,this.cos_phi),r=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,a=this.ns0*my(t-this.long0),o=r*Math.sin(a)+this.x0,s=this.rh-r*Math.cos(a)+this.y0;return e.x=o,e.y=s,e},inverse:function(e){var t,n,i,r,a,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),i=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),i=-1),r=0,0!==t&&(r=Math.atan2(i*e.x,i*e.y)),i=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-i*i)/(2*this.ns0)):(n=(this.c-i*i)/this.ns0,o=this.phi1z(this.e3,n)),a=my(r/this.ns0+this.long0),e.x=a,e.y=o,e},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(e,t){var n,i,r,a,o=tx(.5*t);if(e0||Math.abs(a)<=Gg?(o=this.x0+1*this.a*n*Math.sin(i)/a,s=this.y0+1*this.a*(this.cos_p14*t-this.sin_p14*n*r)/a):(o=this.x0+this.infinity_dist*n*Math.sin(i),s=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*n*r)),e.x=o,e.y=s,e},inverse:function(e){var t,n,i,r,a,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(r=Math.atan2(t,this.rc),n=Math.sin(r),o=tx((i=Math.cos(r))*this.sin_p14+e.y*n*this.cos_p14/t),a=Math.atan2(e.x*n,t*this.cos_p14*i-e.y*this.sin_p14*n),a=my(this.long0+a)):(o=this.phic0,a=0),e.x=a,e.y=o,e},names:["gnom"]};var rx={init:function(){this.sphere||(this.k0=fy(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(e){var t,n,i=e.x,r=e.y,a=my(i-this.long0);if(this.sphere)t=this.x0+this.a*a*Math.cos(this.lat_ts),n=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=Xw(this.e,Math.sin(r));t=this.x0+this.a*this.k0*a,n=this.y0+this.a*o*.5/this.k0}return e.x=t,e.y=n,e},inverse:function(e){var t,n;return e.x-=this.x0,e.y-=this.y0,this.sphere?(t=my(this.long0+e.x/this.a/Math.cos(this.lat_ts)),n=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(n=function(e,t){var n=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-n)<1e-6)return t<0?-1*Qg:Qg;for(var i,r,a,o,s=Math.asin(.5*t),l=0;l<30;l++)if(r=Math.sin(s),a=Math.cos(s),o=e*r,s+=i=Math.pow(1-o*o,2)/(2*a)*(t/(1-e*e)-r/(1-o*o)+.5/e*Math.log((1-o)/(1+o))),Math.abs(i)<=1e-10)return s;return NaN}(this.e,2*e.y*this.k0/this.a),t=my(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=n,e},names:["cea"]};var ax={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(e){var t=e.x,n=e.y,i=my(t-this.long0),r=Vw(n-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*r,e},inverse:function(e){var t=e.x,n=e.y;return e.x=my(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=Vw(this.lat0+(n-this.y0)/this.a),e},names:["Equirectangular","Equidistant_Cylindrical","eqc"]};var ox={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Nw(this.es),this.e1=zw(this.es),this.e2=Qw(this.es),this.e3=Gw(this.es),this.ml0=this.a*Ow(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(e){var t,n,i,r=e.x,a=e.y,o=my(r-this.long0);if(i=o*Math.sin(a),this.sphere)Math.abs(a)<=Gg?(t=this.a*o,n=-1*this.a*this.lat0):(t=this.a*Math.sin(i)/Math.tan(a),n=this.a*(Vw(a-this.lat0)+(1-Math.cos(i))/Math.tan(a)));else if(Math.abs(a)<=Gg)t=this.a*o,n=-1*this.ml0;else{var s=Hw(this.a,this.e,Math.sin(a))/Math.tan(a);t=s*Math.sin(i),n=this.a*Ow(this.e0,this.e1,this.e2,this.e3,a)-this.ml0+s*(1-Math.cos(i))}return e.x=t+this.x0,e.y=n+this.y0,e},inverse:function(e){var t,n,i,r,a,o,s,l,A;if(i=e.x-this.x0,r=e.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=Gg)t=my(i/this.a+this.long0),n=0;else{var c;for(o=this.lat0+r/this.a,s=i*i/this.a/this.a+o*o,l=o,a=20;a;--a)if(l+=A=-1*(o*(l*(c=Math.tan(l))+1)-l-.5*(l*l+s)*c)/((l-o)/c-1),Math.abs(A)<=Gg){n=l;break}t=my(this.long0+Math.asin(i*Math.tan(l)/this.a)/Math.sin(n))}else if(Math.abs(r+this.ml0)<=Gg)n=0,t=my(this.long0+i/this.a);else{var h,u,d,f,p;for(o=(this.ml0+r)/this.a,s=i*i/this.a/this.a+o*o,l=o,a=20;a;--a)if(p=this.e*Math.sin(l),h=Math.sqrt(1-p*p)*Math.tan(l),u=this.a*Ow(this.e0,this.e1,this.e2,this.e3,l),d=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),l-=A=(o*(h*(f=u/this.a)+1)-f-.5*h*(f*f+s))/(this.es*Math.sin(2*l)*(f*f+s-2*o*f)/(4*h)+(o-f)*(h*d-2/Math.sin(2*l))-d),Math.abs(A)<=Gg){n=l;break}h=Math.sqrt(1-this.es*Math.pow(Math.sin(n),2))*Math.tan(n),t=my(this.long0+Math.asin(i*h/this.a)/Math.sin(n))}return e.x=t,e.y=n,e},names:["Polyconic","poly"]};var sx={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(e){var t,n=e.x,i=e.y-this.lat0,r=n-this.long0,a=i/zg*1e-5,o=r,s=1,l=0;for(t=1;t<=10;t++)s*=a,l+=this.A[t]*s;var A,c=l,h=o,u=1,d=0,f=0,p=0;for(t=1;t<=6;t++)A=d*c+u*h,u=u*c-d*h,d=A,f=f+this.B_re[t]*u-this.B_im[t]*d,p=p+this.B_im[t]*u+this.B_re[t]*d;return e.x=p*this.a+this.x0,e.y=f*this.a+this.y0,e},inverse:function(e){var t,n,i=e.x,r=e.y,a=i-this.x0,o=(r-this.y0)/this.a,s=a/this.a,l=1,A=0,c=0,h=0;for(t=1;t<=6;t++)n=A*o+l*s,l=l*o-A*s,A=n,c=c+this.C_re[t]*l-this.C_im[t]*A,h=h+this.C_im[t]*l+this.C_re[t]*A;for(var u=0;u.999999999999&&(n=.999999999999),t=Math.asin(n);var i=my(this.long0+e.x/(.900316316158*this.a*Math.cos(t)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),n=(2*t+Math.sin(2*t))/Math.PI,Math.abs(n)>1&&(n=1);var r=Math.asin(n);return e.x=i,e.y=r,e},names:["Mollweide","moll"]};var hx={init:function(){Math.abs(this.lat1+this.lat2)=0?(n=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(n=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var a=0;return 0!==n&&(a=Math.atan2(t*e.x,t*e.y)),this.sphere?(r=my(this.long0+a/this.ns),i=Vw(this.g-n/this.a),e.x=r,e.y=i,e):(i=jw(this.g-n/this.a,this.e0,this.e1,this.e2,this.e3),r=my(this.long0+a/this.ns),e.x=r,e.y=i,e)},names:["Equidistant_Conic","eqdc"]};var ux={init:function(){this.R=this.a},forward:function(e){var t,n,i=e.x,r=e.y,a=my(i-this.long0);Math.abs(r)<=Gg&&(t=this.x0+this.R*a,n=this.y0);var o=tx(2*Math.abs(r/Math.PI));(Math.abs(a)<=Gg||Math.abs(Math.abs(r)-Qg)<=Gg)&&(t=this.x0,n=r>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o));var s=.5*Math.abs(Math.PI/a-a/Math.PI),l=s*s,A=Math.sin(o),c=Math.cos(o),h=c/(A+c-1),u=h*h,d=h*(2/A-1),f=d*d,p=Math.PI*this.R*(s*(h-f)+Math.sqrt(l*(h-f)*(h-f)-(f+l)*(u-f)))/(f+l);a<0&&(p=-p),t=this.x0+p;var m=l+h;return p=Math.PI*this.R*(d*m-s*Math.sqrt((f+l)*(l+1)-m*m))/(f+l),n=r>=0?this.y0+p:this.y0-p,e.x=t,e.y=n,e},inverse:function(e){var t,n,i,r,a,o,s,l,A,c,h,u;return e.x-=this.x0,e.y-=this.y0,h=Math.PI*this.R,a=(i=e.x/h)*i+(r=e.y/h)*r,h=3*(r*r/(l=-2*(o=-Math.abs(r)*(1+a))+1+2*r*r+a*a)+(2*(s=o-2*r*r+i*i)*s*s/l/l/l-9*o*s/l/l)/27)/(A=(o-s*s/3/l)/l)/(c=2*Math.sqrt(-A/3)),Math.abs(h)>1&&(h=h>=0?1:-1),u=Math.acos(h)/3,n=e.y>=0?(-c*Math.cos(u+Math.PI/3)-s/3/l)*Math.PI:-(-c*Math.cos(u+Math.PI/3)-s/3/l)*Math.PI,t=Math.abs(i)2*Qg*this.a)return;return n=t/this.a,i=Math.sin(n),r=Math.cos(n),a=this.long0,Math.abs(t)<=Gg?o=this.lat0:(o=tx(r*this.sin_p12+e.y*i*this.cos_p12/t),s=Math.abs(this.lat0)-Qg,a=Math.abs(s)<=Gg?this.lat0>=0?my(this.long0+Math.atan2(e.x,-e.y)):my(this.long0-Math.atan2(-e.x,e.y)):my(this.long0+Math.atan2(e.x*i,t*this.cos_p12*r-e.y*this.sin_p12*i))),e.x=a,e.y=o,e}return l=Nw(this.es),A=zw(this.es),c=Qw(this.es),h=Gw(this.es),Math.abs(this.sin_p12-1)<=Gg?(o=jw(((u=this.a*Ow(l,A,c,h,Qg))-(t=Math.sqrt(e.x*e.x+e.y*e.y)))/this.a,l,A,c,h),a=my(this.long0+Math.atan2(e.x,-1*e.y)),e.x=a,e.y=o,e):Math.abs(this.sin_p12+1)<=Gg?(u=this.a*Ow(l,A,c,h,Qg),o=jw(((t=Math.sqrt(e.x*e.x+e.y*e.y))-u)/this.a,l,A,c,h),a=my(this.long0+Math.atan2(e.x,e.y)),e.x=a,e.y=o,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),p=Math.atan2(e.x,e.y),d=Hw(this.a,this.e,this.sin_p12),m=Math.cos(p),g=-(v=this.e*this.cos_p12*m)*v/(1-this.es),y=3*this.es*(1-g)*this.sin_p12*this.cos_p12*m/(1-this.es),b=1-g*(x=(w=t/d)-g*(1+g)*Math.pow(w,3)/6-y*(1+3*g)*Math.pow(w,4)/24)*x/2-w*x*x*x/6,f=Math.asin(this.sin_p12*Math.cos(x)+this.cos_p12*Math.sin(x)*m),a=my(this.long0+Math.asin(Math.sin(p)*Math.sin(x)/Math.cos(f))),M=Math.sin(f),o=Math.atan2((M-this.es*b*this.sin_p12)*Math.tan(f),M*(1-this.es)),e.x=a,e.y=o,e)},names:["Azimuthal_Equidistant","aeqd"]};var fx={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(e){var t,n,i,r,a,o,s,l=e.x,A=e.y;return i=my(l-this.long0),t=Math.sin(A),n=Math.cos(A),r=Math.cos(i),1,((a=this.sin_p14*t+this.cos_p14*n*r)>0||Math.abs(a)<=Gg)&&(o=1*this.a*n*Math.sin(i),s=this.y0+1*this.a*(this.cos_p14*t-this.sin_p14*n*r)),e.x=o,e.y=s,e},inverse:function(e){var t,n,i,r,a,o,s;return e.x-=this.x0,e.y-=this.y0,n=tx((t=Math.sqrt(e.x*e.x+e.y*e.y))/this.a),i=Math.sin(n),r=Math.cos(n),o=this.long0,Math.abs(t)<=Gg?(s=this.lat0,e.x=o,e.y=s,e):(s=tx(r*this.sin_p14+e.y*i*this.cos_p14/t),a=Math.abs(this.lat0)-Qg,Math.abs(a)<=Gg?(o=this.lat0>=0?my(this.long0+Math.atan2(e.x,-e.y)):my(this.long0-Math.atan2(-e.x,e.y)),e.x=o,e.y=s,e):(o=my(this.long0+Math.atan2(e.x*i,t*this.cos_p14*r-e.y*this.sin_p14*i)),e.x=o,e.y=s,e))},names:["ortho"]},px=1,mx=2,vx=3,gx=4,yx=5,wx=6,xx=1,bx=2,Mx=3,Cx=4;function Bx(e,t,n,i){var r;return ejg&&r<=Qg+jg?(i.value=bx,r-=Qg):r>Qg+jg||r<=-(Qg+jg)?(i.value=Mx,r=r>=0?r-Xg:r+Xg):(i.value=Cx,r+=Qg)),r}function Ex(e,t){var n=e+t;return n<-Xg?n+=Wg:n>+Xg&&(n-=Wg),n}var Sx={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=Qg-jg/2?this.face=yx:this.lat0<=-(Qg-jg/2)?this.face=wx:Math.abs(this.long0)<=jg?this.face=px:Math.abs(this.long0)<=Qg+jg?this.face=this.long0>0?mx:gx:this.face=vx,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(e){var t,n,i,r,a,o,s={x:0,y:0},l={value:0};if(e.x-=this.long0,t=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(e.y)):e.y,n=e.x,this.face===yx)r=Qg-t,n>=jg&&n<=Qg+jg?(l.value=xx,i=n-Qg):n>Qg+jg||n<=-(Qg+jg)?(l.value=bx,i=n>0?n-Xg:n+Xg):n>-(Qg+jg)&&n<=-jg?(l.value=Mx,i=n+Qg):(l.value=Cx,i=n);else if(this.face===wx)r=Qg+t,n>=jg&&n<=Qg+jg?(l.value=xx,i=-n+Qg):n=-jg?(l.value=bx,i=-n):n<-jg&&n>=-(Qg+jg)?(l.value=Mx,i=-n-Qg):(l.value=Cx,i=n>0?-n+Xg:-n-Xg);else{var A,c,h,u,d,f;this.face===mx?n=Ex(n,+Qg):this.face===vx?n=Ex(n,+Xg):this.face===gx&&(n=Ex(n,-Qg)),u=Math.sin(t),d=Math.cos(t),f=Math.sin(n),A=d*Math.cos(n),c=d*f,h=u,this.face===px?i=Bx(r=Math.acos(A),h,c,l):this.face===mx?i=Bx(r=Math.acos(c),h,-A,l):this.face===vx?i=Bx(r=Math.acos(-A),h,-c,l):this.face===gx?i=Bx(r=Math.acos(-c),h,A,l):(r=i=0,l.value=xx)}return o=Math.atan(12/Xg*(i+Math.acos(Math.sin(i)*Math.cos(jg))-Qg)),a=Math.sqrt((1-Math.cos(r))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(i))))),l.value===bx?o+=Qg:l.value===Mx?o+=Xg:l.value===Cx&&(o+=1.5*Xg),s.x=a*Math.cos(o),s.y=a*Math.sin(o),s.x=s.x*this.a+this.x0,s.y=s.y*this.a+this.y0,e.x=s.x,e.y=s.y,e},inverse:function(e){var t,n,i,r,a,o,s,l,A,c,h,u,d={lam:0,phi:0},f={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,n=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),t=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?f.value=xx:e.y>=0&&e.y>=Math.abs(e.x)?(f.value=bx,t-=Qg):e.x<0&&-e.x>=Math.abs(e.y)?(f.value=Mx,t=t<0?t+Xg:t-Xg):(f.value=Cx,t+=Qg),A=Xg/12*Math.tan(t),a=Math.sin(A)/(Math.cos(A)-1/Math.sqrt(2)),o=Math.atan(a),(s=1-(i=Math.cos(t))*i*(r=Math.tan(n))*r*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?s=-1:s>1&&(s=1),this.face===yx)l=Math.acos(s),d.phi=Qg-l,f.value===xx?d.lam=o+Qg:f.value===bx?d.lam=o<0?o+Xg:o-Xg:f.value===Mx?d.lam=o-Qg:d.lam=o;else if(this.face===wx)l=Math.acos(s),d.phi=l-Qg,f.value===xx?d.lam=-o+Qg:f.value===bx?d.lam=-o:f.value===Mx?d.lam=-o-Qg:d.lam=o<0?-o-Xg:-o+Xg;else{var p,m,v;A=(p=s)*p,m=(A+=(v=A>=1?0:Math.sqrt(1-A)*Math.sin(o))*v)>=1?0:Math.sqrt(1-A),f.value===bx?(A=m,m=-v,v=A):f.value===Mx?(m=-m,v=-v):f.value===Cx&&(A=m,m=v,v=-A),this.face===mx?(A=p,p=-m,m=A):this.face===vx?(p=-p,m=-m):this.face===gx&&(A=p,p=m,m=-A),d.phi=Math.acos(-v)-Qg,d.lam=Math.atan2(m,p),this.face===mx?d.lam=Ex(d.lam,-Qg):this.face===vx?d.lam=Ex(d.lam,-Xg):this.face===gx&&(d.lam=Ex(d.lam,+Qg))}return 0!==this.es&&(c=d.phi<0?1:0,h=Math.tan(d.phi),u=this.b/Math.sqrt(h*h+this.one_minus_f_squared),d.phi=Math.atan(Math.sqrt(this.a*this.a-u*u)/(this.one_minus_f*u)),c&&(d.phi=-d.phi)),d.lam+=this.long0,e.x=d.lam,e.y=d.phi,e},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},Tx=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],_x=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Ix=.8487,Lx=1.3523,Fx=Vg/5,kx=18,Px=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))};var Ux={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(e){var t=my(e.x-this.long0),n=Math.abs(e.y),i=Math.floor(n*Fx);i<0?i=0:i>=kx&&(i=17);var r={x:Px(Tx[i],n=Vg*(n-.08726646259971647*i))*t,y:Px(_x[i],n)};return e.y<0&&(r.y=-r.y),r.x=r.x*this.a*Ix+this.x0,r.y=r.y*this.a*Lx+this.y0,r},inverse:function(e){var t={x:(e.x-this.x0)/(this.a*Ix),y:Math.abs(e.y-this.y0)/(this.a*Lx)};if(t.y>=1)t.x/=Tx[18][0],t.y=e.y<0?-Qg:Qg;else{var n=Math.floor(t.y*kx);for(n<0?n=0:n>=kx&&(n=17);;)if(_x[n][0]>t.y)--n;else{if(!(_x[n+1][0]<=t.y))break;++n}var i=_x[n],r=5*(t.y-i[0])/(_x[n+1][0]-i[0]);r=function(e,t,n,i){for(var r=t;i;--i){var a=e(r);if(r-=a,Math.abs(a)1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var e=1-this.es,t=1/e;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=t,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(e){var t,n,i,r,a=e.x,o=e.y;if(a-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var s=this.radius_p/Mw(this.radius_p*Math.cos(o),Math.sin(o));if(n=s*Math.cos(a)*Math.cos(o),i=s*Math.sin(a)*Math.cos(o),r=s*Math.sin(o),(this.radius_g-n)*n-i*i-r*r*this.radius_p_inv2<0)return e.x=Number.NaN,e.y=Number.NaN,e;t=this.radius_g-n,this.flip_axis?(e.x=this.radius_g_1*Math.atan(i/Mw(r,t)),e.y=this.radius_g_1*Math.atan(r/t)):(e.x=this.radius_g_1*Math.atan(i/t),e.y=this.radius_g_1*Math.atan(r/Mw(i,t)))}else"sphere"===this.shape&&(t=Math.cos(o),n=Math.cos(a)*t,i=Math.sin(a)*t,r=Math.sin(o),t=this.radius_g-n,this.flip_axis?(e.x=this.radius_g_1*Math.atan(i/Mw(r,t)),e.y=this.radius_g_1*Math.atan(r/t)):(e.x=this.radius_g_1*Math.atan(i/t),e.y=this.radius_g_1*Math.atan(r/Mw(i,t))));return e.x=e.x*this.a,e.y=e.y*this.a,e},inverse:function(e){var t,n,i,r,a=-1,o=0,s=0;if(e.x=e.x/this.a,e.y=e.y/this.a,"ellipse"===this.shape){this.flip_axis?(s=Math.tan(e.y/this.radius_g_1),o=Math.tan(e.x/this.radius_g_1)*Mw(1,s)):(o=Math.tan(e.x/this.radius_g_1),s=Math.tan(e.y/this.radius_g_1)*Mw(1,o));var l=s/this.radius_p;if(t=o*o+l*l+a*a,(i=(n=2*this.radius_g*a)*n-4*t*this.C)<0)return e.x=Number.NaN,e.y=Number.NaN,e;r=(-n-Math.sqrt(i))/(2*t),a=this.radius_g+r*a,o*=r,s*=r,e.x=Math.atan2(o,a),e.y=Math.atan(s*Math.cos(e.x)/a),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if("sphere"===this.shape){if(this.flip_axis?(s=Math.tan(e.y/this.radius_g_1),o=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+s*s)):(o=Math.tan(e.x/this.radius_g_1),s=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+o*o)),t=o*o+s*s+a*a,(i=(n=2*this.radius_g*a)*n-4*t*this.C)<0)return e.x=Number.NaN,e.y=Number.NaN,e;r=(-n-Math.sqrt(i))/(2*t),a=this.radius_g+r*a,o*=r,s*=r,e.x=Math.atan2(o,a),e.y=Math.atan(s*Math.cos(e.x)/a)}return e.x=e.x+this.long0,e},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};function Vx(e){return e.startsWith("TMS")}function jx(e){return e.startsWith("EPSG")}function Wx(e){return jx(e)?e:"EPSG:".concat(e.match(/\d+/)[0])}Zy.defaultDatum="WGS84",Zy.Proj=Uy,Zy.WGS84=new Zy.Proj("WGS84"),Zy.Point=fw,Zy.toPoint=Vy,Zy.defs=Ay,Zy.nadgrid=function(e,t){var n=new DataView(t),i=function(e){var t=e.getInt32(8,!1);if(11===t)return!1;11!==(t=e.getInt32(8,!0))&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian");return!0}(n),r=function(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:Ly(e,56,64).trim(),fromSemiMajorAxis:e.getFloat64(120,t),fromSemiMinorAxis:e.getFloat64(136,t),toSemiMajorAxis:e.getFloat64(152,t),toSemiMinorAxis:e.getFloat64(168,t)}}(n,i);r.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var a=function(e,t,n){for(var i=176,r=[],a=0;a0&&void 0!==arguments[0]?arguments[0]:qx;s(this,e),this.size=new at,this._radiiSquared=new at,this._invRadiiSquared=new at,this.setSize(t)}return A(e,[{key:"geodeticSurfaceNormal",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new at;return e.toVector3(t).multiply(this._invRadiiSquared).normalize()}},{key:"geodeticSurfaceNormalCartographic",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new at,n=Hh.degToRad(e.longitude),i=Hh.degToRad(e.latitude),r=Math.cos(i);return t.set(r*Math.cos(n),r*Math.sin(n),Math.sin(i))}},{key:"setSize",value:function(e){this.size.set(e.x,e.y,e.z),this._radiiSquared.multiplyVectors(e,e),this._invRadiiSquared.x=0==e.x?0:1/this._radiiSquared.x,this._invRadiiSquared.y=0==e.y?0:1/this._radiiSquared.y,this._invRadiiSquared.z=0==e.z?0:1/this._radiiSquared.z}},{key:"cartographicToCartesian",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new at;$x.copy(e.geodesicNormal),t.multiplyVectors(this._radiiSquared,$x);var n=Math.sqrt($x.dot(t));return t.divideScalar(n),$x.multiplyScalar(e.altitude),t.add($x)}},{key:"cartesianToCartographic",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ob("EPSG:4326",0,0,0),n=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z),i=this.size.x,r=this.size.z,a=Math.abs((i*i-r*r)/(i*i)),o=1-Math.sqrt(1-a),s=Math.sqrt(e.x*e.x+e.y*e.y),l=Math.atan2(e.y,e.x),A=Math.atan(e.z/s*(1-o+a*i/n)),c=Math.sin(A),h=Math.cos(A),u=Math.atan((e.z*(1-o)+a*i*c*c*c)/((1-o)*(s-a*i*h*h*h))),d=s*Math.cos(u)+e.z*Math.sin(u)-i*Math.sqrt(1-a*Math.sin(u)*Math.sin(u));return t.setFromValues(Hh.radToDeg(l),Hh.radToDeg(u),d)}},{key:"cartographicToCartesianArray",value:function(e){for(var t=[],n=0;n1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;s(this,e),this.isCoordinates=!0,Jx.isValid(t),this.crs=t,this.x=0,this.y=0,this.z=0,this._normal=new at,n.length>0?this.setFromArray(n):n.isVector3||n.isCoordinates?this.setFromVector3(n):this.setFromValues(n,i,r),this._normalNeedsUpdate=!0}return A(e,[{key:"setFromValues",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.x=null==e?0:e,this.y=null==t?0:t,this.z=null==n?0:n,this._normalNeedsUpdate=!0,this}},{key:"setFromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.setFromValues(e[t],e[t+1],e[t+2])}},{key:"setFromVector3",value:function(e){return this.setFromValues(e.x,e.y,e.z)}},{key:"clone",value:function(){return new e(this.crs,this)}},{key:"copy",value:function(e){return this.crs=e.crs,this.setFromVector3(e)}},{key:"longitude",get:function(){return this.x}},{key:"latitude",get:function(){return this.y}},{key:"altitude",get:function(){return this.z},set:function(e){this.z=e}},{key:"geodesicNormal",get:function(){return this._normalNeedsUpdate&&(this._normalNeedsUpdate=!1,Jx.is4326(this.crs)?tb.geodeticSurfaceNormalCartographic(this,this._normal):"EPSG:4978"==this.crs?tb.geodeticSurfaceNormal(this,this._normal):this._normal.set(0,0,1)),this._normal}},{key:"toVector3",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new at;return e.copy(this)}},{key:"applyMatrix4",value:function(e){return at.prototype.applyMatrix4.call(this,e)}},{key:"as",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new e(t);return this.crs==t?n.copy(this):(Jx.is4326(this.crs)&&"EPSG:3857"==t&&(this.y=Hh.clamp(this.y,-89.999999,89.999999)),n.setFromArray(ib(this.crs,t).forward([this.x,this.y,this.z]))),n.crs=t,n}}]),e}(),sb=new tt,lb=new tt,Ab=new tt,cb=new tt,hb=new tt,ub=new tt(2,2),db={row:0,col:0,invDiff:0};function fb(e,t){var n=e.zoom-t,i=Math.pow(2,n);return db.invDiff=1/i,db.row=(e.row-e.row%i)*db.invDiff,db.col=(e.col-e.col%i)*db.invDiff,db}for(var pb=new Array(8),mb=pb.length-1;mb>=0;mb--)pb[mb]=new ob("EPSG:4326",0,0,0,0);var vb=new ob("EPSG:4326",0,0),gb=new Map,yb=new Map;function wb(e){var t=Jx.formatToEPSG(e),n=gb.get(t),i=n.dimensions(lb),r=Jx.formatToTms(e);return{epsg:t,globalExtent:n,globalDimension:i,sTs:yb.get(r)||yb.get("default"),isInverted:!r.includes(":NI")}}function xb(e,t){var n=yb.get(Jx.formatToTms(e))||yb.get("default"),i=Math.pow(2,t);return Ab.set(i,i).multiply(n),Ab}var bb=function(){function e(t,n,i,r,a){s(this,e),this.isExtent=!0,this.crs=t,this.zoom=0,Jx.isTms(this.crs)?(this.row=0,this.col=0):(this.west=0,this.east=0,this.south=0,this.north=0),this.set(n,i,r,a)}return A(e,[{key:"clone",value:function(){return Jx.isTms(this.crs)?new e(this.crs,this.zoom,this.row,this.col):new e(this.crs,this.west,this.east,this.south,this.north)}},{key:"tiledCovering",value:function(t){if("EPSG:4326"==this.crs&&t==Jx.tms_3857){var n=[],i=rb.copy(this).as(Jx.formatToEPSG(t),ab),r=wb(Jx.formatToEPSG(t)),a=r.globalExtent,o=r.globalDimension,s=r.sTs;i.clampByExtent(a),i.dimensions(hb);var l=this.zoom+1||Math.floor(Math.log2(Math.round(o.x/(hb.x*s.x)))),A=xb(t,l),c=i.center(vb);cb.x=c.x-a.west,cb.y=a.north-i.north,cb.divide(o).multiply(A).floor();for(var h=Math.ceil((a.north-i.south)/o.x*A.y)-1;h>=cb.y;h--)n.push(new e(t,l,h,cb.x));return n}var u=new e(t,0,0,0),d=wb(this.crs),f=d.globalExtent,p=d.globalDimension,m=d.sTs,v=d.isInverted,g=this.center(vb);this.dimensions(hb);var y=Math.floor(Math.log2(Math.round(p.x/(hb.x*m.x)))),w=xb(t,y);return cb.x=g.x-f.west,cb.y=v?f.north-g.y:g.y-f.south,cb.divide(p).multiply(w).floor(),u.set(y,cb.y,cb.x),[u]}},{key:"as",value:function(t,n){if(Jx.isValid(t),n=n||new e("EPSG:4326",[0,0,0,0]),Jx.isTms(this.crs)){var i=wb(this.crs),r=i.epsg,a=i.globalExtent,o=i.globalDimension,s=xb(this.crs,this.zoom);return hb.set(1,1).divide(s).multiply(o),n.west=a.west+(o.x-hb.x*(s.x-this.col)),n.east=n.west+hb.x,n.south=a.south+hb.y*(s.y-this.row-1),n.north=n.south+hb.y,n.crs=r,n.zoom=this.zoom,t==r?n:n.as(t,n)}if(Jx.isEpsg(t)){if(this.crs!=t){var l=this.center(vb);pb[0].setFromValues(this.west,this.north),pb[1].setFromValues(l.x,this.north),pb[2].setFromValues(this.east,this.north),pb[3].setFromValues(this.east,l.y),pb[4].setFromValues(this.east,this.south),pb[5].setFromValues(l.x,this.south),pb[6].setFromValues(this.west,this.south),pb[7].setFromValues(this.west,l.y),n.set(1/0,-1/0,1/0,-1/0);for(var A=0;A0&&void 0!==arguments[0]?arguments[0]:new ob(this.crs);if(Jx.isTms(this.crs))throw new Error("Invalid operation for WMTS bbox");return this.dimensions(sb),e.crs=this.crs,e.setFromValues(this.west+.5*sb.x,this.south+.5*sb.y),e}},{key:"dimensions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt;return e.x=Math.abs(this.east-this.west),e.y=Math.abs(this.north-this.south),e}},{key:"isPointInside",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.crs==e.crs?vb.copy(e):e.as(this.crs,vb),vb.x<=this.east+t&&vb.x>=this.west-t&&vb.y<=this.north+t&&vb.y>=this.south-t}},{key:"isInside",value:function(e,t){return Jx.isTms(this.crs)?this.zoom==e.zoom?this.row==e.row&&this.col==e.col:!(this.zoom1&&void 0!==arguments[1]?arguments[1]:new ut;if(this.crs!=e.crs)throw new Error("unsupported mix");if(Jx.isTms(this.crs))return fb(this,e.zoom),t.set(this.col*db.invDiff-db.col,this.row*db.invDiff-db.row,db.invDiff,db.invDiff);e.dimensions(sb),this.dimensions(lb);var n=(this.west-e.west)/sb.x,i=(e.north-this.north)/sb.y,r=lb.x/sb.x,a=lb.y/sb.y;return t.set(n,i,r,a)}},{key:"tiledExtentParent",value:function(t){return t&&t=t.east||this.east<=t.west||this.south>=t.north||this.north<=t.south)}},{key:"intersect",value:function(t){return this.intersectsExtent(t)?(t.crs!=this.crs&&(t=t.as(this.crs,rb)),new e(this.crs,Math.max(this.west,t.west),Math.min(this.east,t.east),Math.max(this.south,t.south),Math.min(this.north,t.north))):new e(this.crs,0,0,0,0)}},{key:"set",value:function(e,t,n,i){if(null==e)throw new Error("No values to set in the extent");return e.isExtent&&(Jx.isTms(e.crs)?(t=e.row,n=e.col,e=e.zoom):(t=e.east,n=e.south,i=e.north,e=e.west)),Jx.isTms(this.crs)?(this.zoom=e,this.row=t,this.col=n):e.isCoordinates?(this.west=e.x,this.east=t.x,this.south=e.y,this.north=t.y):void 0!==e.west?(this.west=e.west,this.east=e.east,this.south=e.south,this.north=e.north):4==e.length?(this.west=e[0],this.east=e[1],this.south=e[2],this.north=e[3]):void 0!==i&&(this.west=e,this.east=t,this.south=n,this.north=i),this}},{key:"copy",value:function(e){return this.crs=e.crs,this.set(e)}},{key:"union",value:function(e){if(e.crs!=this.crs)throw new Error("unsupported union between 2 diff crs");if(this.west===1/0)this.copy(e);else{var t=e.west;tthis.east&&(this.east=n);var i=e.south;ithis.north&&(this.north=r)}}},{key:"expandByCoordinates",value:function(e){var t=e.crs==this.crs?e:e.as(this.crs,vb);this.expandByValuesCoordinates(t.x,t.y)}},{key:"expandByValuesCoordinates",value:function(e,t){ethis.east&&(this.east=e),tthis.north&&(this.north=t)}},{key:"toString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Jx.isTms(this.crs)?"".concat(this.zoom).concat(e).concat(this.row).concat(e).concat(this.col):"".concat(this.east).concat(e).concat(this.north).concat(e).concat(this.west).concat(e).concat(this.south)}},{key:"subdivision",value:function(){return this.subdivisionByScheme()}},{key:"subdivisionByScheme",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ub,n=[],i=this.dimensions(sb).divide(t),r=t.x-1;r>=0;r--)for(var a=t.y-1;a>=0;a--){var o=this.west+r*i.x,s=this.south+a*i.y;n.push(new e(this.crs,o,o+i.x,s,s+i.y))}return n}},{key:"transformedCopy",value:function(e,t,n){if(!Jx.isTms(n.crs)){if(this.crs=n.crs,this.zoom=n.zoom,this.west=(n.west+e.x)*t.x,this.east=(n.east+e.x)*t.x,this.west>this.east){var i=this.west;this.west=this.east,this.east=i}if(this.south=(n.south+e.y)*t.y,this.north=(n.north+e.y)*t.y,this.south>this.north){var r=this.south;this.south=this.north,this.north=r}}}},{key:"clampSouthNorth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.south,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.north;return this.south=Math.max(this.south,e),this.north=Math.min(this.north,t),this}},{key:"clampWestEast",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.west,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.east;return this.west=Math.max(this.west,e),this.east=Math.min(this.east,t),this}},{key:"clampByExtent",value:function(e){return this.clampSouthNorth(e.south,e.north),this.clampWestEast(e.west,e.east)}}],[{key:"fromBox3",value:function(t,n){return new e(t,{west:n.min.x,east:n.max.x,south:n.min.y,north:n.max.y})}}]),e}();rb=new bb("EPSG:4326",[0,0,0,0]),ab=new bb("EPSG:4326",[0,0,0,0]),gb.set("EPSG:4326",new bb("EPSG:4326",-180,180,-90,90));var Mb=gb.get("EPSG:4326").as("EPSG:3857");Mb.clampSouthNorth(Mb.west,Mb.east),gb.set("EPSG:3857",Mb),yb.set("default",new tt(1,1)),yb.set(Jx.tms_3857,yb.get("default")),yb.set(Jx.tms_4326,new tt(2,1));var Cb={v:new at,coord1:new ob("EPSG:4978"),coord2:new ob("EPSG:4978"),offset:new tt};function Bb(e,t,n,i,r,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},s=arguments.length>7?arguments[7]:void 0,l=arguments.length>8?arguments[8]:void 0,A=s||new ob(i);o.worldFromLocal?A.setFromVector3(Cb.v.copy(r).applyMatrix4(o.worldFromLocal)):A.setFromVector3(r);var c=Sb.getTerrainObjectAt(e,A,t,n,l);if(c)return c.coord.z+=a,c.coord.as(i,Cb.coord2).toVector3(r),o.localFromWorld&&r.applyMatrix4(o.localFromWorld),{id:c.texture.id,version:c.texture.version,tile:c.tile}}var Eb,Sb={getElevationValueAt:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,r=Rb(e,n,t,i||e.level0Nodes);if(r)return r.coord.z},getTerrainObjectAt:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;return Rb(e,n,t,i||e.level0Nodes,r)},FAST_READ_Z:0,PRECISE_READ_Z:1,placeObjectOnGround:function(e,t,n){var i,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4?arguments[4]:void 0;if(console.warn("placeObjectOnGround has been deprecated because it needs review and test"),i=a?a.concat(e.level0Nodes):e.level0Nodes,r.modifyGeometry){var o={worldFromLocal:n.matrixWorld,localFromWorld:(new bt).copy(n.matrixWorld).invert()},s=n.geometry;if(s.vertices){r.cache&&(r.cache.length=s.vertices.length);for(var l=!0,A=new ob(t),c=0;c=0?t:void 0}}function _b(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r2&&void 0!==arguments[2]?arguments[2]:new tt;if(e.crs!=t.crs)throw new Error("Unsupported mix: ".concat(e.crs," and ").concat(t.crs));t.dimensions(Db);var i=(e.x-t.west)/Db.x,r=(t.north-e.y)/Db.y;n.set(i,r)}(a,o.extent,Ub.offset),a.z=1==t?function(e,t,n,i,r){var a=i.x/r.x/16,o=Math.floor(n.x/a)*a,s=Math.floor(n.y/a)*a;1==o&&(o-=a),1==s&&(s-=a);var l=o,A=o+a,c=s,h=s+a,u=(n.x-o)/a,d=(n.y-s)/a,f=1==d||u/(1-d)>=1,p=new Tn(new at(l,h),new at(A,c),f?new at(A,h):new at(l,c));p.getBarycoord(new at(n.x,n.y),Pb);var m=e.attachedLayers.filter((function(e){return e.isElevationLayer}))[0],v=Fb(m,t,p.a.x,p.a.y),g=Fb(m,t,p.b.x,p.b.y),y=Fb(m,t,p.c.x,p.c.y);return v*Pb.x+g*Pb.y+y*Pb.z}(e,c,Ub.offset,l.extent.dimensions(),o.extent.dimensions()):kb(e,c,Ub.offset),null!=a.z?{coord:a,texture:c,tile:l}:void 0}}var Ob=1,Nb={frustum:new Wi,matrix:new bt,box3:new tn},zb=new tn(new at(-1,-1,-1),new at(1,1,1));function Qb(e,t,n){if(e.camera3D.isOrthographicCamera)e._preSSE=t;else{var i=Hh.degToRad(n);e._preSSE=t/(2*Math.tan(.5*i))}}var Gb=function(){function e(t,n,i){var r=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(s(this,e),this.crs=t,a.isCamera)console.warn("options.camera parameter is deprecated. Use options.camera.cameraThree to place a custom camera as a parameter. See the documentation of Camera."),this.camera3D=a;else if(a.cameraThree)this.camera3D=a.cameraThree;else if(a.type===Ob)this.camera3D=new FA;else this.camera3D=new Ni(30);if(this.camera3D.aspect=void 0!==this.camera3D.aspect?this.camera3D.aspect:1,this._viewMatrix=new bt,this.width=n,this.height=i,this._viewMatrixNeedsUpdate=!0,this.resize(n,i),this._preSSE=1/0,this.camera3D.isPerspectiveCamera){var o=this.camera3D.fov;Object.defineProperty(this.camera3D,"fov",{get:function(){return o},set:function(e){o=e,Qb(r,r.height,o)}})}}return A(e,[{key:"resize",value:function(e,t){var n=e/t;if(this.camera3D.aspect!==n){if(this.camera3D.isOrthographicCamera){this.camera3D.zoom*=this.width/e;var i=this.camera3D.top*this.camera3D.aspect/n;this.camera3D.bottom=-i,this.camera3D.top=i}else this.camera3D.isPerspectiveCamera&&(this.camera3D.fov=2*et.radToDeg(Math.atan(t/this.height*Math.tan(et.degToRad(this.camera3D.fov)/2))));this.camera3D.aspect=n}this.width=e,this.height=t,Qb(this,this.height,this.camera3D.fov),this.camera3D.updateProjectionMatrix&&(this.camera3D.updateProjectionMatrix(),this._viewMatrixNeedsUpdate=!0)}},{key:"update",value:function(){this.camera3D.updateMatrixWorld(),this._viewMatrixNeedsUpdate=!0}},{key:"position",value:function(e){return new ob(this.crs,this.camera3D.position).as(e||this.crs)}},{key:"setPosition",value:function(e){this.camera3D.position.copy(e.as(this.crs))}},{key:"isBox3Visible",value:function(e,t){return this.box3SizeOnScreen(e,t).intersectsBox(zb)}},{key:"isSphereVisible",value:function(e,t){return this._viewMatrixNeedsUpdate&&(this._viewMatrix.multiplyMatrices(this.camera3D.projectionMatrix,this.camera3D.matrixWorldInverse),this._viewMatrixNeedsUpdate=!1),t?(Nb.matrix.multiplyMatrices(this._viewMatrix,t),Nb.frustum.setFromProjectionMatrix(Nb.matrix)):Nb.frustum.setFromProjectionMatrix(this._viewMatrix),Nb.frustum.intersectsSphere(e)}},{key:"box3SizeOnScreen",value:function(e,t){var n=function(e,t,n){var i=e.camera3D.matrixWorldInverse;n&&(i=Nb.matrix.multiplyMatrices(e.camera3D.matrixWorldInverse,n));Hb[0].set(t.min.x,t.min.y,t.min.z).applyMatrix4(i),Hb[1].set(t.min.x,t.min.y,t.max.z).applyMatrix4(i),Hb[2].set(t.min.x,t.max.y,t.min.z).applyMatrix4(i),Hb[3].set(t.min.x,t.max.y,t.max.z).applyMatrix4(i),Hb[4].set(t.max.x,t.min.y,t.min.z).applyMatrix4(i),Hb[5].set(t.max.x,t.min.y,t.max.z).applyMatrix4(i),Hb[6].set(t.max.x,t.max.y,t.min.z).applyMatrix4(i),Hb[7].set(t.max.x,t.max.y,t.max.z).applyMatrix4(i);for(var r=!1,a=0;a<8;a++)Hb[a].z<=-e.camera3D.near?r=!0:Hb[a].z=-e.camera3D.near;return r?Hb:void 0}(this,e,t);if(!n)return Nb.box3.makeEmpty();for(var i=0;i<8;i++)n[i].applyMatrix4(this.camera3D.projectionMatrix);return Nb.box3.setFromPoints(n)}},{key:"adjustAltitudeToAvoidCollisionWithLayer",value:function(e,t,n){var i=e.camera.position().as("EPSG:4326");if(void 0!==t){var r=Sb.getElevationValueAt(t,i);if(void 0!==r)i.altitude-(r+n)<0&&(i.altitude=r+n,e.camera.camera3D.position.copy(i.as(e.referenceCrs)),e.notifyChange(this.camera3D))}}}]),e}(),Hb=[new at,new at,new at,new at,new at,new at,new at,new at];var Vb="update_start",jb="before_camera_update",Wb="after_camera_update",Xb="before_layer_update",Yb="after_layer_update",Kb="before_render",Zb="after_render",Jb="update_end";function qb(e,t){this.renderingState=0,this.needsRedraw=!1,this.scheduler=e,this.gfxEngine=t,this._updateLoopRestarted=!0}function $b(e,t,n){if(n){var i,r=S(n);try{for(r.s();!(i=r.n()).done;){var a=i.value,o=t.update(e,t,a),s=t.getObjectToUpdateForAttachedLayers(a);if(s)if(s.element){if(__DEBUG__&&!s.element.isObject3D)throw new Error("\n Invalid object for attached layer to update.\n Must be a THREE.Object and have a THREE.Material");var l,A=S(t.attachedLayers);try{for(A.s();!(l=A.n()).done;){var c=l.value;c.ready&&(c.update(e,c,s.element,s.parent),c.cache.flush())}}catch(e){A.e(e)}finally{A.f()}}else if(s.elements)for(var h=0;h0){var l,A=S(o.attachedLayers);try{for(A.s();!(l=A.n()).done;){var c=l.value;c.ready&&c.preUpdate&&c.preUpdate(i,s)}}catch(e){A.e(e)}finally{A.f()}var h=o.preUpdate(i,s);$b(i,o,h),o.postUpdate(i,o,t)}o.cache.flush(),e.execFrameRequesters(Yb,n,this._updateLoopRestarted,o)}}}catch(e){a.e(e)}finally{a.f()}},qb.prototype._step=function(e,t){var n=t-this._lastTimestamp;e._executeFrameRequestersRemovals(),e.execFrameRequesters(Vb,n,this._updateLoopRestarted);var i=this.needsRedraw;this._lastTimestamp=t,this.needsRedraw=!1,this.renderingState=0;var r=new Set(e._changeSources);e._changeSources.clear();var a=this.gfxEngine.getWindowSize();e.execFrameRequesters(jb,n,this._updateLoopRestarted),e.camera.update(a.x,a.y),e.execFrameRequesters(Wb,n,this._updateLoopRestarted);var o=e.camera.camera3D.matrixAutoUpdate;e.camera.camera3D.matrixAutoUpdate=!1,this._update(e,r,n),0==this.scheduler.commandsWaitingExecutionCount()&&this.dispatchEvent({type:"command-queue-empty"}),i&&this._renderView(e,n),this._updateLoopRestarted=0===this.renderingState,__DEBUG__&&(document.title=document.title.substr(0,document.title.length-2)),e.camera.camera3D.matrixAutoUpdate=o,e.execFrameRequesters(Jb,n,this._updateLoopRestarted)},qb.prototype._renderView=function(e,t){e.execFrameRequesters(Kb,t,this._updateLoopRestarted),e.render?e.render():this.gfxEngine.renderView(e),e.execFrameRequesters(Zb,t,this._updateLoopRestarted)},qb.prototype.dispose=function(){this.animationFrame&&cancelAnimationFrame(this.animationFrame)};var tM=!1,nM=8;function iM(e,t,n){var i=e.getContext(),r=i.createShader(t);return i.shaderSource(r,n),i.compileShader(r),r}function rM(){return navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox")}var aM=function(){return tM},oM=function(){return!!document.documentMode},sM=function(){return nM},lM=function(e){var t=e.getContext();nM=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),t.getParameter(t.MAX_TEXTURE_SIZE);var n=t.createProgram(),i=iM(e,t.VERTEX_SHADER,"\nvoid main() {\n gl_Position = vec4( 0.0, 0.0, 0.0, 1.0 );\n}\n"),r="#define SAMPLE ".concat(nM,"\n");r+="\nuniform sampler2D uni[SAMPLE];\nvoid main() {\n gl_FragColor += texture2D(uni[SAMPLE-1], vec2(0));\n}\n";var a=iM(e,t.FRAGMENT_SHADER,r);if(t.attachShader(n,i),t.attachShader(n,a),t.linkProgram(n),!1===t.getProgramParameter(n,t.LINK_STATUS)){if(!(nM>16))throw new Error("The GPU capabilities could not be determined accurately.\n Impossible to link a shader with the Maximum texture units ".concat(nM));var o=t.getProgramInfoLog(n);console.warn("".concat(o,": using a maximum of 16 texture units instead of the reported value (").concat(nM,")")),rM()&&console.warn("It can come from a Mesa/Firefox bug;\n the shader compiles to an error when using more than 16 sampler uniforms,\n see https://bugzilla.mozilla.org/show_bug.cgi?id=777028"),nM=16}t.deleteProgram(n),t.deleteShader(i),t.deleteShader(a),tM=e.capabilities.logarithmicDepthBuffer},AM="\n#include \n#include \n#include \n#include \n#include \n#include \nattribute vec2 uv_0;\n#if NUM_CRS > 1\nattribute float uv_1;\n#endif\nattribute vec3 normal;\n\nuniform mat4 modelMatrix;\nuniform bool lightingEnabled;\nvarying vec2 vHighPrecisionZW;\n\n#if MODE == MODE_FINAL\n#include \nvarying vec3 vUv;\nvarying vec3 vNormal;\n#endif\nvoid main() {\n vec2 uv = vec2(uv_0.x, 1.0 - uv_0.y);\n\n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n#if MODE == MODE_FINAL\n #include \n #if NUM_CRS > 1\n vUv = vec3(uv_0, (uv_1 > 0.) ? uv_1 : uv_0.y); // set uv_1 = uv_0 if uv_1 is undefined\n #else\n vUv = vec3(uv_0, 0.0);\n #endif\n vNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\n#endif\n}\n",cM="\n#include \n#include \n#include \n#include \n#include \n#if MODE == MODE_FINAL\n#include \n#include \n#include \n#endif\n#include \n\nuniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vUv; // uv_0.x/uv_1.x, uv_0.y, uv_1.y\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n #include \n\n#if MODE == MODE_ID\n\n #include \n\n#elif MODE == MODE_DEPTH\n\n #include \n\n#else\n\n gl_FragColor = vec4(diffuse, opacity);\n\n uvs[0] = vec3(vUv.xy, 0.);\n\n#if NUM_CRS > 1\n uvs[1] = vec3(vUv.x, fract(vUv.z), floor(vUv.z));\n#endif\n\n vec4 color;\n #pragma unroll_loop\n for ( int i = 0; i < NUM_FS_TEXTURES; i ++ ) {\n color = getLayerColor( i , colorTextures[ i ], colorOffsetScales[ i ], colorLayers[ i ]);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, color.rgb, color.a);\n }\n\n #if defined(DEBUG)\n if (showOutline) {\n #pragma unroll_loop\n for ( int i = 0; i < NUM_CRS; i ++) {\n color = getOutlineColor( outlineColors[ i ], uvs[ i ].xy);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, color.rgb, color.a);\n }\n }\n #endif\n\n #include \n #include \n #include \n\n#endif\n}\n",hM=new RegExp("gl_Position.*(?![^]*gl_Position)"),uM=new RegExp("[^\\w]*main[^\\w]*(void)?[^\\w]*{"),dM=function(e){if(!e.vertexShader.includes("USE_LOGDEPTHBUF")&&!e.vertexShader.includes("logdepthbuf_pars_vertex")){e.vertexShader="#include \n#define EPSILON 1e-6\n".concat(e.vertexShader);var t=hM.exec(e.vertexShader),n=t[0].length+t.index;e.vertexShader="".concat(e.vertexShader.slice(0,n),"\n#include \n").concat(e.vertexShader.slice(n)),e.fragmentShader="#include \n").concat(e.fragmentShader.slice(n)),e.defines={USE_LOGDEPTHBUF:1,USE_LOGDEPTHBUF_EXT:1}}},fM=function(e,t){return e.replace(/#pragma unroll_loop\s+for\s*\(\s*int\s+i\s*=\s*([\w\d]+);\s*i\s+<\s+([\w\d]+);\s*i\s*\+\+\s*\)\s*\{\n([^}]*)\}/g,(function(e,n,i,r){var a="";n=n in t?t[n]:parseInt(n,10),i=i in t?t[i]:parseInt(i,10);for(var o=n;on&&console.warn("LayeredMaterial: Not enough texture units (".concat(n," < ").concat(l,"), excess textures have been discarded.")),s.value=l;for(var d=l;d0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(s(this,n),e=t.call(this,i),TM=TM||[1,BM()],e.defines.NUM_VS_TEXTURES=TM[0],e.defines.NUM_FS_TEXTURES=TM[1],e.defines.USE_FOG=1,e.defines.NUM_CRS=r,vM(v(e),"ELEVATION",_M),vM(v(e),"MODE",mM.MODES),gM(v(e),"mode","MODE",mM.MODES.FINAL),__DEBUG__){e.defines.DEBUG=1;var a=[new at(1,0,0)];r>1&&a.push(new at(1,.5,0)),yM(v(e),"showOutline",!0),yM(v(e),"outlineWidth",.008),yM(v(e),"outlineColors",a)}aM()&&(e.defines.USE_LOGDEPTHBUF=1,e.defines.USE_LOGDEPTHBUF_EXT=1),e.vertexShader=AM,IM[r]=IM[r]||fM(cM,e.defines),e.fragmentShader=IM[r],yM(v(e),"diffuse",new Fn(.04,.23,.35)),yM(v(e),"opacity",e.opacity),yM(v(e),"lightingEnabled",!1),yM(v(e),"lightPosition",new at(-.5,0,1)),yM(v(e),"fogDistance",1e9),yM(v(e),"fogColor",new Fn(.76,.85,1)),yM(v(e),"overlayAlpha",0),yM(v(e),"overlayColor",new Fn(1,.3,0)),yM(v(e),"objectId",0),yM(v(e),"minBorderDistance",-.01),e.layers=[],e.elevationLayerIds=[],e.colorLayerIds=[],e.uniforms.elevationLayers=new Rc(new Array(TM[0]).fill(EM)),e.uniforms.elevationTextures=new Rc(new Array(TM[0]).fill(xM)),e.uniforms.elevationOffsetScales=new Rc(new Array(TM[0]).fill(wM)),e.uniforms.elevationTextureCount=new Rc(0),e.uniforms.colorLayers=new Rc(new Array(TM[1]).fill(EM)),e.uniforms.colorTextures=new Rc(new Array(TM[1]).fill(xM)),e.uniforms.colorOffsetScales=new Rc(new Array(TM[1]).fill(wM)),e.uniforms.colorTextureCount=new Rc(0);var o=e.visible;return Object.defineProperty(v(e),"visible",{get:function(){return o},set:function(e){o!=e&&(o=e,this.dispatchEvent({type:e?"shown":"hidden"}))}}),e}return A(n,[{key:"onBeforeCompile",value:function(e,t){t.capabilities.isWebGL2&&(this.defines.WEBGL2=!0,e.glslVersion="300 es")}},{key:"getUniformByType",value:function(e){return{layers:this.uniforms["".concat(e,"Layers")],textures:this.uniforms["".concat(e,"Textures")],offsetScales:this.uniforms["".concat(e,"OffsetScales")],textureCount:this.uniforms["".concat(e,"TextureCount")]}}},{key:"updateLayersUniforms",value:function(){var e=this,t=this.layers.filter((function(t){return e.colorLayerIds.includes(t.id)&&t.visible&&t.opacity>0}));if(t.sort((function(t,n){return e.colorLayerIds.indexOf(t.id)-e.colorLayerIds.indexOf(n.id)})),SM(this.getUniformByType("color"),t,this.defines.NUM_FS_TEXTURES),this.elevationLayerIds.some((function(t){return e.getLayer(t)}))||this.uniforms.elevationTextureCount.value&&!this.elevationLayerIds.length){var n=this.getElevationLayer()?[this.getElevationLayer()]:[];SM(this.getUniformByType("elevation"),n,this.defines.NUM_VS_TEXTURES)}this.layersNeedUpdate=!1}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"}),this.layers.forEach((function(e){return e.dispose(!0)})),this.layers.length=0,this.layersNeedUpdate=!0}},{key:"setSequence",value:function(e){this.colorLayerIds=e,this.layersNeedUpdate=!0}},{key:"setSequenceElevation",value:function(e){this.elevationLayerIds[0]=e,this.layersNeedUpdate=!0}},{key:"removeLayer",value:function(e){var t=this.layers.findIndex((function(t){return t.id===e}));if(t>-1){this.layers[t].dispose(),this.layers.splice(t,1);var n=this.colorLayerIds.indexOf(e);n>-1?this.colorLayerIds.splice(n,1):this.elevationLayerIds=[]}}},{key:"addLayer",value:function(e){e.layer.id in this.layers&&console.warn('The "{layer.id}" layer was already present in the material, overwritting.'),this.layers.push(e)}},{key:"getLayer",value:function(e){return this.layers.find((function(t){return t.id===e}))}},{key:"getLayers",value:function(e){return this.layers.filter((function(t){return e.includes(t.id)}))}},{key:"getElevationLayer",value:function(){var e=this;return this.layers.find((function(t){return t.id===e.elevationLayerIds[0]}))}},{key:"setElevationScale",value:function(e){this.elevationLayerIds.length&&(this.getElevationLayer().scale=e)}}]),n}(vl);function FM(e,t,n){var i=e.image,r=i.width,a=i.height,o=i.data;if(!o)return{min:null,max:null};var s=function(e,t,n){var i=t.x,r=t.y,a=t.z,o=[Fb({noDataValue:n},e,i,r),Fb({noDataValue:n},e,i+a,r),Fb({noDataValue:n},e,i+a,r+a),Fb({noDataValue:n},e,i,r+a)].filter((function(e){return null!=e&&e>-10}));if(o.length)return{min:Math.min.apply(Math,C(o)),max:Math.max.apply(Math,C(o))}}(e,t,n)||{max:-1/0,min:1/0},l=s.min,A=s.max,c=Math.floor(t.z*r);if(c>2)for(var h=Math.floor(t.z*a),u=Math.floor(t.x*r),d=Math.floor(t.y*a),f=Math.max(Math.floor(c/32),2),p=d+h,m=d;m-10&&y!=n&&(A=Math.max(A,y),l=Math.min(l,y))}return A===-1/0||l===1/0?{min:null,max:null}:{min:l,max:A}}function kM(e,t,n){var i=e%n/n,r=Math.floor(e/n)/n,a=t.x+i*t.z,o=t.y+r*t.w;return Math.floor(o*n)*n+Math.floor(a*n)}var PM=new ut,UM=function(e){h(n,e);var t=y(n);function n(e,i){var r;return s(this,n),(r=t.call(this)).layer=i,r.crs=i.parent.tileMatrixSets.indexOf(Jx.formatToTms(i.crs)),-1==r.crs&&console.error("Unknown crs:",i.crs),r.textures=[],r.offsetScales=[],r.level=-1,r.material=e,r._handlerCBEvent=function(){r.material.layersNeedUpdate=!0},i.addEventListener("visible-property-changed",r._handlerCBEvent),r}return A(n,[{key:"id",get:function(){return this.layer.id}},{key:"opacity",get:function(){return this.layer.opacity}},{key:"visible",get:function(){return this.layer.visible}},{key:"initFromParent",value:function(e,t){if(e&&e.level>this.level){var n,i=0,r=S(t);try{for(r.s();!(n=r.n()).done;){var a,o=n.value,s=S(e.textures);try{for(s.s();!(a=s.n()).done;){var l=a.value;if(o.isInside(l.extent)){this.setTexture(i++,l,o.offsetToParent(l.extent));break}}}catch(e){s.e(e)}finally{s.f()}}}catch(e){r.e(e)}finally{r.f()}__DEBUG__&&i!=t.length&&console.error("non-coherent result ".concat(i," vs ").concat(t.length,"."),t)}}},{key:"dispose",value:function(e){e&&(this.layer.removeEventListener("visible-property-changed",this._handlerCBEvent),this._listeners={});var t,n=S(this.textures);try{for(n.s();!(t=n.n()).done;){var i=t.value;i.isTexture&&i.dispose()}}catch(e){n.e(e)}finally{n.f()}this.level=-1,this.textures=[],this.offsetScales=[],this.material.layersNeedUpdate=!0}},{key:"setTexture",value:function(e,t,n){this.level=t&&0==e?t.extent.zoom:this.level,this.textures[e]=t||null,this.offsetScales[e]=n,this.material.layersNeedUpdate=!0}},{key:"setTextures",value:function(e,t){this.dispose(!1);for(var n=0,i=e.length;ni&&n[r-1]>i&&n[Math.sqrt(r)-1]>i&&n[r-Math.sqrt(r)]>i)||(e.extent.offsetToParent(a.extent,PM),function(e,t,n,i){for(var r=0,a=e.length;r2&&void 0!==arguments[2]?arguments[2]:{};return-1==t?n.zoom?n.zoom.min:0:Math.min(e,Math.ceil((t+e)/2))}function GM(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.level,r=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,s=a.source.zoom?a.source.zoom.max:1/0;if(o.lowestLevelError!=1/0)n=QM(o.lowestLevelError,r,a.source),n=o.lowestLevelError==n?n-1:n,1==e&&(n=NM(n,a.updateStrategy.options));else{switch(e){case 1:n=NM(i,a.updateStrategy.options);break;case 2:n=zM(i,r,a.updateStrategy.options);break;case 3:n=QM(i,r,a.source);break;default:n=OM(t,i,r)}n=Math.min(n,s)}return n}var HM,VM=function(){function e(t){s(this,e),this.layer=t}return A(e,[{key:"clear",value:function(){}},{key:"update",value:function(){}}]),e}(),jM=function(e){h(n,e);var t=y(n);function n(e){var i;return s(this,n),(i=t.call(this,e)).displayed={tiles:new Set},Object.defineProperty(i.displayed,"layers",{get:function(){var e=[];return i.displayed.tiles.forEach((function(t){var n=t.material;e=C(new Set([].concat(C(e),C(n.colorLayerIds.filter((function(e){return n.getLayer(e)}))),C(n.elevationLayerIds))))})),i.layer.attachedLayers.filter((function(t){return e.includes(t.id)}))}}),Object.defineProperty(i.displayed,"extent",{get:function(){var e=new bb(i.layer.extent.crs,1/0,-1/0,1/0,-1/0);return e.min=1/0,e.max=-1/0,i.displayed.tiles.forEach((function(t){e.union(t.extent),e.min=Math.min(t.obb.z.min,e.min),e.max=Math.max(t.obb.z.max,e.max)})),e}}),i}return A(n,[{key:"clear",value:function(){this.displayed.tiles.clear()}},{key:"update",value:function(e){e.material.visible?this.displayed.tiles.add(e):this.displayed.tiles.delete(e)}}]),n}(VM),WM={INFINITE:1/0,TEXTURE:9e5,GEOMETRY:9e5},XM=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:WM.INFINITE;s(this,e),this.lifeTime=t,this.lastTimeFlush=Date.now(),this.data=new Map}return A(e,[{key:"getByArray",value:function(e){return this.get(e[0],e[1],e[2])}},{key:"setByArray",value:function(e,t){return this.set(e,t[0],t[1],t[2])}},{key:"get",value:function(e,t,n){var i=this.data.get(e);if(null!=i){if(null!=i.lastTimeUsed)HM=i;else{var r=i.get(t);if(null==r)return;if(null!=r.lastTimeUsed)HM=r;else{var a=r.get(n);if(null==a)return;HM=a}}return HM.value?(HM.lastTimeUsed=Date.now(),HM.value):void 0}}},{key:"set",value:function(e,t,n,i){if(HM={value:e,lastTimeUsed:Date.now()},null==n)return this.data.set(t,HM),e;this.data.get(t)||this.data.set(t,new Map);var r=this.data.get(t);return null==i?(r.set(n,HM),e):(r.get(n)||r.set(n,new Map),r.get(n).set(i,HM),e)}},{key:"delete",value:function(e,t,n){var i=this.data.get(e);if(void 0!==i)if(null!=i.lastTimeUsed)this.data.get(e),this.data.delete(e);else{var r=i.get(t);if(void 0===r)return;if(null!=r.lastTimeUsed)i.get(t),i.delete(t),0==i.size&&this.data.delete(e);else{if(void 0===r.get(n))return;r.get(n),r.delete(n),0==r.size&&(i.delete(t),0==i.size&&this.data.delete(e))}}}},{key:"clear",value:function(){this.data.clear()}},{key:"flush",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now();this.lifeTime==WM.INFINITE||this.lifeTime>t-this.lastTimeFlush||!this.data.size||(this.lastTimeFlush=1/0,this.data.forEach((function(n,i){e.lifeTime1&&void 0!==arguments[1]?arguments[1]:{};return fetch(e,t).then((function(e){return ZM(e),e.arrayBuffer()}))};function qM(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t){var n=new Hi(e,KM,KM,me,ne);return n.internalFormat="R32F",n}return new Hi(e,KM,KM,le,ne)}var $M={text:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(fetch)return fetch(e,t).then((function(e){return ZM(e),e.text()}));console.log("fetch is not defind")},json:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(fetch)return fetch(e,t).then((function(e){return ZM(e),e.json()}));console.log("fetch is not defind")},xml:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(fetch)return fetch(e,t).then((function(e){return ZM(e),e.text()})).then((function(e){return(new window.DOMParser).parseFromString(e,"text/xml")}));console.log("fetch is not defind")},texture:function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};YM.crossOrigin=i.crossOrigin;var r=new Promise((function(e,i){t=e,n=i}));return YM.load(e,t,(function(){}),n),r},arrayBuffer:JM,textureFloat:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return JM(e,t).then((function(e){return qM(new Float32Array(e),t.isWebGL2)}))},multiple:function(e,t){var n,i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[];for(var o in t){if(!this[o])throw new Error("".concat(o," is not a valid Fetcher method."));var s,l=S(t[o]);try{var A=function(){var t=s.value;n="".concat(e,".").concat(t),a.push(i[o](n,r).then((function(e){return{type:t,result:e}})))};for(l.s();!(s=l.n()).done;)A()}catch(e){l.e(e)}finally{l.f()}}return Promise.all(a).then((function(e){var t,n={},i=S(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;n[r.type]=r.result}}catch(e){i.e(e)}finally{i.f()}return Promise.resolve(n)}))}},eC=new XM,tC={};function nC(e,t,n,i){n[e]=n[e]||{};var r,a=S(tC[e]);try{for(a.s();!(r=a.n()).done;){var o=r.value,s=rC(t[e][o],i);void 0!==s&&(n[e][o]=s)}}catch(e){a.e(e)}finally{a.f()}}function iC(e){if(!e)return{};if(e.stops||e.expression)return{color:e};if("string"==typeof e){var t=e.match(/(?:((hsl|rgb)a? *\(([\d.%]+(?:deg|g?rad|turn)?)[ ,]*([\d.%]+)[ ,]*([\d.%]+)[ ,/]*([\d.%]*)\))|(#((?:[\d\w]{3}){1,2})([\d\w]{1,2})?))/i);if(!t)return{color:e,opacity:1};if(t[7]){var n=1;return t[9]&&(n=.00392156862745098*parseInt(1==t[9].length?"".concat(t[9]).concat(t[9]):t[9],16)),{color:"#".concat(t[8]),opacity:n}}if(t[0])return{color:"".concat(t[2],"(").concat(t[3],",").concat(t[4],",").concat(t[5],")"),opacity:Number(t[6])||1}}}function rC(e,t){if(null!=e){if(e.expression)return e.expression.evaluate(t);if(e.stops){for(var n=e.stops.length-1;n>=0;n--){var i=e.stops[n];if(t.globals.zoom>=i[0])return i[1]}return e.stops[0][1]}return e}}function aC(e,t){var n=document.createElement("img"),i=document.createElement("canvas");if("string"==typeof e)n.src=e;else if(e&&e[t]){var r=e[t];i.width=r.width,i.height=r.height,i.getContext("2d").drawImage(e.img,r.x,r.y,r.width,r.height,0,0,r.width,r.height),n.src=i.toDataURL("image/png")}return n}var oC={left:[0,-.5],right:[-1,-.5],top:[-.5,0],bottom:[-.5,-1],"top-right":[-1,0],"bottom-left":[0,-1],"bottom-right":[-1,-1],center:[-.5,-.5],"top-left":[0,0]};function sC(e,t,n,i,r){var a;Object.defineProperty(e[t],n,{enumerable:!0,get:function(){return void 0===a?e.parent[t][n]||r:a},set:function(e){a=e}}),e[t][n]=i}var lC=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;s(this,e),this.isStyle=!0,this.order=0,this.parent=i||{zoom:{},fill:{},stroke:{},point:{},text:{}},n.zoom=n.zoom||{},n.fill=n.fill||{},n.stroke=n.stroke||{},n.point=n.point||{},n.text=n.text||{},this.zoom={},sC(this,"zoom","min",n.zoom.min),sC(this,"zoom","max",n.zoom.max),this.fill={},sC(this,"fill","color",n.fill.color),sC(this,"fill","opacity",n.fill.opacity,1),sC(this,"fill","pattern",n.fill.pattern),"string"==typeof this.fill.pattern&&$M.texture(this.fill.pattern).then((function(e){t.fill.pattern=e.image})),this.stroke={},sC(this,"stroke","color",n.stroke.color),sC(this,"stroke","opacity",n.stroke.opacity,1),sC(this,"stroke","width",n.stroke.width,1),sC(this,"stroke","dasharray",n.stroke.dasharray,[]),this.point={},sC(this,"point","color",n.point.color),sC(this,"point","line",n.point.line),sC(this,"point","opacity",n.point.opacity,1),sC(this,"point","radius",n.point.radius,2),sC(this,"point","width",n.point.width,0),this.text={},sC(this,"text","field",n.text.field),sC(this,"text","zOrder",n.text.zOrder,"auto"),sC(this,"text","color",n.text.color,"#000000"),sC(this,"text","anchor",n.text.anchor,"center"),sC(this,"text","offset",n.text.offset,[0,0]),sC(this,"text","padding",n.text.padding,2),sC(this,"text","size",n.text.size,16),sC(this,"text","placement",n.text.placement,"point"),sC(this,"text","rotation",n.text.rotation,"auto"),sC(this,"text","wrap",n.text.wrap,10),sC(this,"text","spacing",n.text.spacing,0),sC(this,"text","transform",n.text.transform,"none"),sC(this,"text","justify",n.text.justify,"center"),sC(this,"text","opacity",n.text.opacity,1),sC(this,"text","font",n.text.font,["Open Sans Regular","Arial Unicode MS Regular","sans-serif"]),sC(this,"text","haloColor",n.text.haloColor,"#000000"),sC(this,"text","haloWidth",n.text.haloWidth,0),sC(this,"text","haloBlur",n.text.haloBlur,0)}return A(e,[{key:"drawingStylefromContext",value:function(e){var t={};if((this.fill.color||this.fill.pattern)&&nC("fill",this,t,e),this.stroke.color&&nC("stroke",this,t,e),this.point.color&&nC("point",this,t,e),Object.keys(t).length)return t}},{key:"symbolStylefromContext",value:function(t){var n=new e;return nC("text",this,n,t),this.icon&&nC("icon",this,n,t),n}},{key:"copy",value:function(e){return Object.assign(this.fill,e.fill),Object.assign(this.stroke,e.stroke),Object.assign(this.point,e.point),Object.assign(this.text,e.text),this}},{key:"clone",value:function(){var t=new e;return t.copy(this)}},{key:"setFromGeojsonProperties",value:function(e,t){return t===pC.POINT?(this.point.color=e.fill,this.point.opacity=e["fill-opacity"],this.point.line=e.stroke,this.point.radius=e.radius,this.text.color=e["label-color"],this.text.opacity=e["label-opacity"],this.text.size=e["label-size"],e.icon&&(this.icon={image:e.icon,size:1})):(this.stroke.color=e.stroke,this.stroke.width=e["stroke-width"],this.stroke.opacity=e["stroke-opacity"],t!==pC.LINE&&(this.fill.color=e.fill,this.fill.opacity=e["fill-opacity"])),this}},{key:"setFromVectorTileLayer",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.layout=e.layout||{},e.paint=e.paint||{},this.order=n,"fill"!==e.type||this.fill.color)if("line"!==e.type||this.stroke.color){if("circle"===e.type||i){var r=iC(void e.paint["circle-color"]),a=r.color,o=r.opacity;this.point.color=a,this.point.opacity=o,this.point.radius=void e.paint["circle-radius"]}else if("symbol"===e.type){this.text.zOrder=void e.layout["symbol-z-order"],"auto"==this.text.zOrder?this.text.zOrder=void e.layout["symbol-sort-key"]||"Y":"viewport-y"==this.text.zOrder?this.text.zOrder="Y":"source"==this.text.zOrder&&(this.text.zOrder=0),this.text.anchor=void e.layout["text-anchor"],this.text.offset=void e.layout["text-offset"],this.text.padding=void e.layout["text-padding"],this.text.size=void e.layout["text-size"],this.text.placement=void e.layout["symbol-placement"],this.text.rotation=void e.layout["text-rotation-alignment"],this.text.field=void e.layout["text-field"],this.text.wrap=void e.layout["text-max-width"],this.text.spacing=void e.layout["text-letter-spacing"],this.text.transform=void e.layout["text-transform"],this.text.justify=void e.layout["text-justify"];var s=iC(void e.paint["text-color"]),l=s.color,A=s.opacity;this.text.color=l,this.text.opacity=void e.paint["text-opacity"]||void 0!==A&&A,this.text.font=void e.layout["text-font"];var c=void e.paint["text-halo-color"];c&&(this.text.haloColor=c.color||c,this.text.haloWidth=void e.paint["text-halo-width"],this.text.haloBlur=void e.paint["text-halo-blur"]);var h=void e.layout["icon-image"];h&&(this.icon={key:h},this.icon.size=void e.layout["icon-size"]||1)}}else{var u=void e.paint["line-color"],d=iC(u),f=d.color,p=d.opacity;this.stroke.dasharray=void e.paint["line-dasharray"],this.stroke.color=f,this.stroke.lineCap=e.layout["line-cap"],this.stroke.width=void e.paint["line-width"],this.stroke.opacity=void e.paint["line-opacity"]||p}else{var m=iC(void(e.paint["fill-color"]||e.paint["fill-pattern"])),v=m.color,g=m.opacity;if(this.fill.color=v,this.fill.opacity=void e.paint["fill-opacity"]||g,e.paint["fill-pattern"]&&t&&(this.fill.pattern=aC(t,e.paint["fill-pattern"])),e.paint["fill-outline-color"]){var y=iC(void e.paint["fill-outline-color"]),w=y.color,x=y.opacity;this.stroke.color=w,this.stroke.opacity=x,this.stroke.width=1,this.stroke.dasharray=[]}}return this}},{key:"applyToHTML",value:function(e,t){var n=this;if(e.style.padding="".concat(this.text.padding,"px"),e.style.maxWidth="".concat(this.text.wrap,"em"),e.style.color=this.text.color,this.text.size>0&&(e.style.fontSize="".concat(this.text.size,"px")),e.style.fontFamily=this.text.font.join(","),e.style.textTransform=this.text.transform,e.style.letterSpacing="".concat(this.text.spacing,"em"),e.style.textAlign=this.text.justify,e.style["white-space"]="pre-line",this.text.haloWidth>0&&(e.style.setProperty("--text_stroke_display","block"),e.style.setProperty("--text_stroke_width","".concat(this.text.haloWidth,"px")),e.style.setProperty("--text_stroke_color",this.text.haloColor),e.setAttribute("data-before",e.textContent)),this.icon){var i=this.icon.image,r=this.icon.size,a=this.icon.key,o=eC.get(i||a,r);o||((o=a&&t?aC(t,a):aC(i)).style.position="absolute",eC.set(o,i||a,r));var s=function t(){var i=o.cloneNode();switch(i.width*=r,i.height*=r,n.text.anchor){case"left":i.style.right="calc(100% - ".concat(.5*i.width,"px)"),i.style.top="calc(50% - ".concat(.5*i.height,"px)");break;case"right":i.style.top="calc(50% - ".concat(.5*i.height,"px)");break;case"top":i.style.right="calc(50% - ".concat(.5*i.width,"px)");break;case"bottom":i.style.top="calc(100% - ".concat(.5*i.height,"px)"),i.style.right="calc(50% - ".concat(.5*i.width,"px)");break;case"bottom-left":i.style.top="calc(100% - ".concat(.5*i.height,"px)"),i.style.right="calc(100% - ".concat(.5*i.width,"px)");break;case"bottom-right":i.style.top="calc(100% - ".concat(.5*i.height,"px)");break;case"top-left":i.style.right="calc(100% - ".concat(.5*i.width,"px)");break;case"top-right":break;default:i.style.top="calc(50% - ".concat(.5*i.height,"px)"),i.style.right="calc(50% - ".concat(.5*i.width,"px)")}i.style["z-index"]=-1,e.appendChild(i),o.removeEventListener("load",t)};o.complete?s():o.addEventListener("load",s)}}},{key:"getTextAnchorPosition",value:function(){return oC[this.text.anchor]}},{key:"getTextFromProperties",value:function(e){return this.text.field.expression?rC(this.text.field,e):this.text.field.replace(/\{(.+?)\}/g,(function(t,n){return e.properties()[n]||""})).trim()}}]),e}(),AC={itowns_stroke_single_before:".itowns-stroke-single:before {\n display: var(--text_stroke_display);\n content: attr(data-before);\n opacity: 1;\n position: absolute;\n -webkit-text-stroke-width: var(--text_stroke_width);\n -webkit-text-stroke-color: var(--text_stroke_color);\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n z-index: -1;\n white-space: inherit;\n overflow-wrap: inherit;\n letter-spacing: inherit;\n text-align: inherit;\n padding: inherit;\n font-family: inherit;\n text-transform: inherit;\n max-width: inherit;\n font-size: inherit;\n}\n"},cC=document.createElement("style");cC.type="text/css",Object.keys(AC).forEach((function(e){cC.innerHTML+="".concat(AC[e],"\n\n")})),document.getElementsByTagName("head")[0].appendChild(cC);var hC=new lC;function uC(e){return new bb(e,1/0,-1/0,1/0,-1/0)}tC.fill=Object.keys(hC.fill),tC.stroke=Object.keys(hC.stroke),tC.point=Object.keys(hC.point),tC.text=Object.keys(hC.text),tC.icon=["image","size","key"];var dC=new ob("EPSG:4326",0,0,0),fC=new at(0,0,1),pC={POINT:0,LINE:1,POLYGON:2},mC=function(){function e(t){s(this,e),this.indices=[],this.properties={},this.size=t.size,t.extent&&(this.extent=uC(t.extent.crs),this._currentExtent=uC(t.extent.crs))}return A(e,[{key:"startSubGeometry",value:function(e,t){var n=this.indices.length-1,i=this.extent?uC(this.extent.crs):void 0,r=n>-1?this.indices[n].offset+this.indices[n].count:t.vertices.length/this.size;this.indices.push({offset:r,count:e,extent:i}),this._currentExtent=i,function(e,t){e.vertices.length+=t*e.size,e.normals&&(e.normals.length=e.vertices.length)}(t,e)}},{key:"closeSubGeometry",value:function(e,t){var n=this.indices.length-1,i=n>-1?this.indices[n].offset+this.indices[n].count:t.vertices.length/this.size-e;this.indices.push({offset:i,count:e,extent:this._currentExtent}),this.extent&&(this.extent.union(this._currentExtent),this._currentExtent=uC(this.extent.crs))}},{key:"getLastSubGeometry",value:function(){var e=this.indices.length-1;return this.indices[e]}},{key:"pushCoordinates",value:function(e,t){e.as(t.crs,dC),t.normals&&dC.geodesicNormal.toArray(t.normals,t._pos),t._pushValues(dC.x,dC.y,dC.z),this._currentExtent&&this._currentExtent.expandByCoordinates(t.useCrsOut?dC:e)}},{key:"pushCoordinatesValues",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:fC;e.normals&&r.toArray(e.normals,e._pos),e._pushValues(t,n,i),this._currentExtent&&this._currentExtent.expandByValuesCoordinates(t,n,i)}},{key:"updateExtent",value:function(){if(this.extent){var e=this.indices[this.indices.length-1];e&&this.extent.union(e.extent)}}}]),e}();function vC(e,t){this.vertices[this._pos++]=e,this.vertices[this._pos++]=t}function gC(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.vertices[this._pos++]=e,this.vertices[this._pos++]=t,this.vertices[this._pos++]=n}var yC=function(){function e(t,n){if(s(this,e),!Object.keys(pC).find((function(e){return pC[e]===t})))throw new Error("Unsupported Feature type: ".concat(t));this.type=t,this.geometries=[],this.vertices=[],this.crs=n.crs,this.size=n.size,this.normals=3==n.size?[]:void 0,n.extent&&(this.extent=uC(n.extent.crs),this.useCrsOut=!n.forceExtentCrs),this._pos=0,this._pushValues=(3===this.size?gC:vC).bind(this),this.style=new lC({},n.style)}return A(e,[{key:"bindNewGeometry",value:function(){var e=new mC(this);return this.geometries.push(e),e}},{key:"updateExtent",value:function(e){this.extent&&this.extent.union(e.extent)}},{key:"geometryCount",get:function(){return this.geometries.length}}]),e}(),wC=function(){function e(t){s(this,e),this.isFeatureCollection=!0,this.crs=Jx.formatToEPSG(t.crs),this.features=[],this.mergeFeatures=void 0===t.mergeFeatures||t.mergeFeatures,this.extent=t.buildExtent?uC(t.forcedExtentCrs||this.crs):void 0,this.translation=new at,this.scale=new at(1,1,1),this.size="3d"==t.structure?3:2,this.filterExtent=t.filterExtent,this.overrideAltitudeInToZero=t.overrideAltitudeInToZero,this.style=t.style}return A(e,[{key:"updateExtent",value:function(e){if(this.extent){var t,n=S(e?[e]:this.features.map((function(e){return e.extent})));try{for(n.s();!(t=n.n()).done;){var i=t.value;this.extent.union(i)}}catch(e){n.e(e)}finally{n.f()}}}},{key:"removeEmptyFeature",value:function(){this.features=this.features.filter((function(e){return e.geometries.length}))}},{key:"pushFeature",value:function(e){this.features.push(e),this.updateExtent(e.extent)}},{key:"requestFeature",value:function(e,t){var n=this.features.find(t);if(n&&this.mergeFeatures)return n;var i=new yC(e,this);return this.features.push(i),i}},{key:"requestFeatureByType",value:function(e){return this.requestFeature(e,(function(t){return t.type===e}))}},{key:"requestFeatureById",value:function(e,t){return this.requestFeature(t,(function(t){return t.id===e}))}},{key:"newFeatureByReference",value:function(e){var t=new yC(e.type,this);return t.extent=e.extent,t.geometries=e.geometries,t.normals=e.normals,t.size=e.size,t.vertices=e.vertices,t._pos=e._pos,this.features.push(t),t}},{key:"transformCoordinates",value:function(e){return e.x=e.x/this.scale.x-this.translation.x,e.y=e.y/this.scale.y-this.translation.y,e.z=e.z/this.scale.z-this.translation.z,e}},{key:"setParentStyle",value:function(e){e&&this.features.forEach((function(t){t.style.parent=e}))}}]),e}(),xC=function(e){if(e.crsOut||e.crsIn){console.warn("Parsing options with crsIn and crsOut are deprecates, use { in, out } structure.");var t={in:{},out:{}};return t.in.crs=e.crsIn,t.in.isInverted=e.isInverted,t.in.styles=e.styles,t.in.layers=e.layers,t.in.filter=e.filter,t.out.crs=e.crsOut,t.out.mergeFeatures=e.mergeFeatures,t.out.withNormal=e.withNormal,t.out.withAltitude=e.withAltitude,e.out.withAltitude&&e.out.withNormal?t.structure="3d":t.structure="2d",t.out.filteringExtent=e.filteringExtent,t.out.style=e.style,t.out.overrideAltitudeInToZero=e.overrideAltitudeInToZero,t.out.filter=e.filter,t}return!e.out||void 0===e.out.withAltitude&&void 0===e.out.withNormal||(console.warn("Parsing options out.withAltitude and out.withNormal are deprecates, use out.structure: 2d or 3d."),e.out.withAltitude&&e.out.withNormal?e.structure="3d":e.structure="2d"),e};function bC(e){if(e.crs){if("epsg"==e.crs.type.toLowerCase())return"EPSG:".concat(e.crs.properties.code);if("name"==e.crs.type.toLowerCase()){var t=e.crs.properties.name.toLowerCase().indexOf("epsg:");if(t>=0){var n=e.crs.properties.name.indexOf(":",t+5);if(n>0)return"EPSG:".concat(e.crs.properties.name.substr(n+1))}}throw new Error("Unsupported CRS type '".concat(e.crs,"'"))}return"EPSG:4326"}var MC=new ob("EPSG:4978",0,0,0),CC=function(e,t,n){return MC.crs=n,MC.setFromArray(t[0]),!e.isPointInside(MC)},BC={populateGeometry:function(e,t,n,i,r){n.startSubGeometry(t.length,r);var a,o=!i.overrideAltitudeInToZero&&3==i.size&&"number"==typeof t[0][2],s=S(t);try{for(s.s();!(a=s.n()).done;){var l=a.value;MC.crs=e,MC.setFromValues(l[0],l[1],o?l[2]:0),n.pushCoordinates(MC,r)}}catch(e){s.e(e)}finally{s.f()}n.updateExtent()},point:function(e,t,n,i,r){this.default(e,t,[n],i,r)},default:function(e,t,n,i,r){if(!i.filterExtent||!CC(i.filterExtent,n,t)){var a=e.bindNewGeometry();a.properties=r,a.properties.style=new lC({},e.style).setFromGeojsonProperties(r,e.type),this.populateGeometry(t,n,a,i,e),e.updateExtent(a)}},polygon:function(e,t,n,i,r){if(!i.filterExtent||!CC(i.filterExtent,n[0],t)){var a=e.bindNewGeometry();a.properties=r,a.properties.style=new lC({},e.style).setFromGeojsonProperties(r,e.type);for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};(t=xC(t)).in=t.in||{};var n=t.out,i=t.in;switch("string"==typeof e&&(e=JSON.parse(e)),i.crs=i.crs||bC(e),n.filteringExtent&&("boolean"==typeof n.filteringExtent?n.filterExtent=e.extent.as(i.crs):n.filteringExtent.isExtent&&(n.filterExtent=n.filteringExtent)),e.type.toLowerCase()){case"featurecollection":return Promise.resolve(TC(i.crs,e.features,n));case"feature":return Promise.resolve(TC(i.crs,[e],n));default:throw new Error("Unsupported GeoJSON type: '".concat(e.type))}}};function IC(e,t){return Array.from(e.getElementsByTagName(t))}function LC(e){return"#"===e[0]?e:`#${e}`}function FC(e){return e?.normalize(),e&&e.textContent||""}function kC(e,t,n){const i=e.getElementsByTagName(t),r=i.length?i[0]:null;return r&&n&&n(r),r}function PC(e,t,n){const i={};if(!e)return i;const r=e.getElementsByTagName(t),a=r.length?r[0]:null;return a&&n?n(a,i):i}function UC(e,t,n){const i=FC(kC(e,t));return i&&n&&n(i)||{}}function DC(e,t,n){const i=parseFloat(FC(kC(e,t)));if(!isNaN(i))return i&&n&&n(i)||{}}function RC(e,t,n){const i=parseFloat(FC(kC(e,t)));if(!isNaN(i))return i&&n&&n(i),i}function OC(e,t){const n={};for(const i of t)UC(e,i,(e=>{n[i]=e}));return n}function NC(e){return 1===e?.nodeType}function zC(e){return PC(e,"line",(e=>{const t=Object.assign({},UC(e,"color",(e=>({stroke:`#${e}`}))),DC(e,"opacity",(e=>({"stroke-opacity":e}))),DC(e,"width",(e=>({"stroke-width":96*e/25.4}))));return t}))}function QC(e){let t=[];if(null===e)return t;for(const n of Array.from(e.childNodes)){if(!NC(n))continue;const e=GC(n.nodeName);if("gpxtpx:TrackPointExtension"===e)t=t.concat(QC(n));else{const i=FC(n);t.push([e,HC(i)])}}return t}function GC(e){return["heart","gpxtpx:hr","hr"].includes(e)?"heart":e}function HC(e){const t=parseFloat(e);return isNaN(t)?e:t}function VC(e){const t=[parseFloat(e.getAttribute("lon")||""),parseFloat(e.getAttribute("lat")||"")];if(isNaN(t[0])||isNaN(t[1]))return null;RC(e,"ele",(e=>{t.push(e)}));const n=kC(e,"time");return{coordinates:t,time:n?FC(n):null,extendedValues:QC(kC(e,"extensions"))}}function jC(e){const t=OC(e,["name","cmt","desc","type","time","keywords"]),n=Array.from(e.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*"));for(const i of n)i.parentNode?.parentNode===e&&(t[i.tagName.replace(":","_")]=FC(i));const i=IC(e,"link");return i.length&&(t.links=i.map((e=>Object.assign({href:e.getAttribute("href")},OC(e,["text","type"]))))),t}function WC(e,t){const n=IC(e,t),i=[],r=[],a={};for(let e=0;e1,o=Object.assign({_gpxType:"trk"},jC(e),zC(kC(e,"extensions")),i.length?{coordinateProperties:{times:a?i:i[0]}}:{});for(const e of r){n.push(e.line),o.coordinateProperties||(o.coordinateProperties={});const t=o.coordinateProperties,i=Object.entries(e.extendedValues);for(let e=0;enew Array(e.line.length).fill(null)))),t[n][e]=o):t[n]=o}}return{type:"Feature",properties:o,geometry:a?{type:"MultiLineString",coordinates:n}:{type:"LineString",coordinates:n[0]}}}function KC(e){const t=Object.assign(jC(e),OC(e,["sym"])),n=VC(e);return n?{type:"Feature",properties:t,geometry:{type:"Point",coordinates:n.coordinates}}:null}function*ZC(e){for(const t of IC(e,"trk")){const e=YC(t);e&&(yield e)}for(const t of IC(e,"rte")){const e=XC(t);e&&(yield e)}for(const t of IC(e,"wpt")){const e=KC(t);e&&(yield e)}}function JC(e,t){const n={},i="stroke"==t||"fill"===t?t:t+"-color";return"#"===e[0]&&(e=e.substring(1)),6===e.length||3===e.length?n[i]="#"+e:8===e.length&&(n[t+"-opacity"]=parseInt(e.substring(0,2),16)/255,n[i]="#"+e.substring(6,8)+e.substring(4,6)+e.substring(2,4)),n}function qC(e,t,n){const i={};return RC(e,t,(e=>{i[n]=e})),i}function $C(e,t){return PC(e,"color",(e=>JC(FC(e),t)))}function eB(e){return Object.assign({},function(e){return PC(e,"PolyStyle",((e,t)=>Object.assign(t,PC(e,"color",(e=>JC(FC(e),"fill"))),UC(e,"fill",(e=>{if("0"===e)return{"fill-opacity":0}})),UC(e,"outline",(e=>{if("0"===e)return{"stroke-opacity":0}})))))}(e),function(e){return PC(e,"LineStyle",(e=>Object.assign($C(e,"stroke"),qC(e,"width","stroke-width"))))}(e),function(e){return PC(e,"LabelStyle",(e=>Object.assign($C(e,"label"),qC(e,"scale","label-scale"))))}(e),function(e){return PC(e,"IconStyle",(e=>Object.assign($C(e,"icon"),qC(e,"scale","icon-scale"),qC(e,"heading","icon-heading"),PC(e,"hotSpot",(e=>{const t=parseFloat(e.getAttribute("x")||""),n=parseFloat(e.getAttribute("y")||""),i=e.getAttribute("xunits")||"",r=e.getAttribute("yunits")||"";return isNaN(t)||isNaN(n)?{}:{"icon-offset":[t,n],"icon-offset-units":[i,r]}})),PC(e,"Icon",((e,t)=>(UC(e,"href",(e=>{t.icon=e})),t))))))}(e))}const tB=/\s*/g,nB=/^\s*|\s*$/g,iB=/\s+/;function rB(e){return e.replace(tB,"").split(",").map(parseFloat).filter((e=>!isNaN(e))).slice(0,3)}function aB(e){return e.replace(nB,"").split(iB).map(rB).filter((e=>e.length>=2))}function oB(e){let t=IC(e,"coord");var n,i,r;0===t.length&&(n=e,i="coord",r="*",t=Array.from(n.getElementsByTagNameNS(r,i)));const a=t.map((e=>FC(e).split(" ").map(parseFloat)));return 0===a.length?null:{geometry:a.length>2?{type:"LineString",coordinates:a}:{type:"Point",coordinates:a[0]},times:IC(e,"when").map((e=>FC(e)))}}function sB(e){if(0===e.length)return e;const t=e[0],n=e[e.length-1];let i=!0;for(let e=0;e=2&&t.push({type:"Point",coordinates:e});break}case"LineString":{const e=aB(AB(r));e.length>=2&&t.push({type:"LineString",coordinates:e});break}case"Polygon":{const e=[];for(const t of IC(r,"LinearRing")){const n=sB(aB(AB(t)));n.length>=4&&e.push(n)}e.length&&t.push({type:"Polygon",coordinates:e});break}case"Track":case"gx:Track":{const e=oB(r);if(!e)break;const{times:i,geometry:a}=e;t.push(a),i.length&&n.push(i);break}}return{geometries:t,coordTimes:n}}function hB(e){return PC(e,"ExtendedData",((e,t)=>{for(const n of IC(e,"Data"))t[n.getAttribute("name")||""]=FC(kC(n,"value"));for(const n of IC(e,"SimpleData"))t[n.getAttribute("name")||""]=FC(n);return t}))}function uB(e){return 0===e.length?null:1===e.length?e[0]:{type:"GeometryCollection",geometries:e}}function dB(e){return PC(e,"TimeSpan",(e=>({timespan:{begin:FC(kC(e,"begin")),end:FC(kC(e,"end"))}})))}function fB(e){return PC(e,"TimeStamp",(e=>({timestamp:FC(kC(e,"when"))})))}function pB(e,t){return UC(e,"styleUrl",(e=>(e=LC(e),t[e]?Object.assign({styleUrl:e},t[e]):{styleUrl:e})))}function mB(e){const t=kC(e,"description");for(const e of Array.from(t?.childNodes||[]))if(4===e.nodeType)return{description:{"@type":"html",value:FC(e)}};return{}}function vB(e,t){const{coordTimes:n,geometries:i}=cB(e),r={type:"Feature",geometry:uB(i),properties:Object.assign(OC(e,["name","address","visibility","open","phoneNumber","description"]),mB(e),pB(e,t),eB(e),hB(e),dB(e),fB(e),n.length?{coordinateProperties:{times:1===n.length?n[0]:n}}:{})};void 0!==r.properties?.visibility&&(r.properties.visibility="0"!==r.properties.visibility);const a=e.getAttribute("id");return null!==a&&""!==a&&(r.id=a),r}function gB(e){let t=e.getAttribute("id");const n=e.parentNode;return!t&&NC(n)&&"CascadingStyle"===n.localName&&(t=n.getAttribute("kml:id")||n.getAttribute("id")),LC(t||"")}function*yB(e){const t=function(e){const t={};for(const n of IC(e,"Style"))t[gB(n)]=eB(n);for(const n of IC(e,"StyleMap")){const e=LC(n.getAttribute("id")||"");UC(n,"styleUrl",(n=>{n=LC(n),t[n]&&(t[e]=t[n])}))}return t}(e);for(const n of IC(e,"Placemark")){const e=vB(n,t);e&&(yield e)}}var wB={parse:function(e,t){return t=xC(t),_C.parse((n=e,{type:"FeatureCollection",features:Array.from(yB(n))}),t);var n}},xB={parse:function(e,t){return t=xC(t),_C.parse((n=e,{type:"FeatureCollection",features:Array.from(ZC(n))}),t);var n}},bB=function(e,t,n,i,r){var a,o,s=8*r-i-1,l=(1<>1,c=-7,h=n?r-1:0,u=n?-1:1,d=e[t+h];for(h+=u,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+e[t+h],h+=u,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=i;c>0;o=256*o+e[t+h],h+=u,c-=8);if(0===a)a=1-A;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),a-=A}return(d?-1:1)*o*Math.pow(2,a-i)},MB=function(e,t,n,i,r,a){var o,s,l,A=8*a-r-1,c=(1<>1,u=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,f=i?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+h>=1?u/l:u*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(t*l-1)*Math.pow(2,r),o+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,r),o=0));r>=8;e[n+d]=255&s,d+=f,s/=256,r-=8);for(o=o<0;e[n+d]=255&o,d+=f,o/=256,A-=8);e[n+d-f]|=128*p},CB=BB;function BB(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}BB.Varint=0,BB.Fixed64=1,BB.Bytes=2,BB.Fixed32=5;var EB=4294967296,SB=1/EB,TB="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function _B(e){return e.type===BB.Bytes?e.readVarint()+e.pos:e.pos+1}function IB(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function LB(e,t,n){var i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(i);for(var r=n.pos-1;r>=e;r--)n.buf[r+i]=n.buf[r]}function FB(e,t){for(var n=0;n>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function HB(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}BB.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos>3,a=this.pos;this.type=7&i,e(r,t,this),this.pos===a&&this.skip(i)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=QB(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=HB(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=QB(this.buf,this.pos)+QB(this.buf,this.pos+4)*EB;return this.pos+=8,e},readSFixed64:function(){var e=QB(this.buf,this.pos)+HB(this.buf,this.pos+4)*EB;return this.pos+=8,e},readFloat:function(){var e=bB(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=bB(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,n,i=this.buf;return t=127&(n=i[this.pos++]),n<128?t:(t|=(127&(n=i[this.pos++]))<<7,n<128?t:(t|=(127&(n=i[this.pos++]))<<14,n<128?t:(t|=(127&(n=i[this.pos++]))<<21,n<128?t:function(e,t,n){var i,r,a=n.buf;if(r=a[n.pos++],i=(112&r)>>4,r<128)return IB(e,i,t);if(r=a[n.pos++],i|=(127&r)<<3,r<128)return IB(e,i,t);if(r=a[n.pos++],i|=(127&r)<<10,r<128)return IB(e,i,t);if(r=a[n.pos++],i|=(127&r)<<17,r<128)return IB(e,i,t);if(r=a[n.pos++],i|=(127&r)<<24,r<128)return IB(e,i,t);if(r=a[n.pos++],i|=(1&r)<<31,r<128)return IB(e,i,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=i[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&TB?function(e,t,n){return TB.decode(e.subarray(t,n))}(this.buf,t,e):function(e,t,n){var i="",r=t;for(;r239?4:l>223?3:l>191?2:1;if(r+c>n)break;1===c?l<128&&(A=l):2===c?128==(192&(a=e[r+1]))&&(A=(31&l)<<6|63&a)<=127&&(A=null):3===c?(a=e[r+1],o=e[r+2],128==(192&a)&&128==(192&o)&&((A=(15&l)<<12|(63&a)<<6|63&o)<=2047||A>=55296&&A<=57343)&&(A=null)):4===c&&(a=e[r+1],o=e[r+2],s=e[r+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&((A=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||A>=1114112)&&(A=null)),null===A?(A=65533,c=1):A>65535&&(A-=65536,i+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),i+=String.fromCharCode(A),r+=c}return i}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==BB.Bytes)return e.push(this.readVarint(t));var n=_B(this);for(e=e||[];this.pos127;);else if(t===BB.Bytes)this.pos=this.readVarint()+this.pos;else if(t===BB.Fixed32)this.pos+=4;else{if(t!==BB.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var n,i;e>=0?(n=e%4294967296|0,i=e/4294967296|0):(i=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,i=i+1|0));if(e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos]=127&e}(n,0,t),function(e,t){var n=(7&e)<<4;if(t.buf[t.pos++]|=n|((e>>>=3)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;t.buf[t.pos++]=127&e}(i,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var i,r,a=0;a55295&&i<57344){if(!r){i>56319||a+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):r=i;continue}if(i<56320){e[n++]=239,e[n++]=191,e[n++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(e[n++]=239,e[n++]=191,e[n++]=189,r=null);i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=63&i|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&LB(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),MB(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),MB(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n=128&&LB(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeMessage:function(e,t,n){this.writeTag(e,BB.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,FB,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,kB,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,DB,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,PB,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,UB,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,RB,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,OB,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,NB,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,zB,t)},writeBytesField:function(e,t){this.writeTag(e,BB.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,BB.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,BB.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,BB.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,BB.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,BB.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,BB.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,BB.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,BB.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,BB.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var VB=jB;function jB(e,t){this.x=e,this.y=t}jB.prototype={clone:function(){return new jB(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=t*this.x-n*this.y,r=n*this.x+t*this.y;return this.x=i,this.y=r,this},_rotateAround:function(e,t){var n=Math.cos(e),i=Math.sin(e),r=t.x+n*(this.x-t.x)-i*(this.y-t.y),a=t.y+i*(this.x-t.x)+n*(this.y-t.y);return this.x=r,this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},jB.convert=function(e){return e instanceof jB?e:Array.isArray(e)?new jB(e[0],e[1]):e};var WB=XB;function XB(e,t,n,i,r){this.properties={},this.extent=n,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=r,e.readFields(YB,this,t)}function YB(e,t,n){1==e?t.id=n.readVarint():2==e?function(e,t){var n=e.readVarint()+e.pos;for(;e.pos>3}if(r--,1===i||2===i)a+=e.readSVarint(),o+=e.readSVarint(),1===i&&(t&&s.push(t),t=[]),t.push(new VB(a,o));else{if(7!==i)throw new Error("unknown command "+i);t&&t.push(t[0].clone())}}return t&&s.push(t),s},XB.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,i=0,r=0,a=0,o=1/0,s=-1/0,l=1/0,A=-1/0;e.pos>3}if(i--,1===n||2===n)(r+=e.readSVarint())s&&(s=r),(a+=e.readSVarint())A&&(A=a);else if(7!==n)throw new Error("unknown command "+n)}return[o,l,s,A]},XB.prototype.toGeoJSON=function(e,t,n){var i,r,a=this.extent*Math.pow(2,n),o=this.extent*e,s=this.extent*t,l=this.loadGeometry(),A=XB.types[this.type];function c(e){for(var t=0;t>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}return t}(n))}function $B(e,t,n){if(3===e){var i=new ZB(n,n.readVarint()+n.pos);i.length&&(t[i.name]=i)}}JB.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new WB(this._pbf,t,this.extent,this._keys,this._values)};var eE=function(e,t){this.layers=e.readFields($B,{},t)},tE=gb.get("EPSG:3857").dimensions(),nE=new at(tE.x,tE.y,1),iE=new tt,rE=new tt;function aE(e,t){t.out=t.out||{};var n=new eE(new CB(e)),i=Object.keys(n.layers);if(!(i.length<1)){var r=e.extent.col,a=e.extent.zoom,o=t.in.isInverted?e.extent.row:(1<=e.zoom.min&&a2&&void 0!==arguments[2]&&arguments[2],i=t.bindNewGeometry();n=n&&t.type===pC.POLYGON,i.properties=e.properties;var r=e._pbf;r.pos=e._geometry;for(var a=r.readVarint()+r.pos,o=1,s=0,l=0,A=0,c=0,h=0;r.pos>3}if(s--,1===o||2===o)l+=r.readSVarint(),A+=r.readSVarint(),1===o&&(c&&(n&&h>0&&i.indices.length>0&&(t.updateExtent(i),(i=t.bindNewGeometry()).properties=e.properties),i.closeSubGeometry(c,t),i.getLastSubGeometry().ccw=h<0),c=0,h=0),c++,i.pushCoordinatesValues(t,l,A),1==c?(rE.set(l,A),iE.set(l,A)):n&&c>1&&(h+=(iE.x-l)*(iE.y+A),iE.set(l,A));else{if(7!==o)throw new Error("unknown command ".concat(o));c&&(c++,i.pushCoordinatesValues(t,rE.x,rE.y),n&&(h+=(iE.x-rE.x)*(iE.y+rE.y)))}}c&&(n&&h>0&&i.indices.length>0&&(t.updateExtent(i),(i=t.bindNewGeometry()).properties=e.properties),i.closeSubGeometry(c,t),i.getLastSubGeometry().ccw=h<0),t.updateExtent(i)}(o,A))};for(c.s();!(r=c.n()).done;)h()}catch(e){c.e(e)}finally{c.f()}},o=i.length-1;o>=0;o--)r(o)})),s.removeEmptyFeature(),s.features.sort((function(e,t){return e.order-t.order})),s.updateExtent(),s.extent=e.extent,Promise.resolve(s)}}var oE={parse:function(e,t){return t=xC(t),Promise.resolve(aE(e,t))}},sE=new Map([["image/x-bil;bits=32",$M.textureFloat],["geojson",$M.json],["application/json",$M.json],["application/kml",$M.xml],["application/gpx",$M.xml],["application/x-protobuf;type=mapbox-vector",$M.arrayBuffer]]),lE=new Map([["geojson",_C.parse],["application/json",_C.parse],["application/kml",wB.parse],["application/gpx",xB.parse],["application/x-protobuf;type=mapbox-vector",oE.parse]]),AE={getByArray:function(){},setByArray:function(e){return e},clear:function(){}};var cE=0,hE=function(e){h(n,e);var t=y(n);function n(e){var i;if(s(this,n),(i=t.call(this,e)).isSource=!0,!e.url)throw new Error("New Source: url is required");return i.uid=cE++,i.url=e.url,i.format=e.format,i.fetcher=e.fetcher||sE.get(e.format)||$M.texture,i.parser=e.parser||lE.get(e.format)||function(e){return e},i.isVectorSource=null!=(e.parser||lE.get(e.format)),i.networkOptions=e.networkOptions||{crossOrigin:"anonymous"},i.attribution=e.attribution,i.whenReady=Promise.resolve(),i._featuresCaches={},e.extent&&!e.extent.isExtent?i.extent=new bb(i.crs,e.extent):i.extent=e.extent,i}return A(n,[{key:"handlingError",value:function(e){throw new Error(e)}},{key:"urlFromExtent",value:function(e){throw new Error("In extended Source, you have to implement the method urlFromExtent!")}},{key:"requestToKey",value:function(e){return[e.zoom,e.row,e.col]}},{key:"loadData",value:function(e,t){var n=this,i=this._featuresCaches[t.crs],r=this.requestToKey(e),a=i.getByArray(r);return a||(a=i.setByArray(function(e,t){var n=e.urlFromExtent(t);return e.fetcher(n,e.networkOptions).then((function(e){return e.extent=t,e}),(function(t){return e.handlingError(t)}))}(this,e).then((function(e){return n.parser(e,{out:t,in:n})}),(function(e){return n.handlingError(e)})),r),this.onParsedFile&&a.then((function(e){return n.onParsedFile(e),console.warn("Source.onParsedFile was deprecated"),e}))),a}},{key:"onLayerAdded",value:function(e){this._featuresCaches[e.out.crs]||(this._featuresCaches[e.out.crs]=this.isVectorSource?new XM:AE)}},{key:"onLayerRemoved",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._featuresCaches[e.unusedCrs];t&&(t.clear(),delete this._featuresCaches[e.unusedCrs])}},{key:"extentInsideLimit",value:function(e){throw new Error("In extented Source, you have to implement the method extentInsideLimit!")}}]),n}(A((function e(t){s(this,e),t.projection&&(console.warn("Source projection parameter is deprecated, use crs instead."),t.crs=t.crs||t.projection),this.crs=t.crs}))),uE=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s(this,n),r.projection&&(console.warn("Layer projection parameter is deprecated, use crs instead."),r.crs=r.crs||r.projection),void 0===r.source||!0===r.source)throw new Error("Layer ".concat(e," needs Source"));return(i=t.call(this)).isLayer=!0,Object.assign(v(i),r),Object.defineProperty(v(i),"id",{value:e,writable:!1}),i.options=r.options||{},i.updateStrategy||(i.updateStrategy={type:0,options:{}}),i.defineLayerProperty("frozen",!1),r.zoom?(i.zoom={max:r.zoom.max,min:r.zoom.min||0},null==i.zoom.max&&(i.zoom.max=1/0)):i.zoom={max:1/0,min:0},i.info=new VM(v(i)),i.source=i.source||new hE({url:"none"}),i.ready=!1,i._promises=[],i.whenReady=new Promise((function(e,t){i._resolve=e,i._reject=t})).then((function(){return i.ready=!0,i.source.onLayerAdded({out:v(i)}),v(i)})),i._promises.push(i.source.whenReady),i.cache=new XM(r.cacheLifeTime),i.mergeFeatures=void 0===i.mergeFeatures||r.mergeFeatures,i.filter=i.filter||i.source.filter,i}return A(n,[{key:"addInitializationStep",value:function(){var e;return this._promises.push(new Promise((function(t){e=t}))),e}},{key:"defineLayerProperty",value:function(e,t,n){var i=this,r=Object.getOwnPropertyDescriptor(this,e);if(!r||!r.set){var a=null==this[e]?t:this[e];Object.defineProperty(this,e,{get:function(){return a},set:function(t){if(a!==t){var r={type:"".concat(e,"-property-changed"),previous:{},new:{}};r.previous[e]=a,r.new[e]=t,a=t,n&&n(i,e),i.dispatchEvent(r)}}})}}},{key:"convert",value:function(e){return e}},{key:"getData",value:function(e,t){var n=this,i=this.source.requestToKey(this.source.isVectorSource?t:e),r=this.cache.getByArray(i);return r||(r=this.source.loadData(e,this).then((function(e){return n.convert(e,t)}),(function(e){throw e})),this.cache.setByArray(r,i)),r}},{key:"isValidData",value:function(e){}},{key:"delete",value:function(){console.warn("Function delete doesn't exist for this layer")}}]),n}(Je),dE=function(e){var t=Array.from(e);return t.sort((function(e,t){return e.sequence-t.sequence})),t.map((function(e){return e.id}))},fE=function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}},pE=function(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}},mE=function(e){var t={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext},n='Your $0 does not seem to support $1',i=document.createElement("div");return i.id="webglmessage",i.style.fontFamily="monospace",i.style.fontSize="13px",i.style.fontWeight="normal",i.style.textAlign="center",i.style.background="#fff",i.style.color="#000",i.style.padding="1.5em",i.style.width="400px",i.style.margin="5em auto 0",n=(n=t[e]?n.replace("$0","graphics card"):n.replace("$0","browser")).replace("$1",{1:"WebGL",2:"WebGL 2"}[e]),i.innerHTML=n,i};function vE(e,t){return!(e.left>t.right||e.rightt.bottom||e.bottom0&&void 0!==arguments[0]?arguments[0]:12,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;s(this,e),this.x=t,this.y=n,this.grid=[],this.hidden=[],this.visible=[],this.resize(),this.reset(),this.width=i,this.height=r}return A(e,[{key:"reset",value:function(){for(var e=0;e0&&this.grid[a][o].some((function(t){return vE(t.boundaries,e.boundaries)})))return this.hidden.push(e),!1;for(var s=t;s<=n;s++)for(var l=i;l<=r;l++)this.grid[s][l].push(e);return!0}}]),e}(),yE=new bt,wE=new at,xE=function(){function e(){s(this,e),this.domElement=document.createElement("div"),this.domElement.style.overflow="hidden",this.domElement.style.position="absolute",this.domElement.style.height="100%",this.domElement.style.width="100%",this.domElement.style.zIndex=1,this.garbage=document.createElement("div"),this.garbage.style.display="none",this.domElement.appendChild(this.garbage),this.halfWidth=0,this.halfHeight=0,this.grid=new gE,this.infoTileLayer=void 0}return A(e,[{key:"setSize",value:function(e,t){this.domElement.style.width="".concat(e),this.domElement.style.height="".concat(t),this.halfWidth=e/2,this.halfHeight=t/2,this.grid.width=e,this.grid.height=t,this.grid.x=Math.ceil(e/20),this.grid.y=Math.ceil(t/20),this.grid.resize()}},{key:"registerLayer",value:function(e){this.domElement.appendChild(e.domElement)}},{key:"render",value:function(e,t){var n=this;this.infoTileLayer&&this.infoTileLayer.layer.attachedLayers.find((function(e){return e.isLabelLayer&&e.visible}))&&(this.grid.reset(),yE.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this.culling(e,this.infoTileLayer.displayed.extent),this.grid.visible.sort((function(e,t){var n=t.order-e.order;return 0==n?!e.visible&&t.visible?1:-1:n})),this.grid.visible.forEach((function(e){n.grid.insert(e)&&(e.visible=!0,e.updateCSSPosition())})),this.grid.hidden.forEach((function(e){e.visible=!1})))}},{key:"culling",value:function(e,t){var n=this;if(e.isLabel)!t.isPointInside(e.coordinates)||function(e){var t=e.parent;return t.material&&!t.material.visible&&t.children.find((function(e){return e.isTileMesh&&e.children.find((function(e){return e.isLabel}))}))}(e)||e.parent.level<4&&e.parent.layer.horizonCulling&&e.parent.layer.horizonCulling(e.horizonCullingPoint)?this.grid.hidden.push(e):(wE.setFromMatrixPosition(e.matrixWorld),wE.applyMatrix4(yE),e.updateProjectedPosition(wE.x*this.halfWidth+this.halfWidth,-wE.y*this.halfHeight+this.halfHeight),this.grid.visible.some((function(t){return t.projectedPosition.x==e.projectedPosition.x&&t.projectedPosition.y==e.projectedPosition.y&&t.baseContent==e.baseContent}))?(e.parent.remove(e),this.grid.hidden.push(e)):this.grid.visible.push(e));else{if(!e.visible)return void this.hideNodeDOM(e);if(e.extent&&!e.extent.intersectsExtent(t))return void this.hideNodeDOM(e);this.showNodeDOM(e),e.children.forEach((function(e){return n.culling(e,t)}))}}},{key:"removeLabelDOM",value:function(e){this.garbage.appendChild(e.content),this.garbage.innerHTML=""}},{key:"hideNodeDOM",value:function(e){var t=this;if(e.domElements){var n=Object.values(e.domElements);n.length>0?n.forEach((function(e){1==e.visible&&(e.dom.style.display="none",e.visible=!1)})):e.children.filter((function(e){return e.isTileMesh})).forEach((function(e){return t.hideNodeDOM(e)}))}}},{key:"showNodeDOM",value:function(e){e.domElements&&Object.values(e.domElements).forEach((function(e){0==e.visible&&(e.dom.style.display="block",e.visible=!0)}))}}]),e}(),bE=new ut,ME=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,e);var i=!oM();void 0===n.antialias&&(n.antialias=!0),void 0===n.alpha&&(n.alpha=!0),void 0===n.logarithmicDepthBuffer&&(n.logarithmicDepthBuffer=this.gLDebug||i),void 0===n.isWebGL2&&(n.isWebGL2=!0);var r=t.domElement?t:void 0,a=r?r.domElement:t;this.width=a.clientWidth,this.height=a.clientHeight,this.positionBuffer=null,this._nextThreejsLayer=1,this.fullSizeRenderTarget=new dt(this.width,this.height),this.fullSizeRenderTarget.texture.minFilter=Z,this.fullSizeRenderTarget.texture.magFilter=X,this.fullSizeRenderTarget.depthBuffer=!0,this.fullSizeRenderTarget.depthTexture=new ns,this.fullSizeRenderTarget.depthTexture.type=ee,this.renderView=function(e){this.renderer.clear(),this.renderer.render(e.scene,e.camera.camera3D),this.label2dRenderer.render(e.scene,e.camera.camera3D)}.bind(this),this.onWindowResize=function(e,t){this.width=e,this.height=t,this.fullSizeRenderTarget.setSize(this.width,this.height),this.renderer.setSize(this.width,this.height),this.label2dRenderer.setSize(this.width,this.height)}.bind(this);try{this.label2dRenderer=new xE,this.label2dRenderer.setSize(this.width,this.height),a.appendChild(this.label2dRenderer.domElement),this.renderer=r||new(n.isWebGL2,$a)({canvas:document.createElement("canvas"),antialias:n.antialias,alpha:n.alpha,logarithmicDepthBuffer:n.logarithmicDepthBuffer}),this.renderer.domElement.style.position="relative",this.renderer.domElement.style.zIndex=0,this.renderer.domElement.style.top=0}catch(e){var o=n.isWebGL2?"2":"1";console.error("Failed to create WebGLRenderer webGL ".concat(o,".")),this.renderer=null}if(!this.renderer)throw fE()?pE()||a.appendChild(mE(2)):a.appendChild(mE(1)),new Error("WebGL unsupported");!r&&n.logarithmicDepthBuffer&&(this.renderer.capabilities.isWebGL2||this.renderer.extensions.get("EXT_frag_depth")||(this.renderer.dispose(),this.renderer=new(n.isWebGL2,$a)({canvas:document.createElement("canvas"),antialias:n.antialias,alpha:n.alpha,logarithmicDepthBuffer:!1}))),-1===this.renderer.domElement.tabIndex&&(this.renderer.domElement.tabIndex=-1),lM(this.renderer),this.renderer.setClearColor(197896),this.renderer.sortObjects=!0,this.renderer.debug.checkShaderErrors=__DEBUG__,r||(this.renderer.setPixelRatio(a.devicePixelRatio),this.renderer.setSize(a.clientWidth,a.clientHeight),a.appendChild(this.renderer.domElement))}return A(e,[{key:"getWindowSize",value:function(){return new tt(this.width,this.height)}},{key:"getRenderer",value:function(){return this.renderer}},{key:"renderViewToBuffer",value:function(e,t){return t||(t={x:0,y:0,width:this.width,height:this.height}),t.buffer=t.buffer||new Uint8Array(4*t.width*t.height),this.renderViewToRenderTarget(e,this.fullSizeRenderTarget,t),this.renderer.readRenderTargetPixels(this.fullSizeRenderTarget,t.x,this.height-(t.y+t.height),t.width,t.height,t.buffer),t.buffer}},{key:"renderViewToRenderTarget",value:function(e,t,n){t||(t=this.fullSizeRenderTarget);var i=this.renderer.getRenderTarget();return n&&(this.fullSizeRenderTarget.scissor.set(n.x,t.height-(n.y+n.height),n.width,n.height),this.fullSizeRenderTarget.scissorTest=!0),this.renderer.setRenderTarget(t),this.renderer.clear(!0,!0,!1),this.renderer.render(e.scene,e.camera.camera3D),this.renderer.setRenderTarget(i),this.fullSizeRenderTarget.scissorTest=!1,t}},{key:"bufferToImage",value:function(e,t,n){var i=document.createElement("canvas"),r=i.getContext("2d");i.width=t,i.height=n;var a=r.getImageData(0,0,t,n);a.data.set(e),r.putImageData(a,0,0);var o=new Image;return o.src=i.toDataURL(),o}},{key:"getUniqueThreejsLayer",value:function(){return this._nextThreejsLayer>31&&(console.warn("Too much three.js layers. Starting from now all of them will use layerMask = 31"),this._nextThreejsLayer=31),this._nextThreejsLayer++}},{key:"depthBufferRGBAValueToOrthoZ",value:function(e,t){if(bE.fromArray(e).divideScalar(255),aM()&&"PerspectiveCamera"==t.type){var n=CM(bE),i=2/(Math.log(t.far+1)/Math.LN2);return Math.pow(2,2*n/i)}var r=CM(bE);return r=2*r-1}},{key:"onRender",value:function(){}}]),e}();function CE(e,t,n,i,r,a,o){if(t==pC.LINE&&function(e,t,n,i,r,a){for(var o=e.x,s=e.y,l=i+a,A=i;l=-n&&y<=g+n&&Math.abs(v*o-m*s+u*h-d*c)/g<=n)return!0}return!1}(e,n,i,r,a,o))return!0;if(t==pC.POLYGON&&function(e,t,n,i,r){for(var a=e.x,o=e.y,s=!1,l=n,A=n+i-r;lo!=d>o&&a<(u-c)*(o-h)/(d-h)+c&&(s=!s)}return s}(e,n,r,a,o))return!0;if(t==pC.POINT){var s=function(e,t,n,i,r,a){for(var o,s=e.x,l=e.y,A=n*n,c=i;c2&&void 0!==arguments[2]?arguments[2]:.1,i=[];if(SE.copy(e),t.extent){if(SE.as(Jx.formatToEPSG(t.extent.crs),SE),t.extent.as(SE.crs,EE),!EE.isPointInside(SE,n))return i;(t.isFeatureCollection&&1!=t.scale.x&&1!=t.scale.y||0!=t.translation.x&&0!=t.translation.y)&&(SE.x=(SE.x+t.translation.x)*t.scale.x,SE.y=(SE.y+t.translation.y)*t.scale.y,1!=t.scale.x&&1!=t.scale.y&&(n*=Math.sqrt(Math.pow(t.scale.x,2)+Math.pow(t.scale.y,2))))}if(t.isFeatureCollection){var r,a=S(t.features);try{for(a.s();!(r=a.n()).done;){var o=r.value;o.extent&&!o.extent.isPointInside(SE,n)||BE(SE,o,n,i)}}catch(e){a.e(e)}finally{a.f()}}else t.geometries&&BE(SE,t,n,i);return i},_E=new bb("EPSG:4326",[0,0,0,0]),IE=0;function LE(e){var t=/\$\{u:([\w-_.|]+)\}/.exec(e);if(!t)return e;var n=t[1].split("|");return e.replace(t[0],n[IE++%n.length])}var FE=function(e,t){return LE(t.url.replace(/(\$\{z\}|%TILEMATRIX)/,e.zoom).replace(/(\$\{y\}|%ROW)/,e.row).replace(/(\$\{x\}|%COL)/,e.col))},kE=function(e,t){var n="EPSG:4326"==t.crs?9:2;e.as(t.crs,_E);var i=_E.west.toFixed(n),r=_E.south.toFixed(n),a=_E.east.toFixed(n),o=_E.north.toFixed(n),s=t.axisOrder||"wsen";return s=s.replace("w","".concat(i,",")).replace("s","".concat(r,",")).replace("e","".concat(a,",")).replace("n","".concat(o,",")).slice(0,-1),LE(t.url.replace("%bbox",s))},PE=function(e){return LE(e)},UE={executeCommand:function(e){var t=e.layer,n=e.extentsSource,i=e.extentsDestination||n;return Promise.all(n.map((function(e,n){return t.getData(e,i[n])})))}},DE=function(){function e(t){s(this,e),this.command=t,this.isCancelledCommandException=!0}return A(e,[{key:"toString",value:function(){return"Cancelled command ".concat(this.command.requester.id,"/").concat(this.command.layer.id)}}]),e}(),RE={executeCommand:function(e){var t=[],n=e.layer,i=e.requester,r=e.extentsSource;if(i&&!i.material)return Promise.reject(new DE(e));for(var a=0,o=r.length;a=2.0 are supported."));else{var c=new H(A,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u=0&&void 0===l[v]&&console.warn('THREE.GLTFLoader: Unknown extension "'+v+'".')}}c.setExtensions(s),c.setPlugins(l),c.parse(i,r)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};function i(e){this.parser=e,this.name=n.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function a(){this.name=n.KHR_MATERIALS_UNLIT}function o(e){this.parser=e,this.name=n.KHR_MATERIALS_CLEARCOAT}function s(e){this.parser=e,this.name=n.KHR_MATERIALS_TRANSMISSION}function l(e){this.parser=e,this.name=n.KHR_TEXTURE_BASISU}function A(e){this.parser=e,this.name=n.EXT_TEXTURE_WEBP,this.isSupported=null}function c(e){this.name=n.EXT_MESHOPT_COMPRESSION,this.parser=e}i.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a,o)},A.prototype.loadTexture=function(e){var t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;var a=r.extensions[t],o=i.images[a.source],s=n.textureLoader;if(o.uri){var l=n.options.manager.getHandler(o.uri);null!==l&&(s=l)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,o,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))},A.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported},c.prototype.loadBufferView=function(e){var t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){var i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([r,a.ready]).then((function(e){var t=i.byteOffset||0,n=i.byteLength||0,r=i.count,o=i.byteStride,s=new ArrayBuffer(r*o),l=new Uint8Array(e[0],t,n);return a.decodeGltfBuffer(new Uint8Array(s),r,o,l,i.mode,i.filter),s}))}return null};var h="glTF",u=1313821514,d=5130562;function f(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:OA.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==h)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,r=new DataView(e,12),a=0;a",t).replace("#include ",n).replace("#include ",i).replace("#include ",r).replace("#include ",a)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function g(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return v},extendParams:function(e,t,n){var i=t.extensions[this.name];e.color=new Fn(1,1,1),e.opacity=1;var r=[];if(Array.isArray(i.diffuseFactor)){var a=i.diffuseFactor;e.color.fromArray(a),e.opacity=a[3]}if(void 0!==i.diffuseTexture&&r.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new Fn(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new Fn(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var o=i.specularGlossinessTexture;r.push(n.assignTexture(e,"glossinessMap",o)),r.push(n.assignTexture(e,"specularMap",o))}return Promise.all(r)},createMaterial:function(e){var t=new v(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function y(){this.name=n.KHR_MESH_QUANTIZATION}function w(e,t,n,i){Il.call(this,e,t,n,i)}p.prototype.decodePrimitive=function(e,t){var n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(var A in a){var c=F[A]||A.toLowerCase();o[c]=a[A]}for(A in e.attributes){c=F[A]||A.toLowerCase();if(void 0!==a[A]){var h=n.accessors[e.attributes[A]],u=T[h.componentType];l[c]=u,s[c]=!0===h.normalized}}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var n in e.attributes){var i=e.attributes[n],r=s[n];void 0!==r&&(i.normalized=r)}t(e)}),o,l)}))}))},m.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},v.prototype=Object.create(gl.prototype),v.prototype.constructor=v,v.prototype.copy=function(e){return gl.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},w.prototype=Object.create(Il.prototype),w.prototype.constructor=w,w.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i,a=0;a!==i;a++)t[a]=n[r+a];return t},w.prototype.beforeStart_=w.prototype.copySampleValue_,w.prototype.afterEnd_=w.prototype.copySampleValue_,w.prototype.interpolate_=function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,A=i-t,c=(n-t)/A,h=c*c,u=h*c,d=e*l,f=d-l,p=-2*u+3*h,m=u-h,v=1-p,g=m-h+c,y=0;y!==o;y++){var w=a[f+y+o],x=a[f+y+s]*A,b=a[d+y+o],M=a[d+y]*A;r[y]=v*w+g*x+p*b+m*M}return r};var x=0,b=1,M=2,C=3,B=4,E=5,S=6,T={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},_={9728:X,9729:Z,9984:Y,9985:J,9986:K,9987:q},I={33071:j,33648:W,10497:V},L={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},F={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex",_BATCHID:"_BATCHID"},k={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},P={CUBICSPLINE:void 0,LINEAR:ke,STEP:Fe},U="OPAQUE",D="MASK",R="BLEND";function O(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function N(e,t,n){for(var i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function z(e,t){void 0!==t.extras&&("object"===r(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Q(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,i=t.weights.length;n=2&&r.setY(C,x[b*o+1]),o>=3&&r.setZ(C,x[b*o+2]),o>=4&&r.setW(C,x[b*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r}))},H.prototype.loadTexture=function(e){var t=this.json,n=this.options,i=t.textures[e],r=t.images[i.source],a=this.textureLoader;if(r.uri){var o=n.manager.getHandler(r.uri);null!==o&&(a=o)}return this.loadTextureImage(e,r,a)},H.prototype.loadTextureImage=function(e,t,n){var i=this,r=this.json,a=this.options,o=r.textures[e],s=self.URL||self.webkitURL,l=t.uri,A=!1,c=!0;if("image/jpeg"===t.mimeType&&(c=!1),void 0!==t.bufferView)l=i.getDependency("bufferView",t.bufferView).then((function(e){if("image/png"===t.mimeType){var n=new DataView(e,25,1).getUint8(0,!1);c=6===n||4===n||3===n}A=!0;var i=new Blob([e],{type:t.mimeType});return l=s.createObjectURL(i)}));else if(void 0===t.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return Promise.resolve(l).then((function(e){return new Promise((function(t,i){var r=t;!0===n.isImageBitmapLoader&&(r=function(e){t(new ts(e))}),n.load(O(e,a.path),r,void 0,i)}))})).then((function(t){!0===A&&s.revokeObjectURL(l),t.flipY=!1,o.name&&(t.name=o.name),c||(t.format=Ae);var n=(r.samplers||{})[o.sampler]||{};return t.magFilter=_[n.magFilter]||Z,t.minFilter=_[n.minFilter]||q,t.wrapS=I[n.wrapS]||V,t.wrapT=I[n.wrapT]||V,i.associations.set(t,{type:"textures",index:e}),t}))},H.prototype.assignTexture=function(e,t,i){var r=this;return this.getDependency("texture",i.index).then((function(a){if(void 0===i.texCoord||0==i.texCoord||"aoMap"===t&&1==i.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+t+" not yet supported."),r.extensions[n.KHR_TEXTURE_TRANSFORM]){var o=void 0!==i.extensions?i.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(o){var s=r.associations.get(a);a=r.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,s)}}e[t]=a}))},H.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,i=void 0!==t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal,o=!0===e.isSkinnedMesh,s=Object.keys(t.morphAttributes).length>0,l=s&&void 0!==t.morphAttributes.normal;if(e.isPoints){var A="PointsMaterial:"+n.uuid,c=this.cache.get(A);c||(c=new Xo,On.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(A,c)),n=c}else if(e.isLine){A="LineBasicMaterial:"+n.uuid;var h=this.cache.get(A);h||(h=new Do,On.prototype.copy.call(h,n),h.color.copy(n.color),this.cache.add(A,h)),n=h}if(i||r||a||o||s){A="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(A+="specular-glossiness:"),o&&(A+="skinning:"),i&&(A+="vertex-tangents:"),r&&(A+="vertex-colors:"),a&&(A+="flat-shading:"),s&&(A+="morph-targets:"),l&&(A+="morph-normals:");var u=this.cache.get(A);u||(u=n.clone(),o&&(u.skinning=!0),r&&(u.vertexColors=!0),a&&(u.flatShading=!0),s&&(u.morphTargets=!0),l&&(u.morphNormals=!0),i&&(u.vertexTangents=!0,u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(A,u),this.associations.set(u,this.associations.get(n))),n=u}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=n},H.prototype.getMaterialType=function(){return gl},H.prototype.loadMaterial=function(e){var t,i=this,r=this.json,a=this.extensions,o=r.materials[e],s={},l=o.extensions||{},A=[];if(l[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var c=a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=c.getMaterialType(),A.push(c.extendParams(s,o,i))}else if(l[n.KHR_MATERIALS_UNLIT]){var h=a[n.KHR_MATERIALS_UNLIT];t=h.getMaterialType(),A.push(h.extendParams(s,o,i))}else{var u=o.pbrMetallicRoughness||{};if(s.color=new Fn(1,1,1),s.opacity=1,Array.isArray(u.baseColorFactor)){var d=u.baseColorFactor;s.color.fromArray(d),s.opacity=d[3]}void 0!==u.baseColorTexture&&A.push(i.assignTexture(s,"map",u.baseColorTexture)),s.metalness=void 0!==u.metallicFactor?u.metallicFactor:1,s.roughness=void 0!==u.roughnessFactor?u.roughnessFactor:1,void 0!==u.metallicRoughnessTexture&&(A.push(i.assignTexture(s,"metalnessMap",u.metallicRoughnessTexture)),A.push(i.assignTexture(s,"roughnessMap",u.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),A.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))}!0===o.doubleSided&&(s.side=2);var f=o.alphaMode||U;return f===R?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,f===D&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==Nn&&(A.push(i.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new tt(1,-1),void 0!==o.normalTexture.scale&&s.normalScale.set(o.normalTexture.scale,-o.normalTexture.scale)),void 0!==o.occlusionTexture&&t!==Nn&&(A.push(i.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==Nn&&(s.emissive=(new Fn).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==Nn&&A.push(i.assignTexture(s,"emissiveMap",o.emissiveTexture)),Promise.all(A).then((function(){var r;return r=t===v?a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s),o.name&&(r.name=o.name),r.map&&(r.map.encoding=Ne),r.emissiveMap&&(r.emissiveMap.encoding=Ne),z(r,o),i.associations.set(r,{type:"materials",index:e}),o.extensions&&N(a,r,o),r}))},H.prototype.createUniqueName=function(e){for(var t=kc.sanitizeNodeName(e||""),n=t,i=1;this.nodeNamesUsed[n];++i)n=t+"_"+i;return this.nodeNamesUsed[n]=!0,n},H.prototype.loadGeometries=function(e){var t=this,i=this.extensions,r=this.primitiveCache;function a(e){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return $(n,e,t)}))}for(var o,s,l=[],A=0,c=e.length;A0&&Q(h,a),h.name=n.createUniqueName(a.name||"mesh_"+e),z(h,a),d.extensions&&N(r,h,d),n.assignFinalMaterial(h),l.push(h)}if(1===l.length)return l[0];var p=new ja;for(A=0,c=l.length;A1?new ja:1===t.length?t[0]:new zt)!==t[0])for(var s=0,l=t.length;st._taskLoad?-1:1}));return(i=n.workerPool[n.workerPool.length-1])._taskCosts[e]=t,i._taskLoad+=t,i}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))},dispose:function(){for(var e=0;e=0&&(l[i.KHR_MATERIALS_COMMON]=new r(A)),new B(A,l,{crossOrigin:this.crossOrigin,manager:this.manager,path:t||this.resourcePath||""}).parse((function(e,t,i,r){n({scene:e,scenes:t,cameras:i,animations:r})}))}}),e.Shaders={update:function(){console.warn("threeExamples.LegacyGLTFLoader.Shaders has been deprecated, and now updates automatically.")}},n.prototype.update=function(e,t){var n=this.boundUniforms;for(var i in n){var r=n[i];switch(r.semantic){case"MODELVIEW":r.uniform.value.multiplyMatrices(t.matrixWorldInverse,r.sourceNode.matrixWorld);break;case"MODELVIEWINVERSETRANSPOSE":var a=r.uniform.value;this._m4.multiplyMatrices(t.matrixWorldInverse,r.sourceNode.matrixWorld),a.getNormalMatrix(this._m4);break;case"PROJECTION":r.uniform.value.copy(t.projectionMatrix);break;case"JOINTMATRIX":for(var o=r.uniform.value,s=0;s>10),56320+(1023&i)))}return t}(a)}};var KE=new XE("utf-8"),ZE="tileset",JE="batchtable",qE="boundingVolume",$E=function(){function e(t,n,i,r){s(this,e),this.type=JE,this.batchLength=i;var a=t;n>0&&(console.warn("Binary batch table content not supported yet."),a=t.slice(0,t.byteLength));var o=KE.decode(new Uint8Array(a)),l=JSON.parse(o);l.extensions&&(this.extensions=r.parseExtensions(l.extensions,this.type),delete l.extensions),this.content=l}return A(e,[{key:"getInfoById",value:function(e){if(e<0&&e0){var u=l,d=e.slice(u,s.FTJSONLength+u),f=KE.decode(new Uint8Array(d));(c=JSON.parse(f)).RTC_CENTER?h.fromArray(c.RTC_CENTER):h.set(0,0,0)}if(s.FTBinaryLength>0&&console.warn("3D Tiles feature table binary not supported yet."),s.BTJSONLength>0){var p=l+s.FTJSONLength+s.FTBinaryLength,m=e.slice(p,s.BTJSONLength+p);A.push(new $E(m,s.BTBinaryLength,c.BATCH_LENGTH,t.registeredExtensions))}else A.push(Promise.resolve({}));var v=l+s.FTJSONLength+s.FTBinaryLength+s.BTJSONLength+s.BTBinaryLength,g=e.slice(v),y=new DataView(g,0,20);return A.push(new Promise((function(e){var a=function(i){var a,o=S(i.scenes);try{for(o.s();!(a=o.n()).done;){a.value.traverse(rS)}}catch(e){o.e(e)}finally{o.f()}void 0===n||"Y"===n?i.scene.applyMatrix4(eS):"X"===n&&i.scene.applyMatrix4(tS),i.scene.position.copy(h);var s=new Uint8Array(g,20,y.getUint32(12,!0)),l=KE.decode(new Uint8Array(s)),A=JSON.parse(l);A.extensions&&A.extensions.CESIUM_RTC&&(i.scene.position.fromArray(A.extensions.CESIUM_RTC.center),i.scene.updateMatrixWorld(!0));i.scene.traverse((function(e){if(e.isB3dm=!0,e.frustumCulled=!1,e.material){if(t.overrideMaterials){if(Array.isArray(e.material)){var n,i=S(e.material);try{for(i.s();!(n=i.n()).done;){n.value.dispose()}}catch(e){i.e(e)}finally{i.f()}}else e.material.dispose();"object"===r(t.overrideMaterials)&&t.overrideMaterials.isMaterial?e.material=t.overrideMaterials:e.material.depthWrite=!0}else aM()&&e.material.isRawShaderMaterial&&!t.doNotPatchMaterial&&(dM(e.material),console.warn("b3dm shader has been patched to add log depth buffer support"));e.material.transparent=t.opacity<1,e.material.opacity=t.opacity}})),e(i)};1===y.getUint32(4,!0)?iS.parse(g,i,a):nS.parse(g,i,a)}))),Promise.all(A).then((function(e){return{gltf:e[1],batchTable:e[0]}}))}throw new Error("Invalid b3dm file.")},oS=function(e,t){if(!e)throw new Error("No array buffer provided.");var n=new DataView(e),i=0,r={},a={},o={};if(r.magic=KE.decode(new Uint8Array(e,i,4)),i+=4,r.magic){r.version=n.getUint32(i,!0),i+=Uint32Array.BYTES_PER_ELEMENT,r.byteLength=n.getUint32(i,!0),i+=Uint32Array.BYTES_PER_ELEMENT,r.FTJSONLength=n.getUint32(i,!0),i+=Uint32Array.BYTES_PER_ELEMENT,r.FTBinaryLength=n.getUint32(i,!0),i+=Uint32Array.BYTES_PER_ELEMENT,r.BTJSONLength=n.getUint32(i,!0),i+=Uint32Array.BYTES_PER_ELEMENT,r.BTBinaryLength=n.getUint32(i,!0),i+=Uint32Array.BYTES_PER_ELEMENT;var s={};if(r.FTJSONLength>0){var l=i,A=e.slice(l,r.FTJSONLength+l),c=KE.decode(new Uint8Array(A));s=JSON.parse(c)}if(r.FTBinaryLength>0&&(o=function(e,t,n){var i,r=new si,a=KE.decode(new Uint8Array(e,t,n)),o=JSON.parse(a);o.POINTS_LENGTH&&(i=o.POINTS_LENGTH);if(o.POSITION){var s=o.POSITION.byteOffset+a.length+t,l=new Float32Array(e,s,3*i);r.setAttribute("position",new zn(l,3))}if(o.RGB){var A=o.RGB.byteOffset+a.length+t,c=new Uint8Array(e,A,3*i);r.setAttribute("color",new zn(c,3,!0))}if(o.POSITION_QUANTIZED)throw new Error("For pnts loader, POSITION_QUANTIZED: not yet managed");if(o.RGBA)throw new Error("For pnts loader, RGBA: not yet managed");if(o.RGB565)throw new Error("For pnts loader, RGB565: not yet managed");if(o.NORMAL)throw new Error("For pnts loader, NORMAL: not yet managed");if(o.NORMAL_OCT16P)throw new Error("For pnts loader, NORMAL_OCT16P: not yet managed");if(o.BATCH_ID)throw new Error("For pnts loader, BATCH_ID: not yet managed");var h=o.RTC_CENTER?(new at).fromArray(o.RTC_CENTER):void 0;return{geometry:r,offset:h}}(e,i,r.FTJSONLength)),r.BTJSONLength>0){var h=i+r.FTJSONLength+r.FTBinaryLength,u=e.slice(h,r.BTJSONLength+h);a=new $E(u,r.BTBinaryLength,s.BATCH_LENGTH,t)}var d={point:o,batchTable:a};return Promise.resolve(d)}throw new Error("Invalid pnts file.")};function sS(e,t,n){var i=OA.extractUrlBase(n),r={gltfUpAxis:t.tileset.asset.gltfUpAxis,urlBase:i,overrideMaterials:t.overrideMaterials,doNotPatchMaterial:t.doNotPatchMaterial,opacity:t.opacity,registeredExtensions:t.registeredExtensions};return aS(e,r).then((function(e){return{batchTable:e.batchTable,object3d:e.gltf.scene}}))}function lS(e,t){return oS(e,t.registeredExtensions).then((function(e){var n=t.material?t.material.clone():new Xo({size:.05,vertexColors:!0}),i=new qo(e.point.geometry,n);return e.point.offset&&i.position.copy(e.point.offset),{object3d:i}}))}var AS={executeCommand:function(e){var t=e.layer,n=e.metadata,i=new zt;!function(e,t,n,i){e.frustumCulled=!1,e.layer=t,n.transform&&e.applyMatrix4(n.transform),e.geometricError=n.geometricError,e.tileId=n.tileId,n.refine?e.additiveRefinement="ADD"===n.refine.toUpperCase():e.additiveRefinement=!!i&&i.additiveRefinement,e.viewerRequestVolume=n.viewerRequestVolume,e.boundingVolume=n.boundingVolume,e.boundingVolume.region&&e.add(e.boundingVolume.region),e.updateMatrixWorld()}(i,t,n,e.requester);var r=n.content&&(n.content.url||n.content.uri),a=function(e){e.layers.set(t.threejsLayer),e.userData.metadata=n,e.layer=t,e.material&&(e.material.transparent=t.opacity<1,e.material.opacity=t.opacity,e.material.wireframe=t.wireframe)};if(r){var o=r.startsWith("http")?r:n.baseURL+r,s={b3dm:sS,pnts:lS};return $M.arrayBuffer(o,t.source.networkOptions).then((function(e){if(void 0!==e){var r,l=KE.decode(new Uint8Array(e,0,4));if("{"===l[0]){e=JSON.parse(KE.decode(new Uint8Array(e)));var A=o.slice(0,o.lastIndexOf("/")+1);t.tileset.extendTileset(e,n.tileId,A,t.registeredExtensions)}else if("b3dm"==l)r=s.b3dm;else{if("pnts"!=l)return Promise.reject("Unsupported magic code ".concat(l));r=s.pnts}if(r)return r(e,t,o).then((function(e){return i.content=e.object3d,e.batchTable&&(i.batchTable=e.batchTable),i.add(e.object3d),i.traverse(a),i}))}return i.traverse(a),i}))}return i.traverse(a),Promise.resolve(i)}},cS=1;var hS={executeCommand:function(e){var t=e.layer,n=e.requester;return n.load().then((function(i){var r=new qo(i,t.material);return function(e){var t=e.geometry.attributes.position.count,n=new Uint8Array(4*t),i=cS++;if(t>65535||i>65535)return console.warn("Currently picking is limited to Points with less than 65535 elements and less than 65535 Points instances"),e;for(var r=0;r>24,n[4*r+1]=(16711680&a)>>16,n[4*r+2]=(65280&a)>>8,n[4*r+3]=(255&a)>>0}e.baseId=i,e.geometry.setAttribute("unique_id",new zn(n,4,!0))}(r),r.frustumCulled=!1,r.matrixAutoUpdate=!1,t.isEntwinePointTileLayer||(r.position.copy(n.bbox.min),r.scale.copy(t.scale)),r.updateMatrix(),r.tightbbox=i.boundingBox.applyMatrix4(r.matrix),r.layers.set(t.threejsLayer),r.layer=t,r.extent=bb.fromBox3(e.view.referenceCrs,n.bbox),r.userData.node=n,r}))}};function uS(e,t){var n=t.priority-e.priority;return 0===n?t.timestamp-e.timestamp:n}function dS(){return{queue:function(e){var t=e.layer,n=this.storages.get(t.id);n||(n={q:new PriorityQueue({comparator:uS}),priority:1,accumulator:0},this.storages.set(t.id,n)),n.priority=t.priority||1,n.q.queue(e),this.counters.pending++},storages:new Map,counters:{executing:0,executed:0,failed:0,cancelled:0,pending:0},execute:function(e,t){var n=this;return this.counters.pending--,this.counters.executing++,t.executeCommand(e).then((function(t){n.counters.executing--,e.resolve(t),n.counters.executed++}),(function(t){n.counters.executing--,e.reject(t),n.counters.failed++,__DEBUG__&&n.counters.failed<3&&console.error(t)}))}}}function fS(){this.defaultQueue=dS(),this.hostQueues=new Map,this.providers={},this.maxCommandsPerHost=6,this.initDefaultProviders()}function pS(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e.camera.camera3D.layers.mask;return e.camera.camera3D.layers.mask=1<>>1],t)>=0?r=a+1:i=a;return r},t.exports=function(){function e(e){var t;this.options=e,this.comparator=this.options.comparator,this.data=(null!=(t=this.options.initialValues)?t.slice(0):void 0)||[],this.data.sort(this.comparator).reverse()}return e.prototype.queue=function(e){var t;t=i(this.data,e,this.comparator),this.data.splice(t,0,e)},e.prototype.dequeue=function(){return this.data.pop()},e.prototype.peek=function(){return this.data[this.data.length-1]},e.prototype.clear=function(){this.data.length=0},e}()},{}],4:[function(e,t,n){t.exports=function(){function e(e){var t,n,i,r,a,o,s,l;for(this.comparator=(null!=e?e.comparator:void 0)||function(e,t){return e-t},this.pageSize=(null!=e?e.pageSize:void 0)||512,this.length=0,s=0;1<a;0<=a?++n:--n)t.push(null);if(this._memory=[],this._mask=this.pageSize-1,e.initialValues)for(i=0,r=(o=e.initialValues).length;i0&&(this._write(1,t),this._bubbleDown(1,t)),e},e.prototype.peek=function(){return this._read(1)},e.prototype.clear=function(){this.length=0,this._memory.length=0},e.prototype._write=function(e,t){var n;for(n=e>>this._shift;n>=this._memory.length;)this._memory.push(this._emptyMemoryPageTemplate.slice(0));return this._memory[n][e&this._mask]=t},e.prototype._read=function(e){return this._memory[e>>this._shift][e&this._mask]},e.prototype._bubbleUp=function(e,t){var n,i,r,a;for(n=this.comparator;e>1&&(i=e&this._mask,e3?r=e&~this._mask|i>>1:i<2?(r=e-this.pageSize>>this._shift,r+=r&~(this._mask>>1),r|=this.pageSize>>1):r=e-2,!(n(a=this._read(r),t)<0));)this._write(r,t),this._write(e,a),e=r},e.prototype._bubbleDown=function(e,t){var n,i,r,a,o;for(o=this.comparator;ethis._mask&&!(e&this._mask-1)?n=i=e+2:e&this.pageSize>>1?(n=(e&~this._mask)>>1,i=(n=(n|=e&this._mask>>1)+1<0)for(e=t=1,n=this.data.length;1<=n?tn;e=1<=n?++t:--t)this._bubbleUp(e)},e.prototype.queue=function(e){this.data.push(e),this._bubbleUp(this.data.length-1)},e.prototype.dequeue=function(){var e,t;return t=this.data[0],e=this.data.pop(),this.data.length>0&&(this.data[0]=e,this._bubbleDown(0)),t},e.prototype.peek=function(){return this.data[0]},e.prototype.clear=function(){this.length=0,this.data.length=0},e.prototype._bubbleUp=function(e){for(var t,n;e>0&&(t=e-1>>>1,this.comparator(this.data[e],this.data[t])<0);)n=this.data[t],this.data[t]=this.data[e],this.data[e]=n,e=t},e.prototype._bubbleDown=function(e){var t,n,i,r,a;for(t=this.data.length-1;r=(n=1+(e<<1))+1,i=e,n<=t&&this.comparator(this.data[n],this.data[i])<0&&(i=n),r<=t&&this.comparator(this.data[r],this.data[i])<0&&(i=r),i!==e;)a=this.data[i],this.data[i]=this.data[e],this.data[e]=a,e=i},e}()},{}]},{},[1])(1)})),fS.prototype.constructor=fS,fS.prototype.initDefaultProviders=function(){this.addProtocolProvider("tile",RE),this.addProtocolProvider("3d-tiles",AS),this.addProtocolProvider("pointcloud",hS)},fS.prototype.runCommand=function(e,t,n){var i=this,r=this.getProtocolProvider(e.layer.protocol);if(!r)throw new Error("No known provider for layer ".concat(e.layer.id));t.execute(e,r,n).then((function(){if(e.view.notifyChange(e.requester,e.redraw),t.counters.executing0&&(r+=o.priority,o.accumulator+=o.priority,(!t||o.accumulator>n)&&(t=o,n=o.accumulator))}}catch(e){a.e(e)}finally{a.f()}if(t)return t.accumulator-=r,t.q}(e.storages);t&&t.length>0;){var n=t.dequeue();if(!n.earlyDropFunction||!n.earlyDropFunction(n))return n;e.counters.pending--,e.counters.cancelled++,n.reject(new DE(n))}};var mS=new ut;function vS(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=e.mainLoop.gfxEngine.getWindowSize();n=n||new tt(Math.floor(r.x/2),Math.floor(r.y/2));var a=t.level0Nodes.map((function(e){return mM.push(e,mM.MODES.ID)})),o=pS(e,t.object3d,t.threejsLayer),s=e.mainLoop.gfxEngine.renderViewToBuffer({camera:e.camera,scene:t.object3d},{x:n.x-i,y:n.y-i,width:1+2*i,height:1+2*i});o(),a.forEach((function(e){return e()}));var l=[];return gS(i,(function(e,t){var n=4*(2*t*i+e),r=s.slice(n,n+4||void 0);mS.fromArray(r).divideScalar(255);var a=CM(mS,Math.pow(256,3)),o=Math.round(a);l.includes(o)||l.push(o)})),l}function gS(e,t){for(var n,i=0;i<=e;i++){for(var r=i*i,a=-i;a<=i;a++)for(var o=a*a,s=-i;s<=i;s++){var l=o+s*s;if(!(l>r)&&(!(l<=n)&&!1===t(a,s)))return}n=r}}function yS(e){return e.layer?e.layer:e.parent?yS(e.parent):void 0}var wS,xS=new Nc,bS=function(e,t,n,i){var r,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],o=vS(e,i,t,n),s=function(e){o.includes(e.id)&&e.isTileMesh&&a.push({object:e,layer:i})},l=S(i.level0Nodes);try{for(l.s();!(r=l.n()).done;){var A=r.value;A.traverse(s)}}catch(e){l.e(e)}finally{l.f()}return a},MS=function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],a=arguments.length>5?arguments[5]:void 0;if(void 0!==a?xS.layers.set(a):xS.layers.enableAll(),n<0){var o=e.viewToNormalizedCoords(t);xS.setFromCamera(o,e.camera.camera3D);var s,l=xS.intersectObject(i,!0),A=S(l);try{for(A.s();!(s=A.n()).done;){var c=s.value;c.layer=yS(c.object),r.push(c)}}catch(e){A.e(e)}finally{A.f()}return r}var h={x:t.x-n,y:t.y-n,width:1+2*n,height:1+2*n},u=e.mainLoop.gfxEngine.renderViewToBuffer({scene:i,camera:e.camera},h),d=new Fn;e.mainLoop.gfxEngine.renderer.getClearColor(d);var f=Math.round(255*d.r),p=Math.round(255*d.g),m=Math.round(255*d.b),v=e.viewToNormalizedCoords(t),g=v.clone();return gS(n,(function(t,a){var o=4*((a+n)*(2*n+1)+(t+n)),s=u[o],l=u[o+1],A=u[o+2];if(!(Math.abs(f-s)<=1&&Math.abs(p-l)<=1&&Math.abs(m-A)<=1)){g.setX(v.x+t/e.camera.width).setY(v.y+a/e.camera.height),xS.setFromCamera(g,e.camera.camera3D);var c,h=S(xS.intersectObject(i,!0));try{for(h.s();!(c=h.n()).done;){var d=c.value;d.layer=yS(d.object),r.push(d)}}catch(e){h.e(e)}finally{h.f()}return 0==r.length}})),r},CS=0,BS=1,ES=2,SS=3,TS=4,_S=[1,3,7,60],IS=function(){function e(){s(this,e),this.state=CS,this.lastErrorTimestamp=0,this.errorCount=0,this.failureParams={lowestLevelError:1/0}}return A(e,[{key:"canTryUpdate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now();switch(this.state){case CS:return!0;case SS:case BS:case TS:return!1;default:var t=1e3*this.secondsUntilNextTry();return t<=e-this.lastErrorTimestamp}}},{key:"secondsUntilNextTry",value:function(){if(this.state!==ES)return 0;var e=Math.max(0,Math.min(this.errorCount,_S.length)-1);return _S[e]}},{key:"newTry",value:function(){this.state=BS}},{key:"success",value:function(){this.lastErrorTimestamp=0,this.state=CS}},{key:"noMoreUpdatePossible",value:function(){this.state=TS}},{key:"noData",value:function(e){this.state=CS,this.failureParams.lowestLevelError=Math.min(e.targetLevel,this.failureParams.lowestLevelError)}},{key:"failure",value:function(e,t,n){n&&null!=n.targetLevel&&(this.failureParams.lowestLevelError=Math.min(n.targetLevel,this.failureParams.lowestLevelError)),this.lastErrorTimestamp=e,this.state=t?SS:ES,this.errorCount++}},{key:"inError",value:function(){return this.state==SS||this.state==ES}}]),e}(),LS={cleanup:function(e){if(e.layer=null,"function"==typeof e.dispose)e.dispose();else if(e.geometry&&e.geometry.dispose(),e.material)if(Array.isArray(e.material)){var t,n=S(e.material);try{for(n.s();!(t=n.n()).done;){t.value.dispose()}}catch(e){n.e(e)}finally{n.f()}}else e.material.dispose()},removeChildren:function(e,t){var n=t.children.filter((function(t){return(t.layer&&t.layer.id)===e.id}));return t.remove.apply(t,C(n)),n},removeChildrenAndCleanup:function(e,t){var n=t.children.filter((function(t){return(t.layer&&t.layer.id)===e.id}));return t.remove.apply(t,C(n)),t.layer===e&&this.cleanup(t),n},removeChildrenAndCleanupRecursively:function(e,t){var n,i=t.children.filter((function(t){return(t.layer&&t.layer.id)===e.id})),r=S(i);try{for(r.s();!(n=r.n()).done;){var a=n.value;this.removeChildrenAndCleanupRecursively(e,a)}}catch(e){r.e(e)}finally{r.f()}return t.remove.apply(t,C(i)),t.layer&&t.layer.id===e.id&&this.cleanup(t),i}},FS=new ob("EPSG:4326"),kS="";kS=void 0!==document.documentElement.style.transform?"transform":void 0!==document.documentElement.style.webkitTransform?"webkitTransform":void 0!==document.documentElement.style.mozTransform?"mozTransform":void 0!==document.documentElement.style.oTransform?"oTransform":"transform";var PS=function(e){h(n,e);var t=y(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(s(this,n),null==r)throw new Error("coordinates are mandatory to add a Label");var l=(e=t.call(this)).visible;return Object.defineProperty(v(e),"visible",{set:function(e){e!=l&&(l=e,this.content.style.display=e?"block":"none")},get:function(){return l}}),e.isLabel=!0,e.coordinates=r,e.projectedPosition={x:0,y:0},e.boundaries={left:0,right:0,top:0,bottom:0},e.content=document.createElement("div"),e.content.classList.add("itowns-label"),e.content.style.userSelect="none",e.content.style.position="absolute","string"==typeof i?e.content.textContent=i:e.content.appendChild(i),e.baseContent=i,a.isStyle?(e.anchor=a.getTextAnchorPosition(),a.text.haloWidth>0&&e.content.classList.add("itowns-stroke-single"),a.applyToHTML(e.content,o)):e.anchor=[0,0],e.zoom={min:a.zoom&&null!=a.zoom.min?a.zoom.min:2,max:a.zoom&&null!=a.zoom.max?a.zoom.max:24},e.order=a.order||0,e.padding=2,e}return A(n,[{key:"updateProjectedPosition",value:function(e,t){var n=Math.round(e),i=Math.round(t);n==this.projectedPosition.x&&i==this.projectedPosition.y||(this.projectedPosition.x=n,this.projectedPosition.y=i,this.boundaries.left=e+this.offset.left-this.padding,this.boundaries.right=e+this.offset.right+this.padding,this.boundaries.top=t+this.offset.top-this.padding,this.boundaries.bottom=t+this.offset.bottom+this.padding)}},{key:"updateCSSPosition",value:function(){this.content.style[kS]="translate(".concat(this.boundaries.left+this.padding,"px, ").concat(this.boundaries.top+this.padding,"px)")}},{key:"initDimensions",value:function(){if(!this.offset){wS=this.content.getBoundingClientRect();var e=Math.round(wS.width),t=Math.round(wS.height);this.offset={left:e*this.anchor[0],top:t*this.anchor[1]},this.offset.right=this.offset.left+e,this.offset.bottom=this.offset.top+t}}},{key:"update3dPosition",value:function(e){this.coordinates.as(e,FS),FS.toVector3(this.position),this.parent.worldToLocal(this.position),this.updateMatrixWorld()}},{key:"updateElevationFromLayer",value:function(e){var t=Sb.getElevationValueAt(e,this.coordinates,Sb.FAST_READ_Z);if(t&&t!=this.coordinates.z)return this.coordinates.z=t,this.updateHorizonCullingPoint(),!0}},{key:"updateHorizonCullingPoint",value:function(){this.horizonCullingPoint&&this.getWorldPosition(this.horizonCullingPoint)}}]),n}(zt),US=new ob("EPSG:4326",0,0,0),DS=new bb("EPSG:4326",0,0,0,0),RS=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(this,n),(i=t.call(this,e,r)).isLabelLayer=!0,i.domElement=document.createElement("div"),i.domElement.id="itowns-label-".concat(i.id),i.defineLayerProperty("visible",!0,(function(){i.domElement.style.display=i.visible?"block":"none"})),i.buildExtent=!0,i}return A(n,[{key:"convert",value:function(e,t){var n=this,i=[],r=this.style&&this.style.text&&this.style.text.field;t.as(e.crs,DS),US.crs=e.crs;var a={zoom:t.zoom};return e.features.forEach((function(t){if(t.type===pC.POINT){var o=t.style&&t.style.text.field;t.geometries.forEach((function(s){if(US.setFromArray(t.vertices,s.size*s.indices[0].offset),e.transformCoordinates(US),2==t.size&&(US.z=0),DS.isPointInside(US)){var l,A=s.properties.style&&s.properties.style.text.field,c={globals:a,properties:function(){return s.properties}};if(A||o||r)A?l=s.properties.style.getTextFromProperties(c):o?l=t.style.getTextFromProperties(c):r&&(l=n.style.getTextFromProperties(c));else if(!(s.properties.style&&s.properties.style.icon||t.style&&t.style.icon||n.style&&n.style.icon))return;var h=(s.properties.style||t.style||n.style).symbolStylefromContext(c),u=new PS(l,US.clone(),h,n.source.sprites);u.layerId=n.id,2==t.size&&(u.needsAltitude=!0),i.push(u)}}))}})),i}},{key:"preUpdate",value:function(){}},{key:"update",value:function(e,t,n,i){var r=this;if(i||!n.children.length){if(!this.frozen&&n.visible&&this.visible){var a=n.getExtentsByProjection(this.source.crs)||[n.extent],o=a[0].zoom;if(!(ot.zoom.max)){void 0===n.layerUpdateState[this.id]&&(n.layerUpdateState[this.id]=new IS);var s=n.material.getElevationLayer();if(s&&n.layerUpdateState[s.id].canTryUpdate()&&n.children.forEach((function(t){t.isLabel&&t.needsAltitude&&t.updateElevationFromLayer(r.parent)&&t.update3dPosition(e.view.referenceCrs)})),n.layerUpdateState[this.id].canTryUpdate()){if(this.source.extentInsideLimit(n.extent,o)){n.layerUpdateState[this.id].newTry();var l={layer:this,extentsSource:a,view:e.view,threejsLayer:this.threejsLayer,requester:n};return e.scheduler.execute(l).then((function(t){if(t){var i=e.view.mainLoop.gfxEngine.label2dRenderer,a=[];if(t.forEach((function(t){n.parent?t.forEach((function(t){t.needsAltitude&&t.updateElevationFromLayer(r.parent),n.children.find((function(e){return e.isLabel&&e.baseContent==t.baseContent}))||(n.add(t),t.update3dPosition(e.view.referenceCrs),n.level<4&&(t.horizonCullingPoint=new at,t.updateHorizonCullingPoint()),a.push(t.content))})):t.forEach((function(e){LS.removeChildrenAndCleanupRecursively(r,e),i.removeLabelDOM(e)}))})),a.length>0){var o,s=n.domElements[r.id];s||(s={dom:document.createElement("div"),visible:!0},n.domElements[r.id]=s),(o=s.dom).append.apply(o,a);var l=n.findClosestDomElement(r.id);(l&&l.dom||r.domElement).appendChild(s.dom),s.visible=!0,t.forEach((function(e){return e.forEach((function(e){return e.initDimensions()}))})),t.forEach((function(e){return e.forEach((function(e){e.visible=!1}))})),n.children.sort((function(e){return e.isLabel?-e.order:1})),n.addEventListener("removed",(function(){t.forEach((function(e){return e.forEach((function(e){return n.remove(e)}))})),r.removeNodeDomElement(n)}))}n.layerUpdateState[r.id].noMoreUpdatePossible()}}))}n.layerUpdateState[this.id].noMoreUpdatePossible()}}}}else LS.removeChildrenAndCleanupRecursively(this,n)}},{key:"removeLabelsFromNodeRecursive",value:function(e){var t=this;e.children.forEach((function(n){n.isLabel&&n.layerId===t.id?e.remove(n):n.isTileMesh&&t.removeLabelsFromNodeRecursive(n)})),this.removeNodeDomElement(e)}},{key:"removeNodeDomElement",value:function(e){if(e.domElements[this.id]){var t=e.domElements[this.id].dom;t.parentElement.removeChild(t),delete e.domElements[this.id]}}},{key:"delete",value:function(){var e=this;this.domElement.parentElement.removeChild(this.domElement),this.parent.level0Nodes.forEach((function(t){return e.removeLabelsFromNodeRecursive(t)}))}}]),n}(uE),OS="layers-initialized",NS="layer-removed",zS="layer-added",QS="initialized",GS="camera-moved",HS=function(e,t){e.object3d&&(e.object3d.visible=e.visible),e.threejsLayer&&(e.visible?t.camera.camera3D.layers.enable(e.threejsLayer):t.camera.camera3D.layers.disable(e.threejsLayer))};var VS,jS=new tt,WS=new bt,XS=new tt,YS=new dn,KS=new at,ZS=new at,JS=new ob("EPSG:4326"),qS=[],$S=function(e){h(n,e);var t=y(n);function n(e,i){var r,a,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(s(this,n),!i)throw new Error("Invalid viewerDiv parameter (must non be null/undefined)");(r=t.call(this)).domElement=i,r.referenceCrs=e,JS.crs=e,a=o.renderer&&o.renderer.domElement?new ME(o.renderer):new ME(i,o.renderer),r.engine=a,r.mainLoop=o.mainLoop||new qb(new fS,a),r.scene=o.scene3D||new Qt,o.scene3D||(r.scene.autoUpdate=!1),r.camera=new Gb(r.referenceCrs,r.mainLoop.gfxEngine.getWindowSize().x,r.mainLoop.gfxEngine.getWindowSize().y,o.camera),r._frameRequesters={},r._layers=[],window.addEventListener("resize",(function(){return r.resize()}),!1),r._changeSources=new Set,__DEBUG__&&(r.isDebugMode=!0),r._delayedFrameRequesterRemoval=[],r._allLayersAreReadyCallback=function(){r.getLayers().every((function(e){return e.ready}))&&0==r.mainLoop.scheduler.commandsWaitingExecutionCount()&&0==r.mainLoop.renderingState&&(r.dispatchEvent({type:OS}),r.removeFrameRequester(Jb,r._allLayersAreReadyCallback))},r.camera.resize(r.domElement.clientWidth,r.domElement.clientHeight);var l=function e(){r.removeEventListener(OS,e),r.dispatchEvent({type:QS})};return r.addEventListener(OS,l),r._fullSizeDepthBuffer=new Uint8Array(4*r.camera.width*r.camera.height),r._pixelDepthBuffer=new Uint8Array(4),r.domElement.tabIndex=-1,r.domElement.focus(),qS.push(v(r)),r}return A(n,[{key:"dispose",value:function(){var e=qS.indexOf(this);if(-1!=e){this.controls&&this.controls.dispose&&this.controls.dispose(),this.removeAllFrameRequesters(),this.removeAllEvents();var t,n=S(this.getLayers((function(e){return!e.isTiledGeometryLayer&&!e.isAtmosphere})));try{for(n.s();!(t=n.n()).done;){var i=t.value;this.removeLayer(i.id)}}catch(e){n.e(e)}finally{n.f()}var r,a=S(this.getLayers((function(e){return e.isAtmosphere})));try{for(a.s();!(r=a.n()).done;){var o=r.value;this.removeLayer(o.id)}}catch(e){a.e(e)}finally{a.f()}var s,l=S(this.getLayers((function(e){return e.isTiledGeometryLayer})));try{for(l.s();!(s=l.n()).done;){var A=s.value;this.removeLayer(A.id)}}catch(e){l.e(e)}finally{l.f()}qS.splice(e,1),this.mainLoop.dispose()}else console.warn("View already disposed")}},{key:"addLayer",value:function(e,t){var n=this;if(!e||!e.isLayer)return Promise.reject(new Error("Add Layer type object"));if(this.getLayerById(e.id))return e._reject(new Error("Invalid id '".concat(e.id,"': id already used")));if(e=function(e,t,n){var i=t.source;if(n&&!t.extent&&(t.extent=n.extent,i&&!i.extent&&(i.extent=n.extent)),t.isGeometryLayer?(n&&(t.threejsLayer=e.mainLoop.gfxEngine.getUniqueThreejsLayer()),t.defineLayerProperty("visible",!0,(function(){return HS(t,e)})),HS(t,e),t.crs=e.referenceCrs):t.crs||(n&&n.tileMatrixSets&&n.tileMatrixSets.includes(Jx.formatToTms(i.crs))?t.crs=i.crs:t.crs=n&&n.extent.crs),t.isLabelLayer)e.mainLoop.gfxEngine.label2dRenderer.registerLayer(t);else if(t.labelEnabled||t.addLabelLayer){t.labelEnabled&&console.info("layer.labelEnabled is deprecated use addLabelLayer, instead of"),t.buildExtent=!0;var r=new RS("".concat(t.id,"-label"),{source:i,style:t.style,zoom:t.zoom,crs:i.crs,visible:t.visible});t.addEventListener("visible-property-changed",(function(){r.visible=t.visible})),e.addEventListener(NS,(function n(i){i.layerId===t.id&&e.removeLayer(r.id),e.removeEventListener(NS,n)})),t.whenReady=t.whenReady.then((function(){return e.addLayer(r),t}))}return t}(this,e,t),t)if(e.isColorLayer){var i=this.getLayers((function(e){return e.isColorLayer}));if(e.sequence=i.length,!(t.countColorLayersTextures.apply(t,C(i).concat([e]))<=BM()))return e._reject(new Error("Cant add color layer ".concat(e.id,": the maximum layer is reached")));t.attach(e)}else e.isElevationLayer&&"image/x-bil;bits=32"==e.source.format?(e.source.networkOptions.isWebGL2=this.mainLoop.gfxEngine.renderer.capabilities.isWebGL2,t.attach(e)):t.attach(e);else{if("function"!=typeof e.update)return e._reject(new Error("Cant add GeometryLayer: missing a update function"));if("function"!=typeof e.preUpdate)return e._reject(new Error("Cant add GeometryLayer: missing a preUpdate function"));this._layers.push(e)}return e.object3d&&!e.object3d.parent&&e.object3d!==this.scene&&this.scene.add(e.object3d),Promise.all(e._promises).then((function(){e._resolve(),n.notifyChange(t||e,!1),n._frameRequesters[Jb]&&n._frameRequesters[Jb].includes(n._allLayersAreReadyCallback)||n.addFrameRequester(Jb,n._allLayersAreReadyCallback),n.dispatchEvent({type:zS,layerId:e.id})}),e._reject),e.whenReady}},{key:"removeLayer",value:function(e){var t=this.getLayerById(e);if(t){var n=t.parent;if(t.delete(),n&&!n.detach(t))throw new Error("Error to detach ".concat(e," from ").concat(n.id));if(null==n&&this._layers.splice(this._layers.findIndex((function(t){return t.id==e})),1),t.isColorLayer){var i,r=S(this.getLayers((function(e){return e.isColorLayer})));try{for(r.s();!(i=r.n()).done;){var a=i.value;a.sequence>t.sequence&&a.sequence--}}catch(e){r.e(e)}finally{r.f()}}var o,s=0,l=S(qS);try{for(l.s();!(o=l.n()).done;){s+=o.value.getLayers((function(e){return e.source.uid==t.source.uid&&e.crs==t.crs})).length}}catch(e){l.e(e)}finally{l.f()}return t.source.onLayerRemoved({unusedCrs:0==s?t.crs:void 0}),this.notifyChange(this.camera),this.dispatchEvent({type:NS,layerId:e}),!0}throw new Error("".concat(e," doesn't exist"))}},{key:"notifyChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&(this._changeSources.add(e),(e.isTileMesh||e.isCamera)&&(this._fullSizeDepthBuffer.needsUpdate=!0)),this.mainLoop.scheduleViewUpdate(this,t)}},{key:"getLayers",value:function(e){var t,n=[],i=S(this._layers);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(e&&!e(r)||n.push(r),r.attachedLayers){var a,o=S(r.attachedLayers);try{for(o.s();!(a=o.n()).done;){var s=a.value;e&&!e(s,r)||n.push(s)}}catch(e){o.e(e)}finally{o.f()}}}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"getLayerById",value:function(e){return this.getLayers((function(t){return t.id===e}))[0]}},{key:"addFrameRequester",value:function(e,t){if("function"!=typeof t)throw new Error("frameRequester must be a function");this._frameRequesters[e]?this._frameRequesters[e].push(t):this._frameRequesters[e]=[t]}},{key:"removeFrameRequester",value:function(e,t){this._frameRequesters[e].includes(t)?this._delayedFrameRequesterRemoval.push({when:e,frameRequester:t}):console.error("Invalid call to removeFrameRequester: frameRequester isn't registered")}},{key:"removeAllFrameRequesters",value:function(){for(var e in this._frameRequesters)if(Object.prototype.hasOwnProperty.call(this._frameRequesters,e)){var t,n=S(this._frameRequesters[e]);try{for(n.s();!(t=n.n()).done;){var i=t.value;this.removeFrameRequester(e,i)}}catch(e){n.e(e)}finally{n.f()}}this._executeFrameRequestersRemovals()}},{key:"removeAllEvents",value:function(){if(void 0!==this._listeners){for(var e in this._listeners)Object.prototype.hasOwnProperty.call(this._listeners,e)&&delete this._listeners[e];this._listeners=void 0}}},{key:"_executeFrameRequestersRemovals",value:function(){var e,t=S(this._delayedFrameRequesterRemoval);try{for(t.s();!(e=t.n()).done;){var n=e.value,i=this._frameRequesters[n.when].indexOf(n.frameRequester);i>=0?this._frameRequesters[n.when].splice(i,1):console.warn("FrameReq has already been removed")}}catch(e){t.e(e)}finally{t.f()}this._delayedFrameRequesterRemoval.length=0}},{key:"execFrameRequesters",value:function(e,t,n){if(this._frameRequesters[e]){this._delayedFrameRequesterRemoval.length>0&&this._executeFrameRequestersRemovals();for(var i=arguments.length,r=new Array(i>3?i-3:0),a=3;a1&&void 0!==arguments[1]?arguments[1]:jS,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=this.domElement.getBoundingClientRect();if(void 0!==e.touches&&e.touches.length)return t.set(e.touches[n].clientX-i.x,e.touches[n].clientY-i.y);var r=e.target.getBoundingClientRect();return t.set(r.x+e.offsetX-i.x,r.y+e.offsetY-i.y)}},{key:"eventToNormalizedCoords",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.viewToNormalizedCoords(this.eventToViewCoords(e,jS,t))}},{key:"viewToNormalizedCoords",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jS;return t.x=e.x/this.camera.width*2-1,t.y=e.y/this.camera.height*-2+1,t}},{key:"normalizedToViewCoords",value:function(e){return jS.x=.5*(e.x+1)*this.camera.width,jS.y=-.5*(e.y-1)*this.camera.height,jS}},{key:"pickObjectsAt",value:function(e){for(var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length,r=new Array(i>2?i-2:0),a=2;a0&&void 0!==arguments[0]?arguments[0]:.28;return this.getScaleFromDistance(e,this.getDistanceFromCamera())}},{key:"getScaleFromDistance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.28,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;e/=1e3;var n=Hh.degToRad(this.camera.camera3D.fov),i=this.camera.height/(2*t*Math.tan(.5*n));return e*i}},{key:"getDistanceFromCamera",value:function(e){return this.getPickingPositionFromDepth(e,ZS),this.camera.camera3D.position.distanceTo(ZS)}},{key:"getPixelsToMeters",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1?arguments[1]:void 0;return this.camera.camera3D.isOrthographicCamera?e*(VS=(this.camera.camera3D.right-this.camera.camera3D.left)/this.camera.camera3D.zoom)/this.camera.width:this.getPixelsToMetersFromDistance(e,this.getDistanceFromCamera(t))}},{key:"getPixelsToMetersFromDistance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e*t/this.camera._preSSE}},{key:"getMetersToPixels",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1?arguments[1]:void 0;return this.camera.camera3D.isOrthographicCamera?(VS=(this.camera.camera3D.right-this.camera.camera3D.left)/this.camera.camera3D.zoom,e*this.camera.width/VS):this.getMetersToPixelsFromDistance(e,this.getDistanceFromCamera(t))}},{key:"getMetersToPixelsFromDistance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.camera._preSSE*e/t}},{key:"pickFeaturesAt",value:function(e){for(var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,i=arguments.length,r=new Array(i>2?i-2:0),a=2;a0&&A.forEach((function(e){return s[e.layer.id].push(e)})),0==o.length)return s;this.getPickingPositionFromDepth(l,ZS);var c,h=this.camera.camera3D.position.distanceTo(ZS);JS.setFromVector3(ZS);var u={M:this.getPixelsToMetersFromDistance(n,h),D:.001*n};this.isPlanarView?u.D=u.M:this.getPixelsToDegrees&&(u.D=this.getMetersToDegrees(u.M));var d,f=bS(this,l,n,this.tileLayer),p=S(f);try{for(p.s();!(d=p.n()).done;){var m=d.value;if(m.object.material){var v,g=S(m.object.material.getLayers(o));try{for(g.s();!(v=g.n()).done;){var y,w=v.value,x=S(w.textures);try{for(x.s();!(y=x.n()).done;){var b=y.value;b.features&&(c=Jx.isMetricUnit(b.features.crs)?u.M:u.D,s[w.id]=s[w.id].concat(TE(JS,b.features,c)))}}catch(e){x.e(e)}finally{x.f()}}}catch(e){g.e(e)}finally{g.f()}}}}catch(e){p.e(e)}finally{p.f()}return s}},{key:"readDepthBuffer",value:function(e,t,n,i,r){var a=this.mainLoop.gfxEngine,o=this.tileLayer.wireframe,s=this.tileLayer.opacity,l=this.tileLayer.visible;o&&(this.tileLayer.wireframe=!1),s<1&&(this.tileLayer.opacity=1),l||(this.tileLayer.visible=!0);var A=this.tileLayer.level0Nodes.map((function(e){return mM.push(e,mM.MODES.DEPTH)}));return r=a.renderViewToBuffer({camera:this.camera,scene:this.tileLayer.object3d},{x:e,y:t,width:n,height:i,buffer:r}),A.forEach((function(e){return e()})),this.tileLayer.wireframe!==o&&(this.tileLayer.wireframe=o),this.tileLayer.opacity!==s&&(this.tileLayer.opacity=s),this.tileLayer.visible!==l&&(this.tileLayer.visible=l),r}},{key:"getPickingPositionFromDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new at;if(this.tileLayer&&0!=this.tileLayer.level0Nodes.length&&this.tileLayer.level0Nodes[0]){var n=this.mainLoop,i=0==n.scheduler.commandsWaitingExecutionCount()&&0==n.renderingState,r=n.gfxEngine,a=r.getWindowSize(),o=this.camera.camera3D;(e=e||a.clone().multiplyScalar(.5)).x=Math.floor(e.x),e.y=Math.floor(e.y);var s,l=o.layers.mask;if(o.layers.mask=1<1e7))return t}else t=void 0}},{key:"pickCoordinates",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ob(this.tileLayer.extent.crs);return e instanceof Event?this.eventToViewCoords(e):e&&void 0!==e.x&&void 0!==e.y?jS.copy(e):jS.set(this.mainLoop.gfxEngine.width/2,this.mainLoop.gfxEngine.height/2),this.getPickingPositionFromDepth(jS,ZS),JS.crs=this.referenceCrs,JS.setFromVector3(ZS),JS.as(t.crs,t),t}},{key:"resize",value:function(e,t){null==e&&(e=this.domElement.clientWidth),null==t&&(t=this.domElement.clientHeight),this._fullSizeDepthBuffer=new Uint8Array(4*e*t),this.mainLoop.gfxEngine.onWindowResize(e,t),this.camera.resize(e,t),this.notifyChange(this.camera.camera3D)}}]),n}(Je),eT=1e3/60,tT=0,nT=1,iT=2,rT=function(e){e.id&&(clearInterval(e.id),e.id=void 0),e.waitTimer&&(clearInterval(e.waitTimer),e.waitTimer=void 0),e.keyframe=0},aT=function(e){rT(e),e.isEnded()&&e.dispatchEvent({type:"animation-ended"}),e.dispatchEvent({type:"animation-stopped"}),e.duration=0},oT=function(e){h(n,e);var t=y(n);function n(){var e;return s(this,n),(e=t.call(this)).id=null,e.keyframe=0,e.duration=0,e.state=tT,e.waitTimer=null,e}return A(n,[{key:"isPlaying",value:function(){return this.state===nT}},{key:"isStopped",value:function(){return this.state===tT}},{key:"isEnded",value:function(){return this.state===iT}},{key:"play",value:function(e){this.duration=e,this.dispatchEvent({type:"animation-started"}),this.state=nT,rT(this),this.id=setInterval(this.frame.bind(this),eT)}},{key:"playLater",value:function(e,t){var n=Math.floor(eT*t);window.clearInterval(this.waitTimer);var i=this;this.waitTimer=window.setTimeout((function(){i.play(e)}),n)}},{key:"stop",value:function(){this.state=tT,aT(this)}},{key:"frame",value:function(){this.keyframeMath.pow(2,32))throw new Error("Tile segments count is too big");var o=r*r*2+(e.disableSkirt?0:4*r*2);t.position=new Float32Array(3*a),t.normal=new Float32Array(3*a);var s=e.builder.uvCount;s>1&&(t.uvs[1]=new Float32Array(a)),n[0]=function(){},e.buildIndexAndUv_0&&(a1&&function(){var r=i.computeUvs[1](e);n[1]=function(e){t.uvs[1][e]=r}}();for(var v=0;v<=l;v++){var g=v/l,y=3*c;i.uProjecte(g,e);var w=i.vertexPosition(e,e.projected),x=i.vertexNormal(e);w.sub(e.center),e.quatNormalToZ&&(w.applyQuaternion(e.quatNormalToZ),x.applyQuaternion(e.quatNormalToZ)),w.toArray(t.position,y),x.toArray(t.normal,y);var b,M=S(n);try{for(M.s();!(b=M.n()).done;){(0,b.value)(c,g,m)}}catch(e){M.e(e)}finally{M.f()}e.disableSkirt||0!==f&&f!==A&&(v===l?u.push(c):0===v&&d.push(c)),p.push(c),c++}h.push(p),0===f?u=u.concat(p):f===A&&(u=u.concat(p.slice().reverse()))}function C(e,n,i,r){return t.index[r+0]=e,t.index[r+1]=n,t.index[r+2]=i,r+3}e.disableSkirt||(u=u.concat(d.reverse()));var B=0;if(e.buildIndexAndUv_0)for(var E=0;E1&&(t.uvs[1][c]=t.uvs[1][O]);var Q=(R+1)%u.length;B=U(B,O,c,0===Q?k:c+1,u[Q]),c++}}return t}function lT(e){e.buildIndexAndUv_0=!0,e.center=e.builder.center(e.extent).clone();var t=sT(e);t.index=new zn(t.index,1),t.uvs[0]=new zn(t.uvs[0],2),t.position=new zn(t.position,3),t.normal=new zn(t.normal,3);for(var n=1;n1&&void 0!==arguments[1]?arguments[1]:lT(e);s(this,n),(i=t.call(this)).center=e.center,i.extent=e.extent,i.setIndex(r.index),i.setAttribute("position",r.position),i.setAttribute("normal",r.normal);for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{};s(this,e),this.tmp={coords:[new ob("EPSG:4326",0,0),new ob("EPSG:4326",0,0)],position:new at,dimension:new tt},this.crs=t.crs,this.uvCount=t.uvCount,this.computeUvs=[function(){},function(e){var t=vT(e.projected.latitude)*e.nbRow;return(isFinite(t)?t:0)-e.deltaUV1}]}return A(e,[{key:"prepare",value:function(e){e.nbRow=Math.pow(2,e.level+1);var t=vT(e.extent.south);isFinite(t)||(t=0);var n=t%(1/e.nbRow);e.deltaUV1=(t-n)*e.nbRow,e.quatNormalToZ=mT.setFromAxisAngle(dT,-(.5*Math.PI-Hh.degToRad(e.extent.center().latitude))),e.projected={longitude:0,latitude:0},e.extent.dimensions(this.tmp.dimension)}},{key:"center",value:function(e){return e.center(this.tmp.coords[0]).as(this.crs,this.tmp.coords[1]).toVector3()}},{key:"vertexPosition",value:function(e){return this.tmp.coords[0].setFromValues(e.projected.longitude,e.projected.latitude),this.tmp.coords[0].as(this.crs,this.tmp.coords[1]).toVector3(this.tmp.position),this.tmp.position}},{key:"vertexNormal",value:function(){return this.tmp.coords[1].geodesicNormal}},{key:"uProjecte",value:function(e,t){t.projected.longitude=t.extent.west+e*this.tmp.dimension.x}},{key:"vProjecte",value:function(e,t){t.projected.latitude=t.extent.south+e*this.tmp.dimension.y}},{key:"computeSharableExtent",value:function(e){var t=Math.abs(e.west-e.east)/2,n=new bb(e.crs,-t,t,e.south,e.north),i=Hh.degToRad(e.west-n.west),r=Hh.degToRad(90-e.center(this.tmp.coords[0]).latitude);return fT.setFromAxisAngle(uT,i),pT.setFromAxisAngle(dT,r),fT.multiply(pT),{sharableExtent:n,quaternion:fT.clone(),position:this.center(e)}}}]),e}(),xT=new wT({crs:"EPSG:4978",uvCount:1}),bT=new at,MT=new tt,CT=new at,BT=new ob("EPSG:4326",0,0,0),ET=function(e){h(n,e);var t=y(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new at(1/0,1/0,1/0),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new at(-1/0,-1/0,-1/0);return s(this,n),zt.DefaultUp.set(0,0,1),(e=t.call(this)).box3D=new tn(i.clone(),r.clone()),e.natBox=e.box3D.clone(),e.z={min:0,max:0,scale:1},g(e,v(e))}return A(n,[{key:"clone",value:function(){return(new n).copy(this)}},{key:"copy",value:function(e){return b(u(n.prototype),"copy",this).call(this,e),this.box3D.copy(e.box3D),this.natBox.copy(e.natBox),this.z.min=e.z.min,this.z.max=e.z.max,this.z.scale=e.z.scale,this}},{key:"update",value:function(){this.updateMatrixWorld(!0)}},{key:"updateZ",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.z.scale;this.z={min:e,max:t,scale:n,delta:Math.abs(t-e)*n},this.box3D.min.z=this.natBox.min.z+e*n,this.box3D.max.z=this.natBox.max.z+t*n}},{key:"updateScaleZ",value:function(e){e>0&&this.updateZ(this.z.min,this.z.max,e)}},{key:"isSphereAboveXYBox",value:function(e){var t=this.worldToLocal(e.center),n=Math.max(this.box3D.min.x,Math.min(t.x,this.box3D.max.x)),i=Math.max(this.box3D.min.y,Math.min(t.y,this.box3D.max.y));return Math.sqrt((n-t.x)*(n-t.x)+(i-t.y)*(i-t.y))1&&void 0!==arguments[1]?arguments[1]:e.min||0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.max||0;if("EPSG:4326"==e.crs){var r=xT.computeSharableExtent(e),a=r.sharableExtent,o=r.quaternion,s=r.position,l=Math.max(Math.floor(a.dimensions(MT).x/90+1),2),A={extent:a,level:0,segment:l,disableSkirt:!0,builder:xT},c=new AT(A);gT||(gT=new n),gT.box3D.copy(c.boundingBox),gT.natBox.copy(c.boundingBox),this.copy(gT),this.updateZ(t,i),this.position.copy(s),this.quaternion.copy(o),this.updateMatrixWorld(!0)}else{if(Jx.isTms(e.crs)||!Jx.isMetricUnit(e.crs))throw new Error("Unsupported extent crs");e.center(BT).toVector3(this.position),e.dimensions(MT),bT.set(MT.x,MT.y,Math.abs(i-t)),this.box3D.setFromCenterAndSize(CT,bT),this.updateMatrixWorld(!0)}return this}}]),n}(zt),ST=new at,TT=new ob("EPSG:4326",0,0,0),_T=new eb,IT=[],LT=new at;function FT(e){return e-360*Math.floor((e+180)/360)}function kT(e){return e.getLayers((function(e){return e.isTiledGeometryLayer}))[0]}var PT=function(e){h(n,e);var t=y(n);function n(){var e;return s(this,n),e=t.call(this),zt.DefaultUp.set(0,0,1),e.seaLevel=new zt,e.target=new zt,e.target.rotation.order="ZXY",e.camera=new Oi,e.add(e.seaLevel),e.seaLevel.add(e.target),e.target.add(e.camera),e.coord=new ob("EPSG:4978",0,0),e.targetWorldPosition=new at,e.removeAll=function(){},e._onChangeCallback=null,e}return A(n,[{key:"applyTransformToCamera",value:function(e,t){var n=this;this.proxy?(t.quaternion._onChange(this._onChangeCallback),this.camera.matrixWorld.decompose(this.proxy.position,t.quaternion,t.scale),t.quaternion._onChange((function(){return n.removeProxy(e,t)}))):this.camera.matrixWorld.decompose(t.position,t.quaternion,t.scale)}},{key:"setProxy",value:function(e,t){var n=this;!this.proxy&&e&&t&&(this.proxy={position:new at},Object.keys(t.position).forEach((function(i){return function(e,t,n,i){n.proxy.position[i]=t.position[i],Object.defineProperty(t.position,i,{get:function(){return n.proxy.position[i]},set:function(r){n.removeProxy(e,t),t.position[i]=r}})}(e,t,n,i)})),this._onChangeCallback=t.quaternion._onChangeCallback,t.quaternion._onChange((function(){return n.removeProxy(e,t)})))}},{key:"removeProxy",value:function(e,t){var n=this;this.stop(e),this.proxy&&e&&t&&(Object.keys(t.position).forEach((function(e){return Object.defineProperty(t.position,e,{value:n.proxy.position[e],writable:!0})})),t.quaternion._onChange(this._onChangeCallback),this.proxy=null)}},{key:"setTargetFromCoordinate",value:function(e,t){t.as(kT(e).extent.crs,this.coord);var n=Math.max(0,this.coord.z);this.coord.z=n,this.coord.as(e.referenceCrs).toVector3(ST),"EPSG:4978"==e.referenceCrs?(this.lookAt(ST),this.seaLevel.position.set(0,0,ST.length()-n)):(this.position.set(ST.x,ST.y,0),this.seaLevel.position.set(0,0,0)),this.target.position.set(0,0,n)}},{key:"setFromPositions",value:function(e,t){this.setTargetFromCoordinate(e,new ob(e.referenceCrs,ST)),this.target.rotation.set(0,0,0),this.updateMatrixWorld(!0),this.camera.position.copy(t),this.target.worldToLocal(this.camera.position);var n=this.camera.position.length();this.target.rotation.x=Math.asin(this.camera.position.z/n);var i=Hh.clamp(this.camera.position.y/(Math.cos(this.target.rotation.x)*n),-1,1);this.target.rotation.z=Math.sign(-this.camera.position.x)*Math.acos(i),this.camera.position.set(0,n,0)}},{key:"applyParams",value:function(e,t){t.coord&&this.setTargetFromCoordinate(e,t.coord),null!=t.tilt&&(this.target.rotation.x=Hh.degToRad(t.tilt)),null!=t.heading&&(this.target.rotation.z=Hh.degToRad(FT(t.heading+180))),t.range&&this.camera.position.set(0,t.range,0),this.camera.rotation.set(.5*-Math.PI,0,Math.PI),this.updateMatrixWorld(!0),this.targetWorldPosition.setFromMatrixPosition(this.seaLevel.matrixWorld)}},{key:"getParams",value:function(){return{coord:this.coord.clone(),tilt:this.tilt,heading:this.heading,range:this.range,targetWorldPosition:this.targetWorldPosition}}},{key:"setfromCamera",value:function(e,t,n){t.updateMatrixWorld(!0),null==n&&(n=e.getPickingPositionFromDepth()||function(e,t){var n=new at(0,0,.5);if(n.unproject(t),n.sub(t.position).normalize(),"EPSG:4978"==e.referenceCrs)return _T.intersection({direction:n,origin:t.position});var i=t.position.z/n.z;return n.multiplyScalar(i).add(t.position)}(e,t));var i=n&&!isNaN(n.x)?t.position.distanceTo(n):100;t.localToWorld(ST.set(0,0,-i)),this.setFromPositions(e,t.position)}},{key:"copyObject3D",value:function(e){return this.copy(e,!1),this.seaLevel.copy(e.seaLevel,!1),this.target.copy(e.target,!1),this.camera.copy(e.camera),this}},{key:"animateCameraToLookAtTarget",value:function(e,t,i){var r=this;i.easing=i.easing||ud.Easing.Quartic.InOut,this.setfromCamera(e,t);var a=new ud.Group;this.start=(this.start||new n).copyObject3D(this),this.end=(this.end||new n).copyObject3D(this);var o,s,l=i.time||2500,A={t:0},c=[],h={promise:new Promise((function(e,t){o=e,s=t})),resolve:o,reject:s};return this.addPlaceTargetOnGround(e,t,i.coord,A),this.end.applyParams(e,i),c.push(new ud.Tween(A,a).to({t:1},l).easing(i.easing).onUpdate((function(t){"EPSG:4978"==e.referenceCrs&&r.quaternion.slerpQuaternions(r.start.quaternion,r.end.quaternion,t.t),r.camera.quaternion.slerpQuaternions(r.start.camera.quaternion,r.end.camera.quaternion,t.t),r.target.rotation.set(0,0,0),r.target.rotateZ(Hh.lerp(r.start.target.rotation.z,r.end.target.rotation.z,t.t)),r.target.rotateX(Hh.lerp(r.start.target.rotation.x,r.end.target.rotation.x,t.t))})).onComplete(i.onComplete)),"EPSG:4978"!=e.referenceCrs&&c.push(new ud.Tween(this.position,a).to(this.end.position,l).easing(i.easing).onComplete(i.onComplete)),c.push(new ud.Tween(this.seaLevel.position,a).to(this.end.seaLevel.position,l).easing(i.easing)),c.push(new ud.Tween(this.camera.position,a).to(this.end.camera.position,l).easing(i.easing)),this.animationFrameRequester=function(){a.update(),r.updateMatrixWorld(!0),r.applyTransformToCamera(e,t),r.targetWorldPosition.setFromMatrixPosition(r.seaLevel.matrixWorld),i.callback&&i.callback(r),TT.crs=e.referenceCrs,TT.setFromVector3(r.targetWorldPosition).as(kT(e).extent.crs,r.coord),e.notifyChange(t)},this.removeAll=function(t){this.removeAll=function(){},a.removeAll(),this.animationFrameRequester&&e.removeFrameRequester(Kb,this.animationFrameRequester),h.resolve(void 0!==t),this.animationFrameRequester=null},c[c.length-1].onComplete(this.removeAll),c.forEach((function(e){return e.start()})),e.addFrameRequester(Kb,this.animationFrameRequester),e.notifyChange(t),h}},{key:"stop",value:function(e){this.removePlaceTargetOnGround(e),this.removeAll()}},{key:"addPlaceTargetOnGround",value:function(e,t,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{t:1};if(this.removePlaceTargetOnGround(e),e&&t){var a=this.target.position.z;this.placeTargetOnGround=function(){var o=Math.max(0,Sb.getElevationValueAt(kT(e),n||i.coord,Sb.PRECISE_READ_Z)||0);i.target.position.z=a*(1-r.t)+o*r.t,i.target.updateMatrixWorld(!0),i.applyTransformToCamera(e,t)},this.placeTargetOnGround(),e.addFrameRequester(Kb,this.placeTargetOnGround)}}},{key:"removePlaceTargetOnGround",value:function(e){e&&this.placeTargetOnGround&&(e.removeFrameRequester(Kb,this.placeTargetOnGround),this.placeTargetOnGround=null)}},{key:"tilt",get:function(){return Hh.radToDeg(this.target.rotation.x)}},{key:"heading",get:function(){return FT(Hh.radToDeg(this.target.rotation.z)+180)}},{key:"range",get:function(){return this.camera.position.y}}]),n}(zt);function UT(e){return IT[e.uuid]=IT[e.uuid]||new PT(e),IT[e.uuid]}var DT,RT,OT,NT={defaultStopPlaceOnGroundAtEnd:!1,Easing:ud.Easing,stop:function(e,t){UT(t).stop(e)},getTransformCameraLookingAtTarget:function(e,t,n){var i=UT(t);return i.setfromCamera(e,t,n),i.getParams()},transformCameraToLookAtTarget:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.isExtent&&(n=this.getCameraTransformOptionsFromExtent(e,t,n)),n.proxy=void 0===n.proxy||n.proxy;var i=UT(t);return i.stop(e),i.setfromCamera(e,t),n.proxy&&i.setProxy(e,t),i.applyParams(e,n),i.addPlaceTargetOnGround(e,t,n.coord),i.applyTransformToCamera(e,t),e.notifyChange(t),Promise.resolve(i.getParams())},getCameraTransformOptionsFromExtent:function(e,t,n){var i,r={coord:new ob(n.crs,0,0,0),heading:0,tilt:e.isPlanarView?90:89.9};if(e.isGlobeView?(n=n.as("EPSG:4326"),yT||(yT=new ET),yT.setFromExtent(n),yT.box3D.getSize(LT),i={x:LT.y,y:LT.x}):i=(n=n.as(e.referenceCrs)).dimensions(),n.center(r.coord),t.isOrthographicCamera)i.x/i.y>t.aspect?t.zoom=(t.right-t.left)/i.x:t.zoom=(t.top-t.bottom)/i.y,t.updateProjectionMatrix(),r.range=1e3;else if(t.isPerspectiveCamera){var a=et.degToRad(t.fov);if(i.x/i.y>t.aspect){var o=.5*e.domElement.clientHeight/Math.tan(.5*a),s=2*Math.atan(.5*e.domElement.clientWidth/o);r.range=i.x/(2*Math.tan(.5*s))}else r.range=i.y/(2*Math.tan(.5*a))}return r},animateCameraToLookAtTarget:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i.proxy=void 0===i.proxy||i.proxy;var r=UT(t);return r.stop(e),i.proxy&&r.setProxy(e,t),r.animateCameraToLookAtTarget(e,t,i).promise.then((function(t){var i=r.getParams();return(void 0===i.stopPlaceOnGroundAtEnd?n.defaultStopPlaceOnGroundAtEnd:i.stopPlaceOnGroundAtEnd)&&r.stop(e),i.finished=t,i}))},sequenceAnimationsToLookAtTarget:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[{}],r=function(e){return e.reduce((function(e,t){return e.then((function(e){return!e.length||e[e.length-1].finished?t().then(Array.prototype.concat.bind(e)):Promise.resolve([{finished:!1}])}))}),Promise.resolve([]))},a=i.map((function(i){return function(){return n.animateCameraToLookAtTarget(e,t,i)}}));return r(a)},getDiffParams:function(e,t){var n;if(e&&t)return Math.abs(e.range-t.range)/e.range>.001&&((n=n||{}).range={previous:e.range,new:t.range}),Math.abs(e.tilt-t.tilt)>.1&&((n=n||{}).tilt={previous:e.tilt,new:t.tilt}),Math.abs(e.heading-t.heading)>.1&&((n=n||{}).heading={previous:e.heading,new:t.heading}),(Math.abs(e.coord.x-t.coord.x)>1e-6||Math.abs(e.coord.y-t.coord.y)>1e-6)&&((n=n||{}).coord={previous:e.coord,new:t.coord}),n}},zT=37,QT=38,GT=39,HT=40,VT=16,jT=17,WT=function(){function e(){s(this,e),this.NONE={},this.ORBIT={mouseButton:_.LEFT,keyboard:jT,enable:!0,finger:2},this.DOLLY={mouseButton:_.MIDDLE,enable:!0},this.PAN={mouseButton:_.RIGHT,up:QT,bottom:HT,left:zT,right:GT,enable:!0,finger:3},this.MOVE_GLOBE={mouseButton:_.LEFT,enable:!0,finger:1},this.PANORAMIC={mouseButton:_.LEFT,keyboard:VT,enable:!0}}return A(e,[{key:"inputToState",value:function(e,t){for(var n=0,i=Object.keys(this);n1&&void 0!==arguments[1]&&arguments[1];return(e=Object.assign({},e)).coord&&Array.isArray(e.coord)&&(e.coord=new ob("EPSG:4326").setFromArray(e.coord).as("EPSG:4978",DT)),Math.abs(e.heading-this.getHeading())<.5&&(e.heading=this.getHeading()),this.lookAtCoordinate(e,t)}},{key:"flyTo",value:function(e){return this.setView(e,!0)}},{key:"fit",value:function(e){if(e){var t=(new tn).setFromObject(e).getSize(new at);return this.flyTo({coord:new ob("EPSG:4978").setFromVector3(e.getWorldPosition(new at)).as("EPSG:4326"),range:Math.max(t.x,t.z),tilt:90})}}},{key:"lookAtCoordinate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.isAnimationEnabled();if(!t.isExtent&&(t.zoom?t.range=this.view.tileLayer.computeDistanceCameraFromTileZoom(t.zoom,this.view.camera):t.scale&&(t.range=this.view.getScaleFromDistance(t.pitch,t.scale),(t.rangethis.maxDistance)&&(console.warn("This scale ".concat(t.scale," can not be reached")),t.range=Hh.clamp(t.range,this.minDistance,this.maxDistance))),void 0!==t.tilt)){var i=90-Hh.radToDeg(this.maxPolarAngle),r=90-Hh.radToDeg(this.minPolarAngle);(t.tiltr)&&(t.tilt=Hh.clamp(t.tilt,i,r),console.warn("Tilt was clamped to ",t.tilt," the interval is between ".concat(i," and ").concat(r," degree")))}return n?(t.callback=function(e){},this.dispatchEvent({type:"animation-started"}),NT.animateCameraToLookAtTarget(this.view,this.camera,t).then((function(t){return e.dispatchEvent({type:"animation-ended"}),t}))):NT.transformCameraToLookAtTarget(this.view,this.camera,t).then((function(e){return e}))}}]),n}(Je),YT=1e-6,KT=new tt,ZT=new tt,JT=new tt,qT=new Gc(1,.01,0),$T=new Gc(1,0,0),e_=1,t_=new tt,n_=new tt,i_=new tt,r_=new at,a_=new tt,o_=new tt,s_=new tt,l_=new nt,A_=new ob("EPSG:4978"),c_=new ob("EPSG:4978",0,0,0),h_=new ob("EPSG:4326",0,0,0);function u_(e,t){c_.setFromVector3(e).as("EPSG:4326",h_),t.position.copy(e),t.lookAt(h_.geodesicNormal.add(e)),t.rotateX(.5*Math.PI),t.updateMatrixWorld(!0)}var d_,f_,p_=0,m_=!0,v_=.25,g_=new nt(0,0,0,1),y_=new at,w_=new at,x_=new nt,b_=new an,M_=new at,C_=new at,B_={},E_="orientation-changed",S_="range-changed",T_="camera-target-changed",__=new nt,I_=new nt,L_=new at(1,0,0),F_=1/0,k_=new at,P_=new at,U_=new Nc,D_=new at,R_=new at,O_=new an,N_=function(e){h(n,e);var t=y(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),(r=t.call(this,e)).player=new oT,r.states=new WT,r.state=r.states.NONE,r.enabled=!0,a.zoomSpeed&&(console.warn("Controls zoomSpeed parameter is deprecated. Use zoomInFactor and zoomOutFactor instead."),a.zoomFactor=a.zoomFactor||a.zoomSpeed),r.zoomFactor=a.zoomFactor||1.25,r.minDistance=a.minDistance||50,r.maxDistance=a.maxDistance||8*qx.x,r.minZoom=0,r.maxZoom=1/0,r.rotateSpeed=a.rotateSpeed||.25,r.keyPanSpeed=7,r.minPolarAngle=Hh.degToRad(.5),r.maxPolarAngle=Hh.degToRad(86),r.minAzimuthAngle=-1/0,r.maxAzimuthAngle=1/0,r.handleCollision=void 0===a.handleCollision||a.handleCollision,r.minDistanceCollision=60,r.enableKeys=!0,r.enableDamping=!0,r.dampingMoveFactor=null!=a.dampingMoveFactor?a.dampingMoveFactor:v_,r.enablePan=!0,r.startEvent={type:"start"},r.endEvent={type:"end"},r.updateHelper=function(){},r._onEndingMove=null,r._onMouseMove=r.onMouseMove.bind(v(r)),r._onMouseUp=r.onMouseUp.bind(v(r)),r._onMouseDown=r.onMouseDown.bind(v(r)),r._onMouseWheel=r.onMouseWheel.bind(v(r)),r._onContextMenuListener=r.onContextMenuListener.bind(v(r)),r._ondblclick=r.ondblclick.bind(v(r)),r._onTouchStart=r.onTouchStart.bind(v(r)),r._update=r.update.bind(v(r)),r._onTouchMove=r.onTouchMove.bind(v(r)),r._onKeyDown=r.onKeyDown.bind(v(r)),r._onKeyUp=r.onKeyUp.bind(v(r)),r._onBlurListener=r.onBlurListener.bind(v(r)),r.view.domElement.addEventListener("contextmenu",r._onContextMenuListener,!1),r.view.domElement.addEventListener("mousedown",r._onMouseDown,!1),r.view.domElement.addEventListener("mousewheel",r._onMouseWheel,!1),r.view.domElement.addEventListener("dblclick",r._ondblclick,!1),r.view.domElement.addEventListener("DOMMouseScroll",r._onMouseWheel,!1),r.view.domElement.addEventListener("touchstart",r._onTouchStart,!1),r.view.domElement.addEventListener("touchend",r._onMouseUp,!1),r.view.domElement.addEventListener("touchmove",r._onTouchMove,!1),r.player.addEventListener("animation-frame",r._update),window.addEventListener("keydown",r._onKeyDown,!1),window.addEventListener("keyup",r._onKeyUp,!1),window.addEventListener("blur",r._onBlurListener),OT||((OT=new zt).matrixWorldInverse=new bt),e.scene.add(OT),i.isExtent?i.center().as("EPSG:4978",c_):(i.coord.as("EPSG:4978",c_),i.tilt=i.tilt||89.5,i.heading=i.heading||0),u_(c_,OT),r.lookAtCoordinate(i,!1),A_.crs=r.view.referenceCrs,r}return A(n,[{key:"dollyInScale",get:function(){return this.zoomFactor}},{key:"dollyOutScale",get:function(){return 1/this.zoomFactor}},{key:"isPaused",get:function(){return this.state==this.states.NONE}},{key:"onEndingMove",value:function(e){this._onEndingMove&&(this.player.removeEventListener("animation-stopped",this._onEndingMove),this._onEndingMove=null),this.state=this.states.NONE,this.handlingEvent(e)}},{key:"rotateLeft",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;$T.theta-=e}},{key:"rotateUp",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;$T.phi-=e}},{key:"panLeft",value:function(e){var t=this.camera.matrix.elements;r_.fromArray(t),r_.multiplyScalar(-e),y_.add(r_)}},{key:"panUp",value:function(e){var t=this.camera.matrix.elements;r_.fromArray(t,4),r_.multiplyScalar(e),y_.add(r_)}},{key:"mouseToPan",value:function(e,t){var n=this.view.mainLoop.gfxEngine;if(this.state=this.states.PAN,this.camera.isPerspectiveCamera){var i=this.camera.position.distanceTo(this.getCameraTargetPosition());i*=2*Math.tan(Hh.degToRad(.5*this.camera.fov)),this.panLeft(e*i/n.width*this.camera.aspect),this.panUp(t*i/n.height)}else this.camera.isOrthographicCamera&&(this.panLeft(e*(this.camera.right-this.camera.left)/n.width),this.panUp(t*(this.camera.top-this.camera.bottom)/n.height))}},{key:"dolly",value:function(e){0!==e&&(RT=e>0?this.dollyInScale:this.dollyOutScale,this.camera.isPerspectiveCamera?e_/=RT:this.camera.isOrthographicCamera&&(this.camera.zoom=Hh.clamp(this.camera.zoom*RT,this.minZoom,this.maxZoom),this.camera.updateProjectionMatrix(),this.view.notifyChange(this.camera)))}},{key:"getMinDistanceCameraBoundingSphereObbsUp",value:function(e){if(e.level>10&&1==e.children.length&&e.geometry){var t=e.obb;O_.center.copy(this.camera.position),O_.radius=this.minDistanceCollision,t.isSphereAboveXYBox(O_)&&(F_=Math.min(O_.center.z-t.box3D.max.z,F_))}}},{key:"update",value:function(){if(F_=1/0,this.handleCollision&&this.view.tileLayer){var e,t=S(this.view.tileLayer.level0Nodes);try{for(t.s();!(e=t.n()).done;){e.value.traverse(this.getMinDistanceCameraBoundingSphereObbsUp.bind(this))}}catch(e){t.e(e)}finally{t.f()}}switch(this.state){case this.states.MOVE_GLOBE:if(F_<0)OT.translateY(-F_),this.camera.position.setLength(this.camera.position.length()-F_);else if(F_o&&$T.phi>0){var s=a-o,l=1-(s-(F_-o))/s;$T.phi*=l*l}else if(F_-o&&$T.phi>-.01){var A=2*o,c=-Math.asin(.25*(o-F_)/qT.radius);c=Hh.clamp(c,-.01,0);var h=1-(o-F_)/A;$T.phi=Hh.lerp($T.phi,c,h),F_-=Math.sin($T.phi)*qT.radius}qT.theta+=$T.theta,qT.phi+=$T.phi,qT.theta=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,qT.theta)),qT.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,qT.phi)),qT.radius=this.camera.position.length()*e_,qT.makeSafe(),qT.radius=Math.max(this.minDistance,Math.min(this.maxDistance,qT.radius)),this.camera.position.setFromSpherical(qT),F_<0&&(this.camera.position.y-=F_,qT.setFromVector3(this.camera.position),$T.phi=0),OT.localToWorld(this.camera.position)}this.camera.up.copy(OT.position).normalize(),this.camera.lookAt(OT.position),this.enableDamping?($T.theta*=.75,$T.phi*=.75,l_.slerp(g_,.2*this.dampingMoveFactor)):($T.theta=0,$T.phi=0,l_.set(0,0,0,1)),e_=1,y_.set(0,0,0),(w_.distanceToSquared(this.camera.position)>YT||8*(1-x_.dot(this.camera.quaternion))>YT)&&(this.view.notifyChange(this.camera),w_.copy(this.camera.position),x_.copy(this.camera.quaternion)),this.enableDamping&&this.state===this.states.ORBIT&&this.player.isStopped()&&($T.theta>YT||$T.phi>YT)&&this.player.playLater(60,2),this.view.dispatchEvent({type:GS,coord:A_.setFromVector3(OT.position),range:qT.radius,heading:-Hh.radToDeg(qT.theta),tilt:90-Hh.radToDeg(qT.phi)})}},{key:"onMouseMove",value:function(e){if(this.player.isPlaying()&&this.player.stop(),!1!==this.enabled){e.preventDefault();var t=this.view.eventToViewCoords(e);switch(this.state){case this.states.ORBIT:case this.states.PANORAMIC:ZT.copy(t),JT.subVectors(ZT,KT);var n=this.view.mainLoop.gfxEngine;this.rotateLeft(2*Math.PI*JT.x/n.width*this.rotateSpeed),this.rotateUp(2*Math.PI*JT.y/n.height*this.rotateSpeed),KT.copy(ZT);break;case this.states.DOLLY:o_.copy(t),s_.subVectors(o_,a_),this.dolly(-s_.y),a_.copy(o_);break;case this.states.PAN:this.enablePan&&(n_.copy(t),i_.subVectors(n_,t_),this.mouseToPan(i_.x,i_.y),t_.copy(n_));break;case this.states.MOVE_GLOBE:var i=this.view.viewToNormalizedCoords(t);U_.setFromCamera(i,this.camera),U_.ray.intersectSphere(b_,C_)?(P_.copy(C_).normalize(),l_.setFromUnitVectors(P_,k_),p_=Date.now()):this.onMouseUp()}this.state!==this.states.NONE&&this.update()}}},{key:"updateTarget",value:function(){this.view.getPickingPositionFromDepth(null,R_);var e=isNaN(R_.x)?100:this.camera.position.distanceTo(R_);D_.set(0,0,-e),this.camera.localToWorld(D_),u_(D_,OT),OT.matrixWorldInverse.copy(OT.matrixWorld).invert(),D_.copy(this.camera.position),D_.applyMatrix4(OT.matrixWorldInverse),qT.setFromVector3(D_)}},{key:"handlingEvent",value:function(e){e=e||NT.getTransformCameraLookingAtTarget(this.view,this.camera);var t=NT.getDiffParams(f_,e);if(t&&(t.range&&this.dispatchEvent({type:S_,previous:t.range.previous,new:t.range.new}),t.coord&&this.dispatchEvent({type:T_,previous:t.coord.previous,new:t.coord.new}),t.tilt||t.heading)){var n={type:E_};t.tilt&&(n.previous={tilt:t.tilt.previous},n.new={tilt:t.tilt.new}),t.heading&&(n.previous=n.previous||{},n.new=n.new||{},n.new.heading=t.heading.new,n.previous.heading=t.heading.previous),this.dispatchEvent(n)}}},{key:"onMouseDown",value:function(e){if(NT.stop(this.view,this.camera),this.player.stop(),this.onEndingMove(),!1!==this.enabled){this.updateTarget(),f_=NT.getTransformCameraLookingAtTarget(this.view,this.camera,R_),this.state=this.states.inputToState(e.button,d_);var t=this.view.eventToViewCoords(e);switch(this.state){case this.states.ORBIT:case this.states.PANORAMIC:KT.copy(t);break;case this.states.MOVE_GLOBE:this.view.getPickingPositionFromDepth(t,M_)?(b_.radius=M_.length(),k_.copy(M_).normalize(),this.updateHelper(M_,B_.picking)):this.state=this.states.NONE;break;case this.states.DOLLY:a_.copy(t);break;case this.states.PAN:t_.copy(t)}this.state!=this.states.NONE&&(this.view.domElement.addEventListener("mousemove",this._onMouseMove,!1),this.view.domElement.addEventListener("mouseup",this._onMouseUp,!1),this.view.domElement.addEventListener("mouseleave",this._onMouseUp,!1),this.dispatchEvent(this.startEvent))}}},{key:"ondblclick",value:function(e){if(!1!==this.enabled&&!d_){this.player.stop();var t=this.view.getPickingPositionFromDepth(this.view.eventToViewCoords(e)),n=this.getRange(t);return t&&n>this.minDistance?this.lookAtCoordinate({coord:new ob("EPSG:4978",t),range:.6*n,time:1500}):void 0}}},{key:"onMouseUp",value:function(){var e=this;!1!==this.enabled&&(this.view.domElement.removeEventListener("mousemove",this._onMouseMove,!1),this.view.domElement.removeEventListener("mouseup",this._onMouseUp,!1),this.view.domElement.removeEventListener("mouseleave",this._onMouseUp,!1),this.dispatchEvent(this.endEvent),this.player.stop(),this.enableDamping?this.state===this.states.ORBIT&&($T.theta>YT||$T.phi>YT)?(this.player.play(60),this._onEndingMove=function(){return e.onEndingMove()},this.player.addEventListener("animation-stopped",this._onEndingMove)):this.state===this.states.MOVE_GLOBE&&Date.now()-p_<50?(this.player.play(120),this._onEndingMove=function(){return e.onEndingMove()},this.player.addEventListener("animation-stopped",this._onEndingMove)):this.onEndingMove():this.onEndingMove())}},{key:"onMouseWheel",value:function(e){if(this.player.stop(),this.enabled&&this.states.DOLLY.enable){NT.stop(this.view,this.camera),e.preventDefault(),this.updateTarget();var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),this.dolly(t);var n=this.getRange(R_);this.update();var i=this.getRange(R_);Math.abs(i-n)/n>.001&&this.dispatchEvent({type:S_,previous:n,new:i}),this.dispatchEvent(this.startEvent),this.dispatchEvent(this.endEvent)}}},{key:"onKeyUp",value:function(){!1!==this.enabled&&!1!==this.enableKeys&&(d_=void 0)}},{key:"onKeyDown",value:function(e){if(this.player.stop(),!1!==this.enabled&&!1!==this.enableKeys)switch(d_=e.keyCode,e.keyCode){case this.states.PAN.up:this.mouseToPan(0,this.keyPanSpeed),this.state=this.states.PAN,this.update();break;case this.states.PAN.bottom:this.mouseToPan(0,-this.keyPanSpeed),this.state=this.states.PAN,this.update();break;case this.states.PAN.left:this.mouseToPan(this.keyPanSpeed,0),this.state=this.states.PAN,this.update();break;case this.states.PAN.right:this.mouseToPan(-this.keyPanSpeed,0),this.state=this.states.PAN,this.update()}}},{key:"onTouchStart",value:function(e){if(this.player.stop(),!1!==this.enabled&&(this.state=this.states.touchToState(e.touches.length),this.updateTarget(),this.state!==this.states.NONE)){switch(this.state){case this.states.MOVE_GLOBE:var t=this.view.eventToViewCoords(e);this.view.getPickingPositionFromDepth(t,M_)?(b_.radius=M_.length(),k_.copy(M_).normalize(),this.updateHelper(M_,B_.picking)):this.state=this.states.NONE;break;case this.states.ORBIT:case this.states.DOLLY:var n=e.touches[0].pageX,i=e.touches[0].pageY,r=n-e.touches[1].pageX,a=i-e.touches[1].pageY,o=Math.sqrt(r*r+a*a);a_.set(0,o),KT.set(n,i);break;case this.states.PAN:t_.set(e.touches[0].pageX,e.touches[0].pageY)}this.dispatchEvent(this.startEvent)}}},{key:"onTouchMove",value:function(e){if(this.player.isPlaying()&&this.player.stop(),!1!==this.enabled){switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case this.states.MOVE_GLOBE.finger:var t=this.view.eventToViewCoords(e),n=this.view.viewToNormalizedCoords(t);U_.setFromCamera(n,this.camera),U_.ray.intersectSphere(b_,C_)?(P_.copy(C_).normalize(),l_.setFromUnitVectors(P_,k_),p_=Date.now()):this.onMouseUp.bind(this)();break;case this.states.ORBIT.finger:case this.states.DOLLY.finger:var i=this.view.mainLoop.gfxEngine;ZT.set(e.touches[0].pageX,e.touches[0].pageY),JT.subVectors(ZT,KT),this.rotateLeft(2*Math.PI*JT.x/i.width*this.rotateSpeed),this.rotateUp(2*Math.PI*JT.y/i.height*this.rotateSpeed),KT.copy(ZT);var r=e.touches[0].pageX-e.touches[1].pageX,a=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(r*r+a*a);o_.set(0,o),s_.subVectors(o_,a_),this.dolly(s_.y),a_.copy(o_);break;case this.states.PAN.finger:n_.set(e.touches[0].pageX,e.touches[0].pageY),i_.subVectors(n_,t_),this.mouseToPan(i_.x,i_.y),t_.copy(n_);break;default:this.state=this.states.NONE}this.state!==this.states.NONE&&this.update()}}},{key:"onContextMenuListener",value:function(e){e.preventDefault()}},{key:"onBlurListener",value:function(){this.onKeyUp(),this.onMouseUp()}},{key:"dispose",value:function(){this.view.domElement.removeEventListener("contextmenu",this._onContextMenuListener,!1),this.view.domElement.removeEventListener("mousedown",this._onMouseDown,!1),this.view.domElement.removeEventListener("mousemove",this._onMouseMove,!1),this.view.domElement.removeEventListener("mousewheel",this._onMouseWheel,!1),this.view.domElement.removeEventListener("DOMMouseScroll",this._onMouseWheel,!1),this.view.domElement.removeEventListener("mouseup",this._onMouseUp,!1),this.view.domElement.removeEventListener("mouseleave",this._onMouseUp,!1),this.view.domElement.removeEventListener("dblclick",this._ondblclick,!1),this.view.domElement.removeEventListener("touchstart",this._onTouchStart,!1),this.view.domElement.removeEventListener("touchend",this._onMouseUp,!1),this.view.domElement.removeEventListener("touchmove",this._onTouchMove,!1),this.player.removeEventListener("animation-frame",this._onKeyUp),window.removeEventListener("keydown",this._onKeyDown,!1),window.removeEventListener("keyup",this._onKeyUp,!1),window.removeEventListener("blur",this._onBlurListener),this.dispatchEvent({type:"dispose"})}},{key:"pan",value:function(e){return this.mouseToPan(e.x,e.y),this.update(),Promise.resolve()}},{key:"getCameraOrientation",value:function(){return this.view.getPickingPositionFromDepth(null,R_),[this.getTilt(R_),this.getHeading(R_)]}},{key:"getCameraCoordinate",value:function(){return new ob("EPSG:4978",this.camera.position).as("EPSG:4326")}},{key:"getLookAtCoordinate",value:function(){return NT.getTransformCameraLookingAtTarget(this.view,this.camera).coord}},{key:"setAnimationEnabled",value:function(e){m_=e}},{key:"isAnimationEnabled",value:function(){return m_}},{key:"getZoom",value:function(){return this.view.tileLayer.computeTileZoomFromDistanceCamera(this.getRange(),this.view.camera)}},{key:"setZoom",value:function(e,t){return this.lookAtCoordinate({zoom:e},t)}},{key:"zoomIn",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.lookAtCoordinate({zoom:Math.min(this.getZoom()+1,18),time:500},e)}},{key:"zoomOut",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.lookAtCoordinate({zoom:this.getZoom()-1,time:500},e)}},{key:"getScale",value:function(e){return console.warn("Deprecated, use View#getScale instead."),this.view.getScale(e)}},{key:"pixelsToMeters",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.28;console.warn("Deprecated use View#getPixelsToMeters instead.");var n=this.getScale(t),i=e*t;return i/n/1e3}},{key:"pixelsToDegrees",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.28;console.warn("Deprecated, use View#getPixelsToMeters and GlobeControls#getMetersToDegrees instead.");var n=this.pixelsToMeters(e,t);return Hh.radToDeg(2*Math.asin(n/(2*qx.x)))}},{key:"metersToPixels",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.28;console.warn("Deprecated, use View#getMetersToPixels instead.");var n=this.getScale(t);return e*n/(t/=1e3)}},{key:"setScale",value:function(e,t,n){return this.lookAtCoordinate({scale:e,pitch:t},n)}},{key:"lookAtCoordinate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.isAnimationEnabled();if(!t.isExtent&&(t.zoom?t.range=this.view.tileLayer.computeDistanceCameraFromTileZoom(t.zoom,this.view.camera):t.scale&&(t.range=this.view.getScaleFromDistance(t.pitch,t.scale),(t.rangethis.maxDistance)&&(console.warn("This scale ".concat(t.scale," can not be reached")),t.range=Hh.clamp(t.range,this.minDistance,this.maxDistance))),void 0!==t.tilt)){var i=90-Hh.radToDeg(this.maxPolarAngle),r=90-Hh.radToDeg(this.minPolarAngle);(t.tiltr)&&(t.tilt=Hh.clamp(t.tilt,i,r),console.warn("Tilt was clamped to ",t.tilt," the interval is between ".concat(i," and ").concat(r," degree")))}return f_=NT.getTransformCameraLookingAtTarget(this.view,this.camera),n?(t.callback=function(e){return OT.position.copy(e.targetWorldPosition)},this.dispatchEvent({type:"animation-started"}),NT.animateCameraToLookAtTarget(this.view,this.camera,t).then((function(t){return e.dispatchEvent({type:"animation-ended"}),e.handlingEvent(t),t}))):NT.transformCameraToLookAtTarget(this.view,this.camera,t).then((function(t){return OT.position.copy(t.targetWorldPosition),e.handlingEvent(t),t}))}},{key:"getCameraTargetPosition",value:function(){return OT.position}}]),n}(XT);function z_(e){if(e.dispose)e.dispose();else if(e.geometry&&e.geometry.dispose(),e.material)if(Array.isArray(e.material)){var t,n=S(e.material);try{for(n.s();!(t=n.n()).done;){t.value.dispose()}}catch(e){n.e(e)}finally{n.f()}}else e.material.dispose()}function Q_(e,t){var n,i=S(e.children);try{for(i.s();!(n=i.n()).done;){Q_(n.value,t)}}catch(e){i.e(e)}finally{i.f()}t(e)}var G_=function(e){h(n,e);var t=y(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(s(this,n),a.cacheLifeTime=null==a.cacheLifeTime?WM.GEOMETRY:a.cacheLifeTime,(r=t.call(this,e,a)).isGeometryLayer=!0,!i||!i.isObject3D)throw new Error("Missing/Invalid object3d parameter (must be a\n three.js Object3D instance)");return"Group"===i.type&&""===i.name&&(i.name=e),Object.defineProperty(v(r),"object3d",{value:i,writable:!1,configurable:!0}),r.defineLayerProperty("opacity",1,(function(){(r.parent?r.parent.object3d:r.object3d).traverse((function(e){e.layer==v(r)?r.changeOpacity(e):e.content&&e.content.layer==v(r)&&e.content.traverse(r.changeOpacity)}))})),r.defineLayerProperty("wireframe",!1,(function(){(r.parent?r.parent.object3d:r.object3d).traverse((function(e){e.layer==v(r)&&e.material?e.material.wireframe=r.wireframe:e.content&&e.content.layer==v(r)&&e.content.traverse((function(e){e.material&&e.layer==v(r)&&(e.material.wireframe=r.wireframe)}))}))})),r.attachedLayers=[],r.visible=null==a.visible||a.visible,Object.defineProperty(r.zoom,"max",{value:1/0,writable:!1}),r.filteringExtent=!r.source.isFileSource,r.structure="3d",r}return A(n,[{key:"getObjectToUpdateForAttachedLayers",value:function(e){if(e.parent&&e.material)return{element:e,parent:e.parent}}},{key:"postUpdate",value:function(){}},{key:"culling",value:function(){return!0}},{key:"attach",value:function(e){if(!e.update)throw new Error("Missing 'update' function -> can't attach layer\n ".concat(e.id));this.attachedLayers.push(e),e.parent=this}},{key:"detach",value:function(e){var t=this.attachedLayers.length;return this.attachedLayers=this.attachedLayers.filter((function(t){return t.id!=e.id})),e.parent=void 0,this.attachedLayers.length2&&void 0!==arguments[2]?arguments[2]:this.options.defaultPickingRadius,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=this.parent?this.parent.object3d:this.object3d;return MS(e,t,n,r,i,this.threejsLayer)}},{key:"changeOpacity",value:function(e){e.material&&(null!=e.material.opacity&&(e.material.transparent=this.opacity<1,e.material.opacity=this.opacity),e.material.uniforms&&null!=e.material.uniforms.opacity&&(e.material.transparent=this.opacity<1,e.material.uniforms.opacity.value=this.opacity))}}]),n}(uE),H_=function(e){h(n,e);var t=y(n);function n(e,i,r,a){var o,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(s(this,n),o=t.call(this,e,i),!a)throw new Error("extent is mandatory to build a TileMesh");o.layer=r,o.extent=a,o.extent.zoom=l,o.level=l,o.material.objectId=o.id,o.obb=o.geometry.OBB.clone(),o.boundingSphere=new an,o.obb.box3D.getBoundingSphere(o.boundingSphere),o._tms=new Map;var A,c=S(r.tileMatrixSets);try{for(c.s();!(A=c.n()).done;){var h=A.value;o._tms.set(h,o.extent.tiledCovering(h))}}catch(e){c.e(e)}finally{c.f()}return o.frustumCulled=!1,o.matrixAutoUpdate=!1,o.rotationAutoUpdate=!1,o.layerUpdateState={},o.isTileMesh=!0,o.domElements={},o}return A(n,[{key:"setBBoxZ",value:function(e,t,n){null==e&&null==t||Math.floor(e)===Math.floor(this.obb.z.min)&&Math.floor(t)===Math.floor(this.obb.z.max)||(this.obb.updateZ(e,t,n),this.horizonCullingPointElevationScaled&&this.horizonCullingPointElevationScaled.setLength(this.obb.z.delta+this.horizonCullingPoint.length()),this.obb.box3D.getBoundingSphere(this.boundingSphere))}},{key:"getExtentsByProjection",value:function(e){return this._tms.get(Jx.formatToTms(e))}},{key:"findCommonAncestor",value:function(e){if(e)return e.level==this.level?e.id==this.id?e:0!=e.level?this.parent.findCommonAncestor(e.parent):void 0:e.level1&&(c.uvs[1]=new zn(c.uvs[1],1));var u=new AT(t,c);return u.OBB=new ET(u.boundingBox.min,u.boundingBox.max),u._count=0,u.dispose=function(){u._count--,u._count<=0&&(u.index=null,delete u.attributes.uv_0,si.prototype.dispose.call(u),j_.delete(o,t.level,s))},A(u),Promise.resolve({geometry:u,quaternion:r,position:a})}return l.then((function(e){return{geometry:e,quaternion:r,position:a}}))}(i,o).then((function(e){e.geometry._count++;var o=n.tileMatrixSets.length,s=new LM(n.materialOptions,o),l=new H_(e.geometry,s,n,t,a);if(r&&r.isTileMesh){var A=i.computeSharableExtent(r.extent);e.position.sub(A.position).applyQuaternion(A.quaternion.invert()),e.quaternion.premultiply(A.quaternion)}return l.position.copy(e.position),l.quaternion.copy(e.quaternion),l.visible=!1,l.updateMatrix(),l.add(l.obb),function(e,t){if(e.material.transparent=t.opacity<1,e.material.opacity=t.opacity,t.diffuse&&(e.material.diffuse=t.diffuse),__DEBUG__&&(e.material.showOutline=t.showOutline||!1,e.material.wireframe=t.wireframe||!1),t.isGlobeLayer){e.horizonCullingPoint=e.extent.center().as("EPSG:4978").toVector3(),e.extent.dimensions(W_).multiplyScalar(Hh.DEG2RAD);var n=W_.length(),i=Math.abs(1/Math.cos(.5*n));e.horizonCullingPoint.setLength(i*e.horizonCullingPoint.length()),e.horizonCullingPointElevationScaled=e.horizonCullingPoint.clone()}}(l,n),r&&l.setBBoxZ(r.obb.z.min,r.obb.z.max),l}))};function Y_(e,t,n,i,r){if(e.isCancelledCommandException)t.layerUpdateState[n.id].success();else if(e instanceof SyntaxError)t.layerUpdateState[n.id].failure(0,!0);else{__DEBUG__&&(n.isColorLayer?console.warn("Error in process color on layer",n.id,", node",t,e):n.isElevationLayer?console.warn("Error in process elevation on layer",n.id,", node",t,e):console.warn("Error in process feature on layer",n.id,", node",t,e));var a=t.layerUpdateState[n.id].errorCount>4;t.layerUpdateState[n.id].failure(Date.now(),a,{targetLevel:i}),a||window.setTimeout((function(){r.notifyChange(t,!1)}),1e3*t.layerUpdateState[n.id].secondsUntilNextTry())}}var K_=Math.pow(131072,.5);function Z_(e){return e.visible?100:10}function J_(e){return!e.requester.parent||!e.requester.material||(!!(e.layer.isElevationLayer&&e.requester.material.getElevationLayer()&&e.targetLevel<=e.requester.material.getElevationLayer().level)||!e.requester.material.visible)}function q_(e,t,n,i,r){return{view:e,layer:t,extentsSource:n,extentsDestination:i,requester:r,priority:Z_(r.material),earlyDropFunction:J_}}function $_(e){return function(t){t.material&&t.material.removeLayer&&(t.material.removeLayer(e),t.material.elevationLayerIds[0]==e&&t.setBBoxZ(0,0)),t.layerUpdateState&&t.layerUpdateState[e]&&delete t.layerUpdateState[e]}}var eI,tI=new at,nI=new at,iI=function(e){h(n,e);var t=y(n);function n(e,i,r,a,o){var l;if(s(this,n),o.cacheLifeTime=WM.INFINITE,o.source=!1,(l=t.call(this,e,i,o)).isTiledGeometryLayer=!0,l.protocol="tile",l.sseSubdivisionThreshold=l.sseSubdivisionThreshold||1,l.schemeTile=r,l.builder=a,l.info=new jM(v(l)),!l.schemeTile)throw new Error("Cannot init tiled layer without schemeTile for layer ".concat(l.id));if(!l.builder)throw new Error("Cannot init tiled layer without builder for layer ".concat(l.id));l.level0Nodes=[];var A,c=[],h=S(l.schemeTile);try{for(h.s();!(A=h.n()).done;){var u=A.value;c.push(l.convert(void 0,u))}}catch(e){h.e(e)}finally{h.f()}return l._promises.push(Promise.all(c).then((function(e){var t;l.level0Nodes=e,(t=l.object3d).add.apply(t,C(e)),l.object3d.updateMatrixWorld()}))),l}return A(n,[{key:"pickObjectsAt",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.options.defaultPickingRadius,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return bS(e,t,n,this,i)}},{key:"preUpdate",value:function(e,t){var n=this;if(t.has(void 0)||0==t.size)return this.level0Nodes;__DEBUG__&&(this._latestUpdateStartingLevel=0),e.colorLayers=e.view.getLayers((function(e,t){return t&&t.id==n.id&&e.isColorLayer})),e.elevationLayers=e.view.getLayers((function(e,t){return t&&t.id==n.id&&e.isElevationLayer})),e.maxElevationLevel=-1;var i,r,a=S(e.elevationLayers);try{for(a.s();!(i=a.n()).done;){var o=i.value;e.maxElevationLevel=Math.max(o.source.zoom.max,e.maxElevationLevel)}}catch(e){a.e(e)}finally{a.f()}-1==e.maxElevationLevel&&(e.maxElevationLevel=1/0),this.colorLayersOrder=dE(e.colorLayers);var s,l=S(t.values());try{for(l.s();!(s=l.n()).done;){var A=s.value;if(A.isCamera)return this.level0Nodes;if(A.layer===this){if(r){if(!(r=A.findCommonAncestor(r)))return this.level0Nodes}else r=A;null==r.material&&(r=void 0)}}}catch(e){l.e(e)}finally{l.f()}return r?(__DEBUG__&&(this._latestUpdateStartingLevel=r.level),[r]):this.level0Nodes}},{key:"update",value:function(e,t,i){var r=this;if(!i.parent)return LS.removeChildrenAndCleanup(this,i);if(i.parent.pendingSubdivision)return i.visible=!1,i.material.visible=!1,void this.info.update(i);if(i.visible=!this.culling(i,e.camera),i.visible){var a=!1;return i.material.visible=!0,this.info.update(i),(i.pendingSubdivision||n.hasEnoughTexturesToSubdivide(e,i)&&this.subdivision(e,this,i))&&(this.subdivideNode(e,i),i.material.visible=i.pendingSubdivision,this.info.update(i),a=!0),i.material.visible&&!a?LS.removeChildren(this,i):a?i.children.filter((function(e){return e.layer==r})):void 0}return i.material.visible=!1,this.info.update(i),LS.removeChildren(this,i)}},{key:"convert",value:function(e,t){return X_(e,t,this)}},{key:"countColorLayersTextures",value:function(){return arguments.length}},{key:"culling",value:function(e,t){return!t.isBox3Visible(e.obb.box3D,e.obb.matrixWorld)}},{key:"subdivideNode",value:function(e,t){var n=this;if(!t.pendingSubdivision&&!t.children.some((function(e){return e.layer==n}))){var i=t.extent.subdivision();t.pendingSubdivision=!0;var r={view:e.view,requester:t,layer:this,priority:1e4,extentsSource:i,redraw:!1};return e.scheduler.execute(r).then((function(n){var i,r=S(n);try{for(r.s();!(i=r.n()).done;){var a=i.value;t.add(a),a.updateMatrixWorld(!0)}}catch(e){r.e(e)}finally{r.f()}t.pendingSubdivision=!1,e.view.notifyChange(t,!1)}),(function(e){if(t.pendingSubdivision=!1,!e.isCancelledCommandException)throw new Error(e)}))}}},{key:"subdivision",value:function(e,t,n){if(n.levelo.zoom.max||sc.zoom.max||h2&&void 0!==arguments[2]?arguments[2]:{};s(this,n);var o=yb.get(Jx.tms_4326),l=gb.get("EPSG:4326").subdivisionByScheme(o);a.tileMatrixSets=[Jx.tms_4326,Jx.tms_3857];var A=a.tileMatrixSets.length,c=new wT({crs:"EPSG:4978",uvCount:A});(r=t.call(this,e,i||new ja,l,c,a)).isGlobeLayer=!0,r.options.defaultPickingRadius=5,r.minSubdivisionLevel=null==r.minSubdivisionLevel?2:r.minSubdivisionLevel,r.maxSubdivisionLevel=null==r.maxSubdivisionLevel?19:r.maxSubdivisionLevel,r.maxDeltaElevation=r.maxDeltaElevation||4,r.extent=r.schemeTile[0].clone();for(var h=1;h0:oI degrees, and the cosine of that","// earth shadow hack","const float cutoffAngle = pi/1.95;","const float steepness = 1.5;","vec3 totalRayleigh(vec3 lambda)","{","return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));","}","// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE","vec3 simplifiedRayleigh()","{","return 0.0005 / vec3(94, 40, 18);","}","float rayleighPhase(float cosTheta)","{ ","return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));","}","vec3 totalMie(vec3 lambda, vec3 K, float T)","{","float c = (0.2 * T ) * 10E-18;","return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;","}","float hgPhase(float cosTheta, float g)","{","return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));","}","float sunIntensity(float zenithAngleCos)","{","return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));","}","// float logLuminance(vec3 c)","// {","// return log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);","// }","// Filmic ToneMapping http://filmicgames.com/archives/75","float A = 0.15;","float B = 0.50;","float C = 0.10;","float D = 0.20;","float E = 0.02;","float F = 0.30;","float W = 1000.0;","vec3 Uncharted2Tonemap(vec3 x)","{","return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;","}","void main() ","{","vec3 up2 = normalize(cameraPosition.xyz);","float sunfade = 1.0-clamp(1.0-exp((v3LightPosition.y/450000.0)),0.0,1.0);","float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));","vec3 sunDirection = normalize(v3LightPosition);","float sunE = sunIntensity(dot(sunDirection, up2));","// extinction (absorbtion + out scattering) ","// rayleigh coefficients","vec3 betaR = simplifiedRayleigh() * reileighCoefficient;","// mie coefficients","vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;","// optical length","// cutoff angle at 90 to avoid singularity in next formula.","float zenithAngle = acos(max(0.0, dot(up2, normalize(vWorldPosition - cameraPosition))));","float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","// combined extinction factor","vec3 Fex = exp(-(betaR * sR + betaM * sM));","// in scattering","float cosTheta = dot(normalize(vWorldPosition - cameraPosition), sunDirection);","float rPhase = rayleighPhase(cosTheta*0.5+0.5);","vec3 betaRTheta = betaR * rPhase;","float mPhase = hgPhase(cosTheta, mieDirectionalG);","vec3 betaMTheta = betaM * mPhase;","vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));","Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up2, sunDirection),5.0),0.0,1.0));","//nightsky","vec3 direction = normalize(vWorldPosition - cameraPosition);","float theta = acos(direction.y); // elevation --\x3e y-axis, [-pi/2, pi/2]","float phi = atan(direction.z, direction.x); // azimuth --\x3e x-axis [-pi/2, pi/2]","vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);","// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;","vec3 L0 = vec3(0.1) * Fex;","// composition + solar disc","//if (cosTheta > sunAngularDiameterCos)","float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);","// if (normalize(vWorldPosition - cameraPosition).y>0.0)","L0 += (sunE * 19000.0 * Fex)*sundisk;","vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));","vec3 texColor = (Lin+L0); ","texColor *= 0.04 ;","texColor += vec3(0.0,0.001,0.0025)*0.3;","float g_fMaxLuminance = 1.0;","float fLumScaled = 0.1 / luminance; ","float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ","float ExposureBias = fLumCompressed;","vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);","vec3 color = curr*whiteScale;","vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));","gl_FragColor.rgb = retColor;","gl_FragColor.a = 1. - ( (length(cameraPosition) - 6400000.) / 1000.);","}"].join("\n")},hI=function(e){h(n,e);var t=y(n);function n(){s(this,n);var e=Di.clone(cI.uniforms),i=new Ri({fragmentShader:cI.fragmentShader,vertexShader:cI.vertexShader,uniforms:e,side:1,transparent:!0,depthWrite:!1}),r=new el(4e4,32,15);return t.call(this,r,i)}return A(n)}(Ei),uI="\n#include \n\nuniform int atmoIN;\nvarying float intensity;\n\nvec4 glowColor = vec4(0.45, 0.74, 1. ,1.0);\n\nvoid main() {\n #include \n gl_FragColor = glowColor * intensity;\n}\n",dI="\n#include \n#include \n\nuniform int atmoIN;\nvarying float intensity;\n\nvoid main()\n{\n vec3 normalES = normalize( normalMatrix * normal );\n vec3 normalCAMES = normalize( normalMatrix * cameraPosition );\n\n if(atmoIN == 0) {\n intensity = pow(0.666 - dot(normalES, normalCAMES), 4. );\n } else {\n intensity = pow( 1. - dot(normalES, normalCAMES), 0.8 );\n }\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n #include \n}\n",fI=new at(1,0,0),pI=new at,mI=new ob("EPSG:4326"),vI=new ob("EPSG:4326"),gI=new Fn(9688568),yI=new Fn,wI=new Fn(197896),xI=6e5,bI=160*qx.x,MI=function(e){h(n,e);var t=y(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"atmosphere",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,n),r.source=!1,(e=t.call(this,i,new zt,r)).isAtmosphere=!0;var a=new Ri({uniforms:{atmoIN:{type:"i",value:0},screenSize:{type:"v2",value:new tt(window.innerWidth,window.innerHeight)}},vertexShader:dI,fragmentShader:uI,side:1,blending:2,transparent:!0,wireframe:!1}),o=new $s(1,64,64),l=new Ei(o,a);l.scale.copy(qx).multiplyScalar(1.14),e.basicAtmosphere=new zt,e.realisticAtmosphere=new zt,e.realisticAtmosphere.visible=!1,e.object3d.add(e.basicAtmosphere),e.object3d.add(e.realisticAtmosphere),e.basicAtmosphere.add(l);var A=new Ri({uniforms:{atmoIN:{type:"i",value:1},screenSize:{type:"v2",value:new tt(window.innerWidth,window.innerHeight)}},vertexShader:dI,fragmentShader:uI,side:0,blending:2,transparent:!0,depthWrite:!1}),c=new Ei(o,A);return c.scale.copy(qx).multiplyScalar(1.002),e.basicAtmosphere.add(c),e.realisticLightingPosition={x:-.5,y:0,z:1},e.fog={enable:!0,distance:bI},e.realisticAtmosphereInitParams=r.Kr?r:{Kr:.0025,Km:.0015,ESun:20,g:-.95,innerRadius:64e5,outerRadius:67e5,wavelength:[.65,.57,.475],scaleDepth:.25},e.object3d.updateMatrixWorld(),e}return A(n,[{key:"update",value:function(e,t,n){n.material.fogDistance=this.fog.distance,n.material.lightingEnabled=this.realisticAtmosphere.visible,n.material.lightPosition=this.realisticLightingPosition}},{key:"preUpdate",value:function(e,t){var n=e.view.camera.camera3D.position;if(this.fog.enable){pI.setFromMatrixPosition(e.view.tileLayer.object3d.matrixWorld);var i=pI.distanceTo(n);this.fog.distance=bI*Math.pow(.25*(i-.99*qx.x)/qx.x,1.5)}else this.fog.distance=1e11;var r=e.view.mainLoop.gfxEngine.renderer;mI.crs=e.view.referenceCrs,mI.setFromVector3(n).as("EPSG:4326",vI);var a=vI.altitude;if(a1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s(this,n),zt.DefaultUp.set(0,0,1),(i=t.call(this,"EPSG:4978",e,a)).isGlobeView=!0,i.camera.camera3D.near=Math.max(15,2352e-9*qx.x),i.camera.camera3D.far=10*qx.x;var o=new lI("globe",a.object3d,a);i.mainLoop.gfxEngine.label2dRenderer.infoTileLayer=o.info;var l=new PA;return l.position.set(-.5,0,1),l.updateMatrixWorld(!0),o.object3d.add(l),i.addLayer(o),i.tileLayer=o,Array.isArray(r.coord)&&(r.coord=new ob("EPSG:4326").setFromArray(r.coord)),r.isExtent||(r.coord=r.coord||new ob("EPSG:4326",0,0),r.tilt=r.tilt||89.5,r.heading=r.heading||0,r.range=r.range||2*qx.x),a.noControls?NT.transformCameraToLookAtTarget(v(i),i.camera.camera3D,r):(i.controls=new N_(v(i),r),i.controls.handleCollision=void 0===a.handleCollision||a.handleCollision),i.addLayer(new MI("atmosphere",a.atmosphere)),i.camera.resize(e.clientWidth,e.clientHeight),i}return A(n,[{key:"addLayer",value:function(e){if(!e||!e.isLayer)return Promise.reject(new Error("Add Layer type object"));if(e.isColorLayer){if(!this.tileLayer.tileMatrixSets.includes(Jx.formatToTms(e.source.crs)))return e._reject("Only ".concat(this.tileLayer.tileMatrixSets," tileMatrixSet are currently supported for color layers"))}else if(e.isElevationLayer&&Jx.formatToTms(e.source.crs)!==this.tileLayer.tileMatrixSets[0])return e._reject("Only ".concat(this.tileLayer.tileMatrixSets[0]," tileMatrixSet is currently supported for elevation layers"));return b(u(n.prototype),"addLayer",this).call(this,e,this.tileLayer)}},{key:"getPixelsToDegrees",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1?arguments[1]:void 0;return this.getMetersToDegrees(this.getPixelsToMeters(e,t))}},{key:"getPixelsToDegreesFromDistance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.getMetersToDegrees(this.getPixelsToMetersFromDistance(e,t))}},{key:"getMetersToDegrees",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return Hh.radToDeg(2*Math.asin(e/(2*qx.x)))}}]),n}($S),BI=32,EI=84,SI=89,TI=_.LEFT,_I=_.MIDDLE,II=_.RIGHT,LI=new at,FI=new nt,kI=0,PI=new at,UI=-1,DI=0,RI=1,OI=2,NI=3,zI=4,QI={default:"auto",drag:"move",pan:"cell",travel:"wait",rotate:"move",ortho_zoom:"wait"},GI=new at,HI=new tt,VI=new tt,jI=new tt(0,0),WI=new at,XI=new at,YI=new at,KI=new at(0,0,0),ZI=0,JI=new at,qI=new nt,$I=new tt,eL=new at,tL=new at,nL=new nt,iL=new nt,rL=0,aL=0,oL=!1,sL=!1,lL=0,AL=0,cL=new Nc,hL=new vn(new at(0,0,-1)),uL={enableRotation:!0,rotateSpeed:2,minPanSpeed:.05,maxPanSpeed:15,zoomTravelTime:.2,zoomFactor:2,maxResolution:0,minResolution:1/0,maxAltitude:5e7,groundLevel:200,autoTravelTimeMin:1.5,autoTravelTimeMax:4,autoTravelTimeDist:5e4,smartTravelHeightMin:75,smartTravelHeightMax:500,instantTravel:!1,minZenithAngle:0,maxZenithAngle:82.5,focusOnMouseOver:!0,focusOnMouseClick:!0,handleCollision:!0,minDistanceCollision:30,enableSmartTravel:!0,enablePan:!0},dL="moved",fL=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(this,n),(i=t.call(this,e)).camera.isOrthographicCamera?(kI=i.camera.zoom,i.enableRotation=!1,i.enablePan=!1,i.maxAltitude=1/0,i.zoomTravelTime="number"==typeof r.zoomTravelTime?r.zoomTravelTime:uL.zoomTravelTime):(i.enableRotation=void 0===r.enableRotation?uL.enableRotation:r.enableRotation,i.rotateSpeed=r.rotateSpeed||uL.rotateSpeed,i.enablePan=void 0===r.enablePan?uL.enablePan:r.enablePan,i.minPanSpeed=r.minPanSpeed||uL.minPanSpeed,i.maxPanSpeed=r.maxPanSpeed||uL.maxPanSpeed,i.maxAltitude=r.maxAltitude||uL.maxAltitude,i.zoomTravelTime=r.zoomTravelTime||uL.zoomTravelTime),r.zoomInFactor&&(console.warn("Controls zoomInFactor parameter is deprecated. Use zoomFactor instead."),r.zoomFactor=r.zoomFactor||r.zoomInFactor),r.zoomOutFactor&&(console.warn("Controls zoomOutFactor parameter is deprecated. Use zoomFactor instead."),r.zoomFactor=r.zoomFactor||r.zoomInFactor||1/r.zoomOutFactor),0===r.zoomFactor&&(console.warn("Controls zoomFactor parameter can not be equal to 0. Its value will be set to default."),r.zoomFactor=uL.zoomFactor),i.zoomInFactor=r.zoomFactor||uL.zoomFactor,i.zoomOutFactor=1/(r.zoomFactor||uL.zoomFactor),i.maxResolution=r.maxResolution||uL.maxResolution,i.minResolution=r.minResolution||uL.minResolution,i.groundLevel=r.groundLevel||uL.groundLevel,i.autoTravelTimeMin=r.autoTravelTimeMin||uL.autoTravelTimeMin,i.autoTravelTimeMax=r.autoTravelTimeMax||uL.autoTravelTimeMax,i.autoTravelTimeDist=r.autoTravelTimeDist||uL.autoTravelTimeDist,r.smartZoomHeightMin&&(console.warn("Controls smartZoomHeightMin parameter is deprecated. Use smartTravelHeightMin instead."),r.smartTravelHeightMin=r.smartTravelHeightMin||r.smartZoomHeightMin),r.smartZoomHeightMax&&(console.warn("Controls smartZoomHeightMax parameter is deprecated. Use smartTravelHeightMax instead."),r.smartTravelHeightMax=r.smartTravelHeightMax||r.smartZoomHeightMax),i.smartTravelHeightMin=r.smartTravelHeightMin||uL.smartTravelHeightMin,i.smartTravelHeightMax=r.smartTravelHeightMax||uL.smartTravelHeightMax,i.instantTravel=r.instantTravel||uL.instantTravel,i.minZenithAngle=(r.minZenithAngle||uL.minZenithAngle)*Math.PI/180,i.maxZenithAngle=(r.maxZenithAngle||uL.maxZenithAngle)*Math.PI/180,i.focusOnMouseOver=r.focusOnMouseOver||uL.focusOnMouseOver,i.focusOnMouseClick=r.focusOnMouseClick||uL.focusOnMouseClick,i.handleCollision=void 0===r.handleCollision?uL.handleCollision:r.handleCollision,i.minDistanceCollision=uL.minDistanceCollision,i.enableSmartTravel=void 0===r.enableSmartTravel?uL.enableSmartTravel:r.enableSmartTravel,LI.copy(i.camera.position),FI.copy(i.camera.quaternion),i.state=UI,i.cursor=QI,i.view.controls&&(console.warn("Deprecated use of PlanarControls. See examples to correct PlanarControls implementation."),i.view.controls.dispose()),i.view.controls=v(i),i._handlerOnKeyDown=i.onKeyDown.bind(v(i)),i._handlerOnMouseDown=i.onMouseDown.bind(v(i)),i._handlerOnMouseUp=i.onMouseUp.bind(v(i)),i._handlerOnMouseMove=i.onMouseMove.bind(v(i)),i._handlerOnMouseWheel=i.onMouseWheel.bind(v(i)),i._handlerFocusOnMouseClick=i.onMouseClick.bind(v(i)),i._handlerFocusOnMouseOver=i.onMouseOver.bind(v(i)),i._handlerContextMenu=i.onContextMenu.bind(v(i)),i._handlerUpdate=i.update.bind(v(i)),i.view.addFrameRequester(Wb,i._handlerUpdate),i.addInputListeners(),i}return A(n,[{key:"dispose",value:function(){this.removeInputListeners(),this.view.removeFrameRequester(Wb,this._handlerUpdate)}},{key:"update",value:function(e,t){t&&(e=16);var n=this.state!==UI;switch(this.state){case NI:this.handleTravel(e),this.dispatchEvent({type:"range-changed"}),this.view.notifyChange(this.camera);break;case zI:this.handleZoomOrtho(e),this.dispatchEvent({type:"range-changed"}),this.view.notifyChange(this.camera);break;case DI:this.handleDragMovement(),this.view.notifyChange(this.camera);break;case OI:this.handleRotation(),this.view.dispatchEvent({type:GS,heading:this.getHeading(),tilt:this.getTilt()}),this.view.notifyChange(this.camera);break;case RI:this.handlePanMovement(),this.view.notifyChange(this.camera)}this.handleCollision&&this.view.camera.adjustAltitudeToAvoidCollisionWithLayer(this.view,this.view.tileLayer,this.minDistanceCollision),n&&this.view.dispatchEvent({type:dL}),jI.set(0,0)}},{key:"initiateDrag",value:function(){this.state=DI,WI.copy(this.getWorldPointAtScreenXY(HI)),YI.set(0,0,0)}},{key:"handleDragMovement",value:function(){this.getWorldPointFromMathPlaneAtScreenXY(HI,WI.z,XI),YI.subVectors(WI,XI),this.camera.position.add(YI),YI.set(0,0,0)}},{key:"initiatePan",value:function(){this.state=RI}},{key:"handlePanMovement",value:function(){JI.set(-jI.x,jI.y,0),this.camera.localToWorld(JI),this.camera.position.copy(JI)}},{key:"initiateRotation",value:function(){this.state=OI,KI.copy(this.getWorldPointAtScreenXY(new tt(.5*this.view.mainLoop.gfxEngine.width,.5*this.view.mainLoop.gfxEngine.height)));var e=this.camera.position.distanceTo(KI);ZI=Math.acos((this.camera.position.z-KI.z)/e)}},{key:"handleRotation",value:function(){var e=-this.rotateSpeed*jI.x/this.view.mainLoop.gfxEngine.width,t=-this.rotateSpeed*jI.y/this.view.mainLoop.gfxEngine.height,n=this.camera.position.clone().sub(KI);0===e&&0===t||(ZI+t>=this.minZenithAngle&&ZI+t<=this.maxZenithAngle&&0!==t&&(ZI+=t,JI.set(0,0,1),qI.setFromUnitVectors(this.camera.up,JI),n.applyQuaternion(qI),JI.setFromMatrixColumn(this.camera.matrix,0),qI.setFromAxisAngle(JI,t),n.applyQuaternion(qI),JI.set(0,0,1),qI.setFromUnitVectors(this.camera.up,JI).invert(),n.applyQuaternion(qI)),0!==e&&(JI.set(0,0,1),qI.setFromAxisAngle(JI,e),n.applyQuaternion(qI))),this.camera.position.copy(n),this.camera.lookAt(GI),this.camera.position.add(KI),this.camera.updateMatrixWorld()}},{key:"initiateZoom",value:function(e){var t;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),PI.copy(this.getWorldPointAtScreenXY(HI));var n=new at;if(t>0||t<0&&this.maxAltitude>this.camera.position.z){var i=t>0?this.zoomInFactor:this.zoomOutFactor,r=this.view.getPixelsToMeters()/i;if(this.maxResolution>r||r>this.minResolution)return;this.camera.isOrthographicCamera?(this.state=zI,this.view.notifyChange(this.camera),lL=this.camera.zoom,AL=lL*i,PI.z=this.camera.position.z,rL=0,aL=this.zoomTravelTime,this.updateMouseCursorType()):(n.lerpVectors(this.camera.position,PI,1-1/i),this.initiateTravel(n,this.zoomTravelTime,null,!1))}}},{key:"handleZoomOrtho",value:function(e){rL=Math.min(rL+e/1e3/aL,1);var t=lL+rL*(AL-lL);this.camera.zoom!==t&&(this.camera.zoom=t,this.camera.updateProjectionMatrix(),this.view.viewToNormalizedCoords(HI,JI),JI.z=0,JI.unproject(this.camera),this.camera.position.x+=PI.x-JI.x,this.camera.position.y+=PI.y-JI.y,this.camera.updateMatrixWorld(!0)),this.testAnimationEnd()}},{key:"initiateSmartTravel",value:function(){var e=this.getWorldPointAtScreenXY(HI),t=new at;t.copy(e).sub(this.camera.position),t.z=0,t.normalize();var n=this.camera.position.distanceTo(e),i=Hh.lerp(this.smartTravelHeightMin,this.smartTravelHeightMax,Math.min(n/5e3,1)),r=new at;r.copy(e),this.enableRotation&&r.add(t.multiplyScalar(2*-i)),r.z=e.z+i,this.camera.isOrthographicCamera&&(lL=this.camera.zoom,AL=lL*(1+Math.min(n/5e3,1)),r.z=this.camera.position.z),this.initiateTravel(r,"auto",e,!0)}},{key:"initiateTravel",value:function(e,t,n,i){if(this.state=NI,this.view.notifyChange(this.camera),rL=0,this.updateMouseCursorType(),oL=this.enableRotation&&n&&(n.isQuaternion||n.isVector3),sL=i,tL.copy(this.camera.position),nL.copy(this.camera.quaternion),oL&&(n.isQuaternion?iL.copy(n):n.isVector3&&(e===n?(this.camera.lookAt(n),iL.copy(this.camera.quaternion),this.camera.quaternion.copy(nL)):(this.camera.position.copy(e),this.camera.lookAt(n),iL.copy(this.camera.quaternion),this.camera.quaternion.copy(nL),this.camera.position.copy(tL)))),eL.copy(e),this.instantTravel)aL=0;else if("auto"===t){var r=Math.min(1,e.distanceTo(this.camera.position)/this.autoTravelTimeDist);if(aL=Hh.lerp(this.autoTravelTimeMin,this.autoTravelTimeMax,r),oL){var a=.5-.5*iL.normalize().dot(this.camera.quaternion.normalize());aL*=1+2*a,aL=Math.min(aL,this.autoTravelTimeMax)}}else aL=t}},{key:"handleTravel",value:function(e){rL=Math.min(rL+e/1e3/aL,1);var t=sL?this.smooth(rL):rL;this.camera.position.lerpVectors(tL,eL,t);var n=lL+t*(AL-lL);this.camera.isOrthographicCamera&&this.camera.zoom!==n&&(this.camera.zoom=n,this.camera.updateProjectionMatrix()),!0===oL&&this.camera.quaternion.slerpQuaternions(nL,iL,t),this.testAnimationEnd()}},{key:"testAnimationEnd",value:function(){1===rL&&(this.state=UI,this.updateMouseCursorType())}},{key:"goToTopView",value:function(){var e=new at,t=new nt;e.copy(this.getWorldPointAtScreenXY(new tt(.5*this.view.mainLoop.gfxEngine.width,.5*this.view.mainLoop.gfxEngine.height))),e.z+=Math.min(this.maxAltitude,this.camera.position.distanceTo(e)),t.setFromAxisAngle(new at(1,0,0),0),this.initiateTravel(e,"auto",t,!0)}},{key:"goToStartView",value:function(){this.camera.isOrthographicCamera&&(lL=this.camera.zoom,AL=kI),this.initiateTravel(LI,"auto",FI,!0)}},{key:"getWorldPointFromMathPlaneAtScreenXY",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new at;return $I.copy(this.view.viewToNormalizedCoords(e)),cL.setFromCamera($I,this.camera),hL.constant=t,cL.ray.intersectPlane(hL,n),n}},{key:"getWorldPointAtScreenXY",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new at;return this.view.getPickingPositionFromDepth(e,t)||this.getWorldPointFromMathPlaneAtScreenXY(e,this.groundLevel,t),t}},{key:"addInputListeners",value:function(){this.view.domElement.addEventListener("keydown",this._handlerOnKeyDown,!1),this.view.domElement.addEventListener("mousedown",this._handlerOnMouseDown,!1),this.view.domElement.addEventListener("mouseup",this._handlerOnMouseUp,!1),this.view.domElement.addEventListener("mouseleave",this._handlerOnMouseUp,!1),this.view.domElement.addEventListener("mousemove",this._handlerOnMouseMove,!1),this.view.domElement.addEventListener("mousewheel",this._handlerOnMouseWheel,!1),this.focusOnMouseOver&&this.view.domElement.addEventListener("mouseover",this._handlerFocusOnMouseOver,!1),this.focusOnMouseClick&&this.view.domElement.addEventListener("click",this._handlerFocusOnMouseClick,!1),this.view.domElement.addEventListener("contextmenu",this._handlerContextMenu,!1),this.view.domElement.addEventListener("MozMousePixelScroll",this._handlerOnMouseWheel,!1)}},{key:"removeInputListeners",value:function(){this.view.domElement.removeEventListener("keydown",this._handlerOnKeyDown,!0),this.view.domElement.removeEventListener("mousedown",this._handlerOnMouseDown,!1),this.view.domElement.removeEventListener("mouseup",this._handlerOnMouseUp,!1),this.view.domElement.removeEventListener("mouseleave",this._handlerOnMouseUp,!1),this.view.domElement.removeEventListener("mousemove",this._handlerOnMouseMove,!1),this.view.domElement.removeEventListener("mousewheel",this._handlerOnMouseWheel,!1),this.view.domElement.removeEventListener("mouseover",this._handlerFocusOnMouseOver,!1),this.view.domElement.removeEventListener("click",this._handlerFocusOnMouseClick,!1),this.view.domElement.removeEventListener("contextmenu",this._handlerContextMenu,!1),this.view.domElement.removeEventListener("MozMousePixelScroll",this._handlerOnMouseWheel,!1)}},{key:"updateMouseCursorType",value:function(){switch(this.state){case UI:this.view.domElement.style.cursor=this.cursor.default;break;case DI:this.view.domElement.style.cursor=this.cursor.drag;break;case RI:this.view.domElement.style.cursor=this.cursor.pan;break;case NI:this.view.domElement.style.cursor=this.cursor.travel;break;case zI:this.view.domElement.style.cursor=this.cursor.ortho_zoom;break;case OI:this.view.domElement.style.cursor=this.cursor.rotate}}},{key:"updateMousePositionAndDelta",value:function(e){this.view.eventToViewCoords(e,HI),jI.copy(HI).sub(VI),VI.copy(HI)}},{key:"setCursor",value:function(e,t){this.cursor[e]=t,this.updateMouseCursorType()}},{key:"onMouseDown",value:function(e){if(e.preventDefault(),UI===this.state){if(eI=e.button,this.updateMousePositionAndDelta(e),TI===e.button)if(e.ctrlKey){if(!this.enableRotation)return;this.initiateRotation()}else this.initiateDrag();else if(_I===e.button){if(!this.enableSmartTravel)return;this.initiateSmartTravel()}else if(II===e.button){if(!this.enablePan)return;this.initiatePan()}this.updateMouseCursorType()}}},{key:"onMouseUp",value:function(e){e.preventDefault(),NI!==this.state&&zI!==this.state&&eI===e.button&&(this.state=UI),this.updateMouseCursorType()}},{key:"onMouseMove",value:function(e){e.preventDefault(),this.updateMousePositionAndDelta(e),UI!==this.state&&this.view.notifyChange()}},{key:"onKeyDown",value:function(e){if(UI===this.state)switch(e.keyCode){case EI:this.camera.isOrthographicCamera||this.goToTopView();break;case SI:this.goToStartView();break;case BI:this.enableSmartTravel&&this.initiateSmartTravel(e)}}},{key:"onMouseWheel",value:function(e){e.preventDefault(),e.stopPropagation(),UI===this.state&&this.initiateZoom(e)}},{key:"onMouseOver",value:function(){this.view.domElement.focus()}},{key:"onMouseClick",value:function(){this.view.domElement.focus()}},{key:"onContextMenu",value:function(e){e.preventDefault()}},{key:"smooth",value:function(e){return Math.pow(Math.pow(e,2)*(3-2*e),1.2)}},{key:"zoomIn",value:function(){this._getScreenCenter(),this.initiateZoom({wheelDelta:1})}},{key:"zoomOut",value:function(){this._getScreenCenter(),this.initiateZoom({wheelDelta:-1})}},{key:"_getScreenCenter",value:function(){var e=this.view.domElement.getBoundingClientRect();HI.set(e.x+e.width/2-e.x,e.y+e.height/2-e.y)}}]),n}(XT),pL=new nt,mL=new at,vL=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(s(this,e),t.projection&&(console.warn("PlanarTileBuilder projection parameter is deprecated, use crs instead."),t.crs=t.crs||t.projection),!t.crs)throw new Error("options.crs is mandatory for PlanarTileBuilder");this.crs=t.crs,this.tmp={coords:new ob("EPSG:4326",0,0),position:new at,normal:new at(0,0,1)},this.uvCount=t.uvCount||1}return A(e,[{key:"prepare",value:function(e){e.nbRow=Math.pow(2,e.zoom+1),e.projected=new at}},{key:"center",value:function(e){return e.center(this.tmp.coords),mL.set(this.tmp.coords.x,this.tmp.coords.y,0),mL}},{key:"vertexPosition",value:function(e){return this.tmp.position.set(e.projected.x,e.projected.y,0),this.tmp.position}},{key:"vertexNormal",value:function(){return this.tmp.normal}},{key:"uProjecte",value:function(e,t){t.projected.x=t.extent.west+e*(t.extent.east-t.extent.west)}},{key:"vProjecte",value:function(e,t){t.projected.y=t.extent.south+e*(t.extent.north-t.extent.south)}},{key:"computeSharableExtent",value:function(e){return{sharableExtent:new bb(e.crs,0,Math.abs(e.west-e.east),0,Math.abs(e.north-e.south)),quaternion:pL,position:this.center(e).clone()}}}]),e}(),gL=function(e){h(n,e);var t=y(n);function n(e,i,r){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};s(this,n);var l=Jx.formatToTms(i.crs),A=[l];return gb.get(i.crs)||gb.set(i.crs,i),o.tileMatrixSets=A,(a=t.call(this,e,r||new ja,[i],new vL({crs:i.crs}),o)).isPlanarLayer=!0,a.extent=i,a.minSubdivisionLevel=null==a.minSubdivisionLevel?0:a.minSubdivisionLevel,a.maxSubdivisionLevel=null==a.maxSubdivisionLevel?5:a.maxSubdivisionLevel,a.maxDeltaElevation=a.maxDeltaElevation||4,a}return A(n)}(iI),yL=function(e){h(n,e);var t=y(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s(this,n),zt.DefaultUp.set(0,0,1),(r=t.call(this,i.crs,e,a)).isPlanarView=!0;var o=i.dimensions(),l=Math.max(o.x,o.y),A=r.camera.camera3D;A.near=.1,A.far=A.isOrthographicCamera?2e3:2*l,A.updateProjectionMatrix();var c=new gL("planar",i,a.object3d,a);r.mainLoop.gfxEngine.label2dRenderer.infoTileLayer=c.info,r.addLayer(c);var h=a.placement||{};return Array.isArray(h.coord)&&(h.coord=new ob("EPSG:4326").setFromArray(h.coord)),h.isExtent||(h.coord=h.coord||i.center(),h.tilt=h.tilt||90,h.heading=h.heading||0,h.range=h.range||l),NT.transformCameraToLookAtTarget(v(r),A,h),a.noControls||(r.controls=new fL(v(r),a.controls)),r.tileLayer=c,r}return A(n,[{key:"addLayer",value:function(e){return b(u(n.prototype),"addLayer",this).call(this,e,this.tileLayer)}}]),n}($S),wL=new ob("EPSG:4326",0,0,0),xL=new bt;function bL(e,t){e.geometry&&e.geometry.applyMatrix4(t),e.children.forEach((function(e){return bL(e,t)}))}function ML(e,t){if(e){e.layer=t,e.material&&(e.material.transparent=t.opacity<1,e.material.opacity=t.opacity,e.material.wireframe=t.wireframe,t.size&&(e.material.size=t.size),t.linewidth&&(e.material.linewidth=t.linewidth)),e.layers.set(t.threejsLayer);var n,i=S(e.children);try{for(i.s();!(n=i.n()).done;){ML(n.value,t)}}catch(e){i.e(e)}finally{i.f()}return e}}var CL={update:function(e,t,n){if(n.parent||!n.children.length){if(n.visible){if(void 0===n.layerUpdateState[t.id])n.layerUpdateState[t.id]=new IS;else if(!n.layerUpdateState[t.id].canTryUpdate())return;var i=n.children.filter((function(e){return e.layer==t}));if(i.length>0)return i;var r=n.getExtentsByProjection(t.source.crs)||[n.extent],a=r[0].zoom;if(a==t.zoom.min&&this.source.extentInsideLimit(n.extent,a)&&(!t.source.isFileSource||n.extent.isPointInside(t.source.extent.center(wL)))){n.layerUpdateState[t.id].newTry();var o={layer:t,extentsSource:r,view:e.view,threejsLayer:t.threejsLayer,requester:n};return e.scheduler.execute(o).then((function(e){if(e=e[0]){var i=!e.layer;if(ML(e,t),t.onMeshCreated&&t.onMeshCreated(e),n.layerUpdateState[t.id].success(),!n.parent)return void LS.removeChildrenAndCleanupRecursively(t,e);i&&(xL.copy(n.matrixWorld).invert().elements[14]-=e.minAltitude,bL(e,xL)),e.minAltitude&&(e.position.z=e.minAltitude),e.layer=t,n.add(e),n.updateMatrixWorld()}else n.layerUpdateState[t.id].failure(1,!0)}),(function(i){return Y_(i,n,t,n.level,e.view)}))}n.layerUpdateState[t.id].noMoreUpdatePossible()}}else LS.removeChildrenAndCleanupRecursively(t,n)}};new at,new Fn(1,1,1),new Fn(.5,.5,.5),new Fn(.5,.5,.5),new Fn(.63,.32,.18),new Fn(0,1,0),new Fn(0,.8,0),new Fn(0,.6,0),new Fn(1,.66,0),new Fn(1,0,1),new Fn(1,0,0),new Fn(0,0,1),new Fn(.8,.8,1),new Fn(.4,.4,.7),new Fn(1,1,0),new Fn(.3,.6,.6);var BL={38:{method:"translateZ",sign:-1},40:{method:"translateZ",sign:1},37:{method:"translateX",sign:-1},39:{method:"translateX",sign:1},33:{method:"rotateZ",sign:1,noSpeed:!0},34:{method:"rotateZ",sign:-1,noSpeed:!0},wheelup:{method:"translateZ",sign:1,oneshot:!0},wheeldown:{method:"translateZ",sign:-1,oneshot:!0}};function EL(e){e.preventDefault(),this._isMouseDown=!0;var t=this.view.eventToViewCoords(e);this._onMouseDownMouseX=t.x,this._onMouseDownMouseY=t.y}function SL(e){e.preventDefault(),this._isMouseDown=!0,this._onMouseDownMouseX=e.touches[0].pageX,this._onMouseDownMouseY=e.touches[0].pageY}function TL(e){if(!0===this._isMouseDown){var t=this.view.eventToViewCoords(e),n=Hh.degToRad(this._camera3D.fov)/this.view.mainLoop.gfxEngine.height;this._camera3D.rotateY((t.x-this._onMouseDownMouseX)*n),this._camera3D.rotateX((t.y-this._onMouseDownMouseY)*n),this._onMouseDownMouseX=t.x,this._onMouseDownMouseY=t.y,this.view.notifyChange(this._camera3D,!1)}}function _L(){this._isMouseDown=!1}function IL(e){var t=BL[e.keyCode];t&&(this.moves.delete(t),e.preventDefault())}function LL(e){var t=BL[e.keyCode];t&&(this.moves.add(t),this.view.notifyChange(this._camera3D,!1),e.preventDefault())}function FL(e){var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t<0?this.moves.add(BL.wheelup):this.moves.add(BL.wheeldown),this.view.notifyChange(this._camera3D,!1)}var kL=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,n),(i=t.call(this)).view=e,i.options=r,i._camera3D=e.camera.camera3D,i.moves=new Set,i.moveSpeed=10,i._onMouseDownMouseX=0,i._onMouseDownMouseY=0,i._isMouseDown=!1,e.domElement.addEventListener("mousedown",EL.bind(v(i)),!1),e.domElement.addEventListener("touchstart",SL.bind(v(i)),!1);var a=TL.bind(v(i));return e.domElement.addEventListener("mousemove",a,!1),e.domElement.addEventListener("touchmove",a,!1),e.domElement.addEventListener("mouseup",_L.bind(v(i)),!1),e.domElement.addEventListener("touchend",_L.bind(v(i)),!1),e.domElement.addEventListener("mousewheel",FL.bind(v(i)),!1),e.domElement.addEventListener("DOMMouseScroll",FL.bind(v(i)),!1),window.addEventListener("keyup",IL.bind(v(i)),!0),window.addEventListener("keydown",LL.bind(v(i)),!0),i.view.addFrameRequester(Wb,i.update.bind(v(i))),r.focusOnMouseOver&&e.domElement.addEventListener("mouseover",(function(){return e.domElement.focus()})),r.focusOnClick&&e.domElement.addEventListener("click",(function(){return e.domElement.focus()})),i}return A(n,[{key:"isUserInteracting",value:function(){return 0!==this.moves.size||this._isMouseDown}},{key:"update",value:function(e,t){t&&(e=16);var n,i=S(this.moves);try{for(i.s();!(n=i.n()).done;){var r=n.value;this._camera3D[r.method](r.sign*(r.noSpeed?1:this.moveSpeed)*e/1e3)}}catch(e){i.e(e)}finally{i.f()}if(this.moves.size>0||this._isMouseDown){this.view.notifyChange(this._camera3D);var a,o=S(this.moves);try{for(o.s();!(a=o.n()).done;){var s=a.value;s.oneshot&&this.moves.delete(s)}}catch(e){o.e(e)}finally{o.f()}}}}]),n}(Je);function PL(e,t,n){var i=.5*Hh.degToRad(n-e.fov);return Hh.clamp(t,-i,i)}var UL=new at(0,1,0);function DL(e,t,n){t.quaternion.setFromUnitVectors(UL,t.up),t.rotateY(n.rotateY),t.rotateX(n.rotateX),e.notifyChange(e.camera.camera3D)}var RL={38:{method:"translateZ",sign:-1},40:{method:"translateZ",sign:1},37:{method:"translateX",sign:-1},39:{method:"translateX",sign:1},33:{method:"translateY",sign:1},34:{method:"translateY",sign:-1}};function OL(e){this.camera.position.z+=e}var NL=new at,zL=new nt,QL=new Bt(0,0,0,"YXZ");function GL(e){NL.copy(this.camera.position),NL.normalize(),this.camera.position.add(NL.multiplyScalar(e))}var HL=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s(this,n),(i=t.call(this)).isFirstPersonControls=!0,i.camera=e.camera.camera3D,i.view=e,i.moves=new Set,r.panoramaRatio){var a=200*r.panoramaRatio/(2*Math.PI);r.verticalFOV=2==r.panoramaRatio?180:Hh.radToDeg(2*Math.atan(200/(2*a)))}return r.verticalFOV=r.verticalFOV||180,r.moveSpeed=void 0===r.moveSpeed?10:r.moveSpeed,i.options=r,i._isMouseDown=!1,i._onMouseDownMouseX=0,i._onMouseDownMouseY=0,i._state={rotateX:0,rotateY:0,snapshot:function(){return{rotateX:this.rotateX,rotateY:this.rotateY}}},i.reset(),i.eventListeners=r.disableEventListeners,r.disableEventListeners||(i._onMouseDown=i.onMouseDown.bind(v(i)),i._onMouseMove=i.onMouseMove.bind(v(i)),i._onMouseUp=i.onMouseUp.bind(v(i)),i._onMouseWheel=i.onMouseWheel.bind(v(i)),i._onKeyUp=i.onKeyUp.bind(v(i)),i._onKeyDown=i.onKeyDown.bind(v(i)),e.domElement.addEventListener("mousedown",i._onMouseDown,!1),e.domElement.addEventListener("touchstart",i._onMouseDown,!1),e.domElement.addEventListener("mousemove",i._onMouseMove,!1),e.domElement.addEventListener("touchmove",i._onMouseMove,!1),e.domElement.addEventListener("mouseup",i._onMouseUp,!1),e.domElement.addEventListener("touchend",i._onMouseUp,!1),e.domElement.addEventListener("mousewheel",i._onMouseWheel,!1),e.domElement.addEventListener("DOMMouseScroll",i._onMouseWheel,!1),document.addEventListener("keydown",i._onKeyDown,!1),document.addEventListener("keyup",i._onKeyUp,!1)),i.view.addFrameRequester(Wb,i.update.bind(v(i))),i._onFocus=function(){return e.domElement.focus()},i.focusOnMouseOver=r.focusOnMouseOver,r.focusOnMouseOver&&e.domElement.addEventListener("mouseover",i._onFocus),i.focusOnClick=r.focusOnClick,r.focusOnClick&&e.domElement.addEventListener("click",i._onFocus),"EPSG:4978"==e.referenceCrs?i.moveCameraVertical=GL:i.moveCameraVertical=OL,i}return A(n,[{key:"isUserInteracting",value:function(){return 0!==this.moves.size&&!this._isMouseDown}},{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];zL.setFromUnitVectors(UL,this.camera.up),zL.invert(),zL.multiply(this.camera.quaternion),QL.setFromQuaternion(zL),e||(this._state.rotateX=QL.x),this._state.rotateY=QL.y}},{key:"update",value:function(e,t,n){if(0!=this.enabled){t&&(e=16);var i,r=this.camera.position.y,a=S(this.moves);try{for(a.s();!(i=a.n()).done;){var o=i.value;"translateY"===o.method?this.moveCameraVertical(o.sign*this.options.moveSpeed*e/1e3):this.camera[o.method](o.sign*this.options.moveSpeed*e/1e3)}}catch(e){a.e(e)}finally{a.f()}!0!==this._isMouseDown&&!0!==n||DL(this.view,this.camera,this._state),this.moves.size&&this.view.notifyChange(this.view.camera.camera3D),this.camera.position.y=r}}},{key:"onMouseDown",value:function(e){if(0!=this.enabled){this._isMouseDown=!0;var t=this.view.eventToViewCoords(e);this._onMouseDownMouseX=t.x,this._onMouseDownMouseY=t.y,this._stateOnMouseDown=this._state.snapshot()}}},{key:"onMouseUp",value:function(){0!=this.enabled&&(this._isMouseDown=!1)}},{key:"onMouseMove",value:function(e){if(0!=this.enabled&&!0===this._isMouseDown){var t=Hh.degToRad(this.camera.fov)/this.view.mainLoop.gfxEngine.height,n=this.view.eventToViewCoords(e);this._state.rotateY=(n.x-this._onMouseDownMouseX)*t+this._stateOnMouseDown.rotateY,this._state.rotateX=PL(this.camera,(n.y-this._onMouseDownMouseY)*t+this._stateOnMouseDown.rotateX,this.options.verticalFOV),DL(this.view,this.camera,this._state)}}},{key:"onMouseWheel",value:function(e){if(0!=this.enabled){var t=0;void 0!==e.wheelDelta?t=-e.wheelDelta:void 0!==e.detail&&(t=e.detail),this.camera.fov=Hh.clamp(this.camera.fov+Math.sign(t),10,Math.min(100,this.options.verticalFOV)),this.camera.updateProjectionMatrix(),this._state.rotateX=PL(this.camera,this._state.rotateX,this.options.verticalFOV),DL(this.view,this.camera,this._state)}}},{key:"onKeyUp",value:function(e){if(0!=this.enabled){var t=RL[e.keyCode];t&&(this.moves.delete(t),this.view.notifyChange(void 0,!1),e.preventDefault())}}},{key:"onKeyDown",value:function(e){if(0!=this.enabled){var t=RL[e.keyCode];t&&(this.moves.add(t),this.view.notifyChange(void 0,!1),e.preventDefault())}}},{key:"dispose",value:function(){this.eventListeners||(this.view.domElement.removeEventListener("mousedown",this._onMouseDown,!1),this.view.domElement.removeEventListener("touchstart",this._onMouseDown,!1),this.view.domElement.removeEventListener("mousemove",this._onMouseMove,!1),this.view.domElement.removeEventListener("touchmove",this._onMouseMove,!1),this.view.domElement.removeEventListener("mouseup",this._onMouseUp,!1),this.view.domElement.removeEventListener("touchend",this._onMouseUp,!1),this.view.domElement.removeEventListener("mousewheel",this._onMouseWheel,!1),this.view.domElement.removeEventListener("DOMMouseScroll",this._onMouseWheel,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("keyup",this._onKeyUp,!1)),this.focusOnMouseOver&&this.view.domElement.removeEventListener("mouseover",this._onFocus),this.focusOnClick&&this.view.domElement.removeEventListener("click",this._onFocus),this.dispatchEvent({type:"dispose"})}}]),n}(Je);new Nn({color:16777215,depthTest:!1,transparent:!0,opacity:.5}),new at,new at,new nt;var VL=Jm((function(e){function t(e,t,a){a=a||2;var o,s,l,h,u,f,p,m=t&&t.length,v=m?t[0]*a:e.length,g=n(e,0,v,a,!0),y=[];if(!g||g.next===g.prev)return y;if(m&&(g=function(e,t,r,a){var o,s,l,h=[];for(o=0,s=t.length;o80*a){o=l=e[0],s=h=e[1];for(var w=a;wl&&(l=u),f>h&&(h=f);p=0!==(p=Math.max(l-o,h-s))?1/p:0}return r(g,y,a,o,s,p),y}function n(e,t,n,i,r){var a,o;if(r===E(e,t,n,i)>0)for(a=t;a=t;a-=i)o=M(a,e[a],e[a+1],o);return o&&v(o,o.next)&&(C(o),o=o.next),o}function i(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!v(i,i.next)&&0!==m(i.prev,i,i.next))i=i.next;else{if(C(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function r(e,t,n,A,c,h,d){if(e){!d&&h&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=u(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,l,A=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,A*=2}while(o>1)}(r)}(e,A,c,h);for(var f,p,m=e;e.prev!==e.next;)if(f=e.prev,p=e.next,h?o(e,A,c,h):a(e))t.push(f.i/n),t.push(e.i/n),t.push(p.i/n),C(e),e=p.next,m=p.next;else if((e=p)===m){d?1===d?r(e=s(i(e),t,n),t,n,A,c,h,2):2===d&&l(e,t,n,A,c,h):r(i(e),t,n,A,c,h,1);break}}}function a(e){var t=e.prev,n=e,i=e.next;if(m(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(f(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&m(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function o(e,t,n,i){var r=e.prev,a=e,o=e.next;if(m(r,a,o)>=0)return!1;for(var s=r.xa.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,c=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,h=u(s,l,t,n,i),d=u(A,c,t,n,i),p=e.prevZ,v=e.nextZ;p&&p.z>=h&&v&&v.z<=d;){if(p!==e.prev&&p!==e.next&&f(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&m(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,v!==e.prev&&v!==e.next&&f(r.x,r.y,a.x,a.y,o.x,o.y,v.x,v.y)&&m(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&f(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&m(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;v&&v.z<=d;){if(v!==e.prev&&v!==e.next&&f(r.x,r.y,a.x,a.y,o.x,o.y,v.x,v.y)&&m(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function s(e,t,n){var r=e;do{var a=r.prev,o=r.next.next;!v(a,o)&&g(a,r,r.next,o)&&x(a,o)&&x(o,a)&&(t.push(a.i/n),t.push(r.i/n),t.push(o.i/n),C(r),C(r.next),r=e=o),r=r.next}while(r!==e);return i(r)}function l(e,t,n,a,o,s){var l=e;do{for(var A=l.next.next;A!==l.prev;){if(l.i!==A.i&&p(l,A)){var c=b(l,A);return l=i(l,l.next),c=i(c,c.next),r(l,t,n,a,o,s),void r(c,t,n,a,o,s)}A=A.next}l=l.next}while(l!==e)}function A(e,t){return e.x-t.x}function c(e,t){if(t=function(e,t){var n,i=t,r=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>o){if(o=s,s===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x=i.x&&i.x>=c&&r!==i.x&&f(an.x||i.x===n.x&&h(n,i)))&&(n=i,d=l)),i=i.next}while(i!==A);return n}(e,t),t){var n=b(t,e);i(t,t.next),i(n,n.next)}}function h(e,t){return m(e.prev,e,t.prev)<0&&m(t.next,e,e.next)<0}function u(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,n=e;do{(t.x=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function p(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&g(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(x(e,t)&&x(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(m(e.prev,e,t.prev)||m(e,t.prev,t))||v(e,t)&&m(e.prev,e,e.next)>0&&m(t.prev,t,t.next)>0)}function m(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function v(e,t){return e.x===t.x&&e.y===t.y}function g(e,t,n,i){var r=w(m(e,t,n)),a=w(m(e,t,i)),o=w(m(n,i,e)),s=w(m(n,i,t));return r!==a&&o!==s||(!(0!==r||!y(e,n,t))||(!(0!==a||!y(e,i,t))||(!(0!==o||!y(n,e,i))||!(0!==s||!y(n,t,i)))))}function y(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function w(e){return e>0?1:e<0?-1:0}function x(e,t){return m(e.prev,e,e.next)<0?m(e,t,e.next)>=0&&m(e,e.prev,t)>=0:m(e,t,e.prev)<0||m(e,e.next,t)<0}function b(e,t){var n=new B(e.i,e.x,e.y),i=new B(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function M(e,t,n,i){var r=new B(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function C(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function B(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(e,t,n,i){for(var r=0,a=t,o=n-i;a0&&(i+=e[r-1].length,n.holes.push(i))}return n}}));function jL(e,t,n){for(var i=t[e],r=arguments.length,a=new Array(r>3?r-3:0),o=3;o3&&void 0!==arguments[3]?arguments[3]:0,r=(i*=3)+3*t,a=i;a3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:e.length/3,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:a;a*=3;var l,A=(s*=3)+(o*=3);l=isNaN(i)?Array.isArray(i)?function(e){return i[(e-s)/3]}:function(t){return i({},KL.setFromArray(e,t))}:function(){return i};for(var c=s,h=a;c1){var h,u=2*(o-e.geometries.length),d=new Uint16Array(u),f=0,p=S(e.geometries);try{for(p.s();!(h=p.n()).done;){var m=h.value,v=jL("color",t,WL,m.properties),g=m.indices[0].offset;if(g>65535){console.warn("Feature to Line: integer overflow, too many points in lines");break}var y=m.indices[0].count,w=g+y;XL(a,y,v,g);for(var x=g;x65535)return console.warn("Feature to Polygon: integer overflow, too many points in polygons"),"break";var h=jL("color",t,WL,e.properties),u=e.indices.slice(-1)[0],d=u.offset+u.count,f=d-c,p=jL("altitude",t,0,e.properties);0!==p&&ZL(n,i,r,p,0,c,f),XL(a,f,h,c);var m=r.slice(3*c,3*d),v=e.indices.map((function(e){return e.offset-c})).slice(1),g=VL(m,v,3),y=o.length;o.length+=g.length;for(var w=0;w0&&void 0!==arguments[0]?arguments[0]:{};return function(t){if(t)return iF(t.features,e)}};Hh.DEG2RAD,new bt,new at,new at,(new at).set(0,0,1),new ob("EPSG:4326",0,0,0),new Bt,new nt;var aF={color_layers_pars_fragment:"\nstruct Layer {\n int textureOffset;\n int crs;\n float effect;\n float opacity;\n};\n\nuniform sampler2D colorTextures[NUM_FS_TEXTURES];\nuniform vec4 colorOffsetScales[NUM_FS_TEXTURES];\nuniform Layer colorLayers[NUM_FS_TEXTURES];\nuniform int colorTextureCount;\n\nvec3 uvs[NUM_CRS];\n\nfloat getBorderDistance(vec2 uv) {\n vec2 p2 = min(uv, 1. -uv);\n return min(p2.x, p2.y);\n}\n\nfloat tolerance = 0.99;\n\nvec4 applyWhiteToInvisibleEffect(vec4 color, float intensity) {\n float a = dot(color.rgb, vec3(0.333333333));\n if (a >= tolerance) {\n color.a *= 1.0 - pow(abs(a), intensity);\n }\n return color;\n}\n\nvec4 applyLightColorToInvisibleEffect(vec4 color, float intensity) {\n float a = max(0.05,1. - length(color.xyz - 1.));\n color.a *= 1.0 - pow(abs(a), intensity);\n color.rgb *= color.rgb * color.rgb;\n return color;\n}\n\n#if defined(DEBUG)\nuniform bool showOutline;\nuniform vec3 outlineColors[NUM_CRS];\nuniform float outlineWidth;\n\nvec4 getOutlineColor(vec3 outlineColor, vec2 uv) {\n float alpha = 1. - clamp(getBorderDistance(uv) / outlineWidth, 0., 1.);\n return vec4(outlineColor, alpha);\n}\n#endif\n\nuniform float minBorderDistance;\nvec4 getLayerColor(int textureOffset, sampler2D tex, vec4 offsetScale, Layer layer) {\n if ( textureOffset >= colorTextureCount ) return vec4(0);\n\n vec3 uv;\n // #pragma unroll_loop\n for ( int i = 0; i < NUM_CRS; i ++ ) {\n if ( i == layer.crs ) uv = uvs[ i ];\n }\n\n float borderDistance = getBorderDistance(uv.xy);\n if (textureOffset != layer.textureOffset + int(uv.z) || borderDistance < minBorderDistance ) return vec4(0);\n vec4 color = texture2D(tex, pitUV(uv.xy, offsetScale));\n if(color.a > 0.0) {\n if(layer.effect > 2.0) {\n color.rgb /= color.a;\n color = applyLightColorToInvisibleEffect(color, layer.effect);\n } else if(layer.effect > 0.0) {\n color.rgb /= color.a;\n color = applyWhiteToInvisibleEffect(color, layer.effect);\n }\n }\n\n color.a *= layer.opacity;\n return color;\n}\n",elevation_pars_vertex:"\n#if NUM_VS_TEXTURES > 0\n struct Layer {\n float scale;\n float bias;\n int mode;\n float zmin;\n float zmax;\n };\n\n uniform Layer elevationLayers[NUM_VS_TEXTURES];\n uniform sampler2D elevationTextures[NUM_VS_TEXTURES];\n uniform vec4 elevationOffsetScales[NUM_VS_TEXTURES];\n uniform int elevationTextureCount;\n\n highp float decode32(highp vec4 rgba) {\n highp float Sign = 1.0 - step(128.0,rgba[0])*2.0;\n highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0;\n highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000);\n highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 ));\n return Result;\n }\n\n float getElevationMode(vec2 uv, sampler2D tex, int mode) {\n if (mode == ELEVATION_RGBA)\n return decode32(texture2D( tex, uv ).abgr * 255.0);\n if (mode == ELEVATION_DATA || mode == ELEVATION_COLOR)\n #if defined(WEBGL2)\n return texture2D( tex, uv ).r;\n #else\n return texture2D( tex, uv ).w;\n #endif\n return 0.;\n }\n\n float getElevation(vec2 uv, sampler2D tex, vec4 offsetScale, Layer layer) {\n uv = uv * offsetScale.zw + offsetScale.xy;\n float d = getElevationMode(uv, tex, layer.mode);\n if (d < layer.zmin || d > layer.zmax) d = 0.;\n return d * layer.scale + layer.bias;\n }\n#endif\n",elevation_vertex:"\n#if NUM_VS_TEXTURES > 0\n if(elevationTextureCount > 0) {\n float elevation = getElevation(uv, elevationTextures[0], elevationOffsetScales[0], elevationLayers[0]);\n transformed += elevation * normal;\n }\n#endif\n",fog_fragment:"\n#if defined(USE_FOG)\n float fogFactor = 1. - min( exp(-fogDepth / fogDistance), 1.);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor);\n#endif\n",fog_pars_fragment:"\n#if defined(USE_FOG)\nuniform vec3 fogColor;\nuniform float fogDistance;\nvarying float fogDepth;\n#endif\n",lighting_fragment:"\nif (lightingEnabled) {\n float light = min(2. * dot(vNormal, lightPosition), 1.);\n gl_FragColor.rgb *= light;\n}\n",lighting_pars_fragment:"\nuniform bool lightingEnabled;\nuniform vec3 lightPosition;\nvarying vec3 vNormal;\n",mode_depth_fragment:"\n#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\ngl_FragColor = packDepthToRGBA(gl_FragDepthEXT);\n#else\nfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\ngl_FragColor = packDepthToRGBA(fragCoordZ);\n#endif\n",mode_id_fragment:"\ngl_FragColor = packDepthToRGBA(float(objectId) / 16777216.0);\n",mode_pars_fragment:"\n#if MODE == MODE_ID || MODE == MODE_DEPTH\n#include \n#endif\n\n#if MODE == MODE_ID\nuniform int objectId;\n#endif\n",overlay_fragment:"\ngl_FragColor.rgb = mix(gl_FragColor.rgb, overlayColor, overlayAlpha);\n",overlay_pars_fragment:"\nuniform vec3 overlayColor;\nuniform float overlayAlpha;\n",pitUV:"\nvec2 pitUV(vec2 uv, vec4 pit)\n{\n return uv * pit.zw + vec2(pit.x, 1.0 - pit.w - pit.y);\n}\n",precision_qualifier:"\nprecision highp float;\nprecision highp int;\n",projective_texturing_vertex:"\nfor(int i = 0; i < ORIENTED_IMAGES_COUNT; ++i)\n projectiveTextureCoords[i] = projectiveTextureMatrix[i] * mvPosition;\n",projective_texturing_pars_vertex:"\nuniform mat4 projectiveTextureMatrix[ORIENTED_IMAGES_COUNT];\nvarying vec4 projectiveTextureCoords[ORIENTED_IMAGES_COUNT];\n",projective_texturing_pars_fragment:"\nuniform sampler2D projectiveTexture[ORIENTED_IMAGES_COUNT];\nuniform sampler2D mask[ORIENTED_IMAGES_COUNT];\nvarying vec4 projectiveTextureCoords[ORIENTED_IMAGES_COUNT];\nuniform float projectiveTextureAlphaBorder;\nuniform float opacity;\nuniform bool boostLight;\n\nstruct Distortion {\n vec2 size;\n#if USE_DISTORTION\n vec2 pps;\n vec4 polynom;\n vec3 l1l2;\n#endif\n};\n\nuniform Distortion projectiveTextureDistortion[ORIENTED_IMAGES_COUNT];\n\nfloat getAlphaBorder(vec2 p)\n{\n vec2 d = clamp(projectiveTextureAlphaBorder * min(p, 1. - p), 0., 1.);\n return min(d.x, d.y);\n}\n\n#if USE_DISTORTION\nvoid distort(inout vec2 p, vec4 polynom, vec2 pps)\n{\n vec2 v = p - pps;\n float v2 = dot(v, v);\n if (v2 > polynom.w) {\n p = vec2(-1.);\n }\n else {\n p += (v2 * (polynom.x + v2 * (polynom.y + v2 * polynom.z) ) ) * v;\n }\n}\n\nvoid distort(inout vec2 p, vec4 polynom, vec3 l1l2, vec2 pps)\n{\n if ((l1l2.x == 0.) && (l1l2.y == 0.)) {\n distort(p, polynom, pps);\n } else {\n vec2 AB = (p - pps) / l1l2.z;\n float R = length(AB);\n float lambda = atan(R) / R;\n vec2 ab = lambda * AB;\n float rho2 = dot(ab, ab);\n float r357 = 1. + rho2* (polynom.x + rho2* (polynom.y + rho2 * polynom.z));\n p = pps + l1l2.z * (r357 * ab + vec2(dot(l1l2.xy, ab), l1l2.y * ab.x));\n }\n}\n#endif\n\nvec4 mixBaseColor(vec4 aColor, vec4 baseColor) {\n #ifdef USE_BASE_MATERIAL\n baseColor.rgb = aColor.a == 1.0 ? aColor.rgb : mix(baseColor, aColor, aColor.a).rgb;\n baseColor.a = min(1.0, aColor.a + baseColor.a);\n #else\n baseColor.rgb += aColor.rgb * aColor.a;\n baseColor.a += aColor.a;\n #endif\n return baseColor;\n}\n\nvec4 projectiveTextureColor(vec4 coords, Distortion distortion, sampler2D tex, sampler2D mask, vec4 baseColor) {\n vec3 p = coords.xyz / coords.w;\n if(p.z * p.z < 1.) {\n#if USE_DISTORTION\n p.xy *= distortion.size;\n distort(p.xy, distortion.polynom, distortion.l1l2, distortion.pps);\n p.xy /= distortion.size;\n#endif\n\n float d = getAlphaBorder(p.xy) * texture2D(mask, p.xy).r;\n\n if(d > 0.) {\n\n#if DEBUG_ALPHA_BORDER\n vec3 r = texture2D(tex, p.xy).rgb;\n return mixBaseColor(vec4( r.r * d, r.g, r.b, 1.0), baseColor);\n#else\n vec4 color = texture2D(tex, p.xy);\n color.a *= d;\n if (boostLight) {\n return mixBaseColor(vec4(sqrt(color.rgb), color.a), baseColor);\n } else {\n return mixBaseColor(color, baseColor);\n }\n#endif\n\n }\n }\n return mixBaseColor(vec4(0.), baseColor);\n}\n",project_pars_vertex:"\nattribute vec3 position;\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n",WebGL2_pars_vertex:"\n#if defined(WEBGL2)\n#define attribute in\n#define varying out\n#define texture2D texture\n#endif\n",WebGL2_pars_fragment:"\n#if defined(WEBGL2)\n#define varying in\nout highp vec4 pc_fragColor;\n#define gl_FragColor pc_fragColor\n#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad\n#endif\n",install:function(e,t,n){return n?(Object.keys(t).forEach((function(i){"install"!=i&&(e[n+i]=t[i])})),e):Object.assign(e,this)}};aF.install(Xi,aF,"itowns/");var oF=new bb("EPSG:4326",[0,0,0,0]);function sF(e,t,n,i,r,a,o,s){e.beginPath();var l,A=S(n);try{for(A.s();!(l=A.n()).done;){var c=l.value;if(c.extent&&c.extent.intersectsExtent(a)){var h=c.offset*r,u=h+c.count*r;e.moveTo(t[h],t[h+1]);for(var d=h+r;d3&&void 0!==arguments[3]?arguments[3]:{},r=arguments.length>4?arguments[4]:void 0;e.beginPath();var a=null==i.point.opacity?1:i.point.opacity;a!==e.globalAlpha&&(e.globalAlpha=a),e.arc(t,n,(i.point.radius||3)*r,0,2*Math.PI,!1),i.point.color&&(e.fillStyle=i.point.color,e.fill()),i.point.line&&(e.lineWidth=(i.point.width||1)*r,e.strokeStyle=i.point.line,e.stroke())}document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGMatrix();var AF=new ob("EPSG:4326",0,0,0);function cF(e,t,n,i,r){var a,o=n.dimensions().x/e.canvas.width,s={zoom:n.zoom},l=S(t.geometries);try{var A=function(){var l=a.value;if(l.extent.intersectsExtent(n)){var A={globals:s,properties:function(){return l.properties}},c=(l.properties.style||i).drawingStylefromContext(A);if(c)if(t.type===pC.POINT){var h,u=(Math.round(c.point.radius*r)||3*r)*o,d=S(l.indices);try{for(d.s();!(h=d.n()).done;)for(var f=h.value,p=f.offset*t.size,m=p+f.count*t.size,v=p;v2&&void 0!==arguments[2]?arguments[2]:[{offset:0,count:1}],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,s=arguments.length>7?arguments[7]:void 0;if(0!==t.length)if(i.length){var l,A=S(i);try{for(A.s();!(l=A.n()).done;){sF(e,t,n,l.value,r,a,o,s)}}catch(e){A.e(e)}finally{A.f()}}else sF(e,t,n,i,r,a,o,s)}(e,t.vertices,l.indices,c,t.size,n,r,t.type==pC.POLYGON)}};for(l.s();!(a=l.n()).done;)A()}catch(e){l.e(e)}finally{l.f()}}var hF=new tt,uF=new tt,dF=new tt,fF=new bb("EPSG:4326",0,0,0,0),pF=function(e,t,n,i,r){var a;if(e){t.dimensions(uF);var o=document.createElement("canvas");AF.crs=t.crs,o.width=n,o.height=n;var s=o.getContext("2d");r&&(s.fillStyle=r.getStyle(),s.fillRect(0,0,n,n)),s.globalCompositeOperation=i.globalCompositeOperation||"source-over",s.imageSmoothingEnabled=!1,s.lineJoin="round";var l=e.crs==t.crs?t:t.as(e.crs,oF),A=e.translation,c=e.scale;fF.transformedCopy(A,c,l),dF.set(s.canvas.width,s.canvas.width).divide(uF),hF.set(t.west,t.south).add(A).multiply(dF).negate(),s.setTransform(dF.x/c.x,0,0,dF.y/c.y,hF.x,hF.y);var h,u=c.x/dF.x,d=S(e.features);try{for(d.s();!(h=d.n()).done;){var f=h.value;cF(s,f,fF,f.style||i,u)}}catch(e){d.e(e)}finally{d.f()}(a=new ts(o)).flipY=!1}else if(r){var p=new Uint8Array(3);p[0]=255*r.r,p[1]=255*r.g,p[2]=255*r.b,a=new Hi(p,1,1,Ae)}else a=new ht;return a},mF=new bb("EPSG:4326",[0,0,0,0]),vF=function(e){return e.generateMipmaps=!1,e.magFilter=Z,e.minFilter=Z,e};var gF=function(e,t,n){var i;if(e.isFeatureCollection){var r=n.source.backgroundLayer,a=r&&r.paint?new Fn(r.paint["background-color"]):void 0;t.as(Jx.formatToEPSG(n.crs),mF),(i=pF(e,mF,256,n.style,a)).features=e,i.extent=t}else{if(!e.isTexture)throw new Error("Data type is not supported to convert into texture");i=e}return n.isColorLayer?function(e,t){return e.anisotropy=16,e.premultiplyAlpha=t,vF(e)}(i,n.transparent):n.isElevationLayer?(i.flipY&&(i.flipY=!1),vF(i)):void 0},yF=function(e){h(n,e);var t=y(n);function n(e,i){return s(this,n),i.cacheLifeTime=null==i.cacheLifeTime?WM.TEXTURE:i.cacheLifeTime,t.call(this,e,i)}return A(n,[{key:"convert",value:function(e,t){return gF(e,t,this)}},{key:"delete",value:function(){var e,t=S(this.parent.level0Nodes);try{for(t.s();!(e=t.n()).done;){e.value.traverse($_(this.id))}}catch(e){t.e(e)}finally{t.f()}}}]),n}(uE),wF=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(this,n),(i=t.call(this,e,r)).isColorLayer=!0,i.style=new lC(r.style),i.defineLayerProperty("visible",!0),i.defineLayerProperty("opacity",1),i.defineLayerProperty("sequence",0),i.transparent=r.transparent||i.opacity<1,i.noTextureParentOutsideLimit=!!r.source&&r.source.isFileSource,i.fx=r.fx||0,i.buildExtent=!0,i.structure="2d",i}return A(n,[{key:"setupRasterNode",value:function(e){var t=new DM(e.material,this);return e.material.addLayer(t),e.material.setSequence(this.parent.colorLayersOrder),t}},{key:"update",value:function(e,t,n,i){return function(e,t,n,i){var r=n.material;if(i&&r){var a=n.getExtentsByProjection(t.crs),o=a[0].zoom;if(!(o>t.zoom.max||o=t.source.zoom.min)return void e.view.notifyChange(n,!1)}if(r.visible&&t.visible&&n.layerUpdateState[t.id].canTryUpdate())if(s.level>=a[0].zoom)n.layerUpdateState[t.id].noMoreUpdatePossible();else if(!t.frozen){var A=n.layerUpdateState[t.id].failureParams,c=a[0].zoom||n.level,h=GM(t.updateStrategy.type,n,c,s.level,t,A);if(!(!t.source.isVectorSource&&h<=s.level||h>c)){if(!t.source.extentInsideLimit(n.extent,h))return n.layerUpdateState[t.id].noData({targetLevel:h}),void e.view.notifyChange(n,!1);var u=a.map((function(e){return e.tiledExtentParent(h)}));n.layerUpdateState[t.id].newTry();var d=q_(e.view,t,u,a,n);return e.scheduler.execute(d).then((function(e){var i=a.map((function(t,n){return t.offsetToParent(e[n].extent,s.offsetScales[n])}));s.setTextures(e,i),n.layerUpdateState[t.id].success()}),(function(i){return Y_(i,n,t,h,e.view)}))}A.lowestLevelError!=1/0&&n.layerUpdateState[t.id].noMoreUpdatePossible()}}}}(e,this,n,i)}}]),n}(yF),xF=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,n),(i=t.call(this,e,r)).isElevationLayer=!0;var a=1;return i.useColorTextureElevation&&(a=i.colorTextureElevationMaxZ-i.colorTextureElevationMinZ),i.defineLayerProperty("scale",i.scale||1,(function(e){e.parent.object3d.traverse((function(t){t.layer==e.parent&&t.material&&(t.material.setElevationScale(e.scale*a),t.obb.updateScaleZ(e.scale))}))})),i}return A(n,[{key:"setupRasterNode",value:function(e){var t=this,n=new RM(e.material,this);e.material.addLayer(n),e.material.setSequenceElevation(this.id);var i=function(){return e.setBBoxZ(n.min,n.max,t.scale)};return i(),n.addEventListener("updatedElevation",i),n}},{key:"update",value:function(e,t,n,i){return function(e,t,n,i){var r=n.material;if(i&&r){var a=n.getExtentsByProjection(t.crs),o=a[0].zoom;if(!(o>t.zoom.max||o=t.source.zoom.min)return void e.view.notifyChange(n,!1)}if(!t.frozen&&r.visible&&n.layerUpdateState[t.id].canTryUpdate()){var A=n.layerUpdateState[t.id].failureParams,c=GM(t.updateStrategy.type,n,a[0].zoom,s.level,t,A);if(!(c<=s.level||c>a[0].zoom)){if(!t.source.extentInsideLimit(n.extent,c))return n.layerUpdateState[t.id].noData({targetLevel:c}),void e.view.notifyChange(n,!1);var h=a.map((function(e){return e.tiledExtentParent(c)}));n.layerUpdateState[t.id].newTry();var u=q_(e.view,t,h,a,n);return e.scheduler.execute(u).then((function(e){if(c<=s.level)n.layerUpdateState[t.id].noMoreUpdatePossible();else{var i=a.map((function(t,n){return t.offsetToParent(e[n].extent,s.offsetScales[n])}));s.setTextures(e,i),n.layerUpdateState[t.id].success()}}),(function(i){return Y_(i,n,t,c,e.view)}))}n.layerUpdateState[t.id].noMoreUpdatePossible()}}}}(e,this,n,i)}}]),n}(yF);new at;var bF=new Ei,MF=new tn;bF.geometry.boundingBox=MF,new at;var CF=new Ei,BF=new tn;function EF(e,t,n,i,r,a){var o={view:e,requester:r,layer:n,priority:r?1/(r.distance+1):100,metadata:i,redraw:a};return t.execute(o)}function SF(e){return e.children.filter((function(t){return t.layer==e.layer&&t.tileId}))}function TF(e,t,n,i){n.additiveRefinement?function(e,t,n,i){var r,a=S(t.tileset.tiles[n.tileId].children);try{var o=function(){var a=r.value;if(a.promise||a.loaded)return"continue";var o=n.matrixWorld;if(a.transform&&(o=FF.multiplyMatrices(n.matrixWorld,a.transform)),!(!i||!i(t,e.camera,a,o)))return"continue";a.promise=EF(e.view,e.scheduler,t,a,n,!0).then((function(i){n.add(i),i.updateMatrixWorld();var r=LF(t.extent.crs,i.boundingVolume,i.matrixWorld);i.traverse((function(e){e.extent=r})),t.onTileContentLoaded(i),e.view.notifyChange(a),a.loaded=!0,delete a.promise}))};for(a.s();!(r=a.n()).done;)o()}catch(e){a.e(e)}finally{a.f()}}(e,t,n,i):function(e,t,n){if(!n.pendingSubdivision&&0==SF(n).length){var i=function(){var i=t.tileset.tiles[n.tileId].children;if(null==i||0===i.length)return{v:void 0};n.pendingSubdivision=!0;for(var r=[],a=function(a){r.push(EF(e.view,e.scheduler,t,i[a],n,!1).then((function(r){i[a].loaded=!0,n.add(r),r.updateMatrixWorld(),n.additiveRefinement&&e.view.notifyChange(n),t.tileset.tiles[r.tileId].loaded=!0,t.onTileContentLoaded(r)})))},o=0;o2&&void 0!==arguments[2]?arguments[2]:0,i=t.additiveRefinement||n>0,r=0;rthis.cleanupDelay){this.root.cleanableSince=void 0;for(var t=0;tthis.cleanupDelay))break;PF(this,n)}this._cleanableTiles.splice(0,t)}return[this.root]}var RF=new tn,OF=new an;function NF(e,t){e.content&&(e.content.visible=t)}function zF(e,t){t.cleanableSince||(t.cleanableSince=Date.now(),e._cleanableTiles.push(t))}function QF(e,t,n){if(void 0===t.tileset.tiles[n.tileId].children)return!1;if(t.tileset.tiles[n.tileId].isTileset)return!0;var i=function(e,t){if(t.distance=0,t.boundingVolume.region)RF.copy(t.boundingVolume.region.box3D),RF.applyMatrix4(t.boundingVolume.region.matrixWorld),t.distance=RF.distanceToPoint(e.camera3D.position);else if(t.boundingVolume.box)RF.copy(t.boundingVolume.box),RF.applyMatrix4(t.matrixWorld),t.distance=RF.distanceToPoint(e.camera3D.position);else{if(!t.boundingVolume.sphere)return 1/0;OF.copy(t.boundingVolume.sphere),OF.applyMatrix4(t.matrixWorld),t.distance=Math.max(0,OF.distanceToPoint(e.camera3D.position))}return 0===t.distance?1/0:e._preSSE*(t.geometricError/t.distance)}(e.camera,n);return i>t.sseThreshold}var GF=new bt,HF=new at,VF=new at,jF=new bb("EPSG:4326",0,0,0,0),WF=new at,XF=new at,YF=function(){function e(t,n,i){if(s(this,e),this.type=qE,t.region)this.initBoundingRegion(t.region,n);else if(t.box)this.initBoundingBox(t.box);else{if(!t.sphere)throw new Error("3D Tiles nodes must have a bounding volume");this.initBoundingSphere(t.sphere)}t.extensions&&(this.extensions=i.parseExtensions(t.extensions,this.type))}return A(e,[{key:"initBoundingRegion",value:function(e,t){jF.set(Hh.radToDeg(e[0]),Hh.radToDeg(e[2]),Hh.radToDeg(e[1]),Hh.radToDeg(e[3]));var n=new ET;n.setFromExtent(jF),n.updateZ(e[4],e[5]),n.matrix.premultiply(t),n.matrix.decompose(n.position,n.quaternion,n.scale),this.region=n}},{key:"initBoundingBox",value:function(e){HF.set(e[0],e[1],e[2]),VF.set(e[3],e[7],e[11]).multiplyScalar(2),this.box=new tn,this.box.setFromCenterAndSize(HF,VF)}},{key:"initBoundingSphere",value:function(e){WF.set(e[0],e[1],e[2]),this.sphere=new an(WF,e[3])}},{key:"boundingVolumeCulling",value:function(e,t){return!(!this.region||e.isBox3Visible(this.region.box3D,GF.multiplyMatrices(t,this.region.matrix)))||(!(!this.box||e.isBox3Visible(this.box,t))||this.sphere&&!e.isSphereVisible(this.sphere,t))}},{key:"viewerRequestVolumeCulling",value:function(e,t){return this.region?(console.warn("Region viewerRequestVolume not yet supported"),!0):this.box?(console.warn("Bounding box viewerRequestVolume not yet supported"),!0):!(!this.sphere||(XF.copy(this.sphere.center),XF.applyMatrix4(t),e.camera3D.position.distanceTo(XF)<=this.sphere.radius))}}]),e}(),KF=new bt,ZF=function(){function e(t,n,i){s(this,e),this.type=ZE,this.asset=t.asset,this.properties=t.properties,this.geometricError=t.geometricError,this.extensionsUsed=t.extensionsUsed,this.extensionsRequired=t.extensionsRequired,this.tiles=[],this.parseTiles(t.root,n,void 0,i),t.extensions&&(this.extensions=i.parseExtensions(t.extensions,this.type))}return A(e,[{key:"parseTiles",value:function(e,t,n,i){if(e.transform=e.transform?(new bt).fromArray(e.transform):void 0,e._worldFromLocalTransform=e.transform,n&&n._worldFromLocalTransform&&(e.transform?e._worldFromLocalTransform=(new bt).multiplyMatrices(n._worldFromLocalTransform,e.transform):e._worldFromLocalTransform=n._worldFromLocalTransform),(e.viewerRequestVolume&&e.viewerRequestVolume.region||e.boundingVolume&&e.boundingVolume.region)&&(e._worldFromLocalTransform?KF.copy(e._worldFromLocalTransform).invert():KF.identity()),e.viewerRequestVolume=e.viewerRequestVolume?new YF(e.viewerRequestVolume,KF,i):void 0,e.boundingVolume=e.boundingVolume?new YF(e.boundingVolume,KF,i):void 0,this.tiles.push(e),e.tileId=this.tiles.length-1,e.baseURL=t,e.children){var r,a=S(e.children);try{for(a.s();!(r=a.n()).done;){var o=r.value;this.parseTiles(o,t,e,i)}}catch(e){a.e(e)}finally{a.f()}}}},{key:"extendTileset",value:function(e,t,n,i){this.parseTiles(e.root,n,this.tiles[t],i),this.tiles[t].children=[e.root],this.tiles[t].isTileset=!0}}]),e}(),JF=function(){function e(){s(this,e)}return A(e,[{key:"registerExtension",value:function(e,t){this[e]=t}},{key:"getExtension",value:function(e,t){if(this[e]&&this[e][t])return this[e][t];console.error("".concat("No extension manager registered for extension "," ").concat(e," and for class ").concat(t))}},{key:"isExtensionRegistered",value:function(e){return this[e]}},{key:"parseExtensions",value:function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=new(this.getExtension(i,t))(e[i]));return n}}]),e}(),qF=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:kF,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:QF;return function(n,i,r){if(!r.parent.pendingSubdivision||r.parent.additiveRefinement){var a=!e||!e(i,n.camera,r,r.matrixWorld);if(r.visible=a,a){var o;if(r.cleanableSince&&(i._cleanableTiles.splice(i._cleanableTiles.indexOf(r),1),r.cleanableSince=void 0),r.pendingSubdivision||t(n,i,r))TF(n,i,r,e),NF(r,r.pendingSubdivision||r.additiveRefinement),o=SF(r);else{NF(r,!0);var s,l=S(SF(r));try{for(l.s();!(s=l.n()).done;){var A=s.value;A.visible=!1,zF(i,A)}}catch(e){l.e(e)}finally{l.f()}}return o}zF(i,r)}else r.visible=!1}}(),$F=function(e){h(n,e);var t=y(n);function n(e,i,r){var a;s(this,n),(a=t.call(this,e,new ja,{source:i.source})).isC3DTilesLayer=!0,a.sseThreshold=i.sseThreshold||16,a.cleanupDelay=i.cleanupDelay||1e3,a.onTileContentLoaded=i.onTileContentLoaded||function(){},a.protocol="3d-tiles",a.overrideMaterials=void 0===i.overrideMaterials||i.overrideMaterials,a.name=i.name,a.registeredExtensions=i.registeredExtensions||new JF,a._cleanableTiles=[];var o=a.addInitializationStep();return a.source.whenReady.then((function(e){if(a.tileset=new ZF(e,a.source.baseUrl,a.registeredExtensions),a.tileset.extensionsUsed){var t,n=S(a.tileset.extensionsUsed);try{for(n.s();!(t=n.n()).done;){var i=t.value;a.registeredExtensions.isExtensionRegistered(i)||(a.tileset.extensionsRequired&&a.tileset.extensionsRequired.includes(i)?console.error('3D Tiles tileset required extension "'.concat(i,'" must be registered to the 3D Tiles layer of iTowns to be parsed and used.')):console.warn('3D Tiles tileset used extension "'.concat(i,'" must be registered to the 3D Tiles layer of iTowns to be parsed and used.')))}}catch(e){n.e(e)}finally{n.f()}}(function(e,t,n,i){return EF(e,t,n,i,void 0,!0).then((function(t){n.object3d.add(t),t.updateMatrixWorld(),n.tileset.tiles[t.tileId].loaded=!0,n.root=t,n.extent=LF(n.crs||e.referenceCrs,t.boundingVolume,t.matrixWorld),n.onTileContentLoaded(t)}))})(r,r.mainLoop.scheduler,v(a),e.root).then(o)})),a}return A(n,[{key:"preUpdate",value:function(){return DF.bind(this)()}},{key:"update",value:function(e,t,n){return qF(e,t,n)}},{key:"getObjectToUpdateForAttachedLayers",value:function(e){if(e.content){var t=[];e.content.traverse((function(n){n.isObject3D&&n.material&&n.layer==e.layer&&t.push(n)}));var n=e.parent;return n&&n.content?{elements:t,parent:n.content}:{elements:t}}}},{key:"findBatchTable",value:function(e){return e.batchTable?e.batchTable:e.parent?this.findBatchTable(e.parent):void 0}},{key:"getInfoFromIntersectObject",value:function(e){for(var t={},n=-1,i={},r=0;r=this.zoom.min;r--){var a=this.tileMatrixSetLimits[r],o=ik.set(r,a.minTileRow,a.minTileCol).as(i),s=o.west,l=o.north,A=ik.set(r,a.maxTileRow,a.maxTileCol).as(i),c=A.east,h=A.south;this.extentSetlimits[i][r]=new bb(i,s,c,h,l)}}}},{key:"extentInsideLimit",value:function(e,t){return t>=this.zoom.min&&t<=this.zoom.max&&(null==this.extentSetlimits[e.crs]||this.extentSetlimits[e.crs][t].intersectsExtent(e))}}]),n}(hE),ak=function(e){h(n,e);var t=y(n);function n(e){var i;if(s(this,n),e.projection&&(console.warn("WFSSource projection parameter is deprecated, use crs instead."),e.crs=e.crs||e.projection),!e.typeName)throw new Error("source.typeName is required in wfs source.");if(!e.crs)throw new Error("source.crs is required in wfs source");for(var r in e.format=e.format||"application/json",(i=t.call(this,e)).isWFSSource=!0,i.typeName=e.typeName,i.version=e.version||"2.0.2",i.url="".concat(e.url,"SERVICE=WFS&REQUEST=GetFeature&typeName=").concat(i.typeName,"&VERSION=").concat(i.version,"&SRSNAME=").concat(i.crs,"&BBOX=%bbox,").concat(i.crs),void 0!==e.tk&&(i.url+="&tk="+e.tk),e.format&&(i.url=i.url+"&outputFormat="+e.format),e.name&&(i.url=i.url+"&name="+e.name),i.zoom={min:0,max:1/0},i.vendorSpecific=e.vendorSpecific,i.vendorSpecific)Object.prototype.hasOwnProperty.call(i.vendorSpecific,r)&&(i.url="".concat(i.url,"&").concat(r,"=").concat(i.vendorSpecific[r]));return i}return A(n,[{key:"handlingError",value:function(e){var t=this;return e.response&&400==e.response.status?e.response.text().then((function(n){var i="".concat(t.url,"SERVICE=WFS&REQUEST=GetCapabilities&VERSION=").concat(t.version),r=(new DOMParser).parseFromString(n,"application/xml").querySelector("Exception"),a=r.getAttribute("exceptionCode"),o=r.querySelector("ExceptionText").textContent;console.error("Source ".concat(t.typeName,': bad request when fetching data. Server says: "').concat(a,": ").concat(o,'". \nReviewing ').concat(i," may help."),e)})):b(u(n.prototype),"handlingError",this).call(this,e)}},{key:"requestToKey",value:function(e){return Jx.isTms(e.crs)?b(u(n.prototype),"requestToKey",this).call(this,e):[e.zoom,e.south,e.west]}},{key:"urlFromExtent",value:function(e){return kE(e,this)}},{key:"extentInsideLimit",value:function(e){return this.extent.intersectsExtent(e)}}]),n}(hE),ok=function(e){h(n,e);var t=y(n);function n(e){var i;if(s(this,n),!e.name)throw new Error("New WMTSSource: name is required");return(i=t.call(this,e)).isWMTSSource=!0,i.url="".concat(i.url)+(i.url.includes("?")?"&":"?")+"LAYER=".concat(e.name)+"&FORMAT=".concat(i.format)+"&SERVICE=WMTS"+"&VERSION=".concat(e.version||"1.0.0")+"&REQUEST=GetTile"+"&STYLE=".concat(e.style||"normal")+"&TILEMATRIXSET=".concat(e.tileMatrixSet)+"&TILEMATRIX=%TILEMATRIX&TILEROW=%ROW&TILECOL=%COL",void 0!==e.tk&&(i.url+="&tk="+e.tk),i}return A(n)}(rk),sk={POSITION_CARTESIAN:{numElements:3,arrayType:Float32Array,attributeName:"position"},COLOR_PACKED:{numElements:4,arrayType:Uint8Array,attributeName:"color",normalized:!0},INTENSITY:{numElements:1,numByte:2,arrayType:Uint16Array,attributeName:"intensity",normalized:!0},CLASSIFICATION:{numElements:1,arrayType:Uint8Array,attributeName:"classification",normalized:!0},NORMAL_SPHEREMAPPED:{numElements:2,arrayType:Uint8Array,attributeName:"sphereMappedNormal"},NORMAL_OCT16:{numElements:2,arrayType:Uint8Array,attributeName:"oct16Normal"},NORMAL:{numElements:3,arrayType:Float32Array,attributeName:"normal"}},lk=function(){var e=ck[Ak],t=sk[e];t.potreeName=e,t.numByte=t.numByte||t.arrayType.BYTES_PER_ELEMENT,t.byteSize=t.numElements*t.numByte,t.normalized=t.normalized||!1;var n="getUint".concat(8*t.numByte);t.getValue=1===t.numByte?function(e,t){return e[n](t)}:function(e,t){return e[n](t,!0)}},Ak=0,ck=Object.keys(sk);Ak>18]+o[63&e>>12]+o[63&e>>6]+o[63&e]}function a(e,t,n){for(var i,a=[],o=t;o>16,A[c++]=255&t>>8,A[c++]=255&t;return 2===o&&(t=s[e.charCodeAt(n)]<<2|s[e.charCodeAt(n+1)]>>4,A[c++]=255&t),1===o&&(t=s[e.charCodeAt(n)]<<10|s[e.charCodeAt(n+1)]<<4|s[e.charCodeAt(n+2)]>>2,A[c++]=255&t>>8,A[c++]=255&t),A},n.fromByteArray=function(e){for(var t,n=e.length,i=n%3,r=[],s=16383,l=0,A=n-i;lA?A:l+s));return 1===i?(t=e[n-1],r.push(o[t>>2]+o[63&t<<4]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],r.push(o[t>>10]+o[63&t>>4]+o[63&t<<2]+"=")),r.join("")};for(var o=[],s=[],l="undefined"==typeof Uint8Array?Array:Uint8Array,A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,h=A.length;ct||e.byteLengthe)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e,n,i){return A(e),0>=e||void 0===n?t(e):"string"==typeof i?t(e).fill(n,i):t(e).fill(n)}function h(e){return A(e),t(0>e?0:0|p(e))}function u(e,n){if(("string"!=typeof n||""===n)&&(n="utf8"),!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var r=0|m(e,n),a=t(r),o=a.write(e,n);return o!==r&&(a=a.slice(0,o)),a}function d(e){for(var n=0>e.length?0:0|p(e.length),i=t(n),r=0;r=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|e}function m(e,t){if(i.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||H(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+r(e));var n=e.length,a=2>>1;case"base64":return Q(e).length;default:if(o)return a?-1:z(e).length;t=(""+t).toLowerCase(),o=!0}}function v(e,t,n){var i=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),0>=n)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return F(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return L(this,t,n);case"base64":return S(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function y(e,t,n,r,a){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647n&&(n=-2147483648),V(n=+n)&&(n=a?0:e.length-1),0>n&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(0>n){if(!a)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,a);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,i,r){function a(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var o,s=1,l=e.length,A=t.length;if(void 0!==i&&("ucs2"===(i=(i+"").toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(2>e.length||2>t.length)return-1;s=2,l/=2,A/=2,n/=2}if(r){var c=-1;for(o=n;ol&&(n=l-A),o=n;0<=o;o--){for(var h=!0,u=0;ur&&(i=r):i=r;var a=t.length;i>a/2&&(i=a/2);for(var o,s=0;s(t-=2));++o)i=(n=e.charCodeAt(o))>>8,r=n%256,a.push(r),a.push(i);return a}(t,e.length-n),e,n,i)}function S(e,t,n){return 0===t&&n===e.length?j.fromByteArray(e):j.fromByteArray(e.slice(t,n))}function T(e,t,n){n=l(e.length,n);for(var i=[],r=t;rc&&(h=c):2===u?128==(192&(a=e[r+1]))&&(127<(A=(31&c)<<6|63&a)&&(h=A)):3===u?(a=e[r+1],o=e[r+2],128==(192&a)&&128==(192&o)&&(2047<(A=(15&c)<<12|(63&a)<<6|63&o)&&(55296>A||57343A&&(h=A)));null===h?(h=65533,u=1):65535>>10),h=56320|1023&h),i.push(h),r+=u}return _(i)}function _(e){var t=e.length;if(t<=4096)return s.apply(String,e);for(var n="",i=0;it)&&(t=0),(!n||0>n||n>i)&&(n=i);for(var r="",a=t;ae)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,n,r,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function D(e,t,n,i){if(n+i>e.length)throw new RangeError("Index out of range");if(0>n)throw new RangeError("Index out of range")}function R(e,t,n,i,r){return t=+t,n>>>=0,r||D(e,0,n,4),W.write(e,t,n,i,23,4),n+4}function O(e,t,n,i,r){return t=+t,n>>>=0,r||D(e,0,n,8),W.write(e,t,n,i,52,8),n+8}function N(e){return 16>e?"0"+e.toString(16):e.toString(16)}function z(e,t){t=t||1/0;for(var n,i=e.length,r=null,a=[],o=0;on){if(!r){if(56319n){-1<(t-=3)&&a.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&-1<(t-=3)&&a.push(239,191,189);if(r=null,128>n){if(0>(t-=1))break;a.push(n)}else if(2048>n){if(0>(t-=2))break;a.push(192|n>>6,128|63&n)}else if(65536>n){if(0>(t-=3))break;a.push(224|n>>12,128|63&n>>6,128|63&n)}else{if(!(1114112>n))throw new Error("Invalid code point");if(0>(t-=4))break;a.push(240|n>>18,128|63&n>>12,128|63&n>>6,128|63&n)}}return a}function Q(e){return j.toByteArray(function(e){if(2>(e=(e=e.split("=")[0]).trim().replace(X,"")).length)return"";for(;0!=e.length%4;)e+="=";return e}(e))}function G(e,t,n,i){for(var r=0;r=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function H(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function V(e){return e!=e}var j=e("base64-js"),W=e("ieee754");n.Buffer=i,n.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},n.INSPECT_MAX_BYTES=50,n.kMaxLength=2147483647,i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){return i.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){return i.isBuffer(this)?this.byteOffset:void 0}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,n){return o(e,t,n)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,n){return c(e,t,n)},i.allocUnsafe=function(e){return h(e)},i.allocUnsafeSlow=function(e){return h(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==i.prototype},i.compare=function(e,t){if(H(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),H(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,a=0,o=l(n,r);at&&(e+=" ... "),""},i.prototype.compare=function(e,t,n,a,o){if(H(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+r(e));if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===a&&(a=0),void 0===o&&(o=this.length),0>t||n>e.length||0>a||o>this.length)throw new RangeError("out of range index");if(a>=o&&t>=n)return 0;if(a>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(a>>>=0),A=(n>>>=0)-(t>>>=0),c=l(s,A),h=this.slice(a,o),u=e.slice(t,n),d=0;d>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-t;if((void 0===n||n>r)&&(n=r),0n||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":return M(this,e,t,n);case"latin1":case"binary":return C(this,e,t,n);case"base64":return B(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.slice=function(e,t){var n=this.length;0>(e=~~e)?0>(e+=n)&&(e=0):e>n&&(e=n),0>(t=void 0===t?n:~~t)?0>(t+=n)&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||P(e,t,this.length);for(var i=this[e],r=1,a=0;++a>>=0,t>>>=0,n||P(e,t,this.length);for(var i=this[e+--t],r=1;0>>=0,t||P(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);for(var i=this[e],r=1,o=0;++o=(r*=128)&&(i-=a(2,8*t)),i},i.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);for(var i=t,r=1,o=this[e+--i];0=(r*=128)&&(o-=a(2,8*t)),o},i.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),W.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),W.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),W.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),W.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,i){(e=+e,t>>>=0,n>>>=0,i)||U(this,e,t,n,a(2,8*n)-1,0);var r=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,i)||U(this,e,t,n,a(2,8*n)-1,0);var r=n-1,o=1;for(this[t+r]=255&e;0<=--r&&(o*=256);)this[t+r]=255&e/o;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){var r=a(2,8*n-1);U(this,e,t,n,r-1,-r)}var o=0,s=1,l=0;for(this[t]=255&e;++oe&&0===l&&0!==this[t+o-1]&&(l=1),this[t+o]=255&(e/s>>0)-l;return t+n},i.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){var r=a(2,8*n-1);U(this,e,t,n,r-1,-r)}var o=n-1,s=1,l=0;for(this[t+o]=255&e;0<=--o&&(s*=256);)0>e&&0===l&&0!==this[t+o+1]&&(l=1),this[t+o]=255&(e/s>>0)-l;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,1,127,-128),0>e&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,n){return R(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return R(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return O(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return O(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(!i.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),0t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-ta||"latin1"===r)&&(e=a)}}else"number"==typeof e&&(e&=255);if(0>t||this.length>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o */ o.read=function(e,t,n,i,r){var o,s,l=8*r-i-1,A=(1<>1,h=-7,u=n?r-1:0,d=n?-1:1,f=e[t+u];for(u+=d,o=f&(1<<-h)-1,f>>=-h,h+=l;0>=-h,h+=i;0>1,v=23===l?a(2,-24)-a(2,-77):0,g=s?0:A-1,y=s?1:-1,w=0>r||0===r&&0>1/r?1:0;for(r=n(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,c=p):(c=e(t(r)/d),1>r*(u=a(2,-c))&&(c--,u*=2),2<=(r+=1<=c+m?v/u:v*a(2,1-m))*u&&(c++,u/=2),c+m>=p?(h=0,c=p):1<=c+m?(h=(r*u-1)*a(2,l),c+=m):(h=r*a(2,m-1)*a(2,l),c=0));8<=l;i[o+g]=255&h,g+=y,h/=256,l-=8);for(c=c< (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/master/LICENSE */ !function(e){"object"==r(a)&&void 0!==i?i.exports=e():("undefined"==typeof window?void 0===o?"undefined"==typeof self?this:self:o:window).JSZip=e()}((function(){return function e(n,i,r){function a(s,l){if(!i[s]){if(!n[s]){var A="function"==typeof t&&t;if(!l&&A)return A(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var h=i[s]={exports:{}};n[s][0].call(h.exports,(function(e){return a(n[s][1][e]||e)}),h,h.exports,e,n,i,r)}return i[s].exports}for(var o="function"==typeof t&&t,s=0;s>2,o=(3&t)<<4|n>>4,s=1>6:64,l=2>4,n=(15&a)<<4|(o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(e.charAt(l++)))>>2,i=(3&o)<<6|(s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(e.charAt(l++))),c[A++]=t,64!==o&&(c[A++]=n),64!==s&&(c[A++]=i);return c}},{"./support":30,"./utils":32}],2:[function(e,t){function n(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}var i=e("./external"),r=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");n.prototype={getContentWorker:function(){var e=new r(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new r(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},n.createWorkerFrom=function(e,t,n){return e.pipe(new a).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=n},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var i=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t){var n=e("./utils"),i=function(){for(var e,t=[],n=0;256>n;n++){e=n;for(var i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"===n.getTypeOf(e)?function(e,t,n){e^=-1;for(var r=0;r<0+n;r++)e=e>>>8^i[255&(e^t.charCodeAt(r))];return-1^e}(0|t,e,e.length):function(e,t,n){e^=-1;for(var r=0;r<0+n;r++)e=e>>>8^i[255&(e^t[r])];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t){var n;n="undefined"==typeof Promise?e("lie"):Promise,t.exports={Promise:n}},{lie:37}],7:[function(e,t,n){function i(e,t){s.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,a=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),l=r?"uint8array":"array";n.magic="\b\0",o.inherits(i,s),i.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(l,e.data),!1)},i.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},i.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},i.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new i("Deflate",e)},n.uncompressWorker=function(){return new i("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t){function n(e,t){var n,i="";for(n=0;n>>=8;return i}function i(e,t,i,r,o,s){var h,u,d=e.file,f=e.compression,p=s!==l.utf8encode,m=a.transformTo("string",s(d.name)),v=a.transformTo("string",l.utf8encode(d.name)),g=d.comment,y=a.transformTo("string",s(g)),w=a.transformTo("string",l.utf8encode(g)),x=v.length!==d.name.length,b=w.length!==g.length,M="",C="",B="",E=d.dir,S=d.date,T={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(T.crc32=e.crc32,T.compressedSize=e.compressedSize,T.uncompressedSize=e.uncompressedSize);var _=0;t&&(_|=8),!p&&(x||b)&&(_|=2048);var I,L=0,F=0;E&&(L|=16),"UNIX"===o?(F=798,L|=((I=d.unixPermissions)||(I=E?16893:33204),(65535&I)<<16)):(F=20,L|=63&(d.dosPermissions||0)),h=S.getUTCHours(),h<<=6,h|=S.getUTCMinutes(),h<<=5,h|=S.getUTCSeconds()/2,u=S.getUTCFullYear()-1980,u<<=4,u|=S.getUTCMonth()+1,u<<=5,u|=S.getUTCDate(),x&&(M+="up"+n((C=n(1,1)+n(A(m),4)+v).length,2)+C),b&&(M+="uc"+n((B=n(1,1)+n(A(y),4)+w).length,2)+B);var k="";return k+="\n\0",k+=n(_,2),k+=f.magic,k+=n(h,2),k+=n(u,2),k+=n(T.crc32,4),k+=n(T.compressedSize,4),k+=n(T.uncompressedSize,4),k+=n(m.length,2),k+=n(M.length,2),{fileRecord:c.LOCAL_FILE_HEADER+k+m+M,dirRecord:c.CENTRAL_FILE_HEADER+n(F,2)+k+n(y.length,2)+"\0\0\0\0"+n(L,4)+n(r,4)+m+M+y}}function r(e,t,n,i){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}var a=e("../utils"),o=e("../stream/GenericWorker"),l=e("../utf8"),A=e("../crc32"),c=e("../signature");a.inherits(r,o),r.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-i-1))/n:100}}))},r.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},r.prototype.closedSource=function(e){this.accumulate=!1;var t,r=this.streamFiles&&!e.file.dir,a=i(e,r,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(a.dirRecord),r)this.push({data:(t=e,c.DATA_DESCRIPTOR+n(t.crc32,4)+n(t.compressedSize,4)+n(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:a.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},r.prototype.flush=function(){for(var e=this.bytesWritten,t=0;te)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(127&e>>25),(15&e>>21)-1,31&e>>16,31&e>>11,63&e>>5,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t){function n(e){i.call(this,e)}var i=e("./Uint8ArrayReader");e("../utils").inherits(n,i),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t){function n(e){i.call(this,e)}var i=e("./DataReader");e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t){function n(e){i.call(this,e)}var i=e("./ArrayReader");e("../utils").inherits(n,i),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t){var n=e("../utils"),i=e("../support"),r=e("./ArrayReader"),a=e("./StringReader"),o=e("./NodeBufferReader"),s=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new o(e):i.uint8array?new s(n.transformTo("uint8array",e)):new r(n.transformTo("array",e)):new a(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t){function n(e){i.call(this,"ConvertWorker to "+e),this.destType=e}var i=e("./GenericWorker"),r=e("../utils");r.inherits(n,i),n.prototype.processChunk=function(e){this.push({data:r.transformTo(this.destType,e.data),meta:e.meta})},t.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(e,t){function n(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}var i=e("./GenericWorker"),r=e("../crc32");e("../utils").inherits(n,i),n.prototype.processChunk=function(e){this.streamInfo.crc32=r(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t){function n(e){r.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}var i=e("../utils"),r=e("./GenericWorker");i.inherits(n,r),n.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}r.prototype.processChunk.call(this,e)},t.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(e,t){function n(e){r.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}var i=e("../utils"),r=e("./GenericWorker");i.inherits(n,r),n.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=l(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(e,t){function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n "+e:e}},t.exports=n},{}],29:[function(e,t){function n(e,t,n){var o=t;"blob"===t||"arraybuffer"===t?o="uint8array":"base64"===t&&(o="string");try{this._internalType=o,this._outputType=t,this._mimeType=n,i.checkSupport(o),this._worker=e.pipe(new r(o)),e.lock()}catch(n){this._worker=new a("error"),this._worker.error(n)}}var i=e("../utils"),r=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),s=e("../support"),l=e("../external"),c=null;if(s.nodestream)try{c=e("../nodejs/NodejsStreamOutputAdapter")}catch(n){}n.prototype={accumulate:function(e){return t=this,n=e,new l.Promise((function(e,r){var a=[],s=t._internalType,l=t._outputType,c=t._mimeType;t.on("data",(function(e,t){a.push(e),n&&n(t)})).on("error",(function(e){a=[],r(e)})).on("end",(function(){try{var t=function(e,t,n){return"blob"===e?i.newBlob(i.transformTo("arraybuffer",t),n):"base64"===e?o.encode(t):i.transformTo(e,t)}(l,function(e,t){var n,i=0,r=null,a=0;for(n=0;nc;c++)A[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;A[254]=A[254]=1,n.utf8encode=function(e){return o.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,n,i,r,a,s=e.length,l=0;for(r=0;rn?1:2048>n?2:65536>n?3:4;for(t=o.uint8array?new Uint8Array(l):Array(l),r=a=0;an?t[a++]=n:(2048>n?t[a++]=192|n>>>6:(65536>n?t[a++]=224|n>>>12:(t[a++]=240|n>>>18,t[a++]=128|63&n>>>12),t[a++]=128|63&n>>>6),t[a++]=128|63&n);return t}(e)},n.utf8decode=function(e){return o.nodebuffer?a.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,r,o=e.length,s=Array(2*o);for(t=n=0;t(i=e[t++]))s[n++]=i;else if(4<(r=A[i]))s[n++]=65533,t+=r-1;else{for(i&=2===r?31:3===r?15:7;1i?s[n++]=i:(i-=65536,s[n++]=55296|1023&i>>10,s[n++]=56320|1023&i)}return s.length!==n&&(s.subarray?s=s.subarray(0,n):s.length=n),a.applyFromCharCode(s)}(e=a.transformTo(o.uint8array?"uint8array":"array",e))},a.inherits(i,l),i.prototype.processChunk=function(e){var t=a.transformTo(o.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var i=t;(t=new Uint8Array(i.length+this.leftOver.length)).set(this.leftOver,0),t.set(i,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var r=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return 0>n||0===n?t:n+A[e[n]]>t?n:t}(t),s=t;r!==t.length&&(o.uint8array?(s=t.subarray(0,r),this.leftOver=t.subarray(r,t.length)):(s=t.slice(0,r),this.leftOver=t.slice(r,t.length))),this.push({data:n.utf8decode(s),meta:e.meta})},i.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=i,a.inherits(r,l),r.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=r},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,n,i){function r(e){return e}function a(e,t){for(var n=0;n(t=e.charCodeAt(n))?"0":"")+t.toString(16).toUpperCase();return i},i.delay=function(e,t,n){d((function(){e.apply(n||null,t||[])}))},i.inherits=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n},i.extend=function(){var e,t,n={};for(e=0;ee)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,0>(e=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR)))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),0>this.relativeOffsetEndOfZip64CentralDir))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=t-i;if(0r)throw new Error("Corrupted zip: missing "+n(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=i},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(e,t){function n(e,t){this.options=e,this.loadOptions=t}var i=e("./reader/readerFor"),r=e("./utils"),a=e("./compressedObject"),o=e("./crc32"),s=e("./utf8"),l=e("./compressions"),A=e("./support");n.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(l.hasOwnProperty(t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=65535&this.externalFileAttributes>>16),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,i,r=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4t.windowBits&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new A,this.strm.avail_out=0;var n=a.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(l[n]);if(t.header&&a.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=a.deflateSetDictionary(this.strm,r)))throw new Error(l[n]);this._dict_set=!0}}function r(e,t){var n=new i(t);if(n.push(e,!0),n.err)throw n.msg||l[n.err];return n.result}var a=e("./zlib/deflate"),o=e("./utils/common"),s=e("./utils/strings"),l=e("./zlib/messages"),A=e("./zlib/zstream"),c=Object.prototype.toString;i.prototype.push=function(e,t){var n,i,r=this.strm,l=this.options.chunkSize;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,r.input="string"==typeof e?s.string2buf(e):"[object ArrayBuffer]"===c.call(e)?new Uint8Array(e):e,r.next_in=0,r.avail_in=r.input.length;do{if(0===r.avail_out&&(r.output=new o.Buf8(l),r.next_out=0,r.avail_out=l),1!==(n=a.deflate(r,i))&&0!==n)return this.onEnd(n),!(this.ended=!0);0!==r.avail_out&&(0!==r.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(s.buf2binstring(o.shrinkBuf(r.output,r.next_out))):this.onData(o.shrinkBuf(r.output,r.next_out)))}while((0t.windowBits&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&16>t.windowBits)||e&&e.windowBits||(t.windowBits+=32),15t.windowBits&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var n=a.inflateInit2(this.strm,t.windowBits);if(n!==l.Z_OK)throw new Error(A[n]);this.header=new h,a.inflateGetHeader(this.strm,this.header)}function r(e,t){var n=new i(t);if(n.push(e,!0),n.err)throw n.msg||A[n.err];return n.result}var a=e("./zlib/inflate"),o=e("./utils/common"),s=e("./utils/strings"),l=e("./zlib/constants"),A=e("./zlib/messages"),c=e("./zlib/zstream"),h=e("./zlib/gzheader"),u=Object.prototype.toString;i.prototype.push=function(e,t){var n,i,r,A,c,h,d=this.strm,f=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?l.Z_FINISH:l.Z_NO_FLUSH,d.input="string"==typeof e?s.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?new Uint8Array(e):e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new o.Buf8(f),d.next_out=0,d.avail_out=f),(n=a.inflate(d,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&p&&(h="string"==typeof p?s.string2buf(p):"[object ArrayBuffer]"===u.call(p)?new Uint8Array(p):p,n=a.inflateSetDictionary(this.strm,h)),n===l.Z_BUF_ERROR&&!0===m&&(n=l.Z_OK,m=!1),n!==l.Z_STREAM_END&&n!==l.Z_OK)return this.onEnd(n),!(this.ended=!0);d.next_out&&(0!==d.avail_out&&n!==l.Z_STREAM_END&&(0!==d.avail_in||i!==l.Z_FINISH&&i!==l.Z_SYNC_FLUSH)||("string"===this.options.to?(r=s.utf8border(d.output,d.next_out),A=d.next_out-r,c=s.buf2string(d.output,r),d.next_out=A,d.avail_out=f-A,A&&o.arraySet(d.output,d.output,r,A,0),this.onData(c)):this.onData(o.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((0t&&(e.subarray&&o||!e.subarray&&a))return s.apply(null,r.shrinkBuf(e,t));for(var n="",i=0;iA;A++)l[A]=252<=A?6:248<=A?5:240<=A?4:224<=A?3:192<=A?2:1;l[254]=l[254]=1,n.string2buf=function(e){var t,n,i,a,o,s=e.length,l=0;for(a=0;an?1:2048>n?2:65536>n?3:4;for(t=new r.Buf8(l),a=o=0;on?t[o++]=n:(2048>n?t[o++]=192|n>>>6:(65536>n?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|63&n>>>12),t[o++]=128|63&n>>>6),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return i(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n(a=e[n++]))A[r++]=a;else if(4<(o=l[a]))A[r++]=65533,n+=o-1;else{for(a&=2===o?31:3===o?15:7;1a?A[r++]=a:(a-=65536,A[r++]=55296|1023&a>>10,A[r++]=56320|1023&a)}return i(A,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return 0>n||0===n?t:n+l[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t){t.exports=function(e,t,n,i){for(var r=0|65535&e,a=0|65535&e>>>16,o=0;0!==n;){for(n-=o=2e3n;n++){e=n;for(var i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,i,r){e^=-1;for(var a=r;a>>8^n[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,n){function i(e,t){return e.msg=C[t],t}function r(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),0!==n&&(w.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function s(e,t){x._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,o(e.strm)}function l(e,t){e.pending_buf[e.pending++]=t}function A(e,t){e.pending_buf[e.pending++]=255&t>>>8,e.pending_buf[e.pending++]=255&t}function c(e,t){var n,i,r=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,A=e.window,c=e.w_mask,h=e.prev,u=e.strstart+258,d=A[a+o-1],f=A[a+o];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(A[(n=t)+o]===f&&A[n+o-1]===d&&A[n]===A[a]&&A[++n]===A[a+1]){a+=2,n++;do{}while(A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&al&&0!=--r);return o<=e.lookahead?o:e.lookahead}function h(e){var t,n,i,r,a,o,s,l,A,c,h=e.w_size;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=h+(h-262)){for(w.arraySet(e.window,e.window,h,h,0),e.match_start-=h,e.strstart-=h,e.block_start-=h,t=n=e.hash_size;i=e.head[--t],e.head[t]=h<=i?i-h:0,--n;);for(t=n=h;i=e.prev[--t],e.prev[t]=h<=i?i-h:0,--n;);r+=h}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,l=e.strstart+e.lookahead,c=void 0,(A=r)<(c=o.avail_in)&&(c=A),n=0===c?0:(o.avail_in-=c,w.arraySet(s,o.input,o.next_in,c,l),1===o.state.wrap?o.adler=b(o.adler,s,c,l):2===o.state.wrap&&(o.adler=M(o.adler,s,c,l)),o.next_in+=c,o.total_in+=c,c),e.lookahead+=n,3<=e.lookahead+e.insert)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<e.lookahead+e.insert)););}while(e.lookahead<262&&0!==e.strm.avail_in)}function u(e,t){for(var n,i;;){if(e.lookahead<262){if(h(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(n=0,3<=e.lookahead&&(e.ins_h=(e.ins_h<=e.match_length&&(1===e.strategy||3===e.match_length&&4096t.wrap&&(t.wrap=-t.wrap),t.status=t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=0,x._tr_init(t),0):i(e,-2)}function v(e){var t,n=m(e);return 0===n&&((t=e.state).window_size=2*t.w_size,a(t.head),t.max_lazy_match=y[t.level].max_lazy,t.good_match=y[t.level].good_length,t.nice_match=y[t.level].nice_length,t.max_chain_length=y[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n}function g(e,t,n,r,a,o){if(!e)return-2;var s=1;if(-1===t&&(t=6),0>r?(s=0,r=-r):15a||9r||15t||9o||4e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(1>=e.lookahead){if(h(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+n;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,s(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(s(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(s(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(s(e,!1),e.strm.avail_out),1)})),new f(4,4,8,4,u),new f(4,5,16,8,u),new f(4,6,32,32,u),new f(4,4,16,16,d),new f(8,16,32,32,d),new f(8,16,128,128,d),new f(8,32,128,256,d),new f(32,128,258,1024,d),new f(32,258,258,4096,d)],n.deflateInit=function(e,t){return g(e,t,8,15,8,0)},n.deflateInit2=g,n.deflateReset=v,n.deflateResetKeep=m,n.deflateSetHeader=function(e,t){return e&&e.state&&2===e.state.wrap?(e.state.gzhead=t,0):-2},n.deflate=function(e,t){var n,c,u,d;if(!e||!e.state||5t)return e?i(e,-2):-2;if(c=e.state,!e.output||!e.input&&0!==e.avail_in||666===c.status&&4!==t)return i(e,0===e.avail_out?-5:-2);if(c.strm=e,n=c.last_flush,c.last_flush=t,42===c.status)if(2===c.wrap)e.adler=0,l(c,31),l(c,139),l(c,8),c.gzhead?(l(c,(c.gzhead.text?1:0)+(c.gzhead.hcrc?2:0)+(c.gzhead.extra?4:0)+(c.gzhead.name?8:0)+(c.gzhead.comment?16:0)),l(c,255&c.gzhead.time),l(c,255&c.gzhead.time>>8),l(c,255&c.gzhead.time>>16),l(c,255&c.gzhead.time>>24),l(c,9===c.level?2:2<=c.strategy||2>c.level?4:0),l(c,255&c.gzhead.os),c.gzhead.extra&&c.gzhead.extra.length&&(l(c,255&c.gzhead.extra.length),l(c,255&c.gzhead.extra.length>>8)),c.gzhead.hcrc&&(e.adler=M(e.adler,c.pending_buf,c.pending,0)),c.gzindex=0,c.status=69):(l(c,0),l(c,0),l(c,0),l(c,0),l(c,0),l(c,9===c.level?2:2<=c.strategy||2>c.level?4:0),l(c,3),c.status=113);else{var f=8+(c.w_bits-8<<4)<<8;f|=(2<=c.strategy||2>c.level?0:6>c.level?1:6===c.level?2:3)<<6,0!==c.strstart&&(f|=32),f+=31-f%31,c.status=113,A(c,f),0!==c.strstart&&(A(c,e.adler>>>16),A(c,65535&e.adler)),e.adler=1}if(69===c.status)if(c.gzhead.extra){for(u=c.pending;c.gzindex<(65535&c.gzhead.extra.length)&&(c.pending!==c.pending_buf_size||(c.gzhead.hcrc&&c.pending>u&&(e.adler=M(e.adler,c.pending_buf,c.pending-u,u)),o(e),u=c.pending,c.pending!==c.pending_buf_size));)l(c,255&c.gzhead.extra[c.gzindex]),c.gzindex++;c.gzhead.hcrc&&c.pending>u&&(e.adler=M(e.adler,c.pending_buf,c.pending-u,u)),c.gzindex===c.gzhead.extra.length&&(c.gzindex=0,c.status=73)}else c.status=73;if(73===c.status)if(c.gzhead.name){u=c.pending;do{if(c.pending===c.pending_buf_size&&(c.gzhead.hcrc&&c.pending>u&&(e.adler=M(e.adler,c.pending_buf,c.pending-u,u)),o(e),u=c.pending,c.pending===c.pending_buf_size)){d=1;break}d=c.gzindexu&&(e.adler=M(e.adler,c.pending_buf,c.pending-u,u)),0===d&&(c.gzindex=0,c.status=91)}else c.status=91;if(91===c.status)if(c.gzhead.comment){u=c.pending;do{if(c.pending===c.pending_buf_size&&(c.gzhead.hcrc&&c.pending>u&&(e.adler=M(e.adler,c.pending_buf,c.pending-u,u)),o(e),u=c.pending,c.pending===c.pending_buf_size)){d=1;break}d=c.gzindexu&&(e.adler=M(e.adler,c.pending_buf,c.pending-u,u)),0===d&&(c.status=103)}else c.status=103;if(103===c.status&&(c.gzhead.hcrc?(c.pending+2>c.pending_buf_size&&o(e),c.pending+2<=c.pending_buf_size&&(l(c,255&e.adler),l(c,255&e.adler>>8),e.adler=0,c.status=113)):c.status=113),0!==c.pending){if(o(e),0===e.avail_out)return c.last_flush=-1,0}else if(0===e.avail_in&&r(t)<=r(n)&&4!==t)return i(e,-5);if(666===c.status&&0!==e.avail_in)return i(e,-5);if(0!==e.avail_in||0!==c.lookahead||0!==t&&666!==c.status){var p=2===c.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(h(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=x._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(s(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(s(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?1:2}(c,t):3===c.strategy?function(e,t){for(var n,i,r,a,o=e.window;;){if(258>=e.lookahead){if(h(e),258>=e.lookahead&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,3<=e.lookahead&&0e.lookahead&&(e.match_length=e.lookahead)}if(3<=e.match_length?(n=x._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=x._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(s(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(s(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?1:2}(c,t):y[c.level].func(c,t);if(3!==p&&4!==p||(c.status=666),1===p||3===p)return 0===e.avail_out&&(c.last_flush=-1),0;if(2===p&&(1===t?x._tr_align(c):5!=t&&(x._tr_stored_block(c,0,0,!1),3==t&&(a(c.head),0===c.lookahead&&(c.strstart=0,c.block_start=0,c.insert=0))),o(e),0===e.avail_out))return c.last_flush=-1,0}return 4===t?0>=c.wrap?1:(2===c.wrap?(l(c,255&e.adler),l(c,255&e.adler>>8),l(c,255&e.adler>>16),l(c,255&e.adler>>24),l(c,255&e.total_in),l(c,255&e.total_in>>8),l(c,255&e.total_in>>16),l(c,255&e.total_in>>24)):(A(c,e.adler>>>16),A(c,65535&e.adler)),o(e),0=n.w_size&&(0===o&&(a(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new w.Buf8(n.w_size),w.arraySet(c,t,u-n.w_size,n.w_size,0),t=c,u=n.w_size),s=e.avail_in,l=e.next_in,A=e.input,e.avail_in=u,e.next_in=0,e.input=t,h(n);n.lookahead>=3;){for(i=n.strstart,r=n.lookahead-2;n.ins_h=(n.ins_h<f&&(d+=B[i++]<>>=w=y>>>24,f-=w,0==(w=255&y>>>16))E[a++]=65535&y;else{if(!(16&w)){if(0==(64&w)){y=p[(65535&y)+(d&(1<>>=w,f-=w),15>f&&(d+=B[i++]<>>=w=y>>>24,f-=w,!(16&(w=255&y>>>16))){if(0==(64&w)){y=m[(65535&y)+(d&(1<>>=w,f-=w,(w=a-o)>3,d&=(1<<(f-=x<<3))-1,e.next_in=i,e.next_out=a,e.avail_in=i>>24)+(65280&e>>>8)+((65280&e)<<8)+((255&e)<<24)}function r(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new f.Buf32(852),t.distcode=t.distdyn=new f.Buf32(592),t.sane=1,t.back=-1,0):-2}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):-2}function l(e,t){var n,i;return e&&e.state?(i=e.state,0>t?(n=0,t=-t):(n=1+(t>>4),48>t&&(t&=15)),t&&(8>t||15t;)e.lens[t++]=8;for(;256>t;)e.lens[t++]=9;for(;280>t;)e.lens[t++]=7;for(;288>t;)e.lens[t++]=8;for(g(1,e.lens,0,288,u,0,e.work,{bits:9}),t=0;32>t;)e.lens[t++]=5;g(2,e.lens,0,32,d,0,e.work,{bits:5}),y=!1}e.lencode=u,e.lenbits=9,e.distcode=d,e.distbits=5}function h(e,t,n,i){var r,a=e.state;return null===a.window&&(a.wsize=1<=a.wsize?(f.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i<(r=a.wsize-a.wnext)&&(r=i),f.arraySet(a.window,t,n-i,r,a.wnext),(i-=r)?(f.arraySet(a.window,t,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whavey;){if(0===A)break e;A--,d+=r[o++]<>>8,n.check=m(n.check,D,2,0),y=d=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&d)<<8)+(d>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&d)){e.msg="unknown compression method",n.mode=30;break}if(y-=4,L=8+(15&(d>>>=4)),0===n.wbits)n.wbits=L;else if(L>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<y;){if(0===A)break e;A--,d+=r[o++]<>8),512&n.flags&&(D[0]=255&d,D[1]=255&d>>>8,n.check=m(n.check,D,2,0)),y=d=0,n.mode=3;case 3:for(;32>y;){if(0===A)break e;A--,d+=r[o++]<>>8,D[2]=255&d>>>16,D[3]=255&d>>>24,n.check=m(n.check,D,4,0)),y=d=0,n.mode=4;case 4:for(;16>y;){if(0===A)break e;A--,d+=r[o++]<>8),512&n.flags&&(D[0]=255&d,D[1]=255&d>>>8,n.check=m(n.check,D,2,0)),y=d=0,n.mode=5;case 5:if(1024&n.flags){for(;16>y;){if(0===A)break e;A--,d+=r[o++]<>>8,n.check=m(n.check,D,2,0)),y=d=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(A<(b=n.length)&&(b=A),b&&(n.head&&(L=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),f.arraySet(n.head.extra,r,o,b,L)),512&n.flags&&(n.check=m(n.check,r,b,o)),A-=b,o+=b,n.length-=b),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===A)break e;for(b=0;L=r[o+b++],n.head&&L&&65536>n.length&&(n.head.name+=s(L)),L&&bn.length&&(n.head.comment+=s(L)),L&&by;){if(0===A)break e;A--,d+=r[o++]<>9,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;32>y;){if(0===A)break e;A--,d+=r[o++]<>>=7&y,y-=7&y,n.mode=27;break}for(;3>y;){if(0===A)break e;A--,d+=r[o++]<>>=1)){case 0:n.mode=14;break;case 1:if(c(n),n.mode=20,6!==t)break;d>>>=2,y-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}d>>>=2,y-=2;break;case 14:for(d>>>=7&y,y-=7&y;32>y;){if(0===A)break e;A--,d+=r[o++]<>>16)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&d,y=d=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(b=n.length){if(Ay;){if(0===A)break e;A--,d+=r[o++]<>>=5,y-=5,n.ndist=1+(31&d),d>>>=5,y-=5,n.ncode=4+(15&d),d>>>=4,y-=4,286y;){if(0===A)break e;A--,d+=r[o++]<>>=3,y-=3}for(;19>n.have;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,k={bits:n.lenbits},F=g(0,n.lens,0,19,n.lencode,0,n.work,k),n.lenbits=k.bits,F){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16,S=65535&U,!((B=U>>>24)<=y);){if(0===A)break e;A--,d+=r[o++]<S)d>>>=B,y-=B,n.lens[n.have++]=S;else{if(16===S){for(P=B+2;y>>=B,y-=B,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}L=n.lens[n.have-1],b=3+(3&d),d>>>=2,y-=2}else if(17===S){for(P=B+3;y>>=B)),d>>>=3,y-=3}else{for(P=B+7;y>>=B)),d>>>=7,y-=7}if(n.have+b>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;b--;)n.lens[n.have++]=L}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,k={bits:n.lenbits},F=g(1,n.lens,0,n.nlen,n.lencode,0,n.work,k),n.lenbits=k.bits,F){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,k={bits:n.distbits},F=g(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,k),n.distbits=k.bits,F){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=A&&258<=u){e.next_out=l,e.avail_out=u,e.next_in=o,e.avail_in=A,n.hold=d,n.bits=y,v(e,x),l=e.next_out,a=e.output,u=e.avail_out,o=e.next_in,r=e.input,A=e.avail_in,d=n.hold,y=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;E=255&(U=n.lencode[d&(1<>>16,S=65535&U,!((B=U>>>24)<=y);){if(0===A)break e;A--,d+=r[o++]<>T)])>>>16,S=65535&U,!(T+(B=U>>>24)<=y);){if(0===A)break e;A--,d+=r[o++]<>>=T,y-=T,n.back+=T}if(d>>>=B,y-=B,n.back+=B,n.length=S,0===E){n.mode=26;break}if(32&E){n.back=-1,n.mode=12;break}if(64&E){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&E,n.mode=22;case 22:if(n.extra){for(P=n.extra;y>>=n.extra,y-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;E=255&(U=n.distcode[d&(1<>>16,S=65535&U,!((B=U>>>24)<=y);){if(0===A)break e;A--,d+=r[o++]<>T)])>>>16,S=65535&U,!(T+(B=U>>>24)<=y);){if(0===A)break e;A--,d+=r[o++]<>>=T,y-=T,n.back+=T}if(d>>>=B,y-=B,n.back+=B,64&E){e.msg="invalid distance code",n.mode=30;break}n.offset=S,n.extra=15&E,n.mode=24;case 24:if(n.extra){for(P=n.extra;y>>=n.extra,y-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===u)break e;if(b=x-u,n.offset>b){if((b=n.offset-b)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}M=b>n.wnext?(b-=n.wnext,n.wsize-b):n.wnext-b,b>n.length&&(b=n.length),C=n.window}else C=a,M=l-n.offset,b=n.length;for(uy;){if(0===A)break e;A--,d|=r[o++]<y;){if(0===A)break e;A--,d+=r[o++]<n.mode&&(27>n.mode||4!==t))&&h(e,e.output,e.next_out,x-e.avail_out)?(n.mode=31,-4):(w-=e.avail_in,x-=e.avail_out,e.total_in+=w,e.total_out+=x,n.total+=x,n.wrap&&x&&(e.adler=n.check=n.flags?m(n.check,a,x,e.next_out-x):p(n.check,a,x,e.next_out-x)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==w&&0===x||4===t)&&0===F&&(F=-5),F)},n.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},n.inflateGetHeader=function(e,t){var n;return e&&e.state?0==(2&(n=e.state).wrap)?-2:((n.head=t).done=!1,0):-2},n.inflateSetDictionary=function(e,t){var n,i=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?-2:11===n.mode&&p(1,t,i,0)!==n.check?-3:h(e,t,i,i)?(n.mode=31,-4):(n.havedict=1,0):-2},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t){var n=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],r=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],o=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,s,l,A,c,h,u){var d,f,p,m,v,g,y,w,x,b=u.bits,M=0,C=0,B=0,E=0,S=0,T=0,_=0,I=0,L=0,F=0,k=null,P=0,U=new n.Buf16(16),D=new n.Buf16(16),R=null,O=0;for(M=0;15>=M;M++)U[M]=0;for(C=0;C=M;M++)if(I<<=1,0>(I-=U[M]))return-1;if(0M;M++)D[M+1]=D[M]+U[M];for(C=0;Cg?(w=R[O+h[C]],k[P+h[C]]):(w=96,0),d=1<>_)+(f-=d)]=y<<24|w<<16|x|0,0!==f;);for(d=1<>=1;if(0===d?F=0:(F&=d-1,F+=d),C++,0==--U[M]){if(M===E)break;M=t[s+h[C]]}if(S=(I-=U[T+_]));)T++,I<<=1;if(L+=1<e?T[e]:T[256+(e>>>7)]}function s(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=255&t>>>8}function l(e,t,n){e.bi_valid>16-n?(e.bi_buf|=65535&t<>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=65535&t<>>=1,n<<=1,0<--t;);return n>>>1}function h(e,t,n){var i,r,a=Array(16),o=0;for(i=1;i<=15;i++)a[i]=o=o+n[i-1]<<1;for(r=0;r<=t;r++){var s=e[2*r+1];0!==s&&(e[2*r]=c(a[s]++,s))}}function u(e){var t;for(t=0;286>t;t++)e.dyn_ltree[2*t]=0;for(t=0;30>t;t++)e.dyn_dtree[2*t]=0;for(t=0;19>t;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function d(e){8e.heap_len;)a[2*(r=e.heap[++e.heap_len]=2>A?++A:0)]=1,e.depth[r]=0,e.opt_len--,s&&(e.static_len-=o[2*r+1]);for(t.max_code=A,n=e.heap_len>>1;1<=n;n--)p(e,a,n);for(r=l;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],p(e,a,1),i=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=i,a[2*r]=a[2*n]+a[2*i],e.depth[r]=(e.depth[n]>=e.depth[i]?e.depth[n]:e.depth[i])+1,a[2*n+1]=a[2*i+1]=r,e.heap[1]=r++,p(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,i,r,a,o,s,l=t.dyn_tree,A=t.max_code,c=t.stat_desc.static_tree,h=t.stat_desc.has_stree,u=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,f=t.stat_desc.max_length,p=0;for(a=0;a<=15;a++)e.bl_count[a]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;573>n;n++)f<(a=l[2*l[2*(i=e.heap[n])+1]+1]+1)&&(a=f,p++),l[2*i+1]=a,A=s?e.bl_tree[34]++:e.bl_tree[36]++:(r!==a&&e.bl_tree[2*r]++,e.bl_tree[32]++),a=r,A=(s=0)===o?(l=138,3):r===o?(l=6,3):(l=7,4))}function y(e,t,n){var i,r,a=-1,o=t[1],s=0,c=7,h=4;for(0===o&&(c=138,h=3),i=0;i<=n;i++)if(r=o,o=t[2*(i+1)+1],!(++s=s?(A(e,17,e.bl_tree),l(e,s-3,3)):(A(e,18,e.bl_tree),l(e,s-11,7)):(r!==a&&(A(e,r,e.bl_tree),s--),A(e,16,e.bl_tree),l(e,s-3,2));a=r,h=(s=0)===o?(c=138,3):r===o?(c=6,3):(c=7,4)}}function w(e,t,n,i){var r,a,o;l(e,0+(i?1:0),3),a=t,o=n,d(r=e),s(r,o),s(r,~o),x.arraySet(r.pending_buf,r.window,a,o,r.pending),r.pending+=o}var x=e("../utils/common"),b=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],M=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],E=Array(576);i(E);var S=Array(60);i(S);var T=Array(512);i(T);var _=Array(256);i(_);var I=Array(29);i(I);var L,F,k,P=Array(30);i(P);var U=!1;n._tr_init=function(e){U||(function(){var e,t,n,i,a,o=Array(16);for(i=n=0;28>i;i++)for(I[i]=n,e=0;e<1<i;i++)for(P[i]=a,e=0;e<1<>=7;30>i;i++)for(P[i]=a<<7,e=0;e<1<=e;)E[2*e+1]=8,e++,o[8]++;for(;255>=e;)E[2*e+1]=9,e++,o[9]++;for(;279>=e;)E[2*e+1]=7,e++,o[7]++;for(;287>=e;)E[2*e+1]=8,e++,o[8]++;for(h(E,287,o),e=0;30>e;e++)S[2*e+1]=5,S[2*e]=c(e,5);L=new r(E,b,257,286,15),F=new r(S,M,0,30,15),k=new r([],C,0,19,7)}(),U=!0),e.l_desc=new a(e.dyn_ltree,L),e.d_desc=new a(e.dyn_dtree,F),e.bl_desc=new a(e.bl_tree,k),e.bi_buf=0,e.bi_valid=0,u(e)},n._tr_stored_block=w,n._tr_flush_block=function(e,t,n,i){var r,a,o=0;0=t;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;256>t;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),v(e,e.l_desc),v(e,e.d_desc),o=function(e){var t;for(g(e,e.dyn_ltree,e.l_desc.max_code),g(e,e.dyn_dtree,e.d_desc.max_code),v(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*B[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),r=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=r&&(r=a)):r=a=n+5,n+4<=r&&-1!==t?w(e,t,n,i):4===e.strategy||a===r?(l(e,2+(i?1:0),3),m(e,E,S)):(l(e,4+(i?1:0),3),function(e,t,n,i){var r;for(l(e,t-257,5),l(e,n-1,5),l(e,i-4,4),r=0;r>>8,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(_[n]+256+1)]++,e.dyn_dtree[2*o(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){var t;l(e,2,3),A(e,256,E),16===(t=e).bi_valid?(s(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t){t.exports="function"==typeof c?c:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}},{}]},{},[10])(10)}))}).call(this,void 0===o?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:o)},{}]},{},[1])(1)}))}).call(this,void 0===o?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:o)},{}]},{},[1])(1)}))}).call(this,void 0===o?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:o)},{}]},{},[1])(1)}))}).call(this,void 0===o?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:o)},{}]},{},[1])(1)}))}).call(this,void 0===o?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:o)},{}]},{},[1])(1)}))}).call(this)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,t("buffer").Buffer,t("timers").setImmediate)},{buffer:8,timers:22}],12:[function(e,t){function n(){}function i(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,e!==n&&l(this,e)}function a(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function o(e,t,n){c((function(){var i;try{i=t(n)}catch(t){return h.reject(e,t)}i===e?h.reject(e,new TypeError("Cannot resolve promise with itself")):h.resolve(e,i)}))}function s(e){var t=e&&e.then;if(e&&("object"==r(e)||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function l(e,t){function n(t){r||(r=!0,h.reject(e,t))}function i(t){r||(r=!0,h.resolve(e,t))}var r=!1,a=A((function(){t(i,n)}));"error"===a.status&&n(a.value)}function A(e,t){var n={};try{n.value=e(t),n.status="success"}catch(t){n.status="error",n.value=t}return n}var c=e("immediate"),h={},u=["REJECTED"],d=["FULFILLED"],f=["PENDING"];t.exports=i,i.prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){throw n}))}))},i.prototype.catch=function(e){return this.then(null,e)},i.prototype.then=function(e,t){if("function"!=typeof e&&this.state===d||"function"!=typeof t&&this.state===u)return this;var i=new this.constructor(n);this.state!==f?o(i,this.state===d?e:t,this.outcome):this.queue.push(new a(i,e,t));return i},a.prototype.callFulfilled=function(e){h.resolve(this.promise,e)},a.prototype.otherCallFulfilled=function(e){o(this.promise,this.onFulfilled,e)},a.prototype.callRejected=function(e){h.reject(this.promise,e)},a.prototype.otherCallRejected=function(e){o(this.promise,this.onRejected,e)},h.resolve=function(e,t){var n=A(s,t);if("error"===n.status)return h.reject(e,n.value);var i=n.value;if(i)l(e,i);else{e.state=d,e.outcome=t;for(var r=-1,a=e.queue.length;++r=this._max)&&(this._max=1/0),this._lengthCalculator=e.length||n,"function"!=typeof this._lengthCalculator&&(this._lengthCalculator=n),this._allowStale=e.stale||!1,this._maxAge=e.maxAge||null,this._dispose=e.dispose,void this.reset()):new a(e)}function o(e,t,n){i(t);var r=e._cache[t];return r&&(s(e,r)?(c(e,r),!e._allowStale&&(r=void 0)):n&&function(e,t){A(e,t),t.lu=e._mru++,e._lruList[t.lu]=t}(e,r),r&&(r=r.value)),r}function s(e,t){if(!t||!t.maxAge&&!e._maxAge)return!1;var n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e._maxAge&&n>e._maxAge}function l(e){for(;e._lrue._max;)c(e,e._lruList[e._lru])}function A(e,t){for(delete e._lruList[t.lu];e._lru=e)||(e=1/0),this._max=e,this._length>this._max&&l(this)},get:function(){return this._max},enumerable:!0}),Object.defineProperty(a.prototype,"lengthCalculator",{set:function(e){if("function"!=typeof e)for(var t in this._lengthCalculator=n,this._length=this._itemCount,this._cache)this._cache[t].length=1;else for(var t in this._lengthCalculator=e,this._length=0,this._cache)this._cache[t].length=this._lengthCalculator(this._cache[t].value),this._length+=this._cache[t].length;this._length>this._max&&l(this)},get:function(){return this._lengthCalculator},enumerable:!0}),Object.defineProperty(a.prototype,"length",{get:function(){return this._length},enumerable:!0}),Object.defineProperty(a.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!0}),a.prototype.forEach=function(e,t){t=t||this;for(var n=0,i=this._itemCount,r=this._mru-1;0<=r&&nthis._max?(c(this,this._cache[t]),!1):(this._dispose&&this._dispose(t,this._cache[t].value),this._cache[t].now=a,this._cache[t].maxAge=r,this._cache[t].value=n,this._length+=o-this._cache[t].length,this._cache[t].length=o,this.get(t),this._length>this._max&&l(this),!0);var s=new h(t,n,this._mru++,o,a,r);return s.length>this._max?(this._dispose&&this._dispose(t,n),!1):(this._length+=s.length,this._lruList[s.lu]=this._cache[t]=s,this._itemCount++,this._length>this._max&&l(this),!0)},a.prototype.has=function(t){return i(t),!!e(this._cache,t)&&!s(this,this._cache[t])},a.prototype.get=function(e){return i(e),o(this,e,!0)},a.prototype.peek=function(e){return i(e),o(this,e,!1)},a.prototype.pop=function(){var e=this._lruList[this._lru];return c(this,e),e||null},a.prototype.del=function(e){i(e),c(this,this._cache[e])},a.prototype.load=function(e){this.reset();for(var t,n=Date.now(),r=e.length-1;0<=r;r--){i((t=e[r]).k);var a=t.e||0;if(0===a)this.set(t.k,t.v);else{var o=a-n;0-1.001*ce)s=-ce;else if(s>ce&&s<1.001*ce)s=ce;else{if(s<-ce)return{x:-1/0,y:-1/0,z:e.z};if(s>ce)return{x:1/0,y:1/0,z:e.z}}return o>u&&(o-=2*u),r=m(s),a=v(s),{x:((i=n/g(1-t*(r*r)))+l)*a*v(o),y:(i+l)*a*m(o),z:(i*(1-t)+l)*r}}function O(e,t,i,r){var a,o,s,l,A,h,u,f,p,m,v,y,w,x,b,M=1e-12,C=e.x,B=e.y,E=e.z?e.z:0;if(a=g(C*C+B*B),o=g(C*C+B*B+E*E),a/iM*M&&w<30);return{x:x,y:d(v/n(m)),z:b}}function N(e){return 1===e||2===e}function z(e,t,i){if(null===e.grids||0===e.grids.length)return console.log("Grid shift grids not found"),-1;for(var r,a={x:-i.x,y:i.y},o={x:A,y:A},s=[],l=0;la.y||u>a.x||p1e-12&&n(s.y)>1e-12);if(0>c)return console.log("Inverse grid shift iterator failed to converge."),r;r.x=ke(o.x+i.ll[0]),r.y=o.y+i.ll[1]}else isNaN(o.x)||(r.x=e.x+o.x,r.y=e.y+o.y);return r}function G(t,n){var i,r={x:t.x/n.del[0],y:t.y/n.del[1]},a=e(r.x),o=e(r.y),s=r.x-1*a,l=r.y-1*o,c={x:A,y:A};if(0>a||a>=n.lim[0])return c;if(0>o||o>=n.lim[1])return c;i=o*n.lim[0]+a;var h=n.cvs[i][0],u=n.cvs[i][1];i++;var d=n.cvs[i][0],f=n.cvs[i][1];i+=n.lim[0];var p=n.cvs[i][0],m=n.cvs[i][1];i--;var v=n.cvs[i][0],g=n.cvs[i][1],y=s*l,w=s*(1-l),x=(1-s)*(1-l),b=(1-s)*l;return c.x=x*h+w*d+b*v+y*p,c.y=x*u+w*f+b*g+y*m,c}function H(e){var t=Number.isFinite;if("function"==typeof t){if(t(e))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof e||e!=e||!isFinite(e))throw new TypeError("coordinates must be finite numbers")}function V(e,t,n){var i;if(Array.isArray(n)&&(n=je(n)),We(n),e.datum&&t.datum&&function(e,t){return(1===e.datum.datum_type||2===e.datum.datum_type)&&"WGS84"!==t.datumCode||(1===t.datum.datum_type||2===t.datum.datum_type)&&"WGS84"!==e.datumCode}(e,t)&&(n=V(e,i=new U("WGS84"),n),e=i),"enu"!==e.axis&&(n=Ve(e,!1,n)),"longlat"===e.projName)n={x:n.x*pe,y:n.y*pe,z:n.z||0};else if(e.to_meter&&(n={x:n.x*e.to_meter,y:n.y*e.to_meter,z:n.z||0}),!(n=e.inverse(n)))return;return e.from_greenwich&&(n.x+=e.from_greenwich),(n=He(e.datum,t.datum,n))?(t.from_greenwich&&(n={x:n.x-t.from_greenwich,y:n.y,z:n.z||0}),"longlat"===t.projName?n={x:n.x*me,y:n.y*me,z:n.z||0}:(n=t.forward(n),t.to_meter&&(n={x:n.x/t.to_meter,y:n.y/t.to_meter,z:n.z||0})),"enu"===t.axis?n:Ve(t,!0,n)):void 0}function j(e,t,n){var i,r,a;return Array.isArray(n)?(i=V(e,t,n)||{x:NaN,y:NaN},2l&&3<=A&&12>A&&(s=32),72<=l&&84>l&&(0<=A&&9>A?s=31:9<=A&&21>A?s=33:21<=A&&33>A?s=35:33<=A&&42>A&&(s=37)),n=u/(1-u),i=c/g(1-u*m(f)*m(f)),r=p(f)*p(f),a=n*v(f)*v(f),o=c*((1-u/4-3*u*u/64-5*u*u*u/256)*f-(3*u/8+3*u*u/32+45*u*u*u/1024)*m(2*f)+(15*u*u/256+45*u*u*u/1024)*m(4*f)-35*u*u*u/3072*m(6*f));var y=d*i*(65+65*(1-r+a)*65*65/6+65*(5-18*r+r*r+72*a-58*n)*65*65*65*65/120)+5e5,w=d*(o+i*p(f)*(2112.5+65*(5-r+9*a+4*a*a)*65*65*65/24+65*(61-58*r+r*r+600*a-330*n)*65*65*65*65*65/720));return 0>l&&(w+=1e7),{northing:h(w),easting:h(y),zoneNumber:s,zoneLetter:$(l)}}({lat:t[1],lon:t[0]}),n)}function K(e){var t=q(ne(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function Z(e){return e*(u/180)}function J(e){return e/u*180}function q(e){var t=e.northing,n=e.easting,i=e.zoneLetter,r=e.zoneNumber;if(0>r||60i&&(M-=1e7),u=6*(r-1)-180+3,o=x/(1-x),f=(d=M/y/6367449.145945056)+(3*b/2-27*b*b*b/32)*m(2*d)+(21*b*b/16-55*b*b*b*b/32)*m(4*d)+151*b*b*b/96*m(6*d),s=w/g(1-x*m(f)*m(f)),l=p(f)*p(f),A=o*v(f)*v(f),c=w*(1-x)/a(1-x*m(f)*m(f),1.5),h=(n-5e5)/(s*y);var C=f-s*p(f)/c*(h*h/2-(5+3*l+10*A-4*A*A-9*o)*h*h*h*h/24+(61+90*l+298*A+45*l*l-252*o-3*A*A)*h*h*h*h*h*h/720);C=J(C);var B,E=(h-(1+2*l+A)*h*h*h/6+(5-2*A+28*l-3*A*A+8*o+24*l*l)*h*h*h*h*h/120)/v(f);if(E=u+J(E),e.accuracy){var S=q({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});B={top:S.lat,right:S.lon,bottom:C,left:E}}else B={lat:C,lon:E};return B}function $(e){var t="Z";return 84>=e&&72<=e?t="X":72>e&&64<=e?t="W":64>e&&56<=e?t="V":56>e&&48<=e?t="U":48>e&&40<=e?t="T":40>e&&32<=e?t="S":32>e&&24<=e?t="R":24>e&&16<=e?t="Q":16>e&&8<=e?t="P":8>e&&0<=e?t="N":0>e&&-8<=e?t="M":-8>e&&-16<=e?t="L":-16>e&&-24<=e?t="K":-24>e&&-32<=e?t="J":-32>e&&-40<=e?t="H":-40>e&&-48<=e?t="G":-48>e&&-56<=e?t="F":-56>e&&-64<=e?t="E":-64>e&&-72<=e?t="D":-72>e&&-80<=e&&(t="C"),t}function ee(t,n,i){var r=te(i);return function(e,t,n){var i=n-1,r="AJSAJS".charCodeAt(i),a="AFAFAF".charCodeAt(i),o=r+e-1,l=a+t,A=!1;return 90r&&73r)&&A)&&o++,(79===o||79>r&&79r)&&A)&&73==++o&&o++,90a&&73a)&&A)&&l++,(79===l||79>a&&79a)&&A)&&73==++l&&l++,86n)throw"MGRSPoint bad conversion from: "+e;var l=e.charAt(o++);if("A">=l||"B"===l||"Y"===l||"Z"<=l||"I"===l||"O"===l)throw"MGRSPoint zone letter "+l+" not handled: "+e;i=e.substring(o,o+=2);for(var A=te(s),c=function(e,t){for(var n="AJSAJS".charCodeAt(t-1),i=1e5,r=!1;n!==e.charCodeAt(0);){if(73===++n&&n++,79===n&&n++,90ve&&a<=ce+ve?(r.value=tn.AREA_1,a-=ce):a>ce+ve||a<=-(ce+ve)?(r.value=tn.AREA_2,a=0<=a?a-ye:a+ye):(r.value=tn.AREA_3,a+=ce)),a}function oe(e,t){var n=e+t;return n<-ye?n+=ge:n>+ye&&(n-=ge),n}var se=6378137,le=.0066943799901413165,Ae=484813681109536e-20,ce=u/2,he=.16666666666666666,ue=.04722222222222222,de=.022156084656084655,fe=1e-10,pe=.017453292519943295,me=57.29577951308232,ve=u/4,ge=2*u,ye=3.14159265359,we={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},xe={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},be=/[\s_\-\/\(\)]/g,Me=function(e){var t,n,i,r={},a=e.split("+").map((function(e){return e.trim()})).filter((function(e){return e})).reduce((function(e,t){var n=t.split("=");return n.push(!0),e[n[0].toLowerCase()]=n[1],e}),{}),o={proj:"projName",datum:"datumCode",rf:function(e){r.rf=parseFloat(e)},lat_0:function(e){r.lat0=e*pe},lat_1:function(e){r.lat1=e*pe},lat_2:function(e){r.lat2=e*pe},lat_ts:function(e){r.lat_ts=e*pe},lon_0:function(e){r.long0=e*pe},lon_1:function(e){r.long1=e*pe},lon_2:function(e){r.long2=e*pe},alpha:function(e){r.alpha=parseFloat(e)*pe},gamma:function(e){r.rectified_grid_angle=parseFloat(e)},lonc:function(e){r.longc=e*pe},x_0:function(e){r.x0=parseFloat(e)},y_0:function(e){r.y0=parseFloat(e)},k_0:function(e){r.k0=parseFloat(e)},k:function(e){r.k0=parseFloat(e)},a:function(e){r.a=parseFloat(e)},b:function(e){r.b=parseFloat(e)},r_a:function(){r.R_A=!0},zone:function(e){r.zone=parseInt(e,10)},south:function(){r.utmSouth=!0},towgs84:function(e){r.datum_params=e.split(",").map((function(e){return parseFloat(e)}))},to_meter:function(e){r.to_meter=parseFloat(e)},units:function(e){r.units=e;var t=y(xe,e);t&&(r.to_meter=t.to_meter)},from_greenwich:function(e){r.from_greenwich=e*pe},pm:function(e){var t=y(we,e);r.from_greenwich=(t||parseFloat(e))*pe},nadgrids:function(e){"@null"===e?r.datumCode="none":r.nadgrids=e},axis:function(e){3===e.length&&-1!=="ewnsud".indexOf(e.substr(0,1))&&-1!=="ewnsud".indexOf(e.substr(1,1))&&-1!=="ewnsud".indexOf(e.substr(2,1))&&(r.axis=e)},approx:function(){r.approx=!0}};for(t in a)n=a[t],t in o?"function"==typeof(i=o[t])?i(n):r[i]=n:r[t]=n;return"string"==typeof r.datumCode&&"WGS84"!==r.datumCode&&(r.datumCode=r.datumCode.toLowerCase()),r},Ce=/[,\]]/,Be=/[\d\.E\-\+]/;w.prototype.readCharicter=function(){var e=this.text[this.place++];if(4!==this.state)for(;/\s/.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case 1:return this.neutral(e);case 2:return this.keyword(e);case 4:return this.quoted(e);case 5:return this.afterquote(e);case 3:return this.number(e)}},w.prototype.afterquote=function(e){if('"'===e)return this.word+='"',void(this.state=4);if(Ce.test(e))return this.word=this.word.trim(),void this.afterItem(e);throw new Error("havn't handled \""+e+'" in afterquote yet, index '+this.place)},w.prototype.afterItem=function(e){return","===e?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===e?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},w.prototype.number=function(e){if(!Be.test(e)){if(Ce.test(e))return this.word=parseFloat(this.word),void this.afterItem(e);throw new Error("havn't handled \""+e+'" in number yet, index '+this.place)}this.word+=e},w.prototype.quoted=function(e){return'"'===e?void(this.state=5):void(this.word+=e)},w.prototype.keyword=function(e){if(/[A-Za-z84]/.test(e))this.word+=e;else{if("["===e){var t=[];return t.push(this.word),this.level++,null===this.root?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,void(this.state=1)}if(!Ce.test(e))throw new Error("havn't handled \""+e+'" in keyword yet, index '+this.place);this.afterItem(e)}},w.prototype.neutral=function(e){if(/[A-Za-z]/.test(e))return this.word=e,void(this.state=2);if('"'===e)return this.word="",void(this.state=4);if(Be.test(e))return this.word=e,void(this.state=3);if(!Ce.test(e))throw new Error("havn't handled \""+e+'" in neutral yet, index '+this.place);this.afterItem(e)},w.prototype.output=function(){for(;this.placee?-1:1},ke=function(e){return n(e)<=ye?e:e-Fe(e)*ge},Pe=function(e,t,n){var i=e*n;return i=a((1-i)/(1+i),.5*e),p(.5*(ce-t))/i},Ue=function(e,t){for(var i,r,o=ce-2*d(t),s=0;15>=s;s++)if(i=e*m(o),o+=r=ce-2*d(t*a((1-i)/(1+i),.5*e))-o,1e-10>=n(r))return o;return-9999},De=[{init:function(){var e=this.b/this.a;this.es=1-e*e,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=g(this.es),this.lat_ts?this.sphere?this.k0=v(this.lat_ts):this.k0=Le(this.e,m(this.lat_ts),v(this.lat_ts)):!this.k0&&(this.k?this.k0=this.k:this.k0=1)},forward:function(e){var i,r,a=e.x,o=e.y;if(90o*me&&180a*me)return null;if(n(n(o)-ce)<=fe)return null;if(this.sphere)i=this.x0+this.a*this.k0*ke(a-this.long0),r=this.y0+this.a*this.k0*t(p(ve+.5*o));else{var s=m(o),l=Pe(this.e,o,s);i=this.x0+this.a*this.k0*ke(a-this.long0),r=this.y0-this.a*this.k0*t(l)}return e.x=i,e.y=r,e},inverse:function(e){var t,n,i=e.x-this.x0,r=e.y-this.y0;if(this.sphere)n=ce-2*d(f(-r/(this.a*this.k0)));else{var a=f(-r/(this.a*this.k0));if(-9999===(n=Ue(this.e,a)))return null}return t=ke(this.long0+i/(this.a*this.k0)),e.x=t,e.y=n,e},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:E,inverse:E,names:["longlat","identity"]}],Re={},Oe=[],Ne={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},ze=Ne.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Ne.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var Qe={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"}},Ge={};U.projections={start:function(){De.forEach(S)},add:S,get:function(e){if(!e)return!1;var t=e.toLowerCase();return void 0!==Re[t]&&Oe[Re[t]]?Oe[Re[t]]:void 0}},U.projections.start();var He=function(e,t,n){if(D(e,t))return n;if(5===e.datum_type||5===t.datum_type)return n;var i=e.a,r=e.es;if(3===e.datum_type){if(0!==z(e,!1,n))return;i=se,r=le}var a=t.a,o=t.b,s=t.es;if(3===t.datum_type&&(a=se,o=6356752.314,s=le),r===s&&i===a&&!N(e.datum_type)&&!N(t.datum_type))return n;if((n=R(n,r,i),N(e.datum_type)&&(n=function(e,t,n){if(1===t)return{x:e.x+n[0],y:e.y+n[1],z:e.z+n[2]};if(2===t){var i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],A=n[6];return{x:A*(e.x-l*e.y+s*e.z)+i,y:A*(l*e.x+e.y-o*e.z)+r,z:A*(-s*e.x+o*e.y+e.z)+a}}}(n,e.datum_type,e.datum_params)),N(t.datum_type)&&(n=function(e,t,n){if(1===t)return{x:e.x-n[0],y:e.y-n[1],z:e.z-n[2]};if(2===t){var i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],A=n[6],c=(e.x-i)/A,h=(e.y-r)/A,u=(e.z-a)/A;return{x:c+l*h-s*u,y:-l*c+h+o*u,z:s*c-o*h+u}}}(n,t.datum_type,t.datum_params)),n=O(n,s,a,o),3===t.datum_type)&&0!==z(t,!0,n))return;return n},Ve=function(e,t,n){var i,r,a,o=n.x,s=n.y,l=n.z||0,A={};for(a=0;3>a;a++)if(!t||2!==a||void 0!==n.z)switch(0===a?(i=o,r=-1==="ew".indexOf(e.axis[a])?"y":"x"):1===a?(i=s,r=-1==="ns".indexOf(e.axis[a])?"x":"y"):(i=l,r="z"),e.axis[a]){case"e":case"n":A[r]=i;break;case"w":case"s":A[r]=-i;break;case"u":void 0!==n[r]&&(A.z=i);break;case"d":void 0!==n[r]&&(A.z=-i);break;default:return null}return A},je=function(e){var t={x:e[0],y:e[1]};return 2fe?p(A):0,b=a(x,2),M=a(b,2);i=1-this.es*a(h,2),d/=g(i);var C=qe(A,h,u,this.en);r=this.a*(this.k0*d*(1+f/6*(1-b+y+f/20*(5-18*b+M+14*y-58*b*y+f/42*(61+179*M-M*b-479*b)))))+this.x0,s=this.a*(this.k0*(C-this.ml0+h*c*d/2*(1+f/12*(5-b+9*y+4*w+f/30*(61+M-58*b+270*y-330*b*y+f/56*(1385+543*M-M*b-3111*b))))))+this.y0}else{var B=u*m(c);if(n(n(B)-1)fe)return 93;s=0}else s=o(s);0>A&&(s=-s),s=this.a*this.k0*(s-this.lat0)+this.y0}return e.x=r,e.y=s,e},inverse:function(e){var t,r,o,s,l=(e.x-this.x0)*(1/this.a),A=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+A/this.k0,r=$e(t,this.es,this.en),n(r)fe?p(r):0,y=this.ep2*a(u,2),w=a(y,2),x=a(d,2),b=a(x,2);t=1-this.es*a(h,2);var M=l*g(t)/this.k0,C=a(M,2);o=r-(t*=d)*C/(1-this.es)*.5*(1-C/12*(5+3*x-9*y*x+y-4*w-C/30*(61+90*x-252*y*x+45*b+46*y-C/56*(1385+3633*x+4095*b+1574*b*x)))),s=ke(this.long0+M*(1-C/6*(1+2*x+y-C/20*(5+28*x+24*b+8*y*x+6*y-C/42*(61+662*x+1320*b+720*b*x))))/u)}else o=ce*Fe(A),s=0;else{var B=f(l/this.k0),E=.5*(B-1/B),S=this.lat0+A/this.k0,T=v(S);t=g((1-a(T,2))/(1+a(E,2))),o=i(t),0>A&&(o=-o),s=0===E&&0===T?0:ke(c(E,T)+this.long0)}return e.x=s,e.y=o,e},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]},tt=function(e){var t=f(e);return t=(t-1/t)/2},nt=function(e,t){var i=(0,Math.max)(e=n(e),t=n(t)),r=l(e,t)/(i||1);return i*g(1+a(r,2))},it=function(e){var i=n(e);return i=function(e){var n=1+e,i=n-1;return 0===i?e:e*t(n)/i}(i*(1+i/(nt(1,i)+1))),0>e?-i:i},rt=function(e,t){for(var n,i=2*v(2*t),r=e.length-1,a=e[r],o=0;0<=--r;)n=i*a-o+e[r],o=a,a=n;return t+n*m(2*t)},at=function(e){var t=f(e);return t=(t+1/t)/2},ot=function(e,t,n){for(var i,r,a=m(t),o=v(t),s=tt(n),l=at(n),A=2*o*l,c=-2*a*s,h=e.length-1,u=e[h],d=0,f=0,p=0;0<=--h;)i=f,r=d,u=A*(f=u)-i-c*(d=p)+e[h],p=c*f-r+A*d;return[(A=a*l)*u-(c=o*s)*p,A*p+c*u]},st={init:function(){if(!this.approx&&(isNaN(this.es)||0>=this.es))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(et.init.apply(this),this.forward=et.forward,this.inverse=et.inverse),this.x0=void 0===this.x0?0:this.x0,this.y0=void 0===this.y0?0:this.y0,this.long0=void 0===this.long0?0:this.long0,this.lat0=void 0===this.lat0?0:this.lat0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+g(1-this.es)),t=e/(2-e),n=t;this.cgb[0]=t*(2+t*(-2/3+t*(t*(116/45+t*(26/45+t*(-2854/675)))-2))),this.cbg[0]=t*(t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))-2),n*=t,this.cgb[1]=n*(7/3+t*(t*(-227/45+t*(2704/315+t*(2323/945)))-1.6)),this.cbg[1]=n*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),n*=t,this.cgb[2]=n*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=n*(-26/15+t*(34/21+t*(1.6+t*(-12686/2835)))),n*=t,this.cgb[3]=n*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=n*(1237/630+t*(t*(-24832/14175)-2.4)),n*=t,this.cgb[4]=n*(4174/315+t*(-144838/6237)),this.cbg[4]=n*(-734/315+t*(109598/31185)),n*=t,this.cgb[5]=n*(601676/22275),this.cbg[5]=n*(444337/155925),n=a(t,2),this.Qn=this.k0/(1+t)*(1+n*(1/4+n*(1/64+n/256))),this.utg[0]=t*(t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))-.5),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=n*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=n*(13/48+t*(t*(557/1440+t*(281/630+t*(-1983433/1935360)))-.6)),n*=t,this.utg[2]=n*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=n*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),n*=t,this.utg[3]=n*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=n*(49561/161280+t*(-179/168+t*(6601661/7257600))),n*=t,this.utg[4]=n*(-4583/161280+t*(108847/3991680)),this.gtu[4]=n*(34729/80640+t*(-3418889/1995840)),n*=t,this.utg[5]=n*(-20648693/638668800),this.gtu[5]=.6650675310896665*n;var i=rt(this.cbg,this.lat0);this.Zb=-this.Qn*(i+function(e,t){for(var n,i=2*v(t),r=e.length-1,a=e[r],o=0;0<=--r;)n=i*a-o+e[r],o=a,a=n;return m(t)*n}(this.gtu,2*i))},forward:function(e){var t=ke(e.x-this.long0),i=e.y;i=rt(this.cbg,i);var r=m(i),a=v(i),o=m(t),s=v(t);i=c(r,s*a),t=c(o*a,nt(r,a*s)),t=it(p(t));var l,A,h=ot(this.gtu,2*i,2*t);return i+=h[0],t+=h[1],2.623395162778>=n(t)?(l=this.a*(this.Qn*t)+this.x0,A=this.a*(this.Qn*i+this.Zb)+this.y0):(l=1/0,A=1/0),e.x=l,e.y=A,e},inverse:function(e){var t,i,r=(e.x-this.x0)*(1/this.a),a=(e.y-this.y0)*(1/this.a);if(a=(a-this.Zb)/this.Qn,r/=this.Qn,2.623395162778>=n(r)){var o=ot(this.utg,2*a,2*r);a+=o[0],r+=o[1],r=d(tt(r));var s=m(a),l=v(a),A=m(r),h=v(r);a=c(s*h,nt(A,h*l)),r=c(A,h*l),t=ke(r+this.long0),i=rt(this.cgb,a)}else t=1/0,i=1/0;return e.x=t,e.y=i,e},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"]},lt={init:function(){var t=function(t,n){if(void 0===t){if(0>(t=e(30*(ke(n)+u)/u)+1))return 0;if(60fe?(u=m(this.lat0),s=v(this.lat0),e=1-this.es*u*u,this.B=s*s,this.B=g(1+this.es*this.B*this.B/L),this.A=this.B*this.k0*o/e,0>=(A=(l=this.B*o/(s*g(e)))*l-1)?A=0:(A=g(A),0>this.lat0&&(A=-A)),this.E=A+=l,this.E*=a(Pe(this.e,this.lat0,u),this.B)):(this.B=1/o,this.A=this.k0,this.E=l=A=1),_||I?(_?(w=i(m(T)/l),!I&&(b=T)):T=i(l*m(w=b)),this.lam0=M-i(.5*(A-1/A)*p(w))/this.B):(c=a(Pe(this.e,E,m(E)),this.B),h=a(Pe(this.e,S,m(S)),this.B),A=this.E/c,f=(h-c)/(h+c),y=((y=this.E*this.E)-h*c)/(y+h*c),(e=C-B)<-x?B-=ge:e>x&&(B+=ge),this.lam0=ke(.5*(C+B)-d(y*p(.5*this.B*(C-B))/f)/this.B),w=d(2*m(this.B*ke(C-this.lam0))/(A-1/A)),b=T=i(l*m(w))),this.singam=m(w),this.cosgam=v(w),this.sinrot=m(b),this.cosrot=v(b),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=n(this.ArB*d(g(l*l-1)/v(T))),0>this.lat0&&(this.u_0=-this.u_0)),A=.5*w,this.v_pole_n=this.ArB*t(p(ve-A)),this.v_pole_s=this.ArB*t(p(ve+A))},forward:function(e){var i,r,o,s,l,A,h,u={};if(e.x-=this.lam0,n(n(e.y)-ce)>fe){if(i=.5*((s=this.E/a(Pe(this.e,e.y,m(e.y)),this.B))-(l=1/s)),r=.5*(s+l),m(this.B*e.x),o=(i*this.singam-86*this.cosgam)/r,n(n(o)-1)A?-ce:ce;else{if(h.y=this.E/g((1+A)/(1-A)),h.y=Ue(this.e,a(h.y,1/this.B)),h.y===1/0)throw new Error;h.x=-this.rB*c(o*this.cosgam-l*this.singam,v(this.BrA*t))}return h.x+=this.lam0,h},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"]},mt={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(n(this.lat1+this.lat2)fe?t(o/c)/t(s/h):i,isNaN(this.ns)&&(this.ns=i),this.f0=o/(this.ns*a(s,this.ns)),this.rh=this.a*this.f0*a(u,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(e){var t=e.x,i=e.y;n(2*n(i)-u)<=fe&&(i=Fe(i)*(ce-2*fe));var r,o,s=n(n(i)-ce);if(s>fe)r=Pe(this.e,i,m(i)),o=this.a*this.f0*a(r,this.ns);else{if(0>=(s=i*this.ns))return null;o=0}var l=this.ns*ke(t-this.long0);return e.x=this.k0*(o*m(l))+this.x0,e.y=this.k0*(this.rh-o*v(l))+this.y0,e},inverse:function(e){var t,n,i,r,o,s=(e.x-this.x0)/this.k0,l=this.rh-(e.y-this.y0)/this.k0;0n(A-e.y)&&(h=1),A=e.y,f+=1}while(0===h&&15>f);return 15<=f?null:e},names:["Krovak","krovak"]},gt=function(e,t,n,i,r){return e*r-t*m(2*r)+n*m(4*r)-i*m(6*r)},yt=function(e){return 1-.25*e*(1+e/16*(3+1.25*e))},wt=function(e){return.375*e*(1+.25*e*(1+.46875*e))},xt=function(e){return.05859375*e*e*(1+.75*e)},bt=function(e){return e*e*e*(35/3072)},Mt=function(e,t,n){var i=t*n;return e/g(1-i*i)},Ct=function(e){return n(e)l;l++)if(o+=s=(e-(t*o-i*m(2*o)+r*m(4*o)-a*m(6*o)))/(t-2*i*v(2*o)+4*r*v(4*o)-6*a*v(6*o)),1e-10>=n(s))return o;return NaN},Et={init:function(){this.sphere||(this.e0=yt(this.es),this.e1=wt(this.es),this.e2=xt(this.es),this.e3=bt(this.es),this.ml0=this.a*gt(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(e){var t,n,r=e.x,a=e.y;if(r=ke(r-this.long0),this.sphere)t=this.a*i(v(a)*m(r)),n=this.a*(c(p(a),v(r))-this.lat0);else{var o=m(a),s=v(a),l=Mt(this.a,this.e,o),A=p(a)*p(a),h=r*v(a),u=h*h,d=this.es*s*s/(1-this.es);t=l*h*(1-u*A*(1/6-(8-A+8*d)*u/120)),n=this.a*gt(this.e0,this.e1,this.e2,this.e3,a)-this.ml0+l*o/s*u*(.5+(5-A+6*d)*u/24)}return e.x=t+this.x0,e.y=n+this.y0,e},inverse:function(e){e.x-=this.x0,e.y-=this.y0;var t,r,o=e.x/this.a,s=e.y/this.a;if(this.sphere){var l=s+this.lat0;t=i(m(l)*v(o)),r=c(p(o),v(l))}else{var A=this.ml0/this.a+s,h=Bt(A,this.e0,this.e1,this.e2,this.e3);if(n(n(h)-ce)<=fe)return e.x=this.long0,e.y=ce,0>s&&(e.y*=-1),e;var u=Mt(this.a,this.e,m(h)),d=u*u*u/this.a/this.a*(1-this.es),f=a(p(h),2),g=o*this.a/u,y=g*g;t=h-u*p(h)/d*g*g*(.5-(1+3*f)*g*g/24),r=g*(1-y*(f/3+(1+3*f)*f*y/15))/v(h)}return e.x=ke(r+this.long0),e.y=Ct(t),e},names:["Cassini","Cassini_Soldner","cass"]},St=function(e,n){var i;return 1e-7this.lat0?this.S_POLE:this.N_POLE:n(t)fe?(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*g(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(e){var t=e.x,n=e.y;this.sin_phi=m(n),this.cos_phi=v(n);var i=St(this.e3,this.sin_phi,this.cos_phi),r=this.a*g(this.c-this.ns0*i)/this.ns0,a=this.ns0*ke(t-this.long0),o=r*m(a)+this.x0,s=this.rh-r*v(a)+this.y0;return e.x=o,e.y=s,e},inverse:function(e){var t,n,r,a,o,s;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,0<=this.ns0?(t=g(e.x*e.x+e.y*e.y),r=1):(t=-g(e.x*e.x+e.y*e.y),r=-1),a=0,0!==t&&(a=c(r*e.x,r*e.y)),r=t*this.ns0/this.a,this.sphere?s=i((this.c-r*r)/(2*this.ns0)):(n=(this.c-r*r)/this.ns0,s=this.phi1z(this.e3,n)),o=ke(a/this.ns0+this.long0),e.x=o,e.y=s,e},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(e,i){var r,a,o,s,l=Ut(.5*i);if(e=A;A++)if(l+=s=.5*(o=1-(a=e*(r=m(l)))*a)*o/v(l)*(i/(1-e*e)-r/o+.5/e*t((1-a)/(1+a))),1e-7>=n(s))return l;return null}},Rt={init:function(){this.sin_p14=m(this.lat0),this.cos_p14=v(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(e){var t,i,r,a,o,s,l,A=e.x,c=e.y;return r=ke(A-this.long0),t=m(c),i=v(c),a=v(r),1,0<(o=this.sin_p14*t+this.cos_p14*i*a)||n(o)<=fe?(s=this.x0+1*this.a*i*m(r)/o,l=this.y0+1*this.a*(this.cos_p14*t-this.sin_p14*i*a)/o):(s=this.x0+this.infinity_dist*i*m(r),l=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*i*a)),e.x=s,e.y=l,e},inverse:function(e){var t,n,i,r,a,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=g(e.x*e.x+e.y*e.y))?(r=c(t,this.rc),n=m(r),i=v(r),o=Ut(i*this.sin_p14+e.y*n*this.cos_p14/t),a=c(e.x*n,t*this.cos_p14*i-e.y*this.sin_p14*n),a=ke(this.long0+a)):(o=this.phic0,a=0),e.x=a,e.y=o,e},names:["gnom"]},Ot={init:function(){this.sphere||(this.k0=Le(this.e,m(this.lat_ts),v(this.lat_ts)))},forward:function(e){var t,n,i=e.x,r=e.y,a=ke(i-this.long0);if(this.sphere)t=this.x0+this.a*a*v(this.lat_ts),n=this.y0+this.a*m(r)/v(this.lat_ts);else{var o=St(this.e,m(r));t=this.x0+this.a*this.k0*a,n=this.y0+this.a*o*.5/this.k0}return e.x=t,e.y=n,e},inverse:function(e){var r,o;return e.x-=this.x0,e.y-=this.y0,this.sphere?(r=ke(this.long0+e.x/this.a/v(this.lat_ts)),o=i(e.y/this.a*v(this.lat_ts))):(o=function(e,r){var o=1-(1-e*e)/(2*e)*t((1-e)/(1+e));if(1e-6>n(n(r)-o))return 0>r?-1*ce:ce;for(var s,l,A,c,h=i(.5*r),u=0;30>u;u++)if(l=m(h),A=v(h),h+=s=a(1-(c=e*l)*c,2)/(2*A)*(r/(1-e*e)-l/(1-c*c)+.5/e*t((1-c)/(1+c))),1e-10>=n(s))return h;return NaN}(this.e,2*e.y*this.k0/this.a),r=ke(this.long0+e.x/(this.a*this.k0))),e.x=r,e.y=o,e},names:["cea"]},Nt={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=v(this.lat_ts)},forward:function(e){var t=e.x,n=e.y,i=ke(t-this.long0),r=Ct(n-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*r,e},inverse:function(e){var t=e.x,n=e.y;return e.x=ke(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=Ct(this.lat0+(n-this.y0)/this.a),e},names:["Equirectangular","Equidistant_Cylindrical","eqc"]},zt={init:function(){this.temp=this.b/this.a,this.es=1-a(this.temp,2),this.e=g(this.es),this.e0=yt(this.es),this.e1=wt(this.es),this.e2=xt(this.es),this.e3=bt(this.es),this.ml0=this.a*gt(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(e){var t,i,r,a=e.x,o=e.y,s=ke(a-this.long0);if(r=s*m(o),this.sphere)n(o)<=fe?(t=this.a*s,i=-1*this.a*this.lat0):(t=this.a*m(r)/p(o),i=this.a*(Ct(o-this.lat0)+(1-v(r))/p(o)));else if(n(o)<=fe)t=this.a*s,i=-1*this.ml0;else{var l=Mt(this.a,this.e,m(o))/p(o);t=l*m(r),i=this.a*gt(this.e0,this.e1,this.e2,this.e3,o)-this.ml0+l*(1-v(r))}return e.x=t+this.x0,e.y=i+this.y0,e},inverse:function(e){var t,r,o,s,l,A,c,h,u;if(o=e.x-this.x0,s=e.y-this.y0,this.sphere)if(n(s+this.a*this.lat0)<=fe)t=ke(o/this.a+this.long0),r=0;else{var d;for(A=this.lat0+s/this.a,c=o*o/this.a/this.a+A*A,h=A,l=20;l;--l)if(h+=u=-1*(A*(h*(d=p(h))+1)-h-.5*(h*h+c)*d)/((h-A)/d-1),n(u)<=fe){r=h;break}t=ke(this.long0+i(o*p(h)/this.a)/m(r))}else if(n(s+this.ml0)<=fe)r=0,t=ke(this.long0+o/this.a);else{var f,y,w,x,b;for(A=(this.ml0+s)/this.a,c=o*o/this.a/this.a+A*A,h=A,l=20;l;--l)if(b=this.e*m(h),f=g(1-b*b)*p(h),y=this.a*gt(this.e0,this.e1,this.e2,this.e3,h),w=this.e0-2*this.e1*v(2*h)+4*this.e2*v(4*h)-6*this.e3*v(6*h),h-=u=(A*(f*(x=y/this.a)+1)-x-.5*f*(x*x+c))/(this.es*m(2*h)*(x*x+c-2*A*x)/(4*f)+(A-x)*(f*w-2/m(2*h))-w),n(u)<=fe){r=h;break}f=g(1-this.es*a(m(r),2))*p(r),t=ke(this.long0+i(o*f/this.a)/m(r))}return e.x=t,e.y=r,e},names:["Polyconic","poly"]},Qt={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(e){var t,n=e.x,i=e.y-this.lat0,r=n-this.long0,a=1,o=0;for(t=1;10>=t;t++)a*=i/Ae*1e-5,o+=this.A[t]*a;var s,l=o,A=r,c=1,h=0,u=0,d=0;for(t=1;6>=t;t++)s=h*l+c*A,c=c*l-h*A,h=s,u=u+this.B_re[t]*c-this.B_im[t]*h,d=d+this.B_im[t]*c+this.B_re[t]*h;return e.x=d*this.a+this.x0,e.y=u*this.a+this.y0,e},inverse:function(e){var t,n,i=e.x,r=e.y,a=i-this.x0,o=(r-this.y0)/this.a,s=a/this.a,l=1,A=0,c=0,h=0;for(t=1;6>=t;t++)n=A*o+l*s,l=l*o-A*s,A=n,c=c+this.C_re[t]*l-this.C_im[t]*A,h=h+this.C_im[t]*l+this.C_re[t]*A;for(var u=0;u=t;t++)d=p*c+f*h,f=f*c-p*h,p=d,m+=(t-1)*(this.B_re[t]*f-this.B_im[t]*p),v+=(t-1)*(this.B_im[t]*f+this.B_re[t]*p);f=1,p=0;var g=this.B_re[1],y=this.B_im[1];for(t=2;6>=t;t++)d=p*c+f*h,f=f*c-p*h,p=d,g+=t*(this.B_re[t]*f-this.B_im[t]*p),y+=t*(this.B_im[t]*f+this.B_re[t]*p);var w=g*g+y*y;c=(m*g+v*y)/w,h=(v*g-m*y)/w}var x=c,b=h,M=1,C=0;for(t=1;9>=t;t++)M*=x,C+=this.D[t]*M;var B=this.lat0+C*Ae*1e5,E=this.long0+b;return e.x=E,e.y=B,e},names:["New_Zealand_Map_Grid","nzmg"]},Gt={init:function(){},forward:function(e){var n=e.x,i=e.y,r=ke(n-this.long0),a=this.x0+this.a*r,o=this.y0+this.a*t(p(u/4+i/2.5))*1.25;return e.x=a,e.y=o,e},inverse:function(e){e.x-=this.x0,e.y-=this.y0;var t=ke(this.long0+e.x/this.a),n=2.5*(d(f(.8*e.y/this.a))-u/4);return e.x=t,e.y=n,e},names:["Miller_Cylindrical","mill"]},Ht={init:function(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=g((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Je(this.es)},forward:function(e){var t,r,a=e.x,o=e.y;if(a=ke(a-this.long0),this.sphere){if(this.m)for(var s,l=this.n*m(o),A=20;A&&(o-=s=(this.m*o+m(o)-l)/(this.m+v(o)),!(n(s)u&&(a=u),r=(2*t+m(2*t))/u,1o&&(w=-w),t=this.x0+w;var x=A+d;return w=u*this.R*(f*x-l*g((y+A)*(A+1)-x*x))/(y+A),i=0<=a?this.y0+w:this.y0-w,e.x=t,e.y=i,e},inverse:function(e){var t,i,r,a,s,l,A,c,h,d,f,p,m;return e.x-=this.x0,e.y-=this.y0,f=u*this.R,s=(r=e.x/f)*r+(a=e.y/f)*a,m=a*a/(c=-2*(l=-n(a)*(1+s))+1+2*a*a+s*s)+(2*(A=l-2*a*a+r*r)*A*A/c/c/c-9*l*A/c/c)/27,d=2*g(-(h=(l-A*A/3/c)/c)/3),12*ce*this.a?void 0:(r=t/this.a,o=m(r),s=v(r),l=this.long0,n(t)<=fe?A=this.lat0:(A=Ut(s*this.sin_p12+e.y*o*this.cos_p12/t),h=n(this.lat0)-ce,l=n(h)<=fe?0<=this.lat0?ke(this.long0+c(e.x,-e.y)):ke(this.long0-c(-e.x,e.y)):ke(this.long0+c(e.x*o,t*this.cos_p12*s-e.y*this.sin_p12*o))),e.x=l,e.y=A,e):(u=yt(this.es),d=wt(this.es),f=xt(this.es),y=bt(this.es),n(this.sin_p12-1)<=fe?(w=this.a*gt(u,d,f,y,ce),t=g(e.x*e.x+e.y*e.y),A=Bt((w-t)/this.a,u,d,f,y),l=ke(this.long0+c(e.x,-1*e.y)),e.x=l,e.y=A,e):n(this.sin_p12+1)<=fe?(w=this.a*gt(u,d,f,y,ce),t=g(e.x*e.x+e.y*e.y),A=Bt((t-w)/this.a,u,d,f,y),l=ke(this.long0+c(e.x,e.y)),e.x=l,e.y=A,e):(t=g(e.x*e.x+e.y*e.y),M=c(e.x,e.y),x=Mt(this.a,this.e,this.sin_p12),C=v(M),E=-(B=this.e*this.cos_p12*C)*B/(1-this.es),S=3*this.es*(1-E)*this.sin_p12*this.cos_p12*C/(1-this.es),I=1-E*(_=(T=t/x)-E*(1+E)*a(T,3)/6-S*(1+3*E)*a(T,4)/24)*_/2-T*_*_*_/6,b=i(this.sin_p12*v(_)+this.cos_p12*m(_)*C),l=ke(this.long0+i(m(M)*m(_)/v(b))),L=m(b),A=c((L-this.es*I*this.sin_p12)*p(b),L*(1-this.es)),e.x=l,e.y=A,e))},names:["Azimuthal_Equidistant","aeqd"]},Yt={init:function(){this.sin_p14=m(this.lat0),this.cos_p14=v(this.lat0)},forward:function(e){var t,i,r,a,o,s,l,A=e.x,c=e.y;return r=ke(A-this.long0),t=m(c),i=v(c),a=v(r),1,(0<(o=this.sin_p14*t+this.cos_p14*i*a)||n(o)<=fe)&&(s=1*this.a*i*m(r),l=this.y0+1*this.a*(this.cos_p14*t-this.sin_p14*i*a)),e.x=s,e.y=l,e},inverse:function(e){var t,i,r,a,o,s,l;return e.x-=this.x0,e.y-=this.y0,t=g(e.x*e.x+e.y*e.y),i=Ut(t/this.a),r=m(i),a=v(i),s=this.long0,n(t)<=fe?(l=this.lat0,e.x=s,e.y=l,e):(l=Ut(a*this.sin_p14+e.y*r*this.cos_p14/t),o=n(this.lat0)-ce,n(o)<=fe?(s=0<=this.lat0?ke(this.long0+c(e.x,-e.y)):ke(this.long0-c(-e.x,e.y)),e.x=s,e.y=l,e):(s=ke(this.long0+c(e.x*r,t*this.cos_p14*a-e.y*this.sin_p14*r)),e.x=s,e.y=l,e))},names:["ortho"]},Kt=1,Zt=2,Jt=3,qt=4,$t=5,en=6,tn={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4},nn={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.face=this.lat0>=ce-ve/2?$t:this.lat0<=-(ce-ve/2)?en:n(this.long0)<=ve?Kt:n(this.long0)<=ce+ve?0=ve&&n<=ce+ve?(A.value=tn.AREA_0,i=n-ce):n>ce+ve||n<=-(ce+ve)?(A.value=tn.AREA_1,i=0-(ce+ve)&&n<=-ve?(A.value=tn.AREA_2,i=n+ce):(A.value=tn.AREA_3,i=n);else if(this.face===en)r=ce+t,n>=ve&&n<=ce+ve?(A.value=tn.AREA_0,i=-n+ce):n=-ve?(A.value=tn.AREA_1,i=-n):n<-ve&&n>=-(ce+ve)?(A.value=tn.AREA_2,i=-n-ce):(A.value=tn.AREA_3,i=0=n(e.y)?b.value=tn.AREA_0:0<=e.y&&e.y>=n(e.x)?(b.value=tn.AREA_1,t-=ce):0>e.x&&-e.x>=n(e.y)?(b.value=tn.AREA_2,t=0>t?t+ye:t-ye):(b.value=tn.AREA_3,t+=ce),u=ye/12*p(t),s=m(u)/(v(u)-1/g(2)),l=d(s),-1>(A=1-(r=v(t))*r*(a=p(i))*a*(1-v(d(1/v(l)))))?A=-1:1l?l+ye:l-ye:b.value===tn.AREA_2?l-ce:l;else if(this.face===en)h=o(A),x.phi=h-ce,x.lam=b.value===tn.AREA_0?-l+ce:b.value===tn.AREA_1?-l:b.value===tn.AREA_2?-l-ce:0>l?-l-ye:-l+ye;else{var M,C,B;u=(M=A)*M,C=1<=(u+=(B=1<=u?0:g(1-u)*m(l))*B)?0:g(1-u),b.value===tn.AREA_1?(u=C,C=-B,B=u):b.value===tn.AREA_2?(C=-C,B=-B):b.value===tn.AREA_3&&(u=C,C=B,B=-u),this.face===Zt?(u=M,M=-C,C=u):this.face===Jt?(M=-M,C=-C):this.face===qt&&(u=M,M=C,C=-u),x.phi=o(-B)-ce,x.lam=c(C,M),this.face===Zt?x.lam=oe(x.lam,-ce):this.face===Jt?x.lam=oe(x.lam,-ye):this.face===qt&&(x.lam=oe(x.lam,+ce))}0!==this.es&&(f=0>x.phi?1:0,y=p(x.phi),w=this.b/g(y*y+this.one_minus_f_squared),x.phi=d(g(this.a*this.a-w*w)/(this.one_minus_f*w)),f&&(x.phi=-x.phi));return x.lam+=this.long0,e.x=x.lam,e.y=x.phi,e},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},rn=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],an=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],on=.8487,sn=1.3523,ln=me/5,An=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},cn={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var i=ke(t.x-this.long0),r=n(t.y),a=e(r*ln);0>a?a=0:18<=a&&(a=17);var o={x:An(rn[a],r=me*(r-1/ln*a))*i,y:An(an[a],r)};return 0>t.y&&(o.y=-o.y),o.x=o.x*this.a*on+this.x0,o.y=o.y*this.a*sn+this.y0,o},inverse:function(t){var i={x:(t.x-this.x0)/(this.a*on),y:n(t.y-this.y0)/(this.a*sn)};if(1<=i.y)i.x/=rn[18][0],i.y=0>t.y?-ce:ce;else{var r=e(18*i.y);for(0>r?r=0:18<=r&&(r=17);;)if(an[r][0]>i.y)--r;else{if(!(an[r+1][0]<=i.y))break;++r}var a=an[r],o=5*(i.y-a[0])/(an[r+1][0]-a[0]);o=function(e,t,i,r){for(var a,o=t;r&&(o-=a=e(o),!(n(a)t.y&&(i.y=-i.y)}return i.x=ke(i.x+this.long0),i},names:["Robinson","robin"]},hn={init:function(){this.name="geocent"},forward:function(e){return R(e,this.es,this.a)},inverse:function(e){return O(e,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]},un=0,dn=1,fn=2,pn=3,mn={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}},vn={init:function(){if(Object.keys(mn).forEach(function(e){if(void 0===this[e])this[e]=mn[e].def;else{if(mn[e].num&&isNaN(this[e]))throw new Error("Invalid parameter value, must be numeric "+e+" = "+this[e]);mn[e].num&&(this[e]=parseFloat(this[e]))}mn[e].degrees&&(this[e]*=pe)}.bind(this)),n(n(this.lat0)-ce)this.lat0?dn:un:n(this.lat0)=this.pn1||1e10 */var a=e("buffer"),o=a.Buffer;o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?t.exports=a:(i(a,n),n.Buffer=r),r.prototype=Object.create(o.prototype),i(o,r),r.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},r.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=o(e);return void 0===t?i.fill(0):"string"==typeof n?i.fill(t,n):i.fill(t),i},r.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},r.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},{buffer:8}],19:[function(e,t,n){function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(u.isEncoding===d||!d(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=o,this.end=s,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=A,t=3;break;default:return this.write=c,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=u.allocUnsafe(t)}function r(e){return 127>=e?0:6==e>>5?2:14==e>>4?3:30==e>>3?4:2==e>>6?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(1=i)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0==n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1==n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function A(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function c(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}var u=e("safe-buffer").Buffer,d=u.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};n.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=(t=e[i])?n+=s(t):n+=s(55296+((t-=65536)>>10),56320+(1023&t));return n}function A(e){return 0<=e&&127>=e}function c(e){this.tokens=[].slice.call(e),this.tokens.reverse()}function h(e,t){if(e)throw TypeError("Decoder error");return t||65533}function u(e){throw TypeError("The code point "+e+" could not be encoded.")}function d(e){return e=(e+"").trim().toLowerCase(),Object.prototype.hasOwnProperty.call(H,e)?H[e]:null}function f(e,t){return t&&t[e]||null}function p(e,t){var n=t.indexOf(e);return-1===n?null:n}function m(e){if(!("encoding-indexes"in i))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return i["encoding-indexes"][e]}function v(e,t){if(!(this instanceof v))throw TypeError("Called as a function. Did you forget 'new'?");e=void 0===e?"utf-8":e+"",t=o(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var n=d(e);if(null===n||"replacement"===n.name)throw RangeError("Unknown encoding: "+e);if(!X[n.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");var i=this;return i._encoding=n,!!t.fatal&&(i._error_mode="fatal"),!!t.ignoreBOM&&(i._ignoreBOM=!0),Object.defineProperty||(this.encoding=i._encoding.name.toLowerCase(),this.fatal="fatal"===i._error_mode,this.ignoreBOM=i._ignoreBOM),i}function g(e,t){if(!(this instanceof g))throw TypeError("Called as a function. Did you forget 'new'?");t=o(t),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=t.fatal?"fatal":"replacement";var n=this;if(t.NONSTANDARD_allowLegacyEncoding){var r=d(e=void 0===e?"utf-8":e+"");if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!W[r.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");n._encoding=r}else n._encoding=d("utf-8"),void 0!==e&&"console"in i&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=n._encoding.name.toLowerCase()),n}function y(e){var t=e.fatal,n=0,i=0,r=0,o=128,s=191;this.handler=function(e,l){if(-1===l&&0!==r)return r=0,h(t);if(-1===l)return-1;if(0===r){if(a(l,0,127))return l;if(a(l,194,223))r=1,n=31&l;else if(a(l,224,239))224===l&&(o=160),237===l&&(s=159),r=2,n=15&l;else{if(!a(l,240,244))return h(t);240===l&&(o=144),244===l&&(s=143),r=3,n=7&l}return null}if(!a(l,o,s))return n=r=i=0,o=128,s=191,e.prepend(l),h(t);if(o=128,s=191,n=n<<6|63&l,(i+=1)!==r)return null;var A=n;return n=r=i=0,A}}function w(e){e.fatal,this.handler=function(e,t){if(-1===t)return-1;if(Q(t))return t;var n,i;a(t,128,2047)?(n=1,i=192):a(t,2048,65535)?(n=2,i=224):a(t,65536,1114111)&&(n=3,i=240);for(var r=[(t>>6*n)+i];0>6*(n-1);r.push(128|63&o),n-=1}return r}}function x(e,t){var n=t.fatal;this.handler=function(t,i){if(-1===i)return-1;if(A(i))return i;var r=e[i-128];return null===r?h(n):r}}function b(e,t){t.fatal,this.handler=function(t,n){if(-1===n)return-1;if(Q(n))return n;var i=p(n,e);return null===i&&u(n),i+128}}function M(e){var t=e.fatal,n=0,i=0,r=0;this.handler=function(e,o){if(-1===o&&0===n&&0===i&&0===r)return-1;var s;if(-1===o&&(0!==n||0!==i||0!==r)&&(n=0,i=0,r=0,h(t)),0!==r){s=null,a(o,48,57)&&(s=function(e){if(39419e||1237575o?64:65;return(a(o,64,126)||a(o,128,254))&&(u=190*(c-129)+(o-d)),null===(s=null===u?null:f(u,m("gb18030")))&&A(o)&&e.prepend(o),null===s?h(t):s}return A(o)?o:128===o?8364:a(o,129,254)?(n=o,null):h(t)}}function C(e,t){e.fatal,this.handler=function(e,n){if(-1===n)return-1;if(Q(n))return n;if(58853===n)return u(n);if(t&&8364===n)return 128;var i=p(n,m("gb18030"));if(null!==i){var r=i%190;return[z(i/190)+129,r+(63>r?64:65)]}if(t)return u(n);i=function(e){if(59335===e)return 7457;var t,n=0,i=0,r=m("gb18030-ranges");for(t=0;ti?64:98;switch((a(i,64,126)||a(i,161,254))&&(o=157*(r-129)+(i-s)),o){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var l=null===o?null:f(o,m("big5"));return null===l&&A(i)&&e.prepend(i),null===l?h(t):l}return A(i)?i:a(i,129,254)?(n=i,null):h(t)}}function E(e){e.fatal,this.handler=function(e,t){if(-1===t)return-1;if(Q(t))return t;var n=function(e){j=j||m("big5").map((function(e,t){return t<5024?null:e}));var t=j;return 9552===e||9566===e||9569===e||9578===e||21313===e||21317===e?t.lastIndexOf(e):p(e,t)}(t);if(null===n)return u(t);var i=z(n/157)+129;if(161>i)return u(t);var r=n%157;return[i,r+(63>r?64:98)]}}function S(e){var t=e.fatal,n=!1,i=0;this.handler=function(e,r){if(-1===r&&0!==i)return i=0,h(t);if(-1===r&&0===i)return-1;if(142===i&&a(r,161,223))return i=0,65216+r;if(143===i&&a(r,161,254))return n=!0,i=r,null;if(0!==i){var o=i;i=0;var s=null;return a(o,161,254)&&a(r,161,254)&&(s=f(94*(o-161)+(r-161),m(n?"jis0212":"jis0208"))),n=!1,a(r,161,254)||e.prepend(r),null===s?h(t):s}return A(r)?r:142===r||143===r||a(r,161,254)?(i=r,null):h(t)}}function T(e){e.fatal,this.handler=function(e,t){if(-1===t)return-1;if(Q(t))return t;if(165===t)return 92;if(8254===t)return 126;if(a(t,65377,65439))return[142,t-65377+161];8722===t&&(t=65293);var n=p(t,m("jis0208"));return null===n?u(t):[z(n/94)+161,n%94+161]}}function _(e){var t=e.fatal,n=0,i=1,r=2,o=3,s=4,l=5,A=6,c=n,u=n,d=0,p=!1;this.handler=function(e,v){switch(c){default:case n:return 27===v?(c=l,null):a(v,0,127)&&14!==v&&15!==v&&27!==v?(p=!1,v):-1===v?-1:(p=!1,h(t));case i:return 27===v?(c=l,null):92===v?(p=!1,165):126===v?(p=!1,8254):a(v,0,127)&&14!==v&&15!==v&&27!==v&&92!==v&&126!==v?(p=!1,v):-1===v?-1:(p=!1,h(t));case r:return 27===v?(c=l,null):a(v,33,95)?(p=!1,65344+v):-1===v?-1:(p=!1,h(t));case o:return 27===v?(c=l,null):a(v,33,126)?(p=!1,d=v,c=s,null):-1===v?-1:(p=!1,h(t));case s:if(27===v)return c=l,h(t);if(a(v,33,126)){c=o;var g=f(94*(d-33)+v-33,m("jis0208"));return null===g?h(t):g}return-1===v?(c=o,e.prepend(v),h(t)):(c=o,h(t));case l:return 36===v||40===v?(d=v,c=A,null):(e.prepend(v),p=!1,c=u,h(t));case A:var y=d;d=0;var w=null;if(40===y&&66===v&&(w=n),40===y&&74===v&&(w=i),40===y&&73===v&&(w=r),36===y&&(64===v||66===v)&&(w=o),null!==w){c=c=w;var x=p;return p=!0,x?h(t):null}return e.prepend([y,v]),p=!1,c=u,h(t)}}}function I(e){e.fatal;var t=0,n=1,i=2,r=t;this.handler=function(e,a){if(-1===a&&r!==t)return e.prepend(a),r=t,[27,40,66];if(-1===a&&r===t)return-1;if(!(r!==t&&r!==n||14!==a&&15!==a&&27!==a))return u(65533);if(r===t&&Q(a))return a;if(r===n&&(Q(a)&&92!==a&&126!==a||165==a||8254==a)){if(Q(a))return a;if(165===a)return 92;if(8254===a)return 126}if(Q(a)&&r!==t)return e.prepend(a),r=t,[27,40,66];if((165===a||8254===a)&&r!==n)return e.prepend(a),r=n,[27,40,74];8722===a&&(a=65293);var o=p(a,m("jis0208"));return null===o?u(a):r!==i?(e.prepend(a),r=i,[27,36,66]):[z(o/94)+33,o%94+33]}}function L(e){var t=e.fatal,n=0;this.handler=function(e,i){if(-1===i&&0!==n)return n=0,h(t);if(-1===i&&0===n)return-1;if(0!==n){var r=n,o=null;n=0;var s=127>i?64:65,l=160>r?129:193;if((a(i,64,126)||a(i,128,252))&&(o=188*(r-l)+i-s),a(o,8836,10715))return 48508+o;var c=null===o?null:f(o,m("jis0208"));return null===c&&A(i)&&e.prepend(i),null===c?h(t):c}return A(i)||128===i?i:a(i,161,223)?65216+i:a(i,129,159)||a(i,224,252)?(n=i,null):h(t)}}function F(e){e.fatal,this.handler=function(e,t){if(-1===t)return-1;if(Q(t)||128===t)return t;if(165===t)return 92;if(8254===t)return 126;if(a(t,65377,65439))return t-65377+161;8722===t&&(t=65293);var n=function(e){return V=V||m("jis0208").map((function(e,t){return a(t,8272,8835)?null:e})),V.indexOf(e)}(t);if(null===n)return u(t);var i=z(n/188),r=n%188;return[i+(31>i?129:193),r+(63>r?64:65)]}}function k(e){var t=e.fatal,n=0;this.handler=function(e,i){if(-1===i&&0!==n)return n=0,h(t);if(-1===i&&0===n)return-1;if(0!==n){var r=n,o=null;n=0,a(i,65,254)&&(o=190*(r-129)+(i-65));var s=null===o?null:f(o,m("euc-kr"));return null===o&&A(i)&&e.prepend(i),null===s?h(t):s}return A(i)?i:a(i,129,254)?(n=i,null):h(t)}}function P(e){e.fatal,this.handler=function(e,t){if(-1===t)return-1;if(Q(t))return t;var n=p(t,m("euc-kr"));return null===n?u(t):[z(n/190)+129,n%190+65]}}function U(e,t){var n=e>>8,i=255&e;return t?[n,i]:[i,n]}function D(e,t){var n=t.fatal,i=null,r=null;this.handler=function(t,o){if(-1===o&&(null!==i||null!==r))return h(n);if(-1===o&&null===i&&null===r)return-1;if(null===i)return i=o,null;var s;if(s=e?(i<<8)+o:(o<<8)+i,i=null,null!==r){var l=r;return r=null,a(s,56320,57343)?65536+1024*(l-55296)+(s-56320):(t.prepend(U(s,e)),h(n))}return a(s,55296,56319)?(r=s,null):a(s,56320,57343)?h(n):s}}function R(e,t){t.fatal,this.handler=function(t,n){if(-1===n)return-1;if(a(n,0,65535))return U(n,e);var i=U(55296+(n-65536>>10),e),r=U(56320+(1023&n-65536),e);return i.concat(r)}}function O(e){e.fatal,this.handler=function(e,t){return-1===t?-1:A(t)?t:63360+t-128}}function N(e){e.fatal,this.handler=function(e,t){return-1===t?-1:Q(t)?t:a(t,63360,63487)?t-63360+128:u(t)}}void 0!==n&&n.exports&&!i["encoding-indexes"]&&t("./encoding-indexes.js");var z=e,Q=A;c.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};var G=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],H={};G.forEach((function(e){e.encodings.forEach((function(e){e.labels.forEach((function(t){H[t]=e}))}))}));var V,j,W={},X={};Object.defineProperty&&(Object.defineProperty(v.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(v.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(v.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),v.prototype.decode=function(e,t){var n;n="object"==r(e)&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==r(e)&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=o(t),this._do_not_flush||(this._decoder=X[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=!!t.stream;for(var i,a,s=new c(n),A=[];-1!==(a=s.read())&&-1!==(i=this._decoder.handler(s,a));)null!==i&&(Array.isArray(i)?A.push.apply(A,i):A.push(i));if(!this._do_not_flush){do{if(-1===(i=this._decoder.handler(s,s.read())))break;null!==i&&(Array.isArray(i)?A.push.apply(A,i):A.push(i))}while(!s.endOfStream());this._decoder=null}return function(e){return!function(e,t){return-1!==e.indexOf(t)}(["UTF-8","UTF-16LE","UTF-16BE"],this._encoding.name)||this._ignoreBOM||this._BOMseen||(0a||57343=a)r.push(65533);else if(55296<=a&&56319>=a)if(i===n-1)r.push(65533);else{var o=t.charCodeAt(i+1);56320<=o&&57343>=o?(r.push(65536+((1023&a)<<10)+(1023&o)),i+=1):r.push(65533)}i+=1}return r}(e)),a=[];-1!==(i=r.read())&&-1!==(n=this._encoder.handler(r,i));)Array.isArray(n)?a.push.apply(a,n):a.push(n);if(!this._do_not_flush){for(;-1!==(n=this._encoder.handler(r,r.read()));)Array.isArray(n)?a.push.apply(a,n):a.push(n);this._encoder=null}return new Uint8Array(a)},W["UTF-8"]=function(e){return new w(e)},X["UTF-8"]=function(e){return new y(e)},"encoding-indexes"in i&&G.forEach((function(e){"Legacy single-byte encodings"!==e.heading||e.encodings.forEach((function(e){var t=e.name,n=m(t.toLowerCase());X[t]=function(e){return new x(n,e)},W[t]=function(e){return new b(n,e)}}))})),X.GBK=function(e){return new M(e)},W.GBK=function(e){return new C(e,!0)},W.gb18030=function(e){return new C(e)},X.gb18030=function(e){return new M(e)},W.Big5=function(e){return new E(e)},X.Big5=function(e){return new B(e)},W["EUC-JP"]=function(e){return new T(e)},X["EUC-JP"]=function(e){return new S(e)},W["ISO-2022-JP"]=function(e){return new I(e)},X["ISO-2022-JP"]=function(e){return new _(e)},W.Shift_JIS=function(e){return new F(e)},X.Shift_JIS=function(e){return new L(e)},W["EUC-KR"]=function(e){return new P(e)},X["EUC-KR"]=function(e){return new k(e)},W["UTF-16BE"]=function(e){return new R(!0,e)},X["UTF-16BE"]=function(e){return new D(!0,e)},W["UTF-16LE"]=function(e){return new R(!1,e)},X["UTF-16LE"]=function(e){return new D(!1,e)},W["x-user-defined"]=function(e){return new N(e)},X["x-user-defined"]=function(e){return new O(e)},i.TextEncoder||(i.TextEncoder=g),i.TextDecoder||(i.TextDecoder=v),void 0!==n&&n.exports&&(n.exports={TextEncoder:i.TextEncoder,TextDecoder:i.TextDecoder,EncodingIndexes:i["encoding-indexes"]})}(this||{})},{"./encoding-indexes.js":7}],22:[function(e,t,n){(function(t,i){(function(){function r(e,t){this._id=e,this._clearFn=t}var a=e("process/browser.js").nextTick,o=Function.prototype.apply,s=Array.prototype.slice,l={},A=0;n.setTimeout=function(){return new r(o.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new r(o.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n.setImmediate="function"==typeof t?t:function(e){var t=A++,i=!(2>arguments.length)&&s.call(arguments,1);return l[t]=!0,a((function(){l[t]&&(i?e.apply(null,i):e.call(null),n.clearImmediate(t))})),t},n.clearImmediate="function"==typeof i?i:function(e){delete l[e]}}).call(this)}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":16,timers:22}],23:[function(e,t){(function(n){(function(){function r(e){if(!e)throw new Error("forgot to pass buffer");return v.isBuffer(e)?e:a(e)?v.from(e):a(e.buffer)?1===e.BYTES_PER_ELEMENT?v.from(e):v.from(e.buffer):void 0}function a(e){return e instanceof n.ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e)}function s(e,t){return"string"==typeof e&&y.has(e)?p.resolve(y.get(e)):s.getShapefile(e,t).then((function(t){return"string"==typeof e&&y.set(e,t),t}))}function l(e,t){return A.apply(this,arguments)}function A(){return A=o(i().mark((function e(t,n){var r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u(t);case 2:return r=e.sent,e.abrupt("return",s.parseZip(r,n));case 4:case"end":return e.stop()}}),e)}))),A.apply(this,arguments)}var c=e("proj4");c.default&&(c=c.default);var h=e("./unzip"),u=e("./binaryajax"),d=e("./parseShp"),f=e("parsedbf"),p=e("lie"),m=e("lru-cache"),v=e("buffer").Buffer,g=n.URL,y=new m({max:20});s.combine=function(e){var t=M(e,2),n=t[0],i=t[1],r={type:"FeatureCollection",features:[]},a=0,o=n.length;for(i||(i=[]);a1&&void 0!==arguments[1]?arguments[1]:{};return n=xC(n),e.zip?t=wk.parseZip(e.zip):e.shp&&e.shx&&e.dbf&&(t=Promise.all([wk.parseShp(e.shp,e.prj),wk.parseDbf(e.dbf)]).then(wk.combine)),n.in=n.in||{},n.in.crs=e.prj?Zy(e.prj).oProj.datumName:void 0,Promise.resolve(t).then((function(e){return _C.parse(e,n)}))},bk=function(){function e(t){s(this,e),this.classes=t.classes,this.inverseHierarchy={},this.instancesIdxs=[];var n={},i=0,r=t.parentCounts;void 0===r&&(r=new Array(t.instancesLength)).fill(1);for(var a=0;a\n
90 km\n
\n
\n
\n \n
\n
\n \n
\n\n
\n \n
\n\n
\n \n \n
\n
\n',t.container.appendChild(this.element),this.compass=t.container.querySelector("#compass"),this.widgetsScale=t.container.querySelector("#widgets-scale"),this.btn3d=t.container.querySelector("#button-3d"),this.element.querySelector("#zoom-in-button").onclick=function(){n.view.controls.zoomIn()},this.element.querySelector("#zoom-out-button").onclick=function(){n.view.controls.zoomOut()},this.btn3d.onclick=function(){n.view.controls.setTilt("3D"===n.btn3d.innerText?40:90,!0),n.btn3d.innerText="3D"===n.btn3d.innerText?"2D":"3D"},this.element.querySelector("#home-button").onclick=function(){t.controls.flyTo(t.defaultView)},this.view.controls.addEventListener("range-changed",(function(e){var t=Math.round(n.view.getPixelsToMeters(200)),i=Math.pow(10,t.toString().length-1);t=Math.round(t/i)*i;var r=n.view.getMetersToPixels(t),a="m";t>=1e3&&(t/=1e3,a="km"),n.widgetsScale.innerHTML="".concat(t," ").concat(a),n.widgetsScale.style.width="".concat(r,"px")})),this.view.addEventListener(AMRT.Event.CAMERA_MOVED,(function(e){n.compass.style.transform="rotate(".concat(-e.heading,"deg)"),n.btn3d.innerText=e.tilt<89?"2D":"3D"}))}return A(e,[{key:"visible",get:function(){return this._visible},set:function(e){this._visible=e,this.element.style.display=e?"block":"none"}}]),e}(),Ek={coord:[108.5525,34.3227],range:10204904,tilt:90,heading:.001},Sk="globe",Tk="planar",_k=function(e){h(n,e);var t=y(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(this,n),zt.DefaultUp.set(0,0,1),window.__DEBUG__=!1,r.logarithmicDepthBuffer=!0,(i=t.call(this,e,r)).name="GISViewer",i.options=r,i.isGISViewer=!0,i}return A(n,[{key:"initialize",value:function(e){b(u(n.prototype),"initialize",this).call(this,e),this.camera.frustumCulled=!0,this.scene.background=null,this.renderer.setClearAlpha(1),this.defaultView=Ek,this.controlsMap={},this.viewType=e.viewType||Sk,this.viewType===Sk?(this.mapView=new CI(this.container,this.defaultView,{camera:this.camera,renderer:this.renderer,scene3D:this.scene}),this.controlsMap[pp.GLOBE]=this.mapView.controls,this.viewMode=pp.GLOBE):this.viewType===Tk&&(e.extent=e.extent||new bb("EPSG:3857",-20037508.342789244,20037508.342789244,-20037508.342789255,20037508.342789244),this.mapView=new yL(this.container,e.extent,{disableSkirt:!1,maxSubdivisionLevel:19,placement:e.view,camera:this.camera,renderer:this.renderer,scene3D:this.scene}),this.viewMode=pp.PLANAR,this.controlsMap[pp.PLANAR]=this.mapView.controls),this.globe=this.mapView,this.mapView.render=this.renderManager.render,this.controls=this.mapView.controls,this.camera.near=.1,this.camera.updateProjectionMatrix(),If.bindAll(["onUpdate","_onGlobeComplete"],this),this.onGlebeComplete=!1,this.controls.enabled=!1,this.mapView.addEventListener(QS,this._onGlobeComplete),setTimeout(this._onGlobeComplete,2e3),this.mapCenter=this.coordinatesToVector3(e.view?e.view.coord:Ek.coord),this.addEventListener("update",this.onUpdate),Ck.token=e.mapToken||Ck.token,this._elevationLayers=[],this.initLayer(e),this.navigationBar=new Bk(this),e.navigation||(this.navigationBar.visible=!1)}},{key:"_onGlobeComplete",value:function(){var e=this;this.onGlebeComplete||(this.options.showTerrain&&(this._elevationLayers.push(this.loadElevationLayer(Ck.WORLD_DTM)),this._elevationLayers.push(this.loadElevationLayer(Ck.MNT_HIGHRES))),this.mapView.isGlobeView&&this.options.view?(this.defaultView=this.options.view,this.defaultView.onComplete=function(){e.defaultView.onComplete=null,e.controls.enabled=!0,e.dispatchEvent(ld.MAP_INIT)},this.controls.flyTo(this.defaultView)):(this.controls.enabled=!0,this.dispatchEvent(ld.MAP_INIT)),this.onGlebeComplete=!0)}},{key:"initLayer",value:function(e){var t=this;(e.mapSource||[Ck.TianDiTu.imagery]).forEach((function(e){t.loadColorLayer(e)}))}},{key:"addModel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{noFit:!0};return b(u(n.prototype),"addModel",this).call(this,e,t)}},{key:"loadModel",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.onLoad;return i.noSky=!0,i.focus=!1,i.background=!1,i.addModel=!1,i.onLoad=function(e){var n=new ja;if(n.name="modelBox",n.isModelBox=!0,t.modelGroup.add(n),!i.coord&&e.coordinate&&2===e.coordinate.split(",").length){var a=e.coordinate.split(",");i.coord=[Number(a[1]),Number(a[0])]}i.coord&&(i.coord.isVector3?n.position.copy(i.coord):Array.isArray(i.coord)?3===i.coord.length?n.position.fromArray(i.coord):2===i.coord.length&&n.position.copy(t.coordinatesToVector3(i.coord)):i.coord.isCoordinates&&n.position.copy(t.coordinatesToVector3(i.coord)));var o=n.position.clone().normalize().add(n.position);e.isModel&&(e.position.y+=e.getSize().y/2),n.lookAt(o),n.rotateX(Math.PI/2),n.add(e),r&&r(e)},b(u(n.prototype),"loadModel",this).call(this,e,i)}},{key:"loadColorLayer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;e.tk=Ck.token,e.zoom=e.zoom||{min:1,max:18},e.crs=e.crs||"EPSG:3857";var n=e.id;"WMTS"===e.type?e=new ok(e):"TMS"===e.type&&(e=new rk(e));var i=new wF(n,{source:e});return this.mapView.addLayer(i).then((function(){t&&t()})),i}},{key:"loadWFSLayer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.protocol="wfs",e.crs=e.crs||"EPSG:4326",e.typeName=e.name;var t=new ak(e),n=new G_(e.id||(new ja).id,new ja,{name:e.name,update:CL.update,convert:rF({color:new Fn(e.color||"#00ff00"),opacity:e.opacity,altitude:5}),source:t,zoom:{min:3},transparent:!0,opacity:.5});return this.mapView.addLayer(n),n}},{key:"loadSHPLayer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.mapView;return $M.multiple(e.url,{arrayBuffer:["shp","dbf","shx"],text:["prj"]}).then((function(e){return xk(e,{out:{crs:"EPSG:3857",buildExtent:!0}})})).then((function(n){var i=new nk({features:n}),r=new lC(e.style),a=new wF(e.id||(new ja).id,{source:i,style:r,addLabelLayer:!0});return t.addLayer(a)}))}},{key:"loadGeoJSONLayer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.format=e.format||"application/json",e.crs=e.crs||"EPSG:4326";var t=new nk(e),n=new wF(e.id||(new ja).id,{transparent:!0,source:t,style:new lC(e.style)});return this.mapView.addLayer(n),n}},{key:"removeLayerById",value:function(e){this.mapView.removeLayer(e)}},{key:"getLayerById",value:function(e){return this.mapView.getLayerById(e)}},{key:"getLayers",value:function(){return this.mapView.getLayers().splice(2)}},{key:"load3DTilesLayer",value:function(e,t){var n=new JF;n.registerExtension("3DTILES_batch_table_hierarchy",c({},JE,bk));var i=e.id||(new zt).id,r=new $F(i,{name:e.name||i,source:new hk(e),registeredExtensions:n},this.mapView);return $S.prototype.addLayer.call(this.mapView,r).then((function(){t&&t()})),r}},{key:"coordinatesToVector3",value:function(e){return Array.isArray(e)&&(e=new ob("EPSG:4326",e[0],e[1])),e.as(this.mapView.referenceCrs).toVector3()}},{key:"vector3ToCoordinates",value:function(e){var t=new ob("EPSG:4978").setFromVector3(e).as("EPSG:4326");return[t.longitude,t.latitude]}},{key:"pickPosition",value:function(e){return this.mapView.getPickingPositionFromDepth(this.mapView.eventToViewCoords(e))}},{key:"pickCoordinates",value:function(e,t){return this.mapView.pickCoordinates(e,t)}},{key:"computeDistance",value:function(e,t){return e.isVector3&&(e=this.vector3ToCoordinates(e)),t.isVector3&&(t=this.vector3ToCoordinates(t)),e.isCoordinates&&(e=[e.x,e.y]),t.isCoordinates&&(t=[t.x,t.y]),If.computeDistance(e,t)}},{key:"getObjectCoord",value:function(e){return this.vector3ToCoordinates(e.getWorldPosition(new at))}},{key:"setObjectCoord",value:function(e,t){e&&(e.isModel&&(e=e.parent),e.position.copy(this.coordinatesToVector3(t)))}},{key:"setViewMode",value:function(e){if(this.viewMode!==e){switch(this.viewMode=e,this.controls.enabled=!1,e){case pp.GLOBE:this.controls=this.mapView.controls=this.controlsMap[pp.GLOBE];break;case pp.ROAM_FREE:this.controls=this.mapView.controls=this.controlsMap[pp.ROAM_FREE]||new HL(this.mapView);break;case pp.FLY:this.controls=this.mapView.controls=this.controlsMap[pp.FLY]||new kL(this.mapView);case pp.DRIVE:case pp.ROAM_AUTO:}this.controls.enabled=!0}}},{key:"fitCamera",value:function(){}},{key:"_initControls",value:function(){this.camera.defaultPos=this.camera.position.clone()}},{key:"_proxyEvent",value:function(){var e=this;this.renderManager.addEventListener(ld.UPDATE,(function(){e.dispatchEvent(ld.UPDATE)})),this.modelManager.addEventListener(ld.MODEL_UPDATE,(function(){e.dispatchEvent(ld.MODEL_UPDATE)}))}},{key:"loadElevationLayer",value:function(e){e.source=new ok(e.source);var t=new xF(e.id,e);return this.mapView.addLayer(t),t}},{key:"showElevationLayer",value:function(){this._elevationLayers.forEach((function(e){e.visible=!0}))}},{key:"hideElevationLayer",value:function(){this._elevationLayers.forEach((function(e){e.visible=!1}))}},{key:"getCoordsByAddress",value:function(e,t){var n=this;lu.getCoordsByAddress(e,(function(e){if(e.bound){var i=e.bound.split(","),r=n.computeDistance([Number(i[0]),Number(i[1])],[Number(i[0]),Number(i[3])]),a=n.computeDistance([Number(i[0]),Number(i[1])],[Number(i[2]),Number(i[1])]);e.range=Math.max(r,a)}t(e.coord,e.range)}))}},{key:"positioning",value:function(e,t){var n=this;Ek.onComplete=function(){n.controls.flyTo({coord:e,tilt:90,heading:.001,range:t}),Ek.onComplete=void 0},this.controls.flyTo(Ek)}},{key:"onUpdate",value:function(){}},{key:"dispose",value:function(){this.mapView.dispose(),b(u(n.prototype),"dispose",this).call(this)}}]),n}(Rg),Ik=function(){function e(){s(this,e)}return A(e,null,[{key:"createLine",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#ffffff",n=new Li;return e.forEach((function(e){n.vertices.push((new at).copy(e))})),new Go(n,new Do({color:t}))}},{key:"createSprite",value:function(e,t){var n=new go(new ro({map:(new tA).load(e,(function(e){}))}));return n.scale.set(t,t,t),n}},{key:"createPointLight",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#ffffff",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=new LA(e,t,n);return i}},{key:"createSpotLight",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#ffffff",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,r=new _A(e,t,n,i);return r}},{key:"createBoundingBox",value:function(e,t){return new Lh(e,t)}},{key:"createFontMesh",value:function(e,t,n){(n=n||{}).font=e;var i=new Js(t,n);return i.computeBoundingBox(),new Ei(i,new Vh([new wl({color:n.color,shading:1}),new wl({color:n.color,shading:2})]))}},{key:"createLightHelper",value:function(e){var t;return e.isDirectionalLight?t=new Bh(e,1):e.isSpotLight?t=new nh(e):e.isPointLight&&(t=new lh(e)),t}},{key:"createPlane",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#ffffff",i=new $i(e,t),r=new Ei(i,new Nn({color:n}));return r.rotation.x=-Math.PI/2,r}}]),e}(),Lk=function(e,t){hu.call(this),void 0===du&&console.error("TexturePass relies on CopyShader");var n=du;this.map=e,this.opacity=void 0!==t?t:1,this.uniforms=Di.clone(n.uniforms),this.material=new Ri({uniforms:this.uniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,depthTest:!1,depthWrite:!1}),this.needsSwap=!1,this.fsQuad=new hu.FullScreenQuad(null)};Lk.prototype=Object.assign(Object.create(hu.prototype),{constructor:Lk,render:function(e,t,n){var i=e.autoClear;e.autoClear=!1,this.fsQuad.material=this.material,this.uniforms.opacity.value=this.opacity,this.uniforms.tDiffuse.value=this.map,this.material.transparent=this.opacity<1,e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(),this.fsQuad.render(e),e.autoClear=i}});var Fk={uniforms:{tDiffuse:{value:null},pixelSize:{value:null},kernel:{value:null}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n ",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform float pixelSize;\n uniform float kernel[25];\n varying vec2 vUv;\n void main(){\n vec4 texel = \n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-2, 2)))) * kernel[0] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-1, 2)))) * kernel[1] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 0, 2)))) * kernel[2] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 1, 2)))) * kernel[3] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 2, 2)))) * kernel[4] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-2, 1)))) * kernel[5] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-1, 1)))) * kernel[6] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 0, 1)))) * kernel[7] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 1, 1)))) * kernel[8] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 2, 1)))) * kernel[9] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-2, 0)))) * kernel[10] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-1, 0)))) * kernel[11] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 0, 0)))) * kernel[12] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 1, 0)))) * kernel[13] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 2, 0)))) * kernel[14] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-2,-1)))) * kernel[15] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-1,-1)))) * kernel[16] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 0,-1)))) * kernel[17] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 1,-1)))) * kernel[18] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 2,-1)))) * kernel[19] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-2,-2)))) * kernel[20] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2(-1,-2)))) * kernel[21] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 0,-2)))) * kernel[22] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 1,-2)))) * kernel[23] +\n texture2D(tDiffuse, fract(1.0 + (vUv + pixelSize * vec2( 2,-2)))) * kernel[24] ;\n\n gl_FragColor = texel / 256.0;\n }\n "},kk=new Kf;function Pk(e){if(uk||((uk=new $a({antialias:!0,alpha:!0})).setPixelRatio(window.devicePixelRatio),uk.setClearAlpha(0)),uk.setSize(e,e),dk)pk&&dk.remove(pk),mk&&dk.remove(mk),fk.left=e/-2,fk.right=e/2,fk.top=e/2,fk.bottom=e/-2,fk.updateProjectionMatrix();else{(dk=new Qt).background=null,dk.add(new UA(16777215,.7));var t=new PA(16777215,.7);t.position.set(-1,1,-1).normalize(),dk.add(t),fk=new FA(e/-2,e/2,e/2,e/-2,1,1e3)}fk.position.set(0,0,-e-1),fk.lookAt(0,0,0)}var Uk,Dk,Rk,Ok,Nk,zk,Qk,Gk,Hk=function(){function e(){s(this,e)}return A(e,null,[{key:"generateMaterialIcon",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:128;if(Pk(t),pk)pk.material=e;else{var n=new el(1,32,32);pd(n),pk=new Ei(n,e)}return dk.add(pk),pk.scale.set(t/2,t/2,t/2),uk.render(dk,fk),uk.domElement.style.background="transparent",uk.domElement.toDataURL("image/png")}},{key:"generateHDRIcon",value:function(e,t,n){Pk(t=t||128),kk.renderer=uk,kk.load(e,(function(e){var i=new Nn({map:e,side:2});if(mk)mk.material=i;else{var r=new $i(1,1);mk=new Ei(r,i)}dk.add(mk),mk.position.set(0,0,0),mk.scale.set(t,t,t),mk.rotateY(Math.PI),uk.render(dk,fk),n&&n(uk.domElement.toDataURL("image/jpeg"))}))}},{key:"generateTextureIcon",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:128;Pk(t);var n=new Nn({map:e,side:2});if(mk)mk.material=n;else{var i=new $i(1,1);mk=new Ei(i,n)}return dk.add(mk),mk.position.set(0,0,0),mk.scale.set(t,t,t),uk.render(dk,fk),uk.domElement.toDataURL("image/jpeg")}},{key:"generateBlurMap",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,i=arguments.length>3?arguments[3]:void 0;Pk(t),vk||(vk=new vu(uk),gk=new Lk,(yk=new fu(Fk)).uniforms.pixelSize.value=2/t,yk.uniforms.kernel.value=[1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1]),vk.setSize(t,t),vk.passes.length=0,vk.addPass(gk);for(var r=0;r10||e<1||(Jk=5*e,eP())}},{key:"getStrength",value:function(){return 10*qk}},{key:"setStrength",value:function(e){isNaN(e)||e>10||e<1||(qk=e/10,eP())}},{key:"getHeight",value:function(){return Zk/Yk}},{key:"setHeight",value:function(e){isNaN(e)||e>100||e<0||(Zk=Yk*e,eP())}},{key:"importShadow",value:function(t,n,i){i&&i.visible&&(e.createShadow(t,n),Zk=Yk*i.height||0,qk=i.strength/10||.3,Jk=5*i.blur||30,Kk=!0,eP())}}]),e}();function eP(){var e;if(Gk){Uk||((Uk=new $a({antialias:!0,alpha:!0})).setClearAlpha(0),Uk.setPixelRatio(window.devicePixelRatio),Uk.setSize(512,512),Uk.domElement.style.width="512px",Uk.domElement.style.height="512px",(Dk=new Qt).overrideMaterial=new Nn({color:0}),Rk=new FA(-1,1,1,-1,0,1e3)),Dk.remove(Dk.children[0]),Dk.add(Gk),Gk.updateMatrixWorld(),Vk.setFromObject(Gk);var t=Vk.max,n=Vk.min;Vk.getCenter(Wk);var i=t.x-n.x,r=t.z-n.z;(e=zk.geometry).scale.apply(e,[1.2*i/jk[0],1,1.2*r/jk[2]]),jk=[1.2*i,1,1.2*r],zk.position.set(Wk.x,n.y-Zk,Wk.z),Rk.left=-1.2*i/2,Rk.right=1.2*i/2,Rk.top=1.2*r/2,Rk.bottom=-1.2*r/2,Rk.far=t.y-n.y,Rk.updateProjectionMatrix(),Rk.position.set(Wk.x,t.y+.1,Wk.z),Rk.lookAt(Wk.x,n.y,Wk.z),Rk.updateMatrixWorld(),Uk.render(Dk,Rk),Qk.modelGroup.add(Gk),zk.material.map&&zk.material.map.dispose(),Hk.generateBlurMap(Uk.domElement.toDataURL("image/png"),512,Jk,(function(e){zk.material.opacity=qk,zk.material.map=(new tA).load(e),zk.material.needsUpdate=!0}))}}var tP,nP=new at,iP=new at,rP=new at,aP=function(e){h(n,e);var t=y(n);function n(e,i,r){var a;s(this,n),(a=t.call(this)).name="DirectionalLightIcon",a.light=i,a.camera=e,a.light.updateMatrixWorld(),a.color=r||"#1296db",a.matrix=i.matrixWorld,a.matrixAutoUpdate=!1,a.lightIcon=new go(new ro({map:(new tA).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACUVJREFUeF7tW32MFGcZ/z0zd3yYKrezUFotpnA7e1RsJYG0pWhC+LDRVk0aISJVS5TCznJYiAWrMaCJEqspWphZKGrbCKI9Y+JHbRqwNVFKacBUKpbb2YOL0AZ6t7OHJS1wu/OYdz9gP2Z3Znb2OI33/rXZeT5/87zv+zzP+w5hlEZYTz4Aovvy6pl/k45HnxoNU2g0lHYkXr+Z7LZXiDCl4D8GWMrePhS7pf9a2zMqAIQTqbXMvL3cWSLqTsciO/4vAFAS5mYwtlQ4S9hixdRvjwFwjREYlSkwFgFjU+B/cA3o0JOzZWB2Okf7sE69FGSqjtQUeN9PTittly/eZ1P2gNct1dMaENJNnQhawWnqB3ijpak9zYIwEgAoidS3wPwIgIkFM+kpKxZZ6WajOwDPHB8XGhh3ppS0lAlc1iwITgAQ88pms8GQkXyYQI9WO2tfagsNrZ8+1AgEVwCm6KlIjtisI6QpEEQmKHHbQQDvL0WVzPK8gfj0s25vrPp52Eh2M+hxJz6ZSR2IR1KBABDMimH+EcAnWgmCYpgPAfhSUebTlqb+yK/zSiK1CsxP1OF7ztLUT7rJdI2APAC6+VmA94GorZUguBnX6HlY7/0ik/S0Iw1zFqDlVlz9tZsOTwAIISGj7x4iex8Y7x1tEJSEuQyMXznaQXibWVqe0TqfdXM+v1Z6ISrRhHf2LbJtex+hUMVVDuq3tMh0L/JCu/om2blcuI14sqDPMg1KspzOrO4874nfMI8QMKealoEBSZKWp9d0/smLHN8A5CNB7/0okfQLANNqMahf0ISN5GIG7gbTF0CY6hy6OAfinxPwfFqLHnCi6dhuLpBkvOjw7DSz/flMvOuvXp1vCgDBNHln31zb5r0AR8uVSZBnDmozesv/CyXMFcToBnCHH8MAHGbC9kxM3VvNFzLMFwlYcPV/SkoSrRhc03nEpw5/U6DCse19t0qy/V0GPiUaGgB6MnE1XqIJGSc/RsiJxKTe7uHV1ucY8taMNuMvJYZCHkEPAHwzAb+3c9I3M92dr3kVWE7naw1wUhDe3jszPTV7EstmXb5ioN67CiTpANqbMcqBZxhsx6141+7yZ3nd3V0ngugIDEC1csc0t46FDPQV52GnJydGoGnSUgAUw1wK4JkGzvwdjBdAOIR2HLJWqWcErbLbvAnDmAfGPBAWAvhIAxlNZZ/15LUMAFfniXbL9qUNA/FZFxq97Sn68ety0vjHwLzqWoDQEgBueuz0xHcmXHoZ4NscjB4E02eseOQlT2FeJFL01F0g/q3YdGr56Nh7Lo6/88yGae/6kelE2xIAQonURmL+voOCNy1N/UAQIxXDfONq0XRVEhNtysQiNRWgX12BASg0Id49BlCNo5Kd7Rpce0vSr1Hl9JN3vB61pbaK3KLwnN/Ijpt427+/Ms0KIj8wAMVEZ0+1EQSsTWuq2AoDj7BhxhmoOTNgwv1OiZIfhYEBCOvmHiasqFTKBywtusSPIW60ipHcD9Dicjpi7E3H1fvdeBs9DwyAYiTTACkVhhGMdOxqVhjEwBJvOGHqzKW2XOlftiwtGg4in0RlhuHsfJLlpcx8cz1hRNTPuVwP2tsOlqo2wUs526nltL6ZBkcjR4oNlG3VNCxLHSV7FD01jSXMB/Pqhm+9zBfyk7nlhZZlY5OM5AwZlM/mKiJAkhb7KUm9vEFRirNt11SIOXDneS16UshQDFMkYSIZ8zYIW0gxzH8AmOWNI0913NLUD4sf4UTv7czS4WredqKp52KRt3zIdCWdmkhdP8x8rgZssu9Ix7pembyr/0Y7N/ymq6BKguMUNszfiYrOK6OovtKa+ulGAFwmmnqhxQBcl0hdP64BAB3bTnVI47P/Aup2rGpcFL6QuKhggx51aHs7YTJEzOtL7eu6U4Byi9KxmS94BdULXThxYiGzXNPpqZoCYo0QzVbXIUp4CbwxvwuINrWM9nsZ3HhFJfRYa9R/lqTXWwQJtC6tRSrO/10tciEIG6luBte0v8sXQSFispGaYxPf20gcgdI5DP9BnB4F3wZ182xti4ufsLRow5XYLyCKkdwF0IMVfIxzVly9wa+scvrgABjJHwD0tUoj6Fg7YUmrFsLCAoj9tcUW/9DSog+PKgCFZiftdzCix9LUZUGMK/HW294IvKRe89Sr3sARIBQphvmyY9OT+SErHv2xV2Oc6BQ9+VUQOZ0aHbY09c4gsgVvSwCoVxAJBZamBtKhGCY7OdmKQqhlABSjoKXnhy4dJk/nfl6iI9DbKVdQbIOLfbpeJ7gHNrZZa9VDjQxTdpjzIGF9g5R2mCEvKm+Te3G0Hk3LAMhHQaEdXu+0Nm8DA0cJfJQYh3JS7s/iP9mWFzBhHoPmOB15VW599oPV7fH/GgDyIDhdgApiYeWm3fK7hMEi4HFzfFjm5Tng1aF49NWSreFEaiEDz4J5Qkt8J7pIwD3pWORKei0KMdj0oaB3lpoGIJRIfY4YW8XxVGE1pZ1pLRIrOdyhn5otUfZ7rTgas7ntG0Px6VcArjwbpH4mPJKJRX7ZDNhNAaAYyZUA/axK4cXLWXzwwjpVnBNeGa0+HFV08+MgPF/tLBGvTMf83zj3DUAoYcaIYTihnR03IVyvSxtKnJgPW5oPSbqLmG8FMKNKxkkmeg22/RIk+2AmNlPcIaoZjXIOBscyWnSnn0jwBUC9tlR+CvhtUO460h6yO7oEb0Ya6sXqucNeDa+beea3GX/Zp2cAQrr5dSIx5x3HcUhYVl4qe3WmGTq3Yzg/hyaeAHDZ2pp2XnRxBABud/mcQHIDAcBmS1O/4wawNwCMVG/1bZCi4KadVwxTdG++XJTzU0tTRfbna7iAcNbS1BvdBLoC0OBOTtPO57s24IrrLBJo7qAWOepmcPXzRiDkbMw5v1b9WyOZrgAI5pBuvlXVM2zaeSGv1XeFnUGgfkseirotrp4AEI1TJmmzSHoY2EMStgZZ8FoNQB5Uw1zKwKZiLTEEwpNWTN3gFlGeACgJmbTL7Dy/Wq05CHFTUhO2I/jBhJiybe/kjg5umvm2F7t8AeBFoBeakYgAL3qdaMYAaBa5IHxjETCCa4DfFzM2Bfwi1gr6wrZKT5bLCvLJTBCbRiUCpuinbshR7lCpmSI+xGr2k5kgzgveUQGgmLgE/mQmqPOC/z91kP5273HRKgAAAABJRU5ErkJggg=="),sizeAttenuation:!1,depthTest:!1})),a.add(a.lightIcon),a.lightIcon.scale.multiplyScalar(2e-4),a.targetLines=[];for(var o=new Nn({depthTest:!0,color:a.color}),l=0;l<4;l++){var A=new ki(.001,.001,.25);A.translate(0,0,.125);var c=new Ei(A,o);c.renderOrder=5001,a.targetLines.push(c),a.add(c)}return a.targetLines[0].geometry.translate(0,.0075,0),a.targetLines[1].geometry.translate(0,-.0075,0),a.targetLines[2].geometry.translate(.0075,0,0),a.targetLines[3].geometry.translate(-.0075,0,0),a.size=1,a.update(),a}return A(n,[{key:"dispose",value:function(){this.lightIcon.geometry.dispose(),this.lightIcon.material.dispose(),this.targetLines.forEach((function(e){e.geometry.dispose(),e.material.dispose()}))}},{key:"update",value:function(){var e=this;nP.setFromMatrixPosition(this.light.matrixWorld),nP.normalize(),iP.setFromMatrixPosition(this.light.target.matrixWorld),iP.normalize(),rP.subVectors(iP,nP),rP.normalize(),this.lightIcon.lookAt(iP);var t=nP.distanceTo(this.camera.position)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n=this.size/75;this.lightIcon.scale.set(n,n,n),this.targetLines.forEach((function(n){n.lookAt(iP),n.scale.set(1,1,1).multiplyScalar(t*e.size/4)}))}}]),n}(zt),oP=function(){function e(){s(this,e)}return A(e,null,[{key:"screenShot",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.hideAxes(e),i=this.hideGrid(e),r=(tP=e.renderManager.defaultRenderer).getPixelRatio()||1,a=t.width||300*r,o=t.height||300*r,s=tP.getSize(),l=tP.domElement.width,A=tP.domElement.height;tP.domElement.width=a,tP.domElement.height=o,tP.setSize(a,o);var c=e.camera.clone();c.aspect=a/o,c.updateProjectionMatrix(),e.renderManager.render(!0),tP.render(e.scene,c);var h=tP.domElement.toDataURL("image/png");return tP.domElement.width=l,tP.domElement.height=A,tP.setSize(s.x,s.y),n&&e.sceneManager.showAxesHelper(),i&&e.sceneManager.showGridHelp(),h}},{key:"encircleScreenShot",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.hideAxes(e),i=this.hideGrid(e),r=(tP=e.renderManager.defaultRenderer).getPixelRatio()||1,a=t.count||16,o=t.width||300*r,s=t.height||300*r,l=tP.getSize(),A=tP.domElement.width,c=tP.domElement.height,h=e.camera.aspect;tP.domElement.width=o,tP.domElement.height=s,tP.setSize(o,s);var u=t.callback,d=o/s,f=e.camera,p=e.camera.clone();e.camera=p,f.aspect=d,f.updateProjectionMatrix(),p.aspect=d,p.updateProjectionMatrix(),e.controls.update();var m=new yp({camera:f,renderer:tP,renderManager:e.renderManager}),v=[];m.setPosition(e.camera.position.x,e.camera.position.y,e.camera.position.z),m.setTarget(e.controls.target.x,e.controls.target.y,e.controls.target.z);for(var g=0;g1&&void 0!==arguments[1]?arguments[1]:{};s(this,e),this.init(t,n)}return A(e,[{key:"init",value:function(t,n){this.model=t,this.path=n.path,this.directions=n.directions,this.target=n.target,this.rotate=n.rotate,this.tension=n.tension?n.tension:.2,this.time=n.time?n.time:3e3,this.loopType=n.loopType==e.LOOPTYPE_PINGPONG?e.LOOPTYPE_PINGPONG:e.LOOPTYPE_NORMAL,this.loop=n.loop||1/0,this.loopTypeState=0,this.tween=null,this.onUpdate=n.onUpdate,this.onRepeat=n.onRepeat,this.onComplete=n.onComplete}},{key:"path",get:function(){return this._path},set:function(e){if(this._path=[],e)for(var t=0;tMath.PI/2&&(s=-s);var l=new at(t.x,0,t.z).normalize(),A=t.clone(),c=l.angleTo(A);A.y>0&&(c=-c);var h=new nt;h.setFromAxisAngle(new at(1,0,0),c);var u=new nt;return u.setFromAxisAngle(new at(0,1,0),s),n.multiply(u),n.multiply(h),n}},{key:"isValidData",value:function(){return this.model?!this.path||this.path.length<2?(console.error("路径数据错误!"),!1):"number"!=typeof this.tension||this.tension<0||this.tension>1?(console.error("平滑系数取值为0-1之间!"),!1):"number"!=typeof this.time||this.time<=0?(console.error("时间应为正数!"),!1):0!==this.loopType&&1!==this.loopType?(console.error("循环类型只能取0或1!"),!1):!("number"!=typeof this.loop||this.loop<1)||(console.error("循环次数应大于0!"),!1):(console.error("未设置动画模型!"),!1)}}]),e}(),lP=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"catmullrom",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;s(this,e);var a=new cA(t);a.curveType=n,a.tension=i,this.curve=a,this.path=t,this.accuracy=r||10*t.length,this.curveType=n,this.tension=i,this.points=a.getPoints(this.accuracy),this.compute()}return A(e,[{key:"compute",value:function(){var e=this.points.length;this.allLen=0,this.lenArr=[0];for(var t=0;t1)return t?t.set(this.lastPoint.x,this.lastPoint.y,this.lastPoint.z):t=this.lastPoint.clone(),t;for(var n=this.allLen*e,i=0;in){var o=this.points[i],s=n-r,l=this.points[i+1].clone().sub(o).normalize(),A=o.clone().addScaledVector(l,s);return t?t.set(A.x,A.y,A.z):t=this.points[i].clone(),t}}var c=this.points[this.points.length-1];return t?t.set(c.x,c.y,c.z):t=c.clone(),t}},{key:"getLines",value:function(){for(var e=this.points,t=[],n=[],i=0;ir.x/r.z?o=(s=r.z)*n:s=(o=r.x)/n;var c=-(o*=1.1)/2,h=o/2,u=(s*=1.1)/2,d=-s/2,f=2*r.y;this.miniCamera.left=c,this.miniCamera.right=h,this.miniCamera.top=u,this.miniCamera.bottom=d,this.miniCamera.near=.1,this.miniCamera.far=f,this.miniCamera.updateProjectionMatrix(),this.miniCamera.position.copy(l),this.miniCamera.lookAt(A),n>1?(this.insetHeight=this.miniMinSize,this.insetWidth=this.insetHeight*n):(this.insetWidth=this.miniMinSize,this.insetHeight=this.insetWidth/n),this.renderer1||(this.renderer1=new $a({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));var p=this.renderer1;p.setClearAlpha(0),p.setPixelRatio(window.devicePixelRatio),p.setSize(e,t),p.setViewport(0,0,e,t),p.setClearColor(2236962,0),p.render(this.viewer.scene,this.miniCamera);var m=(new tA).load(p.domElement.toDataURL());p.clearDepth(),p.setScissorTest(!0),p.setScissor(this.leftMargin,t-this.insetHeight-this.topMargin,this.insetWidth,this.insetHeight),p.setViewport(this.leftMargin,t-this.insetHeight-this.topMargin,this.insetWidth,this.insetHeight),p.setClearColor(2236962,0),p.render(this.miniScene,this.miniCamera),p.setScissorTest(!1),this.miniPlane.geometry.dispose(),this.miniPlane.geometry=new qi(o,s),this.miniPlane.geometry.verticesNeedUpdate=!0,this.miniPlane.material.map=m,this.miniPlane.material.needsUpdate=!0,this.needUpdateMap=!1,this.setNodesVisible(!0)}}},{key:"show",value:function(){this.visible=!0}},{key:"hide",value:function(){this.visible=!1}},{key:"setNodes",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._hideNodes=[],t&&t.length>0&&this.viewer.modelGroup.traverse((function(n){"Object3D"!==n.type&&"Mesh"!==n.type||t.forEach((function(t){t==n.name&&e._hideNodes.push(n)}))}))}},{key:"setNodesVisible",value:function(e){this.model.visible=e,this._hideNodes.forEach((function(t){t&&(t.visible=e)}))}},{key:"onAfterRender",value:function(e,t,n,i,r){if(this.visible){var a=this.viewer.container.clientWidth,o=this.viewer.container.clientHeight,s=this.renderer.autoClear;this.renderer.autoClear=!1,this.renderer.clearDepth(),this.renderer.setScissorTest(!0),this.renderer.setScissor(this.leftMargin,o-this.insetHeight-this.topMargin,this.insetWidth,this.insetHeight),this.renderer.setViewport(this.leftMargin,o-this.insetHeight-this.topMargin,this.insetWidth,this.insetHeight),this.renderer.setClearColor(2236962,1),this.renderer.render(this.miniScene,this.miniCamera),this.renderer.setScissorTest(!1),this.updateMan(),this.renderer.autoClear=s,this.renderer.setViewport(0,0,a,o)}}},{key:"updateMan",value:function(){var e=new at(0,0,1),t=this.model.getWorldDirection(new at),n=this.getLookAtRotate(e,t);this.miniMan.material.rotation=n;var i=this.model.getWorldPosition(new at);this.miniMan.position.set(i.x,1,i.z)}},{key:"getLookAtRotate",value:function(e,t){var n=new at(t.x,0,t.z);if(0===e.x&&0===e.y&&0===e.z||0===n.x&&0===n.y&&0===n.z||e.x===n.x&&e.y===n.y&&e.z===n.z)return 0;var i=e.angleTo(n);return n.x<0?-i:i}},{key:"getLookAtRotateQue4",value:function(e,t){var n=new nt,i=new nt;if(i.setFromAxisAngle(new at(1,0,0),-Math.PI/2),n.multiply(i),0===e.x&&0===e.y&&0===e.z||0===t.x&&0===t.y&&0===t.z||e.x===t.x&&e.y===t.y&&e.z===t.z)return n;var r=e.clone(),a=new at(0,1,0).clone().cross(r).normalize(),o=new at(e.x,0,e.z).normalize(),s=new at(t.x,0,t.z).normalize(),l=o.angleTo(s);a.angleTo(s)>Math.PI/2&&(l=-l);var A=new nt;return A.setFromAxisAngle(new at(0,0,1),l),n.multiply(A),n}},{key:"hideNodeNames",set:function(e){this.setNodes(e)}},{key:"needUpdateMap",get:function(){return this._needUpdateMap},set:function(e){this._needUpdateMap=!!e,this.updateMap()}},{key:"texture",get:function(){return this._texture||(this._texture=(new tA).load("https://laozicloud-sdk.obs.myhuaweicloud.com/assets/image/miniMan2.png"),this._texture.wrapS=this._texture.wrapT=V,this._texture.repeat.set(1,1),this._texture.needsUpdate=!0),this._texture},set:function(e){e&&(this._texture=(new tA).load(e),this._texture.wrapS=this._texture.wrapT=V,this._texture.repeat.set(1,1),this._texture.needsUpdate=!0,this.miniMan.material.map=this._texture,this.miniMan.material.needsUpdate=!0)}},{key:"miniMinSize",get:function(){return this._miniMinSize},set:function(e){e&&(this._miniMinSize=e)}},{key:"manSize",get:function(){return this._manSize},set:function(e){e&&(this._manSize=e,this.miniMan.scale.set(e,e,e))}}]),n}(zt),cP=function(e){h(n,e);var t=y(n);function n(e,i){var r;return s(this,n),(r=t.call(this)).viewer=e,r.viewer.modelGroup.add(v(r)),r.renderer=e.renderer,r.model=i||r.createModel(),r.modelScale=.1,r.viewMinSize=200,r.rightMargin=10,r.bottomMargin=10,r._freeCamera=new Ni(r.viewer.camera.fov,r.viewer.camera.aspect,r.viewer.camera.near,r.viewer.camera.far),r.needUpdateMap=!0,r}return A(n,[{key:"updateMap",value:function(){if(this._needUpdateMap){var e=this.viewer.container.clientWidth,t=this.viewer.container.clientHeight,n=e/t;n>1?(this.insetHeight=this.viewMinSize,this.insetWidth=this.insetHeight*n):(this.insetWidth=this.viewMinSize,this.insetHeight=this.insetWidth/n),this.renderer1||(this.renderer1=new $a({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));var i=this.renderer1;i.setClearAlpha(0),i.setPixelRatio(window.devicePixelRatio),i.setSize(e,t),i.setViewport(0,0,e,t),i.setClearColor(2236962,0),i.render(this.viewer.scene,this._freeCamera),i.clearDepth(),i.setScissorTest(!0),i.setScissor(e-this.rightMargin-this.insetWidth,this.bottomMargin,this.insetWidth,this.insetHeight),i.setViewport(e-this.rightMargin-this.insetWidth,this.bottomMargin,this.insetWidth,this.insetHeight),i.setClearColor(2236962,0),i.render(this.viewer.scene,this._freeCamera),i.setScissorTest(!1),this.needUpdateMap=!1}}},{key:"createModel",value:function(){var e=new kf(this.viewer),t=new Ei(new Fi(2,2,4),new Gf({}));e.add(t);var n=new Ei(new Fi(1,1,3),new Gf({}));return n.position.z=2,e.add(n),this.add(e),e}},{key:"updateCameraQua",value:function(){this.model.recalculationBound();var e=this.model.boundingSphere,t=(new nt).copy(this.model.quaternion),n=(new nt).setFromAxisAngle(new at(0,1,0),Math.PI),i=(new nt).multiply(t).multiply(n);this._freeCamera.quaternion.copy(i);var r=this.model.getWorldDirection(new at),a=e.center.clone().addScaledVector(r,e.radius);this._freeCamera.position.copy(a)}},{key:"show",value:function(){this.visible=!0}},{key:"hide",value:function(){this.visible=!1}},{key:"onAfterRender",value:function(e,t,n,i,r){if(this.visible){this.updateCameraQua();var a=this.viewer.container.clientWidth,o=this.viewer.container.clientHeight,s=this.renderer.autoClear;this.renderer.autoClear=!1,this.renderer.clearDepth(),this.renderer.setScissorTest(!0),this.renderer.setScissor(a-this.rightMargin-this.insetWidth,this.bottomMargin,this.insetWidth,this.insetHeight),this.renderer.setViewport(a-this.rightMargin-this.insetWidth,this.bottomMargin,this.insetWidth,this.insetHeight),this.renderer.setClearColor(2236962,1),this.renderer.render(this.viewer.scene,this._freeCamera),this.renderer.setScissorTest(!1),this.renderer.autoClear=s,this.renderer.setViewport(0,0,a,o)}}},{key:"modelScale",get:function(){return this.model.scale.x},set:function(e){e&&this.model.scale.set(e,e,e)}},{key:"needUpdateMap",get:function(){return this._needUpdateMap},set:function(e){this._needUpdateMap=!!e,this.updateMap()}},{key:"viewMinSize",get:function(){return this._viewMinSize},set:function(e){e&&(this._viewMinSize=e)}}]),n}(zt);function hP(e,t){var n,i;this.viewer=e,this.camera=e.camera,this.rotateSpeed=.002,this.moveSpeed=5,this.Ammo=t,this.physicsWorld,this.rigidBodies=[],this.count=0,this.movingRegion=new tn(new at(-1/0,-1/0,-1/0),new at(1/0,1/0,1/0)),this.init=function(e){var t=this;this.Ammo().then((function(i){n=i,t.initPhysicsWorld(),e&&e(i)}))},this.initPhysicsWorld=function(){var e=new n.btDefaultCollisionConfiguration,t=new n.btCollisionDispatcher(e),i=new n.btDbvtBroadphase,r=new n.btSequentialImpulseConstraintSolver,a=new n.btDiscreteDynamicsWorld(t,i,r,e);a.setGravity(new n.btVector3(0,-9.82,0)),this.physicsWorld=a},this.bindModels=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Array.isArray(t)||(t=[t]),t.forEach((function(t){t.traverse((function(t){t.isMesh&&e.createRigidBody(t,n)}))}))},this.createRigidBody=function(e,t){var i,a,o=e.getWorldScale(new at),s=e.getWorldPosition(new at),l=e.getWorldQuaternion(new nt);if(e.isMesh){var A=this.getMeshData(e);i=A.faces,0==(a=A.vertices).length&&console.error("no vertices to define mesh shape with"),o||(o={x:1,y:1,z:1});var c=new n.btTriangleMesh;if(r.count++,!(r.count>200)){console.log(r.count);for(var h=0,u=i.length;h0&&(this.rigidBodies.push(e),x.setActivationState(4)),this.physicsWorld.addRigidBody(x),x}}else console.error("cannot make mesh shape for non-Mesh object")},this.getMeshData=function(e){var t=null!==e.geometry.index?e.geometry.index:void 0,n=e.geometry.attributes,i=e.scale;if(void 0!==n.position){for(var r=n.position,a=[],o=[],s=0;s0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=e.getMotionState();if(a){var o=new n.btTransform;a.getWorldTransform(o);var s=o.getOrigin(),l=o.getRotation(),A=new n.btTransform;A.setIdentity(),A.setOrigin(new n.btVector3(s.x()+t,s.y()+i,s.z()+r)),A.setRotation(new n.btQuaternion(l.x(),l.y(),l.z(),l.w())),e.setCenterOfMassTransform(A)}},e._getRotation=function(){return e._getPosAndRot()[1]},e._setLinearVelocity=function(t,i,r){e.setLinearVelocity(new n.btVector3(t,i,r))}}(u),this.physicsWorld.addRigidBody(u),this.person.userData.physicsBody=u,this.person.userData.collided=!1,this.rigidBodies.push(this.person),i=function(e,t,n){var i=new AMRT.BoxGeometry(e,t,n,1,1,1),a=new AMRT.Mesh(i,new Gf);return r.viewer.scene.add(a),a}(s.x,s.y,s.z)},this.setView=function(){var e,t,i,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(void 0!==a.position&&(e=Array.isArray(a.position)?(new AMRT.Vector3).fromArray(a.position):(new AMRT.Vector3).copy(a.position),r.person.position.copy(e)),void 0!==a.rotation&&(Array.isArray(a.rotation)?r.person.rotation.fromArray(a.rotation):r.person.rotation.setFromVector3(a.rotation)),r.person.userData.physicsBody){var o=r.person.userData.physicsBody,s=o.getMotionState();if(s){var l=new n.btTransform;s.getWorldTransform(l),e||(e=l.getOrigin(),e=new AMRT.Vector3(e.x(),e.y(),e.z())),t=r.person.getWorldQuaternion(new nt);var A=new n.btTransform;A.setIdentity(),A.setOrigin(new n.btVector3(e.x,e.y,e.z)),A.setRotation(new n.btQuaternion(t.x,t.y,t.z,t.w)),o.setCenterOfMassTransform(A)}}void 0!==a.cameraDirection?(i=Array.isArray(a.cameraDirection)?(new at).fromArray(a.cameraDirection):(new at).copy(a.cameraDirection)).normalize().negate():((i=this.person.getWorldDirection(new at)).y-=.4,i.normalize().negate()),a.distance&&(N=a.distance),a.minDistance&&(z=a.minDistance),a.maxDistance&&(Q=a.maxDistance),L(i)},this.getView=function(){return{position:this.person.position.toArray(),rotation:this.person.rotation.toArray(),cameraDirection:this.camera.getWorldDirection(new at),distance:N,minDistance:z,maxDistance:Q}};var r=this,a={type:"change"},o=new Bt(0,0,0,"YXZ"),s=Math.PI/2,l=new at,A=!1,c=!1,h=!1,u=!1,d=!1,f=!1,p=performance.now(),m=new at,v=new at;new Nc;var g,y=function(){if(!0===r.enabled){var e=performance.now(),t=(e-p)/1e3;m.x-=10*m.x*t,m.z-=10*m.z*t,m.y-=10*m.y*t,v.z=Number(A)-Number(c),v.x=Number(u)-Number(h),v.y=Number(f)-Number(d),v.normalize(),A||c||h||u?((A||c)&&(m.z-=v.z*r.moveSpeed*t,r.moveForward(-m.z*t)),(h||u)&&(m.x-=v.x*r.moveSpeed*t,r.moveRight(-m.x*t)),w("run")):(r.moveForward(0),w("stop")),p=e,r.physicsWorld.stepSimulation(t,10)}}.bind(this);function w(e){if(r.person)if(e){if(e!=g)switch(e){case"run":r.person.animation.play(P);break;case"up":r.person.animation.play(D);break;case"down":r.person.animation.play(R);break;case"jump":r.person.animation.play(U);break;default:r.person.animation.stop()}}else this.person.animation.stop();g=e}function x(e,t,a){var o;a=a||e,r.person.recalculationBound();var s=r.person.position.clone();if(Math.abs(t)>0){s.addScaledVector(e,t),o=s.clone().sub(r.person.position).normalize(),t=t<0?-1:1;var l=s.clone().addScaledVector(a,t*N*1e4);if(r.person.lookAt(l),r.person.userData.physicsBody)r.person.userData.physicsBody.setLinearVelocity(new n.btVector3(o.x*r.moveSpeed,o.y*r.moveSpeed,o.z*r.moveSpeed))}if(r.person.userData.physicsBody){var A=r.person.userData.physicsBody.getMotionState();if(A){var c=new n.btTransform;A.getWorldTransform(c);var h=c.getOrigin(),u=r.person.getWorldQuaternion(new nt);r.person.position.set(h.x(),h.y(),h.z()),i.position.set(h.x(),h.y(),h.z()),i.quaternion.copy(u)}L()}}function b(e){switch(e.keyCode){case 38:case 87:A=!0;break;case 37:case 65:h=!0;break;case 40:case 83:c=!0;break;case 39:case 68:u=!0;break;case 82:d=!0;break;case 70:f=!0;break;case 32:r.jump()}}function M(e){switch(e.keyCode){case 38:case 87:A=!1;break;case 37:case 65:h=!1;break;case 40:case 83:c=!1;break;case 39:case 68:u=!1;break;case 82:d=!1;break;case 70:f=!1}}function C(e){0===e.button&&document.addEventListener(ld.MOVE,E,!1)}function B(){document.removeEventListener(ld.MOVE,E,!1)}function E(e){if(!1!==r.enabled){var t=e.movementX||e.mozMovementX||e.webkitMovementX||0,n=e.movementY||e.mozMovementY||e.webkitMovementY||0;G.set(t,n,0),0!=r.rotationAngle&&G.applyAxisAngle(new AMRT.Vector3(0,0,1),r.rotationAngle*Hh.DEG2RAD),o.setFromQuaternion(r.camera.quaternion),o.y+=G.x*r.rotateSpeed,o.x-=G.y*r.rotateSpeed,o.x=Math.max(-s,Math.min(s,o.x)),r.camera.quaternion.setFromEuler(o);var i=r.camera.getWorldDirection(new at),l=r.person.getWorldPosition(new at).clone().addScaledVector(i,-N);r.dispatchEvent(a),r.camera.position.copy(l)}}function S(e){!1!==r.enabled&&(e.deltaY<0?(--N0&&(++N>Q&&(N=Q),L()))}function T(e){r.preX=e.targetTouches[0].clientX,r.preY=e.targetTouches[0].clientY,document.addEventListener("touchmove",I,!1)}function _(){document.removeEventListener("touchmove",I,!1)}function I(e){if(!1!==r.enabled){var t=e.targetTouches[0].clientX-r.preX||0,n=e.targetTouches[0].clientY-r.preY||0;G.set(t,n,0),0!=r.rotationAngle&&G.applyAxisAngle(new AMRT.Vector3(0,0,1),r.rotationAngle*Hh.DEG2RAD),o.setFromQuaternion(r.camera.quaternion),o.y-=G.x*r.rotateSpeed,o.x-=G.y*r.rotateSpeed,o.x=Math.max(-s,Math.min(s,o.x)),r.camera.quaternion.setFromEuler(o);var i=r.camera.getWorldDirection(new at),l=r.person.getWorldPosition(new at).clone().addScaledVector(i,-N);r.dispatchEvent(a),r.camera.position.copy(l),r.preX=e.targetTouches[0].clientX,r.preY=e.targetTouches[0].clientY}}function L(e){e||(e=r.camera.getWorldDirection(new at).negate());var t=r.person.getWorldPosition(new at),n=t.clone().addScaledVector(e,N);r.camera.position.copy(n),r.camera.lookAt(t)}this.moveForward=function(e){l.setFromMatrixColumn(r.camera.matrix,2),l.y=0,l.normalize().negate(),x(l,e)},this.moveRight=function(e){l.setFromMatrixColumn(r.camera.matrix,0),l.y=0,l.normalize().negate(),x(l,-e)},new at,this.connect=function(){document.addEventListener(ld.START,C,!1),document.addEventListener(ld.END,B,!1),document.addEventListener("keydown",b,!1),document.addEventListener("keyup",M,!1),document.addEventListener("touchstart",T,!1),document.addEventListener("touchend",_,!1),document.addEventListener("wheel",S,!1)},this.disconnect=function(){document.removeEventListener(ld.START,C,!1),document.removeEventListener(ld.END,B,!1),document.removeEventListener("keydown",b,!1),document.removeEventListener("keyup",M,!1),document.removeEventListener("touchstart",T,!1),document.removeEventListener("touchend",_,!1),document.removeEventListener("wheel",S,!1)},this.rotationAngle=0;var F,k=!1;new at;var P,U,D,R,O,N,z,Q,G=new at;Object.defineProperties(this,{person:{get:function(){return O},set:function(e){(O=e).boundingBox.getSize(new at).y;var t=O.boundingSphere;N=5*t.radius,z=1*t.radius,Q=20*t.radius,O.name="threePersonControls",r.createPerson()}},distance:{get:function(){return N},set:function(e){N=e}},maxDistance:{get:function(){return Q},set:function(e){Q=e}},minDistance:{get:function(){return z},set:function(e){z=e}},enabled:{get:function(){return k},set:function(e){e=k=Boolean(e),r.viewer.controls.enabled=!e,e?(r.connect(),F=r.viewer.camera.near,r.viewer.camera.near=.1,r.viewer.camera.updateProjectionMatrix(),r.viewer.addEventListener("update",y)):(r.disconnect(),r.viewer.camera.near=F,r.viewer.camera.updateProjectionMatrix(),r.viewer.removeEventListener("update",y))}},runAnimationName:{set:function(e){P=e}},upAnimationName:{set:function(e){D=e}},downAnimationName:{set:function(e){R=e}},jumpAnimationName:{set:function(e){U=e}}})}return hP.prototype=Object.create(Je.prototype),hP.prototype.constructor=hP,e.ACESFilmicToneMapping=5,e.AMRTBasicMaterial=El,e.AMRTShadowMaterial=Sl,e.AddEquation=I,e.AddOperation=2,e.AdditiveBlending=2,e.AlphaFormat=le,e.AlwaysDepth=1,e.AlwaysStencilFunc=519,e.AmbientLight=UA,e.AmbientLightProbe=rc,e.AmmoHelper=hP,e.Anchor=Ym,e.AnimationClip=Gl,e.AnimationLoader=Zl,e.AnimationMixer=Dc,e.AnimationObjectGroup=Pc,e.AnimationUtils=_l,e.ArcCurve=rA,e.ArrayCamera=Wa,e.ArrowHelper=Rh,e.Audio=fc,e.AudioAnalyser=wc,e.AudioContext=$A,e.AudioListener=dc,e.AudioLoader=ec,e.AxesHelper=Oh,e.AxisHelper=function(e){return console.warn("AxisHelper has been renamed to AxesHelper."),new Oh(e)},e.BackSide=1,e.BasicDepthPacking=3200,e.BasicEditorTool=Nm,e.BasicModelTool=Pm,e.BasicShadowMap=0,e.BinaryTextureLoader=function(e){return console.warn("BinaryTextureLoader has been renamed to DataTextureLoader."),new ql(e)},e.Bone=_o,e.BooleanKeyframeTrack=Ul,e.BoundingBoxHelper=function(e,t){return console.warn("BoundingBoxHelper has been deprecated. Creating a BoxHelper instead."),new Lh(e,t)},e.Box2=jc,e.Box3=tn,e.Box3Helper=Fh,e.BoxBufferGeometry=ki,e.BoxGeometry=Fi,e.BoxHelper=Lh,e.BufferAttribute=zn,e.BufferGeometry=si,e.BufferGeometryLoader=QA,e.ByteType=1010,e.Cache=Xl,e.Camera=Oi,e.CameraHelper=Th,e.CameraViewMode=pp,e.CanvasRenderer=function(){console.error("CanvasRenderer has been removed")},e.CanvasTexture=ts,e.CatmullRomCurve3=cA,e.CineonToneMapping=4,e.CircleBufferGeometry=fl,e.CircleGeometry=dl,e.ClampToEdgeWrapping=j,e.Clipping=ip,e.Clock=lc,e.ClosedSplineCurve3=jh,e.Color=Fn,e.ColorKeyframeTrack=Dl,e.CompressedTexture=es,e.CompressedTextureLoader=Jl,e.ConeBufferGeometry=ul,e.ConeGeometry=hl,e.CubeCamera=Qi,e.CubeGeometry=Fi,e.CubeReflectionMapping=N,e.CubeRefractionMapping=z,e.CubeTexture=hr,e.CubeTextureLoader=eA,e.CubeUVReflectionMapping=G,e.CubeUVRefractionMapping=H,e.CubicBezierCurve=fA,e.CubicBezierCurve3=pA,e.CubicInterpolant=Ll,e.CullFaceBack=1,e.CullFaceFront=2,e.CullFaceFrontBack=3,e.CullFaceNone=0,e.Curve=nA,e.CurvePath=bA,e.CustomBlending=5,e.CylinderBufferGeometry=cl,e.CylinderGeometry=Al,e.Cylindrical=Hc,e.DataTexture=Hi,e.DataTexture2DArray=ur,e.DataTexture3D=dr,e.DataTextureLoader=ql,e.DecrementStencilOp=7683,e.DecrementWrapStencilOp=34056,e.DefaultLoadingManager=jl,e.DepthFormat=fe,e.DepthStencilFormat=pe,e.DepthTexture=ns,e.DirectionalLight=PA,e.DirectionalLightHelper=Bh,e.DirectionalLightIcon=aP,e.DirectionalLightShadow=kA,e.DiscreteInterpolant=kl,e.DodecahedronBufferGeometry=ps,e.DodecahedronGeometry=fs,e.DoubleSide=2,e.DstAlphaFactor=D,e.DstColorFactor=R,e.DynamicBufferAttribute=function(e,t){return console.warn("DynamicBufferAttribute has been removed. Use new BufferAttribute().setDynamic( true ) instead."),new zn(e,t).setDynamic(!0)},e.DynamicCopyUsage=35050,e.DynamicDrawUsage=Ye,e.DynamicReadUsage=35049,e.EdgesGeometry=ll,e.EdgesHelper=function(e,t){return console.warn("EdgesHelper has been removed. Use EdgesGeometry instead."),new jo(new ll(e.geometry),new Do({color:void 0!==t?t:16777215}))},e.EllipseCurve=iA,e.EntityFactory=Ik,e.EqualDepth=4,e.EqualStencilFunc=514,e.EquirectangularReflectionMapping=303,e.EquirectangularRefractionMapping=Q,e.Euler=Bt,e.Event=ld,e.EventDispatcher=Je,e.Exploding=Ld,e.ExtrudeBufferGeometry=Ys,e.ExtrudeBufferGeometry2=Jh,e.ExtrudeGeometry=Xs,e.ExtrudeGeometry2=Zh,e.Face3=Dn,e.Face4=function(e,t,n,i,r,a,o){return console.warn("Face4 has been removed. A Face3 will be created instead."),new Dn(e,t,n,r,a,o)},e.FaceColors=1,e.FaceNormalsHelper=xh,e.FileLoader=Kl,e.FlatShading=1,e.Float32Attribute=function(e,t){return console.warn("Float32Attribute has been removed. Use new Float32BufferAttribute() instead."),new Yn(e,t)},e.Float32BufferAttribute=Yn,e.Float64Attribute=function(e,t){return console.warn("Float64Attribute has been removed. Use new Float64BufferAttribute() instead."),new Kn(e,t)},e.Float64BufferAttribute=Kn,e.FloatType=ne,e.FlyLineTool=Om,e.Fog=to,e.FogExp2=eo,e.Font=ZA,e.FontLoader=qA,e.FreeCamera=cP,e.FrontFaceDirectionCCW=1,e.FrontFaceDirectionCW=0,e.FrontSide=0,e.Frustum=Wi,e.GISViewer=_k,e.GammaEncoding=ze,e.Geometry=Li,e.GeometryUtils=Yh,e.GreaterDepth=6,e.GreaterEqualDepth=5,e.GreaterEqualStencilFunc=518,e.GreaterStencilFunc=516,e.GridHelper=ph,e.Group=ja,e.HalfFloatType=ie,e.HemisphereLight=EA,e.HemisphereLightHelper=dh,e.HemisphereLightProbe=ic,e.IconHelper=Hk,e.IcosahedronBufferGeometry=ds,e.IcosahedronGeometry=us,e.ImageBitmapLoader=YA,e.ImageLoader=$l,e.ImageUtils=At,e.ImmediateRenderObject=Kc,e.IncrementStencilOp=7682,e.IncrementWrapStencilOp=34055,e.InstancedBufferAttribute=zA,e.InstancedBufferGeometry=NA,e.InstancedInterleavedBuffer=Oc,e.InstancedMesh=Uo,e.Int16Attribute=function(e,t){return console.warn("Int16Attribute has been removed. Use new Int16BufferAttribute() instead."),new Vn(e,t)},e.Int16BufferAttribute=Vn,e.Int32Attribute=function(e,t){return console.warn("Int32Attribute has been removed. Use new Int32BufferAttribute() instead."),new Wn(e,t)},e.Int32BufferAttribute=Wn,e.Int8Attribute=function(e,t){return console.warn("Int8Attribute has been removed. Use new Int8BufferAttribute() instead."),new Qn(e,t)},e.Int8BufferAttribute=Qn,e.IntType=1013,e.InterleavedBuffer=no,e.InterleavedBufferAttribute=io,e.Interpolant=Il,e.InterpolateDiscrete=Fe,e.InterpolateLinear=ke,e.InterpolateSmooth=Pe,e.InvertStencilOp=5386,e.JSONLoader=function(){console.error("JSONLoader has been removed.")},e.KeepStencilOp=We,e.KeyframeTrack=Pl,e.LOD=bo,e.LargeSceneLoader=dg,e.LargeSceneLoader2=kg,e.LatheBufferGeometry=rl,e.LatheGeometry=il,e.Layers=Et,e.LensFlare=function(){console.error("LensFlare has been moved to /examples/js/objects/Lensflare.js")},e.LessDepth=2,e.LessEqualDepth=3,e.LessEqualStencilFunc=515,e.LessStencilFunc=513,e.Light=BA,e.LightProbe=nc,e.LightProbeHelper=fh,e.LightShadow=SA,e.Line=Go,e.Line3=Yc,e.LineBasicMaterial=Do,e.LineCurve=mA,e.LineCurve3=vA,e.LineDashedMaterial=Bl,e.LineLoop=Wo,e.LinePieces=1,e.LineSegments=jo,e.LineStrip=0,e.LinearEncoding=Oe,e.LinearFilter=Z,e.LinearInterpolant=Fl,e.LinearMipMapLinearFilter=1008,e.LinearMipMapNearestFilter=1007,e.LinearMipmapLinearFilter=q,e.LinearMipmapNearestFilter=J,e.LinearToneMapping=1,e.Loader=Wl,e.LoaderUtils=OA,e.LoadingManager=Vl,e.LogLuvEncoding=3003,e.LoopOnce=Ie,e.LoopPingPong=2202,e.LoopRepeat=Le,e.LuminanceAlphaFormat=ue,e.LuminanceFormat=he,e.MOUSE=_,e.MapSource=Ck,e.Material=On,e.MaterialLoader=RA,e.Math=et,e.MathUtils=Hh,e.Matrix3=lt,e.Matrix4=bt,e.MaxEquation=104,e.Measure3D=Lm,e.Measure3DTool=Dm,e.Mesh=Ei,e.MeshBasicMaterial=Nn,e.MeshDepthMaterial=Ra,e.MeshDistanceMaterial=Oa,e.MeshLambertMaterial=Ml,e.MeshMatcapMaterial=Cl,e.MeshNormalMaterial=bl,e.MeshPhongMaterial=wl,e.MeshPhysicalMaterial=yl,e.MeshStandardMaterial=gl,e.MeshToonMaterial=xl,e.MinEquation=103,e.MinimapTool=AP,e.MirroredRepeatWrapping=W,e.MixOperation=1,e.MultiMaterial=Vh,e.MultiplyBlending=4,e.MultiplyOperation=0,e.NearestFilter=X,e.NearestMipMapLinearFilter=1005,e.NearestMipMapNearestFilter=1004,e.NearestMipmapLinearFilter=K,e.NearestMipmapNearestFilter=Y,e.NeverDepth=0,e.NeverStencilFunc=512,e.NoBlending=0,e.NoColors=0,e.NoToneMapping=0,e.NormalBlending=1,e.NotEqualDepth=7,e.NotEqualStencilFunc=517,e.NumberKeyframeTrack=Rl,e.Object3D=zt,e.ObjectLoader=HA,e.ObjectSpaceNormalMap=1,e.OctahedronBufferGeometry=hs,e.OctahedronGeometry=cs,e.OneFactor=F,e.OneMinusDstAlphaFactor=207,e.OneMinusDstColorFactor=209,e.OneMinusSrcAlphaFactor=U,e.OneMinusSrcColorFactor=203,e.OrthographicCamera=FA,e.PCFShadowMap=1,e.PCFSoftShadowMap=2,e.ParametricBufferGeometry=as,e.ParametricGeometry=rs,e.Particle=function(e){return console.warn("Particle has been renamed to Sprite."),new go(e)},e.ParticleBasicMaterial=function(e){return console.warn("ParticleBasicMaterial has been renamed to PointsMaterial."),new Xo(e)},e.ParticleSystem=function(e,t){return console.warn("ParticleSystem has been renamed to Points."),new qo(e,t)},e.ParticleSystemMaterial=function(e){return console.warn("ParticleSystemMaterial has been renamed to PointsMaterial."),new Xo(e)},e.Path=MA,e.PathEditor=Tm,e.PathEditorTool=Um,e.PathTween=sP,e.PerspectiveCamera=Ni,e.Plane=vn,e.PlaneBufferGeometry=$i,e.PlaneGeometry=qi,e.PlaneHelper=kh,e.PointCloud=function(e,t){return console.warn("PointCloud has been renamed to Points."),new qo(e,t)},e.PointCloudMaterial=function(e){return console.warn("PointCloudMaterial has been renamed to PointsMaterial."),new Xo(e)},e.PointLight=LA,e.PointLightHelper=lh,e.Points=qo,e.PointsMaterial=Xo,e.PolarGridHelper=mh,e.PolyhedronBufferGeometry=ss,e.PolyhedronGeometry=os,e.PositionalAudio=yc,e.PositionalAudioHelper=vh,e.PropertyBinding=kc,e.PropertyMixer=xc,e.QuadraticBezierCurve=gA,e.QuadraticBezierCurve3=yA,e.Quaternion=nt,e.QuaternionKeyframeTrack=Nl,e.QuaternionLinearInterpolant=Ol,e.REVISION=T,e.RGBADepthPacking=je,e.RGBAFormat=ce,e.RGBA_ASTC_10x10_Format=37819,e.RGBA_ASTC_10x5_Format=37816,e.RGBA_ASTC_10x6_Format=37817,e.RGBA_ASTC_10x8_Format=37818,e.RGBA_ASTC_12x10_Format=37820,e.RGBA_ASTC_12x12_Format=37821,e.RGBA_ASTC_4x4_Format=Ee,e.RGBA_ASTC_5x4_Format=37809,e.RGBA_ASTC_5x5_Format=37810,e.RGBA_ASTC_6x5_Format=37811,e.RGBA_ASTC_6x6_Format=37812,e.RGBA_ASTC_8x5_Format=37813,e.RGBA_ASTC_8x6_Format=37814,e.RGBA_ASTC_8x8_Format=37815,e.RGBA_BPTC_Format=Se,e.RGBA_ETC2_EAC_Format=_e,e.RGBA_PVRTC_2BPPV1_Format=Ce,e.RGBA_PVRTC_4BPPV1_Format=Me,e.RGBA_S3TC_DXT1_Format=ge,e.RGBA_S3TC_DXT3_Format=ye,e.RGBA_S3TC_DXT5_Format=we,e.RGBDEncoding=Ve,e.RGBEEncoding=Qe,e.RGBEFormat=de,e.RGBELoader=Nh,e.RGBFormat=Ae,e.RGBM16Encoding=He,e.RGBM7Encoding=Ge,e.RGB_ETC1_Format=Be,e.RGB_ETC2_Format=Te,e.RGB_PVRTC_2BPPV1_Format=be,e.RGB_PVRTC_4BPPV1_Format=xe,e.RGB_S3TC_DXT1_Format=ve,e.RawShaderMaterial=vl,e.Ray=dn,e.Raycaster=Nc,e.RectAreaLight=DA,e.RectAreaLightHelper=Ah,e.RedFormat=me,e.ReinhardToneMapping=2,e.RenderOrder2=Ze,e.RenderOrder3=3e3,e.RenderOrder5=Ke,e.RepeatWrapping=V,e.ReplaceStencilOp=7681,e.ReverseSubtractEquation=102,e.RingBufferGeometry=nl,e.RingGeometry=tl,e.Scene=Qt,e.SceneUtils=Kh,e.ScreenHelper=oP,e.SelectionTool=Rm,e.ShaderChunk=Xi,e.ShaderLib=Ki,e.ShaderMaterial=Ri,e.ShadowHelper=$k,e.ShadowMaterial=ml,e.Shape=CA,e.ShapeBufferGeometry=ol,e.ShapeGeometry=al,e.ShapePath=KA,e.ShapeUtils=Vs,e.ShortType=1011,e.Skeleton=To,e.SkeletonHelper=sh,e.SkinnedMesh=Bo,e.SmoothShading=2,e.Sphere=an,e.SphereBufferGeometry=el,e.SphereGeometry=$s,e.Spherical=Gc,e.SphericalHarmonics3=tc,e.SphericalReflectionMapping=305,e.Spline=Xh,e.SplineCurve=wA,e.SplineCurve3=Wh,e.SpotLight=_A,e.SpotLightHelper=nh,e.SpotLightShadow=TA,e.Sprite=go,e.SpriteMaterial=ro,e.SrcAlphaFactor=P,e.SrcAlphaSaturateFactor=210,e.SrcColorFactor=k,e.StaticCopyUsage=35046,e.StaticDrawUsage=Xe,e.StaticReadUsage=35045,e.StereoCamera=sc,e.StreamCopyUsage=35042,e.StreamDrawUsage=35040,e.StreamReadUsage=35041,e.StringKeyframeTrack=zl,e.SubtractEquation=101,e.SubtractiveBlending=3,e.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},e.TWEEN=ud,e.TangentSpaceNormalMap=0,e.TetrahedronBufferGeometry=As,e.TetrahedronGeometry=ls,e.TextBufferGeometry=qs,e.TextGeometry=Js,e.Texture=ht,e.TextureLoader=tA,e.TorusBufferGeometry=xs,e.TorusGeometry=ws,e.TorusKnotBufferGeometry=ys,e.TorusKnotGeometry=gs,e.TransFormMode=Mm,e.TransformControls=bm,e.Triangle=Tn,e.TriangleFanDrawMode=2,e.TriangleStripDrawMode=1,e.TrianglesDrawMode=0,e.TubeBufferGeometry=vs,e.TubeGeometry=ms,e.UVMapping=O,e.Uint16Attribute=function(e,t){return console.warn("Uint16Attribute has been removed. Use new Uint16BufferAttribute() instead."),new jn(e,t)},e.Uint16BufferAttribute=jn,e.Uint32Attribute=function(e,t){return console.warn("Uint32Attribute has been removed. Use new Uint32BufferAttribute() instead."),new Xn(e,t)},e.Uint32BufferAttribute=Xn,e.Uint8Attribute=function(e,t){return console.warn("Uint8Attribute has been removed. Use new Uint8BufferAttribute() instead."),new Gn(e,t)},e.Uint8BufferAttribute=Gn,e.Uint8ClampedAttribute=function(e,t){return console.warn("Uint8ClampedAttribute has been removed. Use new Uint8ClampedBufferAttribute() instead."),new Hn(e,t)},e.Uint8ClampedBufferAttribute=Hn,e.Uncharted2ToneMapping=3,e.Uniform=Rc,e.UniformsLib=Yi,e.UniformsUtils=Di,e.UnsignedByteType=$,e.UnsignedInt248Type=se,e.UnsignedIntType=te,e.UnsignedShort4444Type=re,e.UnsignedShort5551Type=ae,e.UnsignedShort565Type=oe,e.UnsignedShortType=ee,e.VSMShadowMap=3,e.Vector2=tt,e.Vector3=at,e.Vector4=ut,e.VectorKeyframeTrack=Ql,e.Vertex=function(e,t,n){return console.warn("Vertex has been removed. Use Vector3 instead."),new at(e,t,n)},e.VertexColors=2,e.VertexNormalsHelper=eh,e.VideoTexture=li,e.Viewer=Rg,e.WebGLMultisampleRenderTarget=ft,e.WebGLRenderTarget=dt,e.WebGLRenderTargetCube=Gi,e.WebGLRenderer=$a,e.WebGLUtils=Ga,e.WireframeGeometry=is,e.WireframeHelper=function(e,t){return console.warn("WireframeHelper has been removed. Use WireframeGeometry instead."),new jo(new is(e.geometry),new Do({color:void 0!==t?t:16777215}))},e.WorkerBufferAttribute=Zn,e.WrapAroundEnding=Re,e.XHRLoader=function(e){return console.warn("XHRLoader has been renamed to FileLoader."),new Kl(e)},e.ZeroCurvatureEnding=Ue,e.ZeroFactor=L,e.ZeroSlopeEnding=De,e.ZeroStencilOp=0,e._Math=et,e.sRGBEncoding=Ne,Object.defineProperty(e,"__esModule",{value:!0}),e}({});