fengmap.plugin.draw.min.js
194.3 KB
/**Released Version v3.1.5,BUILD 69,Time 1706862864775. Fengmap Javascript SDK , see: https://www.fengmap.com for details**/
!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.fengmap=i():t.fengmap=i()}(this,function(){return n=[function(D,F,t){"use strict";t.r(F);for(var e=[],Y=0;Y<256;Y++)e[Y]=(Y<16?"0":"")+Y.toString(16);var d={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0,s=4294967295*Math.random()|0;return(e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&i]+e[i>>8&255]+"-"+e[i>>16&15|64]+e[i>>24&255]+"-"+e[63&n|128]+e[n>>8&255]+"-"+e[n>>16&255]+e[n>>24&255]+e[255&s]+e[s>>8&255]+e[s>>16&255]+e[s>>24&255]).toUpperCase()},clamp:function(t,i,n){return Math.max(i,Math.min(n,t))},euclideanModulo:function(t,i){return(t%i+i)%i},mapLinear:function(t,i,n,s,e){return s+(t-i)*(e-s)/(n-i)},lerp:function(t,i,n){return(1-n)*t+n*i},smoothstep:function(t,i,n){return t<=i?0:n<=t?1:(t=(t-i)/(n-i))*t*(3-2*t)},smootherstep:function(t,i,n){return t<=i?0:n<=t?1:(t=(t-i)/(n-i))*t*t*(t*(6*t-15)+10)},randInt:function(t,i){return t+Math.floor(Math.random()*(i-t+1))},randFloat:function(t,i){return t+Math.random()*(i-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*d.DEG2RAD},radToDeg:function(t){return t*d.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,i,n,s,e){var r=Math.cos,h=Math.sin,o=r(n/2),n=h(n/2),u=r((i+s)/2),a=h((i+s)/2),f=r((i-s)/2),c=h((i-s)/2),r=r((s-i)/2),h=h((s-i)/2);"XYX"===e?t.set(o*a,n*f,n*c,o*u):"YZY"===e?t.set(n*c,o*a,n*f,o*u):"ZXZ"===e?t.set(n*f,n*c,o*a,o*u):"XZX"===e?t.set(o*a,n*h,n*r,o*u):"YXY"===e?t.set(n*r,o*a,n*h,o*u):"ZYZ"===e?t.set(n*h,n*r,o*a,o*u):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.")}};function r(t,i,n,s){this.u=t||0,this.v=i||0,this.M=n||0,this.A=void 0!==s?s:1}Object.assign(r,{slerp:function(t,i,n,s){return n.copy(t).slerp(i,s)},slerpFlat:function(t,i,n,s,e,r,h){var o,u,a,f=n[s+0],c=n[s+1],l=n[s+2],n=n[s+3],s=e[r+0],v=e[r+1],d=e[r+2],e=e[r+3];n===e&&f===s&&c===v&&l===d||(r=1-h,o=0<=(u=f*s+c*v+l*d+n*e)?1:-1,(a=1-u*u)>Number.EPSILON&&(a=Math.sqrt(a),u=Math.atan2(a,u*o),r=Math.sin(r*u)/a,h=Math.sin(h*u)/a),f=f*r+s*(u=h*o),c=c*r+v*u,l=l*r+d*u,n=n*r+e*u,r===1-h&&(f*=a=1/Math.sqrt(f*f+c*c+l*l+n*n),c*=a,l*=a,n*=a)),t[i]=f,t[i+1]=c,t[i+2]=l,t[i+3]=n}}),Object.defineProperties(r.prototype,{x:{get:function(){return this.u},set:function(t){this.u=t,this.S()}},y:{get:function(){return this.v},set:function(t){this.v=t,this.S()}},z:{get:function(){return this.M},set:function(t){this.M=t,this.S()}},w:{get:function(){return this.A},set:function(t){this.A=t,this.S()}}}),Object.assign(r.prototype,{isQuaternion:!0,set:function(t,i,n,s){return this.u=t,this.v=i,this.M=n,this.A=s,this.S(),this},clone:function(){return new this.constructor(this.u,this.v,this.M,this.A)},copy:function(t){return this.u=t.x,this.v=t.y,this.M=t.z,this.A=t.w,this.S(),this},setFromEuler:function(t,i){var n,s,e,r,h,o,u;if(t&&t.isEuler)return h=t.u,o=t.v,n=t.M,t=t.order,r=Math.cos,u=Math.sin,s=r(h/2),e=r(o/2),r=r(n/2),h=u(h/2),o=u(o/2),u=u(n/2),"XYZ"===t?(this.u=h*e*r+s*o*u,this.v=s*o*r-h*e*u,this.M=s*e*u+h*o*r,this.A=s*e*r-h*o*u):"YXZ"===t?(this.u=h*e*r+s*o*u,this.v=s*o*r-h*e*u,this.M=s*e*u-h*o*r,this.A=s*e*r+h*o*u):"ZXY"===t?(this.u=h*e*r-s*o*u,this.v=s*o*r+h*e*u,this.M=s*e*u+h*o*r,this.A=s*e*r-h*o*u):"ZYX"===t?(this.u=h*e*r-s*o*u,this.v=s*o*r+h*e*u,this.M=s*e*u-h*o*r,this.A=s*e*r+h*o*u):"YZX"===t?(this.u=h*e*r+s*o*u,this.v=s*o*r+h*e*u,this.M=s*e*u-h*o*r,this.A=s*e*r-h*o*u):"XZY"===t&&(this.u=h*e*r-s*o*u,this.v=s*o*r-h*e*u,this.M=s*e*u+h*o*r,this.A=s*e*r+h*o*u),!1!==i&&this.S(),this;throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.")},setFromAxisAngle:function(t,i){var i=i/2,n=Math.sin(i);return this.u=t.x*n,this.v=t.y*n,this.M=t.z*n,this.A=Math.cos(i),this.S(),this},setFromRotationMatrix:function(t){var i,t=t.elements,n=t[0],s=t[4],e=t[8],r=t[1],h=t[5],o=t[9],u=t[2],a=t[6],t=t[10],f=n+h+t;return 0<f?(i=.5/Math.sqrt(f+1),this.A=.25/i,this.u=(a-o)*i,this.v=(e-u)*i,this.M=(r-s)*i):h<n&&t<n?(i=2*Math.sqrt(1+n-h-t),this.A=(a-o)/i,this.u=.25*i,this.v=(s+r)/i,this.M=(e+u)/i):t<h?(i=2*Math.sqrt(1+h-n-t),this.A=(e-u)/i,this.u=(s+r)/i,this.v=.25*i,this.M=(o+a)/i):(i=2*Math.sqrt(1+t-n-h),this.A=(r-s)/i,this.u=(e+u)/i,this.v=(o+a)/i,this.M=.25*i),this.S(),this},setFromUnitVectors:function(t,i){var n=t.dot(i)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this.u=-t.y,this.v=t.x,this.M=0):(this.u=0,this.v=-t.z,this.M=t.y)):(this.u=t.y*i.z-t.z*i.y,this.v=t.z*i.x-t.x*i.z,this.M=t.x*i.y-t.y*i.x),this.A=n,this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(d.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,i){var n=this.angleTo(t);return 0!==n&&(i=Math.min(1,i/n),this.slerp(t,i)),this},inverse:function(){return this.conjugate()},conjugate:function(){return this.u*=-1,this.v*=-1,this.M*=-1,this.S(),this},dot:function(t){return this.u*t.u+this.v*t.v+this.M*t.M+this.A*t.A},lengthSq:function(){return this.u*this.u+this.v*this.v+this.M*this.M+this.A*this.A},length:function(){return Math.sqrt(this.u*this.u+this.v*this.v+this.M*this.M+this.A*this.A)},normalize:function(){var t=this.length();return 0===t?(this.u=0,this.v=0,this.M=0,this.A=1):(this.u=this.u*(t=1/t),this.v=this.v*t,this.M=this.M*t,this.A=this.A*t),this.S(),this},multiply:function(t,i){return void 0!==i?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,i)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,i){var n=t.u,s=t.v,e=t.M,t=t.A,r=i.u,h=i.v,o=i.M,i=i.A;return this.u=n*i+t*r+s*o-e*h,this.v=s*i+t*h+e*r-n*o,this.M=e*i+t*o+n*h-s*r,this.A=t*i-n*r-s*h-e*o,this.S(),this},slerp:function(t,i){if(0!==i){if(1===i)return this.copy(t);var n,s=this.u,e=this.v,r=this.M,h=this.A,o=h*t.A+s*t.u+e*t.v+r*t.M;o<0?(this.A=-t.A,this.u=-t.u,this.v=-t.v,this.M=-t.M,o=-o):this.copy(t),1<=o?(this.A=h,this.u=s,this.v=e,this.M=r):((t=1-o*o)<=Number.EPSILON?(this.A=(n=1-i)*h+i*this.A,this.u=n*s+i*this.u,this.v=n*e+i*this.v,this.M=n*r+i*this.M,this.normalize()):(n=Math.sqrt(t),t=Math.atan2(n,o),o=Math.sin((1-i)*t)/n,i=Math.sin(i*t)/n,this.A=h*o+this.A*i,this.u=s*o+this.u*i,this.v=e*o+this.v*i,this.M=r*o+this.M*i),this.S())}return this},equals:function(t){return t.u===this.u&&t.v===this.v&&t.M===this.M&&t.A===this.A},fromArray:function(t,i){return this.u=t[i=void 0===i?0:i],this.v=t[i+1],this.M=t[i+2],this.A=t[i+3],this.S(),this},toArray:function(t,i){return(t=void 0===t?[]:t)[i=void 0===i?0:i]=this.u,t[i+1]=this.v,t[i+2]=this.M,t[i+3]=this.A,t},fromBufferAttribute:function(t,i){return this.u=t.getX(i),this.v=t.getY(i),this.M=t.getZ(i),this.A=t.getW(i),this},R:function(t){return this.S=t,this},S:function(){}});var L=new g,_=new r;function g(t,i,n){this.x=t||0,this.y=i||0,this.z=n||0}Object.assign(g.prototype,{isVector3:!0,set:function(t,i,n){return this.x=t,this.y=i,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,i){return void 0!==i?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,i)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this},addScaledVector:function(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this},sub:function(t,i){return void 0!==i?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,i)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this},multiply:function(t,i){return void 0!==i?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,i)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,i){return this.x=t.x*i.x,this.y=t.y*i.y,this.z=t.z*i.z,this},applyEuler:function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(_.setFromEuler(t))},applyAxisAngle:function(t,i){return this.applyQuaternion(_.setFromAxisAngle(t,i))},applyMatrix3:function(t){var i=this.x,n=this.y,s=this.z,t=t.elements;return this.x=t[0]*i+t[3]*n+t[6]*s,this.y=t[1]*i+t[4]*n+t[7]*s,this.z=t[2]*i+t[5]*n+t[8]*s,this},applyNormalMatrix:function(t){return this.applyMatrix3(t).normalize()},applyMatrix4:function(t){var i=this.x,n=this.y,s=this.z,t=t.elements,e=1/(t[3]*i+t[7]*n+t[11]*s+t[15]);return this.x=(t[0]*i+t[4]*n+t[8]*s+t[12])*e,this.y=(t[1]*i+t[5]*n+t[9]*s+t[13])*e,this.z=(t[2]*i+t[6]*n+t[10]*s+t[14])*e,this},applyQuaternion:function(t){var i=this.x,n=this.y,s=this.z,e=t.x,r=t.y,h=t.z,t=t.w,o=t*i+r*s-h*n,u=t*n+h*i-e*s,a=t*s+e*n-r*i,i=-e*i-r*n-h*s;return this.x=o*t+i*-e+u*-h-a*-r,this.y=u*t+i*-r+a*-e-o*-h,this.z=a*t+i*-h+o*-r-u*-e,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var i=this.x,n=this.y,s=this.z,t=t.elements;return this.x=t[0]*i+t[4]*n+t[8]*s,this.y=t[1]*i+t[5]*n+t[9]*s,this.z=t[2]*i+t[6]*n+t[10]*s,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this},clampScalar:function(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this.z=Math.max(t,Math.min(i,this.z)),this},clampLength:function(t,i){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(i,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(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this},lerpVectors:function(t,i,n){return this.subVectors(i,t).multiplyScalar(n).add(t)},cross:function(t,i){return void 0!==i?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,i)):this.crossVectors(this,t)},crossVectors:function(t,i){var n=t.x,s=t.y,t=t.z,e=i.x,r=i.y,i=i.z;return this.x=s*i-t*r,this.y=t*e-n*i,this.z=n*r-s*e,this},projectOnVector:function(t){var i=t.lengthSq();return 0===i?this.set(0,0,0):(i=t.dot(this)/i,this.copy(t).multiplyScalar(i))},projectOnPlane:function(t){return L.copy(this).projectOnVector(t),this.sub(L)},reflect:function(t){return this.sub(L.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var i=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===i?Math.PI/2:(t=this.dot(t)/i,Math.acos(d.clamp(t,-1,1)))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var i=this.x-t.x,n=this.y-t.y,t=this.z-t.z;return i*i+n*n+t*t},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,i,n){var s=Math.sin(i)*t;return this.x=s*Math.sin(n),this.y=Math.cos(i)*t,this.z=s*Math.cos(n),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,i,n){return this.x=t*Math.sin(i),this.y=n,this.z=t*Math.cos(i),this},setFromMatrixPosition:function(t){t=t.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(t){var i=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),t=this.setFromMatrixColumn(t,2).length();return this.x=i,this.y=n,this.z=t,this},setFromMatrixColumn:function(t,i){return this.fromArray(t.elements,4*i)},setFromMatrix3Column:function(t,i){return this.fromArray(t.elements,3*i)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,i){return this.x=t[i=void 0===i?0:i],this.y=t[i+1],this.z=t[i+2],this},toArray:function(t,i){return(t=void 0===t?[]:t)[i=void 0===i?0:i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t},fromBufferAttribute:function(t,i,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(i),this.y=t.getY(i),this.z=t.getZ(i),this}});var u=new g,a=new y,H=new g(0,0,0),N=new g(1,1,1),h=new g,U=new g,o=new g;function y(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function G(){this.type="Curve",this.arcLengthDivisions=200}function E(t,i){this.x=t||0,this.y=i||0}function s(t,i,n,s,e,r,h,o){G.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=i||0,this.xRadius=n||1,this.yRadius=s||1,this.aStartAngle=e||0,this.aEndAngle=r||2*Math.PI,this.aClockwise=h||!1,this.aRotation=o||0}Object.assign(y.prototype,{isMatrix4:!0,set:function(t,i,n,s,e,r,h,o,u,a,f,c,l,v,d,y){var p=this.elements;return p[0]=t,p[4]=i,p[8]=n,p[12]=s,p[1]=e,p[5]=r,p[9]=h,p[13]=o,p[2]=u,p[6]=a,p[10]=f,p[14]=c,p[3]=l,p[7]=v,p[11]=d,p[15]=y,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 y).fromArray(this.elements)},copy:function(t){var i=this.elements,t=t.elements;return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],this},copyPosition:function(t){var i=this.elements,t=t.elements;return i[12]=t[12],i[13]=t[13],i[14]=t[14],this},extractBasis:function(t,i,n){return t.setFromMatrixColumn(this,0),i.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,i,n){return this.set(t.x,i.x,n.x,0,t.y,i.y,n.y,0,t.z,i.z,n.z,0,0,0,0,1),this},extractRotation:function(t){var i=this.elements,n=t.elements,s=1/u.setFromMatrixColumn(t,0).length(),e=1/u.setFromMatrixColumn(t,1).length(),t=1/u.setFromMatrixColumn(t,2).length();return i[0]=n[0]*s,i[1]=n[1]*s,i[2]=n[2]*s,i[3]=0,i[4]=n[4]*e,i[5]=n[5]*e,i[6]=n[6]*e,i[7]=0,i[8]=n[8]*t,i[9]=n[9]*t,i[10]=n[10]*t,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this},makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var i,n,s,e,r,h,o,u,a,f,c,l,v=this.elements,d=t.x,y=t.y,p=t.z,m=Math.cos(d),d=Math.sin(d),b=Math.cos(y),y=Math.sin(y),M=Math.cos(p),p=Math.sin(p);return"XYZ"===t.order?(r=m*M,h=m*p,o=d*M,u=d*p,v[0]=b*M,v[4]=-b*p,v[8]=y,v[1]=h+o*y,v[5]=r-u*y,v[9]=-d*b,v[2]=u-r*y,v[6]=o+h*y,v[10]=m*b):"YXZ"===t.order?(n=b*p,s=y*M,v[0]=(i=b*M)+(e=y*p)*d,v[4]=s*d-n,v[8]=m*y,v[1]=m*p,v[5]=m*M,v[9]=-d,v[2]=n*d-s,v[6]=e+i*d,v[10]=m*b):"ZXY"===t.order?(n=b*p,s=y*M,v[0]=(i=b*M)-(e=y*p)*d,v[4]=-m*p,v[8]=s+n*d,v[1]=n+s*d,v[5]=m*M,v[9]=e-i*d,v[2]=-m*y,v[6]=d,v[10]=m*b):"ZYX"===t.order?(r=m*M,h=m*p,o=d*M,u=d*p,v[0]=b*M,v[4]=o*y-h,v[8]=r*y+u,v[1]=b*p,v[5]=u*y+r,v[9]=h*y-o,v[2]=-y,v[6]=d*b,v[10]=m*b):"YZX"===t.order?(a=m*b,f=m*y,c=d*b,l=d*y,v[0]=b*M,v[4]=l-a*p,v[8]=c*p+f,v[1]=p,v[5]=m*M,v[9]=-d*M,v[2]=-y*M,v[6]=f*p+c,v[10]=a-l*p):"XZY"===t.order&&(a=m*b,f=m*y,c=d*b,l=d*y,v[0]=b*M,v[4]=-p,v[8]=y*M,v[1]=a*p+l,v[5]=m*M,v[9]=f*p-c,v[2]=c*p-f,v[6]=d*M,v[10]=l*p+a),v[3]=0,v[7]=0,v[11]=0,v[12]=0,v[13]=0,v[14]=0,v[15]=1,this},makeRotationFromQuaternion:function(t){return this.compose(H,t,N)},lookAt:function(t,i,n){var s=this.elements;return o.subVectors(t,i),0===o.lengthSq()&&(o.z=1),o.normalize(),h.crossVectors(n,o),0===h.lengthSq()&&(1===Math.abs(n.z)?o.x+=1e-4:o.z+=1e-4,o.normalize(),h.crossVectors(n,o)),h.normalize(),U.crossVectors(o,h),s[0]=h.x,s[4]=U.x,s[8]=o.x,s[1]=h.y,s[5]=U.y,s[9]=o.y,s[2]=h.z,s[6]=U.z,s[10]=o.z,this},multiply:function(t,i){return void 0!==i?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,i)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,i){var t=t.elements,i=i.elements,n=this.elements,s=t[0],e=t[4],r=t[8],h=t[12],o=t[1],u=t[5],a=t[9],f=t[13],c=t[2],l=t[6],v=t[10],d=t[14],y=t[3],p=t[7],m=t[11],t=t[15],b=i[0],M=i[4],g=i[8],A=i[12],w=i[1],E=i[5],S=i[9],R=i[13],j=i[2],x=i[6],O=i[10],T=i[14],k=i[3],B=i[7],I=i[11],i=i[15];return n[0]=s*b+e*w+r*j+h*k,n[4]=s*M+e*E+r*x+h*B,n[8]=s*g+e*S+r*O+h*I,n[12]=s*A+e*R+r*T+h*i,n[1]=o*b+u*w+a*j+f*k,n[5]=o*M+u*E+a*x+f*B,n[9]=o*g+u*S+a*O+f*I,n[13]=o*A+u*R+a*T+f*i,n[2]=c*b+l*w+v*j+d*k,n[6]=c*M+l*E+v*x+d*B,n[10]=c*g+l*S+v*O+d*I,n[14]=c*A+l*R+v*T+d*i,n[3]=y*b+p*w+m*j+t*k,n[7]=y*M+p*E+m*x+t*B,n[11]=y*g+p*S+m*O+t*I,n[15]=y*A+p*R+m*T+t*i,this},multiplyScalar:function(t){var i=this.elements;return i[0]*=t,i[4]*=t,i[8]*=t,i[12]*=t,i[1]*=t,i[5]*=t,i[9]*=t,i[13]*=t,i[2]*=t,i[6]*=t,i[10]*=t,i[14]*=t,i[3]*=t,i[7]*=t,i[11]*=t,i[15]*=t,this},determinant:function(){var t=this.elements,i=t[0],n=t[4],s=t[8],e=t[12],r=t[1],h=t[5],o=t[9],u=t[13],a=t[2],f=t[6],c=t[10],l=t[14];return t[3]*(+e*o*f-s*u*f-e*h*c+n*u*c+s*h*l-n*o*l)+t[7]*(+i*o*l-i*u*c+e*r*c-s*r*l+s*u*a-e*o*a)+t[11]*(+i*u*f-i*h*l-e*r*f+n*r*l+e*h*a-n*u*a)+t[15]*(-s*h*a-i*o*f+i*h*c+s*r*f-n*r*c+n*o*a)},transpose:function(){var t=this.elements,i=t[1];return t[1]=t[4],t[4]=i,i=t[2],t[2]=t[8],t[8]=i,i=t[6],t[6]=t[9],t[9]=i,i=t[3],t[3]=t[12],t[12]=i,i=t[7],t[7]=t[13],t[13]=i,i=t[11],t[11]=t[14],t[14]=i,this},setPosition:function(t,i,n){var s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=i,s[14]=n),this},getInverse:function(t,i){void 0!==i&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var i=this.elements,t=t.elements,n=t[0],s=t[1],e=t[2],r=t[3],h=t[4],o=t[5],u=t[6],a=t[7],f=t[8],c=t[9],l=t[10],v=t[11],d=t[12],y=t[13],p=t[14],t=t[15],m=c*p*a-y*l*a+y*u*v-o*p*v-c*u*t+o*l*t,b=d*l*a-f*p*a-d*u*v+h*p*v+f*u*t-h*l*t,M=f*y*a-d*c*a+d*o*v-h*y*v-f*o*t+h*c*t,g=d*c*u-f*y*u-d*o*l+h*y*l+f*o*p-h*c*p,A=n*m+s*b+e*M+r*g;return 0==A?this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0):(i[0]=m*(m=1/A),i[1]=(y*l*r-c*p*r-y*e*v+s*p*v+c*e*t-s*l*t)*m,i[2]=(o*p*r-y*u*r+y*e*a-s*p*a-o*e*t+s*u*t)*m,i[3]=(c*u*r-o*l*r-c*e*a+s*l*a+o*e*v-s*u*v)*m,i[4]=b*m,i[5]=(f*p*r-d*l*r+d*e*v-n*p*v-f*e*t+n*l*t)*m,i[6]=(d*u*r-h*p*r-d*e*a+n*p*a+h*e*t-n*u*t)*m,i[7]=(h*l*r-f*u*r+f*e*a-n*l*a-h*e*v+n*u*v)*m,i[8]=M*m,i[9]=(d*c*r-f*y*r-d*s*v+n*y*v+f*s*t-n*c*t)*m,i[10]=(h*y*r-d*o*r+d*s*a-n*y*a-h*s*t+n*o*t)*m,i[11]=(f*o*r-h*c*r-f*s*a+n*c*a+h*s*v-n*o*v)*m,i[12]=g*m,i[13]=(f*y*e-d*c*e+d*s*l-n*y*l-f*s*p+n*c*p)*m,i[14]=(d*o*e-h*y*e-d*s*u+n*y*u+h*s*p-n*o*p)*m,i[15]=(h*c*e-f*o*e+f*s*u-n*c*u-h*s*l+n*o*l)*m,this)},invert:function(){var t=this.elements,i=t[0],n=t[1],s=t[2],e=t[3],r=t[4],h=t[5],o=t[6],u=t[7],a=t[8],f=t[9],c=t[10],l=t[11],v=t[12],d=t[13],y=t[14],p=t[15],m=f*y*u-d*c*u+d*o*l-h*y*l-f*o*p+h*c*p,b=v*c*u-a*y*u-v*o*l+r*y*l+a*o*p-r*c*p,M=a*d*u-v*f*u+v*h*l-r*d*l-a*h*p+r*f*p,g=v*f*o-a*d*o-v*h*c+r*d*c+a*h*y-r*f*y,A=i*m+n*b+s*M+e*g;return 0==A?this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0):(t[0]=m*(m=1/A),t[1]=(d*c*e-f*y*e-d*s*l+n*y*l+f*s*p-n*c*p)*m,t[2]=(h*y*e-d*o*e+d*s*u-n*y*u-h*s*p+n*o*p)*m,t[3]=(f*o*e-h*c*e-f*s*u+n*c*u+h*s*l-n*o*l)*m,t[4]=b*m,t[5]=(a*y*e-v*c*e+v*s*l-i*y*l-a*s*p+i*c*p)*m,t[6]=(v*o*e-r*y*e-v*s*u+i*y*u+r*s*p-i*o*p)*m,t[7]=(r*c*e-a*o*e+a*s*u-i*c*u-r*s*l+i*o*l)*m,t[8]=M*m,t[9]=(v*f*e-a*d*e-v*n*l+i*d*l+a*n*p-i*f*p)*m,t[10]=(r*d*e-v*h*e+v*n*u-i*d*u-r*n*p+i*h*p)*m,t[11]=(a*h*e-r*f*e-a*n*u+i*f*u+r*n*l-i*h*l)*m,t[12]=g*m,t[13]=(a*d*s-v*f*s+v*n*c-i*d*c-a*n*y+i*f*y)*m,t[14]=(v*h*s-r*d*s-v*n*o+i*d*o+r*n*y-i*h*y)*m,t[15]=(r*f*s-a*h*s+a*n*o-i*f*o-r*n*c+i*h*c)*m,this)},scale:function(t){var i=this.elements,n=t.x,s=t.y,t=t.z;return i[0]*=n,i[4]*=s,i[8]*=t,i[1]*=n,i[5]*=s,i[9]*=t,i[2]*=n,i[6]*=s,i[10]*=t,i[3]*=n,i[7]*=s,i[11]*=t,this},getMaxScaleOnAxis:function(){var t=this.elements,i=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(i,n,t))},makeTranslation:function(t,i,n){return this.set(1,0,0,t,0,1,0,i,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var i=Math.cos(t),t=Math.sin(t);return this.set(1,0,0,0,0,i,-t,0,0,t,i,0,0,0,0,1),this},makeRotationY:function(t){var i=Math.cos(t),t=Math.sin(t);return this.set(i,0,t,0,0,1,0,0,-t,0,i,0,0,0,0,1),this},makeRotationZ:function(t){var i=Math.cos(t),t=Math.sin(t);return this.set(i,-t,0,0,t,i,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,i){var n=Math.cos(i),i=Math.sin(i),s=1-n,e=t.x,r=t.y,t=t.z,h=s*e,o=s*r;return this.set(h*e+n,h*r-i*t,h*t+i*r,0,h*r+i*t,o*r+n,o*t-i*e,0,h*t-i*r,o*t+i*e,s*t*t+n,0,0,0,0,1),this},makeScale:function(t,i,n){return this.set(t,0,0,0,0,i,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,i,n){return this.set(1,i,n,0,t,1,n,0,t,i,1,0,0,0,0,1),this},compose:function(t,i,n){var s=this.elements,e=i.u,r=i.v,h=i.M,i=i.A,o=e+e,u=r+r,a=h+h,f=e*o,c=e*u,e=e*a,l=r*u,r=r*a,h=h*a,o=i*o,u=i*u,i=i*a,a=n.x,v=n.y,n=n.z;return s[0]=(1-(l+h))*a,s[1]=(c+i)*a,s[2]=(e-u)*a,s[3]=0,s[4]=(c-i)*v,s[5]=(1-(f+h))*v,s[6]=(r+o)*v,s[7]=0,s[8]=(e+u)*n,s[9]=(r-o)*n,s[10]=(1-(f+l))*n,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this},decompose:function(t,i,n){var s=this.elements,e=u.set(s[0],s[1],s[2]).length(),r=u.set(s[4],s[5],s[6]).length(),h=u.set(s[8],s[9],s[10]).length(),t=(this.determinant()<0&&(e=-e),t.x=s[12],t.y=s[13],t.z=s[14],a.copy(this),1/e),s=1/r,o=1/h;return a.elements[0]*=t,a.elements[1]*=t,a.elements[2]*=t,a.elements[4]*=s,a.elements[5]*=s,a.elements[6]*=s,a.elements[8]*=o,a.elements[9]*=o,a.elements[10]*=o,i.setFromRotationMatrix(a),n.x=e,n.y=r,n.z=h,this},makePerspective:function(t,i,n,s,e,r){void 0===r&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var h=this.elements,o=2*e/(n-s),u=(i+t)/(i-t),n=(n+s)/(n-s),s=-(r+e)/(r-e),r=-2*r*e/(r-e);return h[0]=2*e/(i-t),h[4]=0,h[8]=u,h[12]=0,h[1]=0,h[5]=o,h[9]=n,h[13]=0,h[2]=0,h[6]=0,h[10]=s,h[14]=r,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this},makeOrthographic:function(t,i,n,s,e,r){var h=this.elements,o=1/(i-t),u=1/(n-s),a=1/(r-e),i=(i+t)*o,t=(n+s)*u,n=(r+e)*a;return h[0]=2*o,h[4]=0,h[8]=0,h[12]=-i,h[1]=0,h[5]=2*u,h[9]=0,h[13]=-t,h[2]=0,h[6]=0,h[10]=-2*a,h[14]=-n,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this},equals:function(t){for(var i=this.elements,n=t.elements,s=0;s<16;s++)if(i[s]!==n[s])return!1;return!0},fromArray:function(t,i){void 0===i&&(i=0);for(var n=0;n<16;n++)this.elements[n]=t[n+i];return this},toArray:function(t,i){var n=this.elements;return(t=void 0===t?[]:t)[i=void 0===i?0:i]=n[0],t[i+1]=n[1],t[i+2]=n[2],t[i+3]=n[3],t[i+4]=n[4],t[i+5]=n[5],t[i+6]=n[6],t[i+7]=n[7],t[i+8]=n[8],t[i+9]=n[9],t[i+10]=n[10],t[i+11]=n[11],t[i+12]=n[12],t[i+13]=n[13],t[i+14]=n[14],t[i+15]=n[15],t}}),Object.assign(G.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,i){t=this.getUtoTmapping(t);return this.getPoint(t,i)},getPoints:function(t){void 0===t&&(t=5);for(var i=[],n=0;n<=t;n++)i.push(this.getPoint(n/t));return i},getSpacedPoints:function(t){void 0===t&&(t=5);for(var i=[],n=0;n<=t;n++)i.push(this.getPointAt(n/t));return i},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var i,n,s=[],e=this.getPoint(0),r=0;for(s.push(0),n=1;n<=t;n++)r+=(i=this.getPoint(n/t)).distanceTo(e),s.push(r),e=i;return this.cacheArcLengths=s},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,i){for(var n,s=this.getLengths(),e=0,r=s.length,h=i||t*s[r-1],o=0,u=r-1;o<=u;)if((n=s[e=Math.floor(o+(u-o)/2)]-h)<0)o=e+1;else{if(!(0<n)){u=e;break}u=e-1}return s[e=u]===h?e/(r-1):(e+(h-(i=s[e]))/(s[e+1]-i))/(r-1)},getTangent:function(t){var i=t-1e-4,t=t+1e-4,i=(1<t&&(t=1),this.getPoint(i=i<0?0:i));return this.getPoint(t).clone().sub(i).normalize()},getTangentAt:function(t){t=this.getUtoTmapping(t);return this.getTangent(t)},computeFrenetFrames:function(t,i){for(var n,s=new g,e=[],r=[],h=[],o=new g,u=new y,a=0;a<=t;a++)e[a]=this.getTangentAt(a/t),e[a].normalize();r[0]=new g,h[0]=new g;var f=Number.MAX_VALUE,c=Math.abs(e[0].x),l=Math.abs(e[0].y),v=Math.abs(e[0].z);for(c<=f&&(f=c,s.set(1,0,0)),l<=f&&(f=l,s.set(0,1,0)),v<=f&&s.set(0,0,1),o.crossVectors(e[0],s).normalize(),r[0].crossVectors(e[0],o),h[0].crossVectors(e[0],r[0]),a=1;a<=t;a++)r[a]=r[a-1].clone(),h[a]=h[a-1].clone(),o.crossVectors(e[a-1],e[a]),o.length()>Number.EPSILON&&(o.normalize(),n=Math.acos(d.clamp(e[a-1].dot(e[a]),-1,1)),r[a].applyMatrix4(u.makeRotationAxis(o,n))),h[a].crossVectors(e[a],r[a]);if(!0===i)for(n=Math.acos(d.clamp(r[0].dot(r[t]),-1,1)),n/=t,0<e[0].dot(o.crossVectors(r[0],r[t]))&&(n=-n),a=1;a<=t;a++)r[a].applyMatrix4(u.makeRotationAxis(e[a],n*a)),h[a].crossVectors(e[a],r[a]);return{tangents:e,normals:r,binormals:h}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Object.defineProperties(E.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(E.prototype,{isVector2:!0,set:function(t,i){return this.x=t,this.y=i,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,i){return void 0!==i?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,i)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this},addScaledVector:function(t,i){return this.x+=t.x*i,this.y+=t.y*i,this},sub:function(t,i){return void 0!==i?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,i)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var i=this.x,n=this.y,t=t.elements;return this.x=t[0]*i+t[3]*n+t[6],this.y=t[1]*i+t[4]*n+t[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this},clampScalar:function(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this},clampLength:function(t,i){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(i,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(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var i=this.x-t.x,t=this.y-t.y;return i*i+t*t},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this},lerpVectors:function(t,i,n){return this.subVectors(i,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,i){return this.x=t[i=void 0===i?0:i],this.y=t[i+1],this},toArray:function(t,i){return(t=void 0===t?[]:t)[i=void 0===i?0:i]=this.x,t[i+1]=this.y,t},fromBufferAttribute:function(t,i,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(i),this.y=t.getY(i),this},rotateAround:function(t,i){var n=Math.cos(i),i=Math.sin(i),s=this.x-t.x,e=this.y-t.y;return this.x=s*n-e*i+t.x,this.y=s*i+e*n+t.y,this}}),((s.prototype=Object.create(G.prototype)).constructor=s).prototype.isEllipseCurve=!0,s.prototype.getPoint=function(t,i){for(var i=i||new E,n=2*Math.PI,s=this.aEndAngle-this.aStartAngle,e=Math.abs(s)<Number.EPSILON;s<0;)s+=n;for(;n<s;)s-=n;s<Number.EPSILON&&(s=e?0:n),!0!==this.aClockwise||e||(s===n?s=-n:s-=n);var r,h,o,u,e=this.aStartAngle+t*s,t=this.aX+this.xRadius*Math.cos(e),e=this.aY+this.yRadius*Math.sin(e);return 0!==this.aRotation&&(r=Math.cos(this.aRotation),h=Math.sin(this.aRotation),t=(o=t-this.aX)*r-(u=e-this.aY)*h+this.aX,e=o*h+u*r+this.aY),i.set(t,e)},s.prototype.copy=function(t){return G.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this};var X={FULL:0,DOTTED:2,DOT_DASH:4,CENTER:8,DASH:16,DOUBLE_DOT_DASH:32,TRI_DOT_DASH:64,FMARROW:128,ARROW:256},f=new g,Z=new g,z=new g,c=new g,Q=new g,J=new g,W=new g;function q(t,i){this.origin=void 0!==t?t:new g,this.direction=void 0!==i?i:new g(0,0,-1)}function K(){this.mask=1}function $(t,i,n,s){this.ray=new q(t,i),this.near=n||0,this.far=s||1/0,this.camera=null,this.layers=new K,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function tt(t,i){return t.distance-i.distance}function it(t,i,n,s){if(t.layers.test(i.layers)&&t.raycast(i,n),!0===s)for(var e=t.children,r=0,h=e.length;r<h;r++)it(e[r],i,n,!0)}Object.assign(q.prototype,{set:function(t,i){return this.origin.copy(t),this.direction.copy(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,i){return void 0===i&&(console.warn("THREE.Ray: .at() target is now required"),i=new g),i.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(t){return this.origin.copy(this.at(t,f)),this},closestPointToPoint:function(t,i){void 0===i&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),i=new g),i.subVectors(t,this.origin);t=i.dot(this.direction);return t<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(t).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(t){var i=f.subVectors(t,this.origin).dot(this.direction);return(i<0?this.origin:(f.copy(this.direction).multiplyScalar(i).add(this.origin),f)).distanceToSquared(t)},distanceSqToSegment:function(t,i,n,s){Z.copy(t).add(i).multiplyScalar(.5),z.copy(i).sub(t).normalize(),c.copy(this.origin).sub(Z);var e,r,h,t=.5*t.distanceTo(i),i=-this.direction.dot(z),o=c.dot(this.direction),u=-c.dot(z),a=c.lengthSq(),f=Math.abs(1-i*i);return f=0<f?(r=i*o-u,h=t*f,0<=(e=i*u-o)?-h<=r?r<=h?(e*=f=1/f)*(e+i*(r*=f)+2*o)+r*(i*e+r+2*u)+a:(r=t,-(e=Math.max(0,-(i*r+o)))*e+r*(r+2*u)+a):(r=-t,-(e=Math.max(0,-(i*r+o)))*e+r*(r+2*u)+a):r<=-h?-(e=Math.max(0,-(-i*t+o)))*e+(r=0<e?-t:Math.min(Math.max(-t,-u),t))*(r+2*u)+a:r<=h?(e=0,(r=Math.min(Math.max(-t,-u),t))*(r+2*u)+a):-(e=Math.max(0,-(i*t+o)))*e+(r=0<e?t:Math.min(Math.max(-t,-u),t))*(r+2*u)+a):(r=0<i?-t:t,-(e=Math.max(0,-(i*r+o)))*e+r*(r+2*u)+a),n&&n.copy(this.direction).multiplyScalar(e).add(this.origin),s&&s.copy(z).multiplyScalar(r).add(Z),f},intersectSphere:function(t,i){f.subVectors(t.center,this.origin);var n=f.dot(this.direction),s=f.dot(f)-n*n,t=t.radius*t.radius;return t<s||(s=n+(t=Math.sqrt(t-s)),(n=n-t)<0&&s<0)?null:n<0?this.at(s,i):this.at(n,i)},intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var i=t.normal.dot(this.direction);return 0===i?0===t.distanceToPoint(this.origin)?0:null:0<=(t=-(this.origin.dot(t.normal)+t.constant)/i)?t:null},intersectPlane:function(t,i){t=this.distanceToPlane(t);return null===t?null:this.at(t,i)},intersectsPlane:function(t){var i=t.distanceToPoint(this.origin);return 0===i||t.normal.dot(this.direction)*i<0},intersectBox:function(t,i){var n,s,e,r=1/this.direction.x,h=1/this.direction.y,o=1/this.direction.z,u=this.origin,r=0<=r?(n=(t.min.x-u.x)*r,(t.max.x-u.x)*r):(n=(t.max.x-u.x)*r,(t.min.x-u.x)*r),h=0<=h?(e=(t.min.y-u.y)*h,(t.max.y-u.y)*h):(e=(t.max.y-u.y)*h,(t.min.y-u.y)*h);return h<n||r<e||((n<e||n!=n)&&(n=e),(h<r||r!=r)&&(r=h),(e=0<=o?(s=(t.min.z-u.z)*o,(t.max.z-u.z)*o):(s=(t.max.z-u.z)*o,(t.min.z-u.z)*o))<n)||r<s||((n<s||n!=n)&&(n=s),(r=e<r||r!=r?e:r)<0)?null:this.at(0<=n?n:r,i)},intersectsBox:function(t){return null!==this.intersectBox(t,f)},intersectTriangle:function(t,i,n,s,e){Q.subVectors(i,t),J.subVectors(n,t),W.crossVectors(Q,J);var r,i=this.direction.dot(W);if(0<i){if(s)return null;r=1}else{if(!(i<0))return null;r=-1,i=-i}c.subVectors(this.origin,t);n=r*this.direction.dot(J.crossVectors(c,J));return n<0||(s=r*this.direction.dot(Q.cross(c)))<0||i<n+s||(t=-r*c.dot(W))<0?null:this.at(t/i,e)},applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(K.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},enableAll:function(){this.mask=-1},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},disableAll:function(){this.mask=0},test:function(t){return 0!=(this.mask&t.mask)}}),Object.assign($.prototype,{set:function(t,i){this.ray.set(t,i)},setFromCamera:function(t,i){i&&i.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(i.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(i).sub(this.ray.origin).normalize(),this.camera=i):i&&i.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(i.near+i.far)/(i.near-i.far)).unproject(i),this.ray.direction.set(0,0,-1).transformDirection(i.matrixWorld),this.camera=i):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,i,n){n=n||[];return it(t,this,n,i),n.sort(tt),n},intersectObjects:function(t,i,n){var s=n||[];if(!1===Array.isArray(t))console.warn("THREE.Raycaster.intersectObjects: objects is not an Array.");else{for(var e=0,r=t.length;e<r;e++)it(t[e],this,s,i);s.sort(tt)}return s}});var nt={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},l={h:0,s:0,l:0},st={h:0,s:0,l:0};function v(t,i,n){return void 0===i&&void 0===n?this.set(t):this.setRGB(t,i,n)}function et(t,i,n){return n<0&&(n+=1),1<n&&--n,n<1/6?t+6*(i-t)*n:n<.5?i:n<2/3?t+6*(i-t)*(2/3-n):t}function rt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ht(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}Object.assign(v.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,i,n){return this.r=t,this.g=i,this.b=n,this},setHSL:function(t,i,n){return t=d.euclideanModulo(t,1),i=d.clamp(i,0,1),n=d.clamp(n,0,1),0===i?this.r=this.g=this.b=n:(this.r=et(i=2*n-(n=n<=.5?n*(1+i):n+i-n*i),n,t+1/3),this.g=et(i,n,t),this.b=et(i,n,t-1/3)),this},setStyle:function(i){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+i+" will be ignored.")}if(u=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(i)){var n,s,e,r,h=u[1],o=u[2];switch(h){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return s=parseFloat(n[1])/360,e=parseInt(n[2],10)/100,r=parseInt(n[3],10)/100,t(n[5]),this.setHSL(s,e,r)}}else if(u=/^\#([A-Fa-f0-9]+)$/.exec(i)){var h=u[1],u=h.length;if(3===u)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}return i&&0<i.length?this.setColorName(i):this},setColorName:function(t){var i=nt[t];return void 0!==i?this.setHex(i):console.warn("THREE.Color: Unknown color "+t),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,i){return void 0===i&&(i=2),this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},copyLinearToGamma:function(t,i){i=0<(i=void 0===i?2:i)?1/i:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(t){return this.r=rt(t.r),this.g=rt(t.g),this.b=rt(t.b),this},copyLinearToSRGB:function(t){return this.r=ht(t.r),this.g=ht(t.g),this.b=ht(t.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var i,n=this.r,s=this.g,e=this.b,r=Math.max(n,s,e),h=Math.min(n,s,e),o=(h+r)/2;if(h===r)a=i=0;else{var u=r-h,a=o<=.5?u/(r+h):u/(2-r-h);switch(r){case n:i=(s-e)/u+(s<e?6:0);break;case s:i=(e-n)/u+2;break;case e:i=(n-s)/u+4}i/=6}return t.h=i,t.s=a,t.l=o,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,i,n){return this.getHSL(l),l.h+=t,l.s+=i,l.l+=n,this.setHSL(l.h,l.s,l.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,i){return this.r=t.r+i.r,this.g=t.g+i.g,this.b=t.b+i.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,i){return this.r+=(t.r-this.r)*i,this.g+=(t.g-this.g)*i,this.b+=(t.b-this.b)*i,this},lerpHSL:function(t,i){this.getHSL(l),t.getHSL(st);var t=d.lerp(l.h,st.h,i),n=d.lerp(l.s,st.s,i),i=d.lerp(l.l,st.l,i);return this.setHSL(t,n,i),this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,i){return this.r=t[i=void 0===i?0:i],this.g=t[i+1],this.b=t[i+2],this},toArray:function(t,i){return(t=void 0===t?[]:t)[i=void 0===i?0:i]=this.r,t[i+1]=this.g,t[i+2]=this.b,t}}),v.NAMES=nt;var i=[new g,new g,new g,new g,new g,new g,new g,new g],ot=new g,ut=new M,at=new g,ft=new g,ct=new g,n=new g,p=new g,m=new g,lt=new g,vt=new g,dt=new g,b=new g;function M(t,i){this.min=void 0!==t?t:new g(1/0,1/0,1/0),this.max=void 0!==i?i:new g(-1/0,-1/0,-1/0)}function yt(t,i,n,s,e){for(var r=0,h=t.length-3;r<=h;r+=3){b.fromArray(t,r);var o=e.x*Math.abs(b.x)+e.y*Math.abs(b.y)+e.z*Math.abs(b.z),u=i.dot(b),a=n.dot(b),f=s.dot(b);if(Math.max(-Math.max(u,a,f),Math.min(u,a,f))>o)return!1}return!0}function pt(){}function mt(t,i,n,s){this.x=t||0,this.y=i||0,this.z=n||0,this.w=void 0!==s?s:1}Object.assign(M.prototype,{isBox3:!0,set:function(t,i){return this.min.copy(t),this.max.copy(i),this},setFromArray:function(t){for(var i=1/0,n=1/0,s=1/0,e=-1/0,r=-1/0,h=-1/0,o=0,u=t.length;o<u;o+=3){var a=t[o],f=t[o+1],c=t[o+2];a<i&&(i=a),f<n&&(n=f),c<s&&(s=c),e<a&&(e=a),r<f&&(r=f),h<c&&(h=c)}return this.min.set(i,n,s),this.max.set(e,r,h),this},setFromBufferAttribute:function(t){for(var i=1/0,n=1/0,s=1/0,e=-1/0,r=-1/0,h=-1/0,o=0,u=t.count;o<u;o++){var a=t.getX(o),f=t.getY(o),c=t.getZ(o);a<i&&(i=a),f<n&&(n=f),c<s&&(s=c),e<a&&(e=a),r<f&&(r=f),h<c&&(h=c)}return this.min.set(i,n,s),this.max.set(e,r,h),this},setFromPoints:function(t){this.makeEmpty();for(var i=0,n=t.length;i<n;i++)this.expandByPoint(t[i]);return this},setFromCenterAndSize:function(t,i){i=ot.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new g),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new g),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(t){t.updateWorldMatrix(!1,!1);for(var i=t.geometry,n=(void 0!==i&&(null===i.boundingBox&&i.computeBoundingBox(),ut.copy(i.boundingBox),ut.applyMatrix4(t.matrixWorld),this.union(ut)),t.children),s=0,e=n.length;s<e;s++)this.expandByObject(n[s]);return this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,i){return void 0===i&&(console.warn("THREE.Box3: .getParameter() target is now required"),i=new g),i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(t){return this.clampPoint(t.center,ot),ot.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var i,n=0<t.normal.x?(i=t.normal.x*this.min.x,t.normal.x*this.max.x):(i=t.normal.x*this.max.x,t.normal.x*this.min.x);return 0<t.normal.y?(i+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(i+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),0<t.normal.z?(i+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(i+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),i<=-t.constant&&n>=-t.constant},intersectsTriangle:function(t){return!this.isEmpty()&&(this.getCenter(lt),vt.subVectors(this.max,lt),at.subVectors(t.a,lt),ft.subVectors(t.b,lt),ct.subVectors(t.c,lt),n.subVectors(ft,at),p.subVectors(ct,ft),m.subVectors(at,ct),!!yt([0,-n.z,n.y,0,-p.z,p.y,0,-m.z,m.y,n.z,0,-n.x,p.z,0,-p.x,m.z,0,-m.x,-n.y,n.x,0,-p.y,p.x,0,-m.y,m.x,0],at,ft,ct,vt))&&!!yt([1,0,0,0,1,0,0,0,1],at,ft,ct,vt)&&(dt.crossVectors(n,p),yt([dt.x,dt.y,dt.z],at,ft,ct,vt))},clampPoint:function(t,i){return void 0===i&&(console.warn("THREE.Box3: .clampPoint() target is now required"),i=new g),i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return ot.copy(t).clamp(this.min,this.max).sub(t).length()},getBoundingSphere:function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(ot).length(),t},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){return this.isEmpty()||(i[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),i[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),i[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),i[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),i[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),i[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),i[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),i[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(i)),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(pt.prototype,{addEventListener:function(t,i){void 0===this.j&&(this.j={});var n=this.j;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(i)&&n[t].push(i)},hasEventListener:function(t,i){var n;return void 0!==this.j&&void 0!==(n=this.j)[t]&&-1!==n[t].indexOf(i)},removeEventListener:function(t,i){var n;void 0!==this.j&&void 0!==(t=this.j[t])&&-1!==(n=t.indexOf(i))&&t.splice(n,1)},dispatchEvent:function(t){if(void 0!==this.j){var i=this.j[t.type];if(void 0!==i){t.target=this;for(var n=i.slice(0),s=0,e=n.length;s<e;s++)n[s].call(this,t)}}}}),Object.defineProperties(mt.prototype,{width:{get:function(){return this.z},set:function(t){this.z=t}},height:{get:function(){return this.w},set:function(t){this.w=t}}}),Object.assign(mt.prototype,{isVector4:!0,set:function(t,i,n,s){return this.x=t,this.y=i,this.z=n,this.w=s,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;break;case 3:this.w=i;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,i){return void 0!==i?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,i)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this.w=t.w+i.w,this},addScaledVector:function(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this.w+=t.w*i,this},sub:function(t,i){return void 0!==i?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,i)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this.w=t.w-i.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var i=this.x,n=this.y,s=this.z,e=this.w,t=t.elements;return this.x=t[0]*i+t[4]*n+t[8]*s+t[12]*e,this.y=t[1]*i+t[5]*n+t[9]*s+t[13]*e,this.z=t[2]*i+t[6]*n+t[10]*s+t[14]*e,this.w=t[3]*i+t[7]*n+t[11]*s+t[15]*e,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var i=Math.sqrt(1-t.w*t.w);return i<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/i,this.y=t.y/i,this.z=t.z/i),this},setAxisAngleFromRotationMatrix:function(t){var i,n,s,e,r,h,o,u,a,f,t=t.elements,c=t[0],l=t[4],v=t[8],d=t[1],y=t[5],p=t[9],m=t[2],b=t[6],t=t[10];return Math.abs(l-d)<.01&&Math.abs(v-m)<.01&&Math.abs(p-b)<.01?Math.abs(l+d)<.1&&Math.abs(v+m)<.1&&Math.abs(p+b)<.1&&Math.abs(c+y+t-3)<.1?this.set(1,0,0,0):(e=Math.PI,h=(t+1)/2,o=(l+d)/4,u=(v+m)/4,a=(p+b)/4,(r=(y+1)/2)<(f=(c+1)/2)&&h<f?s=f<.01?(i=0,n=.707106781):(n=o/(i=Math.sqrt(f)),u/i):h<r?s=r<.01?(n=0,i=.707106781):(i=o/(n=Math.sqrt(r)),a/n):h<.01?(n=i=.707106781,s=0):(i=u/(s=Math.sqrt(h)),n=a/s),this.set(i,n,s,e)):(f=Math.sqrt((b-p)*(b-p)+(v-m)*(v-m)+(d-l)*(d-l)),Math.abs(f)<.001&&(f=1),this.x=(b-p)/f,this.y=(v-m)/f,this.z=(d-l)/f,this.w=Math.acos((c+y+t-1)/2)),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this.w=Math.max(t.w,Math.min(i.w,this.w)),this},clampScalar:function(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this.z=Math.max(t,Math.min(i,this.z)),this.w=Math.max(t,Math.min(i,this.w)),this},clampLength:function(t,i){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(i,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this.w+=(t.w-this.w)*i,this},lerpVectors:function(t,i,n){return this.subVectors(i,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,i){return this.x=t[i=void 0===i?0:i],this.y=t[i+1],this.z=t[i+2],this.w=t[i+3],this},toArray:function(t,i){return(t=void 0===t?[]:t)[i=void 0===i?0:i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t[i+3]=this.w,t},fromBufferAttribute:function(t,i,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(i),this.y=t.getY(i),this.z=t.getZ(i),this.w=t.getW(i),this}});var A=new g;function w(t,i,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=i,this.count=void 0!==t?t.length/i:0,this.normalized=!0===n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function bt(t,i,n){w.call(this,new Int8Array(t),i,n)}function Mt(t,i,n){w.call(this,new Uint8Array(t),i,n)}function gt(t,i,n){w.call(this,new Uint8ClampedArray(t),i,n)}function At(t,i,n){w.call(this,new Int16Array(t),i,n)}function wt(t,i,n){w.call(this,new Uint16Array(t),i,n)}function Et(t,i,n){w.call(this,new Int32Array(t),i,n)}function St(t,i,n){w.call(this,new Uint32Array(t),i,n)}function S(t,i,n){w.call(this,new Float32Array(t),i,n)}function Rt(t,i,n){w.call(this,new Float64Array(t),i,n)}Object.defineProperty(w.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(w.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,i,n){t*=this.itemSize,n*=i.itemSize;for(var s=0,e=this.itemSize;s<e;s++)this.array[t+s]=i.array[n+s];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var i=this.array,n=0,s=0,e=t.length;s<e;s++){var r=t[s];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",s),r=new v),i[n++]=r.r,i[n++]=r.g,i[n++]=r.b}return this},copyVector2sArray:function(t){for(var i=this.array,n=0,s=0,e=t.length;s<e;s++){var r=t[s];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",s),r=new E),i[n++]=r.x,i[n++]=r.y}return this},copyVector3sArray:function(t){for(var i=this.array,n=0,s=0,e=t.length;s<e;s++){var r=t[s];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",s),r=new g),i[n++]=r.x,i[n++]=r.y,i[n++]=r.z}return this},copyVector4sArray:function(t){for(var i=this.array,n=0,s=0,e=t.length;s<e;s++){var r=t[s];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",s),r=new mt),i[n++]=r.x,i[n++]=r.y,i[n++]=r.z,i[n++]=r.w}return this},applyMatrix3:function(t){for(var i=0,n=this.count;i<n;i++)A.x=this.getX(i),A.y=this.getY(i),A.z=this.getZ(i),A.applyMatrix3(t),this.setXYZ(i,A.x,A.y,A.z);return this},applyMatrix4:function(t){for(var i=0,n=this.count;i<n;i++)A.x=this.getX(i),A.y=this.getY(i),A.z=this.getZ(i),A.applyMatrix4(t),this.setXYZ(i,A.x,A.y,A.z);return this},applyNormalMatrix:function(t){for(var i=0,n=this.count;i<n;i++)A.x=this.getX(i),A.y=this.getY(i),A.z=this.getZ(i),A.applyNormalMatrix(t),this.setXYZ(i,A.x,A.y,A.z);return this},transformDirection:function(t){for(var i=0,n=this.count;i<n;i++)A.x=this.getX(i),A.y=this.getY(i),A.z=this.getZ(i),A.transformDirection(t),this.setXYZ(i,A.x,A.y,A.z);return this},set:function(t,i){return this.array.set(t,i=void 0===i?0:i),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,i){return this.array[t*this.itemSize]=i,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,i){return this.array[t*this.itemSize+1]=i,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,i){return this.array[t*this.itemSize+2]=i,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,i){return this.array[t*this.itemSize+3]=i,this},setXY:function(t,i,n){return t*=this.itemSize,this.array[t+0]=i,this.array[t+1]=n,this},setXYZ:function(t,i,n,s){return t*=this.itemSize,this.array[t+0]=i,this.array[t+1]=n,this.array[t+2]=s,this},setXYZW:function(t,i,n,s,e){return t*=this.itemSize,this.array[t+0]=i,this.array[t+1]=n,this.array[t+2]=s,this.array[t+3]=e,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(bt.prototype=Object.create(w.prototype)).constructor=bt,(Mt.prototype=Object.create(w.prototype)).constructor=Mt,(gt.prototype=Object.create(w.prototype)).constructor=gt,(At.prototype=Object.create(w.prototype)).constructor=At,wt.prototype=Object.create(w.prototype),wt.prototype.constructor=wt,(Et.prototype=Object.create(w.prototype)).constructor=Et,St.prototype=Object.create(w.prototype),St.prototype.constructor=St,(S.prototype=Object.create(w.prototype)).constructor=S,(Rt.prototype=Object.create(w.prototype)).constructor=Rt;var jt=new M;function xt(t,i){this.center=void 0!==t?t:new g,this.radius=void 0!==i?i:0}function Ot(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}Object.assign(xt.prototype,{set:function(t,i){return this.center.copy(t),this.radius=i,this},setFromPoints:function(t,i){for(var n=this.center,s=(void 0!==i?n.copy(i):jt.setFromPoints(t).getCenter(n),0),e=0,r=t.length;e<r;e++)s=Math.max(s,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(s),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var i=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=i*i},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,i){var n=this.center.distanceToSquared(t);return void 0===i&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),i=new g),i.copy(t),n>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new M),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(Ot.prototype,{computeGroups:function(t){for(var i,n=[],s=void 0,e=t.faces,r=0;r<e.length;r++){var h=e[r];h.materialIndex!==s&&(s=h.materialIndex,void 0!==i&&(i.count=3*r-i.start,n.push(i)),i={start:3*r,materialIndex:s})}void 0!==i&&(i.count=3*r-i.start,n.push(i)),this.groups=n},fromGeometry:function(t){var i=t.faces,n=t.vertices,s=t.faceVertexUvs,e=s[0]&&0<s[0].length,r=s[1]&&0<s[1].length,h=t.morphTargets,o=h.length;if(0<o){for(var u=[],a=0;a<o;a++)u[a]={name:h[a].name,data:[]};this.morphTargets.position=u}var f=t.morphNormals,c=f.length;if(0<c){for(var l=[],a=0;a<c;a++)l[a]={name:f[a].name,data:[]};this.morphTargets.normal=l}var v=t.skinIndices,d=t.skinWeights,y=v.length===n.length,p=d.length===n.length;0<n.length&&0===i.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(a=0;a<i.length;a++){var m,b=i[a],M=(this.vertices.push(n[b.a],n[b.b],n[b.c]),b.vertexNormals),M=(3===M.length?this.normals.push(M[0],M[1],M[2]):(M=b.normal,this.normals.push(M,M,M)),b.vertexColors);3===M.length?this.colors.push(M[0],M[1],M[2]):(M=b.color,this.colors.push(M,M,M)),!0===e&&(void 0!==(m=s[0][a])?this.uvs.push(m[0],m[1],m[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",a),this.uvs.push(new E,new E,new E))),!0===r&&(void 0!==(m=s[1][a])?this.uvs2.push(m[0],m[1],m[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",a),this.uvs2.push(new E,new E,new E)));for(var g=0;g<o;g++){var A=h[g].vertices;u[g].data.push(A[b.a],A[b.b],A[b.c])}for(g=0;g<c;g++){var w=f[g].vertexNormals[a];l[g].data.push(w.a,w.b,w.c)}y&&this.skinIndices.push(v[b.a],v[b.b],v[b.c]),p&&this.skinWeights.push(d[b.a],d[b.b],d[b.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}});var Tt=new y,kt=new r;function Bt(t,i,n,s){this.u=t||0,this.v=i||0,this.M=n||0,this.O=s||Bt.DefaultOrder}function It(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Bt.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Bt.DefaultOrder="XYZ",Object.defineProperties(Bt.prototype,{x:{get:function(){return this.u},set:function(t){this.u=t,this.S()}},y:{get:function(){return this.v},set:function(t){this.v=t,this.S()}},z:{get:function(){return this.M},set:function(t){this.M=t,this.S()}},order:{get:function(){return this.O},set:function(t){this.O=t,this.S()}}}),Object.assign(Bt.prototype,{isEuler:!0,set:function(t,i,n,s){return this.u=t,this.v=i,this.M=n,this.O=s||this.O,this.S(),this},clone:function(){return new this.constructor(this.u,this.v,this.M,this.O)},copy:function(t){return this.u=t.u,this.v=t.v,this.M=t.M,this.O=t.O,this.S(),this},setFromRotationMatrix:function(t,i,n){var s=d.clamp,t=t.elements,e=t[0],r=t[4],h=t[8],o=t[1],u=t[5],a=t[9],f=t[2],c=t[6],t=t[10];return"XYZ"===(i=i||this.O)?(this.v=Math.asin(s(h,-1,1)),Math.abs(h)<.9999999?(this.u=Math.atan2(-a,t),this.M=Math.atan2(-r,e)):(this.u=Math.atan2(c,u),this.M=0)):"YXZ"===i?(this.u=Math.asin(-s(a,-1,1)),Math.abs(a)<.9999999?(this.v=Math.atan2(h,t),this.M=Math.atan2(o,u)):(this.v=Math.atan2(-f,e),this.M=0)):"ZXY"===i?(this.u=Math.asin(s(c,-1,1)),Math.abs(c)<.9999999?(this.v=Math.atan2(-f,t),this.M=Math.atan2(-r,u)):(this.v=0,this.M=Math.atan2(o,e))):"ZYX"===i?(this.v=Math.asin(-s(f,-1,1)),Math.abs(f)<.9999999?(this.u=Math.atan2(c,t),this.M=Math.atan2(o,e)):(this.u=0,this.M=Math.atan2(-r,u))):"YZX"===i?(this.M=Math.asin(s(o,-1,1)),Math.abs(o)<.9999999?(this.u=Math.atan2(-a,u),this.v=Math.atan2(-f,e)):(this.u=0,this.v=Math.atan2(h,t))):"XZY"===i?(this.M=Math.asin(-s(r,-1,1)),Math.abs(r)<.9999999?(this.u=Math.atan2(c,u),this.v=Math.atan2(h,e)):(this.u=Math.atan2(-a,t),this.v=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+i),this.O=i,!1!==n&&this.S(),this},setFromQuaternion:function(t,i,n){return Tt.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Tt,i,n)},setFromVector3:function(t,i){return this.set(t.x,t.y,t.z,i||this.O)},reorder:function(t){return kt.setFromEuler(this),this.setFromQuaternion(kt,t)},equals:function(t){return t.u===this.u&&t.v===this.v&&t.M===this.M&&t.O===this.O},fromArray:function(t){return this.u=t[0],this.v=t[1],this.M=t[2],void 0!==t[3]&&(this.O=t[3]),this.S(),this},toArray:function(t,i){return(t=void 0===t?[]:t)[i=void 0===i?0:i]=this.u,t[i+1]=this.v,t[i+2]=this.M,t[i+3]=this.O,t},toVector3:function(t){return t?t.set(this.u,this.v,this.M):new g(this.u,this.v,this.M)},R:function(t){return this.S=t,this},S:function(){}}),Object.assign(It.prototype,{isMatrix3:!0,set:function(t,i,n,s,e,r,h,o,u){var a=this.elements;return a[0]=t,a[1]=s,a[2]=h,a[3]=i,a[4]=e,a[5]=o,a[6]=n,a[7]=r,a[8]=u,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var i=this.elements,t=t.elements;return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],this},extractBasis:function(t,i,n){return t.setFromMatrix3Column(this,0),i.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(t){t=t.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,i){var t=t.elements,i=i.elements,n=this.elements,s=t[0],e=t[3],r=t[6],h=t[1],o=t[4],u=t[7],a=t[2],f=t[5],t=t[8],c=i[0],l=i[3],v=i[6],d=i[1],y=i[4],p=i[7],m=i[2],b=i[5],i=i[8];return n[0]=s*c+e*d+r*m,n[3]=s*l+e*y+r*b,n[6]=s*v+e*p+r*i,n[1]=h*c+o*d+u*m,n[4]=h*l+o*y+u*b,n[7]=h*v+o*p+u*i,n[2]=a*c+f*d+t*m,n[5]=a*l+f*y+t*b,n[8]=a*v+f*p+t*i,this},multiplyScalar:function(t){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=t,i[4]*=t,i[7]*=t,i[2]*=t,i[5]*=t,i[8]*=t,this},determinant:function(){var t=this.elements,i=t[0],n=t[1],s=t[2],e=t[3],r=t[4],h=t[5],o=t[6],u=t[7],t=t[8];return i*r*t-i*h*u-n*e*t+n*h*o+s*e*u-s*r*o},getInverse:function(t,i){void 0!==i&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var i=t.elements,t=this.elements,n=i[0],s=i[1],e=i[2],r=i[3],h=i[4],o=i[5],u=i[6],a=i[7],i=i[8],f=i*h-o*a,c=o*u-i*r,l=a*r-h*u,v=n*f+s*c+e*l;return 0==v?this.set(0,0,0,0,0,0,0,0,0):(t[0]=f*(f=1/v),t[1]=(e*a-i*s)*f,t[2]=(o*s-e*h)*f,t[3]=c*f,t[4]=(i*n-e*u)*f,t[5]=(e*r-o*n)*f,t[6]=l*f,t[7]=(s*u-a*n)*f,t[8]=(h*n-s*r)*f,this)},transpose:function(){var t=this.elements,i=t[1];return t[1]=t[3],t[3]=i,i=t[2],t[2]=t[6],t[6]=i,i=t[5],t[5]=t[7],t[7]=i,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var i=this.elements;return t[0]=i[0],t[1]=i[3],t[2]=i[6],t[3]=i[1],t[4]=i[4],t[5]=i[7],t[6]=i[2],t[7]=i[5],t[8]=i[8],this},setUvTransform:function(t,i,n,s,e,r,h){var o=Math.cos(e),e=Math.sin(e);this.set(n*o,n*e,-n*(o*r+e*h)+r+t,-s*e,s*o,-s*(-e*r+o*h)+h+i,0,0,1)},scale:function(t,i){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=i,n[4]*=i,n[7]*=i,this},rotate:function(t){var i=Math.cos(t),t=Math.sin(t),n=this.elements,s=n[0],e=n[3],r=n[6],h=n[1],o=n[4],u=n[7];return n[0]=i*s+t*h,n[3]=i*e+t*o,n[6]=i*r+t*u,n[1]=-t*s+i*h,n[4]=-t*e+i*o,n[7]=-t*r+i*u,this},translate:function(t,i){var n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=i*n[2],n[4]+=i*n[5],n[7]+=i*n[8],this},equals:function(t){for(var i=this.elements,n=t.elements,s=0;s<9;s++)if(i[s]!==n[s])return!1;return!0},fromArray:function(t,i){void 0===i&&(i=0);for(var n=0;n<9;n++)this.elements[n]=t[n+i];return this},toArray:function(t,i){var n=this.elements;return(t=void 0===t?[]:t)[i=void 0===i?0:i]=n[0],t[i+1]=n[1],t[i+2]=n[2],t[i+3]=n[3],t[i+4]=n[4],t[i+5]=n[5],t[i+6]=n[6],t[i+7]=n[7],t[i+8]=n[8],t}});var Vt=0,Ct=new g,Pt=new r,R=new y,Dt=new g,Ft=new g,Yt=new g,Lt=new r,_t=new g(1,0,0),Ht=new g(0,1,0),Nt=new g(0,0,1),Ut={type:"added"},Gt={type:"removed"};function j(){Object.defineProperty(this,"id",{value:Vt++}),this.uuid=d.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=j.DefaultUp.clone();var t=new g,i=new Bt,n=new r,s=new g(1,1,1);i.R(function(){n.setFromEuler(i,!1)}),n.R(function(){i.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new y},normalMatrix:{value:new It}}),this.matrix=new y,this.matrixWorld=new y,this.matrixAutoUpdate=j.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new K,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}j.DefaultUp=new g(0,1,0),j.DefaultMatrixAutoUpdate=!0,j.prototype=Object.assign(Object.create(pt.prototype),{constructor:j,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,i){this.quaternion.setFromAxisAngle(t,i)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,i){return Pt.setFromAxisAngle(t,i),this.quaternion.multiply(Pt),this},rotateOnWorldAxis:function(t,i){return Pt.setFromAxisAngle(t,i),this.quaternion.premultiply(Pt),this},rotateX:function(t){return this.rotateOnAxis(_t,t)},rotateY:function(t){return this.rotateOnAxis(Ht,t)},rotateZ:function(t){return this.rotateOnAxis(Nt,t)},translateOnAxis:function(t,i){return Ct.copy(t).applyQuaternion(this.quaternion),this.position.add(Ct.multiplyScalar(i)),this},translateX:function(t){return this.translateOnAxis(_t,t)},translateY:function(t){return this.translateOnAxis(Ht,t)},translateZ:function(t){return this.translateOnAxis(Nt,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(R.getInverse(this.matrixWorld))},lookAt:function(t,i,n){t.isVector3?Dt.copy(t):Dt.set(t,i,n);t=this.parent;this.updateWorldMatrix(!0,!1),Ft.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?R.lookAt(Ft,Dt,this.up):R.lookAt(Dt,Ft,this.up),this.quaternion.setFromRotationMatrix(R),t&&(R.extractRotation(t.matrixWorld),Pt.setFromRotationMatrix(R),this.quaternion.premultiply(Pt.inverse()))},add:function(t){if(1<arguments.length)for(var i=0;i<arguments.length;i++)this.add(arguments[i]);else t===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",t):t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),(t.parent=this).children.push(t),t.dispatchEvent(Ut)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t);return this},remove:function(t){if(1<arguments.length)for(var i=0;i<arguments.length;i++)this.remove(arguments[i]);else{var n=this.children.indexOf(t);-1!==n&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(Gt))}return this},attach:function(t){return this.updateWorldMatrix(!0,!1),R.getInverse(this.matrixWorld),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),R.multiply(t.parent.matrixWorld)),t.applyMatrix4(R),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,i){if(this[t]===i)return this;for(var n=0,s=this.children.length;n<s;n++){var e=this.children[n].getObjectByProperty(t,i);if(void 0!==e)return e}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new g),this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new r),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Ft,t,Yt),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new g),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Ft,Lt,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new g),this.updateMatrixWorld(!0);var i=this.matrixWorld.elements;return t.set(i[8],i[9],i[10]).normalize()},raycast:function(){},traverse:function(t){t(this);for(var i=this.children,n=0,s=i.length;n<s;n++)i[n].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var i=this.children,n=0,s=i.length;n<s;n++)i[n].traverseVisible(t)}},traverseAncestors:function(t){var i=this.parent;null!==i&&(t(i),i.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t=!(this.matrixWorldNeedsUpdate=!1));for(var i=this.children,n=0,s=i.length;n<s;n++)i[n].updateMatrixWorld(t)},updateWorldMatrix:function(t,i){var n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===i)for(var s=this.children,e=0,r=s.length;e<r;e++)s[e].updateWorldMatrix(!1,!0)},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,i){if(void 0===i&&(i=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===i)for(var n=0;n<t.children.length;n++){var s=t.children[n];this.add(s.clone())}return this}});var Xt=1,x=new y,Zt=new j,zt=new g,O=new M,Qt=new M,T=new g;function Jt(){Object.defineProperty(this,"id",{value:Xt+=2}),this.uuid=d.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}Jt.prototype=Object.assign(Object.create(pt.prototype),{constructor:Jt,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(65535<function(t){if(0===t.length)return-1/0;for(var i=t[0],n=1,s=t.length;n<s;++n)t[n]>i&&(i=t[n]);return i}(t)?St:wt)(t,1):this.index=t},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,i){return this.attributes[t]=i,this},deleteAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,i,n){this.groups.push({start:t,count:i,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,i){this.drawRange.start=t,this.drawRange.count=i},applyMatrix4:function(t){var i=this.attributes.position,i=(void 0!==i&&(i.applyMatrix4(t),i.needsUpdate=!0),this.attributes.normal),n=(void 0!==i&&(n=(new It).getNormalMatrix(t),i.applyNormalMatrix(n),i.needsUpdate=!0),this.attributes.tangent);return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return x.makeRotationX(t),this.applyMatrix4(x),this},rotateY:function(t){return x.makeRotationY(t),this.applyMatrix4(x),this},rotateZ:function(t){return x.makeRotationZ(t),this.applyMatrix4(x),this},translate:function(t,i,n){return x.makeTranslation(t,i,n),this.applyMatrix4(x),this},scale:function(t,i,n){return x.makeScale(t,i,n),this.applyMatrix4(x),this},lookAt:function(t){return Zt.lookAt(t),Zt.updateMatrix(),this.applyMatrix4(Zt.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zt).negate(),this.translate(zt.x,zt.y,zt.z),this},setFromObject:function(t){var i,n,s=t.geometry;return t.isPoints||t.isLine?(n=new S(3*s.vertices.length,3),i=new S(3*s.colors.length,3),this.setAttribute("position",n.copyVector3sArray(s.vertices)),this.setAttribute("color",i.copyColorsArray(s.colors)),s.lineDistances&&s.lineDistances.length===s.vertices.length&&(n=new S(s.lineDistances.length,1),this.setAttribute("lineDistance",n.copyArray(s.lineDistances))),null!==s.boundingSphere&&(this.boundingSphere=s.boundingSphere.clone()),null!==s.boundingBox&&(this.boundingBox=s.boundingBox.clone())):t.isMesh&&s&&s.isGeometry&&this.fromGeometry(s),this},setFromPoints:function(t){for(var i=[],n=0,s=t.length;n<s;n++){var e=t[n];i.push(e.x,e.y,e.z||0)}return this.setAttribute("position",new S(i,3)),this},updateFromObject:function(t){var i,n=t.geometry;if(t.isMesh){var s=n.T;if(!0===n.elementsNeedUpdate&&(s=void 0,n.elementsNeedUpdate=!1),void 0===s)return this.fromGeometry(n);s.verticesNeedUpdate=n.verticesNeedUpdate,s.normalsNeedUpdate=n.normalsNeedUpdate,s.colorsNeedUpdate=n.colorsNeedUpdate,s.uvsNeedUpdate=n.uvsNeedUpdate,s.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=s}return!0===n.verticesNeedUpdate&&(void 0!==(i=this.attributes.position)&&(i.copyVector3sArray(n.vertices),i.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(i=this.attributes.normal)&&(i.copyVector3sArray(n.normals),i.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(i=this.attributes.color)&&(i.copyColorsArray(n.colors),i.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(i=this.attributes.uv)&&(i.copyVector2sArray(n.uvs),i.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(i=this.attributes.lineDistance)&&(i.copyArray(n.lineDistances),i.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(t.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.T=(new Ot).fromGeometry(t),this.fromDirectGeometry(t.T)},fromDirectGeometry:function(t){var i,n=new Float32Array(3*t.vertices.length);for(i in this.setAttribute("position",new w(n,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(n=new Float32Array(3*t.normals.length),this.setAttribute("normal",new w(n,3).copyVector3sArray(t.normals))),0<t.colors.length&&(n=new Float32Array(3*t.colors.length),this.setAttribute("color",new w(n,3).copyColorsArray(t.colors))),0<t.uvs.length&&(n=new Float32Array(2*t.uvs.length),this.setAttribute("uv",new w(n,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(n=new Float32Array(2*t.uvs2.length),this.setAttribute("uv2",new w(n,2).copyVector2sArray(t.uvs2))),this.groups=t.groups,t.morphTargets){for(var s=[],e=t.morphTargets[i],r=0,h=e.length;r<h;r++){var o=e[r],u=new S(3*o.data.length,3);u.name=o.name,s.push(u.copyVector3sArray(o.data))}this.morphAttributes[i]=s}return 0<t.skinIndices.length&&(n=new S(4*t.skinIndices.length,4),this.setAttribute("skinIndex",n.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(n=new S(4*t.skinWeights.length,4),this.setAttribute("skinWeight",n.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new M);var t=this.attributes.position,i=this.morphAttributes.position;if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),i)for(var n=0,s=i.length;n<s;n++){var e=i[n];O.setFromBufferAttribute(e),this.morphTargetsRelative?(T.addVectors(this.boundingBox.min,O.min),this.boundingBox.expandByPoint(T),T.addVectors(this.boundingBox.max,O.max),this.boundingBox.expandByPoint(T)):(this.boundingBox.expandByPoint(O.min),this.boundingBox.expandByPoint(O.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new xt);var t=this.attributes.position,i=this.morphAttributes.position;if(t){var n=this.boundingSphere.center;if(O.setFromBufferAttribute(t),i)for(var s=0,e=i.length;s<e;s++){var r=i[s];Qt.setFromBufferAttribute(r),this.morphTargetsRelative?(T.addVectors(O.min,Qt.min),O.expandByPoint(T),T.addVectors(O.max,Qt.max),O.expandByPoint(T)):(O.expandByPoint(Qt.min),O.expandByPoint(Qt.max))}O.getCenter(n);for(var h=0,s=0,e=t.count;s<e;s++)T.fromBufferAttribute(t,s),h=Math.max(h,n.distanceToSquared(T));if(i)for(s=0,e=i.length;s<e;s++)for(var r=i[s],o=this.morphTargetsRelative,u=0,a=r.count;u<a;u++)T.fromBufferAttribute(r,u),o&&(zt.fromBufferAttribute(t,u),T.add(zt)),h=Math.max(h,n.distanceToSquared(T));this.boundingSphere.radius=Math.sqrt(h),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,i=this.attributes;if(i.position){var n=i.position.array;if(void 0===i.normal)this.setAttribute("normal",new w(new Float32Array(n.length),3));else for(var s=i.normal.array,e=0,r=s.length;e<r;e++)s[e]=0;var h,o,u,a=i.normal.array,f=new g,c=new g,l=new g,v=new g,d=new g;if(t)for(var y=t.array,e=0,r=t.count;e<r;e+=3)h=3*y[e+0],o=3*y[e+1],u=3*y[e+2],f.fromArray(n,h),c.fromArray(n,o),l.fromArray(n,u),v.subVectors(l,c),d.subVectors(f,c),v.cross(d),a[h]+=v.x,a[1+h]+=v.y,a[2+h]+=v.z,a[o]+=v.x,a[1+o]+=v.y,a[2+o]+=v.z,a[u]+=v.x,a[1+u]+=v.y,a[2+u]+=v.z;else for(e=0,r=n.length;e<r;e+=9)f.fromArray(n,e),c.fromArray(n,e+3),l.fromArray(n,e+6),v.subVectors(l,c),d.subVectors(f,c),v.cross(d),a[e]=v.x,a[e+1]=v.y,a[e+2]=v.z,a[e+3]=v.x,a[e+4]=v.y,a[e+5]=v.z,a[e+6]=v.x,a[e+7]=v.y,a[e+8]=v.z;this.normalizeNormals(),i.normal.needsUpdate=!0}},normalizeNormals:function(){for(var t=this.attributes.normal,i=0,n=t.count;i<n;i++)T.x=t.getX(i),T.y=t.getY(i),T.z=t.getZ(i),T.normalize(),t.setXYZ(i,T.x,T.y,T.z)},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Wt=0;function qt(){Object.defineProperty(this,"id",{value:Wt++}),this.uuid=d.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function k(t){qt.call(this),this.type="LineBasicMaterial",this.color=new v(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}qt.prototype=Object.assign(Object.create(pt.prototype),{constructor:qt,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var i in t){var n,s=t[i];void 0===s?console.warn("THREE.Material: '"+i+"' parameter is undefined."):"shading"===i?(console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===s):void 0===(n=this[i])?console.warn("THREE."+this.type+": '"+i+"' is not a property of this material."):n&&n.isColor?n.set(s):n&&n.isVector3&&s&&s.isVector3?n.copy(s):this[i]=s}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var i=t.clippingPlanes,n=null;if(null!==i)for(var s=i.length,n=new Array(s),e=0;e!==s;++e)n[e]=i[e].clone();return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(qt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),((k.prototype=Object.create(qt.prototype)).constructor=k).prototype.isLineBasicMaterial=!0,k.prototype.copy=function(t){return qt.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this};var Kt=new g,$t=new g,ti=new y,ii=new q,ni=new xt;function si(t,i,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),j.call(this),this.type="Line",this.geometry=void 0!==t?t:new Jt,this.material=void 0!==i?i:new k}function ei(t){return(ei="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ri(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,function(t){t=function(t,i){if("object"!=ei(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=ei(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==ei(t)?t:String(t)}(s.key),s)}}function hi(t,i,n){return i&&ri(t.prototype,i),n&&ri(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}si.prototype=Object.assign(Object.create(j.prototype),{constructor:si,isLine:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var i=t.attributes.position,n=[0],s=1,e=i.count;s<e;s++)Kt.fromBufferAttribute(i,s-1),$t.fromBufferAttribute(i,s),n[s]=n[s-1],n[s]+=Kt.distanceTo($t);t.setAttribute("lineDistance",new S(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){var r=t.vertices;(n=t.lineDistances)[0]=0;for(s=1,e=r.length;s<e;s++)n[s]=n[s-1],n[s]+=r[s-1].distanceTo(r[s])}return this},raycast:function(t,i){var n=this.geometry,s=this.matrixWorld,e=t.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),ni.copy(n.boundingSphere),ni.applyMatrix4(s),ni.radius+=e,!1!==t.ray.intersectsSphere(ni)){ti.getInverse(s),ii.copy(t.ray).applyMatrix4(ti);var s=e/((this.scale.x+this.scale.y+this.scale.z)/3),r=s*s,h=new g,o=new g,u=new g,a=new g,f=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var e=n.index,c=n.attributes.position.array;if(null!==e)for(var l=e.array,v=0,d=l.length-1;v<d;v+=f){var y=l[v],p=l[v+1];h.fromArray(c,3*y),o.fromArray(c,3*p),r<ii.distanceSqToSegment(h,o,a,u)||(a.applyMatrix4(this.matrixWorld),(m=t.ray.origin.distanceTo(a))<t.near)||m>t.far||i.push({distance:m,point:u.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}else for(v=0,d=c.length/3-1;v<d;v+=f)h.fromArray(c,3*v),o.fromArray(c,3*v+3),r<ii.distanceSqToSegment(h,o,a,u)||(a.applyMatrix4(this.matrixWorld),(m=t.ray.origin.distanceTo(a))<t.near)||m>t.far||i.push({distance:m,point:u.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}else if(n.isGeometry)for(var m,b=n.vertices,M=b.length,v=0;v<M-1;v+=f)r<ii.distanceSqToSegment(b[v],b[v+1],a,u)||(a.applyMatrix4(this.matrixWorld),(m=t.ray.origin.distanceTo(a))<t.near)||m>t.far||i.push({distance:m,point:u.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var t=hi(function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.j={}}),oi=(Object.assign(t.prototype,{k:function(t,i){this.B(t,i)||(void 0===this.j[t]&&(this.j[t]=[]),this.j[t].push(i))},B:function(t,i){return i?void 0!==this.j[t]&&-1!==this.j[t].indexOf(i):void 0!==this.j[t]&&0<this.j[t].length},I:function(t,i){void 0!==this.j[t]&&-1!==(i=this.j[t].indexOf(i))&&this.j[t].splice(i,1)},V:function(t){if(void 0!==this.j[t.type])for(var i=this.j[t.type].slice(0),n=0,s=i.length;n<s;n++)i[n].call(this,t)}}),t);function ui(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var s,e,r,h,o=[],u=!0,a=!1;try{if(r=(n=n.call(t)).next,0===i){if(Object(n)!==n)return;u=!1}else for(;!(u=(s=r.call(n)).done)&&(o.push(s.value),o.length!==i);u=!0);}catch(t){a=!0,e=t}finally{try{if(!u&&null!=n.return&&(h=n.return(),Object(h)!==h))return}finally{if(a)throw e}}return o}}(t,i)||ai(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ai(t,i){var n;if(t)return"string"==typeof t?fi(t,i):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fi(t,i):void 0}function fi(t,i){(null==i||i>t.length)&&(i=t.length);for(var n=0,s=new Array(i);n<i;n++)s[n]=t[n];return s}function ci(i,t){var n,s=Object.keys(i);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(i),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})),s.push.apply(s,n)),s}function li(s){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?ci(Object(e),!0).forEach(function(t){var i,n;i=s,n=e[t=t],(t=yi(t))in i?Object.defineProperty(i,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):i[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(e)):ci(Object(e)).forEach(function(t){Object.defineProperty(s,t,Object.getOwnPropertyDescriptor(e,t))})}return s}function vi(t){return(vi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function di(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,yi(s.key),s)}}function yi(t){t=function(t,i){if("object"!=vi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=vi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==vi(t)?t:String(t)}t=function(){function i(t){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");this.C=t,this.P="none",this.currentobj=null,this.D={url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5QoOAiAd1TTTFgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABfElEQVRYw81XO26EMBB9poAIrBwh2hPgMt1WS7cSN+AonAXtIahSpfLWVNtFewXLkG7SeCVIbH5rBZ40jYGZ8fjxPMOwDAcARwAnAO8A3sz6HcAVwAeATwBf8IgIQAGgA0AzrTPfRM8GPy8I6rLz2l1fPAR/2GVJNV4B3DwGf9jN+J7cuTM4Y4yEEFSWJUkpSWtNWmuSUlJZliSEIMbYVBKjlXCWPcsyUkrRFJRSlGXZ1HHMJ1wYhlRVFS1FVVUUhuFsYkau4FJKWgsp5VgSg6MobC+t2bmtEo4Ein4Cne3MfcHBia4vr3/YPodwc6GUcv0dh8Bo+wBpmoJz7k3LOedI09T26BiYi2WAPM/hGw6fJ9iE5xnmj/0RNmFihgwv/bS01ojj2GsF2rZFkiS/l78DbIzANBMDNE3jPZDD5z0wncwAdV17T8Dh82pVQSGEdxIKIZxquKkQ7UKKd3EZbX4db96Q7KIl20VTunlbvovBZBej2b8Np2zr8fwHFGE/6k/Mu0oAAAAASUVORK5CYII=",size:32,height:1,collision:!1},this.F={width:5,type:X.FULL,color:"#FF0000",height:3},this.Y={color:"#FF0000",borderWidth:3,borderColor:"#0000FF",opacity:.5,height:3},this.L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5QocCDgHXcqo9wAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAEQ0lEQVRYw71XTWhcVRg9584kVGzHZKYlTFpsJ/PeKBaKMjN05aYIKgguupASqaKCC1cFVxaSaQW7dSW4KRFBEETEje5qtWK1SdP409L0zZgpJrEtvqY/qebNe/e46KSZDMkkmSR9mwdz35zv3O8737nfJdbxuG7xdQp7EfCj8au//NkORqzd4Lls8S0SgzR8UTHbm0qlr/r+9ORDIZDLFt6B4SDJXQBAci/AbHeyd8L3p6qbSsB1C++SLJHc0fg7yQyFbFd37z83b05d3hQCrls8SrBEcutS6yR3k8wnU713fH9qbEMJuG7hPYIDAAyAGsl447qk6wDmACQIPJVMpWd8f/r3lXDjqwne07PvUQmXBfUbKQS5U8AAyZ568LNW0RGJAalOyRgTRbN1srYVNtsR4Z49hSc6O3iKZBoArPTjzMzsCzduXLy7VizTDgGSAqCGXdDaqK3NmI0S6PYVSrgmAq6bP+S6+cKyzGI2WlxbsRWDbds6D7hu/vCqCOScwquAGaSNpZcDrNXCCEDYWJQoeowtSpYizIDrFl9rScBxiv0gBwn2yWhZwI4OGy4ioNZilhAA2G2AweZMxBvs9RVQA6RxJNQAPJ3LFW8jVCeoTruo77mjqYUTgD3oOIXbS6dZ++9LlRnKDDhOMfS8c589aEPHKRw0xDHS7G0wlrsADSBTz5RpSmuzEYUrdE584Vt7EVZHx8sjXzGXzb8sY44bch8e4mOlc5I9akA+u1xwafG7YWXdBAxZNOBLcYvwpLEdvTQ8tCiE1Q8wGJMQSYoEhhRrov6jkAD1Jsnk/Dkg4AsCNUgEDAFRBAGQQo6GzzWV7DsLfFnXQD5rYAZoeHh+h7I6Mu4Nf7gU+76+/ONxY07RsK9O9ufQ2ucrlZFbS33vOMV+Q3xCMvYguFTyvOHTBgA8b6Q8VwsGZe3QfHrZIs9RZAIRwarTfb+rVK/9mcja4543fHqRD1SrYxNBGJUEDa0IaMyaRGCpCKBk7RgjfVAuj5xa0ogmJkarsVhUkrVDUYtTlPxXBKM1HF5WUhnCifHK8DctrfjSpdFqENpSLDTfLgcYBGEIaG61BKRoGrTHx8vDn69qIJmYGG05WG7ZsjUEtGoNeN75cwDOtj0RAUAms79nYUfBNjIeNQnzkXQ6XwMAa2sEgGvXfp2dX17XROQ4ToLsehvgGw1/dObtVcI9wf5kAAokYI3A74Hax1eujE2ueyj1fX8ukeiZjMXMk4Y8QHI7SbMgMnSQ6AOZIZERUJEw5Hmjv23YVDwz8/etVGJXBUZZktkmVwPJusfbr62N3i+Xz5/Z8HuBPzN5rTvZe5VAhuSehjabD/4pYEued2F0025Gvj9VTXalrwvMk9y+cHbYoaAWliqVC96m3w39m9NXUqn0HYDPkOiywslaGB2rVi9U14rV9u3Y96fHkqmd92T1x1ygE9Xq+b/awfkfmzntCAO/rwcAAAAASUVORK5CYII=",this._="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5QoOAiAd1TTTFgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABfElEQVRYw81XO26EMBB9poAIrBwh2hPgMt1WS7cSN+AonAXtIahSpfLWVNtFewXLkG7SeCVIbH5rBZ40jYGZ8fjxPMOwDAcARwAnAO8A3sz6HcAVwAeATwBf8IgIQAGgA0AzrTPfRM8GPy8I6rLz2l1fPAR/2GVJNV4B3DwGf9jN+J7cuTM4Y4yEEFSWJUkpSWtNWmuSUlJZliSEIMbYVBKjlXCWPcsyUkrRFJRSlGXZ1HHMJ1wYhlRVFS1FVVUUhuFsYkau4FJKWgsp5VgSg6MobC+t2bmtEo4Ein4Cne3MfcHBia4vr3/YPodwc6GUcv0dh8Bo+wBpmoJz7k3LOedI09T26BiYi2WAPM/hGw6fJ9iE5xnmj/0RNmFihgwv/bS01ojj2GsF2rZFkiS/l78DbIzANBMDNE3jPZDD5z0wncwAdV17T8Dh82pVQSGEdxIKIZxquKkQ7UKKd3EZbX4db96Q7KIl20VTunlbvovBZBej2b8Np2zr8fwHFGE/6k/Mu0oAAAAASUVORK5CYII=",this.objectArray=[],this.H=[],this.N=[],this.U=[],this.G=[],this.X=null,this.Z=null,this.J=null,this.W=null,this.q=void 0,this.K="#FF0000",this.$=this.C.getRenderManager().renderer.domElement,this.tt=this.tt.bind(this),this.it=this.it.bind(this),this.nt=this.nt.bind(this),this.st=new $,this.et=new oi,this.rt=null,this.ht=null,this.ot={},this.ut()}var t,n,s;return t=i,(n=[{key:"editUrl",get:function(){return this._},set:function(t){this._=t}},{key:"centerUrl",get:function(){return this.L},set:function(t){this.L=t}},{key:"PointStyle",get:function(){return this.D},set:function(t){this.D=t}},{key:"operate",get:function(){return this.q},set:function(t){this.q=t;for(var i=0;i<this.U.length;i++)this.U[i].visible=!1,"move"===t?"center"===this.U[i]._opetype&&(this.U[i].visible=!0):"center"!==this.U[i]._opetype&&(this.U[i].visible=!0)}},{key:"LineStyle",get:function(){return this.F},set:function(t){this.F=t}},{key:"PolygonStyle",get:function(){return this.Y},set:function(t){this.Y=t}},{key:"DrawTool",get:function(){return this.P},set:function(t){if(this.P=t,"edit"!==this.P){for(var i=0;i<this.U.length;i++)this.U[i].remove();null!==this.ht&&(this.ht.parent.remove(this.ht),this.ht=null,this.C.enableUpdateRender()),this.H.length=0,this.N.length=0,this.U.length=0,this.Z=null,this.X=null}}},{key:"edit",value:function(t,i){if("none"===this.DrawTool||"edit"===this.DrawTool)if(t&&t.shapetype){if(!(0<this.U.length||null!==this.ht)&&(i||null==this.Z||this.Z.id!==t.id)&&(!t.opetype||"no"===t.opetype.type)){for(var n=0;n<this.U.length;n++)this.U[n].remove();null!==this.ht&&(this.ht.parent.remove(this.ht),this.ht=null,this.C.enableUpdateRender()),this.U.length=0,this.X=null,this.Z=t,i||(this.W=t.id),t.type===fengmap.FMType.POLYGON_MARKER?(this.ft(t),this.DrawTool="edit"):t.type===fengmap.FMType.LINE_MARKER?(this.ct(t),this.DrawTool="edit"):t.type===fengmap.FMType.IMAGE_MARKER&&(this.DrawTool="edit",this.J=null,this.lt(t))}}else{for(var s=0;s<this.U.length;s++)this.U[s].remove();this.U.length=0,(this.Z=null)!==this.ht&&(this.ht.parent.remove(this.ht),this.ht=null,this.C.enableUpdateRender())}}},{key:"on",value:function(t,i){this.et.k(t,i)}},{key:"dispose",value:function(){this.$.removeEventListener("mousedown",this.tt,!1),this.$.removeEventListener("mousemove",this.it,!1),this.$.removeEventListener("mouseup",this.nt,!1)}},{key:"createMarkerByInfo",value:function(t){var i;if("circle"===t.shapetype||"ellipse"===t.shapetype||"rect"===t.shapetype||"polygon"===t.shapetype)return i=new fengmap.FMPolygonMarkerEdit(t),e=this.C.getFloor(t.level),i.addTo(e),i.mapEdit=this,t.id&&(i.id=t.id),i;if("line"!==t.shapetype)return e=this.C.getFloor(t.level),(i=new fengmap.FMImageMarkerEdit(t)).addTo(e),i.mapEdit=this,t.id&&(i.id=t.id),i;var n=new fengmap.FMSegment;n.points=[];for(var s=0;s<t.points.length;s++)n.points.push({x:t.points[s].x,y:t.points[s].y,z:t.points[s].z});n.level=t.level,t.segments=[n];var e=new fengmap.FMLineMarkerEdit(t);return e.addTo(this.C),e.mapEdit=this,t.id&&(e.id=t.id),e}}])&&di(t.prototype,n),s&&di(t,s),Object.defineProperty(t,"prototype",{writable:!1}),i}(),Object.assign(t.prototype,{ut:function(){this.$.addEventListener("mousedown",this.tt,!1),this.$.addEventListener("mousemove",this.it,!1),this.$.addEventListener("mouseup",this.nt,!1)},vt:function(t,i){if(("none"===this.DrawTool||"edit"===this.DrawTool)&&(null!==this.ht&&(this.ht.parent.remove(this.ht),this.ht=null,this.C.enableUpdateRender()),t)&&(i||null==this.Z||this.Z.id!==t.id)&&(!t.opetype||"no"===t.opetype.type)){for(var n=0;n<this.U.length;n++)this.U[n].remove();this.U.length=0,this.X=null,this.Z=t,i||(this.W=t.id),t.type===fengmap.FMType.POLYGON_MARKER?(this.ft(t),this.DrawTool="edit"):t.type===fengmap.FMType.LINE_MARKER?(this.ct(t),this.DrawTool="edit"):t.type===fengmap.FMType.IMAGE_MARKER&&(this.DrawTool="edit",this.J=null,this.lt(t))}},dt:function(t){t=li({},t);return t.buildingID===this.C.getMapOptions().mapID&&(t.buildingID=null),t},yt:function(t,i){var n=new E;if(n.x=t/this.$.getBoundingClientRect().width*2-1,n.y=2*-(i/this.$.getBoundingClientRect().height)+1,"point"===this.Z.shapetype)return t=[this.Z.getRenderNode()],this.st.setFromCamera(n,this.C.camera),0<(i=this.st.intersectObjects(t,!0)).length?i[0].object:null;for(var s=[],e=0;e<this.U.length;e++)this.U[e].opetype.node.visible&&s.push(this.U[e].opetype.node);this.st.setFromCamera(n,this.C.camera);t=this.st.intersectObjects(s,!0);return 0<t.length?t[0].object:null},bt:function(t,i){var n=t.offsetX,t=t.offsetY,s=new g;s.x=n/this.$.clientWidth*2-1,s.y=2*-(t/this.$.clientHeight)+1,s.z=.5,this.st.setFromCamera(s,this.C.camera);var e,r=null,h=function(t,i){var n,s,e,r,h="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(h)return s=!(n=!0),{s:function(){h=h.call(t)},n:function(){var t=h.next();return n=t.done,t},e:function(t){s=!0,e=t},f:function(){try{n||null==h.return||h.return()}finally{if(s)throw e}}};if(Array.isArray(t)||(h=ai(t))||i&&t&&"number"==typeof t.length)return h&&(t=h),r=0,{s:i=function(){},n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(this.C.getRenderManager().getRenderList());try{for(h.s();!(e=h.n()).done;)for(var o=ui(e.value,2),u=(o[0],o[1]),a=this.st.intersectObject(u,!0),f=0;f<a.length;f++)a[f].object.mapNode&&(r=a[f].object)}catch(t){h.e(t)}finally{h.f()}null!==r&&r.mapNode?r.mapNode.type!==fengmap.FMType.LINE_MARKER?this.rt={buildingID:r.mapNode.parent.parent.parent.buildingID,level:r.mapNode.level}:(n=r.mapNode.segments[0],this.rt={buildingID:n.buildingID,level:n.level}):this.rt={buildingID:this.C.getMapOptions().mapID,level:this.C.getLevel()},i&&i()},tt:function(s){var e=this;this.bt(s,function(){if("none"!==e.DrawTool)if(2===s.button)"edit"!==e.DrawTool?e.Mt():(null!==e.X||null!==e.Z&&"point"===e.Z.shapetype)&&e.gt(),e.X=null;else{var t=s.clientX-e.$.getBoundingClientRect().left,i=s.clientY-e.$.getBoundingClientRect().top;if("edit"===e.DrawTool){if(null===e.X){if(null===e.Z)return;var n=e.yt(t,i);"point"!==e.Z.shapetype?null!==n&&(e.X=n.mapNode,e.At(!1)):null!==n&&(e.J={x:e.Z.x,y:e.Z.y},e.At(!1))}}else{n=fengmap.FMUtil.coordsScreenToMap(e.C,{x:t,y:i});n.buildingID=e.rt.buildingID,n.level=e.rt.level,"point"===e.DrawTool?(e.wt(n),e.et.V({type:"drawend",info:e.dt(e.currentobj.info),object:e.currentobj}),e.currentobj=null,e.rt=null):"line"===e.DrawTool?e.H.push(n):"circle"===e.DrawTool?0===e.N.length?e.N.push(n):(e.Et(n),e.et.V({type:"drawend",info:e.dt(e.currentobj.info),object:e.currentobj}),e.N.length=0,e.currentobj=null,e.rt=null):"rect"===e.DrawTool?0===e.N.length?e.N.push(n):(e.St(n),e.et.V({type:"drawend",info:e.dt(e.currentobj.info),object:e.currentobj}),e.N.length=0,e.currentobj=null,e.rt=null):"polygon"===e.DrawTool?e.N.push(n):"ellipse"===e.DrawTool&&(0===e.N.length?e.N.push(n):(e.Rt(n),e.et.V({type:"drawend",info:e.dt(e.currentobj.info),object:e.currentobj}),e.N.length=0,e.currentobj=null,e.rt=null))}}})},it:function(t){if("none"!==this.DrawTool){var i=t.clientX-this.$.getBoundingClientRect().left,t=t.clientY-this.$.getBoundingClientRect().top,i=fengmap.FMUtil.coordsScreenToMap(this.C,{x:i,y:t});if("edit"===this.DrawTool)return null!==this.Z&&"point"===this.Z.shapetype&&null!==this.J?(this.Z.moveTo({animate:!1,x:i.x,y:i.y}),void this.et.V({type:"drawing",info:this.dt(this.Z.info),object:this.Z})):void(null!==this.Z&&null!==this.X&&(this.jt(i),this.Z.id=this.W,this.et.V({type:"drawing",info:this.dt(this.Z.info),object:this.Z})));"line"===this.DrawTool?this.xt(i):"circle"===this.DrawTool?this.Et(i):"rect"===this.DrawTool?this.St(i):"polygon"===this.DrawTool?this.Ot(i):"ellipse"===this.DrawTool&&this.Rt(i),this.C.enableUpdateRender(),null!==this.currentobj&&this.et.V({type:"drawing",info:this.dt(this.currentobj.info),object:this.currentobj})}},nt:function(t){if(2!==t.button&&"edit"===this.DrawTool&&null!==this.Z&&("point"===this.Z.shapetype||null!==this.X)){if("point"===this.Z.shapetype)this.vt(this.Z,!0);else if("center"!==this.X.opetype.type){if("ellipse"===this.Z.shapetype||"circle"===this.Z.shapetype)this.J=this.Tt(this.Z.points);else if("rect"===this.Z.shapetype){this.J=this.Z.points;var t=this.kt("center"),i=(t.visible=!0,void 0!==this.q&&"edit"===this.q&&(t.visible=!1),this.kt("point",!0));t.position.x=(i[0].position.x+i[1].position.x)/2,t.position.z=(i[0].position.z+i[1].position.z)/2,this.G.length=0,this.G.push({x:Math.abs(i[0].position.x-i[1].position.x)/2,y:Math.abs(i[0].position.z-i[1].position.z)/2})}else if("polygon"===this.Z.shapetype){this.J=this.Z.points;for(var n=this.Tt(this.J).center,s=this.G.length=0;s<this.J.length;s++)this.G.push({x:this.J[s].x-n.x,y:this.J[s].y-n.y});t=this.kt("center");t.position.x=n.x-this.C.x,t.position.z=this.C.y-n.y}else if("line"===this.Z.shapetype){this.J=this.Z.points;for(var e=this.Tt(this.J).center,r=this.G.length=0;r<this.J.length;r++)this.G.push({x:this.J[r].x-e.x,y:this.J[r].y-e.y});i=this.kt("center");i.position.x=e.x-this.C.x,i.position.z=this.C.y-e.y}}else this.vt(this.Z,!0);this.At(!0),this.X=null,this.Z.id=this.W,this.et.V({type:"editend",info:this.dt(this.Z.info),object:this.Z})}},lt:function(t){t.getRenderNode().position;var i=[new g(-.5,0,.5),new g(-.5,0,-.5),new g(.5,0,-.5),new g(.5,0,.5),new g(-.5,0,.5)],i=(new Jt).setFromPoints(i),n=new k({color:new v(this.K)}),i=(n.depthTest=!1,n.depthWrite=!1,new si(i,n));i.scale.set(1.1,1.1,1.1),t.getRenderNode().add(i),this.ht=i,this.C.enableUpdateRender()},jt:function(t){if(null!==this.X){var s=this;if("ellipse"!==this.Z.shapetype?(this.X.opetype.node.position.x=t.x-this.C.x,this.X.opetype.node.position.z=this.C.y-t.y):"xradius"===this.X.opetype.type?this.X.opetype.node.position.x=t.x-this.C.x:("yradius"!==this.X.opetype.type&&(this.X.opetype.node.position.x=t.x-this.C.x),this.X.opetype.node.position.z=this.C.y-t.y),"circle"===this.Z.shapetype)"yradius"===this.X.opetype.type?(r=w("center"),this.N.length=0,this.N.push({x:this.C.x+r.position.x,y:this.C.y-r.position.z}),this.Et(t,!0)):(w("yradius").visible=!1,this.N.length=0,this.N.push({x:t.x,y:t.y}),this.Et({x:t.x,y:t.y+this.J.yradius},!0));else if("ellipse"===this.Z.shapetype)this.N.length=0,"yradius"===this.X.opetype.type||"xradius"===this.X.opetype.type?(r=w("center"),r={x:this.C.x+r.position.x,y:this.C.y-r.position.z},e=null,e="yradius"===this.X.opetype.type?this.Bt(r,this.J.xradius,Math.abs(r.y-t.y)):this.Bt(r,Math.abs(r.x-t.x),this.J.yradius),this.Rt(e,!0)):(w("xradius").visible=!1,w("yradius").visible=!1,r=this.Bt(t,this.J.xradius,this.J.yradius),this.Rt(r,!0));else if("rect"===this.Z.shapetype)if("center"===this.X.opetype.type){for(var i=w("point",!0),n=0;n<i.length;n++)i[n].visible=!1;this.N.length=0,this.N.push({x:t.x+this.G[0].x,y:t.y-this.G[0].y}),this.St({x:t.x-this.G[0].x,y:t.y+this.G[0].y},!0)}else{var e=w("center"),r=w("point",e.visible=!1,this.X.opetype.node.uuid);null!==r&&(this.N.length=0,this.N.push({x:this.C.x+r.position.x,y:this.C.y-r.position.z}),this.St(t,!0))}else if("polygon"===this.Z.shapetype)if("center"===this.X.opetype.type){for(var h=this.kt("point",!0),o=0;o<h.length;o++)h[o].visible=!1;for(var u=this.X.opetype.node.position.x,a=this.X.opetype.node.position.z,f=[],c=0;c<this.G.length;c++)f.push({x:u+this.G[c].x,y:a-this.G[c].y});this.Ot(f,!0)}else{for(var l=this.kt("point",!0),v=[],d=0;d<l.length;d++)v.push({x:l[d].position.x,y:l[d].position.z});this.Ot(v,!0)}else if("line"===this.Z.shapetype){var y=this.kt("point",!0),p=[];if("center"===this.X.opetype.type){for(var m=0;m<y.length;m++)y[m].visible=!1;for(var b=this.X.opetype.node.position.x,M=this.X.opetype.node.position.z,g=0;g<this.G.length;g++)p.push({x:b+this.G[g].x,y:M-this.G[g].y})}else for(var A=0;A<y.length;A++)p.push({x:y[A].position.x,y:y[A].position.z});this.xt(p,!0)}}function w(t,i,n){return s.kt(t,i,n)}},kt:function(t,i,n){var s=this,e=null;i&&(e=[]);for(var r=0;r<s.U.length;r++)if(s.U[r].opetype.type===t)if(i)(!n||s.U[r].opetype.node.uuid!==n)&&e.push(s.U[r].opetype.node);else{if(!n){e=s.U[r].opetype.node;break}if(s.U[r].opetype.node.uuid!==n){e=s.U[r].opetype.node;break}}return e},Mt:function(){var t;"line"===this.DrawTool?this.xt():"circle"===this.DrawTool?this.Et():"rect"===this.DrawTool?this.St():"polygon"===this.DrawTool?this.Ot():"ellipse"===this.DrawTool&&this.Rt(),"line"!==this.DrawTool&&"polygon"!==this.DrawTool||(t=!0,"line"===this.DrawTool?this.H.length<2&&(t=!1):"polygon"===this.DrawTool&&this.N.length<3&&(t=!1),t&&(this.et.V({type:"drawend",info:this.dt(this.currentobj.info),object:this.currentobj}),this.rt=null),"line"===this.DrawTool&&(this.H.length=0,this.currentobj=null),"polygon"===this.DrawTool&&(this.N.length=0,this.currentobj=null))},gt:function(){if(this.J){if("circle"===this.Z.shapetype)this.N.length=0,this.N.push({x:this.J.center.x,y:this.J.center.y}),this.Et({x:this.J.center.x,y:this.J.center.y+this.J.yradius},!0);else if("ellipse"===this.Z.shapetype){this.N.length=0;var t=this.Bt({x:this.J.center.x,y:this.J.center.y},this.J.xradius,this.J.yradius);this.Rt(t,!0)}else if("rect"===this.Z.shapetype)this.St(),this.vt(this.Z);else if("polygon"===this.Z.shapetype){for(var i=[],n=0;n<this.J.length;n++)i.push({x:this.J[n].x-this.C.x,y:this.C.y-this.J[n].y});this.Ot(i,!0)}else if("line"===this.Z.shapetype){for(var s=[],e=0;e<this.J.length;e++)s.push({x:this.J[e].x-this.C.x,y:this.C.y-this.J[e].y});this.xt(s,!0)}else if("point"===this.Z.shapetype)return this.Z.moveTo({animate:!1,x:this.J.x,y:this.J.y}),this.et.V({type:"editend",info:this.dt(this.Z.info),object:this.Z}),void(this.Z=null);this.Z.id=this.W,this.et.V({type:"editend",info:this.dt(this.Z.info),object:this.Z}),this.vt(this.Z,!0)}},wt:function(t){var i,n={},s=this.PointStyle;for(i in s)n[i]=s[i];n.x=t.x,n.y=t.y,n.buildingID=this.rt.buildingID;var t=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),e=new fengmap.FMImageMarkerEdit(n);e.addTo(t),(e.mapEdit=this).currentobj=e},xt:function(t,i){var n,s=new fengmap.FMSegment,e=(s.points=[],{}),r=this.LineStyle;for(n in r)e[n]=r[n];if(void 0===e.height&&(e.height=3),i){null!==this.Z&&this.Z.remove();for(var h=0;h<t.length;h++)s.points.push({x:this.C.x+t[h].x,y:this.C.y-t[h].y,z:e.height})}else{if(0===this.H.length)return;if(null!==this.currentobj&&(this.currentobj.remove(),!t)&&1===this.H.length)return;for(var o=0;o<this.H.length;o++)s.points.push({x:this.H[o].x,y:this.H[o].y,z:e.height});t&&s.points.push({x:t.x,y:t.y,z:e.height})}i?(s.level=this.rt.level,s.buildingID=this.rt.buildingID):(s.level=this.H[0].level,s.buildingID=this.H[0].buildingID),e.segments=[s];var u=new fengmap.FMLineMarkerEdit(e);u.addTo(this.C),u.mapEdit=this,i?this.Z=u:this.currentobj=u},Et:function(t,i){if(0!==this.N.length){if(i)null!==this.Z&&this.Z.remove();else if(null!==this.currentobj&&(this.currentobj.remove(),!t))return this.N.length=0,void(this.currentobj=null);var n,s=this.N[0],t=Math.sqrt((s.x-t.x)*(s.x-t.x)+(s.y-t.y)*(s.y-t.y)),e=this.PolygonStyle,r={};for(n in e)r[n]=e[n];r.points=fengmap.FMCalculator.circleBuilder(t,this.N[0],32),r.shapetype="circle";var h,t=new fengmap.FMPolygonMarkerEdit(r);i?(h=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),t.addTo(h)):(h=this.C.getBuilding(s.buildingID).getFloor(s.level),t.addTo(h)),t.mapEdit=this,i?this.Z=t:this.currentobj=t}},St:function(t,i){var n=[];if(t||i){if(0===this.N.length)return;if(i)null!==this.Z&&this.Z.remove();else if(null!==this.currentobj&&(this.currentobj.remove(),!t))return this.N.length=0,void(this.currentobj=null);var s=this.N[0],n=[s,{x:t.x,y:s.y},t,{x:s.x,y:t.y}]}else if("edit"===mapdraw.DrawTool)n=this.J,null!==this.Z&&this.Z.remove();else if(null!==this.currentobj)return this.currentobj.remove(),this.N.length=0,void(this.currentobj=null);if(0!==n.length){var e,r=this.PolygonStyle,h={};for(e in r)h[e]=r[e];h.points=n,h.shapetype="rect";s=new fengmap.FMPolygonMarkerEdit(h);i?(n=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),s.addTo(n)):(n=this.C.getBuilding(this.N[0].buildingID).getFloor(this.N[0].level),s.addTo(n)),s.mapEdit=this,!t&&!i||i?this.Z=s:this.currentobj=s}},Ot:function(t,i){var n=[];if(i){null!==this.Z&&this.Z.remove();for(var s=0;s<t.length;s++)n.push({x:this.C.x+t[s].x,y:this.C.y-t[s].y})}else{if(0===this.N.length)return;null!==this.currentobj&&this.currentobj.remove();for(var e=0;e<this.N.length;e++)n.push({x:this.N[e].x,y:this.N[e].y});if(t)n.push({x:t.x,y:t.y});else if(2===n.length)return}var r,h=this.PolygonStyle,o={};for(r in h)o[r]=h[r];o.points=n;var u,a=new fengmap.FMPolygonMarkerEdit(o);i?(u=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),a.addTo(u)):(u=this.C.getBuilding(this.N[0].buildingID).getFloor(this.N[0].level),a.addTo(u)),a.mapEdit=this,i?this.Z=a:this.currentobj=a},Rt:function(t,i){var n=null;if(i)null!==this.Z&&this.Z.remove(),n=t;else{if(0===this.N.length)return;if(null!==this.currentobj&&this.currentobj.remove(),!t)return this.N.length=0,void(this.currentobj=null);var s=this.N[0],e=Math.abs(t.x-s.x),t=Math.abs(t.y-s.y),n=t<e?this.Bt(s,e,e/2):this.Bt(s,t/2,t)}for(var r=[],h=0;h<n.length;h++)r.push({x:n[h].x,y:n[h].y});var o,u=this.PolygonStyle,a={};for(o in u)a[o]=u[o];a.points=r,a.shapetype="ellipse";e=new fengmap.FMPolygonMarkerEdit(a);i?(s=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),e.addTo(s)):(t=this.C.getBuilding(this.N[0].buildingID).getFloor(this.N[0].level),e.addTo(t)),e.mapEdit=this,i?this.Z=e:this.currentobj=e},Bt:function(t,i,n){return new s(t.x,t.y,i,n,0,2*Math.PI,!1,0).getPoints(32)},ct:function(t){for(var i=[],n=(this.J=t.points,this.Tt(t.points).center),s=this.G.length=0;s<t.points.length;s++)i.push(t.points[s]),this.G.push({x:t.points[s].x-n.x,y:t.points[s].y-n.y});i.push({x:n.x,y:n.y,optype:"center"}),this.It(i,t)},ft:function(t){var i,n=this,s=[];if("polygon"===t.shapetype){this.J=t.points;for(var e=this.Tt(t.points).center,r=this.G.length=0;r<t.points.length;r++)s.push(t.points[r]),this.G.push({x:t.points[r].x-e.x,y:t.points[r].y-e.y});s.push({x:e.x,y:e.y,optype:"center"})}else"rect"===t.shapetype?(this.J=t.points,s.push(t.points[0]),s.push(t.points[2]),s.push({x:(t.points[0].x+t.points[2].x)/2,y:(t.points[0].y+t.points[2].y)/2,optype:"center"}),this.G.length=0,this.G.push({x:Math.abs(t.points[0].x-t.points[2].x)/2,y:Math.abs(t.points[0].y-t.points[2].y)/2})):"circle"!==t.shapetype&&"ellipse"!==t.shapetype||(i=this.Tt(t.points),this.J=i,s.push({x:i.center.x,y:i.center.y,optype:"center"}),s.push({x:i.center.x,y:i.center.y+i.yradius,optype:"yradius"}),"ellipse"===t.shapetype&&s.push({x:i.center.x+i.xradius,y:i.center.y,optype:"xradius"}));n.It(s,t)},It:function(t,i){for(var n=this,s=(n.C.getFloor(n.C.getLevel()),0);s<t.length;s++){var e=(e=t[s].optype)||"point",r=n.editUrl,r=("center"===e&&(r=n.centerUrl),new fengmap.FMImageMarkerEdit({url:r,size:16,height:i.height+1,x:t[s].x,y:t[s].y,collision:!1,opetype:e})),h=this.C.getBuilding(i.info.buildingID).getFloor(i.info.level);r.addTo(h),void 0!==this.q&&("move"===this.q?"center"!==e&&(r.visible=!1):"edit"===this.q&&"center"===e&&(r.visible=!1)),n.U.push(r)}},Tt:function(t){for(var i=null,n=null,s=null,e=null,r=0;r<t.length;r++)0===r?(i=t[r].x,n=t[r].y,s=t[r].x,e=t[r].y):(i>t[r].x&&(i=t[r].x),n>t[r].y&&(n=t[r].y),s<t[r].x&&(s=t[r].x),e<t[r].y&&(e=t[r].y));return{center:{x:(i+s)/2,y:(n+e)/2},xradius:Math.abs(s-i)/2,yradius:Math.abs(e-n)/2}},Vt:function(t){var i=t.buildingID,t=t.level;null===i&&(i=this.C.getMapOptions().mapID,t=this.C.getLevel()),null===this.currentobj&&(this.rt={buildingID:i,level:t})},At:function(t){var i=this.C.getInteracations();t?(i.enableDrag=this.ot.enableDrag,i.enableRotate=this.ot.enableRotate,i.enableTilt=this.ot.enableTilt,i.enableZoom=this.ot.enableZoom):(this.ot.enableDrag=i.enableDrag,this.ot.enableRotate=i.enableRotate,this.ot.enableTilt=i.enableTilt,this.ot.enableZoom=i.enableZoom,i.enableDrag=t,i.enableRotate=t,i.enableTilt=t,i.enableZoom=t)},Ct:function(t){if(this.Z&&this.Z.id===t){for(var i=0;i<this.U.length;i++)this.U[i].remove();this.U.length=0}}});function pi(t){return(pi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function mi(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,function(t){t=function(t,i){if("object"!=pi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=pi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==pi(t)?t:String(t)}(s.key),s)}}var bi=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")}var i,n,s;return i=t,s=[{key:"round",value:function(t){return 0<t.toFixed(2)?Math.ceil(t.toFixed(2)):Math.floor(t.toFixed(2))}},{key:"generateUUID",value:function(){for(var t=[],i=0;i<256;i++)t[i]=(i<16?"0":"")+i.toString(16);var n=4294967295*Math.random()|0,s=4294967295*Math.random()|0,e=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=t[255&n]+t[n>>8&255]+t[n>>16&255]+t[n>>24&255]+"-"+t[255&s]+t[s>>8&255]+"-"+t[s>>16&15|64]+t[s>>24&255]+"-"+t[63&e|128]+t[e>>8&255]+"-"+t[e>>16&255]+t[e>>24&255]+t[255&r]+t[r>>8&255]+t[r>>16&255]+t[r>>24&255];return t.length=0,n.toUpperCase()}},{key:"findNearNthPowerOfTwo",value:function(t){t-=1;return(t=(t=(t=(t=(t|=t>>1)|t>>2)|t>>4)|t>>8)|t>>16)<0?1:1+t}},{key:"rgbToArray",value:function(t){var i=new v;return i.setStyle(t),[i.r,i.g,i.b]}},{key:"toRgba",value:function(t){var i;return void 0===t?t:"number"!=typeof t?3<=(i=t.split(",")).length?"rgba("+parseInt(i[0])+","+parseInt(i[1])+","+parseInt(i[2])+",1)":t:"rgba("+parseInt(255*new v(t).r)+","+parseInt(255*new v(t).g)+","+parseInt(255*new v(t).b)+",1)"}},{key:"toColor",value:function(t){var i;return"number"==typeof t?t:3<=(i=t.split(",")).length?parseInt(i[0])<<16|parseInt(i[1])<<8|parseInt(i[2]):(console.error("color format error",t),0)}},{key:"cov",value:function(t){for(var i=[],n=[0,0],s=[],e=0;e<t.length;e++)n[0]+=t[e].x,n[1]+=t[e].y;n[0]=n[0]/t.length,n[1]=n[1]/t.length;for(var r=0;r<t.length;r++)s.push([t[r].x-n[0],t[r].y-n[1]]);for(var h=[],o=0;o<s[0].length;o++){for(var u=[],a=0;a<s.length;a++)u.push(s[a][o]);h.push(u)}for(var f=0;f<h.length;f++){for(var c=[],l=0;l<s[0].length;l++){for(var v=0,d=0;d<h[f].length;d++)v+=h[f][d]*s[d][l];v/=t.length-1,c.push(v)}i.push(c)}return i}},{key:"eig",value:function(t){var i=(t[0][0]+t[1][1])/2,n=t[0][0]*t[1][1]-t[1][0]*t[0][1],s=i+Math.sqrt(i*i-n),i=i-Math.sqrt(i*i-n);return 0==t[0][1]&&0==t[1][0]?{eigValue:[s,i],eigVect:[[1,0],[0,1]]}:(n=(s-t[0][0])/t[0][1],t=(i-t[0][0])/t[0][1],{eigValue:[s,i],eigVect:[[1/Math.sqrt(1+n*n),n/Math.sqrt(1+n*n)],[1/Math.sqrt(1+t*t),t/Math.sqrt(1+t*t)]]})}}],(n=null)&&mi(i.prototype,n),s&&mi(i,s),Object.defineProperty(i,"prototype",{writable:!1}),t}();function Mi(t){return(Mi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gi(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,function(t){t=function(t,i){if("object"!=Mi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=Mi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==Mi(t)?t:String(t)}(s.key),s)}}function Ai(t,i,n){i=Si(i);var s=t,i=wi()?Reflect.construct(i,n||[],Si(t).constructor):i.apply(t,n);if(i&&("object"===Mi(i)||"function"==typeof i))return i;if(void 0!==i)throw new TypeError("Derived constructors may only return object or undefined");t=s;if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function wi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wi=function(){return!!t})()}function Ei(){return(Ei="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,i,n){var s=function(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&null!==(t=Si(t)););return t}(t,i);if(s)return(s=Object.getOwnPropertyDescriptor(s,i)).get?s.get.call(arguments.length<3?t:n):s.value}).apply(this,arguments)}function Si(t){return(Si=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ri(t,i){return(Ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t})(t,i)}var ji=function(t){var i,n=s;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");function s(t){var i;if(this instanceof s)return(i=Ai(this,s,[t])).info2=t,i.id=""+bi.generateUUID(),i.shapetype2="point",i.opetype2="no",t.opetype&&(i.opetype2=t.opetype,i.shapetype2="no"),i.mapEdit=null,i;throw new TypeError("Cannot call a class as a function")}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),t&&Ri(n,t),n=s,(t=[{key:"info",get:function(){return this.info2.id=this.id,this.info2.x=this.x,this.info2.y=this.y,this.info2.height=this.height,this.info2.shapetype=this.shapetype,this.info2.level=this.level,this.info2}},{key:"opetype",get:function(){if(this.opetype2)return{node:this.getRenderNode(),type:this.opetype2}}},{key:"shapetype",get:function(){return this.shapetype2}},{key:"deleteMarker",value:function(){Ei(Si(s.prototype),"remove",this).call(this)}}])&&gi(n.prototype,t),i&&gi(n,i),Object.defineProperty(n,"prototype",{writable:!1}),s}(fengmap.FMImageMarker);function xi(i,t){var n,s=Object.keys(i);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(i),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})),s.push.apply(s,n)),s}function Oi(s){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?xi(Object(e),!0).forEach(function(t){var i,n;i=s,n=e[t=t],(t=Pi(t))in i?Object.defineProperty(i,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):i[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(e)):xi(Object(e)).forEach(function(t){Object.defineProperty(s,t,Object.getOwnPropertyDescriptor(e,t))})}return s}function Ti(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var s,e,r,h,o=[],u=!0,a=!1;try{if(r=(n=n.call(t)).next,0===i){if(Object(n)!==n)return;u=!1}else for(;!(u=(s=r.call(n)).done)&&(o.push(s.value),o.length!==i);u=!0);}catch(t){a=!0,e=t}finally{try{if(!u&&null!=n.return&&(h=n.return(),Object(h)!==h))return}finally{if(a)throw e}}return o}}(t,i)||Bi(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ki(t,i){var n,s,e,r,h="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(h)return s=!(n=!0),{s:function(){h=h.call(t)},n:function(){var t=h.next();return n=t.done,t},e:function(t){s=!0,e=t},f:function(){try{n||null==h.return||h.return()}finally{if(s)throw e}}};if(Array.isArray(t)||(h=Bi(t))||i&&t&&"number"==typeof t.length)return h&&(t=h),r=0,{s:i=function(){},n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Bi(t,i){var n;if(t)return"string"==typeof t?Ii(t,i):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ii(t,i):void 0}function Ii(t,i){(null==i||i>t.length)&&(i=t.length);for(var n=0,s=new Array(i);n<i;n++)s[n]=t[n];return s}function Vi(t){return(Vi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ci(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,Pi(s.key),s)}}function Pi(t){t=function(t,i){if("object"!=Vi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=Vi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==Vi(t)?t:String(t)}var Di=function(){function i(t){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");this.C=t,this.Pt=null,this.Dt=!1,this.$=this.C.getRenderManager().renderer.domElement,this.D={url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5QoOAiAd1TTTFgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABfElEQVRYw81XO26EMBB9poAIrBwh2hPgMt1WS7cSN+AonAXtIahSpfLWVNtFewXLkG7SeCVIbH5rBZ40jYGZ8fjxPMOwDAcARwAnAO8A3sz6HcAVwAeATwBf8IgIQAGgA0AzrTPfRM8GPy8I6rLz2l1fPAR/2GVJNV4B3DwGf9jN+J7cuTM4Y4yEEFSWJUkpSWtNWmuSUlJZliSEIMbYVBKjlXCWPcsyUkrRFJRSlGXZ1HHMJ1wYhlRVFS1FVVUUhuFsYkau4FJKWgsp5VgSg6MobC+t2bmtEo4Ein4Cne3MfcHBia4vr3/YPodwc6GUcv0dh8Bo+wBpmoJz7k3LOedI09T26BiYi2WAPM/hGw6fJ9iE5xnmj/0RNmFihgwv/bS01ojj2GsF2rZFkiS/l78DbIzANBMDNE3jPZDD5z0wncwAdV17T8Dh82pVQSGEdxIKIZxquKkQ7UKKd3EZbX4db96Q7KIl20VTunlbvovBZBej2b8Np2zr8fwHFGE/6k/Mu0oAAAAASUVORK5CYII=",size:32,height:1,collision:!1},this.K="#FF0000",this.F={width:5,type:X.FULL,color:"#FF0000",height:3},this.Y={color:"#FF0000",borderWidth:3,borderColor:"#0000FF",opacity:.5,height:3},this.L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5QocCDgHXcqo9wAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAEQ0lEQVRYw71XTWhcVRg9584kVGzHZKYlTFpsJ/PeKBaKMjN05aYIKgguupASqaKCC1cFVxaSaQW7dSW4KRFBEETEje5qtWK1SdP409L0zZgpJrEtvqY/qebNe/e46KSZDMkkmSR9mwdz35zv3O8737nfJdbxuG7xdQp7EfCj8au//NkORqzd4Lls8S0SgzR8UTHbm0qlr/r+9ORDIZDLFt6B4SDJXQBAci/AbHeyd8L3p6qbSsB1C++SLJHc0fg7yQyFbFd37z83b05d3hQCrls8SrBEcutS6yR3k8wnU713fH9qbEMJuG7hPYIDAAyAGsl447qk6wDmACQIPJVMpWd8f/r3lXDjqwne07PvUQmXBfUbKQS5U8AAyZ568LNW0RGJAalOyRgTRbN1srYVNtsR4Z49hSc6O3iKZBoArPTjzMzsCzduXLy7VizTDgGSAqCGXdDaqK3NmI0S6PYVSrgmAq6bP+S6+cKyzGI2WlxbsRWDbds6D7hu/vCqCOScwquAGaSNpZcDrNXCCEDYWJQoeowtSpYizIDrFl9rScBxiv0gBwn2yWhZwI4OGy4ioNZilhAA2G2AweZMxBvs9RVQA6RxJNQAPJ3LFW8jVCeoTruo77mjqYUTgD3oOIXbS6dZ++9LlRnKDDhOMfS8c589aEPHKRw0xDHS7G0wlrsADSBTz5RpSmuzEYUrdE584Vt7EVZHx8sjXzGXzb8sY44bch8e4mOlc5I9akA+u1xwafG7YWXdBAxZNOBLcYvwpLEdvTQ8tCiE1Q8wGJMQSYoEhhRrov6jkAD1Jsnk/Dkg4AsCNUgEDAFRBAGQQo6GzzWV7DsLfFnXQD5rYAZoeHh+h7I6Mu4Nf7gU+76+/ONxY07RsK9O9ufQ2ucrlZFbS33vOMV+Q3xCMvYguFTyvOHTBgA8b6Q8VwsGZe3QfHrZIs9RZAIRwarTfb+rVK/9mcja4543fHqRD1SrYxNBGJUEDa0IaMyaRGCpCKBk7RgjfVAuj5xa0ogmJkarsVhUkrVDUYtTlPxXBKM1HF5WUhnCifHK8DctrfjSpdFqENpSLDTfLgcYBGEIaG61BKRoGrTHx8vDn69qIJmYGG05WG7ZsjUEtGoNeN75cwDOtj0RAUAms79nYUfBNjIeNQnzkXQ6XwMAa2sEgGvXfp2dX17XROQ4ToLsehvgGw1/dObtVcI9wf5kAAokYI3A74Hax1eujE2ueyj1fX8ukeiZjMXMk4Y8QHI7SbMgMnSQ6AOZIZERUJEw5Hmjv23YVDwz8/etVGJXBUZZktkmVwPJusfbr62N3i+Xz5/Z8HuBPzN5rTvZe5VAhuSehjabD/4pYEued2F0025Gvj9VTXalrwvMk9y+cHbYoaAWliqVC96m3w39m9NXUqn0HYDPkOiywslaGB2rVi9U14rV9u3Y96fHkqmd92T1x1ygE9Xq+b/awfkfmzntCAO/rwcAAAAASUVORK5CYII=",this.Ft=16,this.Yt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5QoOAiAd1TTTFgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABfElEQVRYw81XO26EMBB9poAIrBwh2hPgMt1WS7cSN+AonAXtIahSpfLWVNtFewXLkG7SeCVIbH5rBZ40jYGZ8fjxPMOwDAcARwAnAO8A3sz6HcAVwAeATwBf8IgIQAGgA0AzrTPfRM8GPy8I6rLz2l1fPAR/2GVJNV4B3DwGf9jN+J7cuTM4Y4yEEFSWJUkpSWtNWmuSUlJZliSEIMbYVBKjlXCWPcsyUkrRFJRSlGXZ1HHMJ1wYhlRVFS1FVVUUhuFsYkau4FJKWgsp5VgSg6MobC+t2bmtEo4Ein4Cne3MfcHBia4vr3/YPodwc6GUcv0dh8Bo+wBpmoJz7k3LOedI09T26BiYi2WAPM/hGw6fJ9iE5xnmj/0RNmFihgwv/bS01ojj2GsF2rZFkiS/l78DbIzANBMDNE3jPZDD5z0wncwAdV17T8Dh82pVQSGEdxIKIZxquKkQ7UKKd3EZbX4db96Q7KIl20VTunlbvovBZBej2b8Np2zr8fwHFGE/6k/Mu0oAAAAASUVORK5CYII=",this.Lt=16,this.rt=null,this._t=null,this.Z=null,this.X=null,this.U=[],this.Ht=[],this.G=[],this.J=null,this.tt=this.tt.bind(this),this.it=this.it.bind(this),this.nt=this.nt.bind(this),this.ot={},this.st=new $,this.et=new oi,this.ut()}var t,n,s;return t=i,(n=[{key:"operationType",get:function(){return this.Pt},set:function(t){if(this.Z&&this.Z.type===fengmap.FMType.IMAGE_MARKER&&this.Z.oldUrl&&(this.Z.url=this.Z.oldUrl),this.Pt=t,this._t=null,this.rt=null,"edit"!==this.Pt){for(var i=0;i<this.U.length;i++)this.U[i].remove();this.U.length=0,this.Z=null}}},{key:"markers",get:function(){for(var t=[this.C.getBuilding(this.C.getMapOptions().mapID)],i=this.C.getBuildings(),n=0;n<i.length;n++)t.push(i[n]);for(var s=[],e=0;e<t.length;e++)for(var r=t[e].children,h=0;h<r.length;h++)for(var o=r[h].getLayers(fengmap.FMType.IMAGE_MARKER|fengmap.FMType.POLYGON_MARKER),u=0;u<o.length;u++)for(var a=o[u].children,f=0;f<a.length;f++)void 0!==a[f].operationType&&(a[f].buildingID=t[e].buildingID,a[f].markerType=a[f].type,s.push(a[f]));for(var c=this.C.getMarkerGroup().children,l=0;l<c.length;l++)c[l].type===fengmap.FMType.LINE_MARKER&&void 0!==c[l].operationType&&(c[l].markerType=c[l].type,s.push(c[l]));return s}},{key:"setStyle",value:function(t,i){"lineStyle"===t?this.F=i:"polygonStyle"===t?this.Y=i:"pointStyle"===t?this.D=i:"centerStyle"===t?(this.L=i.url,void 0!==i.size&&(this.Ft=i.size)):"editStyle"===t?(this.Yt=i.url,void 0!==i.size&&(this.Lt=i.size)):"pointRectColor"===t&&(this.K=i)}},{key:"getStyle",value:function(t){return"lineStyle"===t?this.F:"polygonStyle"===t?this.Y:"pointStyle"===t?this.D:"centerStyle"===t?{url:this.L,size:this.Ft}:"editStyle"===t?{url:this.Yt,size:this.Lt}:"pointRectColor"===t?this.K:void 0}},{key:"enable",value:function(){this.Dt=!0}},{key:"disable",value:function(){this.Dt=!1,this.cancel()}},{key:"delete",value:function(t){this.cancel(),t.remove(),this.et.V({type:"deleted",target:t})}},{key:"add",value:function(t){var i=null;if(t.markerType===fengmap.FMType.IMAGE_MARKER){void 0===t.operationType&&(t.operationType="addPoint");var n,s=t.level,e=t.buildingID,e=(void 0===e&&(e=this.C.getMapOptions().mapID),this.C.getBuilding(e));for(n in this.D)void 0===t[n]&&(t[n]=this.D[n]);(i=new fengmap.FMImageMarker(t)).operationType=t.operationType,i.addTo(e.getFloor(s))}else if(t.markerType===fengmap.FMType.LINE_MARKER){for(var r in void 0===t.operationType&&(t.operationType="addLine"),this.F)void 0===t[r]&&(t[r]=this.F[r]);(i=new fengmap.FMLineMarker(t)).operationType=t.operationType,i.addTo(this.C)}else if(t.markerType===fengmap.FMType.POLYGON_MARKER){void 0===t.operationType&&(t.operationType="addPolygon");var h,e=t.level,s=t.buildingID,s=(void 0===s&&(s=this.C.getMapOptions().mapID),this.C.getBuilding(s));for(h in this.Y)void 0===t[h]&&(t[h]=this.Y[h]);(i=new fengmap.FMPolygonMarker(t)).operationType=t.operationType,i.addTo(s.getFloor(e))}return i}},{key:"edit",value:function(t){this.operationType="edit",this.Z&&this.Z.type===fengmap.FMType.IMAGE_MARKER&&(this.Z.url=this.Z.oldUrl);for(var i,n=0;n<this.U.length;n++)this.U[n].remove();this.U.length=0,this.Z=null,t&&((this.Z=t).type===fengmap.FMType.LINE_MARKER?(t.operationType||(t.operationType="addLine"),i=(i=t.segments[0].buildingID)||this.C.getMapOptions().mapID,this.ct({points:t.segments[0].points,height:t.height,info:{buildingID:i,level:t.segments[0].level}})):t.type===fengmap.FMType.POLYGON_MARKER?(t.operationType||(t.operationType="addPolygon"),this.ft({points:t.points,height:t.height,operationType:t.operationType,info:{buildingID:t.parent.parent.parent.buildingID,level:t.level}})):t.type===fengmap.FMType.IMAGE_MARKER&&(t.operationType||(t.operationType="addPoint"),this.J=null,this.lt(t)))}},{key:"cancel",value:function(){if("edit"===this.Pt){this.Z.type===fengmap.FMType.IMAGE_MARKER&&this.edit(null);for(var t=0;t<this.U.length;t++)this.U[t].remove();this.U.length=0,this.Z=null}else this.Nt()}},{key:"dispose",value:function(){this.$.removeEventListener("mousedown",this.tt,!1),this.$.removeEventListener("mousemove",this.it,!1),this.$.removeEventListener("mouseup",this.nt,!1)}},{key:"on",value:function(t,i){this.et.k(t,i)}}])&&Ci(t.prototype,n),s&&Ci(t,s),Object.defineProperty(t,"prototype",{writable:!1}),i}(),B=(Object.assign(Di.prototype,{ut:function(){this.$.addEventListener("mousedown",this.tt,!1),this.$.addEventListener("mousemove",this.it,!1),this.$.addEventListener("mouseup",this.nt,!1)},bt:function(t,i){var n=t.clientX-this.$.getBoundingClientRect().left,t=t.clientY-this.$.getBoundingClientRect().top,s=new g;s.x=n/this.$.getBoundingClientRect().width*2-1,s.y=2*-(t/this.$.getBoundingClientRect().height)+1,s.z=.5,this.st.setFromCamera(s,this.C.camera);var e,r=null,h=ki(this.C.getRenderManager().getRenderList());try{for(h.s();!(e=h.n()).done;)for(var o=Ti(e.value,2),u=(o[0],o[1]),a=this.st.intersectObject(u,!0),f=0;f<a.length;f++)a[f].object.mapNode&&(r=a[f].object)}catch(t){h.e(t)}finally{h.f()}null!==r&&r.mapNode?r.mapNode.type!==fengmap.FMType.LINE_MARKER?this.rt={buildingID:r.mapNode.parent.parent.parent.buildingID,level:r.mapNode.level}:(n=r.mapNode.segments[0],this.rt={buildingID:n.buildingID,level:n.level}):this.rt={buildingID:this.C.getMapOptions().mapID,level:this.C.getLevel()},i&&i()},tt:function(s){var e=this;this.Dt&&(null===this.Pt||"delete"===this.Pt?this.Ht.length=0:this.bt(s,function(){var t,i,n;2===s.button?"edit"!==e.Pt&&e.Nt():(t=s.clientX-e.$.getBoundingClientRect().left,i=s.clientY-e.$.getBoundingClientRect().top,"edit"===e.Pt?(e.Ht.length=0,(n=e.Ut(t,i))?(e.X=n.mapNode,e.At(!1)):(n=e.Gt(t,i))&&n.mapNode&&n.mapNode.type===fengmap.FMType.IMAGE_MARKER&&(e.X=n.mapNode,e.edit(n.mapNode),e.At(!1))):((n=fengmap.FMUtil.coordsScreenToMap(e.C,{x:t,y:i})).buildingID=e.rt.buildingID,n.level=e.rt.level,"addPoint"===e.Pt?(e.wt(n),e.et.V({type:"drawn",target:e._t}),e._t=null,e.rt=null):"addLine"===e.Pt||"addPolygon"===e.Pt||0===e.Ht.length?e.Ht.push(n):(e.Xt(n),e.et.V({type:"drawn",target:e._t}),e.Ht.length=0,e._t=null,e.rt=null)))}))},it:function(t){var i,n;this.Dt&&(i=t.clientX-this.$.getBoundingClientRect().left,t=t.clientY-this.$.getBoundingClientRect().top,i=fengmap.FMUtil.coordsScreenToMap(this.C,{x:i,y:t}),"edit"===this.Pt?(n=t=0,this.X&&(t=i.x-this.X.x,n=i.y-this.X.y,this.X.moveTo({animate:!1,x:i.x,y:i.y})),this.X&&this.X.opetype2&&this.jt(t,n),null!==this.Z&&null!==this.X&&this.et.V({type:"drawing",target:this.Z})):("addLine"===this.Pt?this.xt(i):"addPolygon"===this.Pt?this.Ot(i):this.Xt(i),null!==this._t&&(this._t.operationType=this.Pt,this.et.V({type:"drawing",target:this._t}))))},nt:function(t){var i,n;this.Dt&&(i=t.clientX-this.$.getBoundingClientRect().left,t=t.clientY-this.$.getBoundingClientRect().top,"delete"===this.Pt?(n=this.Gt(i,t))&&n.mapNode&&this.delete(n.mapNode):"edit"===this.Pt&&(null===this.X?(n=this.Gt(i,t))&&n.mapNode?this.edit(n.mapNode):n||this.edit(null):(this.At(!0),this.X=null,this.et.V({type:"edited",target:this.Z}))))},jt:function(t,i){for(var n=[],s=null,e=[],r=0;r<this.U.length;r++)"center"===this.U[r].opetype2?s=this.U[r]:(e.push(this.U[r]),n.push({x:this.U[r].x,y:this.U[r].y}));var h=this.Tt(n).center;if("center"===this.X.opetype2)for(var o=0;o<n.length;o++)n[o].x=n[o].x+t,n[o].y=n[o].y+i,e[o].moveTo({animate:!1,x:n[o].x,y:n[o].y});if("addLine"===this.Z.operationType||"addPolygon"===this.Z.operationType){var u=this.F.height;if(void 0===u&&(u=3),"addLine"===this.Z.operationType)for(var a=0;a<n.length;a++)n[a].z=u;"center"!==this.X.opetype2&&s.moveTo({animate:!1,x:h.x,y:h.y}),"addLine"===this.Z.operationType?((f=new fengmap.FMSegment).points=n,f.level=this.rt.level,f.buildingID=this.rt.buildingID,f=Oi(Oi({},this.F),{},{segments:[f]}),(f=new fengmap.FMLineMarker(f)).userID=this.Z.userID,f.operationType=this.Z.operationType,f.addTo(this.C),this.Z.remove(),this.Z=f):this.Z.points=n}else if("addRectangle"===this.Z.operationType){"center"!==this.X.opetype2&&s.moveTo({animate:!1,x:h.x,y:h.y});var f=Math.abs(e[0].x-e[1].x),c=Math.abs(e[0].y-e[1].y);this.Z.points=fengmap.FMCalculator.rectangleBuilder(f,c,h)}else if("addCircle"===this.Z.operationType){f=this.U[0].x-this.U[1].x,c=this.U[0].y-this.U[1].y,h=Math.sqrt(f*f+c*c);this.Z.points=fengmap.FMCalculator.circleBuilder(h,{x:s.x,y:s.y},32)}else if("addEllipse"===this.Z.operationType)if("center"===this.X.opetype2){f=this.Tt(this.Z.points);this.Z.points=this.Bt({x:s.x,y:s.y},f.xradius,f.yradius)}else{for(var l=null,v=null,d=0;d<e.length;d++)"xradius"===e[d].opetype2?l=Math.abs(e[d].x-s.x):v=Math.abs(e[d].y-s.y);null!==l&&null!==v&&(this.Z.points=this.Bt({x:s.x,y:s.y},l,v))}},Ut:function(t,i){for(var n=new E,s=(n.x=t/this.$.getBoundingClientRect().width*2-1,n.y=2*-(i/this.$.getBoundingClientRect().height)+1,this.st.setFromCamera(n,this.C.camera),[]),e=0;e<this.U.length;e++)s.push(this.U[e].getRenderNode());t=this.st.intersectObjects(s,!0);return 0<t.length?t[0].object:null},Gt:function(t,i){var n,s=new E,e=(s.x=t/this.$.getBoundingClientRect().width*2-1,s.y=2*-(i/this.$.getBoundingClientRect().height)+1,this.st.setFromCamera(s,this.C.camera),[]),r=ki(this.C.getRenderManager().getRenderList());try{for(r.s();!(n=r.n()).done;){var h=Ti(n.value,2),o=h[0],u=h[1],a=o.split("%A%B%C%D")[2];if(a===""+fengmap.FMType.LINE_MARKER||a===""+fengmap.FMType.IMAGE_MARKER||a===""+fengmap.FMType.POLYGON_MARKER)for(var f=u.children,c=0;c<f.length;c++){var l=f[c].mapNode;l&&void 0!==l.operationType&&e.push(f[c])}}}catch(t){r.e(t)}finally{r.f()}t=this.st.intersectObjects(e,!0);return 0<t.length?t[0].object:null},Xt:function(t){"addCircle"===this.Pt?this.Et(t):"addEllipse"===this.Pt?this.Rt(t):"addRectangle"===this.Pt&&this.St(t)},Ot:function(t,i){var n=[],s=null;if(i){null!==this.Z&&this.Z.remove();for(var e=0;e<t.length;e++)n.push({x:this.C.x+t[e].x,y:this.C.y-t[e].y})}else{if(0===this.Ht.length)return;null!==this._t&&(s=this._t.userID,this._t.remove());for(var r=0;r<this.Ht.length;r++)n.push({x:this.Ht[r].x,y:this.Ht[r].y});if(t)n.push({x:t.x,y:t.y});else if(2===n.length)return}var h,o=this.Y,u={};for(h in o)u[h]=o[h];u.points=n;var a,f=new fengmap.FMPolygonMarker(u);i?(a=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),f.addTo(a)):(a=this.C.getBuilding(this.Ht[0].buildingID).getFloor(this.Ht[0].level),f.addTo(a)),f.operationType=this.Pt,i?this.Z=f:(this._t=f,null!==s&&(this._t.userID=s))},xt:function(t,i){var n,s=new fengmap.FMSegment,e=(s.points=[],null),r={},h=this.F;for(n in h)r[n]=h[n];if(void 0===r.height&&(r.height=3),i){null!==this.Z&&this.Z.remove();for(var o=0;o<t.length;o++)s.points.push({x:this.C.x+t[o].x,y:this.C.y-t[o].y,z:r.height})}else{if(0===this.Ht.length)return;if(null!==this._t&&(e=this._t.userID,this._t.remove(),!t)&&1===this.Ht.length)return;for(var u=0;u<this.Ht.length;u++)s.points.push({x:this.Ht[u].x,y:this.Ht[u].y,z:r.height});t&&s.points.push({x:t.x,y:t.y,z:r.height})}i?(s.level=this.rt.level,s.buildingID=this.rt.buildingID):(s.level=this.Ht[0].level,s.buildingID=this.Ht[0].buildingID),r.segments=[s];var a=new fengmap.FMLineMarker(r);a.operationType=this.Pt,a.addTo(this.C),i?this.Z=a:(this._t=a,null!==e&&(this._t.userID=e))},St:function(t,i){var n=[],s=null;if(t||i){if(0===this.Ht.length)return;if(i)null!==this.Z&&this.Z.remove();else if(null!==this._t&&(s=this._t.userID,this._t.remove(),!t))return this.Ht.length=0,void(this._t=null);var e=this.Ht[0],n=[e,{x:t.x,y:e.y},t,{x:e.x,y:t.y}]}else if("edit"===this.Pt)n=this.J,null!==this.Z&&this.Z.remove();else if(null!==this._t)return this._t.remove(),this.Ht.length=0,void(this._t=null);if(0!==n.length){var r,h=this.Y,o={};for(r in h)o[r]=h[r];o.points=n;e=new fengmap.FMPolygonMarker(o);i?(n=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),e.addTo(n)):(n=this.C.getBuilding(this.Ht[0].buildingID).getFloor(this.Ht[0].level),e.addTo(n)),e.operationType=this.Pt,!t&&!i||i?this.Z=e:(this._t=e,null!==s&&(this._t.userID=s))}},Rt:function(t,i){var n=null,s=null;if(i)null!==this.Z&&this.Z.remove(),n=t;else{if(0===this.Ht.length)return;if(null!==this._t&&(s=this._t.userID,this._t.remove()),!t)return this.Ht.length=0,void(this._t=null);var e=this.Ht[0],r=Math.abs(t.x-e.x),t=Math.abs(t.y-e.y),n=t<r?this.Bt(e,r,r/2):this.Bt(e,t/2,t)}for(var h=[],o=0;o<n.length;o++)h.push({x:n[o].x,y:n[o].y});var u,a=this.Y,f={};for(u in a)f[u]=a[u];f.points=h;r=new fengmap.FMPolygonMarker(f);i?(e=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),r.addTo(e)):(t=this.C.getBuilding(this.Ht[0].buildingID).getFloor(this.Ht[0].level),r.addTo(t)),r.operationType=this.Pt,i?this.Z=r:(this._t=r,null!==s&&(this._t.userID=s))},Bt:function(t,i,n){return new s(t.x,t.y,i,n,0,2*Math.PI,!1,0).getPoints(32)},Et:function(t,i){if(0!==this.Ht.length){var n=null;if(i)null!==this.Z&&this.Z.remove();else if(null!==this._t&&(n=this._t.userID,this._t.remove(),!t))return this.Ht.length=0,void(this._t=null);var s,e=this.Ht[0],t=Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)),r=this.Y,h={};for(s in r)h[s]=r[s];h.points=fengmap.FMCalculator.circleBuilder(t,this.Ht[0],32);var o,t=new fengmap.FMPolygonMarker(h);i?(o=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),t.addTo(o)):(o=this.C.getBuilding(e.buildingID).getFloor(e.level),t.addTo(o)),t.operationType=this.Pt,i?this.Z=t:(this._t=t,null!==n&&(this._t.userID=n))}},wt:function(t){var i,n={},s=this.D;for(i in s)n[i]=s[i];n.x=t.x,n.y=t.y,n.buildingID=this.rt.buildingID;var t=this.C.getBuilding(this.rt.buildingID).getFloor(this.rt.level),e=new fengmap.FMImageMarker(n);e.addTo(t),e.operationType=this.Pt,this._t=e},Nt:function(){var t;"addLine"===this.Pt?this.xt():"addCircle"===this.Pt?this.Et():"addRectangle"===this.Pt?this.St():"addPolygon"===this.Pt?this.Ot():"addEllipse"===this.Pt&&this.Rt(),"addLine"!==this.Pt&&"addPolygon"!==this.Pt||(t=!0,"addLine"===this.Pt?this.Ht.length<2&&(t=!1):"addPolygon"===this.Pt&&this.Ht.length<3&&(t=!1),null!==this._t&&(this._t.operationType=this.Pt,t&&(this.et.V({type:"drawn",target:this._t}),this.rt=null),this.Ht.length=0,this._t=null))},It:function(t,i){for(var n=0;n<t.length;n++){var s=(s=t[n].optype)||"point",e=this.Yt,r=this.Lt,e=("center"===s&&(e=this.L,r=this.Ft),new ji({url:e,size:r,height:i.height+1,x:t[n].x,y:t[n].y,collision:!1,opetype:s})),r=this.C.getBuilding(i.info.buildingID).getFloor(i.info.level);e.addTo(r),void 0!==this.q&&("move"===this.q?"center"!==s&&(e.visible=!1):"edit"===this.q&&"center"===s&&(e.visible=!1)),this.U.push(e)}},ct:function(t){for(var i=[],n=(this.J=t.points,this.Tt(t.points).center),s=this.G.length=0;s<t.points.length;s++)i.push(t.points[s]),this.G.push({x:t.points[s].x-n.x,y:t.points[s].y-n.y});i.push({x:n.x,y:n.y,optype:"center"}),this.It(i,t)},Tt:function(t){for(var i=null,n=null,s=null,e=null,r=0;r<t.length;r++)0===r?(i=t[r].x,n=t[r].y,s=t[r].x,e=t[r].y):(i>t[r].x&&(i=t[r].x),n>t[r].y&&(n=t[r].y),s<t[r].x&&(s=t[r].x),e<t[r].y&&(e=t[r].y));return{center:{x:(i+s)/2,y:(n+e)/2},xradius:Math.abs(s-i)/2,yradius:Math.abs(e-n)/2}},ft:function(t){var i,n=[];if(void 0===t.operationType&&(t.operationType="addPolygon"),"addPolygon"===t.operationType){this.J=t.points;for(var s=this.Tt(t.points).center,e=this.G.length=0;e<t.points.length;e++)n.push(t.points[e]),this.G.push({x:t.points[e].x-s.x,y:t.points[e].y-s.y});n.push({x:s.x,y:s.y,optype:"center"})}else"addRectangle"===t.operationType?(this.J=t.points,n.push(t.points[0]),n.push(t.points[2]),n.push({x:(t.points[0].x+t.points[2].x)/2,y:(t.points[0].y+t.points[2].y)/2,optype:"center"}),this.G.length=0,this.G.push({x:Math.abs(t.points[0].x-t.points[2].x)/2,y:Math.abs(t.points[0].y-t.points[2].y)/2})):"addCircle"!==t.operationType&&"addEllipse"!==t.operationType||(i=this.Tt(t.points),this.J=i,n.push({x:i.center.x,y:i.center.y,optype:"center"}),n.push({x:i.center.x,y:i.center.y+i.yradius,optype:"yradius"}),"addEllipse"===t.operationType&&n.push({x:i.center.x+i.xradius,y:i.center.y,optype:"xradius"}));this.It(n,t)},lt:function(i){var n,s=this;i.editUrl?(i.oldUrl=i.url,i.url=i.editUrl):((n=new Image).crossOrigin="Anonymous",n.onload=function(){var t=s.Zt(n).toDataURL();i.oldUrl=i.url,i.editUrl=t,i.url=t},n.src=i.url)},Zt:function(t){var i=document.createElement("canvas"),n=(i.width=64,i.height=64,i.getContext("2d"));return n.lineWidth="5",n.strokeStyle=this.K,n.drawImage(t,0,0,64,64),n.rect(0,0,i.width,i.height),n.stroke(),i},At:function(t){var i=this.C.getInteracations();t?(i.enableDrag=this.ot.enableDrag,i.enableRotate=this.ot.enableRotate,i.enableTilt=this.ot.enableTilt,i.enableZoom=this.ot.enableZoom):(this.ot.enableDrag=i.enableDrag,this.ot.enableRotate=i.enableRotate,this.ot.enableTilt=i.enableTilt,this.ot.enableZoom=i.enableZoom,i.enableDrag=t,i.enableRotate=t,i.enableTilt=t,i.enableZoom=t)}}),{NONE:0,EXTRUDE_MARKER:2,FM3DTILE_LAYER:4,IMAGE_MARKER:8,LOCATION_MARKER:16,POLYGON_MARKER:32,TEXT_MARKER:64,LINE_MARKER:128,LINE3D_MARKER:256,HEAT_MAP_MARKER:512,EXTENT:1024,EXTERNAL_MODEL:2048,MODEL:4096,FACILITY:8192,LABEL:16384,DYNAMIC_MODEL_MARKER:32768,DOM_MARKER:65536,SPHERE_MARKER:1<<17,EXTENT_LAYER:1<<20,EXTERNAL_MODEL_LAYER:1<<21,MODEL_LAYER:1<<22,FACILITY_LAYER:1<<23,LABEL_LAYER:1<<24,MARKER_GROUP:1<<25,FLOW_LINE_LAYER:1<<27,FLOW_LINE_MARKER:1<<27,FIRE_MARKER:1<<28,WALL_MARKER:1<<29,TUBE_MARKER:1<<30}),Fi=(B.LAYER_NODE_TYPE=new Map,B.LAYER_NODE_TYPE.set(B.EXTENT_LAYER,B.EXTENT),B.LAYER_NODE_TYPE.set(B.EXTERNAL_MODEL_LAYER,B.EXTERNAL_MODEL),B.LAYER_NODE_TYPE.set(B.MODEL_LAYER,B.MODEL),B.LAYER_NODE_TYPE.set(B.FACILITY_LAYER,B.FACILITY),B.LAYER_NODE_TYPE.set(B.LABEL_LAYER,B.LABEL),B.LAYER_NODE_TYPE.set(B.DOM_MARKER,B.DOM_MARKER),B.LAYER_NODE_TYPE.set(B.DYNAMIC_MODEL_MARKER,B.DYNAMIC_MODEL_MARKER),B.LAYER_NODE_TYPE.set(B.EXTRUDE_MARKER,B.EXTRUDE_MARKER),B.LAYER_NODE_TYPE.set(B.HEAT_MAP_MARKER,B.HEAT_MAP_MARKER),B.LAYER_NODE_TYPE.set(B.LINE_MARKER,B.LINE_MARKER),B.LAYER_NODE_TYPE.set(B.LOCATION_MARKER,B.LOCATION_MARKER),B.LAYER_NODE_TYPE.set(B.POLYGON_MARKER,B.POLYGON_MARKER),B.LAYER_NODE_TYPE.set(B.TEXT_MARKER,B.TEXT_MARKER),B.LAYER_NODE_TYPE.set(B.IMAGE_MARKER,B.IMAGE_MARKER),B.LAYER_NODE_TYPE.set(B.FLOW_LINE_LAYER,B.FLOW_LINE_MARKER),B.LAYER_NODE_TYPE.set(B.FIRE_MARKER,B.FIRE_MARKER),B.LAYER_NODE_TYPE.set(B.WALL_MARKER,B.WALL_MARKER),B.LAYER_NODE_TYPE.set(B.TUBE_MARKER,B.TUBE_MARKER),B.LAYER_NODE_TYPE.set(B.LINE3D_MARKER,B.LINE3D_MARKER),B.LAYER_NODE_TYPE.set(B.SPHERE_MARKER,B.SPHERE_MARKER),B),Yi=function(t,i,n){n=n||2;var s,e,r,h,o,u=i&&i.length,a=u?i[0]*n:t.length,f=Li(t,0,a,n,!0),c=[];if(f&&f.next!==f.prev){if(u&&(f=function(t,i,n,s){var e,r,h,o,u=[];for(e=0,r=i.length;e<r;e++)o=i[e]*s,h=e<r-1?i[e+1]*s:t.length,(o=Li(t,o,h,s,!1))===o.next&&(o.steiner=!0),u.push(function(t){var i=t,n=t;for(;(i.x<n.x||i.x===n.x&&i.y<n.y)&&(n=i),i=i.next,i!==t;);return n}(o));for(u.sort(Hi),e=0;e<u.length;e++)!function(t,i){(i=function(t,i){var n,s=i,e=t.x,r=t.y,h=-1/0;do{if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){var o=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(o<=e&&h<o){if((h=o)===e){if(r===s.y)return s;if(r===s.next.y)return s.next}n=s.x<s.next.x?s:s.next}}}while(s=s.next,s!==i);if(!n)return null;if(e!==h){var u,a=n,f=n.x,c=n.y,l=1/0;for(s=n;e>=s.x&&s.x>=f&&e!==s.x&&Ui(r<c?e:h,r,f,c,r<c?h:e,r,s.x,s.y)&&(u=Math.abs(r-s.y)/(e-s.x),Qi(s,t))&&(u<l||u===l&&(s.x>n.x||s.x===n.x&&function(t,i){return V(t.prev,t,i.prev)<0&&V(i.next,t,t.next)<0}(n,s)))&&(n=s,l=u),(s=s.next)!==a;);}return n}(t,i))&&(t=Ji(i,t),I(i,i.next),I(t,t.next))}(u[e],n),n=I(n,n.next);return n}(t,i,f,n)),t.length>80*n){for(var l=s=t[0],v=e=t[1],d=n;d<a;d+=n)(r=t[d])<l&&(l=r),(h=t[d+1])<v&&(v=h),s<r&&(s=r),e<h&&(e=h);o=0!==(o=Math.max(s-l,e-v))?1/o:0}_i(f,c,n,l,v,o)}return c};function Li(t,i,n,s,e){var r,h;if(e===0<function(t,i,n,s){for(var e=0,r=i,h=n-s;r<n;r+=s)e+=(t[h]-t[r])*(t[r+1]+t[h+1]),h=r;return e}(t,i,n,s))for(r=i;r<n;r+=s)h=Wi(r,t[r],t[r+1],h);else for(r=n-s;i<=r;r-=s)h=Wi(r,t[r],t[r+1],h);return h&&Gi(h,h.next)&&(qi(h),h=h.next),h}function I(t,i){if(!t)return t;i=i||t;var n,s=t;do{if(n=!1,s.steiner||!Gi(s,s.next)&&0!==V(s.prev,s,s.next))s=s.next;else{if(qi(s),(s=i=s.prev)===s.next)break;n=!0}}while(n||s!==i);return i}function _i(t,i,n,s,e,r,h){if(t){if(!h&&r){for(var o=t,u=s,a=e,f=r,c=o;null===c.z&&(c.z=Ni(c.x,c.y,u,a,f)),c.prevZ=c.prev,c.nextZ=c.next,(c=c.next)!==o;);c.prevZ.nextZ=null,c.prevZ=null;var l,v,d,y,p,m,b,M,g=c,A=1;do{for(v=g,p=g=null,m=0;v;){for(m++,d=v,l=b=0;l<A&&(b++,d=d.nextZ);l++);for(M=A;0<b||0<M&&d;)0!==b&&(0===M||!d||v.z<=d.z)?(v=(y=v).nextZ,b--):(d=(y=d).nextZ,M--),p?p.nextZ=y:g=y,y.prevZ=p,p=y;v=d}}while(p.nextZ=null,A*=2,1<m)}for(var w,E,S=t;t.prev!==t.next;)if(w=t.prev,E=t.next,r?function(t,i,n,s){var e=t.prev,r=t,h=t.next;if(0<=V(e,r,h))return;var o=(e.x<r.x?e.x<h.x?e:h:r.x<h.x?r:h).x,u=(e.y<r.y?e.y<h.y?e:h:r.y<h.y?r:h).y,a=(e.x>r.x?e.x>h.x?e:h:r.x>h.x?r:h).x,f=(e.y>r.y?e.y>h.y?e:h:r.y>h.y?r:h).y,c=Ni(o,u,i,n,s),l=Ni(a,f,i,n,s),v=t.prevZ,d=t.nextZ;for(;v&&v.z>=c&&d&&d.z<=l;){if(v!==t.prev&&v!==t.next&&Ui(e.x,e.y,r.x,r.y,h.x,h.y,v.x,v.y)&&0<=V(v.prev,v,v.next))return;if(v=v.prevZ,d!==t.prev&&d!==t.next&&Ui(e.x,e.y,r.x,r.y,h.x,h.y,d.x,d.y)&&0<=V(d.prev,d,d.next))return;d=d.nextZ}for(;v&&v.z>=c;){if(v!==t.prev&&v!==t.next&&Ui(e.x,e.y,r.x,r.y,h.x,h.y,v.x,v.y)&&0<=V(v.prev,v,v.next))return;v=v.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&Ui(e.x,e.y,r.x,r.y,h.x,h.y,d.x,d.y)&&0<=V(d.prev,d,d.next))return;d=d.nextZ}return 1}(t,s,e,r):function(t){var i=t.prev,n=t,s=t.next;if(0<=V(i,n,s))return;var e=t.next.next;for(;e!==t.prev;){if(Ui(i.x,i.y,n.x,n.y,s.x,s.y,e.x,e.y)&&0<=V(e.prev,e,e.next))return;e=e.next}return 1}(t))i.push(w.i/n),i.push(t.i/n),i.push(E.i/n),qi(t),t=E.next,S=E.next;else if((t=E)===S){h?1===h?_i(t=function(t,i,n){var s=t;do{var e=s.prev,r=s.next.next}while(!Gi(e,r)&&Xi(e,s,s.next,r)&&Qi(e,r)&&Qi(r,e)&&(i.push(e.i/n),i.push(s.i/n),i.push(r.i/n),qi(s),qi(s.next),s=t=r),s=s.next,s!==t);return I(s)}(I(t),i,n),i,n,s,e,r,2):2===h&&function(t,i,n,s,e,r){var h=t;do{for(var o,u=h.next.next;u!==h.prev;){if(h.i!==u.i&&function(t,i){return t.next.i!==i.i&&t.prev.i!==i.i&&!function(t,i){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==i.i&&n.next.i!==i.i&&Xi(n,n.next,t,i))return 1}while(n=n.next,n!==t);return}(t,i)&&(Qi(t,i)&&Qi(i,t)&&function(t,i){var n=t,s=!1,e=(t.x+i.x)/2,r=(t.y+i.y)/2;for(;n.y>r!=n.next.y>r&&n.next.y!==n.y&&e<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(s=!s),n=n.next,n!==t;);return s}(t,i)&&(V(t.prev,t,i.prev)||V(t,i.prev,i))||Gi(t,i)&&0<V(t.prev,t,t.next)&&0<V(i.prev,i,i.next))}(h,u))return o=Ji(h,u),h=I(h,h.next),o=I(o,o.next),_i(h,i,n,s,e,r),_i(o,i,n,s,e,r);u=u.next}}while(h=h.next,h!==t)}(t,i,n,s,e,r):_i(I(t),i,n,s,e,r,1);break}}}function Hi(t,i){return t.x-i.x}function Ni(t,i,n,s,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*e)|t<<8))|t<<4))|t<<2))|t<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-s)*e)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function Ui(t,i,n,s,e,r,h,o){return 0<=(e-h)*(i-o)-(t-h)*(r-o)&&0<=(t-h)*(s-o)-(n-h)*(i-o)&&0<=(n-h)*(r-o)-(e-h)*(s-o)}function V(t,i,n){return(i.y-t.y)*(n.x-i.x)-(i.x-t.x)*(n.y-i.y)}function Gi(t,i){return t.x===i.x&&t.y===i.y}function Xi(t,i,n,s){var e=zi(V(t,i,n)),r=zi(V(t,i,s)),h=zi(V(n,s,t)),o=zi(V(n,s,i));return e!==r&&h!==o||0===e&&Zi(t,n,i)||0===r&&Zi(t,s,i)||0===h&&Zi(n,t,s)||!(0!==o||!Zi(n,i,s))}function Zi(t,i,n){return i.x<=Math.max(t.x,n.x)&&i.x>=Math.min(t.x,n.x)&&i.y<=Math.max(t.y,n.y)&&i.y>=Math.min(t.y,n.y)}function zi(t){return 0<t?1:t<0?-1:0}function Qi(t,i){return V(t.prev,t,t.next)<0?0<=V(t,i,t.next)&&0<=V(t,t.prev,i):V(t,i,t.prev)<0||V(t,t.next,i)<0}function Ji(t,i){var n=new Ki(t.i,t.x,t.y),s=new Ki(i.i,i.x,i.y),e=t.next,r=i.prev;return(t.next=i).prev=t,(n.next=e).prev=n,(s.next=n).prev=s,(r.next=s).prev=r,s}function Wi(t,i,n,s){t=new Ki(t,i,n);return s?(t.next=s.next,(t.prev=s).next.prev=t,s.next=t):(t.prev=t).next=t,t}function qi(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ki(t,i,n){this.i=t,this.x=i,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function $i(t){return function(t){if(Array.isArray(t))return tn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,i){var n;if(t)return"string"==typeof t?tn(t,i):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tn(t,i):void 0}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tn(t,i){(null==i||i>t.length)&&(i=t.length);for(var n=0,s=new Array(i);n<i;n++)s[n]=t[n];return s}var nn={area:function(t){for(var i=t.length,n=0,s=i-1,e=0;e<i;s=e++)n+=t[s].x*t[e].y-t[e].x*t[s].y;return.5*n},isClockWise:function(t){return nn.area(t)<0},triangulateShape:function(t,i){var n=[],s=[],e=[],r=(sn(t),en(n,t),t.length);i.forEach(sn);for(var h=0;h<i.length;h++)s.push(r),r+=i[h].length,en(n,i[h]);for(var o=Yi(n,s),u=0;u<o.length;u+=3)e.push(o.slice(u,u+3));return e},triangulate:function(t){(e=[]).push.apply(e,$i(t[0]));for(var i=[],n=1;n<t.length;n++){var s=[];s.push.apply(s,$i(t[n])),i.push(s)}if(!nn.isClockWise(e))for(var e=e.reverse(),r=0,h=i.length;r<h;r++){var o=i[r];nn.isClockWise(o)&&(i[r]=o.reverse())}return nn.triangulateShape(e,i)}};function sn(t){var i,n=t.length;2<n&&(n=t[n-1],i=t[0],n.x===i.x)&&n.y===i.y&&t.pop()}function en(t,i){for(var n=0;n<i.length;n++)t.push(i[n].x),t.push(i[n].y)}function rn(t){return(rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function hn(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,function(t){t=function(t,i){if("object"!=rn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=rn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==rn(t)?t:String(t)}(s.key),s)}}function on(t,i,n){return i&&hn(t.prototype,i),n&&hn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var C=1e-5,un=.001,an=Math.PI/180,fn=180/Math.PI,B=on(function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")});Object.assign(B.prototype,{zt:function(){return C},Qt:function(){return an},Jt:function(){return fn},Wt:function(t){return t<C&&-C<t},qt:function(t){return C<t},Kt:function(t){return t<-C},$t:function(t,i,n){i=(t.x-n.x)*(i.y-n.y)-(i.x-n.x)*(t.y-n.y);return Math.abs(i)<C?0:i},distanceOfTwoPoints:function(t,i){return t&&i?Math.sqrt((t.x-i.x)*(t.x-i.x)+(t.y-i.y)*(t.y-i.y)):Number.NaN},distance:function(t,i){return Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2))},isPolygonContainPoint:function(t,i){for(var n=0,s=0;s<t.length;s++){var e=t[s].x,r=t[s].y,h=0,o=0,o=(s<t.length-1?(h=t[s+1].x,t[s+1]):(h=t[0].x,t[0])).y;if(e===i.x&&r===i.y||h===i.x&&o===i.y)return!0;if(o!==r){var u=e+(i.y-r)*(h-e)/(o-r);if(u===i.x)return!0;e!==h?u<=Math.max(e,h)&&u>=Math.min(e,h)&&u>i.x&&u!==e&&(u===h&&0<(r-i.y)*(o-i.y)?n+=2:n++):u<=Math.max(e,h)&&u>=Math.min(e,h)&&u>i.x&&(u===h&&0<(r-i.y)*(o-i.y)?n+=2:n++)}}return 0<n%2},isPolygonContainPoint2:function(t,i){var n=t.length;if(n<3)return!1;for(var s=n-1,e=0,r=0;r<n;r++){var h=t[r],o=t[s];h.y>i.y!=o.y>i.y&&i.x<(o.x-h.x)*(i.y-h.y)/(o.y-h.y)+h.x&&(h.y>o.y?e++:e--),s=r}return 0!=e},isPolygonInPolygon:function(t,i){var n=Object.assign([],t),s=Object.assign([],i);n.push(n[0]),s.push(s[0]);for(var e=0;e<n.length-1;e++){var r=n[e];if(!this.isPolygonContainPoint(s,r)&&!this.isPolygonContainPoint2(s,r))return!1}for(var h=0;h<n.length-1;h++)for(var o=0;o<s.length-1;o++)if(this.ti(n[h],n[h+1],s[o],s[o+1]).isintersect&&!this.ii(s[o],s[o+1],n[h])&&!this.ii(s[o],s[o+1],n[h+1]))return!1;return!0},ni:function(t,i,n,s){return!(Math.max(t.x,i.x)<Math.min(n.x,s.x)||Math.max(t.y,i.y)<Math.min(n.y,s.y)||Math.max(n.x,s.x)<Math.min(t.x,i.x)||Math.max(n.y,s.y)<Math.min(t.y,i.y))},si:function(t,i,n,s){return!(Math.max(t.x,i.x)<Math.min(n.x,s.x)||Math.max(t.y,i.y)<Math.min(n.y,s.y)||Math.max(n.x,s.x)<Math.min(t.x,i.x)||Math.max(n.y,s.y)<Math.min(t.y,i.y)||0===this.$t(n,i,t)&&0===this.$t(i,s,t)||this.$t(n,i,t)*this.$t(i,s,t)<0||this.$t(t,s,n)*this.$t(s,i,n)<0)},ei:function(t,i,n){return!(t.x<i.x||t.y<i.y||t.x>n.x||t.y>n.y)},ri:function(t,i,n){var s=Math.min(i.x,n.x),e=Math.max(i.x,n.x),r=Math.min(i.y,n.y),i=Math.max(i.y,n.y);return!(t.x<s||t.x>e||t.y<r||t.y>i)},hi:function(t,i,n){var s=Math.min(n.x,i.x),e=Math.max(n.x,i.x),r=Math.min(n.y,i.y),n=Math.max(n.y,i.y);return!(t.x<s||t.x>e||t.y<r||t.y>n)},oi:function(t,i,n){for(var s,e,r=!1,h=0;h<n;h++)s=i[h],e=i[(h+1)%n],(s.y<t.y&&e.y>=t.y||e.y<t.y&&s.y>=t.y)&&(s.x<=t.x||e.x<=t.x)&&s.x+(t.y-s.y)/(e.y-s.y)*(e.x-s.x)<t.x&&(r=!r);return r},ui:function(t,i,n){return(t.x-i.x)*(n.y-i.y)==(n.x-i.x)*(t.y-i.y)&&Math.min(i.x,n.x)<=t.x&&t.x<=Math.max(i.x,n.x)&&Math.min(i.y,n.y)<=t.y&&t.y<=Math.max(i.y,n.y)},ai:function(t,i){return Math.sqrt((t.x-i.x)*(t.x-i.x)+(t.y-i.y)*(t.y-i.y))},fi:function(t,i){return(t.x-i.x)*(t.x-i.x)+(t.y-i.y)*(t.y-i.y)},ci:function(t,i,n){var s=i.x,i=i.y,e=n.x,n=n.y,r=t.x,t=t.y,h=e-s,o=n-i,u=h*h+o*o,a=r-s,f=t-i,c=a*a+f*f;return this.Wt(u)?this.Wt(c)?0:c:(u=Math.sqrt(u),f=this.qt(o=(h=h/u)*a+(a=o/u)*f)?this.Kt(o-u)?(f=r-(s+o*h))*f+(u=t-(i+o*a))*u:(s=r-e)*s+(h=t-n)*h:c,this.Wt(f)?0:f)},li:function(t,i,n,s){var e,r=i.x,h=i.y,o=n.x,u=n.y,a=t.x,t=t.y,f=o-r,c=u-h,l=Math.sqrt(f*f+c*c),v=a-r,d=t-h,y=Math.sqrt(v*v+d*d);return this.Wt(l)?(s.x=i.x,s.y=i.y,this.Wt(e=y)?0:e):(e=this.qt(c=(f=f/l)*v+(v=c/l)*d)?this.Kt(c-l)?(l=a-(d=r+c*f),f=t-(r=h+c*v),h=Math.sqrt(l*l+f*f),s.x=d,s.y=r,h):(c=a-o,v=t-u,l=Math.sqrt(c*c+v*v),s.x=n.x,s.y=n.y,l):(s.x=i.x,s.y=i.y,y),this.Wt(e)?0:e)},vi:function(t,i){for(var n=0,s=0,e=0,r=0;r<i;r++){var h=t[r],o=t[(r+1)%i],u=(h.x*o.y-h.y*o.x)/2;n+=u,s+=u*(h.x+o.x)/3,e+=u*(h.y+o.y)/3}return{x:s/=n,y:e/=n}},di:function(t){for(var i=nn.triangulate([t]),n=0,s=0,e=0,r=0;r<i.length;r++){var h=t[i[r][0]],o=t[i[r][1]],u=t[i[r][2]],a=o.x-h.x,f=o.y-h.y,c=u.x-h.x,a=(a*(u.y-h.y)-c*f)/2;n+=a,s+=(h.x+o.x+u.x)/3*a,e+=(h.y+o.y+u.y)/3*a}return{x:s/n,y:e/n}},yi:function(t,i){if(i<3)return 0;for(var n=0,s=0;s<i;++s){var e=t[s],r=t[(s+1)%i];n+=e.x*r.y-e.y*r.x}return Math.abs(n/2)},pi:function(t,i,n,s,e){var r,h;return this.si(t,i,n,s)?(r=(s.x-n.x)*(t.y-i.y)-(i.x-t.x)*(n.y-s.y),h=(t.y-n.y)*(i.x-t.x)*(s.x-n.x)+n.x*(s.y-n.y)*(i.x-t.x)-t.x*(i.y-t.y)*(s.x-n.x),e.x=h/r,r=(t.x-i.x)*(s.y-n.y)-(i.y-t.y)*(n.x-s.x),h=i.y*(t.x-i.x)*(s.y-n.y)+(s.x-i.x)*(s.y-n.y)*(t.y-i.y)-s.y*(n.x-s.x)*(i.y-t.y),e.y=h/r,1):0},mi:function(t,i,n,s,e){var r=Math.min(n.x,s.x),h=Math.max(n.x,s.x),o=Math.min(n.y,s.y),u=Math.max(n.y,s.y),a=t.x,f=t.y,c=n.x,l=n.y,v=s.x,d=s.y;if(90==i)return!(t.x<r||t.x>h||(Math.abs(h-r<un)?t.y>=l&&t.y<=d||t.y>=d&&t.y<=l?(e.x=t.x,e.y=t.y,0):l<d&&t.x<l?(e.x=c,e.y=l,0):!(d<l&&t.x<d)||(e.x=v,e.y=d,0):(e.y=y=(d-l)/(v-c)*(a-c)+l,e.x=a,y<f||!this.hi(e,n,s))));if(270==i)return!(t.x<r||t.x>h||(Math.abs(h-r<un)?t.y>=l&&t.y<=d||t.y>=d&&t.y<=l?(e.x=t.x,e.y=t.y,0):l<d&&t.y>d?(e.x=v,e.y=d,0):!(d<l&&t.y>l)||(e.x=c,e.y=l,0):(e.y=y=(d-l)/(v-c)*(a-c)+l,e.x=a,f<y||!this.hi(e,n,s))));if(270!=i&&90!=i&&Math.abs(h-r<un)){var t=r,y=Math.tan(i/180*Math.PI)*(t-a)+f;if(e.y=y,e.x=t,this.hi(e,n,s))return h=y-f,0<(r=t-a)/Math.sqrt(r*r+h*h)*Math.cos(i/180*Math.PI)}return Math.abs(u-o<=un)?(y=o,t=1/Math.tan(i/180*Math.PI)*(y-f)+a,e.x=t,e.y=y,!!this.hi(e,n,s)&&(r=y-f,0<(h=t-a)/Math.sqrt(h*h+r*r)*Math.cos(i/180*Math.PI))):(t=f+(u=Math.tan(i/180*Math.PI))*((y=(l-f-((o=(d-l)/(v-c))*c-u*a))/(u-o))-a),e.x=y,e.y=t,!!this.hi(e,n,s)&&(h=y-a,r=t-f,Math.abs(h)<=un&&Math.abs(r)<=un||0<h/Math.sqrt(h*h+r*r)*Math.cos(i/180*Math.PI)))},bi:function(t,i){return Math.abs(t.x-i.x)<C&&Math.abs(t.y-i.y)<C},Mi:function(t,i,n,s){var e,r,h,o,u=t.x,a=t.y,f=i.x,c=i.y,l=n.x,v=n.y;return this.bi(t,i)||this.bi(t,n)?(s.x=u,s.y=a,!0):(h=Math.min(i.x,n.x),o=Math.max(i.x,n.x),e=Math.min(i.y,n.y),r=Math.max(i.y,n.y),Math.abs(f-l)<1e-5?(s.x=f,e<=(s.y=a)&&a<=r):Math.abs(c-v)<1e-5?(s.x=u,s.y=c,h<=u&&u<=o):(o=a+(e=-1/((v-c)/(l-f)))*((h=(c-a-((r=(v-c)/(l-f))*f-e*u))/(e-r))-u),s.x=h,s.y=o,!!this.hi(s,i,n)||!(!this.bi(t,i)&&!this.bi(t,n))))},gi:function(t,i){return{x:t.y*i.z-t.z*i.y,y:t.z*i.x-t.x*i.z,z:t.x*i.y-t.y*i.x}},Ai:function(t,i){return t.x*i.x+t.y*i.y+t.z*i.z},wi:function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z)},Ei:function(t,i){return t.x*i.x+t.y*i.y},Si:function(t,i){return t.x*i.y-t.y*i.x},Ri:function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},ji:function(t,i){var n,s;return 0==t.x&&0==t.y||0==i.x&&0==i.y?0:(n={x:t.x,y:t.y,z:0},s={x:i.x,y:i.y,z:0},n=this.gi(n,s),s=this.Ei(t,i),s=Math.acos(s/(this.Ri(t)*this.Ri(i))),0<n.z?s/Math.PI*180:360-s/Math.PI*180)},xi:function(t,i,n,s){for(var e=0;e<n.length;e++){var r=n[e],h=n[(e+1)%n.length];if(1==this.pi(t,i,r,h,s))return!0}return!1},Oi:function(t,i,n,s,e){var r=Math.min(t.x,n.x,s.x),h=Math.max(t.x,n.x,s.x),o=Math.min(t.y,n.y,s.y),u=Math.max(t.y,n.y,s.y),h=Math.sqrt((h-r)*(h-r)+(u-o)*(u-o)),r=i/180*Math.PI,u=h*Math.cos(r)+t.x,o=h*Math.sin(r)+t.y;return 1==this.pi(t,{x:u,y:o},n,s,e)},Ti:function(t){var i={x:null,y:null},n=0,s=0;1<t.length&&t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y&&t.pop();for(var e=0;e<t.length;e++)n+=t[e].x,s+=t[e].y;return i.x=n/t.length,i.y=s/t.length,i},ki:function(t,i,n,s){var e=[],r=t.x-i,h=t.x+i,o=t.y-i,u=t.y+i,a=Math.min(n.x,s.x),f=Math.max(n.x,s.x),c=Math.min(n.y,s.y),l=Math.max(n.y,s.y);return f<r||h<a||l<o||u<c||(r=s.x-n.x,h=s.y-n.y,(o=(t=(r*(o=t.x-n.x)+h*(u=t.y-n.y))/(s=r*r+h*h))*t-(o*o+u*u-i*i)/s)<0)||(u=Math.sqrt(o),s={x:n.x-r*(i=-t+u),y:n.y-h*i},r={x:n.x-r*(o=-t-u),y:n.y-h*o},i!==o&&(a<=s.x&&s.x<=f&&c<=s.y&&s.y<=l&&e.push(s),a<=r.x)&&r.x<=f&&c<=r.y&&r.y<=l&&e.push(r)),e},Bi:function(t,i,n){var s,e={};if(t.x!=i.x)return s=i=(i.y-t.y)/(i.x-t.x),i=t.y-i*t.x,e.x=(+n.x- -1*s*n.y-s*i)/(s*s+1),e.y=(s*s*n.y- -1*s*n.x- -1*i)/(s*s+1),e;e.x=t.x,e.y=n.y},ti:function(t,i,n,s){var e,r,h,o,u={point:null,isintersect:!1};return t==n||t==s?(u.isintersect=!0,u.point=t):i==n||i==s?(u.isintersect=!0,u.point=i):(e={x:i.x-t.x,y:i.y-t.y},r={x:s.x-n.x,y:s.y-n.y},h={x:n.x-t.x,y:n.y-t.y},s={x:s.x-t.x,y:s.y-t.y},i={x:i.x-n.x,y:i.y-n.y},n={x:-h.x,y:-h.y},o=this.Si(r,e),Math.abs(o)<=1e-5||this.Si(h,e)*this.Si(s,e)<=-5e-4&&this.Si(n,r)*this.Si(i,r)<-5e-4&&(s=this.Si(r,h)/o,u.point={x:t.x+e.x*s,y:t.y+e.y*s},u.isintersect=!0)),u},Ii:function(t,i,n){t.x===i.x&&(i.x=i.x+1),t.y===i.y&&(i.y=i.y+1),i.x===n.x&&(n.x=n.x+1),i.y===n.y&&(n.y=n.y+1);var s=i.x-t.x,t=i.y-t.y,e=n.x-i.x;return!(0<s*(n.y-i.y)-t*e)},getAngle:function(t){var i=t.p1,t=t.p2,n=t.x-i.x,t=t.y-i.y,i=Math.sqrt(n*n+t*t),i=Math.asin(Math.abs(t)/i);return 0<n&&0<t?i:n<0&&0<t?Math.PI-i:n<0&&t<0?Math.PI+i:0<n&&t<0?2*Math.PI-i:0==n&&0<t?i:0==n&&t<0?3*Math.PI/2:0<n&&0==t?i:n<0&&0==t?Math.PI:null},Vi:function(t){var i=this.distanceOfTwoPoints(t[0],t[1]),n=this.distanceOfTwoPoints(t[1],t[2]),t=this.distanceOfTwoPoints(t[0],t[2]),s=(i+n+t)/2;return Math.sqrt(s*(s-i)*(s-n)*(s-t))},Ci:function(t,i){var n,s,e,r,h;return this.li(t,i[0],i[1],{})<1e-4||this.li(t,i[0],i[2],{})<1e-4||this.li(t,i[1],i[2],{})<1e-4||(r={x:i[1].x-i[0].x,y:i[1].y-i[0].y},n={x:i[0].x-i[2].x,y:i[0].y-i[2].y},s={x:i[2].x-i[1].x,y:i[2].y-i[1].y},h={x:t.x-i[0].x,y:t.y-i[0].y},e={x:t.x-i[1].x,y:t.y-i[1].y},t={x:t.x-i[2].x,y:t.y-i[2].y},i=this.Si(r,h),r=this.Si(s,e),h=this.Si(n,t),C<i*r&&C<r*h)},Pi:function(t,i,n){var s=n.length,e={isintersect:!1,start:null,end:null,type:0,outer:null},r=[];if(this.Ci(t,n)&&(e.start=t),this.Ci(i,n)&&(e.end=i),null!=e.start&&null!=e.end)e.isintersect=!0,e.type=1;else{for(var h=(n[1].x+n[2].x)/2,o=(n[1].y+n[2].y)/2,u=1;u<s;u++){var a,f=this.ti(t,i,n[u-1],n[u]);if(f.isintersect){if(null!=e.start)return e.end=f.point,e.isintersect=!0,e.outer="end",a=this.ji({x:h-n[0].x,y:o-n[0].y},{x:i.x-n[0].x,y:i.y-n[0].y}),e.type=0<(a=a<180?a:a-360)?2:3,e;if(null!=e.end)return e.start=f.point,e.isintersect=!0,e.outer="start",a=this.ji({x:h-n[0].x,y:o-n[0].y},{x:t.x-n[0].x,y:t.y-n[0].y}),e.type=0<(a=a<180?a:a-360)?2:3,e;r.push(f)}}var c,l=this.ti(t,i,n[0],n[s-1]);if(l.isintersect){if(null!=e.start)return e.end=l.point,e.isintersect=!0,e.outer="end",c=this.ji({x:h-n[0].x,y:o-n[0].y},{x:i.x-n[0].x,y:i.y-n[0].y}),e.type=0<(c=c<180?c:c-360)?2:3,e;if(null!=e.end)return e.start=l.point,e.isintersect=!0,e.outer="start",c=this.ji({x:h-n[0].x,y:o-n[0].y},{x:t.x-n[0].x,y:t.y-n[0].y}),e.type=0<(c=c<180?c:c-360)?2:3,e;r.push(l)}2!=r.length||this.distanceOfTwoPoints(r[0].point,r[1].point)<.01||(this.distanceOfTwoPoints(r[0].point,t)<=this.distanceOfTwoPoints(r[0].point,i)?(e.start=r[0].point,e.end=r[1].point):(e.start=r[1].point,e.end=r[0].point),e.isintersect=!0,e.type=4)}return e},Di:function(t,i,n){var s=n.length,e={isintersect:!1,start:null,end:null},r=[];if(this.Ci(t,n)&&(e.start=t),this.Ci(i,n)&&(e.end=i),null!=e.start&&null!=e.end)e.isintersect=!0;else{for(var h=1;h<s;h++){var o=this.ti(t,i,n[h-1],n[h]);if(o.isintersect){if(null!=e.start)return e.end=o.point,e.isintersect=!0,e;if(null!=e.end)return e.start=t,e.isintersect=!0,e;r.push(o)}}var u=this.ti(t,i,n[0],n[s-1]);if(u.isintersect){if(null!=e.start)return e.end=u.point,e.isintersect=!0,e;if(null!=e.end)return e.start=t,e.isintersect=!0,e;r.push(u)}2==r.length&&(e.start=(this.distanceOfTwoPoints(r[0].point,t)<=this.distanceOfTwoPoints(r[0].point,i)?r[0]:r[1]).point,e.end=(this.distanceOfTwoPoints(r[0].point,t)>this.distanceOfTwoPoints(r[0].point,i)?r[0]:r[1]).point,e.isintersect=!0)}return e},Fi:function(e,t){if(0==t.length)return[e];for(var i,n,s=this.Yi(t),r=[],h=(s.sort(function(t,i){var n=(t.Li.x-e.Li.x)*(t.Li.x-e.Li.x)+(t.Li.y-e.Li.y)*(t.Li.y-e.Li.y),s=(i.Li.x-e.Li.x)*(i.Li.x-e.Li.x)+(i.Li.y-e.Li.y)*(i.Li.y-e.Li.y),t=(t._i.x-e.Li.x)*(t._i.x-e.Li.x)+(t._i.y-e.Li.y)*(t._i.y-e.Li.y),i=(i._i.x-e.Li.x)*(i._i.x-e.Li.x)+(i._i.y-e.Li.y)*(i._i.y-e.Li.y);return(n<t?n:t)<(s<i?s:i)}),0),h=0;h<s.length;h++)this.distanceOfTwoPoints(s[h].Li,s[h]._i)<.01||(i=this.distanceOfTwoPoints(s[h].Li,e.Li),n=this.distanceOfTwoPoints(s[h]._i,e.Li),i<.01?e.Li=s[h]._i:n<.01?e.Li=s[h].Li:i<n?.1<this.distanceOfTwoPoints(e.Li,s[h].Li)&&(r.push({Hi:e.Hi,Li:e.Li,_i:s[h].Li,ai:e.ai,Ni:e.Ni}),e.Li=s[h]._i):.1<this.distanceOfTwoPoints(e.Li,s[h]._i)&&(r.push({Hi:e.Hi,Li:e.Li,_i:s[h]._i,ai:e.ai,Ni:e.Ni}),e.Li=s[h].Li),s.splice(h,1));return.1<this.distanceOfTwoPoints(e.Li,e._i)&&r.push(e),r},Yi:function(t){var i=[];if(1==t.length)return t;for(var n=t[0],s=1;0<t.length;){if(s>=t.length){if(i.push(n),t.splice(0,1),t.length<1)break;n=t[0],s=1}if(1===t.length){i.push(n);break}this.ii(n.Li,n._i,t[s].Li)?(this.ii(n.Li,n._i,t[s]._i)||(n._i=t[s]._i),t.splice(s,1)):this.ii(n.Li,n._i,t[s]._i)?(n.Li=t[s].Li,t.splice(s,1)):this.ii(t[s].Li,t[s]._i,n.Li)?(n=(this.ii(t[s].Li,t[s]._i,n._i)||(t[s]._i=n._i),t[s]),t.splice(s,1)):this.ii(t[s].Li,t[s]._i,n._i)?(t[s].Li=n.Li,n=t[s],t.splice(s,1)):s++}return i},ii:function(t,i,n){var s=t.x-n.x,e=t.y-n.y,r=i.x-n.x,h=i.y-n.y,o=this.distanceOfTwoPoints(t,n),n=this.distanceOfTwoPoints(i,n),t=this.distanceOfTwoPoints(t,i);return s*h-e*r<1e-5&&o+n-t<.001}});var cn=new B;function ln(t){return(ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function vn(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,function(t){t=function(t,i){if("object"!=ln(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=ln(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==ln(t)?t:String(t)}(s.key),s)}}B=function(){function i(t){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");this.C=t,this.$=this.C.getContainer(),this.Ui={border:"border:2px solid #0000FF",backgroundColor:null,opacity:null},this.ot={},this.Gi=[Fi.MODEL,Fi.FACILITY,Fi.LABEL,Fi.EXTERNAL_MODEL],this.Xi=0,this.Zi=!1,this.tt=this.tt.bind(this),this.it=this.it.bind(this),this.nt=this.nt.bind(this),this.zi=null,this.Qi=null,this.et=new oi,this.Ji=new fengmap.FMSearchAnalyser({map:this.C}),this.ut()}var t,n,s;return t=i,(n=[{key:"dispose",value:function(){this.$.removeEventListener("mousedown",this.tt,!1),document.removeEventListener("mousemove",this.it,!1),document.removeEventListener("mouseup",this.nt,!1),this.Ji.dispose()}},{key:"boxStyle",get:function(){return this.Ui},set:function(t){this.Ui=t}},{key:"enable",get:function(){return this.Zi},set:function(t){this.Zi=t}},{key:"mouseKey",get:function(){return 0===this.Xi?"left":"right"},set:function(t){this.Xi="left"===t?0:2}},{key:"types",get:function(){return this.Gi},set:function(t){this.Gi=t}},{key:"on",value:function(t,i){this.et.k(t,i)}}])&&vn(t.prototype,n),s&&vn(t,s),Object.defineProperty(t,"prototype",{writable:!1}),i}(),Object.assign(B.prototype,{ut:function(){this.C.getRenderManager().renderer.domElement.style.left="0px",this.$.addEventListener("mousedown",this.tt,!1),document.addEventListener("mousemove",this.it,!1),document.addEventListener("mouseup",this.nt,!1)},Wi:function(t){return{x:t.getBoundingClientRect().left,y:t.getBoundingClientRect().top}},tt:function(t){var i,n;this.Zi&&t.button===this.Xi&&(this.zi&&this.zi.parentNode&&(this.zi.parentNode.removeChild(this.zi),this.zi=null),i=this.Wi(this.C.getRenderManager().renderer.domElement),n=t.clientX-i.x,t=t.clientY-i.y,this.Qi={x:n,y:t},this.At(!1),this.zi=document.createElement("div"),this.zi.style.cssText="position:absolute;top:"+t+"px;left:"+n+"px;width:0px;height:0px;"+this.Ui.border+";",this.$.appendChild(this.zi),this.Ui.backgroundColor&&(this.zi.style.backgroundColor=this.Ui.backgroundColor),void 0!==this.Ui.opacity)&&null!==this.Ui.opacity&&(this.zi.style.opacity=this.Ui.opacity)},it:function(t){var i,n;this.Zi&&null!==this.Qi&&(i=this.Wi(this.C.getRenderManager().renderer.domElement),n=t.clientX-i.x,t=t.clientY-i.y,n<this.Qi.x&&(this.zi.style.left=n+"px"),t<this.Qi.y&&(this.zi.style.top=t+"px"),this.zi.style.width=Math.abs(n-this.Qi.x)+"px",this.zi.style.height=Math.abs(t-this.Qi.y)+"px")},nt:function(t){var b=this;if(this.Zi&&null!==this.zi&&t.button===this.Xi){this.At(!0);var M=this.qi(),s=[],i=this.C.getMapOptions(),n=[],e=[];if(i.buildings&&0<i.buildings.length)for(var r=0;r<i.buildings.length;r++)!function(t){for(var t=b.C.getBuilding(t).bound,i=t.min,t=t.max,n=[{x:i.x,y:i.y},{x:i.x,y:t.y},{x:t.x,y:t.y},{x:t.x,y:i.y}],s=0;s<n.length;s++)if(cn.oi(n[s],M,M.length))return 1;for(var e=0;e<M.length;e++)if(cn.oi(M[e],n,n.length))return 1;for(var r=0;r<M.length-1;r++){for(var h=M[r],o=M[r+1],u=0;u<n.length-1;u++){var a=n[u],f=n[u+1];if(cn.si(h,o,a,f))return 1}var c=n[n.length-1],l=n[0];if(cn.si(h,o,l,c))return 1}for(var v=M[0],d=M[M.length-1],y=0;y<n.length-1;y++){var p=n[y],m=n[y+1];if(cn.si(v,d,p,m))return 1}t=n[n.length-1],i=n[0];if(cn.si(v,d,i,t))return 1}(i.buildings[r].bid)||(n.push(i.buildings[r].mid),e.push(i.buildings[r].bid));for(var h=[],o=0;o<this.Gi.length;o++){for(var u=new fengmap.FMSearchRequest,a=(u.levels=[this.C.getBuilding(i.buildingID).level],u.type=this.Gi[o],u.addCondition({polygon:M}),[]),f=0;f<e.length;f++)a.push({buildingID:e[f],levels:[this.C.getBuilding(e[f]).level]});0<a.length&&(u.buildings=a),h.push(u)}this.Qi=null,this.zi.parentNode&&this.zi.parentNode.removeChild(this.zi),this.zi=null;var c,l=0;c=null,function i(){var n;l<h.length?(n=h[l],b.Ji.query(n,function(t){s.push({type:n.type,children:t}),l++,c=setTimeout(i(),1)})):(null!==c&&clearTimeout(c),b.et.V({type:"boxselected",targets:s,coords:M}))}()}},At:function(t){var i=this.C.getInteracations();t?(i.enableDrag=this.ot.enableDrag,i.enableRotate=this.ot.enableRotate,i.enableTilt=this.ot.enableTilt,i.enableZoom=this.ot.enableZoom):(this.ot.enableDrag=i.enableDrag,this.ot.enableRotate=i.enableRotate,this.ot.enableTilt=i.enableTilt,this.ot.enableZoom=i.enableZoom,i.enableDrag=t,i.enableRotate=t,i.enableTilt=t,i.enableZoom=t)},qi:function(){for(var t=[],i=this.zi.getBoundingClientRect(),n=this.Wi(this.C.getRenderManager().renderer.domElement),s=n.x,n=n.y,e=(t.push({x:i.left-s,y:i.top-n}),t.push({x:i.right-s,y:i.top-n}),t.push({x:i.right-s,y:i.bottom-n}),t.push({x:i.left-s,y:i.bottom-n}),[]),r=0;r<t.length;r++){var h=fengmap.FMUtil.coordsScreenToMap(this.C,t[r]);e.push(h)}return e}});function dn(t){return(dn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yn(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,function(t){t=function(t,i){if("object"!=dn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=dn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==dn(t)?t:String(t)}(s.key),s)}}function pn(t,i,n){i=Mn(i);var s=t,i=mn()?Reflect.construct(i,n||[],Mn(t).constructor):i.apply(t,n);if(i&&("object"===dn(i)||"function"==typeof i))return i;if(void 0!==i)throw new TypeError("Derived constructors may only return object or undefined");t=s;if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function mn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(mn=function(){return!!t})()}function bn(){return(bn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,i,n){var s=function(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&null!==(t=Mn(t)););return t}(t,i);if(s)return(s=Object.getOwnPropertyDescriptor(s,i)).get?s.get.call(arguments.length<3?t:n):s.value}).apply(this,arguments)}function Mn(t){return(Mn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function gn(t,i){return(gn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t})(t,i)}var An=function(t){var i,n=s;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");function s(t){var i;if(this instanceof s)return(i=pn(this,s,[t])).info2=t,i.shapetype2="polygon",i.id=""+bi.generateUUID(),t.shapetype&&(i.shapetype2=t.shapetype),i.mapEdit=null,i;throw new TypeError("Cannot call a class as a function")}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),t&&gn(n,t),n=s,(t=[{key:"info",get:function(){return this.info2.id=this.id,this.info2.shapetype=this.shapetype2,this.info2.level=this.level,this.info2.buildingID=this.parent.parent.parent.buildingID,this.info2}},{key:"shapetype",get:function(){return this.shapetype2}},{key:"deleteMarker",value:function(){bn(Mn(s.prototype),"remove",this).call(this),null!==this.mapEdit&&this.mapEdit.Ct(this.id)}}])&&yn(n.prototype,t),i&&yn(n,i),Object.defineProperty(n,"prototype",{writable:!1}),s}(fengmap.FMPolygonMarker);function wn(t){return(wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function En(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,function(t){t=function(t,i){if("object"!=wn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=wn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==wn(t)?t:String(t)}(s.key),s)}}function Sn(t,i,n){i=xn(i);var s=t,i=Rn()?Reflect.construct(i,n||[],xn(t).constructor):i.apply(t,n);if(i&&("object"===wn(i)||"function"==typeof i))return i;if(void 0!==i)throw new TypeError("Derived constructors may only return object or undefined");t=s;if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function Rn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Rn=function(){return!!t})()}function jn(){return(jn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,i,n){var s=function(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&null!==(t=xn(t)););return t}(t,i);if(s)return(s=Object.getOwnPropertyDescriptor(s,i)).get?s.get.call(arguments.length<3?t:n):s.value}).apply(this,arguments)}function xn(t){return(xn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function On(t,i){return(On=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t})(t,i)}var Tn=function(t){var i,n=s;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");function s(t){var i;if(this instanceof s)return(i=Sn(this,s,[t])).shapetype2="line",i.info2=t,i.id=""+bi.generateUUID(),i.mapEdit=null,i;throw new TypeError("Cannot call a class as a function")}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),t&&On(n,t),n=s,(t=[{key:"info",get:function(){return this.info2.id=this.id,this.info2.points=this.points,this.info2.shapetype=this.shapetype,this.info2.level=this.segments[0].level,this.info2.buildingID=this.segments[0].buildingID,this.info2}},{key:"points",get:function(){return 0===this.segments.length?[]:this.segments[0].points}},{key:"shapetype",get:function(){return this.shapetype2}},{key:"deleteMarker",value:function(){jn(xn(s.prototype),"remove",this).call(this),null!==this.mapEdit&&this.mapEdit.Ct(this.id)}}])&&En(n.prototype,t),i&&En(n,i),Object.defineProperty(n,"prototype",{writable:!1}),s}(fengmap.FMLineMarker);function kn(t){return(kn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Bn(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,function(t){t=function(t,i){if("object"!=kn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=kn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==kn(t)?t:String(t)}(s.key),s)}}var In=function(){function i(t){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");this.C=t.map,this.$=this.C.getContainer(),this.Ki=t.highlightColor,void 0===this.Ki&&(this.Ki="#FF0000"),this.$i=t.radius,void 0===this.$i&&(this.$i=1),this.it=this.it.bind(this),this.st=new $,this.st.params.Line.threshold=this.$i,this.et=new oi,this.tn=[],this.nn={},this.ut()}var t,n,s;return t=i,(n=[{key:"removeTargets",value:function(){for(var t=0;t<this.tn.length;t++)this.tn[t].parent.remove(this.tn[t]);this.nn={},this.tn.length=0}},{key:"addTargets",value:function(t){this.removeTargets();for(var i=0;i<t.length;i++)if(t[i].type===fengmap.FMType.LINE_MARKER){for(var n=t[i].segments[0].points,s=[],e=0;e<n.length;e++)s.push(new g(n[e].x-this.C.x,n[e].z,-n[e].y+this.C.y));var r=new k({visible:!1}),r=new si((new Jt).setFromPoints(s),r);r.myobject=t[i],r.mapNode=t[i],t[i].parent.scene.add(r),this.tn.push(r)}else if(t[i].type===fengmap.FMType.POLYGON_MARKER&&t[i].getRenderNode()){this.nn[""+t[i].id]={borderColor:t[i].borderColor,color:t[i].color};for(var h=t[i].points,o=[],u=0;u<h.length;u++)o.push(new g(h[u].x-this.C.x,t[i].height,-h[u].y+this.C.y));var r=new k({visible:!1}),a=new si((new Jt).setFromPoints(o),r);a.myobject=t[i],a.mapNode=t[i],t[i].getRenderNode().parent.add(a),this.tn.push(a)}}},{key:"dispose",value:function(){this.removeTargets(),this.tn.length=0,this.$.removeEventListener("mousemove",this.it,!1)}},{key:"radius",get:function(){return this.$i},set:function(t){this.$i=t,this.st.params.Line.threshold=this.$i}},{key:"on",value:function(t,i){this.et.k(t,i)}}])&&Bn(t.prototype,n),s&&Bn(t,s),Object.defineProperty(t,"prototype",{writable:!1}),i}();Object.assign(In.prototype,{ut:function(){this.$.addEventListener("mousemove",this.it,!1)},it:function(t){if(0!==this.tn.length){for(var n=this,i=new E,s=this.$.getBoundingClientRect(),i=(i.x=(t.clientX-s.left)/s.width*2-1,i.y=2*-((t.clientY-s.top)/s.height)+1,this.st.setFromCamera(i,this.C.camera),t.clientX-s.left),t=t.clientY-s.top,s=fengmap.FMUtil.coordsScreenToMap(this.C,{x:i,y:t}),e=this.st.intersectObjects(function(){for(var t=[],i=0;i<n.tn.length;i++)n.tn[i].mapNode&&n.tn[i].mapNode.level&&n.tn[i].mapNode.level===n.C.getLevel()&&t.push(n.tn[i]);return t}(this.tn),!0),r=[],h=[],o=0;o<e.length;o++)!function(t,i){for(var n=!0,s=0;s<t.length;s++)if(t[s].uuid===i.uuid){n=!1;break}return n}(r,e[o].object)||(r.push(e[o].object),h.push(e[o].point));var u=[],a=[];if(0<r.length){for(var f=0;f<r.length;f++){u.push(r[f].myobject);var c=h[f];a.push({x:c.x+this.C.x,y:this.C.y-c.z})}for(var l=s,v=u,d=a,y=0;y<v.length-1;y++)for(var p=0;p<v.length-1-y;p++){var m=Math.sqrt((v[p].x-l.x)*(v[p].x-l.x)+(v[p].y-l.y)*(v[p].y-l.y));Math.sqrt((v[p+1].x-l.x)*(v[p+1].x-l.x)+(v[p+1].y-l.y)*(v[p+1].y-l.y))<m&&(m=v[p],v[p]=v[p+1],v[p+1]=m,m=d[p],d[p]=d[p+1],d[p+1]=m)}}0===u.length&&(a=u=null);for(var b=0;b<this.tn.length;b++){var M=this.nn[""+this.tn[b].myobject.id];M&&(this.tn[b].myobject.color=M.color,this.tn[b].myobject.borderColor=M.borderColor)}null!==u&&u[0].type===fengmap.FMType.POLYGON_MARKER&&(u[0].color=this.Ki,u[0].borderColor=this.Ki),this.et.V({type:"snap",coords:s,targets:u,targetsCoords:a,level:this.C.getLevel()})}}});function Vn(t){return(Vn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cn(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var s,e,r,h,o=[],u=!0,a=!1;try{if(r=(n=n.call(t)).next,0===i){if(Object(n)!==n)return;u=!1}else for(;!(u=(s=r.call(n)).done)&&(o.push(s.value),o.length!==i);u=!0);}catch(t){a=!0,e=t}finally{try{if(!u&&null!=n.return&&(h=n.return(),Object(h)!==h))return}finally{if(a)throw e}}return o}}(t,i)||Dn(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pn(t,i){var n,s,e,r,h="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(h)return s=!(n=!0),{s:function(){h=h.call(t)},n:function(){var t=h.next();return n=t.done,t},e:function(t){s=!0,e=t},f:function(){try{n||null==h.return||h.return()}finally{if(s)throw e}}};if(Array.isArray(t)||(h=Dn(t))||i&&t&&"number"==typeof t.length)return h&&(t=h),r=0,{s:i=function(){},n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Dn(t,i){var n;if(t)return"string"==typeof t?Fn(t,i):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fn(t,i):void 0}function Fn(t,i){(null==i||i>t.length)&&(i=t.length);for(var n=0,s=new Array(i);n<i;n++)s[n]=t[n];return s}function Yn(t,i){for(var n=0;n<i.length;n++){var s=i[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,function(t){t=function(t,i){if("object"!=Vn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===i?String:Number)(t);n=n.call(t,i||"default");if("object"!=Vn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==Vn(t)?t:String(t)}(s.key),s)}}var Ln=function(){function i(t){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");this.C=t.map,this.sn=t.defaultStyle,this.en=t.isdirect,this.rn=new Map,this.hn=new Map,this.on=new Map,this.un=this.un.bind(this),this.C.on("beforeRender",this.un)}var t,n,s;return t=i,(n=[{key:"add",value:function(t){var i=this;if(void 0===t.buildingID&&(t.buildingID=this.C.getMapOptions().mapID),void 0===t.type&&(t.type=1),void 0===t.levels){t.levels=[];for(var n=this.C.getBuilding(t.buildingID).getFloorInfos(),s=0;s<n.length;s++)t.levels.push(n[s].level)}for(var e=t.result,r=t.levels,h=t.roadRanks,o=0;o<r.length;o++)for(var u=0;u<h.length;u++)for(var a=function(t,i,n){for(var s=[],e=0;e<t.length;e++)if(""+t[e].level==""+i)for(var r=t[e].roadVector,h=0;h<r.length;h++)""+r[h].roadRank==""+n&&s.push(r[h]);return s}(e,r[o],h[u]),f=(m=p=y=d=v=l=c=f=void 0,t.type),c=r[o],l=t.height,v=h[u],d=a,y=t.zoomRange,p=i.an(v),m=0;m<d.length;m++)d[m].buildingID||(d[m].buildingID=i.C.getMapOptions().mapID),""+f=="1"?(i.fn(p,c,l,v,d[m].startPoint,d[m].startId,y,d[m].buildingID),i.fn(p,c,l,v,d[m].endPoint,d[m].endId,y,d[m].buildingID),i.cn(p,c,l,v,d[m].startPoint,d[m].endPoint,y,d[m].buildingID,d[m].roadEntry)):""+f=="2"?i.cn(p,c,l,v,d[m].startPoint,d[m].endPoint,y,d[m].buildingID,d[m].roadEntry):""+f=="3"&&(i.fn(p,c,l,v,d[m].startPoint,d[m].startId,y,d[m].buildingID),i.fn(p,c,l,v,d[m].endPoint,d[m].endId,y,d[m].buildingID))}},{key:"getNaviLineByRanks",value:function(t){return this.ln(t,this.hn)}},{key:"getNaviNodeByRanks",value:function(t){return this.ln(t,this.rn)}},{key:"remove",value:function(r){for(var h=this,t=(void 0===r.buildingID&&(r.buildingID=this.C.getMapOptions().mapID),r.type),i=(void 0===t&&(t=1),r.levels),n=r.roadRanks,s=0;s<i.length;s++)for(var e=0;e<n.length;e++)""+t=="1"?(o(i[s],n[e]),u(i[s],n[e])):""+t=="2"?o(i[s],n[e]):""+t=="3"&&u(i[s],n[e]);function o(t,i){for(var n=h.hn.get(r.buildingID+""+t),s=a(n,i);-1!==s;)n[s].object.remove(),n.splice(s,1),s=a(n,i);var e=h.on.get(r.buildingID+""+t);if(e)for(s=a(e,i);-1!==s;)e[s].object.remove(),e.splice(s,1),s=a(e,i)}function u(t,i){for(var n=h.rn.get(r.buildingID+""+t),s=a(n,i);-1!==s;)n[s].object.remove(),n.splice(s,1),s=a(n,i)}function a(t,i){for(var n=-1,s=0;s<t.length;s++)if(""+t[s].roadRank==""+i){n=s;break}return n}}},{key:"changeVisible",value:function(t){}},{key:"dispose",value:function(){var t,i=Pn(this.rn);try{for(i.s();!(t=i.n()).done;){for(var n=Cn(t.value,2),s=(n[0],n[1]),e=0;e<s.length;e++)s[e].object.remove();s.length=0}}catch(t){i.e(t)}finally{i.f()}var r,h=Pn(this.hn);try{for(h.s();!(r=h.n()).done;){for(var o=Cn(r.value,2),u=(o[0],o[1]),a=0;a<u.length;a++)u[a].object.remove();u.length=0}}catch(t){h.e(t)}finally{h.f()}var f,c=Pn(this.on);try{for(c.s();!(f=c.n()).done;){for(var l=Cn(f.value,2),v=(l[0],l[1]),d=0;d<v.length;d++)v[d].object.remove();v.length=0}}catch(t){c.e(t)}finally{c.f()}this.on.clear(),this.hn.clear(),this.rn.clear(),this.C.on("beforeRender",this.un)}}])&&Yn(t.prototype,n),s&&Yn(t,s),Object.defineProperty(t,"prototype",{writable:!1}),i}(),_n=(Object.assign(Ln.prototype,{an:function(t){for(var i=null,n=0;n<this.sn.length;n++)if(""+this.sn[n].roadRank==""+t){i=this.sn[n];break}return i},cn:function(s,e,r,h,t,i,n,o,u){var a=this,f=new fengmap.FMSegment,f=(f.points=[{x:t.x,y:t.y,z:r},{x:i.x,y:i.y,z:r}],f.level=e,f.buildingID=o,new fengmap.FMLineMarker({segments:[f],width:s.lineWidth,color:s.lineColor,type:fengmap.FMLineType.FULL})),c=(f.addTo(this.C),this.hn.get(o+""+e));function l(t,i){var n=new fengmap.FMSegment,i=(n.points=[{x:t.p1.x,y:t.p1.y,z:r},{x:i.x,y:i.y,z:r},{x:t.p2.x,y:t.p2.y,z:r}],n.level=e,n.buildingID=o,new fengmap.FMLineMarker({segments:[n],width:s.lineWidth,color:s.lineColor,type:fengmap.FMLineType.FULL,smooth:!1})),t=(i.addTo(a.C),a.on.get(o+""+e));t?t.push({roadRank:h,object:i}):a.on.set(o+""+e,[{roadRank:h,object:i}])}function v(t,i){var n=(t.x+i.x)/2,t=(t.y+i.y)/2,s=Math.PI/4;return{p1:{x:(n-i.x)*Math.cos(s)-(t-i.y)*Math.sin(s)+i.x,y:(t-i.y)*Math.cos(s)+(n-i.x)*Math.sin(s)+i.y},p2:{x:(n-i.x)*Math.cos(2*Math.PI-s)-(t-i.y)*Math.sin(2*Math.PI-s)+i.x,y:(t-i.y)*Math.cos(2*Math.PI-s)+(n-i.x)*Math.sin(2*Math.PI-s)+i.y}}}c?c.push({roadRank:h,object:f,zoomRange:n}):this.hn.set(o+""+e,[{roadRank:h,object:f,zoomRange:n}]),this.en&&(c={x:(t.x+i.x)/2,y:(t.y+i.y)/2},f={x:(t.x+c.x)/2,y:(t.y+c.y)/2},n={x:(i.x+c.x)/2,y:(i.y+c.y)/2},""+u=="1"?l(v(f,c),c):""+u=="2"?l(v(n,c),c):""+u=="3"&&(l(v(f,c),c),l(v(n,c),c)))},fn:function(t,i,n,s,e,r,h,o){var u;this.vn(o+""+i,r)&&(u={x:e.x,y:e.y},u={points:fengmap.FMCalculator.rectangleBuilder(t.pointSize,t.pointSize,u),x:e.x,y:e.y,height:n,color:t.pointColor,borderWidth:0,opacity:1},e=this.C.getBuilding(o).getFloor(i),(n=new fengmap.FMPolygonMarker(u)).addTo(e),n.id=r,(t=this.rn.get(o+""+i))?t.push({roadRank:s,object:n,zoomRange:h}):this.rn.set(o+""+i,[{roadRank:s,object:n,zoomRange:h}]))},vn:function(t,i){var n,s=!0,e=Pn(this.rn);try{for(e.s();!(n=e.n()).done;){var r=Cn(n.value,2),h=r[0],o=r[1];if(""+h==""+t)for(var u=0;u<o.length;u++)if(""+o[u].object.id==""+i){s=!1;break}if(!s)break}}catch(t){e.e(t)}finally{e.f()}return s},dn:function(t,i){for(var n=!1,s=0;s<i.length;s++)if(""+i[s]==""+t){n=!0;break}return n},un:function(){for(var t=this.C.camera,i=this.C.getVisibleLevels(),n=this.C.getZoom(),s=0;s<i.length;s++){var e=this.C.getFloor(i[s]),r=this.hn.get(""+i[s]);if(r)for(var h,o,u=0;u<r.length;u++)n<r[u].zoomRange[0]||n>r[u].zoomRange[1]?r[u].object.parent&&r[u].object.remove():(h=new g((o=r[u].object.segments[0].points)[0].x-this.C.x,o[0].z+e.height,-o[0].y+this.C.y),o=new g(o[1].x-this.C.x,o[1].z+e.height,-o[1].y+this.C.y),h=h.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix),o=o.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix),!(1<Math.abs(h.x)||1<Math.abs(h.y)||1<Math.abs(h.z))||!(1<Math.abs(o.x)||1<Math.abs(o.y)||1<Math.abs(o.z))?r[u].object.parent||r[u].object.addTo(this.C):r[u].object.parent&&r[u].object.remove());var a=this.rn.get(""+i[s]);if(a)for(var f=0;f<a.length;f++){var c,l=a[f].object;n<a[f].zoomRange[0]||n>a[f].zoomRange[1]?l.parent&&l.remove():(c=new g(l.x-this.C.x,l.height+e.height,-l.y+this.C.y).applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix),1<Math.abs(c.x)||1<Math.abs(c.y)||1<Math.abs(c.z)?l.parent&&l.remove():l.parent||l.addTo(e))}}this.C.enableUpdateRender()},ln:function(t,i){var n=t.roadRanks,s=t.levels;if(void 0===t.buildingID&&(t.buildingID=this.C.getMapOptions().mapID),void 0===s)for(var s=[],e=this.C.getBuilding(t.buildingID).getFloorInfos(),r=0;r<e.length;r++)s.push(e[r].level);for(var h=[],o=0;o<s.length;o++){var u=i.get(t.buildingID+""+s[o]);if(u)for(var a=0;a<u.length;a++)this.dn(u[a].roadRank,n)&&h.push(u[a].object)}return h}}),"v3.1.5"),Hn=69,P=window.fengmap||{};P.VERSION=_n,P.BUILD=Hn,P.FMMapEditor=t,P.FMMarkerEditor=Di,P.FMBoxSelectTool=B,P.FMImageMarkerEdit=ji,P.FMPolygonMarkerEdit=An,P.FMLineMarkerEdit=Tn,P.FMSnapCtrl=In,P.FMNaviPathLineTool=Ln,F.default=P}],s={},e.m=n,e.c=s,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"yn",{value:!0})},e.t=function(i,t){if(1&t&&(i=e(i)),8&t)return i;if(4&t&&"object"==typeof i&&i&&i.yn)return i;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:i}),2&t&&"string"!=typeof i)for(var s in i)e.d(n,s,function(t){return i[t]}.bind(null,s));return n},e.n=function(t){var i=t&&t.yn?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=0).default;function e(t){var i;return(s[t]||(i=s[t]={i:t,l:!1,exports:{}},n[t].call(i.exports,i,i.exports,e),i.l=!0,i)).exports}var n,s});