Files
map-demo/public/js/ooomap.xcx.min.js
T
2026-03-27 09:02:29 +08:00

7 lines
863 KiB
JavaScript

/*! ooomap RELEASE XCX version:1.13.15-3 time: 2026/1/27 13:26:56 */
var t,e;t=this,e=function(t){"use strict";function e(t,e){Object.getOwnPropertyNames(e).forEach(i=>{if("constructor"!==i&&"prototype"!==i&&"name"!==i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n)}})}var i=function(t){Object.defineProperty(t,"style",{get(){return{width:this.width+"px",height:this.height+"px"}}}),Object.defineProperty(t,"clientHeight",{get(){return this.height/2}}),Object.defineProperty(t,"clientWidth",{get(){return this.width/2}}),Object.defineProperty(t,"offsetHeight",{get(){return this.height}}),Object.defineProperty(t,"offsetWidth",{get(){return this.width}})},n=new Map;class r{constructor(t){this.identifier=t.identifier,this.force=void 0===t.force?1:t.force,this.pageX=t.pageX||t.x,this.pageY=t.pageY||t.y,this.clientX=t.clientX||t.x,this.clientY=t.clientY||t.y,this.screenX=this.pageX,this.screenY=this.pageY}}class a{constructor(){n.set(this,{})}addEventListener(t,e,i={}){var r=n.get(this);r||(r={},n.set(this,r)),r[t]||(r[t]=[]),r[t].push(e),i.capture,i.once,i.passive}removeEventListener(t,e){const i=n.get(this);if(i){const n=i[t];if(n&&n.length>0)for(var r=n.length;r--;r>0)if(n[r]===e){n.splice(r,1);break}}}dispatchEvent(t={}){"function"!=typeof t.preventDefault&&(t.preventDefault=()=>{}),"function"!=typeof t.stopPropagation&&(t.stopPropagation=()=>{});const e=n.get(this)[t.type];if(e)for(var i=0;i<e.length;i++)e[i](t)}dispatchTouchEvent(t={}){var e=Object.assign({},this);const i={changedTouches:t.changedTouches.map(t=>new r(t)),touches:t.touches.map(t=>new r(t)),targetTouches:Array.prototype.slice.call(t.touches.map(t=>new r(t))),timeStamp:t.timeStamp,target:e,currentTarget:e,type:t.type,cancelBubble:!1,cancelable:!1};this.dispatchEvent(i)}}var o=wx.getSystemInfoSync(),s={AudioContext:function(){},URL:{},location:{}};Object.defineProperties(s,{innerWidth:{get:function(){return o.screenWidth}},innerHeight:{get:function(){return o.screenHeight}}}),e(s,a.prototype);const h={createElementNS:(t,e)=>"canvas"===e?__tmpCanvas:"img"===e?m.createImage():void 0,createElement(t){return this.createElementNS(null,t)}};e(h,a.prototype);const l=new Map,c=new Map,u=new Map;function d(t,e={}){e.target=e.target||this,"function"==typeof this[`on${t}`]&&this[`on${t}`].call(this,e)}function p(t,e={}){this.readyState=t,e.readyState=t,d.call(this,"readystatechange",e)}class f extends a{constructor(){super(),this.onabort=null,this.onerror=null,this.onload=null,this.onloadstart=null,this.onprogress=null,this.ontimeout=null,this.onloadend=null,this.onreadystatechange=null,this.readyState=0,this.response=null,this.responseText=null,this.responseType="text",this.dataType="string",this.responseXML=null,this.status=0,this.statusText="",this.upload={},this.withCredentials=!1,l.set(this,{"content-type":"application/x-www-form-urlencoded"}),c.set(this,{})}abort(){const t=u.get(this);t&&t.abort()}getAllResponseHeaders(){const t=c.get(this);return Object.keys(t).map(e=>`${e}: ${t[e]}`).join("\n")}getResponseHeader(t){return c.get(this)[t]}open(t,e){this._method=t,this._url=e,p.call(this,f.OPENED)}overrideMimeType(){}send(t=""){if(this.readyState!==f.OPENED)throw new Error("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.");{const i=this._url,n=l.get(this),r=this.responseType,a=this.dataType,o=function(t){return!/^(http|https|ftp|wxfile):\/\/.*/i.test(t)}(i);let s;"arraybuffer"===r||(s="utf8"),delete this.response,this.response=null;const h=({data:t,statusCode:e,header:i})=>{if(e=void 0===e?200:e,"string"!=typeof t&&!(t instanceof ArrayBuffer))try{t=JSON.stringify(t)}catch(t){}this.status=e,i&&c.set(this,i),d.call(this,"loadstart"),p.call(this,f.HEADERS_RECEIVED),p.call(this,f.LOADING),this.response=t,t instanceof ArrayBuffer?Object.defineProperty(this,"responseText",{enumerable:!0,configurable:!0,get:function(){throw"InvalidStateError : responseType is "+this.responseType}}):this.responseText=t,p.call(this,f.DONE),d.call(this,"load"),d.call(this,"loadend")},u=({errMsg:t})=>{-1!==t.indexOf("abort")?d.call(this,"abort"):d.call(this,"error",{message:t}),d.call(this,"loadend")};if(o){const t=wx.getFileSystemManager();var e={filePath:i,success:h,fail:u};return s&&(e.encoding=s),void t.readFile(e)}wx.request({data:t,url:i,method:this._method,header:n,dataType:a,responseType:r,success:h,fail:u})}}setRequestHeader(t,e){const i=l.get(this);i[t]=e,l.set(this,i)}addEventListener(t,e){"function"==typeof e&&(this["on"+t]=(t={})=>{t.target=t.target||this,e.call(this,t)})}removeEventListener(t,e){this["on"+t]===e&&(this["on"+t]=null)}}f.UNSEND=0,f.OPENED=1,f.HEADERS_RECEIVED=2,f.LOADING=3,f.DONE=4;try{s.document=h;var window=s,document=h,XMLHttpRequest=f,m=null,__tmpCanvas=null}catch(mu){}function g(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"name"in Function.prototype==0&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}),Object.assign(g.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var i=this._listeners[t];if(void 0!==i){var n=i.indexOf(e);-1!==n&&i.splice(n,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var i=e.slice(0),n=0,r=i.length;n<r;n++)i[n].call(this,t)}}}});var v,y,x,b,w,_,M,S,A,T,L,C,P={LEFT:0,MIDDLE:1,RIGHT:2},E=100,D=103,I=104,O=300,N=301,k=302,z=304,R=306,B=307,F=1e3,U=1001,G=1002,j=1003,V=1004,W=1005,H=1006,X=1007,q=1008,Y=1009,Z=1012,J=1014,K=1015,Q=1016,$=1020,tt=1022,et=1023,it=1026,nt=1027,rt=33776,at=33777,ot=33778,st=33779,ht=35840,lt=35841,ct=35842,ut=35843,dt=36196,pt=2300,ft=2301,mt=2302,gt=2400,vt=2401,yt=2402,xt=3e3,bt=3001,wt=3007,_t=3201,Mt={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var t=[],e=0;e<256;e++)t[e]=(e<16?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(t[255&e]+t[e>>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&i]+t[i>>8&255]+"-"+t[i>>16&15|64]+t[i>>24&255]+"-"+t[63&n|128]+t[n>>8&255]+"-"+t[n>>16&255]+t[n>>24&255]+t[255&r]+t[r>>8&255]+t[r>>16&255]+t[r>>24&255]).toUpperCase()}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Mt.DEG2RAD},radToDeg:function(t){return t*Mt.RAD2DEG},isPowerOfTwo:function(t){return!(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))}};function St(t,e){this.x=t||0,this.y=e||0}function At(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Tt(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function Lt(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function Ct(){this.elements=[1,0,0,0,1,0,0,0,1]}Object.defineProperties(St.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(St.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:(v=new St,y=new St,function(t,e){return v.set(t,t),y.set(e,e),this.clamp(v,y)}),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,i){return this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}}),Object.assign(At.prototype,{isMatrix4:!0,set:function(t,e,i,n,r,a,o,s,h,l,c,u,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=h,g[6]=l,g[10]=c,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new At).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:(T=new Lt,function(t){var e=this.elements,i=t.elements,n=1/T.setFromMatrixColumn(t,0).length(),r=1/T.setFromMatrixColumn(t,1).length(),a=1/T.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}),makeRotationFromEuler:function(t){!t||t.isEuler;var e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),h=Math.sin(n),l=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){var u=a*l,d=a*c,p=o*l,f=o*c;e[0]=s*l,e[4]=-s*c,e[8]=h,e[1]=d+p*h,e[5]=u-f*h,e[9]=-o*s,e[2]=f-u*h,e[6]=p+d*h,e[10]=a*s}else if("YXZ"===t.order){var m=s*l,g=s*c,v=h*l,y=h*c;e[0]=m+y*o,e[4]=v*o-g,e[8]=a*h,e[1]=a*c,e[5]=a*l,e[9]=-o,e[2]=g*o-v,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order)m=s*l,g=s*c,v=h*l,y=h*c,e[0]=m-y*o,e[4]=-a*c,e[8]=v+g*o,e[1]=g+v*o,e[5]=a*l,e[9]=y-m*o,e[2]=-a*h,e[6]=o,e[10]=a*s;else if("ZYX"===t.order)u=a*l,d=a*c,p=o*l,f=o*c,e[0]=s*l,e[4]=p*h-d,e[8]=u*h+f,e[1]=s*c,e[5]=f*h+u,e[9]=d*h-p,e[2]=-h,e[6]=o*s,e[10]=a*s;else if("YZX"===t.order){var x=a*s,b=a*h,w=o*s,_=o*h;e[0]=s*l,e[4]=_-x*c,e[8]=w*c+b,e[1]=c,e[5]=a*l,e[9]=-o*l,e[2]=-h*l,e[6]=b*c+w,e[10]=x-_*c}else"XZY"===t.order&&(x=a*s,b=a*h,w=o*s,_=o*h,e[0]=s*l,e[4]=-c,e[8]=h*l,e[1]=x*c+_,e[5]=a*l,e[9]=b*c-w,e[2]=w*c-b,e[6]=o*l,e[10]=_*c+x);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:(S=new Lt(0,0,0),A=new Lt(1,1,1),function(t){return this.compose(S,t,A)}),lookAt:(w=new Lt,_=new Lt,M=new Lt,function(t,e,i){var n=this.elements;return M.subVectors(t,e),0===M.lengthSq()&&(M.z=1),M.normalize(),w.crossVectors(i,M),0===w.lengthSq()&&(1===Math.abs(i.z)?M.x+=1e-4:M.z+=1e-4,M.normalize(),w.crossVectors(i,M)),w.normalize(),_.crossVectors(M,w),n[0]=w.x,n[4]=_.x,n[8]=M.x,n[1]=w.y,n[5]=_.y,n[9]=M.y,n[2]=w.z,n[6]=_.z,n[10]=M.z,this}),multiply:function(t,e){return void 0!==e?this.multiplyMatrices(t,e):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],h=i[12],l=i[1],c=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15],w=n[0],_=n[4],M=n[8],S=n[12],A=n[1],T=n[5],L=n[9],C=n[13],P=n[2],E=n[6],D=n[10],I=n[14],O=n[3],N=n[7],k=n[11],z=n[15];return r[0]=a*w+o*A+s*P+h*O,r[4]=a*_+o*T+s*E+h*N,r[8]=a*M+o*L+s*D+h*k,r[12]=a*S+o*C+s*I+h*z,r[1]=l*w+c*A+u*P+d*O,r[5]=l*_+c*T+u*E+d*N,r[9]=l*M+c*L+u*D+d*k,r[13]=l*S+c*C+u*I+d*z,r[2]=p*w+f*A+m*P+g*O,r[6]=p*_+f*T+m*E+g*N,r[10]=p*M+f*L+m*D+g*k,r[14]=p*S+f*C+m*I+g*z,r[3]=v*w+y*A+x*P+b*O,r[7]=v*_+y*T+x*E+b*N,r[11]=v*M+y*L+x*D+b*k,r[15]=v*S+y*C+x*I+b*z,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new Lt;return function(e){for(var i=0,n=e.count;i<n;i++)t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.applyMatrix4(this),e.setXYZ(i,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],h=t[13],l=t[2],c=t[6],u=t[10],d=t[14];return t[3]*(+r*s*c-n*h*c-r*o*u+i*h*u+n*o*d-i*s*d)+t[7]*(+e*s*d-e*h*u+r*a*u-n*a*d+n*h*l-r*s*l)+t[11]*(+e*h*c-e*o*d-r*a*c+i*a*d+r*o*l-i*h*l)+t[15]*(-n*o*l-e*s*c+e*o*u+n*a*c-i*a*u+i*s*l)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var i=this.elements,n=t.elements,r=n[0],a=n[1],o=n[2],s=n[3],h=n[4],l=n[5],c=n[6],u=n[7],d=n[8],p=n[9],f=n[10],m=n[11],g=n[12],v=n[13],y=n[14],x=n[15],b=p*y*u-v*f*u+v*c*m-l*y*m-p*c*x+l*f*x,w=g*f*u-d*y*u-g*c*m+h*y*m+d*c*x-h*f*x,_=d*v*u-g*p*u+g*l*m-h*v*m-d*l*x+h*p*x,M=g*p*c-d*v*c-g*l*f+h*v*f+d*l*y-h*p*y,S=r*b+a*w+o*_+s*M;if(0===S){if(!0===e)throw new Error("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");return this.identity()}var A=1/S;return i[0]=b*A,i[1]=(v*f*s-p*y*s-v*o*m+a*y*m+p*o*x-a*f*x)*A,i[2]=(l*y*s-v*c*s+v*o*u-a*y*u-l*o*x+a*c*x)*A,i[3]=(p*c*s-l*f*s-p*o*u+a*f*u+l*o*m-a*c*m)*A,i[4]=w*A,i[5]=(d*y*s-g*f*s+g*o*m-r*y*m-d*o*x+r*f*x)*A,i[6]=(g*c*s-h*y*s-g*o*u+r*y*u+h*o*x-r*c*x)*A,i[7]=(h*f*s-d*c*s+d*o*u-r*f*u-h*o*m+r*c*m)*A,i[8]=_*A,i[9]=(g*p*s-d*v*s-g*a*m+r*v*m+d*a*x-r*p*x)*A,i[10]=(h*v*s-g*l*s+g*a*u-r*v*u-h*a*x+r*l*x)*A,i[11]=(d*l*s-h*p*s-d*a*u+r*p*u+h*a*m-r*l*m)*A,i[12]=M*A,i[13]=(d*v*o-g*p*o+g*a*f-r*v*f-d*a*y+r*p*y)*A,i[14]=(g*l*o-h*v*o-g*a*c+r*v*c+h*a*y-r*l*y)*A,i[15]=(h*p*o-d*l*o+d*a*c-r*p*c-h*a*f+r*l*f)*A,this},scale:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,h=r*a,l=r*o;return this.set(h*a+i,h*o-n*s,h*s+n*o,0,h*o+n*s,l*o+i,l*s-n*a,0,h*s-n*o,l*s+n*a,r*s*s+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,i){var n=this.elements,r=e._x,a=e._y,o=e._z,s=e._w,h=r+r,l=a+a,c=o+o,u=r*h,d=r*l,p=r*c,f=a*l,m=a*c,g=o*c,v=s*h,y=s*l,x=s*c,b=i.x,w=i.y,_=i.z;return n[0]=(1-(f+g))*b,n[1]=(d+x)*b,n[2]=(p-y)*b,n[3]=0,n[4]=(d-x)*w,n[5]=(1-(u+g))*w,n[6]=(m+v)*w,n[7]=0,n[8]=(p+y)*_,n[9]=(m-v)*_,n[10]=(1-(u+f))*_,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this},decompose:(x=new Lt,b=new At,function(t,e,i){var n=this.elements,r=x.set(n[0],n[1],n[2]).length(),a=x.set(n[4],n[5],n[6]).length(),o=x.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],b.copy(this);var s=1/r,h=1/a,l=1/o;return b.elements[0]*=s,b.elements[1]*=s,b.elements[2]*=s,b.elements[4]*=h,b.elements[5]*=h,b.elements[6]*=h,b.elements[8]*=l,b.elements[9]*=l,b.elements[10]*=l,e.setFromRotationMatrix(b),i.x=r,i.y=a,i.z=o,this}),makePerspective:function(t,e,i,n,r,a){var o=this.elements,s=2*r/(e-t),h=2*r/(i-n),l=(e+t)/(e-t),c=(i+n)/(i-n),u=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=h,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,i,n,r,a){var o=this.elements,s=1/(e-t),h=1/(i-n),l=1/(a-r),c=(e+t)*s,u=(i+n)*h,d=(a+r)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*h,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}),Object.assign(Tt,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,a,o){var s=i[n+0],h=i[n+1],l=i[n+2],c=i[n+3],u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(c!==f||s!==u||h!==d||l!==p){var m=1-o,g=s*u+h*d+l*p+c*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*v;if(s=s*m+u*w,h=h*m+d*w,l=l*m+p*w,c=c*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+h*h+l*l+c*c);s*=_,h*=_,l*=_,c*=_}}t[e]=s,t[e+1]=h,t[e+2]=l,t[e+3]=c}}),Object.defineProperties(Tt.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(Tt.prototype,{isQuaternion:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,n=t._y,r=t._z,a=t.order,o=Math.cos,s=Math.sin,h=o(i/2),l=o(n/2),c=o(r/2),u=s(i/2),d=s(n/2),p=s(r/2);return"XYZ"===a?(this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p):"YXZ"===a?(this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p):"ZXY"===a?(this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p):"ZYX"===a?(this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p):"YZX"===a?(this._x=u*l*c+h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c-u*d*p):"XZY"===a&&(this._x=u*l*c-h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c+u*d*p),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,n=i[0],r=i[4],a=i[8],o=i[1],s=i[5],h=i[9],l=i[2],c=i[6],u=i[10],d=n+s+u;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(c-h)*e,this._y=(a-l)*e,this._z=(o-r)*e):n>s&&n>u?(e=2*Math.sqrt(1+n-s-u),this._w=(c-h)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+l)/e):s>u?(e=2*Math.sqrt(1+s-n-u),this._w=(a-l)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(h+c)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(o-r)/e,this._x=(a+l)/e,this._y=(h+c)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new Lt;return function(i,n){return void 0===e&&(e=new Lt),(t=i.dot(n)+1)<1e-6?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),angleTo:function(t){return 2*Math.acos(Math.abs(Mt.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var i=this.angleTo(t);if(0===i)return this;var n=Math.min(1,e/i);return this.slerp(t,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,h=e._z,l=e._w;return this._x=i*l+a*o+n*h-r*s,this._y=n*l+a*s+r*o-i*h,this._z=r*l+a*h+i*s-n*o,this._w=a*l-i*o-n*s-r*h,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var h=1-e;return this._w=h*a+e*this._w,this._x=h*i+e*this._x,this._y=h*n+e*this._y,this._z=h*r+e*this._z,this.normalize()}var l=Math.sqrt(s),c=Math.atan2(l,o),u=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this._w=a*u+this._w*d,this._x=i*u+this._x*d,this._y=n*u+this._y*d,this._z=r*u+this._z*d,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(Lt.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?this.multiplyVectors(t,e):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(L=new Tt,function(t){return!t||t.isEuler,this.applyQuaternion(L.setFromEuler(t))}),applyAxisAngle:function(){var t=new Tt;return function(e,i){return this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,h=s*e+a*n-o*i,l=s*i+o*e-r*n,c=s*n+r*i-a*e,u=-r*e-a*i-o*n;return this.x=h*s+u*-r+l*-o-c*-a,this.y=l*s+u*-a+c*-r-h*-o,this.z=c*s+u*-o+h*-a-l*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(){var t=new At;return function(e){return this.applyMatrix4(t.getInverse(e.projectionMatrix)).applyMatrix4(e.matrixWorld)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new Lt,e=new Lt;return function(i,n){return t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){return void 0!==e?this.crossVectors(t,e):this.crossVectors(this,t)},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new Lt;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new Lt;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Mt.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,i){var n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(Ct.prototype,{isMatrix3:!0,set:function(t,e,i,n,r,a,o,s,h){var l=this.elements;return l[0]=t,l[1]=n,l[2]=o,l[3]=e,l[4]=r,l[5]=s,l[6]=i,l[7]=a,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new Lt;return function(e){for(var i=0,n=e.count;i<n;i++)t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.applyMatrix3(this),e.setXYZ(i,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[3],s=i[6],h=i[1],l=i[4],c=i[7],u=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],y=n[4],x=n[7],b=n[2],w=n[5],_=n[8];return r[0]=a*f+o*v+s*b,r[3]=a*m+o*y+s*w,r[6]=a*g+o*x+s*_,r[1]=h*f+l*v+c*b,r[4]=h*m+l*y+c*w,r[7]=h*g+l*x+c*_,r[2]=u*f+d*v+p*b,r[5]=u*m+d*y+p*w,r[8]=u*g+d*x+p*_,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],h=t[7],l=t[8];return e*a*l-e*o*h-i*r*l+i*o*s+n*r*h-n*a*s},getInverse:function(t,e){t&&t.isMatrix4;var i=t.elements,n=this.elements,r=i[0],a=i[1],o=i[2],s=i[3],h=i[4],l=i[5],c=i[6],u=i[7],d=i[8],p=d*h-l*u,f=l*c-d*s,m=u*s-h*c,g=r*p+a*f+o*m;if(0===g){if(!0===e)throw new Error("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");return this.identity()}var v=1/g;return n[0]=p*v,n[1]=(o*u-d*a)*v,n[2]=(l*a-o*h)*v,n[3]=f*v,n[4]=(d*r-o*c)*v,n[5]=(o*s-l*r)*v,n[6]=m*v,n[7]=(a*c-u*r)*v,n[8]=(h*r-a*s)*v,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},setUvTransform:function(t,e,i,n,r,a,o){var s=Math.cos(r),h=Math.sin(r);this.set(i*s,i*h,-i*(s*a+h*o)+a+t,-n*h,n*s,-n*(-h*a+s*o)+o+e,0,0,1)},scale:function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],a=n[3],o=n[6],s=n[1],h=n[4],l=n[7];return n[0]=e*r+i*s,n[3]=e*a+i*h,n[6]=e*o+i*l,n[1]=-i*r+e*s,n[4]=-i*a+e*h,n[7]=-i*o+e*l,this},translate:function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}});var Pt,Et,Dt,It={getDataURL:function(t){var e;if("undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)e=t;else{void 0===C&&(C=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),C.width=t.width,C.height=t.height;var i=C.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=C}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},Ot=0;function Nt(t,e,i,n,r,a,o,s,h,l){Object.defineProperty(this,"id",{value:Ot++}),this.uuid=Mt.generateUUID(),this.name="",this.image=void 0!==t?t:Nt.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:Nt.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:U,this.wrapT=void 0!==n?n:U,this.magFilter=void 0!==r?r:H,this.minFilter=void 0!==a?a:q,this.anisotropy=void 0!==h?h:1,this.format=void 0!==o?o:et,this.type=void 0!==s?s:Y,this.offset=new St(0,0),this.repeat=new St(1,1),this.center=new St(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ct,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:xt,this.version=0,this.onUpdate=null}function kt(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function zt(t,e,i){this.width=t,this.height=e,this.scissor=new kt(0,0,t,e),this.scissorTest=!1,this.viewport=new kt(0,0,t,e),i=i||{},this.texture=new Nt(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:H,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function Rt(t,e,i){zt.call(this,t,e,i),this.samples=4}function Bt(t,e,i){zt.call(this,t,e,i)}function Ft(t,e,i,n,r,a,o,s,h,l,c,u){Nt.call(this,null,a,o,s,h,l,n,r,c,u),this.image={data:t,width:e,height:i},this.magFilter=void 0!==h?h:j,this.minFilter=void 0!==l?l:j,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function Ut(t,e){this.min=void 0!==t?t:new Lt(1/0,1/0,1/0),this.max=void 0!==e?e:new Lt(-1/0,-1/0,-1/0)}function Gt(t,e){this.center=void 0!==t?t:new Lt,this.radius=void 0!==e?e:0}function jt(t,e){this.normal=void 0!==t?t:new Lt(1,0,0),this.constant=void 0!==e?e:0}function Vt(t,e,i,n,r,a){this.planes=[void 0!==t?t:new jt,void 0!==e?e:new jt,void 0!==i?i:new jt,void 0!==n?n:new jt,void 0!==r?r:new jt,void 0!==a?a:new jt]}Nt.DEFAULT_IMAGE=void 0,Nt.DEFAULT_MAPPING=O,Nt.prototype=Object.assign(Object.create(g.prototype),{constructor:Nt,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=Mt.generateUUID()),!e&&void 0===t.images[n.uuid]){var r;if(Array.isArray(n)){r=[];for(var a=0,o=n.length;a<o;a++)r.push(It.getDataURL(n[a]))}else r=It.getDataURL(n);t.images[n.uuid]={uuid:n.uuid,url:r}}i.image=n.uuid}return e||(t.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping!==O)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case F:t.x=t.x-Math.floor(t.x);break;case U:t.x=t.x<0?0:1;break;case G:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case F:t.y=t.y-Math.floor(t.y);break;case U:t.y=t.y<0?0:1;break;case G:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(Nt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(kt.prototype,{isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,i,n,r,a=.01,o=.1,s=t.elements,h=s[0],l=s[4],c=s[8],u=s[1],d=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(l-u)<a&&Math.abs(c-f)<a&&Math.abs(p-m)<a){if(Math.abs(l+u)<o&&Math.abs(c+f)<o&&Math.abs(p+m)<o&&Math.abs(h+d+g-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var v=(h+1)/2,y=(d+1)/2,x=(g+1)/2,b=(l+u)/4,w=(c+f)/4,_=(p+m)/4;return v>y&&v>x?v<a?(i=0,n=.707106781,r=.707106781):(n=b/(i=Math.sqrt(v)),r=w/i):y>x?y<a?(i=.707106781,n=0,r=.707106781):(i=b/(n=Math.sqrt(y)),r=_/n):x<a?(i=.707106781,n=.707106781,r=0):(i=w/(r=Math.sqrt(x)),n=_/r),this.set(i,n,r,e),this}var M=Math.sqrt((m-p)*(m-p)+(c-f)*(c-f)+(u-l)*(u-l));return Math.abs(M)<.001&&(M=1),this.x=(m-p)/M,this.y=(c-f)/M,this.z=(u-l)/M,this.w=Math.acos((h+d+g-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new kt,e=new kt),t.set(i,i,i,i),e.set(n,n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,i){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),zt.prototype=Object.assign(Object.create(g.prototype),{constructor:zt,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Rt.prototype=Object.assign(Object.create(zt.prototype),{constructor:Rt,isWebGLMultisampleRenderTarget:!0,copy:function(t){return zt.prototype.copy.call(this,t),this.samples=t.samples,this}}),Bt.prototype=Object.create(zt.prototype),Bt.prototype.constructor=Bt,Bt.prototype.isWebGLRenderTargetCube=!0,Ft.prototype=Object.create(Nt.prototype),Ft.prototype.constructor=Ft,Ft.prototype.isDataTexture=!0,Object.assign(Ut.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,h=t.length;s<h;s+=3){var l=t[s],c=t[s+1],u=t[s+2];l<e&&(e=l),c<i&&(i=c),u<n&&(n=u),l>r&&(r=l),c>a&&(a=c),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,h=t.count;s<h;s++){var l=t.getX(s),c=t.getY(s),u=t.getZ(s);l<e&&(e=l),c<i&&(i=c),u<n&&(n=u),l>r&&(r=l),c>a&&(a=c),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new Lt;return function(e,i){var n=t.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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&&(t=new Lt),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(t=new Lt),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(){var t,e,i,n=new Lt;function r(r){var a=r.geometry;if(void 0!==a)if(a.isGeometry){var o=a.vertices;for(e=0,i=o.length;e<i;e++)n.copy(o[e]),n.applyMatrix4(r.matrixWorld),t.expandByPoint(n)}else if(a.isBufferGeometry){var s=a.attributes.position;if(void 0!==s)for(e=0,i=s.count;e<i;e++)n.fromBufferAttribute(s,e).applyMatrix4(r.matrixWorld),t.expandByPoint(n)}}return function(e){return t=this,e.updateMatrixWorld(!0),e.traverse(r),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,e){return void 0===e&&(e=new Lt),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.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:(Pt=new Lt,function(t){return this.clampPoint(t.center,Pt),Pt.distanceToSquared(t.center)<=t.radius*t.radius}),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant},intersectsTriangle:function(){var t=new Lt,e=new Lt,i=new Lt,n=new Lt,r=new Lt,a=new Lt,o=new Lt,s=new Lt,h=new Lt,l=new Lt;function c(n){var r,a;for(r=0,a=n.length-3;r<=a;r+=3){o.fromArray(n,r);var s=h.x*Math.abs(o.x)+h.y*Math.abs(o.y)+h.z*Math.abs(o.z),l=t.dot(o),c=e.dot(o),u=i.dot(o);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>s)return!1}return!0}return function(o){if(this.isEmpty())return!1;this.getCenter(s),h.subVectors(this.max,s),t.subVectors(o.a,s),e.subVectors(o.b,s),i.subVectors(o.c,s),n.subVectors(e,t),r.subVectors(i,e),a.subVectors(t,i);var u=[0,-n.z,n.y,0,-r.z,r.y,0,-a.z,a.y,n.z,0,-n.x,r.z,0,-r.x,a.z,0,-a.x,-n.y,n.x,0,-r.y,r.x,0,-a.y,a.x,0];return!!c(u)&&!!c(u=[1,0,0,0,1,0,0,0,1])&&(l.crossVectors(n,r),c(u=[l.x,l.y,l.z]))}}(),clampPoint:function(t,e){return void 0===e&&(e=new Lt),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new Lt;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new Lt;return function(e){return void 0===e&&(e=new Gt),this.getCenter(e.center),e.radius=.5*this.getSize(t).length(),e}}(),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(){var t=[new Lt,new Lt,new Lt,new Lt,new Lt,new Lt,new Lt,new Lt];return function(e){return this.isEmpty()||(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t)),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(Gt.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(Et=new Ut,function(t,e){var i=this.center;void 0!==e?i.copy(e):Et.setFromPoints(t).getCenter(i);for(var n=0,r=0,a=t.length;r<a;r++)n=Math.max(n,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(n),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 e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,e){var i=this.center.distanceToSquared(t);return void 0===e&&(e=new Lt),e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(t=new Ut),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(jt.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new Lt,e=new Lt;return function(i,n,r){var a=t.subVectors(r,n).cross(e.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(e=new Lt),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(){var t=new Lt;return function(e,i){void 0===i&&(i=new Lt);var n=e.delta(t),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?i.copy(e.start):void 0;var a=-(e.start.dot(this.normal)+this.constant)/r;return a<0||a>1?void 0:i.copy(n).multiplyScalar(a).add(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(t=new Lt),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new Lt,e=new Ct;return function(i,n){var r=n||e.getNormalMatrix(i),a=this.coplanarPoint(t).applyMatrix4(i),o=this.normal.applyMatrix3(r).normalize();return this.constant=-a.dot(o),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(Vt.prototype,{set:function(t,e,i,n,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],h=i[5],l=i[6],c=i[7],u=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(o-n,c-s,f-u,y-m).normalize(),e[1].setComponents(o+n,c+s,f+u,y+m).normalize(),e[2].setComponents(o+r,c+h,f+d,y+g).normalize(),e[3].setComponents(o-r,c-h,f-d,y-g).normalize(),e[4].setComponents(o-a,c-l,f-p,y-v).normalize(),e[5].setComponents(o+a,c+l,f+p,y+v).normalize(),this},intersectsObject:(Dt=new Gt,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Dt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Dt)}),intersectsSprite:function(){var t=new Gt;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++)if(e[r].distanceToPoint(i)<n)return!1;return!0},intersectsBox:function(){var t=new Lt;return function(e){for(var i=this.planes,n=0;n<6;n++){var r=i[n];if(t.x=r.normal.x>0?e.max.x:e.min.x,t.y=r.normal.y>0?e.max.y:e.min.y,t.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(t)<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}});var Wt={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick( specularColor, dotNV );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor;\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, irradiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\t#ifdef USE_TANGENT\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy = normalScale * mapN.xy;\n\t\t\tnormal = normalize( vTBN * mapN );\n\t\t#else\n\t\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t\t#endif\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#if defined( DITHERING )\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"};function Ht(t){var e={};for(var i in t)for(var n in e[i]={},t[i]){var r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}return e}function Xt(t){for(var e={},i=0;i<t.length;i++){var n=Ht(t[i]);for(var r in n)e[r]=n[r]}return e}var qt,Yt,Zt,Jt={clone:Ht,merge:Xt},Kt={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};function Qt(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}Object.assign(Qt.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){if(e=Mt.euclideanModulo(e,1),i=Mt.clamp(i,0,1),n=Mt.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,a=2*n-r;this.r=t(a,r,e+1/3),this.g=t(a,r,e),this.b=t(a,r,e-1/3)}return this}}(),setStyle:function(t){function e(t){void 0!==t&&parseFloat(t)}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,h=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(o,s,h)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l,c=(l=i[1]).length;if(3===c)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return t&&t.length>0&&void 0!==(l=Kt[t])&&this.setHex(l),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(){function t(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),copyLinearToSRGB:function(){function t(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(t={h:0,s:0,l:0});var e,i,n=this.r,r=this.g,a=this.b,o=Math.max(n,r,a),s=Math.min(n,r,a),h=(s+o)/2;if(s===o)e=0,i=0;else{var l=o-s;switch(i=h<=.5?l/(o+s):l/(2-o-s),o){case n:e=(r-a)/l+(r<a?6:0);break;case r:e=(a-n)/l+2;break;case a:e=(n-r)/l+4}e/=6}return t.h=e,t.s=i,t.l=h,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:(Zt={},function(t,e,i){return this.getHSL(Zt),Zt.h+=t,Zt.s+=e,Zt.l+=i,this.setHSL(Zt.h,Zt.s,Zt.l),this}),add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.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,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},lerpHSL:(qt={h:0,s:0,l:0},Yt={h:0,s:0,l:0},function(t,e){this.getHSL(qt),t.getHSL(Yt);var i=Mt.lerp(qt.h,Yt.h,e),n=Mt.lerp(qt.s,Yt.s,e),r=Mt.lerp(qt.l,Yt.l,e);return this.setHSL(i,n,r),this}),equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var $t,te={common:{diffuse:{value:new Qt(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ct},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new St(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Qt(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Qt(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new Ct}},sprite:{diffuse:{value:new Qt(15658734)},opacity:{value:1},center:{value:new St(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new Ct}}},ee={basic:{uniforms:Xt([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.fog]),vertexShader:Wt.meshbasic_vert,fragmentShader:Wt.meshbasic_frag},lambert:{uniforms:Xt([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.emissivemap,te.fog,te.lights,{emissive:{value:new Qt(0)}}]),vertexShader:Wt.meshlambert_vert,fragmentShader:Wt.meshlambert_frag},phong:{uniforms:Xt([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.gradientmap,te.fog,te.lights,{emissive:{value:new Qt(0)},specular:{value:new Qt(1118481)},shininess:{value:30}}]),vertexShader:Wt.meshphong_vert,fragmentShader:Wt.meshphong_frag},standard:{uniforms:Xt([te.common,te.envmap,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.roughnessmap,te.metalnessmap,te.fog,te.lights,{emissive:{value:new Qt(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Wt.meshphysical_vert,fragmentShader:Wt.meshphysical_frag},matcap:{uniforms:Xt([te.common,te.bumpmap,te.normalmap,te.displacementmap,te.fog,{matcap:{value:null}}]),vertexShader:Wt.meshmatcap_vert,fragmentShader:Wt.meshmatcap_frag},points:{uniforms:Xt([te.points,te.fog]),vertexShader:Wt.points_vert,fragmentShader:Wt.points_frag},dashed:{uniforms:Xt([te.common,te.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Wt.linedashed_vert,fragmentShader:Wt.linedashed_frag},depth:{uniforms:Xt([te.common,te.displacementmap]),vertexShader:Wt.depth_vert,fragmentShader:Wt.depth_frag},normal:{uniforms:Xt([te.common,te.bumpmap,te.normalmap,te.displacementmap,{opacity:{value:1}}]),vertexShader:Wt.normal_vert,fragmentShader:Wt.normal_frag},sprite:{uniforms:Xt([te.sprite,te.fog]),vertexShader:Wt.sprite_vert,fragmentShader:Wt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ct},t2D:{value:null}},vertexShader:Wt.background_vert,fragmentShader:Wt.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Wt.cube_vert,fragmentShader:Wt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Wt.equirect_vert,fragmentShader:Wt.equirect_frag},distanceRGBA:{uniforms:Xt([te.common,te.displacementmap,{referencePosition:{value:new Lt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Wt.distanceRGBA_vert,fragmentShader:Wt.distanceRGBA_frag},shadow:{uniforms:Xt([te.lights,te.fog,{color:{value:new Qt(0)},opacity:{value:1}}]),vertexShader:Wt.shadow_vert,fragmentShader:Wt.shadow_frag}};function ie(){var t=null,e=!1,i=null;function n(r,a){!1!==e&&(i(r,a),t.requestAnimationFrame(n))}return{start:function(){!0!==e&&null!==i&&(t.requestAnimationFrame(n),e=!0)},stop:function(){e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function ne(t){var e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);var n=e.get(i);n&&(t.deleteBuffer(n.buffer),e.delete(i))},update:function(i,n){i.isInterleavedBufferAttribute&&(i=i.data);var r=e.get(i);void 0===r?e.set(i,function(e,i){var n=e.array,r=e.dynamic?35048:35044,a=t.createBuffer();t.bindBuffer(i,a),t.bufferData(i,n,r),e.onUploadCallback();var o=5126;return n instanceof Float32Array?o=5126:n instanceof Float64Array||(n instanceof Uint16Array?o=5123:n instanceof Int16Array?o=5122:n instanceof Uint32Array?o=5125:n instanceof Int32Array?o=5124:n instanceof Int8Array?o=5120:n instanceof Uint8Array&&(o=5121)),{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version}}(i,n)):r.version<i.version&&(function(e,i,n){var r=i.array,a=i.updateRange;t.bindBuffer(n,e),!1===i.dynamic?t.bufferData(n,r,35044):-1===a.count?t.bufferSubData(n,0,r):0===a.count||(t.bufferSubData(n,a.offset*r.BYTES_PER_ELEMENT,r.subarray(a.offset,a.offset+a.count)),a.count=-1)}(r.buffer,i,n),r.version=i.version)}}}function re(t,e,i,n,r,a){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new Lt,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new Qt,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}function ae(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._order=n||ae.DefaultOrder}function oe(){this.mask=1}ee.physical={uniforms:Xt([ee.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Wt.meshphysical_vert,fragmentShader:Wt.meshphysical_frag},Object.assign(re.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}}),ae.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ae.DefaultOrder="XYZ",Object.defineProperties(ae.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(ae.prototype,{isEuler:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var n=Mt.clamp,r=t.elements,a=r[0],o=r[4],s=r[8],h=r[1],l=r[5],c=r[9],u=r[2],d=r[6],p=r[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-o,l))):"YZX"===e?(this._z=Math.asin(n(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e&&(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-c,p),this._y=0)),this._order=e,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new At;return function(e,i,n){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,i,n)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:($t=new Tt,function(t){return $t.setFromEuler(this),this.setFromQuaternion($t,t)}),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new Lt(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(oe.prototype,{set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!==(this.mask&t.mask)}});var se,he,le,ce,ue=0;function de(){Object.defineProperty(this,"id",{value:ue++}),this.uuid=Mt.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=de.DefaultUp.clone();var t=new Lt,e=new ae,i=new Tt,n=new Lt(1,1,1);e.onChange(function(){i.setFromEuler(e,!1)}),i.onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new At},normalMatrix:{value:new Ct}}),this.matrix=new At,this.matrixWorld=new At,this.matrixAutoUpdate=de.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new oe,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}de.DefaultUp=new Lt(0,1,0),de.DefaultMatrixAutoUpdate=!0,de.prototype=Object.assign(Object.create(g.prototype),{constructor:de,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:(ce=new Tt,function(t,e){return ce.setFromAxisAngle(t,e),this.quaternion.multiply(ce),this}),rotateOnWorldAxis:function(){var t=new Tt;return function(e,i){return t.setFromAxisAngle(e,i),this.quaternion.premultiply(t),this}}(),rotateX:function(){var t=new Lt(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new Lt(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new Lt(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new Lt;return function(e,i){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(i)),this}}(),translateX:function(){var t=new Lt(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new Lt(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new Lt(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:(le=new At,function(t){return t.applyMatrix4(le.getInverse(this.matrixWorld))}),lookAt:function(){var t=new Tt,e=new At,i=new Lt,n=new Lt;return function(r,a,o){r.isVector3?i.copy(r):i.set(r,a,o);var s=this.parent;this.updateWorldMatrix(!0,!1),n.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?e.lookAt(n,i,this.up):e.lookAt(i,n,this.up),this.quaternion.setFromRotationMatrix(e),s&&(e.extractRotation(s.matrixWorld),t.setFromRotationMatrix(e),this.quaternion.premultiply(t.inverse()))}}(),add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this||t&&t.isObject3D&&(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)),this},remove:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var i=this.children.indexOf(t);return-1!==i&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(i,1)),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i].getObjectByProperty(t,e);if(void 0!==r)return r}},getWorldPosition:function(t){return void 0===t&&(t=new Lt),this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(se=new Lt,he=new Lt,function(t){return void 0===t&&(t=new Tt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(se,t,he),t}),getWorldScale:function(){var t=new Lt,e=new Tt;return function(i){return void 0===i&&(i=new Lt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,i),i}}(),getWorldDirection:function(t){void 0===t&&(t=new Lt),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.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),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){var i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e)for(var n=this.children,r=0,a=n.length;r<a;r++)n[r].updateWorldMatrix(!1,!0)},toJSON:function(t){var e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isMesh&&0!==this.drawMode&&(n.drawMode=this.drawMode),this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,h=o.length;s<h;s++){var l=o[s];r(t.shapes,l)}else r(t.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var c=[];for(s=0,h=this.material.length;s<h;s++)c.push(r(t.materials,this.material[s]));n.material=c}else n.material=r(t.materials,this.material);if(this.children.length>0)for(n.children=[],s=0;s<this.children.length;s++)n.children.push(this.children[s].toJSON(t).object);if(e){var u=m(t.geometries),d=m(t.materials),p=m(t.textures),f=m(t.images);o=m(t.shapes),u.length>0&&(i.geometries=u),d.length>0&&(i.materials=d),p.length>0&&(i.textures=p),f.length>0&&(i.images=f),o.length>0&&(i.shapes=o)}return i.object=n,i;function m(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var i=0;i<t.children.length;i++){var n=t.children[i];this.add(n.clone())}return this}});var pe,fe,me=0;function ge(){Object.defineProperty(this,"id",{value:me+=2}),this.uuid=Mt.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function ve(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function ye(t,e,i){ve.call(this,new Int8Array(t),e,i)}function xe(t,e,i){ve.call(this,new Uint8Array(t),e,i)}function be(t,e,i){ve.call(this,new Uint8ClampedArray(t),e,i)}function we(t,e,i){ve.call(this,new Int16Array(t),e,i)}function _e(t,e,i){ve.call(this,new Uint16Array(t),e,i)}function Me(t,e,i){ve.call(this,new Int32Array(t),e,i)}function Se(t,e,i){ve.call(this,new Uint32Array(t),e,i)}function Ae(t,e,i){ve.call(this,new Float32Array(t),e,i)}function Te(t,e,i){ve.call(this,new Float64Array(t),e,i)}function Le(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Ce(t){if(0===t.length)return-1/0;for(var e=t[0],i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}ge.prototype=Object.assign(Object.create(g.prototype),{constructor:ge,isGeometry:!0,applyMatrix:function(t){for(var e=(new Ct).getNormalMatrix(t),i=0,n=this.vertices.length;i<n;i++)this.vertices[i].applyMatrix4(t);for(i=0,n=this.faces.length;i<n;i++){var r=this.faces[i];r.normal.applyMatrix3(e).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t=new At;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new At;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new At;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new At;return function(e,i,n){return t.makeTranslation(e,i,n),this.applyMatrix(t),this}}(),scale:function(){var t=new At;return function(e,i,n){return t.makeScale(e,i,n),this.applyMatrix(t),this}}(),lookAt:(fe=new de,function(t){fe.lookAt(t),fe.updateMatrix(),this.applyMatrix(fe.matrix)}),fromBufferGeometry:function(t){var e=this,i=null!==t.index?t.index.array:void 0,n=t.attributes,r=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,o=void 0!==n.color?n.color.array:void 0,s=void 0!==n.uv?n.uv.array:void 0,h=void 0!==n.uv2?n.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var l=0,c=0;l<r.length;l+=3,c+=2)e.vertices.push((new Lt).fromArray(r,l)),void 0!==o&&e.colors.push((new Qt).fromArray(o,l));function u(t,i,n,r){var l=void 0===o?[]:[e.colors[t].clone(),e.colors[i].clone(),e.colors[n].clone()],c=new re(t,i,n,void 0===a?[]:[(new Lt).fromArray(a,3*t),(new Lt).fromArray(a,3*i),(new Lt).fromArray(a,3*n)],l,r);e.faces.push(c),void 0!==s&&e.faceVertexUvs[0].push([(new St).fromArray(s,2*t),(new St).fromArray(s,2*i),(new St).fromArray(s,2*n)]),void 0!==h&&e.faceVertexUvs[1].push([(new St).fromArray(h,2*t),(new St).fromArray(h,2*i),(new St).fromArray(h,2*n)])}var d=t.groups;if(d.length>0)for(l=0;l<d.length;l++)for(var p=d[l],f=p.start,m=(c=f,f+p.count);c<m;c+=3)void 0!==i?u(i[c],i[c+1],i[c+2],p.materialIndex):u(c,c+1,c+2,p.materialIndex);else if(void 0!==i)for(l=0;l<i.length;l+=3)u(i[l],i[l+1],i[l+2]);else for(l=0;l<r.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:(pe=new Lt,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(pe).negate(),this.translate(pe.x,pe.y,pe.z),this}),normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new At;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new Lt,e=new Lt,i=0,n=this.faces.length;i<n;i++){var r=this.faces[i],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){var e,i,n,r,a,o;for(void 0===t&&(t=!0),o=new Array(this.vertices.length),e=0,i=this.vertices.length;e<i;e++)o[e]=new Lt;if(t){var s,h,l,c=new Lt,u=new Lt;for(n=0,r=this.faces.length;n<r;n++)a=this.faces[n],s=this.vertices[a.a],h=this.vertices[a.b],l=this.vertices[a.c],c.subVectors(l,h),u.subVectors(s,h),c.cross(u),o[a.a].add(c),o[a.b].add(c),o[a.c].add(c)}else for(this.computeFaceNormals(),n=0,r=this.faces.length;n<r;n++)o[(a=this.faces[n]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,i=this.vertices.length;e<i;e++)o[e].normalize();for(n=0,r=this.faces.length;n<r;n++){var d=(a=this.faces[n]).vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var n=(i=this.faces[t]).vertexNormals;3===n.length?(n[0].copy(i.normal),n[1].copy(i.normal),n[2].copy(i.normal)):(n[0]=i.normal.clone(),n[1]=i.normal.clone(),n[2]=i.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i<n;i++)for((r=this.faces[i]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var a=new ge;for(a.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var o=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals;for(i=0,n=this.faces.length;i<n;i++)h=new Lt,l={a:new Lt,b:new Lt,c:new Lt},o.push(h),s.push(l)}var h,l,c=this.morphNormals[t];for(a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals(),i=0,n=this.faces.length;i<n;i++)r=this.faces[i],h=c.faceNormals[i],l=c.vertexNormals[i],h.copy(r.normal),l.a.copy(r.vertexNormals[0]),l.b.copy(r.vertexNormals[1]),l.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;i<n;i++)(r=this.faces[i]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ut),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Gt),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if(t&&t.isGeometry){var n,r=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,h=t.faces,l=this.faceVertexUvs[0],c=t.faceVertexUvs[0],u=this.colors,d=t.colors;void 0===i&&(i=0),void 0!==e&&(n=(new Ct).getNormalMatrix(e));for(var p=0,f=o.length;p<f;p++){var m=o[p].clone();void 0!==e&&m.applyMatrix4(e),a.push(m)}for(p=0,f=d.length;p<f;p++)u.push(d[p].clone());for(p=0,f=h.length;p<f;p++){var g,v,y,x=h[p],b=x.vertexNormals,w=x.vertexColors;(g=new re(x.a+r,x.b+r,x.c+r)).normal.copy(x.normal),void 0!==n&&g.normal.applyMatrix3(n).normalize();for(var _=0,M=b.length;_<M;_++)v=b[_].clone(),void 0!==n&&v.applyMatrix3(n).normalize(),g.vertexNormals.push(v);for(g.color.copy(x.color),_=0,M=w.length;_<M;_++)y=w[_],g.vertexColors.push(y.clone());g.materialIndex=x.materialIndex+i,s.push(g)}for(p=0,f=c.length;p<f;p++){var S=c[p],A=[];if(void 0!==S){for(_=0,M=S.length;_<M;_++)A.push(S[_].clone());l.push(A)}}}},mergeMesh:function(t){t&&t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,i,n,r,a,o,s,h={},l=[],c=[],u=Math.pow(10,4);for(i=0,n=this.vertices.length;i<n;i++)t=this.vertices[i],void 0===h[e=Math.round(t.x*u)+"_"+Math.round(t.y*u)+"_"+Math.round(t.z*u)]?(h[e]=i,l.push(this.vertices[i]),c[i]=l.length-1):c[i]=c[h[e]];var d=[];for(i=0,n=this.faces.length;i<n;i++){(r=this.faces[i]).a=c[r.a],r.b=c[r.b],r.c=c[r.c],a=[r.a,r.b,r.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(i);break}}for(i=d.length-1;i>=0;i--){var f=d[i];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-l.length;return this.vertices=l,m},setFromPoints:function(t){this.vertices=[];for(var e=0,i=t.length;e<i;e++){var n=t[e];this.vertices.push(new Lt(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,i=0;i<e;i++)t[i]._id=i;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var n,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];for(a&&a.length===e&&(n=[]),o&&o.length===e&&(r=[]),i=0;i<e;i++){var s=t[i]._id;n&&n.push(a[s]),r&&r.push(o[s])}n&&(this.faceVertexUvs[0]=n),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}for(var n=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];n.push(a.x,a.y,a.z)}var o=[],s=[],h={},l=[],c={},u=[],d={};for(r=0;r<this.faces.length;r++){var p=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=p.normal.length()>0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var b=this.faceVertexUvs[0][r];o.push(T(b[0]),T(b[1]),T(b[2]))}if(m&&o.push(S(p.normal)),g){var w=p.vertexNormals;o.push(S(w[0]),S(w[1]),S(w[2]))}if(v&&o.push(A(p.color)),y){var _=p.vertexColors;o.push(A(_[0]),A(_[1]),A(_[2]))}}function M(t,e,i){return i?t|1<<e:t&~(1<<e)}function S(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==h[e]||(h[e]=s.length/3,s.push(t.x,t.y,t.z)),h[e]}function A(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==c[e]||(c[e]=l.length,l.push(t.getHex())),c[e]}function T(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]||(d[e]=u.length/2,u.push(t.x,t.y)),d[e]}return t.data={},t.data.vertices=n,t.data.normals=s,l.length>0&&(t.data.colors=l),u.length>0&&(t.data.uvs=[u]),t.data.faces=o,t},clone:function(){return(new ge).copy(this)},copy:function(t){var e,i,n,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,i=s.length;e<i;e++)this.vertices.push(s[e].clone());var h=t.colors;for(e=0,i=h.length;e<i;e++)this.colors.push(h[e].clone());var l=t.faces;for(e=0,i=l.length;e<i;e++)this.faces.push(l[e].clone());for(e=0,i=t.faceVertexUvs.length;e<i;e++){var c=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),n=0,r=c.length;n<r;n++){var u=c[n],d=[];for(a=0,o=u.length;a<o;a++){var p=u[a];d.push(p.clone())}this.faceVertexUvs[e].push(d)}}var f=t.morphTargets;for(e=0,i=f.length;e<i;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],n=0,r=f[e].vertices.length;n<r;n++)m.vertices.push(f[e].vertices[n].clone());if(void 0!==f[e].normals)for(m.normals=[],n=0,r=f[e].normals.length;n<r;n++)m.normals.push(f[e].normals[n].clone());this.morphTargets.push(m)}var g=t.morphNormals;for(e=0,i=g.length;e<i;e++){var v={};if(void 0!==g[e].vertexNormals)for(v.vertexNormals=[],n=0,r=g[e].vertexNormals.length;n<r;n++){var y=g[e].vertexNormals[n],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[e].faceNormals)for(v.faceNormals=[],n=0,r=g[e].faceNormals.length;n<r;n++)v.faceNormals.push(g[e].faceNormals[n].clone());this.morphNormals.push(v)}var b=t.skinWeights;for(e=0,i=b.length;e<i;e++)this.skinWeights.push(b[e].clone());var w=t.skinIndices;for(e=0,i=w.length;e<i;e++)this.skinIndices.push(w[e].clone());var _=t.lineDistances;for(e=0,i=_.length;e<i;e++)this.lineDistances.push(_[e]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var S=t.boundingSphere;return null!==S&&(this.boundingSphere=S.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(ve.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(ve.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.itemSize:0,this.array=t,this},setDynamic:function(t){return this.dynamic=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.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(a=new Qt),e[i++]=a.r,e[i++]=a.g,e[i++]=a.b}return this},copyVector2sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(a=new St),e[i++]=a.x,e[i++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(a=new Lt),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(a=new kt),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z,e[i++]=a.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),ye.prototype=Object.create(ve.prototype),ye.prototype.constructor=ye,xe.prototype=Object.create(ve.prototype),xe.prototype.constructor=xe,be.prototype=Object.create(ve.prototype),be.prototype.constructor=be,we.prototype=Object.create(ve.prototype),we.prototype.constructor=we,_e.prototype=Object.create(ve.prototype),_e.prototype.constructor=_e,Me.prototype=Object.create(ve.prototype),Me.prototype.constructor=Me,Se.prototype=Object.create(ve.prototype),Se.prototype.constructor=Se,Ae.prototype=Object.create(ve.prototype),Ae.prototype.constructor=Ae,Te.prototype=Object.create(ve.prototype),Te.prototype.constructor=Te,Object.assign(Le.prototype,{computeGroups:function(t){for(var e,i=[],n=void 0,r=t.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,i.push(e)),e={start:3*a,materialIndex:n})}void 0!==e&&(e.count=3*a-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,i=t.faces,n=t.vertices,r=t.faceVertexUvs,a=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,s=t.morphTargets,h=s.length;if(h>0){e=[];for(var l=0;l<h;l++)e[l]={name:s[l].name,data:[]};this.morphTargets.position=e}var c,u=t.morphNormals,d=u.length;if(d>0){for(c=[],l=0;l<d;l++)c[l]={name:u[l].name,data:[]};this.morphTargets.normal=c}var p=t.skinIndices,f=t.skinWeights,m=p.length===n.length,g=f.length===n.length;for(n.length>0&&i.length,l=0;l<i.length;l++){var v=i[l];this.vertices.push(n[v.a],n[v.b],n[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=v.normal;this.normals.push(x,x,x)}var b,w=v.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=v.color;this.colors.push(_,_,_)}!0===a&&(void 0!==(b=r[0][l])?this.uvs.push(b[0],b[1],b[2]):this.uvs.push(new St,new St,new St)),!0===o&&(void 0!==(b=r[1][l])?this.uvs2.push(b[0],b[1],b[2]):this.uvs2.push(new St,new St,new St));for(var M=0;M<h;M++){var S=s[M].vertices;e[M].data.push(S[v.a],S[v.b],S[v.c])}for(M=0;M<d;M++){var A=u[M].vertexNormals[l];c[M].data.push(A.a,A.b,A.c)}m&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.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,this}});var Pe=1;function Ee(){Object.defineProperty(this,"id",{value:Pe+=2}),this.uuid=Mt.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function De(t,e,i,n,r,a){ge.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Ie(t,e,i,n,r,a)),this.mergeVertices()}function Ie(t,e,i,n,r,a){Ee.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};var o=this;t=t||1,e=e||1,i=i||1,n=Math.floor(n)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var s=[],h=[],l=[],c=[],u=0,d=0;function p(t,e,i,n,r,a,p,f,m,g,v){var y,x,b=a/m,w=p/g,_=a/2,M=p/2,S=f/2,A=m+1,T=g+1,L=0,C=0,P=new Lt;for(x=0;x<T;x++){var E=x*w-M;for(y=0;y<A;y++){var D=y*b-_;P[t]=D*n,P[e]=E*r,P[i]=S,h.push(P.x,P.y,P.z),P[t]=0,P[e]=0,P[i]=f>0?1:-1,l.push(P.x,P.y,P.z),c.push(y/m),c.push(1-x/g),L+=1}}for(x=0;x<g;x++)for(y=0;y<m;y++){var I=u+y+A*x,O=u+y+A*(x+1),N=u+(y+1)+A*(x+1),k=u+(y+1)+A*x;s.push(I,O,k),s.push(O,N,k),C+=6}o.addGroup(d,C,v),d+=C,u+=L}p("z","y","x",-1,-1,i,e,t,a,r,0),p("z","y","x",1,-1,i,e,-t,a,r,1),p("x","z","y",1,1,t,i,e,n,a,2),p("x","z","y",1,-1,t,i,-e,n,a,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(s),this.addAttribute("position",new Ae(h,3)),this.addAttribute("normal",new Ae(l,3)),this.addAttribute("uv",new Ae(c,2))}function Oe(t,e,i,n){ge.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new Ne(t,e,i,n)),this.mergeVertices()}function Ne(t,e,i,n){Ee.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};var r,a,o=(t=t||1)/2,s=(e=e||1)/2,h=Math.floor(i)||1,l=Math.floor(n)||1,c=h+1,u=l+1,d=t/h,p=e/l,f=[],m=[],g=[],v=[];for(a=0;a<u;a++){var y=a*p-s;for(r=0;r<c;r++){var x=r*d-o;m.push(x,-y,0),g.push(0,0,1),v.push(r/h),v.push(1-a/l)}}for(a=0;a<l;a++)for(r=0;r<h;r++){var b=r+c*a,w=r+c*(a+1),_=r+1+c*(a+1),M=r+1+c*a;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.addAttribute("position",new Ae(m,3)),this.addAttribute("normal",new Ae(g,3)),this.addAttribute("uv",new Ae(v,2))}Ee.prototype=Object.assign(Object.create(g.prototype),{constructor:Ee,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(Ce(t)>65535?Se:_e)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(this.setIndex(e),this):(this.attributes[t]=e,this):this.addAttribute(t,new ve(arguments[1],arguments[2]))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var i=this.attributes.normal;void 0!==i&&((new Ct).getNormalMatrix(t).applyToBufferAttribute(i),i.needsUpdate=!0);var n=this.attributes.tangent;return void 0!==n&&((new Ct).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new At;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new At;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new At;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new At;return function(e,i,n){return t.makeTranslation(e,i,n),this.applyMatrix(t),this}}(),scale:function(){var t=new At;return function(e,i,n){return t.makeScale(e,i,n),this.applyMatrix(t),this}}(),lookAt:function(){var t=new de;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){var t=new Lt;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(t).negate(),this.translate(t.x,t.y,t.z),this}}(),setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var i=new Ae(3*e.vertices.length,3),n=new Ae(3*e.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new Ae(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];e.push(r.x,r.y,r.z||0)}return this.addAttribute("position",new Ae(e,3)),this},updateFromObject:function(t){var e,i=t.geometry;if(t.isMesh){var n=i.__directGeometry;if(!0===i.elementsNeedUpdate&&(n=void 0,i.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(i);n.verticesNeedUpdate=i.verticesNeedUpdate,n.normalsNeedUpdate=i.normalsNeedUpdate,n.colorsNeedUpdate=i.colorsNeedUpdate,n.uvsNeedUpdate=i.uvsNeedUpdate,n.groupsNeedUpdate=i.groupsNeedUpdate,i.verticesNeedUpdate=!1,i.normalsNeedUpdate=!1,i.colorsNeedUpdate=!1,i.uvsNeedUpdate=!1,i.groupsNeedUpdate=!1,i=n}return!0===i.verticesNeedUpdate&&(void 0!==(e=this.attributes.position)&&(e.copyVector3sArray(i.vertices),e.needsUpdate=!0),i.verticesNeedUpdate=!1),!0===i.normalsNeedUpdate&&(void 0!==(e=this.attributes.normal)&&(e.copyVector3sArray(i.normals),e.needsUpdate=!0),i.normalsNeedUpdate=!1),!0===i.colorsNeedUpdate&&(void 0!==(e=this.attributes.color)&&(e.copyColorsArray(i.colors),e.needsUpdate=!0),i.colorsNeedUpdate=!1),i.uvsNeedUpdate&&(void 0!==(e=this.attributes.uv)&&(e.copyVector2sArray(i.uvs),e.needsUpdate=!0),i.uvsNeedUpdate=!1),i.lineDistancesNeedUpdate&&(void 0!==(e=this.attributes.lineDistance)&&(e.copyArray(i.lineDistances),e.needsUpdate=!0),i.lineDistancesNeedUpdate=!1),i.groupsNeedUpdate&&(i.computeGroups(t.geometry),this.groups=i.groups,i.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Le).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new ve(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new ve(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new ve(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new ve(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new ve(a,2).copyVector2sArray(t.uvs2))}for(var o in this.groups=t.groups,t.morphTargets){for(var s=[],h=t.morphTargets[o],l=0,c=h.length;l<c;l++){var u=h[l],d=new Ae(3*u.data.length,3);d.name=u.name,s.push(d.copyVector3sArray(u.data))}this.morphAttributes[o]=s}if(t.skinIndices.length>0){var p=new Ae(4*t.skinIndices.length,4);this.addAttribute("skinIndex",p.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var f=new Ae(4*t.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ut);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)},computeBoundingSphere:function(){var t=new Ut,e=new Lt;return function(){null===this.boundingSphere&&(this.boundingSphere=new Gt);var i=this.attributes.position;if(i){var n=this.boundingSphere.center;t.setFromBufferAttribute(i),t.getCenter(n);for(var r=0,a=0,o=i.count;a<o;a++)e.x=i.getX(a),e.y=i.getY(a),e.z=i.getZ(a),r=Math.max(r,n.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new ve(new Float32Array(i.length),3));else for(var n=e.normal.array,r=0,a=n.length;r<a;r++)n[r]=0;var o,s,h,l=e.normal.array,c=new Lt,u=new Lt,d=new Lt,p=new Lt,f=new Lt;if(t){var m=t.array;for(r=0,a=t.count;r<a;r+=3)o=3*m[r+0],s=3*m[r+1],h=3*m[r+2],c.fromArray(i,o),u.fromArray(i,s),d.fromArray(i,h),p.subVectors(d,u),f.subVectors(c,u),p.cross(f),l[o]+=p.x,l[o+1]+=p.y,l[o+2]+=p.z,l[s]+=p.x,l[s+1]+=p.y,l[s+2]+=p.z,l[h]+=p.x,l[h+1]+=p.y,l[h+2]+=p.z}else for(r=0,a=i.length;r<a;r+=9)c.fromArray(i,r),u.fromArray(i,r+3),d.fromArray(i,r+6),p.subVectors(d,u),f.subVectors(c,u),p.cross(f),l[r]=p.x,l[r+1]=p.y,l[r+2]=p.z,l[r+3]=p.x,l[r+4]=p.y,l[r+5]=p.z,l[r+6]=p.x,l[r+7]=p.y,l[r+8]=p.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0);var i=this.attributes;for(var n in i)if(void 0!==t.attributes[n])for(var r=i[n].array,a=t.attributes[n],o=a.array,s=0,h=a.itemSize*e;s<o.length;s++,h++)r[h]=o[s];return this}},normalizeNormals:function(){var t=new Lt;return function(){for(var e=this.attributes.normal,i=0,n=e.count;i<n;i++)t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.normalize(),e.setXYZ(i,t.x,t.y,t.z)}}(),toNonIndexed:function(){function t(t,e){for(var i=t.array,n=t.itemSize,r=new i.constructor(e.length*n),a=0,o=0,s=0,h=e.length;s<h;s++){a=e[s]*n;for(var l=0;l<n;l++)r[o++]=i[a++]}return new ve(r,n)}if(null===this.index)return this;var e=new Ee,i=this.index.array,n=this.attributes;for(var r in n){var a=t(n[r],i);e.addAttribute(r,a)}var o=this.morphAttributes;for(r in o){for(var s=[],h=o[r],l=0,c=h.length;l<c;l++)a=t(h[l],i),s.push(a);e.morphAttributes[r]=s}for(var u=this.groups,d=(l=0,u.length);l<d;l++){var p=u[l];e.addGroup(p.start,p.count,p.materialIndex)}return e},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};var n=this.index;null!==n&&(t.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});var r=this.attributes;for(var i in r){var a={itemSize:(d=r[i]).itemSize,type:d.array.constructor.name,array:Array.prototype.slice.call(d.array),normalized:d.normalized};""!==d.name&&(a.name=d.name),t.data.attributes[i]=a}var o={},s=!1;for(var i in this.morphAttributes){for(var h=this.morphAttributes[i],l=[],c=0,u=h.length;c<u;c++){var d;a={itemSize:(d=h[c]).itemSize,type:d.array.constructor.name,array:Array.prototype.slice.call(d.array),normalized:d.normalized},""!==d.name&&(a.name=d.name),l.push(a)}l.length>0&&(o[i]=l,s=!0)}s&&(t.data.morphAttributes=o);var p=this.groups;p.length>0&&(t.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t},clone:function(){return(new Ee).copy(this)},copy:function(t){var e,i,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var a=t.attributes;for(e in a){var o=a[e];this.addAttribute(e,o.clone())}var s=t.morphAttributes;for(e in s){var h=[],l=s[e];for(i=0,n=l.length;i<n;i++)h.push(l[i].clone());this.morphAttributes[e]=h}var c=t.groups;for(i=0,n=c.length;i<n;i++){var u=c[i];this.addGroup(u.start,u.count,u.materialIndex)}var d=t.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=t.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),De.prototype=Object.create(ge.prototype),De.prototype.constructor=De,Ie.prototype=Object.create(Ee.prototype),Ie.prototype.constructor=Ie,Oe.prototype=Object.create(ge.prototype),Oe.prototype.constructor=Oe,Ne.prototype=Object.create(Ee.prototype),Ne.prototype.constructor=Ne;var ke,ze,Re,Be,Fe,Ue,Ge,je,Ve,We,He,Xe=0;function qe(){Object.defineProperty(this,"id",{value:Xe++}),this.uuid=Mt.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexTangents=!1,this.vertexColors=0,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=E,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,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.userData={},this.needsUpdate=!0}function Ye(t){qe.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==t&&(t.attributes,this.setValues(t))}function Ze(t,e){this.origin=void 0!==t?t:new Lt,this.direction=void 0!==e?e:new Lt}function Je(t,e,i){this.a=void 0!==t?t:new Lt,this.b=void 0!==e?e:new Lt,this.c=void 0!==i?i:new Lt}function Ke(t){qe.call(this),this.type="MeshBasicMaterial",this.color=new Qt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Qe(t,e){de.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Ee,this.material=void 0!==e?e:new Ke({color:16777215*Math.random()}),this.drawMode=0,this.updateMorphTargets()}function $e(t,e,i,n){var r,a,o=new Qt(0),s=0,h=null,l=0;function c(t,i){e.buffers.color.setClear(t.r,t.g,t.b,i,n)}return{getClearColor:function(){return o},setClearColor:function(t,e){o.set(t),c(o,s=void 0!==e?e:1)},getClearAlpha:function(){return s},setClearAlpha:function(t){c(o,s=t)},render:function(e,n,u,d){var p=n.background;if(null===p?(c(o,s),h=null,l=0):p&&p.isColor&&(c(p,1),d=!0,h=null,l=0),(t.autoClear||d)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),p&&(p.isCubeTexture||p.isWebGLRenderTargetCube)){void 0===a&&((a=new Qe(new Ie(1,1,1),new Ye({type:"BackgroundCubeMaterial",uniforms:Ht(ee.cube.uniforms),vertexShader:ee.cube.vertexShader,fragmentShader:ee.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),a.geometry.removeAttribute("uv"),a.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.tCube.value}}),i.update(a));var f=p.isWebGLRenderTargetCube?p.texture:p;a.material.uniforms.tCube.value=f,a.material.uniforms.tFlip.value=p.isWebGLRenderTargetCube?1:-1,h===p&&l===f.version||(a.material.needsUpdate=!0,h=p,l=f.version),e.unshift(a,a.geometry,a.material,0,0,null)}else p&&p.isTexture&&(void 0===r&&((r=new Qe(new Ne(2,2),new Ye({type:"BackgroundMaterial",uniforms:Ht(ee.background.uniforms),vertexShader:ee.background.vertexShader,fragmentShader:ee.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(r)),r.material.uniforms.t2D.value=p,!0===p.matrixAutoUpdate&&p.updateMatrix(),r.material.uniforms.uvTransform.value.copy(p.matrix),h===p&&l===p.version||(r.material.needsUpdate=!0,h=p,l=p.version),e.unshift(r,r.geometry,r.material,0,0,null))}}}function ti(t,e,i,n){var r;this.setMode=function(t){r=t},this.render=function(e,n){t.drawArrays(r,e,n),i.update(n,r)},this.renderInstances=function(a,o,s){var h;if(n.isWebGL2)h=t;else if(null===(h=e.get("ANGLE_instanced_arrays")))return;h[n.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](r,o,s,a.maxInstancedCount),i.update(s,r,a.maxInstancedCount)}}function ei(t,e,i){var n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,o=void 0!==i.precision?i.precision:"highp",s=r(o);s!==o&&(o=s);var h=!0===i.logarithmicDepthBuffer,l=t.getParameter(34930),c=t.getParameter(35660),u=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),v=c>0,y=a||!!e.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==n)return n;var i=e.get("EXT_texture_filter_anisotropic");return n=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:h,maxTextures:l,maxVertexTextures:c,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?t.getParameter(36183):0}}function ii(){var t=this,e=null,i=0,n=!1,r=!1,a=new jt,o=new Ct,s={value:null,needsUpdate:!1};function h(){s.value!==e&&(s.value=e,s.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function l(e,i,n,r){var h=null!==e?e.length:0,l=null;if(0!==h){if(l=s.value,!0!==r||null===l){var c=n+4*h,u=i.matrixWorldInverse;o.getNormalMatrix(u),(null===l||l.length<c)&&(l=new Float32Array(c));for(var d=0,p=n;d!==h;++d,p+=4)a.copy(e[d]).applyMatrix4(u,o),a.normal.toArray(l,p),l[p+3]=a.constant}s.value=l,s.needsUpdate=!0}return t.numPlanes=h,l}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(t,r,a){var o=0!==t.length||r||0!==i||n;return n=r,e=l(t,a,0),i=t.length,o},this.beginShadows=function(){r=!0,l(null)},this.endShadows=function(){r=!1,h()},this.setState=function(t,a,o,c,u,d){if(!n||null===t||0===t.length||r&&!o)r?l(null):h();else{var p=r?0:i,f=4*p,m=u.clippingState||null;s.value=m,m=l(t,c,f,d);for(var g=0;g!==f;++g)m[g]=e[g];u.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}}}function ni(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}}}function ri(t,e,i){var n={},r={};function a(t){var o=t.target,s=n[o.id];for(var h in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[h]);o.removeEventListener("dispose",a),delete n[o.id];var l=r[s.id];l&&(e.remove(l),delete r[s.id]),i.memory.geometries--}return{get:function(t,e){var r=n[e.id];return r||(e.addEventListener("dispose",a),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Ee).setFromObject(t)),r=e._bufferGeometry),n[e.id]=r,i.memory.geometries++,r)},update:function(t){var i=t.index,n=t.attributes;for(var r in null!==i&&e.update(i,34963),n)e.update(n[r],34962);var a=t.morphAttributes;for(var r in a)for(var o=a[r],s=0,h=o.length;s<h;s++)e.update(o[s],34962)},getWireframeAttribute:function(t){var i=r[t.id];if(i)return i;var n,a=[],o=t.index,s=t.attributes;if(null!==o)for(var h=0,l=(n=o.array).length;h<l;h+=3){var c=n[h+0],u=n[h+1],d=n[h+2];a.push(c,u,u,d,d,c)}else for(h=0,l=(n=s.position.array).length/3-1;h<l;h+=3)c=h+0,u=h+1,d=h+2,a.push(c,u,u,d,d,c);return i=new(Ce(a)>65535?Se:_e)(a,1),e.update(i,34963),r[t.id]=i,i}}}function ai(t,e,i,n){var r,a,o;this.setMode=function(t){r=t},this.setIndex=function(t){a=t.type,o=t.bytesPerElement},this.render=function(e,n){t.drawElements(r,n,a,e*o),i.update(n,r)},this.renderInstances=function(s,h,l){var c;if(n.isWebGL2)c=t;else if(null===(c=e.get("ANGLE_instanced_arrays")))return;c[n.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](r,l,a,h*o,s.maxInstancedCount),i.update(l,r,s.maxInstancedCount)}}function oi(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(n=n||1,e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 5:case 6:e.triangles+=n*(t-2);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t}}}}function si(t,e){return Math.abs(e[1])-Math.abs(t[1])}function hi(t){var e={},i=new Float32Array(8);return{update:function(n,r,a,o){var s=n.morphTargetInfluences,h=s.length,l=e[r.id];if(void 0===l){l=[];for(var c=0;c<h;c++)l[c]=[c,0];e[r.id]=l}var u=a.morphTargets&&r.morphAttributes.position,d=a.morphNormals&&r.morphAttributes.normal;for(c=0;c<h;c++)0!==(p=l[c])[1]&&(u&&r.removeAttribute("morphTarget"+c),d&&r.removeAttribute("morphNormal"+c));for(c=0;c<h;c++)(p=l[c])[0]=c,p[1]=s[c];for(l.sort(si),c=0;c<8;c++){var p;if(p=l[c]){var f=p[0],m=p[1];if(m){u&&r.addAttribute("morphTarget"+c,u[f]),d&&r.addAttribute("morphNormal"+c,d[f]),i[c]=m;continue}}i[c]=0}o.getUniforms().setValue(t,"morphTargetInfluences",i)}}}function li(t,e){var i={};return{update:function(n){var r=e.render.frame,a=n.geometry,o=t.get(n,a);return i[o.id]!==r&&(a.isGeometry&&o.updateFromObject(n),t.update(o),i[o.id]=r),o},dispose:function(){i={}}}}function ci(t,e,i,n,r,a,o,s,h,l){t=void 0!==t?t:[],e=void 0!==e?e:N,o=void 0!==o?o:tt,Nt.call(this,t,e,i,n,r,a,o,s,h,l),this.flipY=!1}function ui(t,e,i,n){Nt.call(this,null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=j,this.minFilter=j,this.wrapR=U,this.generateMipmaps=!1,this.flipY=!1}qe.prototype=Object.assign(Object.create(g.prototype),{constructor:qe,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var i=t[e];if(void 0!==i)if("shading"!==e){var n=this[e];void 0!==n&&(n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i)}else this.flatShading=1===i}},toJSON:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearCoat&&(i.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(i.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity,void 0!==this.combine&&(i.combine=this.combine),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),!0===this.flatShading&&(i.flatShading=this.flatShading),0!==this.side&&(i.side=this.side),0!==this.vertexColors&&(i.vertexColors=this.vertexColors),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){var r=n(t.textures),a=n(t.images);r.length>0&&(i.textures=r),a.length>0&&(i.images=a)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,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.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.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ye.prototype=Object.create(qe.prototype),Ye.prototype.constructor=Ye,Ye.prototype.isShaderMaterial=!0,Ye.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ht(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},Ye.prototype.toJSON=function(t){var e=qe.prototype.toJSON.call(this,t);for(var i in e.uniforms={},this.uniforms){var n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return Object.keys(r).length>0&&(e.extensions=r),e},Object.assign(Ze.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(e=new Lt),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new Lt;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){void 0===e&&(e=new Lt),e.subVectors(t,this.origin);var i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new Lt;return function(e){var i=t.subVectors(e,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(i).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:(ke=new Lt,ze=new Lt,Re=new Lt,function(t,e,i,n){ke.copy(t).add(e).multiplyScalar(.5),ze.copy(e).sub(t).normalize(),Re.copy(this.origin).sub(ke);var r,a,o,s,h=.5*t.distanceTo(e),l=-this.direction.dot(ze),c=Re.dot(this.direction),u=-Re.dot(ze),d=Re.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(a=l*c-u,s=h*p,(r=l*u-c)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(r*=f)*(r+l*(a*=f)+2*c)+a*(l*r+a+2*u)+d}else a=h,o=-(r=Math.max(0,-(l*a+c)))*r+a*(a+2*u)+d;else a=-h,o=-(r=Math.max(0,-(l*a+c)))*r+a*(a+2*u)+d;else a<=-s?o=-(r=Math.max(0,-(-l*h+c)))*r+(a=r>0?-h:Math.min(Math.max(-h,-u),h))*(a+2*u)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-h,-u),h))*(a+2*u)+d):o=-(r=Math.max(0,-(l*h+c)))*r+(a=r>0?h:Math.min(Math.max(-h,-u),h))*(a+2*u)+d;else a=l>0?-h:h,o=-(r=Math.max(0,-(l*a+c)))*r+a*(a+2*u)+d;return i&&i.copy(this.direction).multiplyScalar(r).add(this.origin),n&&n.copy(ze).multiplyScalar(a).add(ke),o}),intersectSphere:function(){var t=new Lt;return function(e,i){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),r=t.dot(t)-n*n,a=e.radius*e.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=n-o,h=n+o;return s<0&&h<0?null:s<0?this.at(h,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var i,n,r,a,o,s,h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(i=(t.min.x-u.x)*h,n=(t.max.x-u.x)*h):(i=(t.max.x-u.x)*h,n=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,a=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,a=(t.min.y-u.y)*l),i>a||r>n?null:((r>i||i!=i)&&(i=r),(a<n||n!=n)&&(n=a),c>=0?(o=(t.min.z-u.z)*c,s=(t.max.z-u.z)*c):(o=(t.max.z-u.z)*c,s=(t.min.z-u.z)*c),i>s||o>n?null:((o>i||i!=i)&&(i=o),(s<n||n!=n)&&(n=s),n<0?null:this.at(i>=0?i:n,e)))},intersectsBox:function(){var t=new Lt;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new Lt,e=new Lt,i=new Lt,n=new Lt;return function(r,a,o,s,h){e.subVectors(a,r),i.subVectors(o,r),n.crossVectors(e,i);var l,c=this.direction.dot(n);if(c>0){if(s)return null;l=1}else{if(!(c<0))return null;l=-1,c=-c}t.subVectors(this.origin,r);var u=l*this.direction.dot(i.crossVectors(t,i));if(u<0)return null;var d=l*this.direction.dot(e.cross(t));if(d<0)return null;if(u+d>c)return null;var p=-l*t.dot(n);return p<0?null:this.at(p/c,h)}}(),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(Je,{getNormal:(Fe=new Lt,function(t,e,i,n){void 0===n&&(n=new Lt),n.subVectors(i,e),Fe.subVectors(t,e),n.cross(Fe);var r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}),getBarycoord:function(){var t=new Lt,e=new Lt,i=new Lt;return function(n,r,a,o,s){t.subVectors(o,r),e.subVectors(a,r),i.subVectors(n,r);var h=t.dot(t),l=t.dot(e),c=t.dot(i),u=e.dot(e),d=e.dot(i),p=h*u-l*l;if(void 0===s&&(s=new Lt),0===p)return s.set(-2,-1,-1);var f=1/p,m=(u*c-l*d)*f,g=(h*d-l*c)*f;return s.set(1-m-g,g,m)}}(),containsPoint:function(){var t=new Lt;return function(e,i,n,r){return Je.getBarycoord(e,i,n,r,t),t.x>=0&&t.y>=0&&t.x+t.y<=1}}(),getUV:(Be=new Lt,function(t,e,i,n,r,a,o,s){return this.getBarycoord(t,e,i,n,Be),s.set(0,0),s.addScaledVector(r,Be.x),s.addScaledVector(a,Be.y),s.addScaledVector(o,Be.z),s})}),Object.assign(Je.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){var t=new Lt,e=new Lt;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),getMidpoint:function(t){return void 0===t&&(t=new Lt),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return Je.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(t=new Lt),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return Je.getBarycoord(t,this.a,this.b,this.c,e)},containsPoint:function(t){return Je.containsPoint(t,this.a,this.b,this.c)},getUV:function(t,e,i,n,r){return Je.getUV(t,this.a,this.b,this.c,e,i,n,r)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:(Ue=new Lt,Ge=new Lt,je=new Lt,Ve=new Lt,We=new Lt,He=new Lt,function(t,e){void 0===e&&(e=new Lt);var i,n,r=this.a,a=this.b,o=this.c;Ue.subVectors(a,r),Ge.subVectors(o,r),Ve.subVectors(t,r);var s=Ue.dot(Ve),h=Ge.dot(Ve);if(s<=0&&h<=0)return e.copy(r);We.subVectors(t,a);var l=Ue.dot(We),c=Ge.dot(We);if(l>=0&&c<=l)return e.copy(a);var u=s*c-l*h;if(u<=0&&s>=0&&l<=0)return i=s/(s-l),e.copy(r).addScaledVector(Ue,i);He.subVectors(t,o);var d=Ue.dot(He),p=Ge.dot(He);if(p>=0&&d<=p)return e.copy(o);var f=d*h-s*p;if(f<=0&&h>=0&&p<=0)return n=h/(h-p),e.copy(r).addScaledVector(Ge,n);var m=l*p-d*c;if(m<=0&&c-l>=0&&d-p>=0)return je.subVectors(o,a),n=(c-l)/(c-l+(d-p)),e.copy(a).addScaledVector(je,n);var g=1/(m+f+u);return i=f*g,n=u*g,e.copy(r).addScaledVector(Ue,i).addScaledVector(Ge,n)}),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Ke.prototype=Object.create(qe.prototype),Ke.prototype.constructor=Ke,Ke.prototype.isMeshBasicMaterial=!0,Ke.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Qe.prototype=Object.assign(Object.create(de.prototype),{constructor:Qe,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return de.prototype.copy.call(this,t),this.drawMode=t.drawMode,void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t,e,i,n=this.geometry;if(n.isBufferGeometry){var r=n.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t<e;t++)i=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}else{var s=n.morphTargets;void 0!==s&&s.length}},raycast:function(){var t=new At,e=new Ze,i=new Gt,n=new Lt,r=new Lt,a=new Lt,o=new Lt,s=new Lt,h=new Lt,l=new St,c=new St,u=new St,d=new Lt,p=new Lt;function f(t,e,i,n,r,a,o,s){if(null===(1===e.side?n.intersectTriangle(o,a,r,!0,s):n.intersectTriangle(r,a,o,2!==e.side,s)))return null;p.copy(s),p.applyMatrix4(t.matrixWorld);var h=i.ray.origin.distanceTo(p);return h<i.near||h>i.far?null:{distance:h,point:p.clone(),object:t}}function m(t,e,i,o,s,h,p,m,g){n.fromBufferAttribute(s,p),r.fromBufferAttribute(s,m),a.fromBufferAttribute(s,g);var v=f(t,e,i,o,n,r,a,d);if(v){h&&(l.fromBufferAttribute(h,p),c.fromBufferAttribute(h,m),u.fromBufferAttribute(h,g),v.uv=Je.getUV(d,n,r,a,l,c,u,new St));var y=new re(p,m,g);Je.getNormal(n,r,a,y.normal),v.face=y}return v}return function(p,g){var v,y=this.geometry,x=this.material,b=this.matrixWorld;if(void 0!==x&&(null===y.boundingSphere&&y.computeBoundingSphere(),i.copy(y.boundingSphere),i.applyMatrix4(b),!1!==p.ray.intersectsSphere(i)&&(t.getInverse(b),e.copy(p.ray).applyMatrix4(t),null===y.boundingBox||!1!==e.intersectsBox(y.boundingBox))))if(y.isBufferGeometry){var w,_,M,S,A,T,L,C,P,E=y.index,D=y.attributes.position,I=y.attributes.uv,O=y.groups,N=y.drawRange;if(null!==E)if(Array.isArray(x))for(S=0,T=O.length;S<T;S++)for(P=x[(C=O[S]).materialIndex],A=Math.max(C.start,N.start),L=Math.min(C.start+C.count,N.start+N.count);A<L;A+=3)w=E.getX(A),_=E.getX(A+1),M=E.getX(A+2),(v=m(this,P,p,e,D,I,w,_,M))&&(v.faceIndex=Math.floor(A/3),v.face.materialIndex=C.materialIndex,g.push(v));else for(S=Math.max(0,N.start),T=Math.min(E.count,N.start+N.count);S<T;S+=3)w=E.getX(S),_=E.getX(S+1),M=E.getX(S+2),(v=m(this,x,p,e,D,I,w,_,M))&&(v.faceIndex=Math.floor(S/3),g.push(v));else if(void 0!==D)if(Array.isArray(x))for(S=0,T=O.length;S<T;S++)for(P=x[(C=O[S]).materialIndex],A=Math.max(C.start,N.start),L=Math.min(C.start+C.count,N.start+N.count);A<L;A+=3)(v=m(this,P,p,e,D,I,w=A,_=A+1,M=A+2))&&(v.faceIndex=Math.floor(A/3),v.face.materialIndex=C.materialIndex,g.push(v));else for(S=Math.max(0,N.start),T=Math.min(D.count,N.start+N.count);S<T;S+=3)(v=m(this,x,p,e,D,I,w=S,_=S+1,M=S+2))&&(v.faceIndex=Math.floor(S/3),g.push(v))}else if(y.isGeometry){var k,z,R,B,F=Array.isArray(x),U=y.vertices,G=y.faces,j=y.faceVertexUvs[0];j.length>0&&(B=j);for(var V=0,W=G.length;V<W;V++){var H=G[V],X=F?x[H.materialIndex]:x;if(void 0!==X){if(k=U[H.a],z=U[H.b],R=U[H.c],!0===X.morphTargets){var q=y.morphTargets,Y=this.morphTargetInfluences;n.set(0,0,0),r.set(0,0,0),a.set(0,0,0);for(var Z=0,J=q.length;Z<J;Z++){var K=Y[Z];if(0!==K){var Q=q[Z].vertices;n.addScaledVector(o.subVectors(Q[H.a],k),K),r.addScaledVector(s.subVectors(Q[H.b],z),K),a.addScaledVector(h.subVectors(Q[H.c],R),K)}}n.add(k),r.add(z),a.add(R),k=n,z=r,R=a}if(v=f(this,X,p,e,k,z,R,d)){if(B&&B[V]){var $=B[V];l.copy($[0]),c.copy($[1]),u.copy($[2]),v.uv=Je.getUV(d,k,z,R,l,c,u,new St)}v.face=H,v.faceIndex=V,g.push(v)}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ci.prototype=Object.create(Nt.prototype),ci.prototype.constructor=ci,ci.prototype.isCubeTexture=!0,Object.defineProperty(ci.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),ui.prototype=Object.create(Nt.prototype),ui.prototype.constructor=ui,ui.prototype.isDataTexture3D=!0;var di=new Nt,pi=new ui,fi=new ci;function mi(){this.seq=[],this.map={}}var gi=[],vi=[],yi=new Float32Array(16),xi=new Float32Array(9),bi=new Float32Array(4);function wi(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,a=gi[r];if(void 0===a&&(a=new Float32Array(r),gi[r]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=i,t[o].toArray(a,s)}return a}function _i(t,e){if(t.length!==e.length)return!1;for(var i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Mi(t,e){for(var i=0,n=e.length;i<n;i++)t[i]=e[i]}function Si(t,e){var i=vi[e];void 0===i&&(i=new Int32Array(e),vi[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function Ai(t,e){var i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Ti(t,e){var i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Li(t,e){var i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(_i(i,e))return;t.uniform2fv(this.addr,e),Mi(i,e)}}function Ci(t,e){var i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(_i(i,e))return;t.uniform3fv(this.addr,e),Mi(i,e)}}function Pi(t,e){var i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(_i(i,e))return;t.uniform4fv(this.addr,e),Mi(i,e)}}function Ei(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(_i(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Mi(i,e)}else{if(_i(i,n))return;bi.set(n),t.uniformMatrix2fv(this.addr,!1,bi),Mi(i,n)}}function Di(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(_i(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Mi(i,e)}else{if(_i(i,n))return;xi.set(n),t.uniformMatrix3fv(this.addr,!1,xi),Mi(i,n)}}function Ii(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(_i(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Mi(i,e)}else{if(_i(i,n))return;yi.set(n),t.uniformMatrix4fv(this.addr,!1,yi),Mi(i,n)}}function Oi(t,e,i){var n=this.cache,r=i.allocTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2D(e||di,r)}function Ni(t,e,i){var n=this.cache,r=i.allocTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||pi,r)}function ki(t,e,i){var n=this.cache,r=i.allocTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(e||fi,r)}function zi(t,e){var i=this.cache;_i(i,e)||(t.uniform2iv(this.addr,e),Mi(i,e))}function Ri(t,e){var i=this.cache;_i(i,e)||(t.uniform3iv(this.addr,e),Mi(i,e))}function Bi(t,e){var i=this.cache;_i(i,e)||(t.uniform4iv(this.addr,e),Mi(i,e))}function Fi(t,e){var i=this.cache;_i(i,e)||(t.uniform1fv(this.addr,e),Mi(i,e))}function Ui(t,e){var i=this.cache;_i(i,e)||(t.uniform1iv(this.addr,e),Mi(i,e))}function Gi(t,e){var i=this.cache,n=wi(e,this.size,2);_i(i,n)||(t.uniform2fv(this.addr,n),this.updateCache(n))}function ji(t,e){var i=this.cache,n=wi(e,this.size,3);_i(i,n)||(t.uniform3fv(this.addr,n),this.updateCache(n))}function Vi(t,e){var i=this.cache,n=wi(e,this.size,4);_i(i,n)||(t.uniform4fv(this.addr,n),this.updateCache(n))}function Wi(t,e){var i=this.cache,n=wi(e,this.size,4);_i(i,n)||(t.uniformMatrix2fv(this.addr,!1,n),this.updateCache(n))}function Hi(t,e){var i=this.cache,n=wi(e,this.size,9);_i(i,n)||(t.uniformMatrix3fv(this.addr,!1,n),this.updateCache(n))}function Xi(t,e){var i=this.cache,n=wi(e,this.size,16);_i(i,n)||(t.uniformMatrix4fv(this.addr,!1,n),this.updateCache(n))}function qi(t,e,i){var n=this.cache,r=e.length,a=Si(i,r);!1===_i(n,a)&&(t.uniform1iv(this.addr,a),Mi(n,a));for(var o=0;o!==r;++o)i.setTexture2D(e[o]||di,a[o])}function Yi(t,e,i){var n=this.cache,r=e.length,a=Si(i,r);!1===_i(n,a)&&(t.uniform1iv(this.addr,a),Mi(n,a));for(var o=0;o!==r;++o)i.setTextureCube(e[o]||fi,a[o])}function Zi(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Ai;case 35664:return Li;case 35665:return Ci;case 35666:return Pi;case 35674:return Ei;case 35675:return Di;case 35676:return Ii;case 35678:case 36198:return Oi;case 35679:return Ni;case 35680:return ki;case 5124:case 35670:return Ti;case 35667:case 35671:return zi;case 35668:case 35672:return Ri;case 35669:case 35673:return Bi}}(e.type)}function Ji(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Fi;case 35664:return Gi;case 35665:return ji;case 35666:return Vi;case 35674:return Wi;case 35675:return Hi;case 35676:return Xi;case 35678:return qi;case 35680:return Yi;case 5124:case 35670:return Ui;case 35667:case 35671:return zi;case 35668:case 35672:return Ri;case 35669:case 35673:return Bi}}(e.type)}function Ki(t){this.id=t,mi.call(this)}Ji.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Mi(e,t)},Ki.prototype.setValue=function(t,e,i){for(var n=this.seq,r=0,a=n.length;r!==a;++r){var o=n[r];o.setValue(t,e[o.id],i)}};var Qi=/([\w\d_]+)(\])?(\[|\.)?/g;function $i(t,e){t.seq.push(e),t.map[e.id]=e}function tn(t,e,i){var n=t.name,r=n.length;for(Qi.lastIndex=0;;){var a=Qi.exec(n),o=Qi.lastIndex,s=a[1],h="]"===a[2],l=a[3];if(h&&(s|=0),void 0===l||"["===l&&o+2===r){$i(i,void 0===l?new Zi(s,t,e):new Ji(s,t,e));break}var c=i.map[s];void 0===c&&$i(i,c=new Ki(s)),i=c}}function en(t,e,i){mi.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,35718),r=0;r<n;++r){var a=t.getActiveUniform(e,r);tn(a,t.getUniformLocation(e,a.name),this)}}function nn(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,35713),t.getShaderInfoLog(n),n}en.prototype.setValue=function(t,e,i){var n=this.map[e];void 0!==n&&n.setValue(t,i,this.renderer)},en.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},en.upload=function(t,e,i,n){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=i[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,n)}},en.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var a=t[n];a.id in e&&i.push(a)}return i};var rn=0;function an(t){switch(t){case xt:return["Linear","( value )"];case bt:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case wt:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function on(t,e){var i=an(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function sn(t,e){var i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="Uncharted2";break;case 4:i="OptimizedCineon";break;case 5:i="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function hn(t){return""!==t}function ln(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function cn(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function un(t){return t.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(t,e){var i=Wt[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return un(i)})}function dn(t){return t.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,i,n){for(var r="",a=parseInt(e);a<parseInt(i);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]");return r})}function pn(t,e,i,n,r,a,o){var s=t.context,h=n.defines,l=r.vertexShader,c=r.fragmentShader,u="SHADOWMAP_TYPE_BASIC";1===a.shadowMapType?u="SHADOWMAP_TYPE_PCF":2===a.shadowMapType&&(u="SHADOWMAP_TYPE_PCF_SOFT");var d="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",f="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(n.envMap.mapping){case N:case k:d="ENVMAP_TYPE_CUBE";break;case R:case B:d="ENVMAP_TYPE_CUBE_UV";break;case 303:case z:d="ENVMAP_TYPE_EQUIREC";break;case 305:d="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case k:case z:p="ENVMAP_MODE_REFRACTION"}switch(n.combine){case 0:f="ENVMAP_BLENDING_MULTIPLY";break;case 1:f="ENVMAP_BLENDING_MIX";break;case 2:f="ENVMAP_BLENDING_ADD"}}var m,g,v,y,x,b=t.gammaFactor>0?t.gammaFactor:1,w=o.isWebGL2?"":function(t,e,i){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap&&!e.objectSpaceNormalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(hn).join("\n")}(n.extensions,a,e),_=function(t){var e=[];for(var i in t){var n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(h),M=s.createProgram();if(n.isRawShaderMaterial?((m=[_].filter(hn).join("\n")).length>0&&(m+="\n"),(g=[w,_].filter(hn).join("\n")).length>0&&(g+="\n")):(m=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,_,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+b,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+p:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(hn).join("\n"),g=[w,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,_,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+b,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.envMap?"#define "+p:"",a.envMap?"#define "+f:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||e.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==a.toneMapping?"#define TONE_MAPPING":"",0!==a.toneMapping?Wt.tonemapping_pars_fragment:"",0!==a.toneMapping?sn("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Wt.encodings_pars_fragment:"",a.mapEncoding?on("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?on("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?on("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?on("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(v="linearToOutputTexel",y=a.outputEncoding,x=an(y),"vec4 "+v+"( vec4 value ) { return LinearTo"+x[0]+x[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(hn).join("\n")),l=cn(l=ln(l=un(l),a),a),c=cn(c=ln(c=un(c),a),a),l=dn(l),c=dn(c),o.isWebGL2&&!n.isRawShaderMaterial){var S=!1,A=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==l.match(A)&&null!==c.match(A)&&(S=!0,l=l.replace(A,""),c=c.replace(A,"")),m=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,g=["#version 300 es\n","#define varying in",S?"":"out highp vec4 pc_fragColor;",S?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+g}var T=g+c,L=nn(s,35633,m+l),C=nn(s,35632,T);s.attachShader(M,L),s.attachShader(M,C),void 0!==n.index0AttributeName?s.bindAttribLocation(M,0,n.index0AttributeName):!0===a.morphTargets&&s.bindAttribLocation(M,0,"position"),s.linkProgram(M);var P,E,D=s.getProgramInfoLog(M).trim(),I=s.getShaderInfoLog(L).trim(),O=s.getShaderInfoLog(C).trim(),F=!0,U=!0;return!1===s.getProgramParameter(M,35714)?F=!1:""!==D||""!==I&&""!==O||(U=!1),U&&(this.diagnostics={runnable:F,material:n,programLog:D,vertexShader:{log:I,prefix:m},fragmentShader:{log:O,prefix:g}}),s.deleteShader(L),s.deleteShader(C),this.getUniforms=function(){return void 0===P&&(P=new en(s,M,t)),P},this.getAttributes=function(){return void 0===E&&(E=function(t,e){for(var i={},n=t.getProgramParameter(e,35721),r=0;r<n;r++){var a=t.getActiveAttrib(e,r).name;i[a]=t.getAttribLocation(e,a)}return i}(s,M)),E},this.destroy=function(){s.deleteProgram(M),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return this.getUniforms()}},attributes:{get:function(){return this.getAttributes()}}}),this.name=r.name,this.id=rn++,this.code=i,this.usedTimes=1,this.program=M,this.vertexShader=L,this.fragmentShader=C,this}function fn(t,e,i){var n=[],r={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},a=["precision","supportsVertexTextures","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function o(t,e){var i;return t?t.isTexture?i=t.encoding:t.isWebGLRenderTarget&&(i=t.texture.encoding):i=xt,i===xt&&e&&(i=wt),i}this.getParameters=function(e,n,a,s,h,l,c){var u=r[e.type],d=c.isSkinnedMesh?function(t){var e=t.skeleton.bones;if(i.floatVertexTextures)return 1024;var n=i.maxVertexUniforms,r=Math.floor((n-20)/4),a=Math.min(r,e.length);return a<e.length?0:a}(c):0,p=i.precision;null!==e.precision&&(p=i.getMaxPrecision(e.precision),e.precision);var f=t.getRenderTarget();return{shaderID:u,precision:p,supportsVertexTextures:i.vertexTextures,outputEncoding:o(f?f.texture:null,t.gammaOutput),map:!!e.map,mapEncoding:o(e.map,t.gammaInput),matcap:!!e.matcap,matcapEncoding:o(e.matcap,t.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:o(e.envMap,t.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===R||e.envMap.mapping===B),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:o(e.emissiveMap,t.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:1===e.normalMapType,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,combine:e.combine,vertexTangents:e.normalMap&&e.vertexTangents,vertexColors:e.vertexColors,fog:!!s,useFog:e.fog,fogExp:s&&s.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:i.logarithmicDepthBuffer,skinning:e.skinning&&d>0,maxBones:d,useVertexTexture:i.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:n.directional.length,numPointLights:n.point.length,numSpotLights:n.spot.length,numRectAreaLights:n.rectArea.length,numHemiLights:n.hemi.length,numClippingPlanes:h,numClipIntersection:l,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.receiveShadow&&a.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:2===e.side,flipSided:1===e.side,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,i){var n=[];if(i.shaderID?n.push(i.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);for(var o=0;o<a.length;o++)n.push(i[a[o]]);return n.push(e.onBeforeCompile.toString()),n.push(t.gammaOutput),n.push(t.gammaFactor),n.join()},this.acquireProgram=function(r,a,o,s){for(var h,l=0,c=n.length;l<c;l++){var u=n[l];if(u.code===s){++(h=u).usedTimes;break}}return void 0===h&&(h=new pn(t,e,s,r,a,o,i),n.push(h)),h},this.releaseProgram=function(t){if(0===--t.usedTimes){var e=n.indexOf(t);n[e]=n[n.length-1],n.pop(),t.destroy()}},this.programs=n}function mn(){var t=new WeakMap;return{get:function(e){var i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function gn(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function vn(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function yn(){var t=[],e=0,i=[],n=[];function r(i,n,r,a,o,s){var h=t[e];return void 0===h?(h={id:i.id,object:i,geometry:n,material:r,program:r.program,groupOrder:a,renderOrder:i.renderOrder,z:o,group:s},t[e]=h):(h.id=i.id,h.object=i,h.geometry=n,h.material=r,h.program=r.program,h.groupOrder=a,h.renderOrder=i.renderOrder,h.z=o,h.group=s),e++,h}return{opaque:i,transparent:n,init:function(){e=0,i.length=0,n.length=0},push:function(t,e,a,o,s,h){var l=r(t,e,a,o,s,h);(!0===a.transparent?n:i).push(l)},unshift:function(t,e,a,o,s,h){var l=r(t,e,a,o,s,h);(!0===a.transparent?n:i).unshift(l)},cleanup:function(){for(var i=e,n=t.length;i<n;i++){var r=t[i];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.program=null,r.group=null}},sort:function(){i.length>1&&i.sort(gn),n.length>1&&n.sort(vn)}}}function xn(){var t={};function e(i){var n=i.target;n.removeEventListener("dispose",e),delete t[n.id]}return{get:function(i,n){var r,a=t[i.id];return void 0===a?(r=new yn,t[i.id]={},t[i.id][n.id]=r,i.addEventListener("dispose",e)):void 0===(r=a[n.id])&&(r=new yn,a[n.id]=r),r},dispose:function(){t={}}}}function bn(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new Lt,color:new Qt,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"SpotLight":i={position:new Lt,direction:new Lt,color:new Qt,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"PointLight":i={position:new Lt,color:new Qt,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":i={direction:new Lt,skyColor:new Qt,groundColor:new Qt};break;case"RectAreaLight":i={color:new Qt,position:new Lt,halfWidth:new Lt,halfHeight:new Lt}}return t[e.id]=i,i}}}var wn=0;function _n(){var t=new bn,e={id:wn++,hash:{stateID:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},i=new Lt,n=new At,r=new At;return{setup:function(a,o,s){for(var h=0,l=0,c=0,u=0,d=0,p=0,f=0,m=0,g=s.matrixWorldInverse,v=0,y=a.length;v<y;v++){var x=a[v],b=x.color,w=x.intensity,_=x.distance,M=x.shadow&&x.shadow.map?x.shadow.map.texture:null;if(x.isAmbientLight)h+=b.r*w,l+=b.g*w,c+=b.b*w;else if(x.isDirectionalLight){if((A=t.get(x)).color.copy(x.color).multiplyScalar(x.intensity),A.direction.setFromMatrixPosition(x.matrixWorld),i.setFromMatrixPosition(x.target.matrixWorld),A.direction.sub(i),A.direction.transformDirection(g),A.shadow=x.castShadow,x.castShadow){var S=x.shadow;A.shadowBias=S.bias,A.shadowRadius=S.radius,A.shadowMapSize=S.mapSize}e.directionalShadowMap[u]=M,e.directionalShadowMatrix[u]=x.shadow.matrix,e.directional[u]=A,u++}else if(x.isSpotLight)(A=t.get(x)).position.setFromMatrixPosition(x.matrixWorld),A.position.applyMatrix4(g),A.color.copy(b).multiplyScalar(w),A.distance=_,A.direction.setFromMatrixPosition(x.matrixWorld),i.setFromMatrixPosition(x.target.matrixWorld),A.direction.sub(i),A.direction.transformDirection(g),A.coneCos=Math.cos(x.angle),A.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),A.decay=x.decay,A.shadow=x.castShadow,x.castShadow&&(S=x.shadow,A.shadowBias=S.bias,A.shadowRadius=S.radius,A.shadowMapSize=S.mapSize),e.spotShadowMap[p]=M,e.spotShadowMatrix[p]=x.shadow.matrix,e.spot[p]=A,p++;else if(x.isRectAreaLight)(A=t.get(x)).color.copy(b).multiplyScalar(w),A.position.setFromMatrixPosition(x.matrixWorld),A.position.applyMatrix4(g),r.identity(),n.copy(x.matrixWorld),n.premultiply(g),r.extractRotation(n),A.halfWidth.set(.5*x.width,0,0),A.halfHeight.set(0,.5*x.height,0),A.halfWidth.applyMatrix4(r),A.halfHeight.applyMatrix4(r),e.rectArea[f]=A,f++;else if(x.isPointLight)(A=t.get(x)).position.setFromMatrixPosition(x.matrixWorld),A.position.applyMatrix4(g),A.color.copy(x.color).multiplyScalar(x.intensity),A.distance=x.distance,A.decay=x.decay,A.shadow=x.castShadow,x.castShadow&&(S=x.shadow,A.shadowBias=S.bias,A.shadowRadius=S.radius,A.shadowMapSize=S.mapSize,A.shadowCameraNear=S.camera.near,A.shadowCameraFar=S.camera.far),e.pointShadowMap[d]=M,e.pointShadowMatrix[d]=x.shadow.matrix,e.point[d]=A,d++;else if(x.isHemisphereLight){var A;(A=t.get(x)).direction.setFromMatrixPosition(x.matrixWorld),A.direction.transformDirection(g),A.direction.normalize(),A.skyColor.copy(x.color).multiplyScalar(w),A.groundColor.copy(x.groundColor).multiplyScalar(w),e.hemi[m]=A,m++}}e.ambient[0]=h,e.ambient[1]=l,e.ambient[2]=c,e.directional.length=u,e.spot.length=p,e.rectArea.length=f,e.point.length=d,e.hemi.length=m,e.hash.stateID=e.id,e.hash.directionalLength=u,e.hash.pointLength=d,e.hash.spotLength=p,e.hash.rectAreaLength=f,e.hash.hemiLength=m,e.hash.shadowsLength=o.length},state:e}}function Mn(){var t=new _n,e=[],i=[];return{init:function(){e.length=0,i.length=0},state:{lightsArray:e,shadowsArray:i,lights:t},setupLights:function(n){t.setup(e,i,n)},pushLight:function(t){e.push(t)},pushShadow:function(t){i.push(t)}}}function Sn(){var t={};function e(i){var n=i.target;n.removeEventListener("dispose",e),delete t[n.id]}return{get:function(i,n){var r;return void 0===t[i.id]?(r=new Mn,t[i.id]={},t[i.id][n.id]=r,i.addEventListener("dispose",e)):void 0===t[i.id][n.id]?(r=new Mn,t[i.id][n.id]=r):r=t[i.id][n.id],r},dispose:function(){t={}}}}function An(t){qe.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function Tn(t){qe.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Lt,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Ln(t,e,i){for(var n=new Vt,r=new At,a=new St,o=new St(i,i),s=new Lt,h=new Lt,l=new Array(4),c=new Array(4),u={},d={0:1,1:0,2:2},p=[new Lt(1,0,0),new Lt(-1,0,0),new Lt(0,0,1),new Lt(0,0,-1),new Lt(0,1,0),new Lt(0,-1,0)],f=[new Lt(0,1,0),new Lt(0,1,0),new Lt(0,1,0),new Lt(0,1,0),new Lt(0,0,1),new Lt(0,0,-1)],m=[new kt,new kt,new kt,new kt,new kt,new kt],g=0;4!==g;++g){var v=!!(1&g),y=!!(2&g),x=new An({depthPacking:_t,morphTargets:v,skinning:y});l[g]=x;var b=new Tn({morphTargets:v,skinning:y});c[g]=b}var w=this;function _(e,i,n,r,a,o){var s=e.geometry,h=null,p=l,f=e.customDepthMaterial;if(n&&(p=c,f=e.customDistanceMaterial),f)h=f;else{var m=!1;i.morphTargets&&(s&&s.isBufferGeometry?m=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:s&&s.isGeometry&&(m=s.morphTargets&&s.morphTargets.length>0)),e.isSkinnedMesh&&i.skinning;var g=0;m&&(g|=1),e.isSkinnedMesh&&i.skinning&&(g|=2),h=p[g]}if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var v=h.uuid,y=i.uuid,x=u[v];void 0===x&&(x={},u[v]=x);var b=x[y];void 0===b&&(b=h.clone(),x[y]=b),h=b}return h.visible=i.visible,h.wireframe=i.wireframe,h.side=null!=i.shadowSide?i.shadowSide:d[i.side],h.clipShadows=i.clipShadows,h.clippingPlanes=i.clippingPlanes,h.clipIntersection=i.clipIntersection,h.wireframeLinewidth=i.wireframeLinewidth,h.linewidth=i.linewidth,n&&h.isMeshDistanceMaterial&&(h.referencePosition.copy(r),h.nearDistance=a,h.farDistance=o),h}function M(i,r,a,o){if(!1!==i.visible){if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&i.castShadow&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);var s=e.update(i),l=i.material;if(Array.isArray(l))for(var c=s.groups,u=0,d=c.length;u<d;u++){var p=c[u],f=l[p.materialIndex];if(f&&f.visible){var m=_(i,f,o,h,a.near,a.far);t.renderBufferDirect(a,null,s,m,i,p)}}else l.visible&&(m=_(i,l,o,h,a.near,a.far),t.renderBufferDirect(a,null,s,m,i,null))}for(var g=i.children,v=0,y=g.length;v<y;v++)M(g[v],r,a,o)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,i,l){if(!1!==w.enabled&&(!1!==w.autoUpdate||!1!==w.needsUpdate)&&0!==e.length){var c,u=t.getRenderTarget(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var g=0,v=e.length;g<v;g++){var y=e[g],x=y.shadow,b=y&&y.isPointLight;if(void 0!==x){var _=x.camera;if(a.copy(x.mapSize),a.min(o),b){var S=a.x,A=a.y;m[0].set(2*S,A,S,A),m[1].set(0,A,S,A),m[2].set(3*S,A,S,A),m[3].set(S,A,S,A),m[4].set(3*S,0,S,A),m[5].set(S,0,S,A),a.x*=4,a.y*=2}if(null===x.map){var T={minFilter:j,magFilter:j,format:et};x.map=new zt(a.x,a.y,T),x.map.texture.name=y.name+".shadowMap",_.updateProjectionMatrix()}x.isSpotLightShadow&&x.update(y);var L=x.map,C=x.matrix;h.setFromMatrixPosition(y.matrixWorld),_.position.copy(h),b?(c=6,C.makeTranslation(-h.x,-h.y,-h.z)):(c=1,s.setFromMatrixPosition(y.target.matrixWorld),_.lookAt(s),_.updateMatrixWorld(),C.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),C.multiply(_.projectionMatrix),C.multiply(_.matrixWorldInverse)),t.setRenderTarget(L),t.clear();for(var P=0;P<c;P++){if(b){s.copy(_.position),s.add(p[P]),_.up.copy(f[P]),_.lookAt(s),_.updateMatrixWorld();var E=m[P];d.viewport(E)}r.multiplyMatrices(_.projectionMatrix,_.matrixWorldInverse),n.setFromMatrix(r),M(i,l,_,b)}}}w.needsUpdate=!1,t.setRenderTarget(u)}}}function Cn(t,e,i,n){var r=new function(){var e=!1,i=new kt,n=null,r=new kt(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,a,o,s){!0===s&&(e*=o,n*=o,a*=o),i.set(e,n,a,o),!1===r.equals(i)&&(t.clearColor(e,n,a,o),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},a=new function(){var e=!1,i=null,n=null,r=null;return{setTest:function(t){t?U(2929):G(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},o=new function(){var e=!1,i=null,n=null,r=null,a=null,o=null,s=null,h=null,l=null;return{setTest:function(t){t?U(2960):G(2960)},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,o){n===e&&r===i&&a===o||(t.stencilFunc(e,i,o),n=e,r=i,a=o)},setOp:function(e,i,n){o===e&&s===i&&h===n||(t.stencilOp(e,i,n),o=e,s=i,h=n)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,i=null,n=null,r=null,a=null,o=null,s=null,h=null,l=null}}},s=t.getParameter(34921),h=new Uint8Array(s),l=new Uint8Array(s),c=new Uint8Array(s),u={},d=null,p=null,f=null,m=null,g=null,v=null,y=null,x=null,b=null,w=null,_=!1,M=null,S=null,A=null,T=null,L=null,C=t.getParameter(35661),P=!1,D=0,I=t.getParameter(7938);-1!==I.indexOf("WebGL")?(D=parseFloat(/^WebGL\ ([0-9])/.exec(I)[1]),P=D>=1):-1!==I.indexOf("OpenGL ES")&&(D=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(I)[1]),P=D>=2);var O=null,N={},k=new kt,z=new kt;function R(e,i,n){var r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var o=0;o<n;o++)t.texImage2D(i+o,0,6408,1,1,0,6408,5121,r);return a}var B={};function F(i,r){h[i]=1,0===l[i]&&(t.enableVertexAttribArray(i),l[i]=1),c[i]!==r&&((n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),c[i]=r)}function U(e){!0!==u[e]&&(t.enable(e),u[e]=!0)}function G(e){!1!==u[e]&&(t.disable(e),u[e]=!1)}function j(e,n,r,a,o,s,h,l){if(0!==e){if(f||(U(3042),f=!0),5===e)o=o||n,s=s||r,h=h||a,n===g&&o===x||(t.blendEquationSeparate(i.convert(n),i.convert(o)),g=n,x=o),r===v&&a===y&&s===b&&h===w||(t.blendFuncSeparate(i.convert(r),i.convert(a),i.convert(s),i.convert(h)),v=r,y=a,b=s,w=h),m=e,_=null;else if(e!==m||l!==_){if(g===E&&x===E||(t.blendEquation(32774),g=E,x=E),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768)}v=null,y=null,b=null,w=null,m=e,_=l}}else f&&(G(3042),f=!1)}function V(e){M!==e&&(e?t.frontFace(2304):t.frontFace(2305),M=e)}function W(e){0!==e?(U(2884),e!==S&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):G(2884),S=e}function H(e,i,n){e?(U(32823),T===i&&L===n||(t.polygonOffset(i,n),T=i,L=n)):G(32823)}function X(e){void 0===e&&(e=33984+C-1),O!==e&&(t.activeTexture(e),O=e)}return B[3553]=R(3553,3553,1),B[34067]=R(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),U(2929),a.setFunc(3),V(!1),W(1),U(2884),j(0),{buffers:{color:r,depth:a,stencil:o},initAttributes:function(){for(var t=0,e=h.length;t<e;t++)h[t]=0},enableAttribute:function(t){F(t,0)},enableAttributeAndDivisor:F,disableUnusedAttributes:function(){for(var e=0,i=l.length;e!==i;++e)l[e]!==h[e]&&(t.disableVertexAttribArray(e),l[e]=0)},enable:U,disable:G,getCompressedTextureFormats:function(){if(null===d&&(d=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")||e.get("WEBGL_compressed_texture_astc")))for(var i=t.getParameter(34467),n=0;n<i.length;n++)d.push(i[n]);return d},useProgram:function(e){return p!==e&&(t.useProgram(e),p=e,!0)},setBlending:j,setMaterial:function(t,e){2===t.side?G(2884):U(2884);var i=1===t.side;e&&(i=!i),V(i),1===t.blending&&!1===t.transparent?j(0):j(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),r.setMask(t.colorWrite),H(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:V,setCullFace:W,setLineWidth:function(e){e!==A&&(P&&t.lineWidth(e),A=e)},setPolygonOffset:H,setScissorTest:function(t){t?U(3089):G(3089)},activeTexture:X,bindTexture:function(e,i){null===O&&X();var n=N[O];void 0===n&&(n={type:void 0,texture:void 0},N[O]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||B[e]),n.type=e,n.texture=i)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){}},scissor:function(e){!1===k.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),k.copy(e))},viewport:function(e){!1===z.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),z.copy(e))},reset:function(){for(var e=0;e<l.length;e++)1===l[e]&&(t.disableVertexAttribArray(e),l[e]=0);u={},d=null,O=null,N={},p=null,m=null,M=null,S=null,r.reset(),a.reset(),o.reset()}}}function Pn(t,e,i,n,r,a,o){var s={};function h(t,e,i,n){return(t.width>n||t.height>n)&&Math.max(t.width,t.height),t}function l(t){return Mt.isPowerOfTwo(t.width)&&Mt.isPowerOfTwo(t.height)}function c(t,e){return t.generateMipmaps&&e&&t.minFilter!==j&&t.minFilter!==H}function u(e,i,r,a){t.generateMipmap(e),n.get(i).__maxMipLevel=Math.log(Math.max(r,a))*Math.LOG2E}function d(t,i){if(!r.isWebGL2)return t;var n=t;return 6403===t&&(5126===i&&(n=33326),5131===i&&(n=33325),5121===i&&(n=33321)),6407===t&&(5126===i&&(n=34837),5131===i&&(n=34843),5121===i&&(n=32849)),6408===t&&(5126===i&&(n=34836),5131===i&&(n=34842),5121===i&&(n=32856)),33325!==n&&33326!==n&&34842!==n&&34836!==n||e.get("EXT_color_buffer_float"),n}function p(t){return t===j||t===V||t===W?9728:9729}function f(e){var i=e.target;i.removeEventListener("dispose",f),function(e){var i=n.get(e);void 0!==i.__webglInit&&(t.deleteTexture(i.__webglTexture),n.remove(e))}(i),i.isVideoTexture&&delete s[i.id],o.memory.textures--}function m(e){var i=e.target;i.removeEventListener("dispose",m),function(e){var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(i.__webglFramebuffer[a]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[a]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}}(i),o.memory.textures--}function g(t,e){var r=n.get(t);if(t.isVideoTexture&&function(t){var e=t.id,i=o.render.frame;s[e]!==i&&(s[e]=i,t.update())}(t),t.version>0&&r.__version!==t.version){var a=t.image;if(void 0===a);else if(!1!==a.complete)return void x(r,t,e)}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function v(i,o,s){var h;if(s?(t.texParameteri(i,10242,a.convert(o.wrapS)),t.texParameteri(i,10243,a.convert(o.wrapT)),32879===i&&t.texParameteri(i,32882,a.convert(o.wrapR)),t.texParameteri(i,10240,a.convert(o.magFilter)),t.texParameteri(i,10241,a.convert(o.minFilter))):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879===i&&t.texParameteri(i,32882,33071),o.wrapS!==U||o.wrapT,t.texParameteri(i,10240,p(o.magFilter)),t.texParameteri(i,10241,p(o.minFilter)),o.minFilter!==j&&o.minFilter),h=e.get("EXT_texture_filter_anisotropic")){if(o.type===K&&null===e.get("OES_texture_float_linear"))return;if(o.type===Q&&null===(r.isWebGL2||e.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(t.texParameterf(i,h.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function y(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",f),e.__webglTexture=t.createTexture(),o.memory.textures++)}function x(e,n,o){var s=n.isDataTexture3D?32879:3553;y(e,n),i.activeTexture(33984+o),i.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),function(t){return!r.isWebGL2&&(t.wrapS!==U||t.wrapT!==U||t.minFilter!==j&&t.minFilter!==H)}(n)&&l(n.image);var p=h(n.image,0,0,r.maxTextureSize),f=l(p)||r.isWebGL2,m=a.convert(n.format),g=a.convert(n.type),x=d(m,g);v(s,n,f);var b,w=n.mipmaps;if(n.isDepthTexture){if(x=6402,n.type===K){if(!r.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");x=36012}else r.isWebGL2&&(x=33189);n.format===it&&6402===x&&n.type!==Z&&n.type!==J&&(n.type=Z,g=a.convert(n.type)),n.format===nt&&(x=34041,n.type!==$&&(n.type=$,g=a.convert(n.type))),i.texImage2D(3553,0,x,p.width,p.height,0,m,g,null)}else if(n.isDataTexture)if(w.length>0&&f){for(var _=0,M=w.length;_<M;_++)b=w[_],i.texImage2D(3553,_,x,b.width,b.height,0,m,g,b.data);n.generateMipmaps=!1,e.__maxMipLevel=w.length-1}else i.texImage2D(3553,0,x,p.width,p.height,0,m,g,p.data),e.__maxMipLevel=0;else if(n.isCompressedTexture){for(_=0,M=w.length;_<M;_++)b=w[_],n.format!==et&&n.format!==tt?i.getCompressedTextureFormats().indexOf(m)>-1&&i.compressedTexImage2D(3553,_,x,b.width,b.height,0,b.data):i.texImage2D(3553,_,x,b.width,b.height,0,m,g,b.data);e.__maxMipLevel=w.length-1}else if(n.isDataTexture3D)i.texImage3D(32879,0,x,p.width,p.height,p.depth,0,m,g,p.data),e.__maxMipLevel=0;else if(w.length>0&&f){for(_=0,M=w.length;_<M;_++)b=w[_],i.texImage2D(3553,_,x,m,g,b);n.generateMipmaps=!1,e.__maxMipLevel=w.length-1}else i.texImage2D(3553,0,x,m,g,p),e.__maxMipLevel=0;c(n,f)&&u(3553,n,p.width,p.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function b(e,r,o,s){var h=a.convert(r.texture.format),l=a.convert(r.texture.type),c=d(h,l);i.texImage2D(s,0,c,r.width,r.height,0,h,l,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,s,n.get(r.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function w(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){if(n){var r=M(i);t.renderbufferStorageMultisample(36161,r,33189,i.width,i.height)}else t.renderbufferStorage(36161,33189,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer)n?(r=M(i),t.renderbufferStorageMultisample(36161,r,34041,i.width,i.height)):t.renderbufferStorage(36161,34041,i.width,i.height),t.framebufferRenderbuffer(36160,33306,36161,e);else{var o=d(a.convert(i.texture.format),a.convert(i.texture.type));n?(r=M(i),t.renderbufferStorageMultisample(36161,r,o,i.width,i.height)):t.renderbufferStorage(36161,o,i.width,i.height)}t.bindRenderbuffer(36161,null)}function _(e){var i=n.get(e),r=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),g(i.depthTexture,0);var r=n.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===it)t.framebufferTexture2D(36160,36096,3553,r,0);else{if(i.depthTexture.format!==nt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,r,0)}}(i.__webglFramebuffer,e)}else if(r){i.__webglDepthbuffer=[];for(var a=0;a<6;a++)t.bindFramebuffer(36160,i.__webglFramebuffer[a]),i.__webglDepthbuffer[a]=t.createRenderbuffer(),w(i.__webglDepthbuffer[a],e)}else t.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),w(i.__webglDepthbuffer,e);t.bindFramebuffer(36160,null)}function M(t){return r.isWebGL2&&t.isWebGLMultisampleRenderTarget?Math.min(r.maxSamples,t.samples):0}this.setTexture2D=g,this.setTexture3D=function(t,e){var r=n.get(t);t.version>0&&r.__version!==t.version?x(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(e,o){var s=n.get(e);if(6===e.image.length)if(e.version>0&&s.__version!==e.version){y(s,e),i.activeTexture(33984+o),i.bindTexture(34067,s.__webglTexture),t.pixelStorei(37440,e.flipY);for(var p=e&&e.isCompressedTexture,f=e.image[0]&&e.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=p||f?f?e.image[g].image:e.image[g]:h(e.image[g],0,0,r.maxCubemapSize);var x=m[0],b=l(x)||r.isWebGL2,w=a.convert(e.format),_=a.convert(e.type),M=d(w,_);for(v(34067,e,b),g=0;g<6;g++)if(p)for(var S,A=m[g].mipmaps,T=0,L=A.length;T<L;T++)S=A[T],e.format!==et&&e.format!==tt?i.getCompressedTextureFormats().indexOf(w)>-1&&i.compressedTexImage2D(34069+g,T,M,S.width,S.height,0,S.data):i.texImage2D(34069+g,T,M,S.width,S.height,0,w,_,S.data);else f?i.texImage2D(34069+g,0,M,m[g].width,m[g].height,0,w,_,m[g].data):i.texImage2D(34069+g,0,M,w,_,m[g]);s.__maxMipLevel=p?A.length-1:0,c(e,b)&&u(34067,e,x.width,x.height),s.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(33984+o),i.bindTexture(34067,s.__webglTexture)},this.setTextureCubeDynamic=function(t,e){i.activeTexture(33984+e),i.bindTexture(34067,n.get(t).__webglTexture)},this.setupRenderTarget=function(e){var s=n.get(e),h=n.get(e.texture);e.addEventListener("dispose",m),h.__webglTexture=t.createTexture(),o.memory.textures++;var p=!0===e.isWebGLRenderTargetCube,f=!0===e.isWebGLMultisampleRenderTarget,g=l(e)||r.isWebGL2;if(p){s.__webglFramebuffer=[];for(var y=0;y<6;y++)s.__webglFramebuffer[y]=t.createFramebuffer()}else if(s.__webglFramebuffer=t.createFramebuffer(),f&&r.isWebGL2){s.__webglMultisampledFramebuffer=t.createFramebuffer(),s.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var x=d(a.convert(e.texture.format),a.convert(e.texture.type)),S=M(e);t.renderbufferStorageMultisample(36161,S,x,e.width,e.height),t.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(s.__webglDepthRenderbuffer=t.createRenderbuffer(),w(s.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}if(p){for(i.bindTexture(34067,h.__webglTexture),v(34067,e.texture,g),y=0;y<6;y++)b(s.__webglFramebuffer[y],e,36064,34069+y);c(e.texture,g)&&u(34067,e.texture,e.width,e.height),i.bindTexture(34067,null)}else i.bindTexture(3553,h.__webglTexture),v(3553,e.texture,g),b(s.__webglFramebuffer,e,36064,3553),c(e.texture,g)&&u(3553,e.texture,e.width,e.height),i.bindTexture(3553,null);e.depthBuffer&&_(e)},this.updateRenderTargetMipmap=function(t){var e=t.texture;if(c(e,l(t)||r.isWebGL2)){var a=t.isWebGLRenderTargetCube?34067:3553,o=n.get(e).__webglTexture;i.bindTexture(a,o),u(a,e,t.width,t.height),i.bindTexture(a,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget&&r.isWebGL2){var i=n.get(e);t.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,i.__webglFramebuffer);var a=e.width,o=e.height,s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024),t.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728)}}}function En(t,e,i){return{convert:function(t){var n;if(t===F)return 10497;if(t===U)return 33071;if(t===G)return 33648;if(t===j)return 9728;if(t===V)return 9984;if(t===W)return 9986;if(t===H)return 9729;if(t===X)return 9985;if(t===q)return 9987;if(t===Y)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(t===Z)return 5123;if(1013===t)return 5124;if(t===J)return 5125;if(t===K)return 5126;if(t===Q){if(i.isWebGL2)return 5131;if(null!==(n=e.get("OES_texture_half_float")))return n.HALF_FLOAT_OES}if(1021===t)return 6406;if(t===tt)return 6407;if(t===et)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===it)return 6402;if(t===nt)return 34041;if(1028===t)return 6403;if(t===E)return 32774;if(101===t)return 32778;if(102===t)return 32779;if(200===t)return 0;if(201===t)return 1;if(202===t)return 768;if(203===t)return 769;if(204===t)return 770;if(205===t)return 771;if(206===t)return 772;if(207===t)return 773;if(208===t)return 774;if(209===t)return 775;if(210===t)return 776;if((t===rt||t===at||t===ot||t===st)&&null!==(n=e.get("WEBGL_compressed_texture_s3tc"))){if(t===rt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===at)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===ot)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===st)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===ht||t===lt||t===ct||t===ut)&&null!==(n=e.get("WEBGL_compressed_texture_pvrtc"))){if(t===ht)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===lt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===ct)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ut)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===dt&&null!==(n=e.get("WEBGL_compressed_texture_etc1")))return n.COMPRESSED_RGB_ETC1_WEBGL;if((37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t)&&null!==(n=e.get("WEBGL_compressed_texture_astc")))return t;if(t===D||t===I){if(i.isWebGL2){if(t===D)return 32775;if(t===I)return 32776}if(null!==(n=e.get("EXT_blend_minmax"))){if(t===D)return n.MIN_EXT;if(t===I)return n.MAX_EXT}}if(t===$){if(i.isWebGL2)return 34042;if(null!==(n=e.get("WEBGL_depth_texture")))return n.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Dn(){de.call(this),this.type="Group"}function In(){de.call(this),this.type="Camera",this.matrixWorldInverse=new At,this.projectionMatrix=new At,this.projectionMatrixInverse=new At}function On(t,e,i,n){In.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Nn(t){On.call(this),this.cameras=t||[]}An.prototype=Object.create(qe.prototype),An.prototype.constructor=An,An.prototype.isMeshDepthMaterial=!0,An.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Tn.prototype=Object.create(qe.prototype),Tn.prototype.constructor=Tn,Tn.prototype.isMeshDistanceMaterial=!0,Tn.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},Dn.prototype=Object.assign(Object.create(de.prototype),{constructor:Dn,isGroup:!0}),In.prototype=Object.assign(Object.create(de.prototype),{constructor:In,isCamera:!0,copy:function(t,e){return de.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(t=new Lt),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){de.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),On.prototype=Object.assign(Object.create(In.prototype),{constructor:On,isPerspectiveCamera:!0,copy:function(t,e){return In.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*Mt.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Mt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Mt.RAD2DEG*Math.atan(Math.tan(.5*Mt.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Mt.DEG2RAD*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/o,e-=a.offsetY*i/s,n*=a.width/o,i*=a.height/s}var h=this.filmOffset;0!==h&&(r+=t*h/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=de.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Nn.prototype=Object.assign(Object.create(On.prototype),{constructor:Nn,isArrayCamera:!0});var kn,zn,Rn,Bn,Fn,Un,Gn=new Lt,jn=new Lt;function Vn(t,e,i){Gn.setFromMatrixPosition(e.matrixWorld),jn.setFromMatrixPosition(i.matrixWorld);var n=Gn.distanceTo(jn),r=e.projectionMatrix.elements,a=i.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),h=(r[9]+1)/r[5],l=(r[9]-1)/r[5],c=(r[8]-1)/r[0],u=(a[8]+1)/a[0],d=o*c,p=o*u,f=n/(-c+u),m=f*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var g=o+f,v=s+f,y=d-m,x=p+(n-m),b=h*s/v*g,w=l*s/v*g;t.projectionMatrix.makePerspective(y,x,b,w,g,v)}function Wn(t){var e=this,i=null,n=null,r=null,a=[],o=new At,s=new At,h=1,l="stage";void 0!==window&&"VRFrameData"in window&&(n=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",x,!1));var c=new At,u=new Tt,d=new Lt,p=new On;p.bounds=new kt(0,0,.5,1),p.layers.enable(1);var f=new On;f.bounds=new kt(.5,0,.5,1),f.layers.enable(2);var m=new Nn([p,f]);function g(){return null!==i&&!0===i.isPresenting}m.layers.enable(1),m.layers.enable(2);var v,y=new St;function x(){if(g()){var n=i.getEyeParameters("left"),r=n.renderWidth*h,a=n.renderHeight*h;v=t.getPixelRatio(),t.getSize(y),t.setDrawingBufferSize(2*r,a,1),_.start()}else e.enabled&&t.setDrawingBufferSize(y.width,y.height,v),_.stop()}var b=[];function w(t){for(var e=navigator.getGamepads&&navigator.getGamepads(),i=0,n=0,r=e.length;i<r;i++){var a=e[i];if(a&&("Daydream Controller"===a.id||"Gear VR Controller"===a.id||"Oculus Go Controller"===a.id||"OpenVR Gamepad"===a.id||a.id.startsWith("Oculus Touch")||a.id.startsWith("Spatial Controller"))){if(n===t)return a;n++}}}this.enabled=!1,this.getController=function(t){var e=a[t];return void 0===e&&((e=new Dn).matrixAutoUpdate=!1,e.visible=!1,a[t]=e),e},this.getDevice=function(){return i},this.setDevice=function(t){void 0!==t&&(i=t),_.setContext(t)},this.setFramebufferScaleFactor=function(t){h=t},this.setFrameOfReferenceType=function(t){l=t},this.setPoseTarget=function(t){void 0!==t&&(r=t)},this.getCamera=function(t){var e="stage"===l?1.6:0;if(!1===g())return t.position.set(0,e,0),t.rotation.set(0,0,0),t;if(i.depthNear=t.near,i.depthFar=t.far,i.getFrameData(n),"stage"===l){var h=i.stageParameters;h?o.fromArray(h.sittingToStandingTransform):o.makeTranslation(0,e,0)}var v=n.pose,y=null!==r?r:t;y.matrix.copy(o),y.matrix.decompose(y.position,y.quaternion,y.scale),null!==v.orientation&&(u.fromArray(v.orientation),y.quaternion.multiply(u)),null!==v.position&&(u.setFromRotationMatrix(o),d.fromArray(v.position),d.applyQuaternion(u),y.position.add(d)),y.updateMatrixWorld(),p.near=t.near,f.near=t.near,p.far=t.far,f.far=t.far,p.matrixWorldInverse.fromArray(n.leftViewMatrix),f.matrixWorldInverse.fromArray(n.rightViewMatrix),s.getInverse(o),"stage"===l&&(p.matrixWorldInverse.multiply(s),f.matrixWorldInverse.multiply(s));var x=y.parent;null!==x&&(c.getInverse(x.matrixWorld),p.matrixWorldInverse.multiply(c),f.matrixWorldInverse.multiply(c)),p.matrixWorld.getInverse(p.matrixWorldInverse),f.matrixWorld.getInverse(f.matrixWorldInverse),p.projectionMatrix.fromArray(n.leftProjectionMatrix),f.projectionMatrix.fromArray(n.rightProjectionMatrix),Vn(m,p,f);var _=i.getLayers();if(_.length){var M=_[0];null!==M.leftBounds&&4===M.leftBounds.length&&p.bounds.fromArray(M.leftBounds),null!==M.rightBounds&&4===M.rightBounds.length&&f.bounds.fromArray(M.rightBounds)}return function(){for(var t=0;t<a.length;t++){var e=a[t],i=w(t);if(void 0!==i&&void 0!==i.pose){if(null===i.pose)return;var n=i.pose;!1===n.hasPosition&&e.position.set(.2,-.6,-.05),null!==n.position&&e.position.fromArray(n.position),null!==n.orientation&&e.quaternion.fromArray(n.orientation),e.matrix.compose(e.position,e.quaternion,e.scale),e.matrix.premultiply(o),e.matrix.decompose(e.position,e.quaternion,e.scale),e.matrixWorldNeedsUpdate=!0,e.visible=!0;var r="Daydream Controller"===i.id?0:1;b[t]!==i.buttons[r].pressed&&(b[t]=i.buttons[r].pressed,!0===b[t]?e.dispatchEvent({type:"selectstart"}):(e.dispatchEvent({type:"selectend"}),e.dispatchEvent({type:"select"})))}else e.visible=!1}}(),m},this.getStandingMatrix=function(){return o},this.isPresenting=g;var _=new ie;this.setAnimationLoop=function(t){_.setAnimationLoop(t)},this.submitFrame=function(){g()&&i.submitFrame()},this.dispose=function(){void 0!==window&&window.removeEventListener("vrdisplaypresentchange",x)}}function Hn(t){var e=t.context,i=null,n=null,r=1,a=null,o="stage",s=null,h=[],l=[];function c(){return null!==n&&null!==a}var u=new On;u.layers.enable(1),u.viewport=new kt;var d=new On;d.layers.enable(2),d.viewport=new kt;var p=new Nn([u,d]);function f(t){var e=h[l.indexOf(t.inputSource)];e&&e.dispatchEvent({type:t.type})}function m(){t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),y.stop()}function g(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)}p.layers.enable(1),p.layers.enable(2),this.enabled=!1,this.getController=function(t){var e=h[t];return void 0===e&&((e=new Dn).matrixAutoUpdate=!1,e.visible=!1,h[t]=e),e},this.getDevice=function(){return i},this.setDevice=function(t){void 0!==t&&(i=t),t instanceof XRDevice&&e.setCompatibleXRDevice(t)},this.setFramebufferScaleFactor=function(t){r=t},this.setFrameOfReferenceType=function(t){o=t},this.setSession=function(i){null!==(n=i)&&(n.addEventListener("select",f),n.addEventListener("selectstart",f),n.addEventListener("selectend",f),n.addEventListener("end",m),n.baseLayer=new XRWebGLLayer(n,e,{framebufferScaleFactor:r}),n.requestFrameOfReference(o).then(function(e){a=e,t.setFramebuffer(n.baseLayer.framebuffer),y.setContext(n),y.start()}),l=n.getInputSources(),n.addEventListener("inputsourceschange",function(){l=n.getInputSources();for(var t=0;t<h.length;t++)h[t].userData.inputSource=l[t]}))},this.getCamera=function(t){if(c()){var e=t.parent,i=p.cameras;g(p,e);for(var n=0;n<i.length;n++)g(i[n],e);t.matrixWorld.copy(p.matrixWorld);for(var r=t.children,a=(n=0,r.length);n<a;n++)r[n].updateMatrixWorld(!0);return Vn(p,u,d),p}return t},this.isPresenting=c;var v=null,y=new ie;y.setAnimationLoop(function(t,e){if(null!==(s=e.getDevicePose(a)))for(var i=n.baseLayer,r=e.views,o=0;o<r.length;o++){var c=r[o],u=i.getViewport(c),d=s.getViewMatrix(c),f=p.cameras[o];f.matrix.fromArray(d).getInverse(f.matrix),f.projectionMatrix.fromArray(c.projectionMatrix),f.viewport.set(u.x,u.y,u.width,u.height),0===o&&p.matrix.copy(f.matrix)}for(o=0;o<h.length;o++){var m=h[o],g=l[o];if(g){var y=e.getInputPose(g,a);if(null!==y){"targetRay"in y?m.matrix.elements=y.targetRay.transformMatrix:"pointerMatrix"in y&&(m.matrix.elements=y.pointerMatrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.visible=!0;continue}}m.visible=!1}v&&v(t)}),this.setAnimationLoop=function(t){v=t},this.dispose=function(){},this.getStandingMatrix=function(){return new At},this.submitFrame=function(){}}function Xn(t){var e=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),i=void 0!==t.context?t.context:null,n=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,h=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",c=null,u=null;this.domElement=e,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=1,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var d,p,f,m,g,v,y,x,b,w,_,M,S,A,T,L,C,P,E=this,D=!1,I=null,O=null,N=null,k=-1,z={geometry:null,program:null,wireframe:!1},R=null,B=null,F=new kt,U=new kt,G=null,j=0,V=e.width,W=e.height,H=1,X=new kt(0,0,V,W),q=new kt(0,0,V,W),Z=!1,J=new Vt,$=new ii,tt=!1,it=!1,nt=new At,rt=new Lt;function at(){return null===O?H:1}try{var ot={alpha:n,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:h,powerPreference:l};if(e.addEventListener("webglcontextlost",ct,!1),e.addEventListener("webglcontextrestored",ut,!1),null===(d=i||e.getContext("webgl",ot)||e.getContext("experimental-webgl",ot)))throw null!==e.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===d.getShaderPrecisionFormat&&(d.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw t}function st(){p=new ni(d),(f=new ei(d,p,t)).isWebGL2||(p.get("WEBGL_depth_texture"),p.get("OES_texture_float"),p.get("OES_texture_half_float"),p.get("OES_texture_half_float_linear"),p.get("OES_standard_derivatives"),p.get("OES_element_index_uint"),p.get("ANGLE_instanced_arrays")),p.get("OES_texture_float_linear"),P=new En(d,p,f),(m=new Cn(d,p,P,f)).scissor(U.copy(q).multiplyScalar(H)),m.viewport(F.copy(X).multiplyScalar(H)),g=new oi,v=new mn,y=new Pn(d,p,m,v,f,P,g),x=new ne(d),b=new ri(d,x,g),w=new li(b,g),T=new hi(d),_=new fn(E,p,f),M=new xn,S=new Sn,A=new $e(E,m,w,s),L=new ti(d,p,g,f),C=new ai(d,p,g,f),g.programs=_.programs,E.context=d,E.capabilities=f,E.extensions=p,E.properties=v,E.renderLists=M,E.state=m,E.info=g}st();var ht=null;"undefined"!=typeof navigator&&(ht="xr"in navigator?new Hn(E):new Wn(E)),this.vr=ht;var lt=new Ln(E,w,f.maxTextureSize);function ct(t){t.preventDefault(),D=!0}function ut(){D=!1,st()}function dt(t){var e=t.target;e.removeEventListener("dispose",dt),function(t){pt(t),v.remove(t)}(e)}function pt(t){var e=v.get(t).program;t.program=void 0,void 0!==e&&_.releaseProgram(e)}this.shadowMap=lt,this.getContext=function(){return d},this.getContextAttributes=function(){return d.getContextAttributes()},this.forceContextLoss=function(){var t=p.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=p.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(t){void 0!==t&&(H=t,this.setSize(V,W,!1))},this.getSize=function(t){return void 0===t&&(t=new St),t.set(V,W)},this.setSize=function(t,i,n){ht&&ht.isPresenting()||(V=t,W=i,e.width=t*H,e.height=i*H,!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return void 0===t&&(t=new St),t.set(V*H,W*H)},this.setDrawingBufferSize=function(t,i,n){V=t,W=i,H=n,e.width=t*n,e.height=i*n,this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return void 0===t&&(t=new kt),t.copy(F)},this.getViewport=function(t){return t.copy(X)},this.setViewport=function(t,e,i,n){t.isVector4?X.set(t.x,t.y,t.z,t.w):X.set(t,e,i,n),m.viewport(F.copy(X).multiplyScalar(H))},this.getScissor=function(t){return t.copy(q)},this.setScissor=function(t,e,i,n){t.isVector4?q.set(t.x,t.y,t.z,t.w):q.set(t,e,i,n),m.scissor(U.copy(q).multiplyScalar(H))},this.getScissorTest=function(){return Z},this.setScissorTest=function(t){m.setScissorTest(Z=t)},this.getClearColor=function(){return A.getClearColor()},this.setClearColor=function(){A.setClearColor.apply(A,arguments)},this.getClearAlpha=function(){return A.getClearAlpha()},this.setClearAlpha=function(){A.setClearAlpha.apply(A,arguments)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(n|=256),(void 0===i||i)&&(n|=1024),d.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",ct,!1),e.removeEventListener("webglcontextrestored",ut,!1),M.dispose(),S.dispose(),v.dispose(),w.dispose(),ht&&ht.dispose(),gt.stop()},this.renderBufferImmediate=function(t,e){m.initAttributes();var i=v.get(t);t.hasPositions&&!i.position&&(i.position=d.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=d.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=d.createBuffer()),t.hasColors&&!i.color&&(i.color=d.createBuffer());var n=e.getAttributes();t.hasPositions&&(d.bindBuffer(34962,i.position),d.bufferData(34962,t.positionArray,35048),m.enableAttribute(n.position),d.vertexAttribPointer(n.position,3,5126,!1,0,0)),t.hasNormals&&(d.bindBuffer(34962,i.normal),d.bufferData(34962,t.normalArray,35048),m.enableAttribute(n.normal),d.vertexAttribPointer(n.normal,3,5126,!1,0,0)),t.hasUvs&&(d.bindBuffer(34962,i.uv),d.bufferData(34962,t.uvArray,35048),m.enableAttribute(n.uv),d.vertexAttribPointer(n.uv,2,5126,!1,0,0)),t.hasColors&&(d.bindBuffer(34962,i.color),d.bufferData(34962,t.colorArray,35048),m.enableAttribute(n.color),d.vertexAttribPointer(n.color,3,5126,!1,0,0)),m.disableUnusedAttributes(),d.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,a){var o=r.isMesh&&r.matrixWorld.determinant()<0;m.setMaterial(n,o);var s=wt(t,e,n,r),h=!1;z.geometry===i.id&&z.program===s.id&&z.wireframe===(!0===n.wireframe)||(z.geometry=i.id,z.program=s.id,z.wireframe=!0===n.wireframe,h=!0),r.morphTargetInfluences&&(T.update(r,i,n,s),h=!0);var l,c=i.index,u=i.attributes.position,g=1;!0===n.wireframe&&(c=b.getWireframeAttribute(i),g=2);var v=L;null!==c&&(l=x.get(c),(v=C).setIndex(l)),h&&(function(t,e,i){if(!i||!i.isInstancedBufferGeometry||f.isWebGL2||null!==p.get("ANGLE_instanced_arrays")){m.initAttributes();var n=i.attributes,r=e.getAttributes(),a=t.defaultAttributeValues;for(var o in r){var s=r[o];if(s>=0){var h=n[o];if(void 0!==h){var l=h.normalized,c=h.itemSize,u=x.get(h);if(void 0===u)continue;var g=u.buffer,v=u.type,y=u.bytesPerElement;if(h.isInterleavedBufferAttribute){var b=h.data,w=b.stride,_=h.offset;b&&b.isInstancedInterleavedBuffer?(m.enableAttributeAndDivisor(s,b.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=b.meshPerAttribute*b.count)):m.enableAttribute(s),d.bindBuffer(34962,g),d.vertexAttribPointer(s,c,v,l,w*y,_*y)}else h.isInstancedBufferAttribute?(m.enableAttributeAndDivisor(s,h.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):m.enableAttribute(s),d.bindBuffer(34962,g),d.vertexAttribPointer(s,c,v,l,0,0)}else if(void 0!==a){var M=a[o];if(void 0!==M)switch(M.length){case 2:d.vertexAttrib2fv(s,M);break;case 3:d.vertexAttrib3fv(s,M);break;case 4:d.vertexAttrib4fv(s,M);break;default:d.vertexAttrib1fv(s,M)}}}}m.disableUnusedAttributes()}}(n,s,i),null!==c&&d.bindBuffer(34963,l.buffer));var y=1/0;null!==c?y=c.count:void 0!==u&&(y=u.count);var w=i.drawRange.start*g,_=i.drawRange.count*g,M=null!==a?a.start*g:0,S=null!==a?a.count*g:1/0,A=Math.max(w,M),P=Math.min(y,w+_,M+S)-1,E=Math.max(0,P-A+1);if(0!==E){if(r.isMesh)if(!0===n.wireframe)m.setLineWidth(n.wireframeLinewidth*at()),v.setMode(1);else switch(r.drawMode){case 0:v.setMode(4);break;case 1:v.setMode(5);break;case 2:v.setMode(6)}else if(r.isLine){var D=n.linewidth;void 0===D&&(D=1),m.setLineWidth(D*at()),r.isLineSegments?v.setMode(1):r.isLineLoop?v.setMode(2):v.setMode(3)}else r.isPoints?v.setMode(0):r.isSprite&&v.setMode(4);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&v.renderInstances(i,A,E):v.render(A,E)}},this.compile=function(t,e){(u=S.get(t,e)).init(),t.traverse(function(t){t.isLight&&(u.pushLight(t),t.castShadow&&u.pushShadow(t))}),u.setupLights(e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var i=0;i<e.material.length;i++)bt(e.material[i],t.fog,e);else bt(e.material,t.fog,e)})};var ft,mt=null,gt=new ie;function vt(t,e,i,n){if(!1!==t.visible){if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLight)u.pushLight(t),t.castShadow&&u.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||J.intersectsSprite(t)){n&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt);var r=w.update(t),a=t.material;c.push(t,r,a,i,rt.z,null)}}else if(t.isImmediateRenderObject)n&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt),c.push(t,null,t.material,i,rt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||J.intersectsObject(t)))if(n&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt),r=w.update(t),a=t.material,Array.isArray(a))for(var o=r.groups,s=0,h=o.length;s<h;s++){var l=o[s],d=a[l.materialIndex];d&&d.visible&&c.push(t,r,d,i,rt.z,l)}else a.visible&&c.push(t,r,a,i,rt.z,null);var p=t.children;for(s=0,h=p.length;s<h;s++)vt(p[s],e,i,n)}}function yt(t,e,i,n){for(var r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,h=o.geometry,l=void 0===n?o.material:n,c=o.group;if(i.isArrayCamera){B=i;for(var d=i.cameras,p=0,f=d.length;p<f;p++){var g=d[p];if(s.layers.test(g.layers)){if("viewport"in g)m.viewport(F.copy(g.viewport));else{var v=g.bounds,y=v.x*V,x=v.y*W,b=v.z*V,w=v.w*W;m.viewport(F.set(y,x,b,w).multiplyScalar(H))}u.setupLights(g),xt(s,e,g,h,l,c)}}}else B=null,xt(s,e,i,h,l,c)}}function xt(t,e,i,n,r,a){if(t.onBeforeRender(E,e,i,n,r,a),u=S.get(e,B||i),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){m.setMaterial(r);var o=wt(i,e.fog,r,t);z.geometry=null,z.program=null,z.wireframe=!1,function(t,e){t.render(function(t){E.renderBufferImmediate(t,e)})}(t,o)}else E.renderBufferDirect(i,e.fog,n,r,t,a);t.onAfterRender(E,e,i,n,r,a),u=S.get(e,B||i)}function bt(t,e,i){var n=v.get(t),r=u.state.lights,a=u.state.shadowsArray,o=n.lightsHash,s=r.state.hash,h=_.getParameters(t,r.state,a,e,$.numPlanes,$.numIntersection,i),l=_.getProgramCode(t,h),c=n.program,d=!0;if(void 0===c)t.addEventListener("dispose",dt);else if(c.code!==l)pt(t);else if(o.stateID!==s.stateID||o.directionalLength!==s.directionalLength||o.pointLength!==s.pointLength||o.spotLength!==s.spotLength||o.rectAreaLength!==s.rectAreaLength||o.hemiLength!==s.hemiLength||o.shadowsLength!==s.shadowsLength)o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,d=!1;else{if(void 0!==h.shaderID)return;d=!1}if(d){if(h.shaderID){var p=ee[h.shaderID];n.shader={name:t.type,uniforms:Ht(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}}else n.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.onBeforeCompile(n.shader,E),l=_.getProgramCode(t,h),c=_.acquireProgram(t,n.shader,h,l),n.program=c,t.program=c}var f=c.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var m=0;m<E.maxMorphTargets;m++)f["morphTarget"+m]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals)for(t.numSupportedMorphNormals=0,m=0;m<E.maxMorphNormals;m++)f["morphNormal"+m]>=0&&t.numSupportedMorphNormals++;var g=n.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=$.numPlanes,n.numIntersection=$.numIntersection,g.clippingPlanes=$.uniform),n.fog=e,void 0===o&&(n.lightsHash=o={}),o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,t.lights&&(g.ambientLightColor.value=r.state.ambient,g.directionalLights.value=r.state.directional,g.spotLights.value=r.state.spot,g.rectAreaLights.value=r.state.rectArea,g.pointLights.value=r.state.point,g.hemisphereLights.value=r.state.hemi,g.directionalShadowMap.value=r.state.directionalShadowMap,g.directionalShadowMatrix.value=r.state.directionalShadowMatrix,g.spotShadowMap.value=r.state.spotShadowMap,g.spotShadowMatrix.value=r.state.spotShadowMatrix,g.pointShadowMap.value=r.state.pointShadowMap,g.pointShadowMatrix.value=r.state.pointShadowMatrix);var y=n.program.getUniforms(),x=en.seqWithValue(y.seq,g);n.uniformsList=x}function wt(t,e,i,n){j=0;var r=v.get(i),a=u.state.lights,o=r.lightsHash,s=a.state.hash;if(tt&&(it||t!==R)){var h=t===R&&i.id===k;$.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,r,h)}!1===i.needsUpdate&&(void 0===r.program||i.fog&&r.fog!==e?i.needsUpdate=!0:(!i.lights||o.stateID===s.stateID&&o.directionalLength===s.directionalLength&&o.pointLength===s.pointLength&&o.spotLength===s.spotLength&&o.rectAreaLength===s.rectAreaLength&&o.hemiLength===s.hemiLength&&o.shadowsLength===s.shadowsLength)&&(void 0===r.numClippingPlanes||r.numClippingPlanes===$.numPlanes&&r.numIntersection===$.numIntersection)||(i.needsUpdate=!0)),!i.needsUpdate&&r.program||(bt(i,e,n),i.needsUpdate=!1);var l,c,p=!1,g=!1,y=!1,x=r.program,b=x.getUniforms(),w=r.shader.uniforms;if(m.useProgram(x.program)&&(p=!0,g=!0,y=!0),i.id!==k&&(k=i.id,g=!0),p||R!==t){if(b.setValue(d,"projectionMatrix",t.projectionMatrix),f.logarithmicDepthBuffer&&b.setValue(d,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),R!==t&&(R=t,g=!0,y=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var _=b.map.cameraPosition;void 0!==_&&_.setValue(d,rt.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&b.setValue(d,"viewMatrix",t.matrixWorldInverse)}if(i.skinning){b.setOptional(d,n,"bindMatrix"),b.setOptional(d,n,"bindMatrixInverse");var M=n.skeleton;if(M){var S=M.bones;if(f.floatVertexTextures){if(void 0===M.boneTexture){var A=Math.sqrt(4*S.length);A=Mt.ceilPowerOfTwo(A),A=Math.max(A,4);var T=new Float32Array(A*A*4);T.set(M.boneMatrices);var L=new Ft(T,A,A,et,K);L.needsUpdate=!0,M.boneMatrices=T,M.boneTexture=L,M.boneTextureSize=A}b.setValue(d,"boneTexture",M.boneTexture),b.setValue(d,"boneTextureSize",M.boneTextureSize)}else b.setOptional(d,M,"boneMatrices")}}return g&&(b.setValue(d,"toneMappingExposure",E.toneMappingExposure),b.setValue(d,"toneMappingWhitePoint",E.toneMappingWhitePoint),i.lights&&(c=y,(l=w).ambientLightColor.needsUpdate=c,l.directionalLights.needsUpdate=c,l.pointLights.needsUpdate=c,l.spotLights.needsUpdate=c,l.rectAreaLights.needsUpdate=c,l.hemisphereLights.needsUpdate=c),e&&i.fog&&function(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(w,e),i.isMeshBasicMaterial?_t(w,i):i.isMeshLambertMaterial?(_t(w,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(w,i)):i.isMeshPhongMaterial?(_t(w,i),i.isMeshToonMaterial?function(t,e){Tt(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(w,i):Tt(w,i)):i.isMeshStandardMaterial?(_t(w,i),i.isMeshPhysicalMaterial?function(t,e){Ct(t,e),t.reflectivity.value=e.reflectivity,t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness}(w,i):Ct(w,i)):i.isMeshMatcapMaterial?(_t(w,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(w,i)):i.isMeshDepthMaterial?(_t(w,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(w,i)):i.isMeshDistanceMaterial?(_t(w,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(w,i)):i.isMeshNormalMaterial?(_t(w,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(w,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}(w,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(w,i)):i.isPointsMaterial?function(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*H,t.scale.value=.5*W,t.map.value=e.map,null!==e.map&&(!0===e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(w,i):i.isSpriteMaterial?function(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity,t.rotation.value=e.rotation,t.map.value=e.map,null!==e.map&&(!0===e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(w,i):i.isShadowMaterial&&(w.color.value=i.color,w.opacity.value=i.opacity),void 0!==w.ltc_1&&(w.ltc_1.value=te.LTC_1),void 0!==w.ltc_2&&(w.ltc_2.value=te.LTC_2),en.upload(d,r.uniformsList,w,E)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(en.upload(d,r.uniformsList,w,E),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&b.setValue(d,"center",n.center),b.setValue(d,"modelViewMatrix",n.modelViewMatrix),b.setValue(d,"normalMatrix",n.normalMatrix),b.setValue(d,"modelMatrix",n.matrixWorld),x}function _t(t,e){var i;t.opacity.value=e.opacity,e.color&&(t.diffuse.value=e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=v.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}function Tt(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function Ct(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}gt.setAnimationLoop(function(t){ht&&!ht.isPresenting()&&mt&&mt(t)}),void 0!==window&&gt.setContext(window),this.setAnimationLoop=function(t){mt=t,ht.setAnimationLoop(t),gt.start()},this.render=function(t,e){var i,n;if(void 0!==arguments[2]&&(i=arguments[2]),void 0!==arguments[3]&&(n=arguments[3]),e&&e.isCamera&&!D){z.geometry=null,z.program=null,z.wireframe=!1,k=-1,R=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),ht&&ht.enabled&&(e=ht.getCamera(e)),(u=S.get(t,e)).init(),t.onBeforeRender(E,t,e,i||O),nt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),J.setFromMatrix(nt),it=this.localClippingEnabled,tt=$.init(this.clippingPlanes,it,e),(c=M.get(t,e)).init(),vt(t,e,0,E.sortObjects),c.cleanup(),!0===E.sortObjects&&c.sort(),tt&&$.beginShadows();var r=u.state.shadowsArray;lt.render(r,t,e),u.setupLights(e),tt&&$.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),A.render(c,t,e,n);var a=c.opaque,o=c.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;a.length&&yt(a,t,e,s),o.length&&yt(o,t,e,s)}else a.length&&yt(a,t,e),o.length&&yt(o,t,e);null!==O&&(y.updateRenderTargetMipmap(O),y.updateMultisampleRenderTarget(O)),m.buffers.depth.setTest(!0),m.buffers.depth.setMask(!0),m.buffers.color.setMask(!0),m.setPolygonOffset(!1),t.onAfterRender(E,t,e),ht&&ht.enabled&&ht.submitFrame(),c=null,u=null}},this.allocTextureUnit=function(){var t=j;return f.maxTextures,j+=1,t},this.setTexture2D=(ft=!1,function(t,e){t&&t.isWebGLRenderTarget&&(ft||(ft=!0),t=t.texture),y.setTexture2D(t,e)}),this.setTexture3D=function(t,e){y.setTexture3D(t,e)},this.setTexture=function(){var t=!1;return function(e,i){t||(t=!0),y.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?y.setTextureCube(e,i):y.setTextureCubeDynamic(e,i)}}(),this.setFramebuffer=function(t){I=t},this.getRenderTarget=function(){return O},this.setRenderTarget=function(t,e,i){O=t,t&&void 0===v.get(t).__webglFramebuffer&&y.setupRenderTarget(t);var n=I,r=!1;if(t){var a=v.get(t).__webglFramebuffer;t.isWebGLRenderTargetCube?(n=a[e||0],r=!0):n=t.isWebGLMultisampleRenderTarget?v.get(t).__webglMultisampledFramebuffer:a,F.copy(t.viewport),U.copy(t.scissor),G=t.scissorTest}else F.copy(X).multiplyScalar(H),U.copy(q).multiplyScalar(H),G=Z;if(N!==n&&(d.bindFramebuffer(36160,n),N=n),m.viewport(F),m.scissor(U),m.setScissorTest(G),r){var o=v.get(t.texture);d.framebufferTexture2D(36160,36064,34069+e||0,o.__webglTexture,i||0)}},this.readRenderTargetPixels=function(t,e,i,n,r,a){if(t&&t.isWebGLRenderTarget){var o=v.get(t).__webglFramebuffer;if(o){var s=!1;o!==N&&(d.bindFramebuffer(36160,o),s=!0);try{var h=t.texture,l=h.format,c=h.type;if(l!==et&&P.convert(l)!==d.getParameter(35739))return;if(!(c===Y||P.convert(c)===d.getParameter(35738)||c===K&&(f.isWebGL2||p.get("OES_texture_float")||p.get("WEBGL_color_buffer_float"))||c===Q&&(f.isWebGL2?p.get("EXT_color_buffer_float"):p.get("EXT_color_buffer_half_float"))))return;36053===d.checkFramebufferStatus(36160)&&e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&d.readPixels(e,i,n,r,P.convert(l),P.convert(c),a)}finally{s&&d.bindFramebuffer(36160,N)}}}},this.copyFramebufferToTexture=function(t,e,i){var n=e.image.width,r=e.image.height,a=P.convert(e.format);this.setTexture2D(e,0),d.copyTexImage2D(3553,i||0,a,t.x,t.y,n,r,0)},this.copyTextureToTexture=function(t,e,i,n){var r=e.image.width,a=e.image.height,o=P.convert(i.format),s=P.convert(i.type);this.setTexture2D(i,0),e.isDataTexture?d.texSubImage2D(3553,n||0,t.x,t.y,r,a,o,s,e.image.data):d.texSubImage2D(3553,n||0,t.x,t.y,o,s,e.image)}}function qn(t,e){this.name="",this.color=new Qt(t),this.density=void 0!==e?e:25e-5}function Yn(t,e,i){this.name="",this.color=new Qt(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function Zn(){de.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Jn(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Kn(t,e,i,n){this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}function Qn(t){qe.call(this),this.type="SpriteMaterial",this.color=new Qt(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(t)}function $n(t){if(de.call(this),this.type="Sprite",void 0===kn){kn=new Ee;var e=new Jn(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);kn.setIndex([0,1,2,0,2,3]),kn.addAttribute("position",new Kn(e,3,0,!1)),kn.addAttribute("uv",new Kn(e,2,3,!1))}this.geometry=kn,this.material=void 0!==t?t:new Qn,this.center=new St(.5,.5)}function tr(){de.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function er(t,e){t&&t.isGeometry,Qe.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new At,this.bindMatrixInverse=new At}function ir(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{this.boneInverses=[];for(var i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new At)}}function nr(){de.call(this),this.type="Bone"}function rr(t){qe.call(this),this.type="LineBasicMaterial",this.color=new Qt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function ar(t,e,i){de.call(this),this.type="Line",this.geometry=void 0!==t?t:new Ee,this.material=void 0!==e?e:new rr({color:16777215*Math.random()})}function or(t,e){ar.call(this,t,e),this.type="LineSegments"}function sr(t,e){ar.call(this,t,e),this.type="LineLoop"}function hr(t){qe.call(this),this.type="PointsMaterial",this.color=new Qt(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function lr(t,e){de.call(this),this.type="Points",this.geometry=void 0!==t?t:new Ee,this.material=void 0!==e?e:new hr({color:16777215*Math.random()})}function cr(t,e,i,n,r,a,o,s,h){Nt.call(this,t,e,i,n,r,a,o,s,h),this.format=void 0!==o?o:tt,this.minFilter=void 0!==a?a:H,this.magFilter=void 0!==r?r:H,this.generateMipmaps=!1}function ur(t,e,i,n,r,a,o,s,h,l,c,u){Nt.call(this,null,a,o,s,h,l,n,r,c,u),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function dr(t,e,i,n,r,a,o,s,h){Nt.call(this,t,e,i,n,r,a,o,s,h),this.needsUpdate=!0}function pr(t,e,i,n,r,a,o,s,h,l){if((l=void 0!==l?l:it)!==it&&l!==nt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&l===it&&(i=Z),void 0===i&&l===nt&&(i=$),Nt.call(this,null,n,r,a,o,s,l,i,h),this.image={width:t,height:e},this.magFilter=void 0!==o?o:j,this.minFilter=void 0!==s?s:j,this.flipY=!1,this.generateMipmaps=!1}function fr(t){Ee.call(this),this.type="WireframeGeometry";var e,i,n,r,a,o,s,h,l,c,u=[],d=[0,0],p={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,n=m.length;e<n;e++){var g=m[e];for(i=0;i<3;i++)s=g[f[i]],h=g[f[(i+1)%3]],d[0]=Math.min(s,h),d[1]=Math.max(s,h),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]})}for(l in p)o=p[l],c=t.vertices[o.index1],u.push(c.x,c.y,c.z),c=t.vertices[o.index2],u.push(c.x,c.y,c.z)}else if(t&&t.isBufferGeometry){var v,y,x,b,w,_,M;if(c=new Lt,null!==t.index){for(v=t.attributes.position,y=t.index,0===(x=t.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),r=0,a=x.length;r<a;++r)for(e=w=(b=x[r]).start,n=w+b.count;e<n;e+=3)for(i=0;i<3;i++)s=y.getX(e+i),h=y.getX(e+(i+1)%3),d[0]=Math.min(s,h),d[1]=Math.max(s,h),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]});for(l in p)o=p[l],c.fromBufferAttribute(v,o.index1),u.push(c.x,c.y,c.z),c.fromBufferAttribute(v,o.index2),u.push(c.x,c.y,c.z)}else for(e=0,n=(v=t.attributes.position).count/3;e<n;e++)for(i=0;i<3;i++)_=3*e+i,c.fromBufferAttribute(v,_),u.push(c.x,c.y,c.z),M=3*e+(i+1)%3,c.fromBufferAttribute(v,M),u.push(c.x,c.y,c.z)}this.addAttribute("position",new Ae(u,3))}function mr(t,e,i){ge.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i},this.fromBufferGeometry(new gr(t,e,i)),this.mergeVertices()}function gr(t,e,i){Ee.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:i};var n,r,a=[],o=[],s=[],h=[],l=1e-5,c=new Lt,u=new Lt,d=new Lt,p=new Lt,f=new Lt;t.length;var m=e+1;for(n=0;n<=i;n++){var g=n/i;for(r=0;r<=e;r++){var v=r/e;t(v,g,u),o.push(u.x,u.y,u.z),v-l>=0?(t(v-l,g,d),p.subVectors(u,d)):(t(v+l,g,d),p.subVectors(d,u)),g-l>=0?(t(v,g-l,d),f.subVectors(u,d)):(t(v,g+l,d),f.subVectors(d,u)),c.crossVectors(p,f).normalize(),s.push(c.x,c.y,c.z),h.push(v,g)}}for(n=0;n<i;n++)for(r=0;r<e;r++){var y=n*m+r,x=n*m+r+1,b=(n+1)*m+r+1,w=(n+1)*m+r;a.push(y,x,w),a.push(x,b,w)}this.setIndex(a),this.addAttribute("position",new Ae(o,3)),this.addAttribute("normal",new Ae(s,3)),this.addAttribute("uv",new Ae(h,2))}function vr(t,e,i,n){ge.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},this.fromBufferGeometry(new yr(t,e,i,n)),this.mergeVertices()}function yr(t,e,i,n){Ee.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},i=i||1;var r=[],a=[];function o(t,e,i,n){var r,a,o=Math.pow(2,n),h=[];for(r=0;r<=o;r++){h[r]=[];var l=t.clone().lerp(i,r/o),c=e.clone().lerp(i,r/o),u=o-r;for(a=0;a<=u;a++)h[r][a]=0===a&&r===o?l:l.clone().lerp(c,a/u)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var d=Math.floor(a/2);a%2==0?(s(h[r][d+1]),s(h[r+1][d]),s(h[r][d])):(s(h[r][d+1]),s(h[r+1][d+1]),s(h[r+1][d]))}}function s(t){r.push(t.x,t.y,t.z)}function h(e,i){var n=3*e;i.x=t[n+0],i.y=t[n+1],i.z=t[n+2]}function l(t,e,i,n){n<0&&1===t.x&&(a[e]=t.x-1),0===i.x&&0===i.z&&(a[e]=n/2/Math.PI+.5)}function c(t){return Math.atan2(t.z,-t.x)}function u(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}!function(t){for(var i=new Lt,n=new Lt,r=new Lt,a=0;a<e.length;a+=3)h(e[a+0],i),h(e[a+1],n),h(e[a+2],r),o(i,n,r,t)}(n=n||0),function(t){for(var e=new Lt,i=0;i<r.length;i+=3)e.x=r[i+0],e.y=r[i+1],e.z=r[i+2],e.normalize().multiplyScalar(t),r[i+0]=e.x,r[i+1]=e.y,r[i+2]=e.z}(i),function(){for(var t=new Lt,e=0;e<r.length;e+=3){t.x=r[e+0],t.y=r[e+1],t.z=r[e+2];var i=c(t)/2/Math.PI+.5,n=u(t)/Math.PI+.5;a.push(i,1-n)}(function(){for(var t=new Lt,e=new Lt,i=new Lt,n=new Lt,o=new St,s=new St,h=new St,u=0,d=0;u<r.length;u+=9,d+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),i.set(r[u+6],r[u+7],r[u+8]),o.set(a[d+0],a[d+1]),s.set(a[d+2],a[d+3]),h.set(a[d+4],a[d+5]),n.copy(t).add(e).add(i).divideScalar(3);var p=c(n);l(o,d+0,t,p),l(s,d+2,e,p),l(h,d+4,i,p)}})(),function(){for(var t=0;t<a.length;t+=6){var e=a[t+0],i=a[t+2],n=a[t+4],r=Math.max(e,i,n),o=Math.min(e,i,n);r>.9&&o<.1&&(e<.2&&(a[t+0]+=1),i<.2&&(a[t+2]+=1),n<.2&&(a[t+4]+=1))}}()}(),this.addAttribute("position",new Ae(r,3)),this.addAttribute("normal",new Ae(r.slice(),3)),this.addAttribute("uv",new Ae(a,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}function xr(t,e){ge.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new br(t,e)),this.mergeVertices()}function br(t,e){yr.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function wr(t,e){ge.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new _r(t,e)),this.mergeVertices()}function _r(t,e){yr.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Mr(t,e){ge.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Sr(t,e)),this.mergeVertices()}function Sr(t,e){var i=(1+Math.sqrt(5))/2,n=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1];yr.call(this,n,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ar(t,e){ge.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Tr(t,e)),this.mergeVertices()}function Tr(t,e){var i=(1+Math.sqrt(5))/2,n=1/i,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n];yr.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Lr(t,e,i,n,r,a){ge.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r};var o=new Cr(t,e,i,n,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Cr(t,e,i,n,r){Ee.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},e=e||64,i=i||1,n=n||8,r=r||!1;var a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,h=new Lt,l=new Lt,c=new St,u=new Lt,d=[],p=[],f=[],m=[];function g(r){u=t.getPointAt(r/e,u);var o=a.normals[r],c=a.binormals[r];for(s=0;s<=n;s++){var f=s/n*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);l.x=g*o.x+m*c.x,l.y=g*o.y+m*c.y,l.z=g*o.z+m*c.z,l.normalize(),p.push(l.x,l.y,l.z),h.x=u.x+i*l.x,h.y=u.y+i*l.y,h.z=u.z+i*l.z,d.push(h.x,h.y,h.z)}}!function(){for(o=0;o<e;o++)g(o);g(!1===r?e:0),function(){for(o=0;o<=e;o++)for(s=0;s<=n;s++)c.x=o/e,c.y=s/n,f.push(c.x,c.y)}(),function(){for(s=1;s<=e;s++)for(o=1;o<=n;o++){var t=(n+1)*(s-1)+(o-1),i=(n+1)*s+(o-1),r=(n+1)*s+o,a=(n+1)*(s-1)+o;m.push(t,i,a),m.push(i,r,a)}}()}(),this.setIndex(m),this.addAttribute("position",new Ae(d,3)),this.addAttribute("normal",new Ae(p,3)),this.addAttribute("uv",new Ae(f,2))}function Pr(t,e,i,n,r,a,o){ge.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},this.fromBufferGeometry(new Er(t,e,i,n,r,a)),this.mergeVertices()}function Er(t,e,i,n,r,a){Ee.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},t=t||1,e=e||.4,i=Math.floor(i)||64,n=Math.floor(n)||8,r=r||2,a=a||3;var o,s,h=[],l=[],c=[],u=[],d=new Lt,p=new Lt,f=new Lt,m=new Lt,g=new Lt,v=new Lt,y=new Lt;for(o=0;o<=i;++o){var x=o/i*r*Math.PI*2;for(L(x,r,a,t,f),L(x+.01,r,a,t,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=n;++s){var b=s/n*Math.PI*2,w=-e*Math.cos(b),_=e*Math.sin(b);d.x=f.x+(w*y.x+_*g.x),d.y=f.y+(w*y.y+_*g.y),d.z=f.z+(w*y.z+_*g.z),l.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),c.push(p.x,p.y,p.z),u.push(o/i),u.push(s/n)}}for(s=1;s<=i;s++)for(o=1;o<=n;o++){var M=(n+1)*(s-1)+(o-1),S=(n+1)*s+(o-1),A=(n+1)*s+o,T=(n+1)*(s-1)+o;h.push(M,S,T),h.push(S,A,T)}function L(t,e,i,n,r){var a=Math.cos(t),o=Math.sin(t),s=i/e*t,h=Math.cos(s);r.x=n*(2+h)*.5*a,r.y=n*(2+h)*o*.5,r.z=n*Math.sin(s)*.5}this.setIndex(h),this.addAttribute("position",new Ae(l,3)),this.addAttribute("normal",new Ae(c,3)),this.addAttribute("uv",new Ae(u,2))}function Dr(t,e,i,n,r){ge.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new Ir(t,e,i,n,r)),this.mergeVertices()}function Ir(t,e,i,n,r){Ee.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||1,e=e||.4,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var a,o,s=[],h=[],l=[],c=[],u=new Lt,d=new Lt,p=new Lt;for(a=0;a<=i;a++)for(o=0;o<=n;o++){var f=o/n*r,m=a/i*Math.PI*2;d.x=(t+e*Math.cos(m))*Math.cos(f),d.y=(t+e*Math.cos(m))*Math.sin(f),d.z=e*Math.sin(m),h.push(d.x,d.y,d.z),u.x=t*Math.cos(f),u.y=t*Math.sin(f),p.subVectors(d,u).normalize(),l.push(p.x,p.y,p.z),c.push(o/n),c.push(a/i)}for(a=1;a<=i;a++)for(o=1;o<=n;o++){var g=(n+1)*a+o-1,v=(n+1)*(a-1)+o-1,y=(n+1)*(a-1)+o,x=(n+1)*a+o;s.push(g,v,x),s.push(v,y,x)}this.setIndex(s),this.addAttribute("position",new Ae(h,3)),this.addAttribute("normal",new Ae(l,3)),this.addAttribute("uv",new Ae(c,2))}Object.assign(qn.prototype,{isFogExp2:!0,clone:function(){return new qn(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Yn.prototype,{isFog:!0,clone:function(){return new Yn(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Zn.prototype=Object.assign(Object.create(de.prototype),{constructor:Zn,isScene:!0,copy:function(t,e){return de.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=de.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Jn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Jn.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.stride:0,this.array=t,this},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.stride,i*=e.stride;for(var n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Object.defineProperties(Kn.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Kn.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}}),Qn.prototype=Object.create(qe.prototype),Qn.prototype.constructor=Qn,Qn.prototype.isSpriteMaterial=!0,Qn.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this},$n.prototype=Object.assign(Object.create(de.prototype),{constructor:$n,isSprite:!0,raycast:function(){var t=new Lt,e=new Lt,i=new Lt,n=new St,r=new St,a=new At,o=new Lt,s=new Lt,h=new Lt,l=new St,c=new St,u=new St;function d(t,e,i,o,s,h){n.subVectors(t,i).addScalar(.5).multiply(o),void 0!==s?(r.x=h*n.x-s*n.y,r.y=s*n.x+h*n.y):r.copy(n),t.copy(e),t.x+=r.x,t.y+=r.y,t.applyMatrix4(a)}return function(n,r){e.setFromMatrixScale(this.matrixWorld),a.getInverse(this.modelViewMatrix).premultiply(this.matrixWorld),i.setFromMatrixPosition(this.modelViewMatrix);var p,f,m=this.material.rotation;0!==m&&(f=Math.cos(m),p=Math.sin(m));var g=this.center;d(o.set(-.5,-.5,0),i,g,e,p,f),d(s.set(.5,-.5,0),i,g,e,p,f),d(h.set(.5,.5,0),i,g,e,p,f),l.set(0,0),c.set(1,0),u.set(1,1);var v=n.ray.intersectTriangle(o,s,h,!1,t);if(null!==v||(d(s.set(-.5,.5,0),i,g,e,p,f),c.set(0,1),null!==(v=n.ray.intersectTriangle(o,h,s,!1,t)))){var y=n.ray.origin.distanceTo(t);y<n.near||y>n.far||r.push({distance:y,point:t.clone(),uv:Je.getUV(t,o,s,h,l,c,u,new St),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return de.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),tr.prototype=Object.assign(Object.create(de.prototype),{constructor:tr,copy:function(t){de.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i<n;i++){var r=e[i];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var i=this.levels,n=0;n<i.length&&!(e<i[n].distance);n++);i.splice(n,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,i=1,n=e.length;i<n&&!(t<e[i].distance);i++);return e[i-1].object},raycast:(zn=new Lt,function(t,e){zn.setFromMatrixPosition(this.matrixWorld);var i=t.ray.origin.distanceTo(zn);this.getObjectForDistance(i).raycast(t,e)}),update:function(){var t=new Lt,e=new Lt;return function(i){var n=this.levels;if(n.length>1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);n[0].object.visible=!0;for(var a=1,o=n.length;a<o&&r>=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;a<o;a++)n[a].object.visible=!1}}}(),toJSON:function(t){var e=de.prototype.toJSON.call(this,t);e.object.levels=[];for(var i=this.levels,n=0,r=i.length;n<r;n++){var a=i[n];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}}),er.prototype=Object.assign(Object.create(Qe.prototype),{constructor:er,isSkinnedMesh:!0,bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var t=new kt,e=this.geometry.attributes.skinWeight,i=0,n=e.count;i<n;i++){t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.w=e.getW(i);var r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){Qe.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode&&this.bindMatrixInverse.getInverse(this.bindMatrix)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Object.assign(ir.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var i=new At;this.bones[t]&&i.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(i)}},pose:function(){var t,e,i;for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:(Rn=new At,Bn=new At,function(){for(var t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture,r=0,a=t.length;r<a;r++){var o=t[r]?t[r].matrixWorld:Bn;Rn.multiplyMatrices(o,e[r]),Rn.toArray(i,16*r)}void 0!==n&&(n.needsUpdate=!0)}),clone:function(){return new ir(this.bones,this.boneInverses)},getBoneByName:function(t){for(var e=0,i=this.bones.length;e<i;e++){var n=this.bones[e];if(n.name===t)return n}}}),nr.prototype=Object.assign(Object.create(de.prototype),{constructor:nr,isBone:!0}),rr.prototype=Object.create(qe.prototype),rr.prototype.constructor=rr,rr.prototype.isLineBasicMaterial=!0,rr.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},ar.prototype=Object.assign(Object.create(de.prototype),{constructor:ar,isLine:!0,computeLineDistances:(Fn=new Lt,Un=new Lt,function(){var t=this.geometry;if(t.isBufferGeometry){if(null===t.index){for(var e=t.attributes.position,i=[0],n=1,r=e.count;n<r;n++)Fn.fromBufferAttribute(e,n-1),Un.fromBufferAttribute(e,n),i[n]=i[n-1],i[n]+=Fn.distanceTo(Un);t.addAttribute("lineDistance",new Ae(i,1))}}else if(t.isGeometry){var a=t.vertices;for((i=t.lineDistances)[0]=0,n=1,r=a.length;n<r;n++)i[n]=i[n-1],i[n]+=a[n-1].distanceTo(a[n])}return this}),raycast:function(){var t=new At,e=new Ze,i=new Gt;return function(n,r){var a=n.linePrecision,o=this.geometry,s=this.matrixWorld;if(null===o.boundingSphere&&o.computeBoundingSphere(),i.copy(o.boundingSphere),i.applyMatrix4(s),i.radius+=a,!1!==n.ray.intersectsSphere(i)){t.getInverse(s),e.copy(n.ray).applyMatrix4(t);var h=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,c=new Lt,u=new Lt,d=new Lt,p=new Lt,f=this&&this.isLineSegments?2:1;if(o.isBufferGeometry){var m=o.index,g=o.attributes.position.array;if(null!==m)for(var v=m.array,y=0,x=v.length-1;y<x;y+=f){var b=v[y],w=v[y+1];c.fromArray(g,3*b),u.fromArray(g,3*w),e.distanceSqToSegment(c,u,p,d)>l||(p.applyMatrix4(this.matrixWorld),(S=n.ray.origin.distanceTo(p))<n.near||S>n.far||r.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}))}else for(y=0,x=g.length/3-1;y<x;y+=f)c.fromArray(g,3*y),u.fromArray(g,3*y+3),e.distanceSqToSegment(c,u,p,d)>l||(p.applyMatrix4(this.matrixWorld),(S=n.ray.origin.distanceTo(p))<n.near||S>n.far||r.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}))}else if(o.isGeometry){var _=o.vertices,M=_.length;for(y=0;y<M-1;y+=f){var S;e.distanceSqToSegment(_[y],_[y+1],p,d)>l||(p.applyMatrix4(this.matrixWorld),(S=n.ray.origin.distanceTo(p))<n.near||S>n.far||r.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}))}}}}}(),copy:function(t){return de.prototype.copy.call(this,t),this.geometry.copy(t.geometry),this.material.copy(t.material),this},clone:function(){return(new this.constructor).copy(this)}}),or.prototype=Object.assign(Object.create(ar.prototype),{constructor:or,isLineSegments:!0,computeLineDistances:function(){var t=new Lt,e=new Lt;return function(){var i=this.geometry;if(i.isBufferGeometry){if(null===i.index){for(var n=i.attributes.position,r=[],a=0,o=n.count;a<o;a+=2)t.fromBufferAttribute(n,a),e.fromBufferAttribute(n,a+1),r[a]=0===a?0:r[a-1],r[a+1]=r[a]+t.distanceTo(e);i.addAttribute("lineDistance",new Ae(r,1))}}else if(i.isGeometry){var s=i.vertices;for(r=i.lineDistances,a=0,o=s.length;a<o;a+=2)t.copy(s[a]),e.copy(s[a+1]),r[a]=0===a?0:r[a-1],r[a+1]=r[a]+t.distanceTo(e)}return this}}()}),sr.prototype=Object.assign(Object.create(ar.prototype),{constructor:sr,isLineLoop:!0}),hr.prototype=Object.create(qe.prototype),hr.prototype.constructor=hr,hr.prototype.isPointsMaterial=!0,hr.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this},lr.prototype=Object.assign(Object.create(de.prototype),{constructor:lr,isPoints:!0,raycast:function(){var t=new At,e=new Ze,i=new Gt;return function(n,r){var a=this,o=this.geometry,s=this.matrixWorld,h=n.params.Points.threshold;if(null===o.boundingSphere&&o.computeBoundingSphere(),i.copy(o.boundingSphere),i.applyMatrix4(s),i.radius+=h,!1!==n.ray.intersectsSphere(i)){t.getInverse(s),e.copy(n.ray).applyMatrix4(t);var l=h/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,u=new Lt,d=new Lt;if(o.isBufferGeometry){var p=o.index,f=o.attributes.position.array;if(null!==p)for(var m=p.array,g=0,v=m.length;g<v;g++){var y=m[g];u.fromArray(f,3*y),w(u,y)}else{g=0;for(var x=f.length/3;g<x;g++)u.fromArray(f,3*g),w(u,g)}}else{var b=o.vertices;for(g=0,x=b.length;g<x;g++)w(b[g],g)}}function w(t,i){var o=e.distanceSqToPoint(t);if(o<c){e.closestPointToPoint(t,d),d.applyMatrix4(s);var h=n.ray.origin.distanceTo(d);if(h<n.near||h>n.far)return;r.push({distance:h,distanceToRay:Math.sqrt(o),point:d.clone(),index:i,face:null,object:a})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),cr.prototype=Object.assign(Object.create(Nt.prototype),{constructor:cr,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),ur.prototype=Object.create(Nt.prototype),ur.prototype.constructor=ur,ur.prototype.isCompressedTexture=!0,dr.prototype=Object.create(Nt.prototype),dr.prototype.constructor=dr,dr.prototype.isCanvasTexture=!0,pr.prototype=Object.create(Nt.prototype),pr.prototype.constructor=pr,pr.prototype.isDepthTexture=!0,fr.prototype=Object.create(Ee.prototype),fr.prototype.constructor=fr,mr.prototype=Object.create(ge.prototype),mr.prototype.constructor=mr,gr.prototype=Object.create(Ee.prototype),gr.prototype.constructor=gr,vr.prototype=Object.create(ge.prototype),vr.prototype.constructor=vr,yr.prototype=Object.create(Ee.prototype),yr.prototype.constructor=yr,xr.prototype=Object.create(ge.prototype),xr.prototype.constructor=xr,br.prototype=Object.create(yr.prototype),br.prototype.constructor=br,wr.prototype=Object.create(ge.prototype),wr.prototype.constructor=wr,_r.prototype=Object.create(yr.prototype),_r.prototype.constructor=_r,Mr.prototype=Object.create(ge.prototype),Mr.prototype.constructor=Mr,Sr.prototype=Object.create(yr.prototype),Sr.prototype.constructor=Sr,Ar.prototype=Object.create(ge.prototype),Ar.prototype.constructor=Ar,Tr.prototype=Object.create(yr.prototype),Tr.prototype.constructor=Tr,Lr.prototype=Object.create(ge.prototype),Lr.prototype.constructor=Lr,Cr.prototype=Object.create(Ee.prototype),Cr.prototype.constructor=Cr,Cr.prototype.toJSON=function(){var t=Ee.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},Pr.prototype=Object.create(ge.prototype),Pr.prototype.constructor=Pr,Er.prototype=Object.create(Ee.prototype),Er.prototype.constructor=Er,Dr.prototype=Object.create(ge.prototype),Dr.prototype.constructor=Dr,Ir.prototype=Object.create(Ee.prototype),Ir.prototype.constructor=Ir;var Or=function(t,e,i){i=i||2;var n,r,a,o,s,h,l,c=e&&e.length,u=c?e[0]*i:t.length,d=Nr(t,0,u,i,!0),p=[];if(!d)return p;if(c&&(d=function(t,e,i,n){var r,a,o,s=[];for(r=0,a=e.length;r<a;r++)(o=Nr(t,e[r]*n,r<a-1?e[r+1]*n:t.length,n,!1))===o.next&&(o.steiner=!0),s.push(Wr(o));for(s.sort(Gr),r=0;r<s.length;r++)jr(s[r],i),i=kr(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=a=t[0],r=o=t[1];for(var f=i;f<u;f+=i)(s=t[f])<n&&(n=s),(h=t[f+1])<r&&(r=h),s>a&&(a=s),h>o&&(o=h);l=0!==(l=Math.max(a-n,o-r))?1/l:0}return zr(d,p,i,n,r,l),p};function Nr(t,e,i,n,r){var a,o;if(r===function(t,e,i,n){for(var r=0,a=e,o=i-n;a<i;a+=n)r+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return r}(t,e,i,n)>0)for(a=e;a<i;a+=n)o=Qr(a,t[a],t[a+1],o);else for(a=i-n;a>=e;a-=n)o=Qr(a,t[a],t[a+1],o);return o&&Yr(o,o.next)&&($r(o),o=o.next),o}function kr(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Yr(n,n.next)&&0!==qr(n.prev,n,n.next))n=n.next;else{if($r(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function zr(t,e,i,n,r,a,o){if(t){!o&&a&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=Vr(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,a,o,s,h,l=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,n=i,s=0,e=0;e<l&&(s++,n=n.nextZ);e++);for(h=l;s>0||h>0&&n;)0!==s&&(0===h||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,h--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;i=n}a.nextZ=null,l*=2}while(o>1)}(r)}(t,n,r,a);for(var s,h,l=t;t.prev!==t.next;)if(s=t.prev,h=t.next,a?Br(t,n,r,a):Rr(t))e.push(s.i/i),e.push(t.i/i),e.push(h.i/i),$r(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?zr(t=Fr(t,e,i),e,i,n,r,a,2):2===o&&Ur(t,e,i,n,r,a):zr(kr(t),e,i,n,r,a,1);break}}}function Rr(t){var e=t.prev,i=t,n=t.next;if(qr(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(Hr(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&qr(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Br(t,e,i,n){var r=t.prev,a=t,o=t.next;if(qr(r,a,o)>=0)return!1;for(var s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,h=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,l=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,c=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,u=Vr(s,h,e,i,n),d=Vr(l,c,e,i,n),p=t.nextZ;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&Hr(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&qr(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=t.prevZ;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&Hr(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&qr(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function Fr(t,e,i){var n=t;do{var r=n.prev,a=n.next.next;!Yr(r,a)&&Zr(r,n,n.next,a)&&Jr(r,a)&&Jr(a,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(a.i/i),$r(n),$r(n.next),n=t=a),n=n.next}while(n!==t);return n}function Ur(t,e,i,n,r,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Xr(o,s)){var h=Kr(o,s);return o=kr(o,o.next),h=kr(h,h.next),zr(o,e,i,n,r,a),void zr(h,e,i,n,r,a)}s=s.next}o=o.next}while(o!==t)}function Gr(t,e){return t.x-e.x}function jr(t,e){if(e=function(t,e){var i,n=e,r=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>o){if(o=s,s===r){if(a===n.y)return n;if(a===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!i)return null;if(r===o)return i.prev;var h,l=i,c=i.x,u=i.y,d=1/0;for(n=i.next;n!==l;)r>=n.x&&n.x>=c&&r!==n.x&&Hr(a<u?r:o,a,c,u,a<u?o:r,a,n.x,n.y)&&((h=Math.abs(a-n.y)/(r-n.x))<d||h===d&&n.x>i.x)&&Jr(n,t)&&(i=n,d=h),n=n.next;return i}(t,e),e){var i=Kr(e,t);kr(i,i.next)}}function Vr(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Wr(t){var e=t,i=t;do{e.x<i.x&&(i=e),e=e.next}while(e!==t);return i}function Hr(t,e,i,n,r,a,o,s){return(r-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(n-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(r-o)*(n-s)>=0}function Xr(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Zr(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&Jr(t,e)&&Jr(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function qr(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Yr(t,e){return t.x===e.x&&t.y===e.y}function Zr(t,e,i,n){return!!(Yr(t,e)&&Yr(i,n)||Yr(t,n)&&Yr(i,e))||qr(t,e,i)>0!=qr(t,e,n)>0&&qr(i,n,t)>0!=qr(i,n,e)>0}function Jr(t,e){return qr(t.prev,t,t.next)<0?qr(t,e,t.next)>=0&&qr(t,t.prev,e)>=0:qr(t,e,t.prev)<0||qr(t,t.next,e)<0}function Kr(t,e){var i=new ta(t.i,t.x,t.y),n=new ta(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,a.next=n,n.prev=a,n}function Qr(t,e,i,n){var r=new ta(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $r(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 ta(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ea={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},isClockWise:function(t){return ea.area(t)<0},triangulateShape:function(t,e){var i=[],n=[],r=[];ia(t),na(i,t);var a=t.length;e.forEach(ia);for(var o=0;o<e.length;o++)n.push(a),a+=e[o].length,na(i,e[o]);var s=Or(i,n);for(o=0;o<s.length;o+=3)r.push(s.slice(o,o+3));return r}};function ia(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function na(t,e){for(var i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}function ra(t,e){ge.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new aa(t,e)),this.mergeVertices()}function aa(t,e){Ee.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];for(var i=this,n=[],r=[],a=0,o=t.length;a<o;a++)s(t[a]);function s(t){var a=[],o=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1,h=void 0!==e.depth?e.depth:100,l=void 0===e.bevelEnabled||e.bevelEnabled,c=void 0!==e.bevelThickness?e.bevelThickness:6,u=void 0!==e.bevelSize?e.bevelSize:c-2,d=void 0!==e.bevelSegments?e.bevelSegments:3,p=e.extrudePath,f=void 0!==e.UVGenerator?e.UVGenerator:oa;void 0!==e.amount&&(h=e.amount);var m,g,v,y,x,b,w,_,M=!1;p&&(m=p.getSpacedPoints(s),M=!0,l=!1,g=p.computeFrenetFrames(s,!1),v=new Lt,y=new Lt,x=new Lt),l||(d=0,c=0,u=0);var S=t.extractPoints(o),A=S.shape,T=S.holes;if(!ea.isClockWise(A))for(A=A.reverse(),w=0,_=T.length;w<_;w++)b=T[w],ea.isClockWise(b)&&(T[w]=b.reverse());var L=ea.triangulateShape(A,T),C=A;for(w=0,_=T.length;w<_;w++)b=T[w],A=A.concat(b);function P(t,e,i){return e.clone().multiplyScalar(i).add(t)}var E,D,I,O,N,k,z=A.length,R=L.length;function B(t,e,i){var n,r,a,o=t.x-e.x,s=t.y-e.y,h=i.x-t.x,l=i.y-t.y,c=o*o+s*s,u=o*l-s*h;if(Math.abs(u)>Number.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(h*h+l*l),f=e.x-s/d,m=e.y+o/d,g=((i.x-l/p-f)*l-(i.y+h/p-m)*h)/(o*l-s*h),v=(n=f+o*g-t.x)*n+(r=m+s*g-t.y)*r;if(v<=2)return new St(n,r);a=Math.sqrt(v/2)}else{var y=!1;o>Number.EPSILON?h>Number.EPSILON&&(y=!0):o<-Number.EPSILON?h<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(n=-s,r=o,a=Math.sqrt(c)):(n=o,r=s,a=Math.sqrt(c/2))}return new St(n/a,r/a)}for(var F=[],U=0,G=C.length,j=G-1,V=U+1;U<G;U++,j++,V++)j===G&&(j=0),V===G&&(V=0),F[U]=B(C[U],C[j],C[V]);var W,H,X=[],q=F.concat();for(w=0,_=T.length;w<_;w++){for(b=T[w],W=[],U=0,j=(G=b.length)-1,V=U+1;U<G;U++,j++,V++)j===G&&(j=0),V===G&&(V=0),W[U]=B(b[U],b[j],b[V]);X.push(W),q=q.concat(W)}for(E=0;E<d;E++){for(I=E/d,O=c*Math.cos(I*Math.PI/2),D=u*Math.sin(I*Math.PI/2),U=0,G=C.length;U<G;U++)Z((N=P(C[U],F[U],D)).x,N.y,-O);for(w=0,_=T.length;w<_;w++)for(b=T[w],W=X[w],U=0,G=b.length;U<G;U++)Z((N=P(b[U],W[U],D)).x,N.y,-O)}for(D=u,U=0;U<z;U++)N=l?P(A[U],q[U],D):A[U],M?(y.copy(g.normals[0]).multiplyScalar(N.x),v.copy(g.binormals[0]).multiplyScalar(N.y),x.copy(m[0]).add(y).add(v),Z(x.x,x.y,x.z)):Z(N.x,N.y,0);for(H=1;H<=s;H++)for(U=0;U<z;U++)N=l?P(A[U],q[U],D):A[U],M?(y.copy(g.normals[H]).multiplyScalar(N.x),v.copy(g.binormals[H]).multiplyScalar(N.y),x.copy(m[H]).add(y).add(v),Z(x.x,x.y,x.z)):Z(N.x,N.y,h/s*H);for(E=d-1;E>=0;E--){for(I=E/d,O=c*Math.cos(I*Math.PI/2),D=u*Math.sin(I*Math.PI/2),U=0,G=C.length;U<G;U++)Z((N=P(C[U],F[U],D)).x,N.y,h+O);for(w=0,_=T.length;w<_;w++)for(b=T[w],W=X[w],U=0,G=b.length;U<G;U++)N=P(b[U],W[U],D),M?Z(N.x,N.y+m[s-1].y,m[s-1].x+O):Z(N.x,N.y,h+O)}function Y(t,e){var i,n;for(U=t.length;--U>=0;){i=U,(n=U-1)<0&&(n=t.length-1);var r=0,a=s+2*d;for(r=0;r<a;r++){var o=z*r,h=z*(r+1);K(e+i+o,e+n+o,e+n+h,e+i+h)}}}function Z(t,e,i){a.push(t),a.push(e),a.push(i)}function J(t,e,r){Q(t),Q(e),Q(r);var a=n.length/3,o=f.generateTopUV(i,n,a-3,a-2,a-1);$(o[0]),$(o[1]),$(o[2])}function K(t,e,r,a){Q(t),Q(e),Q(a),Q(e),Q(r),Q(a);var o=n.length/3,s=f.generateSideWallUV(i,n,o-6,o-3,o-2,o-1);$(s[0]),$(s[1]),$(s[3]),$(s[1]),$(s[2]),$(s[3])}function Q(t){n.push(a[3*t+0]),n.push(a[3*t+1]),n.push(a[3*t+2])}function $(t){r.push(t.x),r.push(t.y)}!function(){var t=n.length/3;if(l){var r;for(r=z*(s+2*d),U=0;U<R;U++)J((k=L[U])[0]+r,k[1]+r,k[2]+r)}else if(!1!==e.hasTop)for(U=0;U<R;U++)J((k=L[U])[0]+z*s,k[1]+z*s,k[2]+z*s);i.addGroup(t,n.length/3-t,0)}(),function(){var t=n.length/3,e=0;for(Y(C,e),e+=C.length,w=0,_=T.length;w<_;w++)Y(b=T[w],e),e+=b.length;i.addGroup(t,n.length/3-t,1)}()}this.addAttribute("position",new Ae(n,3)),this.addAttribute("uv",new Ae(r,2)),this.computeVertexNormals()}ra.prototype=Object.create(ge.prototype),ra.prototype.constructor=ra,ra.prototype.toJSON=function(){var t=ge.prototype.toJSON.call(this);return sa(this.parameters.shapes,this.parameters.options,t)},aa.prototype=Object.create(Ee.prototype),aa.prototype.constructor=aa,aa.prototype.toJSON=function(){var t=Ee.prototype.toJSON.call(this);return sa(this.parameters.shapes,this.parameters.options,t)};var oa={generateTopUV:function(t,e,i,n,r){var a=e[3*i],o=e[3*i+1],s=e[3*n],h=e[3*n+1],l=e[3*r],c=e[3*r+1];return[new St(a,o),new St(s,h),new St(l,c)]},generateSideWallUV:function(t,e,i,n,r,a){var o=e[3*i],s=e[3*i+1],h=e[3*i+2],l=e[3*n],c=e[3*n+1],u=e[3*n+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*a],g=e[3*a+1],v=e[3*a+2];return Math.abs(s-c)<.01?[new St(o,1-h),new St(l,1-u),new St(d,1-f),new St(m,1-v)]:[new St(s,1-h),new St(c,1-u),new St(p,1-f),new St(g,1-v)]}};function sa(t,e,i){if(i.shapes=[],Array.isArray(t))for(var n=0,r=t.length;n<r;n++){var a=t[n];i.shapes.push(a.uuid)}else i.shapes.push(t.uuid);return void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}function ha(t,e){ge.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new la(t,e)),this.mergeVertices()}function la(t,e){var i=(e=e||{}).font;if(!i||!i.isFont)return new ge;var n=i.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),aa.call(this,n,e),this.type="TextBufferGeometry"}function ca(t,e,i,n,r,a,o){ge.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new ua(t,e,i,n,r,a,o)),this.mergeVertices()}function ua(t,e,i,n,r,a,o){Ee.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},t=t||1,e=Math.max(3,Math.floor(e)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var s,h,l=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),c=0,u=[],d=new Lt,p=new Lt,f=[],m=[],g=[],v=[];for(h=0;h<=i;h++){var y=[],x=h/i;for(s=0;s<=e;s++){var b=s/e;d.x=-t*Math.cos(n+b*r)*Math.sin(a+x*o),d.y=t*Math.cos(a+x*o),d.z=t*Math.sin(n+b*r)*Math.sin(a+x*o),m.push(d.x,d.y,d.z),p.set(d.x,d.y,d.z).normalize(),g.push(p.x,p.y,p.z),v.push(b,1-x),y.push(c++)}u.push(y)}for(h=0;h<i;h++)for(s=0;s<e;s++){var w=u[h][s+1],_=u[h][s],M=u[h+1][s],S=u[h+1][s+1];(0!==h||a>0)&&f.push(w,_,S),(h!==i-1||l<Math.PI)&&f.push(_,M,S)}this.setIndex(f),this.addAttribute("position",new Ae(m,3)),this.addAttribute("normal",new Ae(g,3)),this.addAttribute("uv",new Ae(v,2))}function da(t,e,i,n,r,a){ge.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new pa(t,e,i,n,r,a)),this.mergeVertices()}function pa(t,e,i,n,r,a){Ee.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},t=t||.5,e=e||1,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,i=void 0!==i?Math.max(3,i):8;var o,s,h,l=[],c=[],u=[],d=[],p=t,f=(e-t)/(n=void 0!==n?Math.max(1,n):1),m=new Lt,g=new St;for(s=0;s<=n;s++){for(h=0;h<=i;h++)o=r+h/i*a,m.x=p*Math.cos(o),m.y=p*Math.sin(o),c.push(m.x,m.y,m.z),u.push(0,0,1),g.x=(m.x/e+1)/2,g.y=(m.y/e+1)/2,d.push(g.x,g.y);p+=f}for(s=0;s<n;s++){var v=s*(i+1);for(h=0;h<i;h++){var y=o=h+v,x=o+i+1,b=o+i+2,w=o+1;l.push(y,x,w),l.push(x,b,w)}}this.setIndex(l),this.addAttribute("position",new Ae(c,3)),this.addAttribute("normal",new Ae(u,3)),this.addAttribute("uv",new Ae(d,2))}function fa(t,e,i,n){ge.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},this.fromBufferGeometry(new ma(t,e,i,n)),this.mergeVertices()}function ma(t,e,i,n){Ee.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e)||12,i=i||0,n=n||2*Math.PI,n=Mt.clamp(n,0,2*Math.PI);var r,a,o,s=[],h=[],l=[],c=1/e,u=new Lt,d=new St;for(a=0;a<=e;a++){var p=i+a*c*n,f=Math.sin(p),m=Math.cos(p);for(o=0;o<=t.length-1;o++)u.x=t[o].x*f,u.y=t[o].y,u.z=t[o].x*m,h.push(u.x,u.y,u.z),d.x=a/e,d.y=o/(t.length-1),l.push(d.x,d.y)}for(a=0;a<e;a++)for(o=0;o<t.length-1;o++){var g=r=o+a*t.length,v=r+t.length,y=r+t.length+1,x=r+1;s.push(g,v,x),s.push(v,y,x)}if(this.setIndex(s),this.addAttribute("position",new Ae(h,3)),this.addAttribute("uv",new Ae(l,2)),this.computeVertexNormals(),n===2*Math.PI){var b=this.attributes.normal.array,w=new Lt,_=new Lt,M=new Lt;for(r=e*t.length*3,a=0,o=0;a<t.length;a++,o+=3)w.x=b[o+0],w.y=b[o+1],w.z=b[o+2],_.x=b[r+o+0],_.y=b[r+o+1],_.z=b[r+o+2],M.addVectors(w,_).normalize(),b[o+0]=b[r+o+0]=M.x,b[o+1]=b[r+o+1]=M.y,b[o+2]=b[r+o+2]=M.z}}function ga(t,e){ge.call(this),this.type="ShapeGeometry","object"==typeof e&&(e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new va(t,e)),this.mergeVertices()}function va(t,e){Ee.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var i=[],n=[],r=[],a=[],o=0,s=0;if(!1===Array.isArray(t))l(t);else for(var h=0;h<t.length;h++)l(t[h]),this.addGroup(o,s,h),o+=s,s=0;function l(t){var o,h,l,c=n.length/3,u=t.extractPoints(e),d=u.shape,p=u.holes;for(!1===ea.isClockWise(d)&&(d=d.reverse()),o=0,h=p.length;o<h;o++)l=p[o],!0===ea.isClockWise(l)&&(p[o]=l.reverse());var f=ea.triangulateShape(d,p);for(o=0,h=p.length;o<h;o++)l=p[o],d=d.concat(l);for(o=0,h=d.length;o<h;o++){var m=d[o];n.push(m.x,m.y,0),r.push(0,0,1),a.push(m.x,m.y)}for(o=0,h=f.length;o<h;o++){var g=f[o],v=g[0]+c,y=g[1]+c,x=g[2]+c;i.push(v,y,x),s+=3}}this.setIndex(i),this.addAttribute("position",new Ae(n,3)),this.addAttribute("normal",new Ae(r,3)),this.addAttribute("uv",new Ae(a,2))}function ya(t,e){if(e.shapes=[],Array.isArray(t))for(var i=0,n=t.length;i<n;i++){var r=t[i];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}function xa(t,e){Ee.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var i,n,r,a,o=[],s=Math.cos(Mt.DEG2RAD*e),h=[0,0],l={},c=["a","b","c"];t.isBufferGeometry?(a=new ge).fromBufferGeometry(t):a=t.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],g=0;g<3;g++)i=m[c[g]],n=m[c[(g+1)%3]],h[0]=Math.min(i,n),h[1]=Math.max(i,n),void 0===l[r=h[0]+","+h[1]]?l[r]={index1:h[0],index2:h[1],face1:p,face2:void 0}:l[r].face2=p;for(r in l){var v=l[r];if(void 0===v.face2||d[v.face1].normal.dot(d[v.face2].normal)<=s){var y=u[v.index1];o.push(y.x,y.y,y.z),y=u[v.index2],o.push(y.x,y.y,y.z)}}this.addAttribute("position",new Ae(o,3))}function ba(t,e,i,n,r,a,o,s){ge.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new wa(t,e,i,n,r,a,o,s)),this.mergeVertices()}function wa(t,e,i,n,r,a,o,s){Ee.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};var h=this;t=void 0!==t?t:1,e=void 0!==e?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var l=[],c=[],u=[],d=[],p=0,f=[],m=i/2,g=0;function v(i){var r,a,f,v=new St,y=new Lt,x=0,b=!0===i?t:e,w=!0===i?1:-1;for(a=p,r=1;r<=n;r++)c.push(0,m*w,0),u.push(0,w,0),d.push(.5,.5),p++;for(f=p,r=0;r<=n;r++){var _=r/n*s+o,M=Math.cos(_),S=Math.sin(_);y.x=b*S,y.y=m*w,y.z=b*M,c.push(y.x,y.y,y.z),u.push(0,w,0),v.x=.5*M+.5,v.y=.5*S*w+.5,d.push(v.x,v.y),p++}for(r=0;r<n;r++){var A=a+r,T=f+r;!0===i?l.push(T,T+1,A):l.push(T+1,T,A),x+=3}h.addGroup(g,x,!0===i?1:2),g+=x}!function(){var a,v,y=new Lt,x=new Lt,b=0,w=(e-t)/i;for(v=0;v<=r;v++){var _=[],M=v/r,S=M*(e-t)+t;for(a=0;a<=n;a++){var A=a/n,T=A*s+o,L=Math.sin(T),C=Math.cos(T);x.x=S*L,x.y=-M*i+m,x.z=S*C,c.push(x.x,x.y,x.z),y.set(L,w,C).normalize(),u.push(y.x,y.y,y.z),d.push(A,1-M),_.push(p++)}f.push(_)}for(a=0;a<n;a++)for(v=0;v<r;v++){var P=f[v][a],E=f[v+1][a],D=f[v+1][a+1],I=f[v][a+1];l.push(P,E,I),l.push(E,D,I),b+=6}h.addGroup(g,b,0),g+=b}(),!1===a&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(l),this.addAttribute("position",new Ae(c,3)),this.addAttribute("normal",new Ae(u,3)),this.addAttribute("uv",new Ae(d,2))}function _a(t,e,i,n,r,a,o){ba.call(this,0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function Ma(t,e,i,n,r,a,o){wa.call(this,0,t,e,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function Sa(t,e,i,n){ge.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new Aa(t,e,i,n)),this.mergeVertices()}function Aa(t,e,i,n){Ee.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},t=t||1,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r,a,o=[],s=[],h=[],l=[],c=new Lt,u=new St;for(s.push(0,0,0),h.push(0,0,1),l.push(.5,.5),a=0,r=3;a<=e;a++,r+=3){var d=i+a/e*n;c.x=t*Math.cos(d),c.y=t*Math.sin(d),s.push(c.x,c.y,c.z),h.push(0,0,1),u.x=(s[r]/t+1)/2,u.y=(s[r+1]/t+1)/2,l.push(u.x,u.y)}for(r=1;r<=e;r++)o.push(r,r+1,0);this.setIndex(o),this.addAttribute("position",new Ae(s,3)),this.addAttribute("normal",new Ae(h,3)),this.addAttribute("uv",new Ae(l,2))}ha.prototype=Object.create(ge.prototype),ha.prototype.constructor=ha,la.prototype=Object.create(aa.prototype),la.prototype.constructor=la,ca.prototype=Object.create(ge.prototype),ca.prototype.constructor=ca,ua.prototype=Object.create(Ee.prototype),ua.prototype.constructor=ua,da.prototype=Object.create(ge.prototype),da.prototype.constructor=da,pa.prototype=Object.create(Ee.prototype),pa.prototype.constructor=pa,fa.prototype=Object.create(ge.prototype),fa.prototype.constructor=fa,ma.prototype=Object.create(Ee.prototype),ma.prototype.constructor=ma,ga.prototype=Object.create(ge.prototype),ga.prototype.constructor=ga,ga.prototype.toJSON=function(){var t=ge.prototype.toJSON.call(this);return ya(this.parameters.shapes,t)},va.prototype=Object.create(Ee.prototype),va.prototype.constructor=va,va.prototype.toJSON=function(){var t=Ee.prototype.toJSON.call(this);return ya(this.parameters.shapes,t)},xa.prototype=Object.create(Ee.prototype),xa.prototype.constructor=xa,ba.prototype=Object.create(ge.prototype),ba.prototype.constructor=ba,wa.prototype=Object.create(Ee.prototype),wa.prototype.constructor=wa,_a.prototype=Object.create(ba.prototype),_a.prototype.constructor=_a,Ma.prototype=Object.create(wa.prototype),Ma.prototype.constructor=Ma,Sa.prototype=Object.create(ge.prototype),Sa.prototype.constructor=Sa,Aa.prototype=Object.create(Ee.prototype),Aa.prototype.constructor=Aa;var Ta=Object.freeze({WireframeGeometry:fr,ParametricGeometry:mr,ParametricBufferGeometry:gr,TetrahedronGeometry:xr,TetrahedronBufferGeometry:br,OctahedronGeometry:wr,OctahedronBufferGeometry:_r,IcosahedronGeometry:Mr,IcosahedronBufferGeometry:Sr,DodecahedronGeometry:Ar,DodecahedronBufferGeometry:Tr,PolyhedronGeometry:vr,PolyhedronBufferGeometry:yr,TubeGeometry:Lr,TubeBufferGeometry:Cr,TorusKnotGeometry:Pr,TorusKnotBufferGeometry:Er,TorusGeometry:Dr,TorusBufferGeometry:Ir,TextGeometry:ha,TextBufferGeometry:la,SphereGeometry:ca,SphereBufferGeometry:ua,RingGeometry:da,RingBufferGeometry:pa,PlaneGeometry:Oe,PlaneBufferGeometry:Ne,LatheGeometry:fa,LatheBufferGeometry:ma,ShapeGeometry:ga,ShapeBufferGeometry:va,ExtrudeGeometry:ra,ExtrudeBufferGeometry:aa,EdgesGeometry:xa,ConeGeometry:_a,ConeBufferGeometry:Ma,CylinderGeometry:ba,CylinderBufferGeometry:wa,CircleGeometry:Sa,CircleBufferGeometry:Aa,BoxGeometry:De,BoxBufferGeometry:Ie});function La(t){qe.call(this),this.type="ShadowMaterial",this.color=new Qt(0),this.transparent=!0,this.setValues(t)}function Ca(t){Ye.call(this,t),this.type="RawShaderMaterial"}function Pa(t){qe.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Qt(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ea(t){Pa.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Da(t){qe.call(this),this.type="MeshPhongMaterial",this.color=new Qt(16777215),this.specular=new Qt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ia(t){Da.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Oa(t){qe.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Na(t){qe.call(this),this.type="MeshLambertMaterial",this.color=new Qt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function ka(t){qe.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Qt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(t)}function za(t){rr.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}La.prototype=Object.create(qe.prototype),La.prototype.constructor=La,La.prototype.isShadowMaterial=!0,La.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this},Ca.prototype=Object.create(Ye.prototype),Ca.prototype.constructor=Ca,Ca.prototype.isRawShaderMaterial=!0,Pa.prototype=Object.create(qe.prototype),Pa.prototype.constructor=Pa,Pa.prototype.isMeshStandardMaterial=!0,Pa.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ea.prototype=Object.create(Pa.prototype),Ea.prototype.constructor=Ea,Ea.prototype.isMeshPhysicalMaterial=!0,Ea.prototype.copy=function(t){return Pa.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},Da.prototype=Object.create(qe.prototype),Da.prototype.constructor=Da,Da.prototype.isMeshPhongMaterial=!0,Da.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ia.prototype=Object.create(Da.prototype),Ia.prototype.constructor=Ia,Ia.prototype.isMeshToonMaterial=!0,Ia.prototype.copy=function(t){return Da.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Oa.prototype=Object.create(qe.prototype),Oa.prototype.constructor=Oa,Oa.prototype.isMeshNormalMaterial=!0,Oa.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Na.prototype=Object.create(qe.prototype),Na.prototype.constructor=Na,Na.prototype.isMeshLambertMaterial=!0,Na.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},ka.prototype=Object.create(qe.prototype),ka.prototype.constructor=ka,ka.prototype.isMeshMatcapMaterial=!0,ka.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},za.prototype=Object.create(rr.prototype),za.prototype.constructor=za,za.prototype.isLineDashedMaterial=!0,za.prototype.copy=function(t){return rr.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Ra=Object.freeze({ShadowMaterial:La,SpriteMaterial:Qn,RawShaderMaterial:Ca,ShaderMaterial:Ye,PointsMaterial:hr,MeshPhysicalMaterial:Ea,MeshStandardMaterial:Pa,MeshPhongMaterial:Da,MeshToonMaterial:Ia,MeshNormalMaterial:Oa,MeshLambertMaterial:Na,MeshDepthMaterial:An,MeshDistanceMaterial:Tn,MeshBasicMaterial:Ke,MeshMatcapMaterial:ka,LineDashedMaterial:za,LineBasicMaterial:rr,Material:qe}),Ba={arraySlice:function(t,e,i){return Ba.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,i=new Array(e),n=0;n!==e;++n)i[n]=n;return i.sort(function(e,i){return t[e]-t[i]}),i},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*e,h=0;h!==e;++h)r[o++]=t[s+h];return r},flattenJSON:function(t,e,i,n){for(var r=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[n])&&(e.push(a.time),i.push.apply(i,o)),a=t[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[n])&&(e.push(a.time),o.toArray(i,i.length)),a=t[r++]}while(void 0!==a);else do{void 0!==(o=a[n])&&(e.push(a.time),i.push(o)),a=t[r++]}while(void 0!==a)}}};function Fa(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function Ua(t,e,i,n){Fa.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ga(t,e,i,n){Fa.call(this,t,e,i,n)}function ja(t,e,i,n){Fa.call(this,t,e,i,n)}function Va(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ba.convertArray(e,this.TimeBufferType),this.values=Ba.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function Wa(t,e,i){Va.call(this,t,e,i)}function Ha(t,e,i,n){Va.call(this,t,e,i,n)}function Xa(t,e,i,n){Va.call(this,t,e,i,n)}function qa(t,e,i,n){Fa.call(this,t,e,i,n)}function Ya(t,e,i,n){Va.call(this,t,e,i,n)}function Za(t,e,i,n){Va.call(this,t,e,i,n)}function Ja(t,e,i,n){Va.call(this,t,e,i,n)}function Ka(t,e,i){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.uuid=Mt.generateUUID(),this.duration<0&&this.resetDuration()}function Qa(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Xa;case"vector":case"vector2":case"vector3":case"vector4":return Ja;case"color":return Ha;case"quaternion":return Ya;case"bool":case"boolean":return Wa;case"string":return Za}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){var i=[],n=[];Ba.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}Object.assign(Fa.prototype,{evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var a;i:{n:if(!(t<n)){for(var o=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===o)break;if(r=n,t<(n=e[++i]))break e}a=e.length;break i}if(t>=r)break t;var s=e[1];for(t<s&&(i=2,r=s),o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===o)break;if(n=r,t>=(r=e[--i-1]))break e}a=i,i=0}for(;i<a;){var h=i+a>>>1;t<e[h]?a=h:i=h+1}if(n=e[i],void 0===(r=e[i-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n,a=0;a!==n;++a)e[a]=i[r+a];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(Fa.prototype,{beforeStart_:Fa.prototype.copySampleValue_,afterEnd_:Fa.prototype.copySampleValue_}),Ua.prototype=Object.assign(Object.create(Fa.prototype),{constructor:Ua,DefaultSettings_:{endingStart:gt,endingEnd:gt},intervalChanged_:function(t,e,i){var n=this.parameterPositions,r=t-2,a=t+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case vt:r=t,o=2*e-i;break;case yt:o=e+n[r=n.length-2]-n[r+1];break;default:r=t,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case vt:a=t,s=2*i-e;break;case yt:a=1,s=i+n[1]-n[0];break;default:a=t-1,s=e}var h=.5*(i-e),l=this.valueSize;this._weightPrev=h/(e-o),this._weightNext=h/(s-i),this._offsetPrev=r*l,this._offsetNext=a*l},interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,h=s-o,l=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,b=0;b!==o;++b)r[b]=g*a[l+b]+v*a[h+b]+y*a[s+b]+x*a[c+b];return r}}),Ga.prototype=Object.assign(Object.create(Fa.prototype),{constructor:Ga,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,h=s-o,l=(i-e)/(n-e),c=1-l,u=0;u!==o;++u)r[u]=a[h+u]*c+a[s+u]*l;return r}}),ja.prototype=Object.assign(Object.create(Fa.prototype),{constructor:ja,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(Va,{toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:Ba.convertArray(t.times,Array),values:Ba.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e}}),Object.assign(Va.prototype,{constructor:Va,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:ft,InterpolantFactoryMethodDiscrete:function(t){return new ja(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Ga(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Ua(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case pt:e=this.InterpolantFactoryMethodDiscrete;break;case ft:e=this.InterpolantFactoryMethodLinear;break;case mt:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return pt;case this.InterpolantFactoryMethodLinear:return ft;case this.InterpolantFactoryMethodSmooth:return mt}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]*=t;return this},trim:function(t,e){for(var i=this.times,n=i.length,r=0,a=n-1;r!==n&&i[r]<t;)++r;for(;-1!==a&&i[a]>e;)--a;if(++a,0!==r||a!==n){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Ba.arraySlice(i,r,a),this.values=Ba.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(t=!1);for(var a=null,o=0;o!==r;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){t=!1;break}if(null!==a&&a>s){t=!1;break}a=s}if(void 0!==n&&Ba.isTypedArray(n)){o=0;for(var h=n.length;o!==h;++o){var l=n[o];if(isNaN(l)){t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=this.getInterpolation()===mt,r=1,a=t.length-1,o=1;o<a;++o){var s=!1,h=t[o];if(h!==t[o+1]&&(1!==o||h!==h[0]))if(n)s=!0;else for(var l=o*i,c=l-i,u=l+i,d=0;d!==i;++d){var p=e[l+d];if(p!==e[c+d]||p!==e[u+d]){s=!0;break}}if(s){if(o!==r){t[r]=t[o];var f=o*i,m=r*i;for(d=0;d!==i;++d)e[m+d]=e[f+d]}++r}}if(a>0){for(t[r]=t[a],f=a*i,m=r*i,d=0;d!==i;++d)e[m+d]=e[f+d];++r}return r!==t.length&&(this.times=Ba.arraySlice(t,0,r),this.values=Ba.arraySlice(e,0,r*i)),this},clone:function(){var t=Ba.arraySlice(this.times,0),e=Ba.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}),Wa.prototype=Object.assign(Object.create(Va.prototype),{constructor:Wa,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:pt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ha.prototype=Object.assign(Object.create(Va.prototype),{constructor:Ha,ValueTypeName:"color"}),Xa.prototype=Object.assign(Object.create(Va.prototype),{constructor:Xa,ValueTypeName:"number"}),qa.prototype=Object.assign(Object.create(Fa.prototype),{constructor:qa,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,h=(i-e)/(n-e),l=s+o;s!==l;s+=4)Tt.slerpFlat(r,0,a,s-o,a,s,h);return r}}),Ya.prototype=Object.assign(Object.create(Va.prototype),{constructor:Ya,ValueTypeName:"quaternion",DefaultInterpolation:ft,InterpolantFactoryMethodLinear:function(t){return new qa(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Za.prototype=Object.assign(Object.create(Va.prototype),{constructor:Za,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:pt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ja.prototype=Object.assign(Object.create(Va.prototype),{constructor:Ja,ValueTypeName:"vector"}),Object.assign(Ka,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,a=i.length;r!==a;++r)e.push(Qa(i[r]).scale(n));return new Ka(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid},r=0,a=i.length;r!==a;++r)e.push(Va.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.length,a=[],o=0;o<r;o++){var s=[],h=[];s.push((o+r-1)%r,o,(o+1)%r),h.push(0,1,0);var l=Ba.getKeyframeOrder(s);s=Ba.sortedArray(s,1,l),h=Ba.sortedArray(h,1,l),n||0!==s[0]||(s.push(r),h.push(h[0])),a.push(new Xa(".morphTargetInfluences["+e[o].name+"]",s,h).scale(1/i))}return new Ka(t,-1,a)},findByName:function(t,e){var i=t;if(!Array.isArray(t)){var n=t;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===e)return i[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],h=s.name.match(r);if(h&&h.length>1){var l=n[u=h[1]];l||(n[u]=l=[]),l.push(s)}}var c=[];for(var u in n)c.push(Ka.CreateFromMorphTargetSequence(u,n[u],e,i));return c},parseAnimation:function(t,e){if(!t)return null;for(var i=function(t,e,i,n,r){if(0!==i.length){var a=[],o=[];Ba.flattenJSON(i,a,o,n),0!==a.length&&r.push(new t(e,a,o))}},n=[],r=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],h=0;h<s.length;h++){var l=s[h].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var c={},u=0;u<l.length;u++)if(l[u].morphTargets)for(var d=0;d<l[u].morphTargets.length;d++)c[l[u].morphTargets[d]]=-1;for(var p in c){var f=[],m=[];for(d=0;d!==l[u].morphTargets.length;++d){var g=l[u];f.push(g.time),m.push(g.morphTarget===p?1:0)}n.push(new Xa(".morphTargetInfluence["+p+"]",f,m))}a=c.length*(o||1)}else{var v=".bones["+e[h].name+"]";i(Ja,v+".position",l,"pos",n),i(Ya,v+".quaternion",l,"rot",n),i(Ja,v+".scale",l,"scl",n)}}return 0===n.length?null:new Ka(r,a,n)}}),Object.assign(Ka.prototype,{resetDuration:function(){for(var t=0,e=0,i=this.tracks.length;e!==i;++e){var n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){for(var t=[],e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new Ka(this.name,this.duration,t)}});var $a={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function to(t,e,i){var n=this,r=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this}}var eo=new to,io={};function no(t){this.manager=void 0!==t?t:eo}function ro(t){this.manager=void 0!==t?t:eo}function ao(t){this.manager=void 0!==t?t:eo,this._parser=null}function oo(t){this.manager=void 0!==t?t:eo,this._parser=null}function so(t){this.manager=void 0!==t?t:eo}function ho(t){this.manager=void 0!==t?t:eo}function lo(t){this.manager=void 0!==t?t:eo}function co(){this.type="Curve",this.arcLengthDivisions=200}function uo(t,e,i,n,r,a,o,s){co.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=i||1,this.yRadius=n||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function po(t,e,i,n,r,a){uo.call(this,t,e,i,i,n,r,a),this.type="ArcCurve"}function fo(){var t=0,e=0,i=0,n=0;function r(r,a,o,s){t=r,e=o,i=-3*r+3*a-2*o-s,n=2*r-2*a+o+s}return{initCatmullRom:function(t,e,i,n,a){r(e,i,a*(i-t),a*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,a,o,s){var h=(e-t)/a-(i-t)/(a+o)+(i-e)/o,l=(i-e)/o-(n-e)/(o+s)+(n-i)/s;r(e,i,h*=o,l*=o)},calc:function(r){var a=r*r;return t+e*r+i*a+n*(a*r)}}}Object.assign(no.prototype,{load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=$a.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0),a;if(void 0===io[t]){var o=t.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],h=!!o[2],l=o[3];l=decodeURIComponent(l),h&&(l=atob(l));try{var c,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var d=new Uint8Array(l.length),p=0;p<l.length;p++)d[p]=l.charCodeAt(p);c="blob"===u?new Blob([d.buffer],{type:s}):d.buffer;break;case"document":var f=new DOMParser;c=f.parseFromString(l,s);break;case"json":c=JSON.parse(l);break;default:c=l}setTimeout(function(){e&&e(c),r.manager.itemEnd(t)},0)}catch(e){setTimeout(function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)},0)}}else{io[t]=[],io[t].push({onLoad:e,onProgress:i,onError:n});var m=new XMLHttpRequest;for(var g in m.open("GET",t,!0),m.addEventListener("load",function(e){var i=this.response;$a.add(t,i);var n=io[t];if(delete io[t],200===this.status||0===this.status){this.status;for(var a=0,o=n.length;a<o;a++)(s=n[a]).onLoad&&s.onLoad(i);r.manager.itemEnd(t)}else{for(a=0,o=n.length;a<o;a++){var s;(s=n[a]).onError&&s.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}},!1),m.addEventListener("progress",function(e){for(var i=io[t],n=0,r=i.length;n<r;n++){var a=i[n];a.onProgress&&a.onProgress(e)}},!1),m.addEventListener("error",function(e){var i=io[t];delete io[t];for(var n=0,a=i.length;n<a;n++){var o=i[n];o.onError&&o.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)},!1),m.addEventListener("abort",function(e){var i=io[t];delete io[t];for(var n=0,a=i.length;n<a;n++){var o=i[n];o.onError&&o.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return r.manager.itemStart(t),m}io[t].push({onLoad:e,onProgress:i,onError:n})},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(ro.prototype,{load:function(t,e,i,n){var r=this,a=new no(r.manager);a.setPath(r.path),a.load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},parse:function(t,e){for(var i=[],n=0;n<t.length;n++){var r=Ka.parse(t[n]);i.push(r)}e(i)},setPath:function(t){return this.path=t,this}}),Object.assign(ao.prototype,{load:function(t,e,i,n){var r=this,a=[],o=new ur;o.image=a;var s=new no(this.manager);function h(h){s.load(t[h],function(t){var i=r._parser(t,!0);a[h]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},6===(l+=1)&&(1===i.mipmapCount&&(o.minFilter=H),o.format=i.format,o.needsUpdate=!0,e&&e(o))},i,n)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var l=0,c=0,u=t.length;c<u;++c)h(c);else s.load(t,function(t){var i=r._parser(t,!0);if(i.isCubemap)for(var n=i.mipmaps.length/i.mipmapCount,s=0;s<n;s++){a[s]={mipmaps:[]};for(var h=0;h<i.mipmapCount;h++)a[s].mipmaps.push(i.mipmaps[s*i.mipmapCount+h]),a[s].format=i.format,a[s].width=i.width,a[s].height=i.height}else o.image.width=i.width,o.image.height=i.height,o.mipmaps=i.mipmaps;1===i.mipmapCount&&(o.minFilter=H),o.format=i.format,o.needsUpdate=!0,e&&e(o)},i,n);return o},setPath:function(t){return this.path=t,this}}),Object.assign(oo.prototype,{load:function(t,e,i,n){var r=this,a=new Ft,o=new no(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(t,function(t){var i=r._parser(t);i&&(void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:U,a.wrapT=void 0!==i.wrapT?i.wrapT:U,a.magFilter=void 0!==i.magFilter?i.magFilter:H,a.minFilter=void 0!==i.minFilter?i.minFilter:q,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps),1===i.mipmapCount&&(a.minFilter=H),a.needsUpdate=!0,e&&e(a,i))},i,n),a},setPath:function(t){return this.path=t,this}}),Object.assign(so.prototype,{crossOrigin:"anonymous",load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=$a.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",h,!1),$a.add(t,this),e&&e(this),r.manager.itemEnd(t)}function h(e){o.removeEventListener("load",s,!1),o.removeEventListener("error",h,!1),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}return o.addEventListener("load",s,!1),o.addEventListener("error",h,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(ho.prototype,{crossOrigin:"anonymous",load:function(t,e,i,n){var r=new ci,a=new so(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(i){a.load(t[i],function(t){r.images[i]=t,6===++o&&(r.needsUpdate=!0,e&&e(r))},void 0,n)}for(var h=0;h<t.length;++h)s(h);return r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(lo.prototype,{crossOrigin:"anonymous",load:function(t,e,i,n){var r=new Nt,a=new so(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,function(i){r.image=i;var n=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=n?tt:et,r.needsUpdate=!0,void 0!==e&&e(r)},i,n),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(co.prototype,{getPoint:function(){return null},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,n=[],r=this.getPoint(0),a=0;for(n.push(0),i=1;i<=t;i++)a+=(e=this.getPoint(i/t)).distanceTo(r),n.push(a),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i,n=this.getLengths(),r=0,a=n.length;i=e||t*n[a-1];for(var o,s=0,h=a-1;s<=h;)if((o=n[r=Math.floor(s+(h-s)/2)]-i)<0)s=r+1;else{if(!(o>0)){h=r;break}h=r-1}if(n[r=h]===i)return r/(a-1);var l=n[r];return(r+(i-l)/(n[r+1]-l))/(a-1)},getTangent:function(t){var e=1e-4,i=t-e,n=t+e;i<0&&(i=0),n>1&&(n=1);var r=this.getPoint(i);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var i,n,r,a=new Lt,o=[],s=[],h=[],l=new Lt,c=new At;for(i=0;i<=t;i++)n=i/t,o[i]=this.getTangentAt(n),o[i].normalize();s[0]=new Lt,h[0]=new Lt;var u=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=u&&(u=d,a.set(1,0,0)),p<=u&&(u=p,a.set(0,1,0)),f<=u&&a.set(0,0,1),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),h[0].crossVectors(o[0],s[0]),i=1;i<=t;i++)s[i]=s[i-1].clone(),h[i]=h[i-1].clone(),l.crossVectors(o[i-1],o[i]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(Mt.clamp(o[i-1].dot(o[i]),-1,1)),s[i].applyMatrix4(c.makeRotationAxis(l,r))),h[i].crossVectors(o[i],s[i]);if(!0===e)for(r=Math.acos(Mt.clamp(s[0].dot(s[t]),-1,1)),r/=t,o[0].dot(l.crossVectors(s[0],s[t]))>0&&(r=-r),i=1;i<=t;i++)s[i].applyMatrix4(c.makeRotationAxis(o[i],r*i)),h[i].crossVectors(o[i],s[i]);return{tangents:o,normals:s,binormals:h}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),uo.prototype=Object.create(co.prototype),uo.prototype.constructor=uo,uo.prototype.isEllipseCurve=!0,uo.prototype.getPoint=function(t,e){for(var i=e||new St,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=a?0:n),!0!==this.aClockwise||a||(r===n?r=-n:r-=n);var o=this.aStartAngle+t*r,s=this.aX+this.xRadius*Math.cos(o),h=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),c=Math.sin(this.aRotation),u=s-this.aX,d=h-this.aY;s=u*l-d*c+this.aX,h=u*c+d*l+this.aY}return i.set(s,h)},uo.prototype.copy=function(t){return co.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},uo.prototype.toJSON=function(){var t=co.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},uo.prototype.fromJSON=function(t){return co.prototype.fromJSON.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},po.prototype=Object.create(uo.prototype),po.prototype.constructor=po,po.prototype.isArcCurve=!0;var mo=new Lt,go=new fo,vo=new fo,yo=new fo;function xo(t,e,i,n){co.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=e||!1,this.curveType=i||"centripetal",this.tension=n||.5}function bo(t,e,i,n,r){var a=.5*(n-e),o=.5*(r-i),s=t*t;return(2*i-2*n+a+o)*(t*s)+(-3*i+3*n-2*a-o)*s+a*t+i}function wo(t,e,i,n){return function(t,e){var i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function _o(t,e,i,n,r){return function(t,e){var i=1-t;return i*i*i*e}(t,e)+function(t,e){var i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}function Mo(t,e,i,n){co.call(this),this.type="CubicBezierCurve",this.v0=t||new St,this.v1=e||new St,this.v2=i||new St,this.v3=n||new St}function So(t,e,i,n){co.call(this),this.type="CubicBezierCurve3",this.v0=t||new Lt,this.v1=e||new Lt,this.v2=i||new Lt,this.v3=n||new Lt}function Ao(t,e){co.call(this),this.type="LineCurve",this.v1=t||new St,this.v2=e||new St}function To(t,e){co.call(this),this.type="LineCurve3",this.v1=t||new Lt,this.v2=e||new Lt}function Lo(t,e,i){co.call(this),this.type="QuadraticBezierCurve",this.v0=t||new St,this.v1=e||new St,this.v2=i||new St}function Co(t,e,i){co.call(this),this.type="QuadraticBezierCurve3",this.v0=t||new Lt,this.v1=e||new Lt,this.v2=i||new Lt}function Po(t){co.call(this),this.type="SplineCurve",this.points=t||[]}xo.prototype=Object.create(co.prototype),xo.prototype.constructor=xo,xo.prototype.isCatmullRomCurve3=!0,xo.prototype.getPoint=function(t,e){var i,n,r,a,o=e||new Lt,s=this.points,h=s.length,l=(h-(this.closed?0:1))*t,c=Math.floor(l),u=l-c;if(this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/h)+1)*h:0===u&&c===h-1&&(c=h-2,u=1),this.closed||c>0?i=s[(c-1)%h]:(mo.subVectors(s[0],s[1]).add(s[0]),i=mo),n=s[c%h],r=s[(c+1)%h],this.closed||c+2<h?a=s[(c+2)%h]:(mo.subVectors(s[h-1],s[h-2]).add(s[h-1]),a=mo),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(i.distanceToSquared(n),d),f=Math.pow(n.distanceToSquared(r),d),m=Math.pow(r.distanceToSquared(a),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),go.initNonuniformCatmullRom(i.x,n.x,r.x,a.x,p,f,m),vo.initNonuniformCatmullRom(i.y,n.y,r.y,a.y,p,f,m),yo.initNonuniformCatmullRom(i.z,n.z,r.z,a.z,p,f,m)}else"catmullrom"===this.curveType&&(go.initCatmullRom(i.x,n.x,r.x,a.x,this.tension),vo.initCatmullRom(i.y,n.y,r.y,a.y,this.tension),yo.initCatmullRom(i.z,n.z,r.z,a.z,this.tension));return o.set(go.calc(u),vo.calc(u),yo.calc(u)),o},xo.prototype.copy=function(t){co.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},xo.prototype.toJSON=function(){var t=co.prototype.toJSON.call(this);t.points=[];for(var e=0,i=this.points.length;e<i;e++){var n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},xo.prototype.fromJSON=function(t){co.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push((new Lt).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Mo.prototype=Object.create(co.prototype),Mo.prototype.constructor=Mo,Mo.prototype.isCubicBezierCurve=!0,Mo.prototype.getPoint=function(t,e){var i=e||new St,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(_o(t,n.x,r.x,a.x,o.x),_o(t,n.y,r.y,a.y,o.y)),i},Mo.prototype.copy=function(t){return co.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Mo.prototype.toJSON=function(){var t=co.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Mo.prototype.fromJSON=function(t){return co.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},So.prototype=Object.create(co.prototype),So.prototype.constructor=So,So.prototype.isCubicBezierCurve3=!0,So.prototype.getPoint=function(t,e){var i=e||new Lt,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(_o(t,n.x,r.x,a.x,o.x),_o(t,n.y,r.y,a.y,o.y),_o(t,n.z,r.z,a.z,o.z)),i},So.prototype.copy=function(t){return co.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},So.prototype.toJSON=function(){var t=co.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},So.prototype.fromJSON=function(t){return co.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Ao.prototype=Object.create(co.prototype),Ao.prototype.constructor=Ao,Ao.prototype.isLineCurve=!0,Ao.prototype.getPoint=function(t,e){var i=e||new St;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},Ao.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Ao.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Ao.prototype.copy=function(t){return co.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ao.prototype.toJSON=function(){var t=co.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Ao.prototype.fromJSON=function(t){return co.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},To.prototype=Object.create(co.prototype),To.prototype.constructor=To,To.prototype.isLineCurve3=!0,To.prototype.getPoint=function(t,e){var i=e||new Lt;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},To.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},To.prototype.copy=function(t){return co.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},To.prototype.toJSON=function(){var t=co.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},To.prototype.fromJSON=function(t){return co.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Lo.prototype=Object.create(co.prototype),Lo.prototype.constructor=Lo,Lo.prototype.isQuadraticBezierCurve=!0,Lo.prototype.getPoint=function(t,e){var i=e||new St,n=this.v0,r=this.v1,a=this.v2;return i.set(wo(t,n.x,r.x,a.x),wo(t,n.y,r.y,a.y)),i},Lo.prototype.copy=function(t){return co.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Lo.prototype.toJSON=function(){var t=co.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Lo.prototype.fromJSON=function(t){return co.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Co.prototype=Object.create(co.prototype),Co.prototype.constructor=Co,Co.prototype.isQuadraticBezierCurve3=!0,Co.prototype.getPoint=function(t,e){var i=e||new Lt,n=this.v0,r=this.v1,a=this.v2;return i.set(wo(t,n.x,r.x,a.x),wo(t,n.y,r.y,a.y),wo(t,n.z,r.z,a.z)),i},Co.prototype.copy=function(t){return co.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Co.prototype.toJSON=function(){var t=co.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Co.prototype.fromJSON=function(t){return co.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Po.prototype=Object.create(co.prototype),Po.prototype.constructor=Po,Po.prototype.isSplineCurve=!0,Po.prototype.getPoint=function(t,e){var i=e||new St,n=this.points,r=(n.length-1)*t,a=Math.floor(r),o=r-a,s=n[0===a?a:a-1],h=n[a],l=n[a>n.length-2?n.length-1:a+1],c=n[a>n.length-3?n.length-1:a+2];return i.set(bo(o,s.x,h.x,l.x,c.x),bo(o,s.y,h.y,l.y,c.y)),i},Po.prototype.copy=function(t){co.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push(n.clone())}return this},Po.prototype.toJSON=function(){var t=co.prototype.toJSON.call(this);t.points=[];for(var e=0,i=this.points.length;e<i;e++){var n=this.points[e];t.points.push(n.toArray())}return t},Po.prototype.fromJSON=function(t){co.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push((new St).fromArray(n))}return this};var Eo=Object.freeze({ArcCurve:po,CatmullRomCurve3:xo,CubicBezierCurve:Mo,CubicBezierCurve3:So,EllipseCurve:uo,LineCurve:Ao,LineCurve3:To,QuadraticBezierCurve:Lo,QuadraticBezierCurve3:Co,SplineCurve:Po});function Do(){co.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Io(t){Do.call(this),this.type="Path",this.currentPoint=new St,t&&this.setFromPoints(t)}function Oo(t){Io.call(this,t),this.uuid=Mt.generateUUID(),this.type="Shape",this.holes=[]}function No(t,e){de.call(this),this.type="Light",this.color=new Qt(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function ko(t,e,i){No.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(de.DefaultUp),this.updateMatrix(),this.groundColor=new Qt(e)}function zo(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new St(512,512),this.map=null,this.matrix=new At}function Ro(){zo.call(this,new On(50,1,.5,500))}function Bo(t,e,i,n,r,a){No.call(this,t,e),this.type="SpotLight",this.position.copy(de.DefaultUp),this.updateMatrix(),this.target=new de,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Ro}function Fo(t,e,i,n){No.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new zo(new On(90,1,.5,500))}function Uo(t,e,i,n,r,a){In.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==t?t:-1,this.right=void 0!==e?e:1,this.top=void 0!==i?i:1,this.bottom=void 0!==n?n:-1,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Go(){zo.call(this,new Uo(-5,5,5,-5,.5,500))}function jo(t,e){No.call(this,t,e),this.type="DirectionalLight",this.position.copy(de.DefaultUp),this.updateMatrix(),this.target=new de,this.shadow=new Go}function Vo(t,e){No.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Wo(t,e,i,n){No.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==i?i:10,this.height=void 0!==n?n:10}function Ho(t){this.manager=void 0!==t?t:eo,this.textures={}}Do.prototype=Object.assign(Object.create(co.prototype),{constructor:Do,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ao(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=e){var r=i[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,i=[],n=0,r=this.curves;n<r.length;n++)for(var a=r[n],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),h=0;h<s.length;h++){var l=s[h];e&&e.equals(l)||(i.push(l),e=l)}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(t){co.prototype.copy.call(this,t),this.curves=[];for(var e=0,i=t.curves.length;e<i;e++){var n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){var t=co.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(var e=0,i=this.curves.length;e<i;e++){var n=this.curves[e];t.curves.push(n.toJSON())}return t},fromJSON:function(t){co.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(var e=0,i=t.curves.length;e<i;e++){var n=t.curves[e];this.curves.push((new Eo[n.type]).fromJSON(n))}return this}}),Io.prototype=Object.assign(Object.create(Do.prototype),{constructor:Io,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){return this.currentPoint.set(t,e),this},lineTo:function(t,e){var i=new Ao(this.currentPoint.clone(),new St(t,e));this.curves.push(i),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,i,n){var r=new Lo(this.currentPoint.clone(),new St(t,e),new St(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this},bezierCurveTo:function(t,e,i,n,r,a){var o=new Mo(this.currentPoint.clone(),new St(t,e),new St(i,n),new St(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this},splineThru:function(t){var e=new Po([this.currentPoint.clone()].concat(t));return this.curves.push(e),this.currentPoint.copy(t[t.length-1]),this},arc:function(t,e,i,n,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,i,n,r,a),this},absarc:function(t,e,i,n,r,a){return this.absellipse(t,e,i,i,n,r,a),this},ellipse:function(t,e,i,n,r,a,o,s){var h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,i,n,r,a,o,s)},absellipse:function(t,e,i,n,r,a,o,s){var h=new uo(t,e,i,n,r,a,o,s);if(this.curves.length>0){var l=h.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(h);var c=h.getPoint(1);return this.currentPoint.copy(c),this},copy:function(t){return Do.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Do.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Do.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),Oo.prototype=Object.assign(Object.create(Io.prototype),{constructor:Oo,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){Io.prototype.copy.call(this,t),this.holes=[];for(var e=0,i=t.holes.length;e<i;e++){var n=t.holes[e];this.holes.push(n.clone())}return this},toJSON:function(){var t=Io.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(var e=0,i=this.holes.length;e<i;e++){var n=this.holes[e];t.holes.push(n.toJSON())}return t},fromJSON:function(t){Io.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(var e=0,i=t.holes.length;e<i;e++){var n=t.holes[e];this.holes.push((new Io).fromJSON(n))}return this}}),No.prototype=Object.assign(Object.create(de.prototype),{constructor:No,isLight:!0,copy:function(t){return de.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=de.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),ko.prototype=Object.assign(Object.create(No.prototype),{constructor:ko,isHemisphereLight:!0,copy:function(t){return No.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(zo.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Ro.prototype=Object.assign(Object.create(zo.prototype),{constructor:Ro,isSpotLightShadow:!0,update:function(t){var e=this.camera,i=2*Mt.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix())}}),Bo.prototype=Object.assign(Object.create(No.prototype),{constructor:Bo,isSpotLight:!0,copy:function(t){return No.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Fo.prototype=Object.assign(Object.create(No.prototype),{constructor:Fo,isPointLight:!0,copy:function(t){return No.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Uo.prototype=Object.assign(Object.create(In.prototype),{constructor:Uo,isOrthographicCamera:!0,copy:function(t,e){return In.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-t,a=i+t,o=n+e,s=n-e;if(null!==this.view&&this.view.enabled){var h=this.zoom/(this.view.width/this.view.fullWidth),l=this.zoom/(this.view.height/this.view.fullHeight),c=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;a=(r+=c*(this.view.offsetX/h))+c*(this.view.width/h),s=(o-=u*(this.view.offsetY/l))-u*(this.view.height/l)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=de.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),Go.prototype=Object.assign(Object.create(zo.prototype),{constructor:Go}),jo.prototype=Object.assign(Object.create(No.prototype),{constructor:jo,isDirectionalLight:!0,copy:function(t){return No.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Vo.prototype=Object.assign(Object.create(No.prototype),{constructor:Vo,isAmbientLight:!0}),Wo.prototype=Object.assign(Object.create(No.prototype),{constructor:Wo,isRectAreaLight:!0,copy:function(t){return No.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=No.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}}),Object.assign(Ho.prototype,{load:function(t,e,i,n){var r=this,a=new no(r.manager);a.setPath(r.path),a.load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},parse:function(t){var e=this.textures;function i(t){return e[t],e[t]}var n=new Ra[t.type];if(void 0!==t.uuid&&(n.uuid=t.uuid),void 0!==t.name&&(n.name=t.name),void 0!==t.color&&n.color.setHex(t.color),void 0!==t.roughness&&(n.roughness=t.roughness),void 0!==t.metalness&&(n.metalness=t.metalness),void 0!==t.emissive&&n.emissive.setHex(t.emissive),void 0!==t.specular&&n.specular.setHex(t.specular),void 0!==t.shininess&&(n.shininess=t.shininess),void 0!==t.clearCoat&&(n.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(n.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.vertexColors&&(n.vertexColors=t.vertexColors),void 0!==t.fog&&(n.fog=t.fog),void 0!==t.flatShading&&(n.flatShading=t.flatShading),void 0!==t.blending&&(n.blending=t.blending),void 0!==t.combine&&(n.combine=t.combine),void 0!==t.side&&(n.side=t.side),void 0!==t.opacity&&(n.opacity=t.opacity),void 0!==t.transparent&&(n.transparent=t.transparent),void 0!==t.alphaTest&&(n.alphaTest=t.alphaTest),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(n.colorWrite=t.colorWrite),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(n.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(n.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(n.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(n.rotation=t.rotation),1!==t.linewidth&&(n.linewidth=t.linewidth),void 0!==t.dashSize&&(n.dashSize=t.dashSize),void 0!==t.gapSize&&(n.gapSize=t.gapSize),void 0!==t.scale&&(n.scale=t.scale),void 0!==t.polygonOffset&&(n.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(n.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(n.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(n.skinning=t.skinning),void 0!==t.morphTargets&&(n.morphTargets=t.morphTargets),void 0!==t.dithering&&(n.dithering=t.dithering),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.uniforms)for(var r in t.uniforms){var a=t.uniforms[r];switch(n.uniforms[r]={},a.type){case"t":n.uniforms[r].value=i(a.value);break;case"c":n.uniforms[r].value=(new Qt).setHex(a.value);break;case"v2":n.uniforms[r].value=(new St).fromArray(a.value);break;case"v3":n.uniforms[r].value=(new Lt).fromArray(a.value);break;case"v4":n.uniforms[r].value=(new kt).fromArray(a.value);break;case"m3":n.uniforms[r].value=(new Ct).fromArray(a.value);case"m4":n.uniforms[r].value=(new At).fromArray(a.value);break;default:n.uniforms[r].value=a.value}}if(void 0!==t.defines&&(n.defines=t.defines),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(var o in t.extensions)n.extensions[o]=t.extensions[o];if(void 0!==t.shading&&(n.flatShading=1===t.shading),void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(n.map=i(t.map)),void 0!==t.alphaMap&&(n.alphaMap=i(t.alphaMap),n.transparent=!0),void 0!==t.bumpMap&&(n.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(n.bumpScale=t.bumpScale),void 0!==t.normalMap&&(n.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(n.normalMapType=t.normalMapType),void 0!==t.normalScale){var s=t.normalScale;!1===Array.isArray(s)&&(s=[s,s]),n.normalScale=(new St).fromArray(s)}return void 0!==t.displacementMap&&(n.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(n.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(n.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(n.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(n.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(n.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(n.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(n.specularMap=i(t.specularMap)),void 0!==t.envMap&&(n.envMap=i(t.envMap)),void 0!==t.envMapIntensity&&(n.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(n.reflectivity=t.reflectivity),void 0!==t.lightMap&&(n.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(n.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(n.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(n.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(n.gradientMap=i(t.gradientMap)),n},setPath:function(t){return this.path=t,this},setTextures:function(t){return this.textures=t,this}});var Xo={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);return decodeURIComponent(escape(e))},extractUrlBase:function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function qo(t){this.manager=void 0!==t?t:eo}Object.assign(qo.prototype,{load:function(t,e,i,n){var r=this,a=new no(r.manager);a.setPath(r.path),a.load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},parse:function(t){var e=new Ee,i=t.data.index;if(void 0!==i){var n=new Yo[i.type](i.array);e.setIndex(new ve(n,1))}var r=t.data.attributes;for(var a in r){var o=r[a],s=new ve(n=new Yo[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),e.addAttribute(a,s)}var h=t.data.morphAttributes;if(h)for(var a in h){for(var l=h[a],c=[],u=0,d=l.length;u<d;u++)o=l[u],s=new ve(n=new Yo[o.type](o.array),o.itemSize,o.normalized),void 0!==o.name&&(s.name=o.name),c.push(s);e.morphAttributes[a]=c}var p=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==p){u=0;for(var f=p.length;u!==f;++u){var m=p[u];e.addGroup(m.start,m.count,m.materialIndex)}}var g=t.data.boundingSphere;if(void 0!==g){var v=new Lt;void 0!==g.center&&v.fromArray(g.center),e.boundingSphere=new Gt(v,g.radius)}return t.name&&(e.name=t.name),t.userData&&(e.userData=t.userData),e},setPath:function(t){return this.path=t,this}});var Yo={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Zo(t){this.manager=void 0!==t?t:eo,this.resourcePath=""}Object.assign(Zo.prototype,{crossOrigin:"anonymous",load:function(t,e,i,n){var r=this,a=void 0===this.path?Xo.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;var o=new no(r.manager);o.setPath(this.path),o.load(t,function(t){var i=null;try{i=JSON.parse(t)}catch(t){return void(void 0!==n&&n(t))}var a=i.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()&&r.parse(i,e)},i,n)},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setCrossOrigin:function(t){return this.crossOrigin=t,this},parse:function(t,e){var i=this.parseShape(t.shapes),n=this.parseGeometries(t.geometries,i),r=this.parseImages(t.images,function(){void 0!==e&&e(s)}),a=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,a),s=this.parseObject(t.object,n,o);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e={};if(void 0!==t)for(var i=0,n=t.length;i<n;i++){var r=(new Oo).fromJSON(t[i]);e[r.uuid]=r}return e},parseGeometries:function(t,e){var i={};if(void 0!==t)for(var n=new qo,r=0,a=t.length;r<a;r++){var o,s=t[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Ta[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Ta[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Ta[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Ta[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Ta[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Ta[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new Ta[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Ta[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Ta[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Ta[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Ta[s.type]((new Eo[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Ta[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Ta[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var h=[],l=0,c=s.shapes.length;l<c;l++){var u=e[s.shapes[l]];h.push(u)}o=new Ta[s.type](h,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(h=[],l=0,c=s.shapes.length;l<c;l++)u=e[s.shapes[l]],h.push(u);var d=s.options.extrudePath;void 0!==d&&(s.options.extrudePath=(new Eo[d.type]).fromJSON(d)),o=new Ta[s.type](h,s.options);break;case"BufferGeometry":o=n.parse(s);break;case"Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE&&(o=(new THREE.LegacyJSONLoader).parse(s,this.resourcePath).geometry);break;default:continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),i[s.uuid]=o}return i},parseMaterials:function(t,e){var i={},n={};if(void 0!==t){var r=new Ho;r.setTextures(e);for(var a=0,o=t.length;a<o;a++){var s=t[a];if("MultiMaterial"===s.type){for(var h=[],l=0;l<s.materials.length;l++){var c=s.materials[l];void 0===i[c.uuid]&&(i[c.uuid]=r.parse(c)),h.push(i[c.uuid])}n[s.uuid]=h}else void 0===i[s.uuid]&&(i[s.uuid]=r.parse(s)),n[s.uuid]=i[s.uuid]}}return n},parseAnimations:function(t){for(var e=[],i=0;i<t.length;i++){var n=t[i],r=Ka.parse(n);void 0!==n.uuid&&(r.uuid=n.uuid),e.push(r)}return e},parseImages:function(t,e){var i=this,n={};function r(t){return i.manager.itemStart(t),a.load(t,function(){i.manager.itemEnd(t)},void 0,function(){i.manager.itemError(t),i.manager.itemEnd(t)})}if(void 0!==t&&t.length>0){var a=new so(new to(e));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o<s;o++){var h=t[o],l=h.url;if(Array.isArray(l)){n[h.uuid]=[];for(var c=0,u=l.length;c<u;c++){var d=l[c],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:i.resourcePath+d;n[h.uuid].push(r(p))}}else p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h.url)?h.url:i.resourcePath+h.url,n[h.uuid]=r(p)}}return n},parseTextures:function(t,e){function i(t,e){return"number"==typeof t?t:e[t]}var n={};if(void 0!==t)for(var r=0,a=t.length;r<a;r++){var o,s=t[r];s.image,e[s.image],(o=Array.isArray(e[s.image])?new ci(e[s.image]):new Nt(e[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=i(s.mapping,es)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=i(s.wrap[0],is),o.wrapT=i(s.wrap[1],is)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=i(s.minFilter,ns)),void 0!==s.magFilter&&(o.magFilter=i(s.magFilter,ns)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),n[s.uuid]=o}return n},parseObject:function(t,e,i){var n;function r(t){return e[t],e[t]}function a(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],n=0,r=t.length;n<r;n++){var a=t[n];i[a],e.push(i[a])}return e}return i[t],i[t]}}switch(t.type){case"Scene":n=new Zn,void 0!==t.background&&Number.isInteger(t.background)&&(n.background=new Qt(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?n.fog=new Yn(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(n.fog=new qn(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":n=new On(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(n.focus=t.focus),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.filmGauge&&(n.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(n.filmOffset=t.filmOffset),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"OrthographicCamera":n=new Uo(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"AmbientLight":n=new Vo(t.color,t.intensity);break;case"DirectionalLight":n=new jo(t.color,t.intensity);break;case"PointLight":n=new Fo(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":n=new Wo(t.color,t.intensity,t.width,t.height);break;case"SpotLight":n=new Bo(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":n=new ko(t.color,t.groundColor,t.intensity);break;case"SkinnedMesh":case"Mesh":var o=r(t.geometry),s=a(t.material);n=o.bones&&o.bones.length>0?new er(o,s):new Qe(o,s),void 0!==t.drawMode&&n.setDrawMode(t.drawMode);break;case"LOD":n=new tr;break;case"Line":n=new ar(r(t.geometry),a(t.material),t.mode);break;case"LineLoop":n=new sr(r(t.geometry),a(t.material));break;case"LineSegments":n=new or(r(t.geometry),a(t.material));break;case"PointCloud":case"Points":n=new lr(r(t.geometry),a(t.material));break;case"Sprite":n=new $n(a(t.material));break;case"Group":n=new Dn;break;default:n=new de}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children)for(var h=t.children,l=0;l<h.length;l++)n.add(this.parseObject(h[l],e,i));if("LOD"===t.type)for(var c=t.levels,u=0;u<c.length;u++){var d=c[u],p=n.getObjectByProperty("uuid",d.object);void 0!==p&&n.addLevel(p,d.distance)}return n}});var Jo,Ko,Qo,$o,ts,es={UVMapping:O,CubeReflectionMapping:N,CubeRefractionMapping:k,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:z,SphericalReflectionMapping:305,CubeUVReflectionMapping:R,CubeUVRefractionMapping:B},is={RepeatWrapping:F,ClampToEdgeWrapping:U,MirroredRepeatWrapping:G},ns={NearestFilter:j,NearestMipMapNearestFilter:V,NearestMipMapLinearFilter:W,LinearFilter:H,LinearMipMapNearestFilter:X,LinearMipMapLinearFilter:q};function rs(t){this.manager=void 0!==t?t:eo,this.options=void 0}function as(){this.type="ShapePath",this.color=new Qt,this.subPaths=[],this.currentPath=null}function os(t){this.type="Font",this.data=t}function ss(t,e,i,n,r){var a=r.glyphs[t]||r.glyphs["?"];if(a){var o,s,h,l,c,u,d,p,f=new as;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,v=m.length;g<v;)switch(m[g++]){case"m":o=m[g++]*e+i,s=m[g++]*e+n,f.moveTo(o,s);break;case"l":o=m[g++]*e+i,s=m[g++]*e+n,f.lineTo(o,s);break;case"q":h=m[g++]*e+i,l=m[g++]*e+n,c=m[g++]*e+i,u=m[g++]*e+n,f.quadraticCurveTo(c,u,h,l);break;case"b":h=m[g++]*e+i,l=m[g++]*e+n,c=m[g++]*e+i,u=m[g++]*e+n,d=m[g++]*e+i,p=m[g++]*e+n,f.bezierCurveTo(c,u,d,p,h,l)}return{offsetX:a.ha*e,path:f}}}function hs(t){this.manager=void 0!==t?t:eo}function ls(){}rs.prototype={constructor:rs,setOptions:function(t){return this.options=t,this},load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=$a.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0),a;fetch(t).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,r.options)}).then(function(i){$a.add(t,i),e&&e(i),r.manager.itemEnd(t)}).catch(function(e){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),r.manager.itemStart(t)},setCrossOrigin:function(){return this},setPath:function(t){return this.path=t,this}},Object.assign(as.prototype,{moveTo:function(t,e){this.currentPath=new Io,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,i,n){this.currentPath.quadraticCurveTo(t,e,i,n)},bezierCurveTo:function(t,e,i,n,r,a){this.currentPath.bezierCurveTo(t,e,i,n,r,a)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function i(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i],a=new Oo;a.curves=r.curves,e.push(a)}return e}function n(t,e){for(var i=e.length,n=!1,r=i-1,a=0;a<i;r=a++){var o=e[r],s=e[a],h=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=e[a],h=-h,s=e[r],l=-l),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var c=l*(t.x-o.x)-h*(t.y-o.y);if(0===c)return!0;if(c<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return n}var r=ea.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return i(a);var o,s,h,l=[];if(1===a.length)return s=a[0],(h=new Oo).curves=s.curves,l.push(h),l;var c=!r(a[0].getPoints());c=t?!c:c;var u,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=a.length;v<y;v++)o=r(u=(s=a[v]).getPoints()),(o=t?!o:o)?(!c&&f[g]&&g++,f[g]={s:new Oo,p:u},f[g].s.curves=s.curves,c&&g++,m[g]=[]):m[g].push({h:s,p:u[0]});if(!f[0])return i(a);if(f.length>1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)p[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],S=0;S<M.length;S++){for(var A=M[S],T=!0,L=0;L<f.length;L++)n(A.p,f[L].p)&&(w!==L&&b.push({froms:w,tos:L,hole:S}),T?(T=!1,p[L].push(A)):x=!0);T&&p[w].push(A)}b.length>0&&(x||(m=p))}v=0;for(var C=f.length;v<C;v++){h=f[v].s,l.push(h);for(var P=0,E=(d=m[v]).length;P<E;P++)h.holes.push(d[P].h)}return l}}),Object.assign(os.prototype,{isFont:!0,generateShapes:function(t,e){void 0===e&&(e=100);for(var i=[],n=function(t,e,i){for(var n=Array.from?Array.from(t):String(t).split(""),r=e/i.resolution,a=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,o=[],s=0,h=0,l=0;l<n.length;l++){var c=n[l];if("\n"===c)s=0,h-=a;else{var u=ss(c,r,s,h,i);s+=u.offsetX,o.push(u.path)}}return o}(t,e,this.data),r=0,a=n.length;r<a;r++)Array.prototype.push.apply(i,n[r].toShapes());return i}}),Object.assign(hs.prototype,{load:function(t,e,i,n){var r=this,a=new no(this.manager);a.setPath(this.path),a.load(t,function(t){var i;try{i=JSON.parse(t)}catch(e){i=JSON.parse(t.substring(65,t.length-2))}var n=r.parse(i);e&&e(n)},i,n)},parse:function(t){return new os(t)},setPath:function(t){return this.path=t,this}}),ls.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,i=0,n=e.length;i<n;i+=2){var r=e[i],a=e[i+1];if(r.test(t))return a}return null}},Object.assign(ls.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(t,e,i){for(var n=[],r=0;r<t.length;++r)n[r]=this.createMaterial(t[r],e,i);return n},createMaterial:(Jo={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},Ko=new Qt,Qo=new lo,$o=new Ho,function(t,e,i){var n={};function r(t,r,a,o,s){var h,l=e+t,c=ls.Handlers.get(l);null!==c?h=c.load(l):(Qo.setCrossOrigin(i),h=Qo.load(l)),void 0!==r&&(h.repeat.fromArray(r),1!==r[0]&&(h.wrapS=F),1!==r[1]&&(h.wrapT=F)),void 0!==a&&h.offset.fromArray(a),void 0!==o&&("repeat"===o[0]&&(h.wrapS=F),"mirror"===o[0]&&(h.wrapS=G),"repeat"===o[1]&&(h.wrapT=F),"mirror"===o[1]&&(h.wrapT=G)),void 0!==s&&(h.anisotropy=s);var u=Mt.generateUUID();return n[u]=h,u}var a={uuid:Mt.generateUUID(),type:"MeshLambertMaterial"};for(var o in t){var s=t[o];switch(o){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":case"colorAmbient":case"mapAmbient":case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":default:break;case"DbgName":a.name=s;break;case"blending":a.blending=Jo[s];break;case"colorDiffuse":a.color=Ko.fromArray(s).getHex();break;case"colorSpecular":a.specular=Ko.fromArray(s).getHex();break;case"colorEmissive":a.emissive=Ko.fromArray(s).getHex();break;case"specularCoef":a.shininess=s;break;case"shading":"basic"===s.toLowerCase()&&(a.type="MeshBasicMaterial"),"phong"===s.toLowerCase()&&(a.type="MeshPhongMaterial"),"standard"===s.toLowerCase()&&(a.type="MeshStandardMaterial");break;case"mapDiffuse":a.map=r(s,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy);break;case"mapEmissive":a.emissiveMap=r(s,t.mapEmissiveRepeat,t.mapEmissiveOffset,t.mapEmissiveWrap,t.mapEmissiveAnisotropy);break;case"mapLight":a.lightMap=r(s,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy);break;case"mapAO":a.aoMap=r(s,t.mapAORepeat,t.mapAOOffset,t.mapAOWrap,t.mapAOAnisotropy);break;case"mapBump":a.bumpMap=r(s,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy);break;case"mapBumpScale":a.bumpScale=s;break;case"mapNormal":a.normalMap=r(s,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy);break;case"mapNormalFactor":a.normalScale=s;break;case"mapSpecular":a.specularMap=r(s,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy);break;case"mapMetalness":a.metalnessMap=r(s,t.mapMetalnessRepeat,t.mapMetalnessOffset,t.mapMetalnessWrap,t.mapMetalnessAnisotropy);break;case"mapRoughness":a.roughnessMap=r(s,t.mapRoughnessRepeat,t.mapRoughnessOffset,t.mapRoughnessWrap,t.mapRoughnessAnisotropy);break;case"mapAlpha":a.alphaMap=r(s,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy);break;case"flipSided":a.side=1;break;case"doubleSided":a.side=2;break;case"transparency":a.opacity=s;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":a[o]=s;break;case"vertexColors":!0===s&&(a.vertexColors=2),"face"===s&&(a.vertexColors=1)}}return"MeshBasicMaterial"===a.type&&delete a.emissive,"MeshPhongMaterial"!==a.type&&delete a.specular,a.opacity<1&&(a.transparent=!0),$o.setTextures(n),$o.parse(a)})});var cs={getContext:function(){return void 0===ts&&(ts=new(window.AudioContext||window.webkitAudioContext)),ts},setContext:function(t){ts=t}};function us(t){this.manager=void 0!==t?t:eo}function ds(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new On,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new On,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function ps(t,e,i,n){de.call(this),this.type="CubeCamera";var r=90,a=new On(r,1,t,e);a.up.set(0,-1,0),a.lookAt(new Lt(1,0,0)),this.add(a);var o=new On(r,1,t,e);o.up.set(0,-1,0),o.lookAt(new Lt(-1,0,0)),this.add(o);var s=new On(r,1,t,e);s.up.set(0,0,1),s.lookAt(new Lt(0,1,0)),this.add(s);var h=new On(r,1,t,e);h.up.set(0,0,-1),h.lookAt(new Lt(0,-1,0)),this.add(h);var l=new On(r,1,t,e);l.up.set(0,-1,0),l.lookAt(new Lt(0,0,1)),this.add(l);var c=new On(r,1,t,e);c.up.set(0,-1,0),c.lookAt(new Lt(0,0,-1)),this.add(c),n=n||{format:tt,magFilter:H,minFilter:H},this.renderTarget=new Bt(i,i,n),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var i=t.getRenderTarget(),n=this.renderTarget,r=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,a),t.setRenderTarget(n,1),t.render(e,o),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,h),t.setRenderTarget(n,4),t.render(e,l),n.texture.generateMipmaps=r,t.setRenderTarget(n,5),t.render(e,c),t.setRenderTarget(i)},this.clear=function(t,e,i,n){for(var r=t.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)t.setRenderTarget(a,o),t.clear(e,i,n);t.setRenderTarget(r)}}function fs(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function ms(){de.call(this),this.type="AudioListener",this.context=cs.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0}function gs(t){de.call(this),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function vs(t){gs.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function ys(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function xs(t,e,i){this.binding=t,this.valueSize=i;var n,r=Float64Array;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":r=Array,n=this._select;break;default:n=this._lerp}this.buffer=new r(4*i),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Object.assign(us.prototype,{load:function(t,e,i,n){var r=new no(this.manager);r.setResponseType("arraybuffer"),r.setPath(this.path),r.load(t,function(t){var i=t.slice(0);cs.getContext().decodeAudioData(i,function(t){e(t)})},i,n)},setPath:function(t){return this.path=t,this}}),Object.assign(ds.prototype,{update:function(){var t,e,i,n,r,a,o,s,h=new At,l=new At;return function(c){if(t!==this||e!==c.focus||i!==c.fov||n!==c.aspect*this.aspect||r!==c.near||a!==c.far||o!==c.zoom||s!==this.eyeSep){t=this,e=c.focus,i=c.fov,n=c.aspect*this.aspect,r=c.near,a=c.far,o=c.zoom;var u,d,p=c.projectionMatrix.clone(),f=(s=this.eyeSep/2)*r/e,m=r*Math.tan(Mt.DEG2RAD*i*.5)/o;l.elements[12]=-s,h.elements[12]=s,u=-m*n+f,d=m*n+f,p.elements[0]=2*r/(d-u),p.elements[8]=(d+u)/(d-u),this.cameraL.projectionMatrix.copy(p),u=-m*n-f,d=m*n-f,p.elements[0]=2*r/(d-u),p.elements[8]=(d+u)/(d-u),this.cameraR.projectionMatrix.copy(p)}this.cameraL.matrixWorld.copy(c.matrixWorld).multiply(l),this.cameraR.matrixWorld.copy(c.matrixWorld).multiply(h)}}()}),ps.prototype=Object.create(de.prototype),ps.prototype.constructor=ps,Object.assign(fs.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),ms.prototype=Object.assign(Object.create(de.prototype),{constructor:ms,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},updateMatrixWorld:function(){var t=new Lt,e=new Tt,i=new Lt,n=new Lt,r=new fs;return function(a){de.prototype.updateMatrixWorld.call(this,a);var o=this.context.listener,s=this.up;if(this.timeDelta=r.getDelta(),this.matrixWorld.decompose(t,e,i),n.set(0,0,-1).applyQuaternion(e),o.positionX){var h=this.context.currentTime+this.timeDelta;o.positionX.linearRampToValueAtTime(t.x,h),o.positionY.linearRampToValueAtTime(t.y,h),o.positionZ.linearRampToValueAtTime(t.z,h),o.forwardX.linearRampToValueAtTime(n.x,h),o.forwardY.linearRampToValueAtTime(n.y,h),o.forwardZ.linearRampToValueAtTime(n.z,h),o.upX.linearRampToValueAtTime(s.x,h),o.upY.linearRampToValueAtTime(s.y,h),o.upZ.linearRampToValueAtTime(s.z,h)}else o.setPosition(t.x,t.y,t.z),o.setOrientation(n.x,n.y,n.z,s.x,s.y,s.z)}}()}),gs.prototype=Object.assign(Object.create(de.prototype),{constructor:gs,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setMediaElementSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying&&!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),this.startTime=this.context.currentTime,t.start(this.startTime,this.offset),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},setDetune:function(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1!==this.hasPlaybackControl&&this.loop},setLoop:function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}),vs.prototype=Object.assign(Object.create(gs.prototype),{constructor:vs,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){return this.panner.refDistance=t,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){return this.panner.rolloffFactor=t,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){return this.panner.distanceModel=t,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){return this.panner.maxDistance=t,this},setDirectionalCone:function(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this},updateMatrixWorld:function(){var t=new Lt,e=new Tt,i=new Lt,n=new Lt;return function(r){if(de.prototype.updateMatrixWorld.call(this,r),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(t,e,i),n.set(0,0,1).applyQuaternion(e);var a=this.panner;if(a.positionX){var o=this.context.currentTime+this.listener.timeDelta;a.positionX.linearRampToValueAtTime(t.x,o),a.positionY.linearRampToValueAtTime(t.y,o),a.positionZ.linearRampToValueAtTime(t.z,o),a.orientationX.linearRampToValueAtTime(n.x,o),a.orientationY.linearRampToValueAtTime(n.y,o),a.orientationZ.linearRampToValueAtTime(n.z,o)}else a.setPosition(t.x,t.y,t.z),a.setOrientation(n.x,n.y,n.z)}}}()}),Object.assign(ys.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),i=0;i<e.length;i++)t+=e[i];return t/e.length}}),Object.assign(xs.prototype,{accumulate:function(t,e){var i=this.buffer,n=this.valueSize,r=t*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)i[r+o]=i[o];a=e}else{var s=e/(a+=e);this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,r<1){var o=3*e;this._mixBufferRegion(i,n,o,1-r,e)}for(var s=e,h=e+e;s!==h;++s)if(i[s]!==i[s+e]){a.setValue(i,n);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,i=this.valueSize,n=3*i;t.getValue(e,n);for(var r=i,a=n;r!==a;++r)e[r]=e[n+r%i];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,i,n,r){if(n>=.5)for(var a=0;a!==r;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,n){Tt.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=e+o;t[s]=t[s]*a+t[i+o]*n}}});var bs,ws,_s,Ms,Ss,As,Ts,Ls,Cs,Ps,Es,Ds,Is,Os="\\[\\]\\.:\\/";function Ns(t,e,i){var n=i||ks.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function ks(t,e,i){this.path=e,this.parsedPath=i||ks.parseTrackName(e),this.node=ks.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function zs(){this.uuid=Mt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function Rs(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,a=new Array(r),o={endingStart:gt,endingEnd:gt},s=0;s!==r;++s){var h=n[s].createInterpolant(null);a[s]=h,h.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Bs(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Fs(t){"string"==typeof t&&(t=arguments[1]),this.value=t}function Us(){Ee.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Gs(t,e,i){Jn.call(this,t,e),this.meshPerAttribute=i||1}function js(t,e,i,n){"number"==typeof i&&(n=i,i=!1),ve.call(this,t,e,i),this.meshPerAttribute=n||1}function Vs(t,e,i,n){this.ray=new Ze(t,e),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return this.Points}}})}function Ws(t,e){return t.distance-e.distance}function Hs(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n))for(var r=t.children,a=0,o=r.length;a<o;a++)Hs(r[a],e,i,!0)}function Xs(t,e,i){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==i?i:0,this}function qs(t,e,i){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==i?i:0,this}function Ys(t,e){this.min=void 0!==t?t:new St(1/0,1/0),this.max=void 0!==e?e:new St(-1/0,-1/0)}function Zs(t,e){this.start=void 0!==t?t:new Lt,this.end=void 0!==e?e:new Lt}function Js(t){de.call(this),this.material=t,this.render=function(){}}function Ks(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16711680,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var h=new Ee,l=new Ae(2*o*3,3);h.addAttribute("position",l),or.call(this,h,new rr({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Qs(t,e){de.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var i=new Ee,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,a=1;r<32;r++,a++){var o=r/32*Math.PI*2,s=a/32*Math.PI*2;n.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}i.addAttribute("position",new Ae(n,3));var h=new rr({fog:!1});this.cone=new or(i,h),this.add(this.cone),this.update()}function $s(t){var e=[];t&&t.isBone&&e.push(t);for(var i=0;i<t.children.length;i++)e.push.apply(e,$s(t.children[i]));return e}function th(t){for(var e=$s(t),i=new Ee,n=[],r=[],a=new Qt(0,0,1),o=new Qt(0,1,0),s=0;s<e.length;s++){var h=e[s];h.parent&&h.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}i.addAttribute("position",new Ae(n,3)),i.addAttribute("color",new Ae(r,3));var l=new rr({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0});or.call(this,i,l),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}function eh(t,e,i){this.light=t,this.light.updateMatrixWorld(),this.color=i;var n=new ua(e,4,2),r=new Ke({wireframe:!0,fog:!1});Qe.call(this,n,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function ih(t,e){this.type="RectAreaLightHelper",this.light=t,this.color=e;var i=new Ee;i.addAttribute("position",new Ae([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere();var n=new rr({fog:!1});ar.call(this,i,n);var r=new Ee;r.addAttribute("position",new Ae([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new Qe(r,new Ke({side:1,fog:!1}))),this.update()}function nh(t,e,i){de.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;var n=new _r(e);n.rotateY(.5*Math.PI),this.material=new Ke({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=2);var r=n.getAttribute("position"),a=new Float32Array(3*r.count);n.addAttribute("color",new ve(a,3)),this.add(new Qe(n,this.material)),this.update()}function rh(t,e,i,n){t=t||10,e=e||10,i=new Qt(void 0!==i?i:4473924),n=new Qt(void 0!==n?n:8947848);for(var r=e/2,a=t/e,o=t/2,s=[],h=[],l=0,c=0,u=-o;l<=e;l++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var d=l===r?i:n;d.toArray(h,c),c+=3,d.toArray(h,c),c+=3,d.toArray(h,c),c+=3,d.toArray(h,c),c+=3}var p=new Ee;p.addAttribute("position",new Ae(s,3)),p.addAttribute("color",new Ae(h,3));var f=new rr({vertexColors:2});or.call(this,p,f)}function ah(t,e,i,n,r,a){t=t||10,e=e||16,i=i||8,n=n||64,r=new Qt(void 0!==r?r:4473924),a=new Qt(void 0!==a?a:8947848);var o,s,h,l,c,u,d,p=[],f=[];for(l=0;l<=e;l++)h=l/e*(2*Math.PI),o=Math.sin(h)*t,s=Math.cos(h)*t,p.push(0,0,0),p.push(o,0,s),d=1&l?r:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(l=0;l<=i;l++)for(d=1&l?r:a,u=t-t/i*l,c=0;c<n;c++)h=c/n*(2*Math.PI),o=Math.sin(h)*u,s=Math.cos(h)*u,p.push(o,0,s),f.push(d.r,d.g,d.b),h=(c+1)/n*(2*Math.PI),o=Math.sin(h)*u,s=Math.cos(h)*u,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new Ee;m.addAttribute("position",new Ae(p,3)),m.addAttribute("color",new Ae(f,3));var g=new rr({vertexColors:2});or.call(this,m,g)}function oh(t,e,i,n){this.audio=t,this.range=e||1,this.divisionsInnerAngle=i||16,this.divisionsOuterAngle=n||2;var r=new Ee,a=this.divisionsInnerAngle+2*this.divisionsOuterAngle,o=new Float32Array(3*(3*a+3));r.addAttribute("position",new ve(o,3));var s=new rr({color:65280}),h=new rr({color:16776960});ar.call(this,r,[h,s]),this.update()}function sh(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16776960,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry&&(o=s.faces.length);var h=new Ee,l=new Ae(2*o*3,3);h.addAttribute("position",l),or.call(this,h,new rr({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function hh(t,e,i){de.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,void 0===e&&(e=1);var n=new Ee;n.addAttribute("position",new Ae([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var r=new rr({fog:!1});this.lightPlane=new ar(n,r),this.add(this.lightPlane),(n=new Ee).addAttribute("position",new Ae([0,0,0,0,0,1],3)),this.targetLine=new ar(n,r),this.add(this.targetLine),this.update()}function lh(t){var e=new Ee,i=new rr({color:16777215,vertexColors:1}),n=[],r=[],a={},o=new Qt(16755200),s=new Qt(16711680),h=new Qt(43775),l=new Qt(16777215),c=new Qt(3355443);function u(t,e,i){d(t,i),d(e,i)}function d(t,e){n.push(0,0,0),r.push(e.r,e.g,e.b),void 0===a[t]&&(a[t]=[]),a[t].push(n.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",h),u("u2","u3",h),u("u3","u1",h),u("c","t",l),u("p","c",c),u("cn1","cn2",c),u("cn3","cn4",c),u("cf1","cf2",c),u("cf3","cf4",c),e.addAttribute("position",new Ae(n,3)),e.addAttribute("color",new Ae(r,3)),or.call(this,e,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function ch(t,e){this.object=t,void 0===e&&(e=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),r=new Ee;r.setIndex(new ve(i,1)),r.addAttribute("position",new ve(n,3)),or.call(this,r,new rr({color:e})),this.matrixAutoUpdate=!1,this.update()}function uh(t,e){this.type="Box3Helper",this.box=t;var i=void 0!==e?e:16776960,n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Ee;r.setIndex(new ve(n,1)),r.addAttribute("position",new Ae([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),or.call(this,r,new rr({color:i})),this.geometry.computeBoundingSphere()}function dh(t,e,i){this.type="PlaneHelper",this.plane=t,this.size=void 0===e?1:e;var n=void 0!==i?i:16776960,r=new Ee;r.addAttribute("position",new Ae([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),r.computeBoundingSphere(),ar.call(this,r,new rr({color:n}));var a=new Ee;a.addAttribute("position",new Ae([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Qe(a,new Ke({color:n,opacity:.2,transparent:!0,depthWrite:!1})))}function ph(t,e,i,n,r,a){de.call(this),void 0===t&&(t=new Lt(0,0,1)),void 0===e&&(e=new Lt(0,0,0)),void 0===i&&(i=1),void 0===n&&(n=16776960),void 0===r&&(r=.2*i),void 0===a&&(a=.2*r),void 0===Ps&&((Ps=new Ee).addAttribute("position",new Ae([0,0,0,0,1,0],3)),(Es=new wa(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new ar(Ps,new rr({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Qe(Es,new Ke({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,a)}function fh(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new Ee;i.addAttribute("position",new Ae(e,3)),i.addAttribute("color",new Ae([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var n=new rr({vertexColors:2});or.call(this,i,n)}function mh(t){xo.call(this,t),this.type="catmullrom",this.closed=!0}function gh(t){xo.call(this,t),this.type="catmullrom"}function vh(t){xo.call(this,t),this.type="catmullrom"}Object.assign(Ns.prototype,{getValue:function(t,e){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(ks,{Composite:Ns,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new ks.Composite(t,e,i):new ks(t,e,i)},sanitizeNodeName:(Cs=new RegExp("["+Os+"]","g"),function(t){return t.replace(/\s/g,"_").replace(Cs,"")}),parseTrackName:(bs="[^"+Os+"]",ws="[^"+Os.replace("\\.","")+"]",_s=/((?:WC+[\/:])*)/.source.replace("WC",bs),Ms=/(WCOD+)?/.source.replace("WCOD",ws),Ss=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bs),As=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bs),Ts=new RegExp("^"+_s+Ms+Ss+As+"$"),Ls=["material","materials","bones"],function(t){var e=Ts.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){var r=i.nodeName.substring(n+1);-1!==Ls.indexOf(r)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=r)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){var n=function(t){for(var i=0;i<t.length;i++){var r=t[i];if(r.name===e||r.uuid===e)return r;var a=n(r.children);if(a)return a}return null},r=n(t.children);if(r)return r}return null}}),Object.assign(ks.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=ks.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var a=e.objectIndex;switch(i){case"materials":if(!t.material)return;if(!t.material.materials)return;t=t.material.materials;break;case"bones":if(!t.skeleton)return;t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[i])return;t=t[i]}if(void 0!==a){if(void 0===t[a])return;t=t[a]}}var s=t[n];if(void 0!==s){var h=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?h=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(h=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return;if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes)return;for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(t.geometry.morphAttributes.position[o].name===r){r=o;break}}else{if(!t.geometry.morphTargets)return;for(o=0;o<this.node.geometry.morphTargets.length;o++)if(t.geometry.morphTargets[o].name===r){r=o;break}}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][h]}else e.nodeName}},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(ks.prototype,{_getValue_unbound:ks.prototype.getValue,_setValue_unbound:ks.prototype.setValue}),Object.assign(zs.prototype,{isAnimationObjectGroup:!0,add:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,h=0,l=arguments.length;h!==l;++h){var c=arguments[h],u=c.uuid,d=n[u];if(void 0===d){d=e++,n[u]=d,t.push(c);for(var p=0,f=s;p!==f;++p)o[p].push(new ks(c,r[p],a[p]))}else if(d<i){t[d];var m=--i,g=t[m];for(n[g.uuid]=d,t[d]=g,n[u]=m,t[m]=c,p=0,f=s;p!==f;++p){var v=o[p],y=v[m],x=v[d];v[d]=y,void 0===x&&(x=new ks(c,r[p],a[p])),v[m]=x}}else t[d]}this.nCachedObjects_=i},remove:function(){for(var t=this._objects,e=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,r=n.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],h=s.uuid,l=i[h];if(void 0!==l&&l>=e){var c=e++,u=t[c];i[u.uuid]=l,t[l]=u,i[h]=c,t[c]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[c],g=f[l];f[l]=m,f[c]=g}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var h=arguments[o].uuid,l=n[h];if(void 0!==l)if(delete n[h],l<i){var c=--i,u=t[c],d=t[v=--e];n[u.uuid]=l,t[l]=u,n[d.uuid]=c,t[c]=d,t.pop();for(var p=0,f=a;p!==f;++p){var m=(y=r[p])[c],g=y[v];y[l]=m,y[c]=g,y.pop()}}else{var v;for(n[(d=t[v=--e]).uuid]=l,t[l]=d,t.pop(),p=0,f=a;p!==f;++p){var y;(y=r[p])[l]=y[v],y.pop()}}}this.nCachedObjects_=i},subscribe_:function(t,e){var i=this._bindingsIndicesByPath,n=i[t],r=this._bindings;if(void 0!==n)return r[n];var a=this._paths,o=this._parsedPaths,s=this._objects,h=s.length,l=this.nCachedObjects_,c=new Array(h);n=r.length,i[t]=n,a.push(t),o.push(e),r.push(c);for(var u=l,d=s.length;u!==d;++u){var p=s[u];c[u]=new ks(p,t,e)}return c},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){var n=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=i,a[i]=s,a.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}}),Object.assign(Rs.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){var n=this._clip.duration,r=t._clip.duration,a=r/n,o=n/r;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,i){return t.crossFadeFrom(this,e,i)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,i){var n=this._mixer,r=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,h=a.sampleValues;return s[0]=r,s[1]=r+i,h[0]=t/o,h[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,i,n){if(this.enabled){var r=this._startTime;if(null!==r){var a=(t-r)*i;if(a<0||0===i)return;this._startTime=null,e=i*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var h=this._interpolants,l=this._propertyBindings,c=0,u=h.length;c!==u;++c)h[c].evaluate(o),l[c].accumulate(n,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;null!==i&&(e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t,i=this._clip.duration,n=this.loop,r=this._loopCount,a=2202===n;if(0===t)return-1===r||!a||1&~r?e:i-e;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),e>=i||e<0){var o=Math.floor(e/i);e-=i*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var h=t<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&!(1&~r))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=vt,n.endingEnd=vt):(n.endingStart=t?this.zeroSlopeAtStart?vt:gt:yt,n.endingEnd=e?this.zeroSlopeAtEnd?vt:gt:yt)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=e,o[1]=r+t,s[1]=i,this}}),Bs.prototype=Object.assign(Object.create(g.prototype),{constructor:Bs,_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,h=this._bindingsByRootAndName,l=h[s];void 0===l&&(l={},h[s]=l);for(var c=0;c!==r;++c){var u=n[c],d=u.name,p=l[d];if(void 0!==p)a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[c].binding.parsedPath;++(p=new xs(ks.create(i,d,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[c]=p}o[c].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,i){var n=this._actions,r=this._actionsByClip,a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[i]=t},_removeInactiveAction:function(t){var e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,h=s[s.length-1],l=t._byClipCacheIndex;h._byClipCacheIndex=l,s[l]=h,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackAction:function(t){var e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_addInactiveBinding:function(t,e,i){var n=this._bindingsByRootAndName,r=n[e],a=this._bindings;void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],h=t._cacheIndex;s._cacheIndex=h,e[h]=s,e.pop(),delete o[r];t:{for(var l in o)break t;delete a[n]}},_lendBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&((i=new Ga(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=i),i},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Ka.findByName(i,t):t,a=null!==r?r.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var h=o.actionByRoot[n];if(void 0!==h)return h;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var l=new Rs(this,r,e);return this._bindAction(l,s),this._addInactiveAction(l,a,n),l},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Ka.findByName(i,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[n]||null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1,o=0;o!==i;++o)e[o]._update(n,t,r,a);var s=this._bindings,h=this._nActiveBindings;for(o=0;o!==h;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var h=a[o];this._deactivateAction(h);var l=h._cacheIndex,c=e[e.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,c._cacheIndex=l,e[l]=c,e.pop(),this._removeInactiveBindingsForAction(h)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[e];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Fs.prototype.clone=function(){return new Fs(void 0===this.value.clone?this.value:this.value.clone())},Us.prototype=Object.assign(Object.create(Ee.prototype),{constructor:Us,isInstancedBufferGeometry:!0,copy:function(t){return Ee.prototype.copy.call(this,t),this.maxInstancedCount=t.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),Gs.prototype=Object.assign(Object.create(Jn.prototype),{constructor:Gs,isInstancedInterleavedBuffer:!0,copy:function(t){return Jn.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),js.prototype=Object.assign(Object.create(ve.prototype),{constructor:js,isInstancedBufferAttribute:!0,copy:function(t){return ve.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(Vs.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera&&(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld))},intersectObject:function(t,e,i){var n=i||[];return Hs(t,this,n,e),n.sort(Ws),n},intersectObjects:function(t,e,i){var n=i||[];if(!1===Array.isArray(t))return n;for(var r=0,a=t.length;r<a;r++)Hs(t[r],this,n,e);return n.sort(Ws),n}}),Object.assign(Xs.prototype,{set:function(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){var t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(Mt.clamp(e/this.radius,-1,1))),this}}),Object.assign(qs.prototype,{set:function(t,e,i){return this.radius=t,this.theta=e,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,i){return this.radius=Math.sqrt(t*t+i*i),this.theta=Math.atan2(t,i),this.y=e,this}}),Object.assign(Ys.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new St;return function(e,i){var n=t.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),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=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){return void 0===t&&(t=new St),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(t=new St),this.isEmpty()?t.set(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},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(e=new St),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return void 0===e&&(e=new St),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new St;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(Zs.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(t=new Lt),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(t=new Lt),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(e=new Lt),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new Lt,e=new Lt;return function(i,n){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),a=e.dot(t)/r;return n&&(a=Mt.clamp(a,0,1)),a}}(),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e);return void 0===i&&(i=new Lt),this.delta(i).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Js.prototype=Object.create(de.prototype),Js.prototype.constructor=Js,Js.prototype.isImmediateRenderObject=!0,Ks.prototype=Object.create(or.prototype),Ks.prototype.constructor=Ks,Ks.prototype.update=function(){var t=new Lt,e=new Lt,i=new Ct;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,h=o.faces,l=0,c=0,u=h.length;c<u;c++)for(var d=h[c],p=0,f=d.vertexNormals.length;p<f;p++){var m=s[d[n[p]]],g=d.vertexNormals[p];t.copy(m).applyMatrix4(r),e.copy(g).applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),a.setXYZ(l,t.x,t.y,t.z),l+=1,a.setXYZ(l,e.x,e.y,e.z),l+=1}else if(o&&o.isBufferGeometry){var v=o.attributes.position,y=o.attributes.normal;for(l=0,p=0,f=v.count;p<f;p++)t.set(v.getX(p),v.getY(p),v.getZ(p)).applyMatrix4(r),e.set(y.getX(p),y.getY(p),y.getZ(p)),e.applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),a.setXYZ(l,t.x,t.y,t.z),l+=1,a.setXYZ(l,e.x,e.y,e.z),l+=1}a.needsUpdate=!0}}(),Qs.prototype=Object.create(de.prototype),Qs.prototype.constructor=Qs,Qs.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Qs.prototype.update=function(){var t=new Lt;return function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,i=e*Math.tan(this.light.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}(),th.prototype=Object.create(or.prototype),th.prototype.constructor=th,th.prototype.updateMatrixWorld=function(){var t=new Lt,e=new At,i=new At;return function(n){var r=this.bones,a=this.geometry,o=a.getAttribute("position");i.getInverse(this.root.matrixWorld);for(var s=0,h=0;s<r.length;s++){var l=r[s];l.parent&&l.parent.isBone&&(e.multiplyMatrices(i,l.matrixWorld),t.setFromMatrixPosition(e),o.setXYZ(h,t.x,t.y,t.z),e.multiplyMatrices(i,l.parent.matrixWorld),t.setFromMatrixPosition(e),o.setXYZ(h+1,t.x,t.y,t.z),h+=2)}a.getAttribute("position").needsUpdate=!0,de.prototype.updateMatrixWorld.call(this,n)}}(),eh.prototype=Object.create(Qe.prototype),eh.prototype.constructor=eh,eh.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},eh.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},ih.prototype=Object.create(ar.prototype),ih.prototype.constructor=ih,ih.prototype.update=function(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var t=this.material.color,e=Math.max(t.r,t.g,t.b);e>1&&t.multiplyScalar(1/e),this.children[0].material.color.copy(this.material.color)}},ih.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},nh.prototype=Object.create(de.prototype),nh.prototype.constructor=nh,nh.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},nh.prototype.update=function(){var t=new Lt,e=new Qt,i=new Qt;return function(){var n=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var r=n.geometry.getAttribute("color");e.copy(this.light.color),i.copy(this.light.groundColor);for(var a=0,o=r.count;a<o;a++){var s=a<o/2?e:i;r.setXYZ(a,s.r,s.g,s.b)}r.needsUpdate=!0}n.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate())}}(),rh.prototype=Object.create(or.prototype),rh.prototype.constructor=rh,ah.prototype=Object.create(or.prototype),ah.prototype.constructor=ah,oh.prototype=Object.create(ar.prototype),oh.prototype.constructor=oh,oh.prototype.update=function(){var t,e,i=this.audio,n=this.range,r=this.divisionsInnerAngle,a=this.divisionsOuterAngle,o=Mt.degToRad(i.panner.coneInnerAngle),s=Mt.degToRad(i.panner.coneOuterAngle),h=o/2,l=s/2,c=0,u=0,d=this.geometry,p=d.attributes.position;function f(i,r,a,o){var s=(r-i)/a;for(p.setXYZ(c,0,0,0),u++,t=i;t<r;t+=s)e=c+u,p.setXYZ(e,Math.sin(t)*n,0,Math.cos(t)*n),p.setXYZ(e+1,Math.sin(Math.min(t+s,r))*n,0,Math.cos(Math.min(t+s,r))*n),p.setXYZ(e+2,0,0,0),u+=3;d.addGroup(c,u,o),c+=u,u=0}d.clearGroups(),f(-l,-h,a,0),f(-h,h,r,1),f(h,l,a,0),p.needsUpdate=!0,o===s&&(this.material[0].visible=!1)},oh.prototype.dispose=function(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()},sh.prototype=Object.create(or.prototype),sh.prototype.constructor=sh,sh.prototype.update=function(){var t=new Lt,e=new Lt,i=new Ct;return function(){this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,r=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,h=0,l=0,c=s.length;l<c;l++){var u=s[l],d=u.normal;t.copy(o[u.a]).add(o[u.b]).add(o[u.c]).divideScalar(3).applyMatrix4(n),e.copy(d).applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),r.setXYZ(h,t.x,t.y,t.z),h+=1,r.setXYZ(h,e.x,e.y,e.z),h+=1}r.needsUpdate=!0}}(),hh.prototype=Object.create(de.prototype),hh.prototype.constructor=hh,hh.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},hh.prototype.update=function(){var t=new Lt,e=new Lt,i=new Lt;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),i.subVectors(e,t),this.lightPlane.lookAt(e),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(e),this.targetLine.scale.z=i.length()}}(),lh.prototype=Object.create(or.prototype),lh.prototype.constructor=lh,lh.prototype.update=function(){var t,e,i=new Lt,n=new In;function r(r,a,o,s){i.set(a,o,s).unproject(n);var h=e[r];if(void 0!==h)for(var l=t.getAttribute("position"),c=0,u=h.length;c<u;c++)l.setXYZ(h[c],i.x,i.y,i.z)}return function(){t=this.geometry,e=this.pointMap,n.projectionMatrix.copy(this.camera.projectionMatrix),r("c",0,0,-1),r("t",0,0,1),r("n1",-1,-1,-1),r("n2",1,-1,-1),r("n3",-1,1,-1),r("n4",1,1,-1),r("f1",-1,-1,1),r("f2",1,-1,1),r("f3",-1,1,1),r("f4",1,1,1),r("u1",.7,1.1,-1),r("u2",-.7,1.1,-1),r("u3",0,2,-1),r("cf1",-1,0,1),r("cf2",1,0,1),r("cf3",0,-1,1),r("cf4",0,1,1),r("cn1",-1,0,-1),r("cn2",1,0,-1),r("cn3",0,-1,-1),r("cn4",0,1,-1),t.getAttribute("position").needsUpdate=!0}}(),ch.prototype=Object.create(or.prototype),ch.prototype.constructor=ch,ch.prototype.update=function(){var t=new Ut;return function(e){if(void 0!==this.object&&t.setFromObject(this.object),!t.isEmpty()){var i=t.min,n=t.max,r=this.geometry.attributes.position,a=r.array;a[0]=n.x,a[1]=n.y,a[2]=n.z,a[3]=i.x,a[4]=n.y,a[5]=n.z,a[6]=i.x,a[7]=i.y,a[8]=n.z,a[9]=n.x,a[10]=i.y,a[11]=n.z,a[12]=n.x,a[13]=n.y,a[14]=i.z,a[15]=i.x,a[16]=n.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=n.x,a[22]=i.y,a[23]=i.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),ch.prototype.setFromObject=function(t){return this.object=t,this.update(),this},ch.prototype.copy=function(t){return or.prototype.copy.call(this,t),this.object=t.object,this},ch.prototype.clone=function(){return(new this.constructor).copy(this)},uh.prototype=Object.create(or.prototype),uh.prototype.constructor=uh,uh.prototype.updateMatrixWorld=function(t){var e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),de.prototype.updateMatrixWorld.call(this,t))},dh.prototype=Object.create(ar.prototype),dh.prototype.constructor=dh,dh.prototype.updateMatrixWorld=function(t){var e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?1:0,this.lookAt(this.plane.normal),de.prototype.updateMatrixWorld.call(this,t)},ph.prototype=Object.create(de.prototype),ph.prototype.constructor=ph,ph.prototype.setDirection=(Is=new Lt,function(t){t.y>.99999?this.quaternion.set(0,0,0,1):t.y<-.99999?this.quaternion.set(1,0,0,0):(Is.set(t.z,0,-t.x).normalize(),Ds=Math.acos(t.y),this.quaternion.setFromAxisAngle(Is,Ds))}),ph.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},ph.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},ph.prototype.copy=function(t){return de.prototype.copy.call(this,t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this},ph.prototype.clone=function(){return(new this.constructor).copy(this)},fh.prototype=Object.create(or.prototype),fh.prototype.constructor=fh,co.create=function(t,e){return t.prototype=Object.create(co.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(Do.prototype,{createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new ge,i=0,n=t.length;i<n;i++){var r=t[i];e.vertices.push(new Lt(r.x,r.y,r.z||0))}return e}}),Object.assign(Io.prototype,{fromPoints:function(t){this.setFromPoints(t)}}),mh.prototype=Object.create(xo.prototype),gh.prototype=Object.create(xo.prototype),vh.prototype=Object.create(xo.prototype),Object.assign(vh.prototype,{initFromArray:function(){},getControlPointsArray:function(){},reparametrizeByArcLength:function(){}}),rh.prototype.setColors=function(){},th.prototype.update=function(){},Object.assign(ls.prototype,{extractUrlBase:function(t){return Xo.extractUrlBase(t)}}),Object.assign(Zo.prototype,{setTexturePath:function(t){return this.setResourcePath(t)}}),Object.assign(Ys.prototype,{center:function(t){return this.getCenter(t)},empty:function(){return this.isEmpty()},isIntersectionBox:function(t){return this.intersectsBox(t)},size:function(t){return this.getSize(t)}}),Object.assign(Ut.prototype,{center:function(t){return this.getCenter(t)},empty:function(){return this.isEmpty()},isIntersectionBox:function(t){return this.intersectsBox(t)},isIntersectionSphere:function(t){return this.intersectsSphere(t)},size:function(t){return this.getSize(t)}}),Zs.prototype.center=function(t){return this.getCenter(t)},Object.assign(Mt,{random16:function(){return Math.random()},nearestPowerOfTwo:function(t){return Mt.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return Mt.ceilPowerOfTwo(t)}}),Object.assign(Ct.prototype,{flattenToArrayOffset:function(t,e){return this.toArray(t,e)},multiplyVector3:function(t){return t.applyMatrix3(this)},multiplyVector3Array:function(){},applyToBuffer:function(t){return this.applyToBufferAttribute(t)},applyToVector3Array:function(){}}),Object.assign(At.prototype,{extractPosition:function(t){return this.copyPosition(t)},flattenToArrayOffset:function(t,e){return this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new Lt),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return this.makeRotationFromQuaternion(t)},multiplyToArray:function(){},multiplyVector3:function(t){return t.applyMatrix4(this)},multiplyVector4:function(t){return t.applyMatrix4(this)},multiplyVector3Array:function(){},rotateAxis:function(t){t.transformDirection(this)},crossVector:function(t){return t.applyMatrix4(this)},translate:function(){},rotateX:function(){},rotateY:function(){},rotateZ:function(){},rotateByAxis:function(){},applyToBuffer:function(t){return this.applyToBufferAttribute(t)},applyToVector3Array:function(){},makeFrustum:function(t,e,i,n,r,a){return this.makePerspective(t,e,n,i,r,a)}}),jt.prototype.isIntersectionLine=function(t){return this.intersectsLine(t)},Tt.prototype.multiplyVector3=function(t){return t.applyQuaternion(this)},Object.assign(Ze.prototype,{isIntersectionBox:function(t){return this.intersectsBox(t)},isIntersectionPlane:function(t){return this.intersectsPlane(t)},isIntersectionSphere:function(t){return this.intersectsSphere(t)}}),Object.assign(Je.prototype,{area:function(){return this.getArea()},barycoordFromPoint:function(t,e){return this.getBarycoord(t,e)},midpoint:function(t){return this.getMidpoint(t)},normal:function(t){return this.getNormal(t)},plane:function(t){return this.getPlane(t)}}),Object.assign(Je,{barycoordFromPoint:function(t,e,i,n,r){return Je.getBarycoord(t,e,i,n,r)},normal:function(t,e,i,n){return Je.getNormal(t,e,i,n)}}),Object.assign(Oo.prototype,{extractAllPoints:function(t){return this.extractPoints(t)},extrude:function(t){return new ra(this,t)},makeGeometry:function(t){return new ga(this,t)}}),Object.assign(St.prototype,{fromAttribute:function(t,e,i){return this.fromBufferAttribute(t,e,i)},distanceToManhattan:function(t){return this.manhattanDistanceTo(t)},lengthManhattan:function(){return this.manhattanLength()}}),Object.assign(Lt.prototype,{setEulerFromRotationMatrix:function(){},setEulerFromQuaternion:function(){},getPositionFromMatrix:function(t){return this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return this.setFromMatrixColumn(e,t)},applyProjection:function(t){return this.applyMatrix4(t)},fromAttribute:function(t,e,i){return this.fromBufferAttribute(t,e,i)},distanceToManhattan:function(t){return this.manhattanDistanceTo(t)},lengthManhattan:function(){return this.manhattanLength()}}),Object.assign(kt.prototype,{fromAttribute:function(t,e,i){return this.fromBufferAttribute(t,e,i)},lengthManhattan:function(){return this.manhattanLength()}}),Object.assign(ge.prototype,{computeTangents:function(){},computeLineDistances:function(){}}),Object.assign(de.prototype,{getChildByName:function(t){return this.getObjectByName(t)},renderDepth:function(){},translate:function(t,e){return this.translateOnAxis(e,t)},getWorldRotation:function(){}}),Object.defineProperties(de.prototype,{eulerOrder:{get:function(){return this.rotation.order},set:function(t){this.rotation.order=t}},useQuaternion:{get:function(){},set:function(){}}}),Object.defineProperties(tr.prototype,{objects:{get:function(){return this.levels}}}),Object.defineProperty(ir.prototype,"useVertexTexture",{get:function(){},set:function(){}}),er.prototype.initBones=function(){},Object.defineProperty(co.prototype,"__arcLengthDivisions",{get:function(){return this.arcLengthDivisions},set:function(t){this.arcLengthDivisions=t}}),On.prototype.setLens=function(t,e){void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(No.prototype,{onlyShadow:{set:function(){}},shadowCameraFov:{set:function(t){this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){}},shadowBias:{set:function(t){this.shadow.bias=t}},shadowDarkness:{set:function(){}},shadowMapWidth:{set:function(t){this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){this.shadow.mapSize.height=t}}}),Object.defineProperties(ve.prototype,{length:{get:function(){return this.array.length}},copyIndicesArray:function(){}}),Object.assign(Ee.prototype,{addIndex:function(t){this.setIndex(t)},addDrawCall:function(t,e,i){this.addGroup(t,e)},clearDrawCalls:function(){this.clearGroups()},computeTangents:function(){},computeOffsets:function(){}}),Object.defineProperties(Ee.prototype,{drawcalls:{get:function(){return this.groups}},offsets:{get:function(){return this.groups}}}),Object.assign(aa.prototype,{getArrays:function(){},addShapeList:function(){},addShape:function(){}}),Object.defineProperties(Fs.prototype,{dynamic:{set:function(){}},onUpdate:{value:function(){return this}}}),Object.defineProperties(qe.prototype,{wrapAround:{get:function(){},set:function(){}},overdraw:{get:function(){},set:function(){}},wrapRGB:{get:function(){return new Qt}},shading:{get:function(){},set:function(t){this.flatShading=1===t}}}),Object.defineProperties(Da.prototype,{metal:{get:function(){return!1},set:function(){}}}),Object.defineProperties(Ye.prototype,{derivatives:{get:function(){return this.extensions.derivatives},set:function(t){this.extensions.derivatives=t}}}),Object.assign(Xn.prototype,{clearTarget:function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},animate:function(t){this.setAnimationLoop(t)},getCurrentRenderTarget:function(){return this.getRenderTarget()},getMaxAnisotropy:function(){return this.capabilities.getMaxAnisotropy()},getPrecision:function(){return this.capabilities.precision},resetGLState:function(){return this.state.reset()},supportsFloatTextures:function(){return this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return this.capabilities.vertexTextures},supportsInstancedArrays:function(){return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){this.setScissorTest(t)},initMaterial:function(){},addPrePlugin:function(){},addPostPlugin:function(){},updateShadowMap:function(){},setFaceCulling:function(){}}),Object.defineProperties(Xn.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){this.shadowMap.type=t}},shadowMapCullFace:{get:function(){},set:function(){}}}),Object.defineProperties(Ln.prototype,{cullFace:{get:function(){},set:function(){}},renderReverseSided:{get:function(){},set:function(){}},renderSingleSided:{get:function(){},set:function(){}}}),Object.defineProperties(Bt.prototype,{activeCubeFace:{set:function(){}},activeMipMapLevel:{set:function(){}}}),Object.defineProperties(zt.prototype,{wrapS:{get:function(){return this.texture.wrapS},set:function(t){this.texture.wrapS=t}},wrapT:{get:function(){return this.texture.wrapT},set:function(t){this.texture.wrapT=t}},magFilter:{get:function(){return this.texture.magFilter},set:function(t){this.texture.magFilter=t}},minFilter:{get:function(){return this.texture.minFilter},set:function(t){this.texture.minFilter=t}},anisotropy:{get:function(){return this.texture.anisotropy},set:function(t){this.texture.anisotropy=t}},offset:{get:function(){return this.texture.offset},set:function(t){this.texture.offset=t}},repeat:{get:function(){return this.texture.repeat},set:function(t){this.texture.repeat=t}},format:{get:function(){return this.texture.format},set:function(t){this.texture.format=t}},type:{get:function(){return this.texture.type},set:function(t){this.texture.type=t}},generateMipmaps:{get:function(){return this.texture.generateMipmaps},set:function(t){this.texture.generateMipmaps=t}}}),Object.defineProperties(Wn.prototype,{standing:{set:function(){}},userHeight:{set:function(){}}}),gs.prototype.load=function(t){var e=this;return(new us).load(t,function(t){e.setBuffer(t)}),this},ys.prototype.getData=function(){return this.getFrequencyData()},ps.prototype.updateCubeMap=function(t,e){return this.update(t,e)},It.crossOrigin=void 0,It.loadTexture=function(t,e,i,n){var r=new lo;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},It.loadTextureCube=function(t,e,i,n){var r=new ho;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},It.loadCompressedTexture=function(){},It.loadCompressedTextureCube=function(){};var yh=Object.freeze({__proto__:null,InstancedMesh:{},WebGLMultisampleRenderTarget:Rt,WebGLRenderTargetCube:Bt,WebGLRenderTarget:zt,WebGLRenderer:Xn,ShaderLib:ee,UniformsLib:te,UniformsUtils:Jt,ShaderChunk:Wt,FogExp2:qn,Fog:Yn,Scene:Zn,Sprite:$n,LOD:tr,SkinnedMesh:er,Skeleton:ir,Bone:nr,Mesh:Qe,LineSegments:or,LineLoop:sr,Line:ar,Points:lr,Group:Dn,VideoTexture:cr,DataTexture:Ft,DataTexture3D:ui,CompressedTexture:ur,CubeTexture:ci,CanvasTexture:dr,DepthTexture:pr,Texture:Nt,AnimationLoader:ro,CompressedTextureLoader:ao,DataTextureLoader:oo,CubeTextureLoader:ho,TextureLoader:lo,ObjectLoader:Zo,MaterialLoader:Ho,BufferGeometryLoader:qo,DefaultLoadingManager:eo,LoadingManager:to,ImageLoader:so,ImageBitmapLoader:rs,FontLoader:hs,FileLoader:no,Loader:ls,LoaderUtils:Xo,Cache:$a,AudioLoader:us,SpotLightShadow:Ro,SpotLight:Bo,PointLight:Fo,RectAreaLight:Wo,HemisphereLight:ko,DirectionalLightShadow:Go,DirectionalLight:jo,AmbientLight:Vo,LightShadow:zo,Light:No,StereoCamera:ds,PerspectiveCamera:On,OrthographicCamera:Uo,CubeCamera:ps,ArrayCamera:Nn,Camera:In,AudioListener:ms,PositionalAudio:vs,AudioContext:cs,AudioAnalyser:ys,Audio:gs,VectorKeyframeTrack:Ja,StringKeyframeTrack:Za,QuaternionKeyframeTrack:Ya,NumberKeyframeTrack:Xa,ColorKeyframeTrack:Ha,BooleanKeyframeTrack:Wa,PropertyMixer:xs,PropertyBinding:ks,KeyframeTrack:Va,AnimationUtils:Ba,AnimationObjectGroup:zs,AnimationMixer:Bs,AnimationClip:Ka,Uniform:Fs,InstancedBufferGeometry:Us,BufferGeometry:Ee,Geometry:ge,InterleavedBufferAttribute:Kn,InstancedInterleavedBuffer:Gs,InterleavedBuffer:Jn,InstancedBufferAttribute:js,Face3:re,Object3D:de,Raycaster:Vs,Layers:oe,EventDispatcher:g,Clock:fs,QuaternionLinearInterpolant:qa,LinearInterpolant:Ga,DiscreteInterpolant:ja,CubicInterpolant:Ua,Interpolant:Fa,Triangle:Je,Math:Mt,Spherical:Xs,Cylindrical:qs,Plane:jt,Frustum:Vt,Sphere:Gt,Ray:Ze,Matrix4:At,Matrix3:Ct,Box3:Ut,Box2:Ys,Line3:Zs,Euler:ae,Vector4:kt,Vector3:Lt,Vector2:St,Quaternion:Tt,Color:Qt,ImmediateRenderObject:Js,VertexNormalsHelper:Ks,SpotLightHelper:Qs,SkeletonHelper:th,PointLightHelper:eh,RectAreaLightHelper:ih,HemisphereLightHelper:nh,GridHelper:rh,PolarGridHelper:ah,PositionalAudioHelper:oh,FaceNormalsHelper:sh,DirectionalLightHelper:hh,CameraHelper:lh,BoxHelper:ch,Box3Helper:uh,PlaneHelper:dh,ArrowHelper:ph,AxesHelper:fh,Shape:Oo,Path:Io,ShapePath:as,Font:os,CurvePath:Do,Curve:co,ImageUtils:It,ShapeUtils:ea,WebGLUtils:En,WireframeGeometry:fr,ParametricGeometry:mr,ParametricBufferGeometry:gr,TetrahedronGeometry:xr,TetrahedronBufferGeometry:br,OctahedronGeometry:wr,OctahedronBufferGeometry:_r,IcosahedronGeometry:Mr,IcosahedronBufferGeometry:Sr,DodecahedronGeometry:Ar,DodecahedronBufferGeometry:Tr,PolyhedronGeometry:vr,PolyhedronBufferGeometry:yr,TubeGeometry:Lr,TubeBufferGeometry:Cr,TorusKnotGeometry:Pr,TorusKnotBufferGeometry:Er,TorusGeometry:Dr,TorusBufferGeometry:Ir,TextGeometry:ha,TextBufferGeometry:la,SphereGeometry:ca,SphereBufferGeometry:ua,RingGeometry:da,RingBufferGeometry:pa,PlaneGeometry:Oe,PlaneBufferGeometry:Ne,LatheGeometry:fa,LatheBufferGeometry:ma,ShapeGeometry:ga,ShapeBufferGeometry:va,ExtrudeGeometry:ra,ExtrudeBufferGeometry:aa,EdgesGeometry:xa,ConeGeometry:_a,ConeBufferGeometry:Ma,CylinderGeometry:ba,CylinderBufferGeometry:wa,CircleGeometry:Sa,CircleBufferGeometry:Aa,BoxGeometry:De,CubeGeometry:De,BoxBufferGeometry:Ie,ShadowMaterial:La,SpriteMaterial:Qn,RawShaderMaterial:Ca,ShaderMaterial:Ye,PointsMaterial:hr,MeshPhysicalMaterial:Ea,MeshStandardMaterial:Pa,MeshPhongMaterial:Da,MeshToonMaterial:Ia,MeshNormalMaterial:Oa,MeshLambertMaterial:Na,MeshDepthMaterial:An,MeshDistanceMaterial:Tn,MeshBasicMaterial:Ke,MeshMatcapMaterial:ka,LineDashedMaterial:za,LineBasicMaterial:rr,Material:qe,Float64BufferAttribute:Te,Float32BufferAttribute:Ae,Uint32BufferAttribute:Se,Int32BufferAttribute:Me,Uint16BufferAttribute:_e,Int16BufferAttribute:we,Uint8ClampedBufferAttribute:be,Uint8BufferAttribute:xe,Int8BufferAttribute:ye,BufferAttribute:ve,ArcCurve:po,CatmullRomCurve3:xo,CubicBezierCurve:Mo,CubicBezierCurve3:So,EllipseCurve:uo,LineCurve:Ao,LineCurve3:To,QuadraticBezierCurve:Lo,QuadraticBezierCurve3:Co,SplineCurve:Po,REVISION:"102",MOUSE:P,CullFaceNone:0,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,FrontFaceDirectionCW:0,FrontFaceDirectionCCW:1,BasicShadowMap:0,PCFShadowMap:1,PCFSoftShadowMap:2,FrontSide:0,BackSide:1,DoubleSide:2,FlatShading:1,SmoothShading:2,NoColors:0,FaceColors:1,VertexColors:2,NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5,AddEquation:E,SubtractEquation:101,ReverseSubtractEquation:102,MinEquation:D,MaxEquation:I,ZeroFactor:200,OneFactor:201,SrcColorFactor:202,OneMinusSrcColorFactor:203,SrcAlphaFactor:204,OneMinusSrcAlphaFactor:205,DstAlphaFactor:206,OneMinusDstAlphaFactor:207,DstColorFactor:208,OneMinusDstColorFactor:209,SrcAlphaSaturateFactor:210,NeverDepth:0,AlwaysDepth:1,LessDepth:2,LessEqualDepth:3,EqualDepth:4,GreaterEqualDepth:5,GreaterDepth:6,NotEqualDepth:7,MultiplyOperation:0,MixOperation:1,AddOperation:2,NoToneMapping:0,LinearToneMapping:1,ReinhardToneMapping:2,Uncharted2ToneMapping:3,CineonToneMapping:4,ACESFilmicToneMapping:5,UVMapping:O,CubeReflectionMapping:N,CubeRefractionMapping:k,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:z,SphericalReflectionMapping:305,CubeUVReflectionMapping:R,CubeUVRefractionMapping:B,RepeatWrapping:F,ClampToEdgeWrapping:U,MirroredRepeatWrapping:G,NearestFilter:j,NearestMipMapNearestFilter:V,NearestMipMapLinearFilter:W,LinearFilter:H,LinearMipMapNearestFilter:X,LinearMipMapLinearFilter:q,UnsignedByteType:Y,ByteType:1010,ShortType:1011,UnsignedShortType:Z,IntType:1013,UnsignedIntType:J,FloatType:K,HalfFloatType:Q,UnsignedShort4444Type:1017,UnsignedShort5551Type:1018,UnsignedShort565Type:1019,UnsignedInt248Type:$,AlphaFormat:1021,RGBFormat:tt,RGBAFormat:et,LuminanceFormat:1024,LuminanceAlphaFormat:1025,RGBEFormat:1023,DepthFormat:it,DepthStencilFormat:nt,RedFormat:1028,RGB_S3TC_DXT1_Format:rt,RGBA_S3TC_DXT1_Format:at,RGBA_S3TC_DXT3_Format:ot,RGBA_S3TC_DXT5_Format:st,RGB_PVRTC_4BPPV1_Format:ht,RGB_PVRTC_2BPPV1_Format:lt,RGBA_PVRTC_4BPPV1_Format:ct,RGBA_PVRTC_2BPPV1_Format:ut,RGB_ETC1_Format:dt,RGBA_ASTC_4x4_Format:37808,RGBA_ASTC_5x4_Format:37809,RGBA_ASTC_5x5_Format:37810,RGBA_ASTC_6x5_Format:37811,RGBA_ASTC_6x6_Format:37812,RGBA_ASTC_8x5_Format:37813,RGBA_ASTC_8x6_Format:37814,RGBA_ASTC_8x8_Format:37815,RGBA_ASTC_10x5_Format:37816,RGBA_ASTC_10x6_Format:37817,RGBA_ASTC_10x8_Format:37818,RGBA_ASTC_10x10_Format:37819,RGBA_ASTC_12x10_Format:37820,RGBA_ASTC_12x12_Format:37821,LoopOnce:2200,LoopRepeat:2201,LoopPingPong:2202,InterpolateDiscrete:pt,InterpolateLinear:ft,InterpolateSmooth:mt,ZeroCurvatureEnding:gt,ZeroSlopeEnding:vt,WrapAroundEnding:yt,TrianglesDrawMode:0,TriangleStripDrawMode:1,TriangleFanDrawMode:2,LinearEncoding:xt,sRGBEncoding:bt,GammaEncoding:wt,RGBEEncoding:3002,LogLuvEncoding:3003,RGBM7Encoding:3004,RGBM16Encoding:3005,RGBDEncoding:3006,BasicDepthPacking:3200,RGBADepthPacking:_t,TangentSpaceNormalMap:0,ObjectSpaceNormalMap:1,Face4:function(t,e,i,n,r,a,o){return new re(t,e,i,r,a,o)},LineStrip:0,LinePieces:1,MeshFaceMaterial:function(t){return t},MultiMaterial:function(t){return void 0===t&&(t=[]),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t},PointCloud:function(t,e){return new lr(t,e)},Particle:function(t){return new $n(t)},ParticleSystem:function(t,e){return new lr(t,e)},PointCloudMaterial:function(t){return new hr(t)},ParticleBasicMaterial:function(t){return new hr(t)},ParticleSystemMaterial:function(t){return new hr(t)},Vertex:function(t,e,i){return new Lt(t,e,i)},DynamicBufferAttribute:function(t,e){return new ve(t,e).setDynamic(!0)},Int8Attribute:function(t,e){return new ye(t,e)},Uint8Attribute:function(t,e){return new xe(t,e)},Uint8ClampedAttribute:function(t,e){return new be(t,e)},Int16Attribute:function(t,e){return new we(t,e)},Uint16Attribute:function(t,e){return new _e(t,e)},Int32Attribute:function(t,e){return new Me(t,e)},Uint32Attribute:function(t,e){return new Se(t,e)},Float32Attribute:function(t,e){return new Ae(t,e)},Float64Attribute:function(t,e){return new Te(t,e)},ClosedSplineCurve3:mh,SplineCurve3:gh,Spline:vh,AxisHelper:function(t){return new fh(t)},BoundingBoxHelper:function(t,e){return new ch(t,e)},EdgesHelper:function(t,e){return new or(new xa(t.geometry),new rr({color:void 0!==e?e:16777215}))},WireframeHelper:function(t,e){return new or(new fr(t.geometry),new rr({color:void 0!==e?e:16777215}))},XHRLoader:function(t){return new no(t)},BinaryTextureLoader:function(t){return new oo(t)},GeometryUtils:{merge:function(t,e,i){var n;e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),n=e.matrix,e=e.geometry),t.merge(e,n,i)},center:function(t){return t.center()}},Projector:function(){this.projectVector=function(t,e){t.project(e)},this.unprojectVector=function(t,e){t.unproject(e)},this.pickingRay=function(){}},CanvasRenderer:function(){},JSONLoader:function(){},SceneUtils:{createMultiMaterialObject:function(){},detach:function(){},attach:function(){}},LensFlare:function(){}});try{let t=null;t=window,t.ImageBitmap=t.ImageBitmap||function(){}}catch(mu){}var xh,bh={convert:function(t,e){e={};var i={};return t.setEventState=function(t,e){i[t]=e},t.getEventState=function(t){return!1!==i[t]},t._tmpEventMode=!1,Object.defineProperties(t,{tmpEventMode:{get:function(){return t._tmpEventMode},set:function(e){t._tmpEventMode=e,e||t.tmpEvents&&(t.tmpEvents.forEach(t=>t()),t.tmpEvents.length=0,delete t.tmpEvents)}}}),t.on=function(i,n){var r=[].concat(i);function a(){r.forEach(e=>{t.off(e,n)})}return r.forEach(t=>{(e[t]=e[t]||[]).push(n)}),t.tmpEventMode&&(t.tmpEvents||(t.tmpEvents=[]),t.tmpEvents.push(a)),a},t.clearHandlers=function(t){t?(e[t]={},delete i[t]):(e={},i={})},t.once=function(e,i){function n(){i.apply(t.off(e,n),arguments)}return n.h=i,t.on(e,n)},t.off=function(n,r){for(var a=e[n],o=0;r&&a&&a[o];o++)a[o]!=r&&a[o].h!=r||a.splice(o--,1);return r||(delete e[n],delete i[n]),t},t.emit=function(n){if(!1===i[n])return t;t.__events||(t.__events={}),t.__events[n]=n;for(var r=e[n],a=0;r&&r[a];)r[a++].apply(t,r.slice.call(arguments,1));return t},t}},wh=globalThis.TWEEN||(xh=[],{getAll:function(){return xh},removeAll:function(){xh=[]},add:function(t){xh.push(t)},remove:function(t){var e=xh.indexOf(t);-1!==e&&xh.splice(e,1)},update:function(t,e){if(0===xh.length)return!1;var i=0;for(t=void 0!==t?t:wh.now();i<xh.length;)xh[i].update(t)||e?i++:xh.splice(i,1);return!0}});void 0===window&&"undefined"!=typeof process?wh.now=function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:void 0!==window&&void 0!==window.performance&&void 0!==window.performance.now?wh.now=window.performance.now.bind(window.performance):void 0!==Date.now?wh.now=Date.now:wh.now=function(){return(new Date).getTime()};var _h=["x","y","z","r","g","b","i","alpha","opacity","color","position","rotation","scale","theta","azimuthal","polar","value","alpha"];wh.Tween=function(t){var e,i=t,n={},r={},a={},o=1e3,s=0,h=!1,l=!1,c=0,u=null,d=wh.Easing.Linear.None,p=wh.Interpolation.Linear,f=[],m=null,g=!1,v=null,y=null,x=null;this.to=function(t,e){return r=t,this.props=_h.slice(),t.props&&Array.prototype.push.apply(this.props,t.props),void 0!==e&&(o=e),this},this.start=function(t){for(var e in wh.add(this),l=!0,g=!1,u=void 0!==t?t:wh.now(),u+=c,r){if(r[e]instanceof Array){if(0===r[e].length)continue;r[e]=[i[e]].concat(r[e])}void 0===i[e]&&e.indexOf(".")<0||(n[e]=this.clonePropertyValue(i,e),n[e]instanceof Array==0&&"string"==typeof n[e]&&(n[e]*=1),a[e]=this.clonePropertyValue(n,e)||0)}return this},this.getProp=function(t,e){var i=t[e];if(void 0===i){if(e in this)return this[e];var n=e.split("."),r=null,a=null;return i=n.reduce((t,e,i)=>(i===n.length-2?r=t[e]:i===n.length-1&&(a=e),t[e]),t),Object.defineProperty(this,e,{get:function(){return r[a]},set:function(t){r[a]=t}}),i}return i},this.setProp=function(t,e,i){if(t[e])t[e]=i;else if(e in this)this[e]=i;else{for(var n=e.split("."),r=t,a=n.length-1,o=0;o<a;o++)r=r[n[o]];r[n[a]]=i}},this.clonePropertyValue=function(t,e){var i=this.getProp(t,e);return"object"==typeof i&&"function"==typeof i.clone?i.clone():i},this.stop=function(){return l?(wh.remove(this),l=!1,null!==x&&x.call(i,i),this.stopChainedTweens(),this):this},this.end=function(){return this.update(u+o),this},this.stopChainedTweens=function(){for(var t=0,e=f.length;t<e;t++)f[t].stop()},this.delay=function(t){return c=t,this},this.repeat=function(t){return s=t,this},this.repeatDelay=function(t){return e=t,this},this.yoyo=function(t){return h=t,this},this.easing=function(t){return d=t,this},this.interpolation=function(t){return p=t,this},this.chain=function(){return f=arguments,this},this.onStart=function(t){return m=t,this},this.onUpdate=function(t){return v=t,this},this.onComplete=function(t){return y=t,this},this.onStop=function(t){return x=t,this},this.threeInterpolation=function(t,e,i){t instanceof Lt||t instanceof Qt?t.lerp(e,i):t instanceof Tt&&t.slerp(e,i)},this.update=function(t){var l,x,b;if(t<u)return!0;for(l in!1===g&&(null!==m&&m.call(i,i),g=!0),x=0===o||(x=(t-u)/o)>=1?1:x,b=d(x),r)if(!(l.indexOf(".")<0&&this.props.indexOf(l)<0)&&void 0!==this.getProp(n,l)){var w=this.clonePropertyValue(n,l)||0,_=this.getProp(r,l);if(_ instanceof Array)i[l]=p(_,b);else if("string"==typeof _&&(_="+"===_.charAt(0)||"-"===_.charAt(0)?w+parseFloat(_):parseFloat(_)),"number"==typeof _){var M=w+(_-w)*b;l.indexOf(".")<0?i[l]=M:this.setProp(i,l,M)}else this.threeInterpolation(w,_,b),this.getProp(i,l).copy(w)}if(null!==v&&v.call(i,b,i),1===x){if(s>0){for(l in isFinite(s)&&s--,a){if("string"==typeof r[l]&&(a[l]=a[l]+parseFloat(r[l])),h){var S=this.clonePropertyValue(a,l);a[l]=this.clonePropertyValue(r,l),r[l]=S}n[l]=this.clonePropertyValue(a,l)}return u=void 0!==e?t+e:t+c,!0}null!==y&&y.call(i,i);for(var A=0,T=f.length;A<T;A++)f[A].start(u+o);return!1}return!0}},wh.Easing={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-wh.Easing.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*wh.Easing.Bounce.In(2*t):.5*wh.Easing.Bounce.Out(2*t-1)+.5}}},wh.Interpolation={Linear:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),a=wh.Interpolation.Utils.Linear;return e<0?a(t[0],t[1],n):e>1?a(t[i],t[i-1],i-n):a(t[r],t[r+1>i?i:r+1],n-r)},Bezier:function(t,e){for(var i=0,n=t.length-1,r=Math.pow,a=wh.Interpolation.Utils.Bernstein,o=0;o<=n;o++)i+=r(1-e,n-o)*r(e,o)*t[o]*a(n,o);return i},CatmullRom:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),a=wh.Interpolation.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),a(t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i],n-r)):e<0?t[0]-(a(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(a(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):a(t[r?r-1:0],t[r],t[i<r+1?i:r+1],t[i<r+2?i:r+2],n-r)},Utils:{Linear:function(t,e,i){return(e-t)*i+t},Bernstein:function(t,e){var i=wh.Interpolation.Utils.Factorial;return i(t)/i(e)/i(t-e)},Factorial:function(){var t=[1];return function(e){var i=1;if(t[e])return t[e];for(var n=e;n>1;n--)i*=n;return t[e]=i,i}}(),CatmullRom:function(t,e,i,n,r){var a=.5*(i-t),o=.5*(n-e),s=r*r;return(2*e-2*i+a+o)*(r*s)+(-3*e+3*i-2*a-o)*s+a*r+e}}},wh.getEasingByName=function(t){var e=t.replace(/in|out/gi,"");e=e[0].toUpperCase()+e.slice(1);var i=t.toLowerCase(),n="Out";return i.endsWith("in")?n="In":i.endsWith("inout")&&(n="InOut"),wh.Easing[e]?wh.Easing[e][n]:wh.Easing.Linear.None},wh.getBaseTween=function(t){t=Object.assign({delay:0,duration:1e3,easing:"cubicOut",inverse:!1},t);var e=new wh.Tween({i:t.inverse?1:0}).delay(t.delay).to({i:t.inverse?0:1},t.duration).easing(wh.getEasingByName(t.easing)).onStart(()=>{t.start&&t.start()}).onStop(()=>{t.start&&t.stop()}).onUpdate((e,i)=>{t.update&&t.update(e,i)}).onComplete(()=>{t.complete&&t.complete()});return e},wh.getTween=function(t,e,i){if(t&&e){i=Object.assign({delay:0,duration:1e3,easing:"cubicOut"},i);var n=[];Object.keys(e).forEach(t=>{_h.indexOf(t)<0&&n.push(t)}),n.length&&(e.props=n);var r=new wh.Tween(t).delay(i.delay).to(e,i.duration).easing(wh.getEasingByName(i.easing)).onStart(()=>{i.start&&i.start()}).onStop(()=>{i.stop&&i.stop()}).onUpdate((t,e)=>{i.update&&i.update(t,e)}).onComplete(()=>{i.complete&&i.complete()});return r}};const Mh=Math.PI,Sh=3e3*Mh/180,Ah=6378137,Th=.006693421622965943;function Lh(t,e){var i=t-.0065,n=e-.006,r=Math.sqrt(i*i+n*n)-2e-5*Math.sin(n*Sh),a=Math.atan2(n,i)-3e-6*Math.cos(i*Sh),o=r*Math.cos(a);return{lat:r*Math.sin(a),lng:o}}function Ch(t,e){if(Oh(e,t))return{lng:t,lat:e};var i=Eh(t-105,e-35),n=Ih(t-105,e-35),r=e/180*Mh,a=Math.sin(r);a=1-Th*a*a;var o=Math.sqrt(a);return i=180*i/(Ah*(1-Th)/(a*o)*Mh),{lng:2*t-(t+(n=180*n/(Ah/o*Math.cos(r)*Mh))),lat:2*e-(e+i)}}function Ph(t,e){var i=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return i+=2*(20*Math.sin(6*t*Mh)+20*Math.sin(2*t*Mh))/3,i+=2*(20*Math.sin(e*Mh)+40*Math.sin(e/3*Mh))/3,i+=2*(160*Math.sin(e/12*Mh)+320*Math.sin(e*Mh/30))/3}var Eh=Ph;function Dh(t,e){var i=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return i+=2*(20*Math.sin(6*t*Mh)+20*Math.sin(2*t*Mh))/3,i+=2*(20*Math.sin(t*Mh)+40*Math.sin(t/3*Mh))/3,i+=2*(150*Math.sin(t/12*Mh)+300*Math.sin(t/30*Mh))/3}var Ih=Dh;function Oh(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271}class Nh{constructor(){this.callbacks=[],this.alldoneArr=[],this.type="OMPromise",this.id=Math.random().toString().slice(2),this.__done=!1,this.__index=0,this.id=Math.random().toString().slice(2)}delay(t){var e=new this.constructor;return setTimeout(function(){e.resolve()},t),e}addAlldone(t){this.alldoneArr.push(t)}alldone(t){this.alldoneArr.forEach(e=>{e(t,this.__index)})}destroy(){this.callbacks.length=this.alldoneArr.length=0}then(t){return this.callbacks.push(t),this}_hasIndex(t){return t}resolve(t){var e=this,i=null,n=!1;setTimeout(()=>{var r=e._hasIndex(i||t);if(!e.callbacks.length)return e.alldone(r),e.destroy(),void(e.__done=!0);for(var a=0;a<e.callbacks.length;a++){var o=e.callbacks[a](i||t);if(o instanceof e.constructor){for(n=!0,o.__index=e.__index,a++;a<e.callbacks.length;a++)o.then(e.callbacks[a]);e.alldoneArr.length&&(o.alldoneArr=e.alldoneArr),i=null}else i=o}n||(r=e._hasIndex(i||t),e.alldone(r),e.destroy(),e.__done=!0)},0)}}Nh.empty=function(t){var e=new Nh;return setTimeout(function(){e.resolve(t)},0),e},Nh.delay=function(t){var e=new Nh;return setTimeout(function(){e.resolve()},t),e},Nh.all=function(t,e){t=t.filter(t=>!t.__done);var prom=new Nh,i=0,n=[];function r(r,a){i++,n.push({value:r,index:a}),i===t.length&&(!1!==e&&n.sort((t,e)=>t.index-e.index),prom.resolve(n.map(t=>t.value)))}return t.forEach((t,e)=>{t.__index=e,t.addAlldone(r)}),prom};var kh={log:console.log,warn:console.warn,error:console.error,cloneJSON:t=>JSON.parse(JSON.stringify(t)),addToken:function(t,e){return t.config.params?e+=this.getParamsStr(t.config.params):t.token&&(e+="?token="+t.token),e},getResourceUrl(t,e,i,n=!0,r="",a=null){var o=/[a-z0-9]{18,36}/.test(i),s="",h="",l=o?".omm":".glb";if(t.config.standalone?(h=t.config.baseUrl).endsWith("/")||(h+="/"):h=t.config.server,!n&&r&&!o){if("function"==typeof r)return r(i,e,a);h=r}return t.config.standalone?i.indexOf("/")>-1?i:!o&&r?`${r}${i}.glb`:`${h}${t.config.appID}/${n?"assets/images/":"assets/models/"}${i}${n?".omi":l}`:(i.indexOf("/")>-1?s=i:(s=`${h}${!r||o?n?"resources/image/":"resources/model/":""}${i}`,s+=n?".omi":l),s)},getParamsStr(t){var e="";return Object.keys(t).forEach((i,n)=>{0===n&&(e="?"),n>0&&(e+="&"),e+=i+"="+encodeURIComponent(t[i])}),e},getSuper:t=>Object.getPrototypeOf(t.constructor.prototype),findFromArray(t,e,i,n){for(var r=0;r<t.length;r++){var a=t[r];if(a[e]===i){n(a,r);break}}},generateID(t,e){e=e||"",(t=t||16)<6&&(t=6);for(var i=(new Date).getTime().toString(36).substr(-Math.floor(t/2));i.length<t;i+=Math.random().toString(36).substr(6));return e+i.substr(0,t).toUpperCase()},getp(t,e,i){var n,r=arguments;if(t)for(var a=1;a<r.length-1;a++)if(void 0!==(n=t[r[a]]))return n;return r[r.length-1]},assign(){for(var t=Array.from(arguments),e=t[0],i=1;i<t.length;i++)Object.keys(t[i]).forEach(n=>{void 0===e[n]&&(e[n]=t[i][n])})},colorToStr:t=>"number"==typeof t?"#"+("000000"+t.toString(16)).slice(-6):t,loadTexture:function(){var t=new lo;function e(t){return t&&!(t&t-1)}return function(i,n,r,a){return t.load(i,t=>{var i=e(t.image.width),r=e(t.image.height);i&&r&&(t.wrapS=t.wrapT=F,t.needsUpdate=!0),n&&n(t)},r,a)}}(),loadImageBitmapTexture:function(){var t=new rs;function e(t){return t&&!(t&t-1)}return t.setOptions({imageOrientation:"flipY"}),function(i,n,r,a){return t.load(i,t=>{var i=new dr(t),r=e(i.image.width),a=e(i.image.height);r&&a&&(i.wrapS=i.wrapT=F,i.needsUpdate=!0),n&&n(i)},r,a)}}(),getZoomFactor(t,e){var i=t.view.currentCamera,n=t.view.getRealHeight();if(i instanceof On){var r=n/2,a=e?e.distanceTo(i.position):t.view.controls.getDistance(),o=t.view.camera.fov*Math.PI/180/2;return Math.tan(o)*a/r}if(i instanceof Uo)return 2*i.top/i.zoom/n},getCameraDataByZoom(t,e){var i=e/t.view.pixelsPerCentimeter/100,n=t.view.getRealHeight()/2*i;return{distance:n/Math.tan(t.view.camera.fov*Mt.DEG2RAD/2),top:n}},getCamera2DSize(t,e){var i=t.view.camera.fov,n=t.view.camera.aspect,r=e||t.view.controls.getDistance(),a=Math.tan(i*Math.PI/180/2)*r;return{top:a||1,right:2*a*n/2,distance:r}},getBBoxOfObjects(t){var e=new Ut;return t.forEach(t=>{t.isLine2?(e.expandByPoint(t.geometry.boundingBox.min),e.expandByPoint(t.geometry.boundingBox.max)):t.geometry||t.children&&t.children.length?e.expandByObject(t):e.expandByPoint(t.point||t.position)}),e},getBoundingSphere(t){var e=new Gt;return t=[].concat(t),this.getBBoxOfObjects(t).getBoundingSphere(e),e},focusObject(t,e,i,n,r,a,o){var s=new Gt;if(e=[].concat(e),this.getBBoxOfObjects(e).getBoundingSphere(s),0===s.radius){if(1===e.length)s.center=e[0].position.clone();else{var h=new Lt;e.forEach(t=>{h.add(t.position)}),h.divideScalar(e.length),s.center=h}s.radius=20}return kh.fitView(t,s.center,s.radius,i,n,r,a,o)},getZoomByRadius:(t,e,i=1.3)=>e*i*2*100/(t.view.width/t.view.pixelsPerCentimeter),fitView(t,e,i,n,r,a,o,s,h){r=void 0===r?t.config.animateDuration:r;var l=0,c=i*(a=a||1.3)*2*100/((h||t.view.width)/t.view.pixelsPerCentimeter);function u(){2==++l&&n&&n()}s&&(c=Math.max(c,s)),t.view.moveTo({viewCenter:e,duration:r,polarAngle:o,easing:wh.Easing.Quartic.Out,callback:u}),t.view.zoom={zoom:c,duration:r,easing:wh.Easing.Quartic.Out,callback:u}},buildCurvePoints(t,e,i){if(t.length>=3){var n=Math.PI/10,r=Math.PI-n,a=i||1,o=null==e?3:e;if(0==o)return t;for(var s=1/o,h=[],l=0;l<t.length-2;){var c=t[l].clone(),u=t[l+1].clone(),d=t[l+2].clone(),p=c.clone().sub(u),f=d.clone().sub(u),m=p.angleTo(f),g=p.length(),v=f.length();if(h.push(c),m&&m>n&&m<r&&g>a&&v>a){var y=u.clone().lerp(c,a/g),x=u.clone().lerp(d,a/v);h.push(y);for(var b=s;b<.999999;b+=s){var w=b,_=y.clone().lerp(u,w),M=u.clone().lerp(x,w);h.push(_.lerp(M,w))}t[l+1]=x,l++}else h.push(u),l++;l==t.length-2&&h.push(d)}return h}return t.map(t=>t.clone())},vector3ToScreen(t,e){var i=e.project(t.view.currentCamera);return i.x=(i.x+1)/2*t.view.width/t.view.sizeRate,i.y=-(i.y-1)/2*t.view.height/t.view.sizeRate,i},getPointByDistance(t,e){for(var i,n,r=null,a=0,o=t.length,s={point:null,vector:null,isOver:!1,index:0},h=0;h<o;h++){var l=t[h];if(h>0&&(a+=i=(n=l.clone().sub(r)).length())>=e)return s.vector=n.normalize(),s.point=r.clone().add(s.vector.clone().multiplyScalar(e-a+i)),s.index=h,s;r=l.clone()}return s.vector=n.normalize(),s.point=t[o-1].clone(),s.isOver=!0,s.index=o-1,s},getMouse(t,e){var i,n=e.config.container;i={top:0,left:0,width:n.width/e.view.pixelRatio,height:n.height/e.view.pixelRatio};var r=new St,a=null;t.touches&&t.touches.length>0?a=t.touches:t.changedTouches&&t.changedTouches.length>0&&(a=t.changedTouches);let o=t.clientX,s=t.clientY;return a&&(o=a[0].clientX,s=a[0].clientY,"x"in a[0]&&(o=a[0].x,s=a[0].y)),r.rawX=o-i.left,r.rawY=s-i.top,r.x=r.rawX/i.width*2-1,r.y=-r.rawY/i.height*2+1,r},coordTransform:{bd09ToGcj02:Lh,bd09ToWgs84:function(t,e){var i=Lh(e,t);return Ch(i.lat,i.lng)},gaussianToLongLat:function(t,e,i=20,n=3){var r,a,o,s,h,l,c,u,d,p,f,m,g,v,y,x;return n=i<24?6:3,t+=1e6*i,x=.0174532925199433,c=6378137,l=1/298.257223563,r=parseInt(t/1e6),a=6===n?(r-1)*n+n/2:r*n,a*=x,o=t-(1e6*r+5e5),u=(h=2*l-l*l)/(1-h),y=(v=(e-0)/6367449.145960817)+(3*(s=(1-Math.sqrt(1-h))/(1+Math.sqrt(1-h)))/2-27*s*s*s/32)*Math.sin(2*v)+(21*s*s/16-55*s*s*s*s/32)*Math.sin(4*v)+151*s*s*s/96*Math.sin(6*v)+1097*s*s*s*s/512*Math.sin(8*v),f=u*Math.cos(y)*Math.cos(y),p=Math.tan(y)*Math.tan(y),d=c/Math.sqrt(1-h*Math.sin(y)*Math.sin(y)),g=c*(1-h)/Math.sqrt((1-h*Math.sin(y)*Math.sin(y))*(1-h*Math.sin(y)*Math.sin(y))*(1-h*Math.sin(y)*Math.sin(y))),{lng:(a+((m=o/d)-(1+2*p+f)*m*m*m/6+(5-2*f+28*p-3*f*f+8*u+24*p*p)*m*m*m*m*m/120)/Math.cos(y))/x,lat:(y-d*Math.tan(y)/g*(m*m/2-(5+3*p+10*f-4*f*f-9*u)*m*m*m*m/24+(61+90*p+298*f+45*p*p-256*u-3*f*f)*m*m*m*m*m*m/720))/x}},gcj02ToBd09:function(t,e){e=+e,t=+t;var i=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*Sh),n=Math.atan2(e,t)+3e-6*Math.cos(t*Sh);return{lng:i*Math.cos(n)+.0065,lat:i*Math.sin(n)+.006}},gcj02ToWgs84:Ch,lnglatDistance:function(t,e,i=6378137){var n=.017453292519943295;return i*Math.acos(Math.sin(t.lat*n)*Math.sin(e.lat*n)+Math.cos(t.lat*n)*Math.cos(e.lat*n)*Math.cos(t.lng*n-e.lng*n))},lnglatToGaussian:function(t,e,i=3){var n,r,a,o,s,h,l,c,u,d,p,f,m,g,v=0;return g=.0174532925199433,h=6378137,l=1/298.257223563,a=6===i?(v=parseInt(t/i))*i+i/2:(v=parseInt(t/i+.5))*i,a*=g,n=t*g,r=e*g,u=(c=2*l-l*l)*(1-c),d=h/Math.sqrt(1-c*Math.sin(r)*Math.sin(r)),p=Math.tan(r)*Math.tan(r),f=u*Math.cos(r)*Math.cos(r),o=d*((m=(n-a)*Math.cos(r))+(1-p+f)*m*m*m/6+(5-18*p+p*p+72*f-58*u)*m*m*m*m*m/120),s=h*(.9983242984527954*r-.002514607060518705*Math.sin(2*r)+26390465943376213e-22*Math.sin(4*r)-35*c*c*c/3072*Math.sin(6*r))+d*Math.tan(r)*(m*m/2+(5-p+9*f+4*f*f)*m*m*m*m/24+(61-58*p+p*p+600*f-330*u)*m*m*m*m*m*m/720),{x:o+=5e5,y:s+=0,projNo:v}},lngLatToMercator:function(t){"number"==typeof t&&(t={lng:arguments[0],lat:arguments[1]});var e={},i=20037508.34*t.lng/180,n=Math.log(Math.tan((90+t.lat)*Mh/360))/(Mh/180);return n=20037508.34*n/180,e.x=i,e.y=n,e},lngLatToMercator2:function(t,e){var i=6378137,n=t*Math.PI/180*i,r=e*Math.PI/180;return{x:n,y:3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r)))}},mercatorToLngLat:function(t){"number"==typeof t&&(t={x:arguments[0],y:arguments[1]});var e={},i=t.x/20037508.34*180,n=t.y/20037508.34*180;return n=180/Mh*(2*Math.atan(Math.exp(n*Mh/180))-Mh/2),e.lng=i,e.lat=n,e},wgs84ToGcj02:function(t,e){if(Oh(e,t))return{lng:t,lat:e};var i=function(t,e){var i=Ph(e-105,t-35),n=Dh(e-105,t-35),r=t/180*Mh,a=Math.sin(r);a=1-Th*a*a;var o=Math.sqrt(a);i=180*i/(Ah*(1-Th)/(a*o)*Mh),n=180*n/(Ah/o*Math.cos(r)*Mh);var s=t+i,h=e+n;return{lat:s,lng:h}}(e,t);return{lng:i.lng,lat:i.lat}}},sceneToScreen(t,e){var i=e.clone().project(t.view.currentCamera);return i.x=(i.x+1)/2*t.view.width/t.view.sizeRate,i.y=-(i.y-1)/2*t.view.height/t.view.sizeRate,i},screenToScene(t,e){var i=e.clone();return i.unproject(t.view.currentCamera),i.z=0,i},latLongToVector3(t,e,i,n){var r=t*Math.PI/180,a=(e-180)*Math.PI/180;return new Lt(-(i+n)*Math.cos(r)*Math.cos(a),(i+n)*Math.sin(r),(i+n)*Math.cos(r)*Math.sin(a))},getDPI:()=>96,getNearestAngle(t,e,i){if(void 0===e)return 0;var n=i?180:Math.PI,r=e-t;return(r=(r+n)%(2*n)-n)>n?r-=2*n:r<-n&&(r+=2*n),r},traverse:function(){var t=[],e=!1;function i(n,r,a,o,s,h){a=void 0===a||a,(h=(h=h||[]).slice()).push(0);for(var l=0,c=n.length;l<c;l++){if(!a&&e)return;h[h.length-1]=l;var u=n[l],d=u.children,p=r(u,s,h);if(p){if(e=!0,t.push(u),!a)return;if(o)continue}p&&!a||!d||i(d,r,a,o,s,h)}}return function(n,r,a,o){return t.length=0,e=!1,i(n,r,a,o),t.slice()}}(),collect:function(t,e){var i=this.traverse([].concat(t),function(t){return t[e]});return i.map(t=>t[e])},iscw:function(t){var e=t.reduce(function(e,i,n){var r=n+1<t.length?t[n+1]:t[0];return e+(r.x-i.x)*(r.y+i.y)},0);return e>0},removeFromArray(t,e){for(var i=t.length;i>-1;i--){var n=t[i];e.indexOf(n)>-1&&t.splice(i,1)}},setMaterialColor(t,e,i){var n=new Qt(e),r=!1;Array.isArray(t)&&(t.length>1?(t=t[1],r=!0):t=t[0]),t.color.copy(n),i&&i.config.noEmissive||(r?t.emissive.setScalar(0):(t.emissive||(t.emissive=new Qt),t.emissive.copy(n.clone().multiplyScalar(.35))))},collectMaterials(t,e){t=[].concat(t);var i=[];return t.forEach(t=>{if(!t.entity)return i;t.entity.traverse(t=>{if(t.material){var n=!1;e&&(n=e(t)),n||(Array.isArray(t.material)?Array.prototype.push.apply(i,t.material):i.push(t.material))}})}),i},getRootNode(t,e,i){var n=[];return t[e]&&n.push(t[e]),t.buildingNode.children.forEach(t=>{t[e]&&n.push(t[e]),t.floorNode.children.forEach(t=>{t[e]&&n.push(t[e])})}),i&&i(n),n},getNodeRoot(t){for(;t;){if(!t.parent)return t;if("OMBuilding"===t.parent.type||"OMScene"===t.parent.type)return t.parent;t=t.parent}},cloneGltf(t){const e={animations:t.animations,scene:t.scene.clone(!0)},i={};t.scene.traverse(t=>{t.isSkinnedMesh&&(i[t.name]=t)});const n={},r={};e.scene.traverse(t=>{t.isBone&&(n[t.name]=t),t.isSkinnedMesh&&(r[t.name]=t)});for(let t in i){const e=i[t].skeleton,a=r[t],o=[];for(let t=0;t<e.bones.length;++t){const i=n[e.bones[t].name];o.push(i)}a.bind(new ir(o,e.boneInverses),a.matrixWorld)}return e},isJson:t=>"object"==typeof t&&null!=t,traverseJSON(t,e){if(e&&this.isJson(t)){var i="function"==typeof e;for(var n in t)if(void 0!==n){var r=t[n];i?e(n,r,t):e[n]&&e[n](r,t),(r=t[n])instanceof Array?r.forEach(t=>{this.traverseJSON(t,e)}):null!=r&&"object"==typeof r&&this.traverseJSON(r,e)}}},checkSpriteInView:(t,e)=>!(e.rect.x>=t.width/t.sizeRate||e.rect.y>=t.height/t.sizeRate||e.rect.x+e.rect.width<=0||e.rect.y+e.rect.height<=0),getSecret(){return new(t={},function(){if(1==arguments.length)return t[arguments[0]];2==arguments.length&&(t[arguments[0]]=arguments[1])});var t},getEasingByName(t){var e=t.replace(/in|out/gi,"");e=e[0].toUpperCase()+e.slice(1);var i=t.toLowerCase(),n="Out";return i.endsWith("in")?n="In":i.endsWith("inout")&&(n="InOut"),wh.Easing[e]?wh.Easing[e][n]:wh.Easing.Linear.None},_findData:(t,e)=>t.filter(t=>e(t)),findMarkerData(t,e){if(t.markers&&t.markers.length)return this._findData(t.markers,e)},findModelData(t,e){if(t.models&&t.models.length)return this._findData(t.models,e)},_keywordsFindConfig:t=>(("string"==typeof t||Array.isArray(t))&&(t={words:[].concat(t),multi:!0}),t.words=t.words.map(t=>t.toLowerCase()),{config:t,checkWords:function(e){var i=!1;return e.forEach(e=>{i||("object"==typeof e&&(e=e.text),"string"==typeof e&&(e=e.toLowerCase(),t.words.forEach(t=>{i||e.indexOf(t)>-1&&(i=!0)})))}),i},checkTag:function(e){let i=[].concat(e).map(t=>t.toLowerCase());return t.words.some(t=>i.some(e=>e.indexOf(t)>-1))}}),runTasks(t,e){Array.isArray(t)||(t=[].concat(t)),e=Object.assign({timeout:5e3,deltaTime:16.6,complete:null},e);const i=Date.now(),n=()=>{const r=Date.now();for(;t.length>0&&Date.now()-r<e.deltaTime&&Date.now()-i<e.timeout;)try{t.shift()()}catch(t){}t.length>0&&Date.now()-i<e.timeout?setTimeout(n,0):"function"==typeof e.complete&&setTimeout(e.complete,Math.max(2*e.deltaTime,16))};setTimeout(n,0)},createTaskScheduler(t){t=Object.assign({deltaTime:16.6},t);const e=[];let i=!1;function n(){i||(i=!0,r())}function r(){if(!i)return;const n=Date.now();for(;e.length>0&&Date.now()-n<t.deltaTime;){const t=e.shift();try{t()}catch(t){}}setTimeout(()=>{e.length>0?r():i=!1},0)}return{add:function(t){Array.isArray(t)||(t=[t]),Array.prototype.push.apply(e,t),n()},start:n,stop:function(){i=!1},get length(){return e.length},get isRunning(){return i}}},when(t,e,i=60){t()?e():setTimeout(()=>{kh.when(t,e,i)},i)},findNearestPoint(t,e){let i=1e4,n=null;for(var r=0;r<e.length;r++){let a=e[r],o=a.distanceToSquared(t);o<i&&(i=o,n=a)}return n},capWord:t=>t.charAt(0).toUpperCase()+t.substring(1),setBlockProperty(t,e,i){t.node?t.node[`set${kh.capWord(e)}`](i):t[e]=i}};class zh extends g{constructor(t,e,i){function n(t){p.set(p.radius,0,0),t.update(!0)}super(),this.map=i,this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.target=new Lt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.zoomToCursor=!1,this.rect={x:0,y:0},this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:P.LEFT,ZOOM:P.MIDDLE,PAN:P.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.updateRect=function(){this.rect={x:this.domElement._left||0,y:this.domElement._top||0,width:this.domElement.width,height:this.domElement.height}},this.updateRect(),this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.getPolarAngle=function(){return d.phi},this.getAzimuthalAngle=function(){return d.theta},Object.defineProperties(this,{azimuthal:{get:function(){return this.getAzimuthalAngle()},set:function(t){d.theta=t,n(this)}},polar:{get:function(){return this.getPolarAngle()},set:function(t){d.phi=t,n(this)}},distance:{get:function(){return this.getDistance()},set:function(t){t=R(t,!0),f=1,d.radius=t,n(this)}}}),this.setPose=function(t,e,i){d.theta=t,d.phi=e,i&&(d.radius=i),n(this)},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(o),r.update(),c=l.NONE},this.update=function(){var e=new Lt,i=(new Tt).setFromUnitVectors(t.up,new Lt(0,1,0)),n=i.clone().inverse(),a=new Lt,s=new Tt;return function(t){if(r.enabled){var h=r.object.position;e.copy(h).sub(r.target),e.applyQuaternion(i),t||(d.setFromVector3(e),r.autoRotate&&c===l.NONE&&E(2*Math.PI/60/60*r.autoRotateSpeed),d.theta+=p.theta,d.phi+=p.phi,d.theta=Math.max(r.minAzimuthAngle,Math.min(r.maxAzimuthAngle,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi))),d.makeSafe();var x=d.radius;return d.radius*=f,d.radius=Math.max(r.minDistance,Math.min(r.maxDistance,d.radius)),r.target.add(m),r.zoomToCursor&&0!==x&&(r.object.isPerspectiveCamera?r.target.lerp(y,1-d.radius/x):r.object.isOrthographicCamera&&r.target.lerp(y,1-v)),e.setFromSpherical(d),e.applyQuaternion(n),h.copy(r.target).add(e),r.object.lookAt(r.target),!0===r.enableDamping?(p.theta*=1-r.dampingFactor,p.phi*=1-r.dampingFactor):p.set(0,0,0),f=1,m.set(0,0,0),!!(g||a.distanceToSquared(r.object.position)>u||8*(1-s.dot(r.object.quaternion))>u)&&(r.dispatchEvent(o),a.copy(r.object.position),s.copy(r.object.quaternion),g=!1,v=1,!0)}}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",K,!1),r.domElement.removeEventListener("mousedown",j,!1),r.domElement.removeEventListener("wheel",X,!1),r.domElement.removeEventListener("touchstart",Y,!1),r.domElement.removeEventListener("touchend",J,!1),r.domElement.removeEventListener("touchmove",Z,!1),document.removeEventListener("mousemove",V,!1),document.removeEventListener("mouseup",W,!1),window.removeEventListener("keydown",q,!1)};var r=this;function a(){return r.domElement}var o={type:"change"},s={type:"start"},h={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5,TOUCH_MAP:6},c=l.NONE,u=1e-6,d=new Xs,p=new Xs,f=1,m=new Lt,g=!1,v=1,y=new Lt,x=new St,b=new St,w=new St,_=new St,M=new St,S=new St,A=new St,T=new St,L=new St;function C(t){return Math.pow(t||.95,r.zoomSpeed)}function E(t){p.theta-=t}function D(t){p.phi-=t}var I=function(){var t=new Lt;return function(e,i){t.setFromMatrixColumn(i,0),t.multiplyScalar(-e),m.add(t)}}(),O=function(){var t=new Lt;return function(e,i){var n=1;1===r.object.up.z&&(n=2),t.setFromMatrixColumn(i,n),t.multiplyScalar(e),m.add(t)}}(),N=function(){var t=new Lt,e=new Lt(0,0,1),i=new Lt,n=new Lt,o=new Lt;return function(s,h){var l=a();r.object.matrix.extractBasis(i,n,o);var c=(new Lt).crossVectors(e,i),u=new At;if(u.makeBasis(i,e,c),r.object instanceof On){var d=r.object.position;t.copy(d).sub(r.target);var p=t.length();p*=Math.tan(r.object.fov/2*Math.PI/180),I(2*s*p/l.clientHeight,u),O(2*h*p/l.clientHeight,u)}else r.object instanceof Uo?(I(s*(r.object.right-r.object.left)/r.object.zoom/l.clientWidth,u),O(h*(r.object.top-r.object.bottom)/r.object.zoom/l.clientHeight,u)):r.enablePan=!1}}();function k(t){if(r.object instanceof On)f=R(f/=t);else if(r.object instanceof Uo){v=r.object.zoom;var e=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*t));r.object.zoom=B(e),v/=r.object.zoom,r.object.updateProjectionMatrix(),g=!0}else r.enableZoom=!1}function z(t){if(r.object instanceof On)f=R(f*=t);else if(r.object instanceof Uo){v=r.object.zoom;var e=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/t));r.object.zoom=B(e),v/=r.object.zoom,r.object.updateProjectionMatrix(),g=!0}else r.enableZoom=!1}function R(t,e){if(!r.map.view.minLevelData)return t;var i=e?t:d.radius*t,n=r.map.view.minLevelData.distance,a=r.map.view.maxLevelData.distance,o=.1;return i>n-o?e?n-o:(n-o)/d.radius:i<a+o?e?a+o:(a+o)/d.radius:t}function B(t){var e=r.object.top/t,i=r.map.view.minLevelData.top,n=r.map.view.maxLevelData.top,a=.1;return e<n+a?r.object.top/(n+a):e>i-a?r.object.top/(i-a):t}var F,U,G=function(){var t=new Lt;return new Lt,function(e,i,n){if(r.zoomToCursor){void 0===i&&(i=e.clientX),void 0===n&&(n=e.clientY);var o=a(),s=r.rect;if(r.object.isPerspectiveCamera){t.set((i-s.x)/o.clientWidth*2-1,-(n-s.y)/o.clientHeight*2+1,.5),t.unproject(r.object),t.sub(r.object.position).normalize();var h=(r.target.z-r.object.position.z)/t.z;y.copy(r.object.position).add(t.multiplyScalar(h))}else r.object.isOrthographicCamera&&(t.set((i-s.x)/o.clientWidth*2-1,-(n-s.y)/o.clientHeight*2+1,0),t.unproject(r.object),t.z=r.target.z,y.copy(t))}}}();function j(t){if(!1!==r.enabled){switch(t.preventDefault(),clearTimeout(H),r.map.needHeighFrameRate=!0,t.button){case r.mouseButtons.PAN:if(!1===r.enableRotate)return;!function(t){x.set(t.clientX,t.clientY)}(t),c=l.ROTATE;break;case r.mouseButtons.ZOOM:if(!1===r.enableZoom)return;!function(t){A.set(t.clientX,t.clientY)}(t),c=l.DOLLY;break;case r.mouseButtons.ORBIT:if(!1===r.enablePan)return;!function(t){_.set(t.clientX,t.clientY)}(t),c=l.PAN}c!==l.NONE&&(document.addEventListener("mousemove",V,!1),document.addEventListener("mouseup",W,!1),r.dispatchEvent(s))}}function V(t){if(!1!==r.enabled)switch(t.preventDefault(),c){case l.ROTATE:if(!1===r.enableRotate)return;!function(t){b.set(t.clientX,t.clientY),w.subVectors(b,x);var e=a();E(2*Math.PI*w.x/e.clientWidth*r.rotateSpeed),"3d"===r.map.view.viewMode&&D(2*Math.PI*w.y/e.clientHeight*r.rotateSpeed),x.copy(b),r.update()}(t);break;case l.DOLLY:if(!1===r.enableZoom)return;!function(t){T.set(t.clientX,t.clientY),L.subVectors(T,A),L.y>0?k(C()):L.y<0&&z(C()),A.copy(T),r.update()}(t);break;case l.PAN:if(!1===r.enablePan)return;!function(t){M.set(t.clientX,t.clientY),S.subVectors(M,_),N(S.x,S.y),_.copy(M),r.update()}(t)}}function W(t){!1!==r.enabled&&(r.map.needHeighFrameRate=!1,r.map.needHeighFrameRate=!1,document.removeEventListener("mousemove",V,!1),document.removeEventListener("mouseup",W,!1),r.dispatchEvent(h),c=l.NONE)}var H=null;function X(t){!1===r.enabled||!1===r.enableZoom||c!==l.NONE&&c!==l.ROTATE||(t.preventDefault(),t.stopPropagation(),clearTimeout(H),r.map.needHeighFrameRate=!0,function(t){G(t),t.deltaY<0?z(C()):t.deltaY>0&&k(C()),r.update()}(t),H=setTimeout(()=>{r.map.needHeighFrameRate=!1},1e3),r.dispatchEvent(s),r.dispatchEvent(h))}function q(t){!1!==r.enabled&&!1!==r.enableKeys&&!1!==r.enablePan&&(function(t){switch(t.keyCode){case r.keys.UP:N(0,r.keyPanSpeed),r.update();break;case r.keys.BOTTOM:N(0,-r.keyPanSpeed),r.update();break;case r.keys.LEFT:N(r.keyPanSpeed,0),r.update();break;case r.keys.RIGHT:N(-r.keyPanSpeed,0),r.update()}}(t),clearTimeout(H))}function Y(t){if(!1!==r.enabled){switch(clearTimeout(H),r.map.needHeighFrameRate=!0,t.touches.length){case 2:r.enableZoom&&function(t){let e=t.touches[0].pageX,i=t.touches[0].pageY;var n=t.touches[1].pageX-e,r=t.touches[1].pageY-i;G(t,e+n/2,i+r/2);var a=Math.sqrt(n*n+r*r);A.set(0,a)}(t),r.enableRotate&&function(t){x.set(t.touches[0].pageX,t.touches[0].pageY),F=U=null}(t),c=l.TOUCH_MAP;break;case 1:if(!1===r.enablePan)return;!function(t){_.set(t.touches[0].pageX,t.touches[0].pageY)}(t),c=l.TOUCH_PAN;break;default:c=l.NONE}c!==l.NONE&&r.dispatchEvent(s)}}function Z(t){if(!1!==r.enabled)switch(t.preventDefault(),t.stopPropagation(),t.touches.length){case 2:if(c!==l.TOUCH_MAP)return;r.enableZoom&&function(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);T.set(0,n);var a=T.y/A.y;a>1?z(2-a):a<1&&k(a),A.copy(T),r.update()}(t),r.enableRotate&&function(t){var e=a(),i=new Lt(t.touches[0].pageX,t.touches[0].pageY,0),n=new Lt(t.touches[1].pageX,t.touches[1].pageY,0),o=n.clone().sub(i);if(F){var s=o.clone().cross(F).z>0?1:-1,h=o.angleTo(F);F=o.clone();var l=(i.y+n.y)/2;U||(U=l);var c=l-U;U=l,"3d"===r.map.view.viewMode&&Math.abs(c)>r.map.config.controls_phiThreshold?D(2*Math.PI*c/e.clientHeight*r.rotateSpeed*.6):E(h*s*r.rotateSpeed),r.update()}else F=o.clone()}(t);break;case 1:if(!1===r.enablePan)return;if(c!==l.TOUCH_PAN)return;!function(t){M.set(t.touches[0].pageX,t.touches[0].pageY),S.subVectors(M,_),N(S.x,S.y),_.copy(M),r.update()}(t);break;default:c=l.NONE}}function J(t){!1!==r.enabled&&(r.map.needHeighFrameRate=!1,r.dispatchEvent(h),c=l.NONE)}function K(t){t.preventDefault()}r.domElement.addEventListener("contextmenu",K,!1),r.domElement.addEventListener("mousedown",j,!1),r.domElement.addEventListener("wheel",X,!1),r.domElement.addEventListener("touchstart",Y,!1),r.domElement.addEventListener("touchend",J,!1),r.domElement.addEventListener("touchmove",Z,!1),window.addEventListener("keydown",q,!1),this.update()}}Object.defineProperties(zh.prototype,{center:{get:function(){return this.target}},noZoom:{get:function(){return!this.enableZoom},set:function(t){this.enableZoom=!t}},noRotate:{get:function(){return!this.enableRotate},set:function(t){this.enableRotate=!t}},noPan:{get:function(){return!this.enablePan},set:function(t){this.enablePan=!t}},noKeys:{get:function(){return!this.enableKeys},set:function(t){this.enableKeys=!t}},staticMoving:{get:function(){return!this.enableDamping},set:function(t){this.enableDamping=!t}},dynamicDampingFactor:{get:function(){return this.dampingFactor},set:function(t){this.dampingFactor=t}}});var Rh={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")},Bh=function(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1};Object.assign(Bh.prototype,{setSize:function(t,e){},render:function(t,e,i,n,r){}});var Fh=function(t,e){Bh.call(this),this.textureID=void 0!==e?e:"tDiffuse",t instanceof Ye?(this.uniforms=t.uniforms,this.material=t):t&&(this.uniforms=Jt.clone(t.uniforms),this.material=new Ye({defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this.camera=new Uo(-1,1,1,-1,0,1),this.scene=new Zn,this.quad=new Qe(new Ne(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad)};Fh.prototype=Object.assign(Object.create(Bh.prototype),{constructor:Fh,render:function(t,e,i,n,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i.texture),this.quad.material=this.material,this.renderToScreen?(t.setRenderTarget(null),t.render(this.scene,this.camera)):(t.setRenderTarget(e),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),t.render(this.scene,this.camera))}});var Uh=function(t,e){Bh.call(this),this.scene=t,this.camera=e,this.clear=!0,this.needsSwap=!1,this.inverse=!1};Uh.prototype=Object.assign(Object.create(Bh.prototype),{constructor:Uh,render:function(t,e,i,n,r){var a,o,s=t.context,h=t.state;h.buffers.color.setMask(!1),h.buffers.depth.setMask(!1),h.buffers.color.setLocked(!0),h.buffers.depth.setLocked(!0),this.inverse?(a=0,o=1):(a=1,o=0),h.buffers.stencil.setTest(!0),h.buffers.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),h.buffers.stencil.setFunc(s.ALWAYS,a,4294967295),h.buffers.stencil.setClear(o),t.setRenderTarget(i),this.clear&&t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(e),this.clear&&t.clear(),t.render(this.scene,this.camera),h.buffers.color.setLocked(!1),h.buffers.depth.setLocked(!1),h.buffers.stencil.setFunc(s.EQUAL,1,4294967295),h.buffers.stencil.setOp(s.KEEP,s.KEEP,s.KEEP)}});var Gh=function(){Bh.call(this),this.needsSwap=!1};Gh.prototype=Object.create(Bh.prototype),Object.assign(Gh.prototype,{render:function(t,e,i,n,r){t.state.buffers.stencil.setTest(!1)}});var jh=function(t,e){if(this.renderer=t,void 0===e){var i={minFilter:H,magFilter:H,format:et,stencilBuffer:!1},n=t.getDrawingBufferSize(new St);(e=new zt(n.width,n.height,i)).texture.name="EffectComposer.rt1"}this.renderTarget1=e,this.renderTarget2=e.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],this.copyPass=new Fh(Rh),this._previousFrameTime=Date.now()};Object.assign(jh.prototype,{swapBuffers:function(){var t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t},addPass:function(t){this.passes.push(t);var e=this.renderer.getDrawingBufferSize(new St);t.setSize(e.width,e.height)},insertPass:function(t,e){this.passes.splice(e,0,t)},render:function(t){void 0===t&&(t=.001*(Date.now()-this._previousFrameTime)),this._previousFrameTime=Date.now();var e,i,n=this.renderer.getRenderTarget(),r=!1,a=this.passes.length;for(i=0;i<a;i++)if(!1!==(e=this.passes[i]).enabled){if(e.render(this.renderer,this.writeBuffer,this.readBuffer,t,r),e.needsSwap){if(r){var o=this.renderer.context;o.stencilFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,t),o.stencilFunc(o.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==Uh&&(e instanceof Uh?r=!0:e instanceof Gh&&(r=!1))}this.renderer.setRenderTarget(n)},reset:function(t){if(void 0===t){var e=this.renderer.getDrawingBufferSize(new St);(t=this.renderTarget1.clone()).setSize(e.width,e.height)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(t,e){this.renderTarget1.setSize(t,e),this.renderTarget2.setSize(t,e);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(t,e)}});var Vh=function(t,e,i,n,r){Bh.call(this),this.scene=t,this.camera=e,this.overrideMaterial=i,this.clearColor=n,this.clearAlpha=void 0!==r?r:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1};Vh.prototype=Object.assign(Object.create(Bh.prototype),{constructor:Vh,render:function(t,e,i,n,r){var a,o,s=t.autoClear;t.autoClear=!1,this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(a=t.getClearColor().getHex(),o=t.getClearAlpha(),t.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&t.clearDepth(),t.setRenderTarget(this.renderToScreen?null:i),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),t.render(this.scene,this.camera),this.clearColor&&t.setClearColor(a,o),this.scene.overrideMaterial=null,t.autoClear=s}});var Wh={uniforms:{tDiffuse:{value:null},tDepth:{value:null},size:{value:new St(512,512)},cameraNear:{value:1},cameraFar:{value:100},radius:{value:32},onlyAO:{value:0},aoClamp:{value:.25},lumInfluence:{value:.7}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float cameraNear;","uniform float cameraFar;","#ifdef USE_LOGDEPTHBUF","uniform float logDepthBufFC;","#endif","uniform float radius;","uniform bool onlyAO;","uniform vec2 size;","uniform float aoClamp;","uniform float lumInfluence;","uniform sampler2D tDiffuse;","uniform highp sampler2D tDepth;","varying vec2 vUv;","#define DL 2.399963229728653","#define EULER 2.718281828459045","const int samples = 32;","const bool useNoise = true;","const float noiseAmount = 0.0004;","const float diffArea = 0.4;","const float gDisplace = 0.4;","#include <packing>","vec2 rand( const vec2 coord ) {","vec2 noise;","if ( useNoise ) {","float nx = dot ( coord, vec2( 12.9898, 78.233 ) );","float ny = dot ( coord, vec2( 12.9898, 78.233 ) * 2.0 );","noise = clamp( fract ( 43758.5453 * sin( vec2( nx, ny ) ) ), 0.0, 1.0 );","} else {","float ff = fract( 1.0 - coord.s * ( size.x / 2.0 ) );","float gg = fract( coord.t * ( size.y / 2.0 ) );","noise = vec2( 0.25, 0.75 ) * vec2( ff ) + vec2( 0.75, 0.25 ) * gg;","}","return ( noise * 2.0 - 1.0 ) * noiseAmount;","}","float readDepth( const in vec2 coord ) {","float cameraFarPlusNear = cameraFar + cameraNear;","float cameraFarMinusNear = cameraFar - cameraNear;","float cameraCoef = 2.0 * cameraNear;","#ifdef USE_LOGDEPTHBUF","float logz = unpackRGBAToDepth( texture2D( tDepth, coord ) );","float w = pow(2.0, (logz / logDepthBufFC)) - 1.0;","float z = (logz / w) + 1.0;","#else","float z = unpackRGBAToDepth( texture2D( tDepth, coord ) );","#endif","return cameraCoef / ( cameraFarPlusNear - z * cameraFarMinusNear );","}","float compareDepths( const in float depth1, const in float depth2, inout int far ) {","float garea = 8.0;","float diff = ( depth1 - depth2 ) * 100.0;","if ( diff < gDisplace ) {","garea = diffArea;","} else {","far = 0;","}","float dd = diff - gDisplace;","float gauss = pow( EULER, -2.0 * ( dd * dd ) / ( garea * garea ) );","return gauss;","}","float calcAO( float depth, float dw, float dh ) {","vec2 vv = vec2( dw, dh );","vec2 coord1 = vUv + radius * vv;","vec2 coord2 = vUv - radius * vv;","float temp1 = 0.0;","float temp2 = 0.0;","int far = 0;","temp1 = compareDepths( depth, readDepth( coord1 ), far );","if ( far > 0 ) {","temp2 = compareDepths( readDepth( coord2 ), depth, far );","temp1 += ( 1.0 - temp1 ) * temp2;","}","return temp1;","}","void main() {","vec2 noise = rand( vUv );","float depth = readDepth( vUv );","float tt = clamp( depth, aoClamp, 1.0 );","float w = ( 1.0 / size.x ) / tt + ( noise.x * ( 1.0 - noise.x ) );","float h = ( 1.0 / size.y ) / tt + ( noise.y * ( 1.0 - noise.y ) );","float ao = 0.0;","float dz = 1.0 / float( samples );","float l = 0.0;","float z = 1.0 - dz / 2.0;","for ( int i = 0; i <= samples; i ++ ) {","float r = sqrt( 1.0 - z );","float pw = cos( l ) * r;","float ph = sin( l ) * r;","ao += calcAO( depth, pw * w, ph * h );","z = z - dz;","l = l + DL;","}","ao /= float( samples );","ao = 1.0 - ao;","vec3 color = texture2D( tDiffuse, vUv ).rgb;","vec3 lumcoeff = vec3( 0.299, 0.587, 0.114 );","float lum = dot( color.rgb, lumcoeff );","vec3 luminance = vec3( lum );","vec3 final = vec3( color * mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );","if ( onlyAO ) {","final = vec3( mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );","}","gl_FragColor = vec4( final, 1.0 );","}"].join("\n")};class Hh{constructor(t,e,i,n=1){this.scale=n,this.depthMaterial=new An,this.depthMaterial.depthPacking=_t,this.depthMaterial.blending=0,this.depthMaterial.skinning=!0,this.depthRenderTarget=new zt(e,i,{minFilter:H,magFilter:H}),this.depthRenderTarget.texture.name="SSAOShader.rt",this.ssaoPass=new Fh(Wh),this.ssaoPass.uniforms.tDepth.value=this.depthRenderTarget.texture,this.ssaoPass.uniforms.size.value.set(e*n,i*n),this.ssaoPass.uniforms.cameraNear.value=2,this.ssaoPass.uniforms.cameraFar.value=1200,this.ssaoPass.uniforms.onlyAO.value=!1,this.ssaoPass.uniforms.radius.value=6,this.ssaoPass.uniforms.aoClamp.value=.6,this.ssaoPass.uniforms.lumInfluence.value=1}setSize(t,e){this.depthRenderTarget.setSize(t,e),this.ssaoPass.uniforms.size.value.set(t*this.scale,e*this.scale)}setRadius(t){this.ssaoPass.uniforms.radius.value=t||6}get enabled(){return this.ssaoPass.enabled}set enabled(t){this.ssaoPass.enabled=t}getPass(){return this.ssaoPass}}var Xh={uniforms:{tDiffuse:{value:null},resolution:{value:new St(1/1024,1/512)}},vertexShader:["void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","#define FXAA_REDUCE_MIN (1.0/128.0)","#define FXAA_REDUCE_MUL (1.0/8.0)","#define FXAA_SPAN_MAX 8.0","void main() {","vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;","vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;","vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );","vec3 rgbM = rgbaM.xyz;","vec3 luma = vec3( 0.299, 0.587, 0.114 );","float lumaNW = dot( rgbNW, luma );","float lumaNE = dot( rgbNE, luma );","float lumaSW = dot( rgbSW, luma );","float lumaSE = dot( rgbSE, luma );","float lumaM = dot( rgbM, luma );","float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );","float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );","vec2 dir;","dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));","dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));","float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );","float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );","dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),","max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),","dir * rcpDirMin)) * resolution;","vec4 rgbA = (1.0/2.0) * (","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));","vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));","float lumaB = dot(rgbB, vec4(luma, 0.0));","if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {","gl_FragColor = rgbA;","} else {","gl_FragColor = rgbB;","}","}"].join("\n")};class qh{constructor(t){this.map=t,this.enabled=!0;var e=window.devicePixelRatio||1;this.dpr=e;var i=t.view.width*e,n=t.view.height*e;this.delta=.8,this.depthCamera=this.map.view.camera.clone(),this.basePass=new Vh(t.sceneManager.base,t.view.currentCamera),this.basePass.clearDepth=!0,this.renderDefaultPass=new Vh(t.sceneManager.default,t.view.currentCamera),this.renderDefaultPass.clear=!1,this.renderMainPass=new Vh(t.sceneManager.mainScene,t.view.currentCamera),this.renderMainPass.clear=!1,this.renderMainPass.clearDepth=!1,this.hudPass=new Vh(t.sceneManager.props.constructor("dit"),t.view.cameraHUD),this.hudPass.clear=!1,this.hudPass.clearDepth=!0;var r={minFilter:H,magFilter:H,format:et,stencilBuffer:!0};this.rt=new zt(i,n,r),this.rt.texture.name="EffectComposer.rt1",this.composer=new jh(t.view.renderer,this.rt),this.composer.setSize(i,n),this.ssaoEffect=new Hh(t,i,n),this.ssaoPass=this.ssaoEffect.getPass(),this.markerRender=new Vh(t.sceneManager.markerScene,t.view.currentCamera),this.markerRender.setSize(i,n),this.markerRender.clear=!1,this.markerRender.clearDepth=!1,this.fxaaPass=new Fh(Xh),this.fxaaPass.uniforms.resolution.value=new St(1/i,1/n);var a=new Fh(Rh);a.renderToScreen=!0,this._currentViewMode=null,this.composer.addPass(this.basePass),this.composer.addPass(this.renderDefaultPass),this.composer.addPass(this.renderMainPass),this.composer.addPass(this.markerRender),this.composer.addPass(this.hudPass),this.composer.addPass(this.ssaoPass),this.composer.addPass(a),this.markerNodeEntityVisibles=[]}setSize(t,e){t*=this.dpr,e*=this.dpr,this.rt.setSize(t,e),this.composer.setSize(t,e),this.ssaoEffect.setSize(t,e),this.fxaaPass.uniforms.resolution.value.set(1/t,1/e)}render(){if(this.customRender)this.customRender();else if(this.map.config.context&&this.map.view.renderer.state.reset(),this.map.emit("pre-render"),this.enabled&&"3d"===this.map.view.viewMode&&this.map.config.useAOEffect){this.map.config.context||this.map.view.renderer.clear(),this.map.sceneManager.mainScene.overrideMaterial=this.ssaoEffect.depthMaterial;var t=kh.traverse(this.map.sceneManager.mainScene.children,t=>"markerNodeEntity"===t.name||!!t.isSkinnedMesh||void 0,!0,!0)||[];this.markerNodeEntityVisibles.length=0,t.forEach(t=>{this.markerNodeEntityVisibles.push(t.visible),t.visible=!1}),this.depthCamera.copy(this.map.view.camera);var e=this.map.view.controls.distance,i=e*this.delta,n=e+i;(n/=Math.cos(this.map.view.controls.polar))<300&&(n=300),this.depthCamera.far=n,this.depthCamera.near=e-i,this.depthCamera.updateProjectionMatrix(),this.ssaoPass.uniforms.cameraFar.value=this.depthCamera.far,this.ssaoPass.uniforms.cameraNear.value=this.depthCamera.near,"3d"!==this._currentViewMode&&(this.map.view.renderer.setRenderTarget(this.ssaoEffect.depthRenderTarget),this._currentViewMode="3d"),this.map.view.renderer.render(this.map.sceneManager.mainScene,this.depthCamera),this.map.sceneManager.mainScene.overrideMaterial=null,t.forEach((t,e)=>{t.visible=this.markerNodeEntityVisibles[e]}),this.composer.render()}else"2d"!==this._currentViewMode&&(this.map.view.renderer.setRenderTarget(null),this._currentViewMode="2d"),this.map.config.context||this.map.view.renderer.clear(),this.map.view.renderer.render(this.map.sceneManager.base,this.map.view.currentCamera),this.map.view.renderer.clearDepth(),this.map.view.renderer.render(this.map.sceneManager.default,this.map.view.currentCamera),this.map.view.renderer.render(this.map.sceneManager.mainScene,this.map.view.currentCamera),this.map.view.renderer.render(this.map.sceneManager.markerScene,this.map.view.currentCamera),this.map.view.renderer.clearDepth(),this.map.view.renderer.render(this.map.sceneManager.props.constructor("dit"),this.map.view.cameraHUD)}dispose(){}}Lt.prototype.setFromCoord=function(t){return this.x=t.x,this.y=t.z,this.z=t.y,this};class Yh extends Lt{constructor(t,e,i){super(t,e,i)}setFromArray(t){this.x=t[0]||0,this.y=t[1]||0,this.z=t[2]||0}setFromString(t){var e=t.split(",");return this.x=+e[0],this.y=+e[1],this.z=e[2]?+e[2]:0,this}setFromVector3(t){return this.x=t.x,this.y=t.z,this.z=t.y,this}}var Zh={ambient_intensity:.5,ambient_color:"#d6ebff",l1_intensity:.362,l1_color:"#e6c9a7",l1_angle:325.8,l1_polarAngle:21.78,l1_distance:1e3,l2_intensity:.3,l2_color:"#DAE7FD",l2_angle:174.6,l2_polarAngle:-12.24,l2_distance:1e3,shadow:!1,shadow_type:2,shadow_near:200,shadow_far:2636,shadow_size:1024,light_radius:1e3,shadow_radius:1,shadow_bias:-6e-4},Jh=new Lt(1,0,0),Kh=new Lt(0,0,1);class Qh{constructor(t,e,i){this.group=new Dn,this.group.name="lights",this.renderer=e,this.config=Object.assign(Zh,i),this.ambientLight=new Vo(this.config.ambient_color,this.config.ambient_intensity),this.directionalLight=new jo(this.config.l1_color,this.config.l1_intensity),this.directionalLight2=new jo(this.config.l2_color,this.config.l2_intensity),this.group.add(this.ambientLight,this.directionalLight,this.directionalLight2),this.enableFollowCamera=!0,this.minLightDistance=50,t.mainScene.add(this.group),this.map=t.map,this.config.shadow=this.map.config.useShadowMap,this.setConfig(),this._lightDir=null,this._lightDis=null,this._lightAngle=null,this.offFollowCamera=this.map.on("viewChanged",this.followCamera.bind(this))}getCameraRate(){if("2d"===this.map.view.viewMode)return 1;let t=new Lt;this.map.view.camera.getWorldDirection(t);let e=t.clone();e.z=0;let i=Math.sin(t.angleTo(e));return Math.max(.6,i)}followCamera(){if(!this.enableFollowCamera)return;this._lightDir||this.getLightState();let t=this.directionalLight,e=this.map;t.target.position.copy(e.view.controls.target),t.target.updateMatrixWorld();let i=e.view.controls.distance,n=Math.tan(e.view.camera.fov)*i/1,r=Math.max(n,this.minLightDistance);t.position.copy(e.view.controls.target.clone().add(this._lightDir.clone().multiplyScalar(r))),this.setShadow({shadow_near:.05*r,shadow_far:2*r,light_radius:n}),this.updateShadowMap()}setConfig(t){Object.assign(this.config,t),this.ambientLight.intensity=this.config.ambient_intensity,this.ambientLight.color.set(this.config.ambient_color),this.directionalLight.intensity=this.config.l1_intensity,this.directionalLight.color.set(this.config.l1_color),this.setMainLightAngle(null),this.directionalLight2.intensity=this.config.l2_intensity,this.directionalLight2.color.set(this.config.l2_color),this.setSecondLightAngle(null),this.renderer.shadowMap.type=this.config.shadow_type,this.shadowMapEnabled=this.config.shadow,this.setShadow(),this.getLightState()}getAngle(t){t.updateMatrixWorld();var e=new Lt(t.position.x,t.position.y,0).normalize(),i=Jh.dot(e),n=180*Math.acos(i)/Math.PI;Jh.clone().cross(e).z<0&&(n=360-n),e=new Lt(t.position.x,t.position.y,0).normalize();var r=t.position.clone().normalize(),a=180*Math.acos(e.dot(r))/Math.PI||0;return r.z<0&&(a*=-1),{angle:n,polar:a}}getMainLightAngle(){return this.getAngle(this.directionalLight)}getSecondLightAngle(){return this.getAngle(this.directionalLight2)}setLightAngle(t,e,i,n){null==i?i=this.config[`${e}_angle`]:this.config[`${e}_angle`]=i,null==n?n=this.config[`${e}_polarAngle`]:this.config[`${e}_polarAngle`]=n;var r=i*Math.PI/180,a=n*Math.PI/180,o=Jh.clone().applyAxisAngle(Kh,r),s=(new Lt).crossVectors(o,Kh);o.applyAxisAngle(s,a),o.multiplyScalar(this.config[`${e}_distance`]),t.position.copy(o),t.updateMatrixWorld(),this.config.shadow&&this.setShadow()}setMainLightAngle(t,e){this.setLightAngle(this.directionalLight,"l1",t,e),this.getLightState()}setSecondLightAngle(t,e){this.setLightAngle(this.directionalLight2,"l2",t,e)}setMainLightDistance(t){this.config.l1_distance=t,this.setMainLightAngle(null),this.getLightState()}setSecondLightDistance(t){this.config.l2_distance=t,this.setSecondLightAngle(null)}getLightState(){this.directionalLight.target.updateMatrixWorld(),this.directionalLight.updateMatrixWorld();let t=this.directionalLight.position.clone().sub(this.directionalLight.target.position);this._lightDis=t.length(),this._lightDir=t.normalize();let e=t.clone();e.z=0,this._lightAngle=t.angleTo(e)}setShadow(t){t=Object.assign(this.config,t),this.renderer.shadowMap.type=t.shadow_type;var e=this.directionalLight;e.shadow.bias=t.shadow_bias||-6e-4,e.shadow.radius=t.shadow_radius||1,e.shadow.camera.near=t.shadow_near,e.shadow.camera.far=t.shadow_far,e.shadow.mapSize.width=t.shadow_size,e.shadow.mapSize.height=t.shadow_size;var i=t.light_radius;e.shadow.camera.left=-i,e.shadow.camera.right=i,e.shadow.camera.top=i,e.shadow.camera.bottom=-i,e.shadow.camera.updateProjectionMatrix()}shadowSetting(t){return this.setShadow(t)}updateShadowMap(){this.renderer.shadowMap.needsUpdate=!0}get shadowMapEnabled(){return this.directionalLight.castShadow}set shadowMapEnabled(t){this.config.shadow=t,this.directionalLight.castShadow=t,this.setShadow(),this.updateShadowMap()}get ambientIntensity(){return this.ambientLight.intensity}set ambientIntensity(t){this.ambientLight.intensity=t}get ambientColor(){return this.ambientLight.color}set ambientColor(t){this.ambientLight.color.set(t)}}var $h=new Lt;class tl{constructor(t){this.map=t,this.isCanvas=!1,this.isCanvas=void 0!==t.config.container._canvasId;var n,r={antialias:!0,alpha:!0,context:t.config.context};t.config.webGLConfig&&(r=Object.assign(r,t.config.webGLConfig)),this.isCanvas&&(r.canvas=t.config.container,e(r.canvas,a.prototype),i(r.canvas),e(t.config.canvas2d,a.prototype),i(t.config.canvas2d)),this.renderer=new Xn(r),this.isCanvas||t.config.context||t.config.container.appendChild(this.renderer.domElement),this.width=t.config.container.offsetWidth,this.height=t.config.container.offsetHeight,this._maxSize=null,de.DefaultUp.set(0,0,1),this.renderer.setClearColor("#282a35",1),n=this.map.sysInfo.pixelRatio,this.pixelRatio=n,this.resolution=this.map.config.resolution,this.renderer.setSize(this.width,this.height),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.autoUpdate=!1,this.renderer.shadowMap.type=1,this.renderer.autoClear=!1,this.zoomLevels=[295829355.45,147914677.73,73957338.86,36978669.43,18489334.72,9244667.36,4622333.68,2311166.84,1155583.42,577791.71,288895.85,144447.93,72223.96,36111.98,18056,9028,4514,2257,1128,564,282,141,70,35,17,8,4,2,1],this.pixelsPerCentimeter=kh.getDPI()/2.54,this.camera=new On(35,this.width/this.height,10,1e5);var o=this.width/2,s=this.height/2;this.camera2D=new Uo(-o,o,s,-s,1,1e5),this.camera2D.rotation.set(-Math.PI/2,0,0,"XYZ"),this.camera2D.position.set(0,1e5,0),this.cameraHUD=new Uo(-o,o,s,-s,1,1e5),this.cameraHUD.rotation.set(-Math.PI/2,0,0,"XYZ"),this.cameraHUD.position.set(0,1e3,0),this.frustum=new Vt,this.controls=new zh(this.camera,this.domElement,this.map),Object.assign(this.controls,{dampingFactor:.2,rotateSpeed:.8,zoomSpeed:this.map.config.zoomSpeed,minPolarAngle:this.minPolarAngle*Mt.DEG2RAD,maxPolarAngle:this.maxPolarAngle*Mt.DEG2RAD,zoomToCursor:this.map.config.zoomToCursor}),this.currentCamera=this.camera,this.controls.update(),this.map.config.context&&(this.controls.enabled=!1),this.sizeRate=1,this.lights=new Qh(this.map.sceneManager,this.renderer),this._props={animCount:0,zooms:[]}}init(t){var e=this;t=t||e.map.config;let prom=new Nh;function i(){e.viewMode={mode:t.viewMode,duration:0,callback:()=>{"3d"===t.viewMode&&(e.controls.polar=t.polarAngle*Mt.DEG2RAD,e.controls.azimuthal=t.viewAngle*Mt.DEG2RAD)}},e.updateFrustum(!0),e._events(),setTimeout(()=>{e.map.emit("ready",e.map)},0),prom.resolve()}return e.setZoomLevelRangeData(),t.zoom?e.zoom={zoom:t.zoom,duration:0,callback:i}:(t.zoomLevel=Math.max(Math.min(t.zoomLevel,t.maxZoomLevel),t.minZoomLevel),e.zoomLevel={level:t.zoomLevel,duration:0,callback:i}),prom}get domElement(){return this.map.config.context?this.map.config.context.canvas:this.map.config.eventsOnContainer?this.map.config.container:this.renderer.domElement}setConfig(t){["minZoomLevel","maxZoomLevel","minPolarAngle","maxPolarAngle"].forEach(e=>{t.hasOwnProperty(e)&&void 0!==t[e]&&(this[e]=t[e])}),void 0!==t.viewAngle&&(this.controls.azimuthal=t.viewAngle*Mt.DEG2RAD)}registerZoomChanged(t){t=[].concat(t);var e=[];return t.forEach(t=>{t.id||(t.id=kh.generateID().toLowerCase()),e.push(t.id)}),Array.prototype.push.apply(this._props.zooms,t),()=>{this.unregisterZoomChangedCallback(e)}}unregisterZoomChangedCallback(t){for(var e=this._props.zooms.length-1;e>-1;e--){let i=this._props.zooms[e];t.indexOf(i.id)>-1&&this._props.zooms.splice(e,1)}}getAllZoomChangedCallback(){return this._props.zooms}_events(){var t=null;this.viewChangedFunc=()=>{this.map.emit("viewUpdate"),t||(t=Date.now()),this._zoom=this.zoom,this._props.zooms.forEach(t=>{if(!1!==t.enabled){var e=this._zoom-t.zoom;e<0&&t.lt&&"lt"!==t.state?(t.lt(this._zoom),t.state="lt"):0===e&&t.equal&&"equal"!==t.state?(t.equal(this._zoom),t.state="equal"):e>0&&t.gt&&"gt"!==t.state&&(t.gt(this._zoom),t.state="gt")}});var e=this.zoomLevel;e!==this._props.lastZoomLevel&&(this.map.emit("zoomLevelChanged",{currentLevel:e,lastLevel:this._props.lastZoomLevel}),this._props.lastZoomLevel=e),this._zoom=null;var i=Date.now();i-t>=this.map.config.viewChangedTimeStep&&(t=i,this.updateFrustum(),this.map.emit("viewChanged")),clearTimeout(this._viewChangedID),this._viewChangedID=setTimeout(()=>{t=null,this.updateFrustum(),this.map.emit("viewChanged")},this.map.config.viewChangedEventDelay)},this.controls.addEventListener("change",this.viewChangedFunc)}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=t,this.resize()}get resolution(){return this._resolution||1}set resolution(t){this._resolution=t,this.renderer.setPixelRatio(this.pixelRatio*t)}clampSize(t,e){t=t||this.map.config.container.offsetWidth,e=e||this.map.config.container.offsetHeight;var i=1;if(this.maxSize){var n=Math.max(t,e);this.maxSize<n&&(i=this.maxSize/n),t=Math.round(i*t),e=Math.round(i*e)}this.sizeRate=i,this.width=t,this.height=e,this.renderer.setSize(this.width,this.height),Object.assign(this.renderer.domElement.style,{transformOrigin:"left top",transform:"scale("+1/i+")"})}getRealHeight(){return this.height/(this.sizeRate||1)}resize(t,e){this.clampSize(t,e),this.camera.aspect=this.width/this.height,this.camera.updateProjectionMatrix();var i=kh.getCamera2DSize(this.map);this.controls.updateRect(),this.updateCamera2D(i.top,i.right,!0),this.updateCameraHUD(),this.map.composition.setSize(this.width,this.height),this.map.emit("resize",this.width,this.height)}updateFrustum(t){t&&(this.currentCamera.updateMatrixWorld(),this.currentCamera.updateProjectionMatrix()),this.frustum.setFromMatrix((new At).multiplyMatrices(this.currentCamera.projectionMatrix,this.currentCamera.matrixWorldInverse))}get currentCamera(){return this.controls.object}set currentCamera(t){this.controls.object=t}get minPolarAngle(){return this.map.config.minPolarAngle}set minPolarAngle(t){this.map.config.minPolarAngle=t,this.controls.minPolarAngle=t*Mt.DEG2RAD}get maxPolarAngle(){return this.map.config.maxPolarAngle}set maxPolarAngle(t){this.map.config.maxPolarAngle=t,this.controls.maxPolarAngle=t*Mt.DEG2RAD,this.polarAngle>t&&(this.polarAngle={angle:t,duration:0})}get polarAngle(){return this.controls.polar*Mt.RAD2DEG}set polarAngle(t){var e,i;"2d"!==this.viewMode&&("number"==typeof t&&(t={angle:t}),e=void 0===t.duration?this.map.config.animateDuration:t.duration,i=t.callback,t=t.angle,t=Math.min(Math.max(t,this.map.config.minPolarAngle),this.map.config.maxPolarAngle),this._stopAnim("polarAngleAnim"),this._animStart(),this._props.polarAngleAnim=new wh.Tween(this.controls).to({polar:t*Mt.DEG2RAD},e).onComplete(()=>{this._animComplete(),i&&i()}).start())}get viewAngle(){return this.controls.azimuthal*Mt.RAD2DEG}set viewAngle(t){var e,i;"number"==typeof t&&(t={angle:t}),e=void 0===t.duration?this.map.config.animateDuration:t.duration,i=t.callback,t=t.angle,t=kh.getNearestAngle(this.viewAngle,t,!0)+this.viewAngle,this._stopAnim("veiwAngleAnim"),this._animStart(),this._props.veiwAngleAnim=new wh.Tween(this.controls).to({azimuthal:t*Mt.DEG2RAD},e).onComplete(()=>{this._animComplete(),i&&i()}).start()}get backgroundColor(){return this._backgroundColor||"#282a35"}set backgroundColor(t){this.renderer.setClearColor(t),this._backgroundColor=t}get backgroundAlpha(){return void 0===this._backgroundAlpha?1:this._backgroundAlpha}set backgroundAlpha(t){this.renderer.setClearAlpha(t),this._backgroundAlpha=t}get zoom(){return kh.getZoomFactor(this.map)*this.pixelsPerCentimeter*100}set zoom(t){this._stopAnim("zoomAnim");var e=this.map.config.animateDuration,i=null,n=null;"object"==typeof t&&(e=void 0===t.duration?e:t.duration,i=t.callback,n="string"==typeof t.easing?kh.getEasingByName(t.easing):t.easing,t=t.zoom),"2d"===this.viewMode&&this.updateCamera2D(this.currentCamera.top/this.currentCamera.zoom);var r=kh.getCameraDataByZoom(this.map,t),a=r.distance,o=r.top;a=Math.min(Math.max(a,this.maxLevelData.distance),this.minLevelData.distance),o=Math.min(Math.max(o,this.maxLevelData.top),this.minLevelData.top),this._animStart(),this._props.zoomAnim=new wh.Tween(this).to({"controls.distance":a,camera2DTop:o,props:["camera2DTop"]},e).easing(n||wh.Easing.Quartic.Out).onComplete(()=>{this._animComplete(),i&&i()}).onUpdate(()=>{this.camera2D.updateProjectionMatrix(),this.map.emit("zoom")}).start()}get zoomLevel(){for(var t=this._zoom||this.zoom,e=0;e<this.zoomLevels.length;e++)if(t>this.zoomLevels[e])return e;return this.zoomLevels.length}set zoomLevel(t){"number"==typeof t&&(t={level:t}),t.level=Math.max(Math.min(t.level,29),1);var e=(this.zoomLevels[t.level-1]-this.zoomLevels[t.level])/2;t.zoom=this.zoomLevels[t.level]+e,this.zoom=t}setZoomLevelRangeData(t,e){t=this.zoomLevels[(t||this.map.config.minZoomLevel)-1],e=this.zoomLevels[(e||this.map.config.maxZoomLevel)-1];var i=kh.getCameraDataByZoom(this.map,t),n=kh.getCameraDataByZoom(this.map,e);this.minLevelData=i,this.maxLevelData=n}setZoomLevelRange(t,e){this.map.config.minZoomLevel=t,this.map.config.maxZoomLevel=e,this.setZoomLevelRangeData(t,e),this.zoomLevel<t&&(this.zoomLevel=t),this.zoomLevel>e&&(this.zoomLevel=e)}get minZoomLevel(){return this.map.config.minZoomLevel}set minZoomLevel(t){t=Math.min(Math.max(1,t),28),this.setZoomLevelRange(t,this.maxZoomLevel)}get maxZoomLevel(){return this.map.config.maxZoomLevel}set maxZoomLevel(t){t=Math.min(Math.max(1,t),28),this.setZoomLevelRange(this.minZoomLevel,t)}moveTo(t,e){var i=this;if(!i.stopMoveTo()){var n,r,a,o,s,prom=new Nh,h=t.zoom||t.zoomLevel,l=void 0===t.duration?this.map.config.animateDuration:t.duration,c=null;t||(t=new Lt),Array.isArray(t)&&(t=(new Lt).fromArray(t)),t instanceof Lt||(n=kh.getNearestAngle(this.viewAngle,t.viewAngle,!0)+this.viewAngle,r=t.polarAngle,l=void 0===t.duration?l:t.duration,c=t.callback,o="string"==typeof t.easing?kh.getEasingByName(t.easing):t.easing,t.zoomLevel&&(s=(i.zoomLevels[t.zoomLevel-1]+i.zoomLevels[t.zoomLevel])/2),t.zoom&&(s=t.zoom),s&&(a=kh.getCameraDataByZoom(this.map,s).distance),t=t.viewCenter?Array.isArray(t.viewCenter)?(new Lt).fromArray(t.viewCenter):t.viewCenter.clone():null),o=o||wh.Easing.Cubic.Out,n=void 0===n?this.controls.azimuthal*Mt.RAD2DEG:n,r=void 0===r?this.controls.polar*Mt.RAD2DEG:r,a=void 0===a?this.controls.distance:a,t=t||this.controls.target.clone();var u,d,p=!1;"2d"===this.viewMode?(p=!0,r=0,u=kh.getCameraDataByZoom(this.map,this.zoom).distance):u=this.controls.distance,d=a-u,this._animStart();var f=n*Mt.DEG2RAD,m=r*Mt.DEG2RAD;return Math.abs(i.controls.azimuthal-f)<.05&&Math.abs(i.controls.polar-m)<.05&&i.controls.target.distanceTo(t)<.1&&Math.abs(d)<.1&&(l=0),this._props.moveToAnim=new wh.Tween(i.controls).to({target:t,azimuthal:f,polar:m,props:["target"]},l).easing(o).onUpdate(t=>{if(h&&(i.controls.distance=u+d*t,p)){var e=kh.getCamera2DSize(i.map);i.updateCamera2D(e.top,e.right)}}).onComplete(()=>{i._animComplete(),c&&c(),e&&e(),prom.resolve()}),this._props.moveToAnim.isImportant=t.isImportant,clearTimeout(this._props.move_anim_id),this._props.move_anim_id=setTimeout(()=>{this._props.moveToAnim.start()},0),prom}}_stopAnim(t){if(this._props[t]){if(this._props[t].isImportant)return!0;this._props[t].stop(),this._props[t]=null,this._animComplete()}}_animStart(){this._props.animCount++,this.map.state.addState(this.map.state.VIEW_ANIMATING)}_animComplete(){this._props.animCount--,this._props.animCount<0&&(this._props.animCount=0),this.map.state.removeState(this.map.state.VIEW_ANIMATING)}stopMoveTo(){return this._stopAnim("moveToAnim")}get camera2DTop(){return this.camera2D.top}set camera2DTop(t){this.updateCamera2D(t)}updateCamera2D(t,e,i){e||(e=this.width/this.height*t),i||(this.camera2D._lastTop=this.camera2D.top,this.camera2D.zoom=1),this.camera2D.top=t,this.camera2D.bottom=-t,this.camera2D.right=e,this.camera2D.left=-e,this.camera2D.updateProjectionMatrix()}updateCameraHUD(){var t=this.height/2,e=this.width/2;this.cameraHUD.top=t,this.cameraHUD.bottom=-t,this.cameraHUD.right=e,this.cameraHUD.left=-e,this.cameraHUD.updateProjectionMatrix()}get viewMode(){return this._props.viewMode}set viewMode(t){if("string"==typeof t&&(t={mode:t}),t.mode!==this.viewMode){var e=t.callback;this.map.config.viewMode=this._props.viewMode=t.mode,t.callback=()=>{this.map.emit("viewModeChanged",t.mode),e&&e()},this.setMode(t)}}setMode(t){this._stopAnim("viewModeAnim"),"string"==typeof t&&(t={mode:t}),t.easing&&"string"==typeof t.easing&&(t.easing=kh.getEasingByName(t.easing));var e=this.controls.azimuthal,i=void 0===t.duration?this.map.config.animateDuration:t.duration;switch(t.mode){case"2d":this._animStart(),void 0===t.toNorth&&(t.toNorth=!0),this._props.lastPhi=this.controls.polar<.01?this.map.config.polarAngle*Mt.DEG2RAD:this.controls.polar,this._props.lastViewAngle=this.viewAngle,this.controls.enableRotate=!1;var n={polar:0};t.viewAngle&&(n.azimuthal=t.viewAngle*Mt.DEG2RAD),t.toNorth&&(n.azimuthal=0),this._props.viewModeAnim=new wh.Tween(this.controls).to(n,i).easing(t.easing||wh.Easing.Quartic.Out).onComplete(()=>{var i=kh.getCamera2DSize(this.map);this.currentCamera=this.camera2D,t.toNorth?this.controls.azimuthal=0:this.controls.azimuthal=n.azimuthal||e,this.updateCamera2D(i.top,i.right),this.camera2D.baseTop=i.top,this._animComplete(),t.callback&&t.callback()}),this._props.viewModeAnim.start();break;case"3d":this._animStart(),this.controls.distance=this.controls.distance/this.camera2D.zoom,this.currentCamera=this.camera,this._props.viewModeAnim=new wh.Tween(this.controls).to({polar:this._props.lastPhi||.5,azimuthal:(t.viewAngle||this._props.lastViewAngle)*Mt.DEG2RAD},i).easing(wh.Easing.Quartic.Out).onComplete(()=>{this._animComplete(),t.callback&&t.callback(),this.controls.enableRotate=!0}),this._props.viewModeAnim.start()}}getViewState(t=!1){var e=this.controls.target,i={viewMode:this.viewMode,zoom:this.zoom,zoomLevel:this.zoomLevel,viewAngle:this.viewAngle,polarAngle:this.polarAngle,viewCenter:[e.x,e.y,e.z]};return t?JSON.stringify(i):i}setViewState(t,e,i){var n={};if(["viewMode","zoom","zoomLevel","viewAngle","polarAngle","viewCenter","easing","duration","callback"].forEach(e=>{n[e]=t[e]}),t=n,void 0===e&&(e=t.duration),t.duration=void 0===e?this.map.config.animateDuration:e,t.viewCenter){var r=t.viewCenter;t.viewCenter=new Lt(r[0],r[1],r[2]||0)}return t.viewMode&&t.viewMode!==this.viewMode&&(this.viewMode={mode:t.viewMode,duration:t.duration}),this.moveTo(t,i)}get viewCenter(){var t=this.controls.target;return[t.x,t.y,t.z||0]}set viewCenter(t){var e,i,n;Array.isArray(t)?(e=t[0],i=t[1],n=t[2]):(e=t.x,i=t.y,n=t.z),this.controls.target.set(e,i,n),this.controls.update(!0)}onlyShow(t,e,i){(i=i||{}).withScene||void 0===t?this.map.omScene.showAllNodes():this.map.omScene.onlyShowNode("buildingNode"),this.map.omScene.buildingNode.children.forEach(i=>{void 0===t?(i.visible=!0,i.showAllNodes(),i.floorNode.children.forEach(t=>{t.visible=!0})):t.indexOf(i.data.buildingID)>-1?(i.visible=!0,e&&(i.onlyShowNode("floorNode"),i.floorNode.children.forEach(t=>{t.visible="all"===e||e.indexOf(t.data.floorNumber)>-1}))):i.visible=!1})}getScreenShot(t,e,i,n){var r,a;r=this.width,a=this.height,t=t||r,e=e||a,this.resize(t,e),this.renderer.clearColor(),this.renderer.render(this.map.sceneManager.default,n||this.currentCamera),this.renderer.render(i||this.map.sceneManager.mainScene,n||this.currentCamera);var o=this.renderer.domElement.toDataURL("image/jpeg",1);return this.resize(r,a),o}getScreenShotImage(t=2){var e,i;this.map.baseLayers.length&&(e=(i=this.map.baseLayers[0].entity).parent,this.map.sceneManager.mainScene.add(i));var n=new Image;return n.src=this.getScreenShot(this.width*t,this.height*t),i&&e.add(i),n}get clampSceneArea(){return this._clampSceneArea}set clampSceneArea(t){t?(this._offStartPick=this.map.on("startPick",()=>{this._stopAnim("moveToAnim")}),this._offEndPick=this.map.on("endPick",()=>{var t=this.map.sceneManager.mainScene.area;t.containsPoint(this.controls.target)||(t.clampPoint(this.controls.target,$h),this.moveTo({viewCenter:$h,duration:600,easing:"cubicOut"}))})):(this._offEndPick&&this._offEndPick(),this._offStartPick&&this._offStartPick())}dispose(){this.renderer.renderLists.dispose(),this.renderer.forceContextLoss(),this.controls.dispose(),this.isCanvas||this.map.config.context||this.map.config.container.removeChild(this.renderer.domElement),this.map.off("update",this.updateFunc),this.controls.removeEventListener("change",this.viewChangedFunc),this.renderer.context=null,this.renderer.domElement=null,this.renderer=null}}class el{constructor(t,e){this._name="",this.type="Node",this.data=t||{},this.entity=e,e&&(this.entity.node=this),this.parent=null,this.children=[],this._show=!0}clone(){return new this.constructor(this.data,this.entity)}get name(){return this.data?this.data.name:""}set name(t){this.data.name=t}setEntity(t){var e=null;this.entity&&(e=this.entity.parent),this.entity=t,this.entity&&(this.entity.node=this,e&&e.add(this.entity))}getProp(t){if(this.data)return this.data[t]}setProp(t,e){this.data&&(this.data[t]=e)}getDataClone(){this.data.children&&(this.data.children.length=0);var t=this.data.node;delete this.data.node;var e=kh.cloneJSON(this.data);return this.getDataWithNode&&(e.node=t),t&&(this.data.node=t),e}setData(t){this.data=t}get show(){return this._show}set show(t){this._show=t,this.visible=t}get visible(){return!!this.entity&&this.entity.visible}set visible(t){this.entity&&(this.entity.visible=t&&this.show)}get position(){return this.entity.position}set position(t){this.entity&&(t instanceof Yh?this.entity.position.setFromCoord(t):t instanceof Lt?this.entity.position.copy(t):Array.isArray(t)&&this.entity.position.fromArray(t))}_disposeMaterial(t){t.dispose(),Object.keys(t).forEach(e=>{const i=t[e];i&&"object"==typeof i&&"minFilter"in i&&i.dispose()})}removeEntity(t,e=!0){e&&t.parent&&t.parent.remove(t),t.traverse(t=>{t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(t=>{this._disposeMaterial(t)}):this._disposeMaterial(t.material))})}dispose(){if(this.parent&&this.parent.remove(this),this.entity&&(this.removeEntity(this.entity),this.entity=null,this.children.length))for(var t=this.children.length-1;t>-1;t--)this.children[t]&&this.children[t].dispose();this.data=null}add(t){var e=this;Array.from(arguments).forEach(t=>{var i=!1,n=t.parent?t.parent.entity:t.entity.parent;n&&t.entity&&n!==t.entity&&(t.parent!==this&&t.entity.applyMatrix(n.matrixWorld),t.parent&&t.parent.remove(t),i=!0),e.children.push(t),t.parent=e,e.entity&&t.entity&&e.entity!==t.entity&&(i&&(t.entity.updateMatrixWorld(),t.entity.applyMatrix((new At).getInverse(e.entity.matrixWorld))),e.entity.add(t.entity))})}remove(t,e){var i=this,n=Array.from(arguments);"boolean"==typeof n[n.length-1]&&(e=n.pop());for(var r=n.length-1;r>-1;r--){var a=n[r],o=i.children.indexOf(a);-1!==o&&(i.children.splice(o,1),a.parent=null,a.visible=!1,i.entity&&!1!==e&&i.entity.remove(a.entity))}}find(t,e){var i=null,n="function"==typeof t;return n||(i=Object.keys(t)),kh.traverse(this.children,e=>{if(n)return t(e);for(var r=0,a=i.length;r<a;r++){var o=i[r];if(e.data[o]!==t[o])return!1}return!0},!0)}findData(t,e){if(this.data){e=Object.assign({multi:!0,recursive:!0},e);var i=[],n=this.data.blocks;if(n&&n.length&&(i=i.concat(this._findInArray(n,t,e.multi)),!e.multi&&i.length))return i;var r=this.data.models;if(r&&r.length&&(i=i.concat(this._findInArray(r,t,e.multi)),!e.multi&&i.length))return i;var a=this.data.markers;if(a&&a.length&&(i=i.concat(this._findInArray(a,t,e.multi)),!e.multi&&i.length))return i;if(e.recursive)if(this.buildingNode&&this.buildingNode.children.length)for(var o=0;o<this.buildingNode.children.length;o++){var s=this.buildingNode.children[o];if(i=i.concat(s.findData(t,e)),!e.multi&&i.length)return i}else if(this.floorNode&&this.floorNode.children.length)for(o=0;o<this.floorNode.children.length;o++){var h=this.floorNode.children[o];if(i=i.concat(h.findData(t,e)),!e.multi&&i.length)return i}return i}}_findInArray(t,e,i=!1){var n=e;if("function"!=typeof e){var r=Object.keys(e);n=function(t){for(var i=0;i<r.length;i++)if(t[r[i]]!==e[r[i]])return!1;return!0}}for(var a=[],o=0;o<t.length;o++)if(n(t[o])){if(!i)return[t[o]];a.push(t[o])}return a}setPosition(t){this.entity&&this.entity.position.copy(t)}setRotation(t){this.entity&&this.entity.rotation.copy(t)}setScale(t){this.entity&&this.entity.scale.copy(t)}}class il{constructor(t){this.map=t,this.mapEventHandlers=[],this.entities=[],this.map.on("reset",()=>{this.clear()}),this.map.on("dispose",()=>{this.clear()})}typeNoPicked(t){return["1015"].indexOf(t.data.typeID)<0}add(t){this.mapEventHandlers.indexOf(t)<0&&(this.mapEventHandlers.push(t),this.entities.indexOf(t.entity)<0&&("Object3D"!==t.entity.type||"modelID"in t.data||"linewidth"in t.data)&&!1!==t.data.pickabled&&this.typeNoPicked(t)&&this.entities.push(t.entity))}remove(t){this._removeEntity(t.entity),this._removeHandler(t)}_removeHandler(t){var e=this.mapEventHandlers.indexOf(t);-1!==e&&this.mapEventHandlers.splice(e,1)}_removeEntity(t){var e=this.entities.indexOf(t);-1!==e&&this.entities.splice(e,1)}clear(){this.mapEventHandlers.length=0,this.entities.length=0}update(t){this.mapEventHandlers.forEach(e=>{e.visible&&e.update&&e.update(t)})}}class nl extends el{constructor(t,e,i){super(e,i),this.map=t,this.enabled=!0,this.pickIndex=0,this.picked,this.longPressed,this.doubleClick,this.startPick,this.endPick,this.mouseenter,this.mouseleave,t&&i&&t.mapEventHandlerManager.add(this)}get pickabled(){return!!this.data&&(!1!==this.data.pickabled||this.data.pickabled)}set pickabled(t){this.data.pickabled=t}clone(){var t=new this.constructor(this.map,this.data,this.entity);return t.enabled=this.enabled,t.pickabled=this.pickabled,t.draggable=this.draggable,this.parent&&this.parent.add(t),t}setEntity(t){t&&(super.setEntity(t),this.map.mapEventHandlerManager.remove(this),this.map.mapEventHandlerManager.add(this))}dispose(){this.map.mapEventHandlerManager.remove(this),super.dispose()}}class rl{constructor(t){this.map=t,this.scripts=[],this.scriptClasses={},this.offUpdate=this.map.on("update",t=>{this.invokeScripts("update",t)}),this.offSceneLoaded=this.map.on("sceneDataProcessed",t=>{this.createSceneScripts(t)})}clearScripts(){this.scripts.length=0,this.scriptClasses={}}destroy(){this.clearScripts(),this.offUpdate(),this.offSceneLoaded()}createScriptByString(t,e){var i=new Function("map","scene",`${e}\n\nreturn ${t};`)(this.map,this.map.omScene);return this.scriptClasses[t]=i,i}createSceneScripts(t){}addScript(t,e){this.scriptClasses[t]=e}getClassByName(t){return this.scriptClasses[t]}registerScript(t){this.scripts.push(t)}removeScript(t){var e=this.scripts.findIndex(e=>e.name===t);this.scripts.splice(e,1)}invokeScripts(t,...e){var i=this.scripts.length;if(i)for(var n=i-1;n>-1;n--){var r=this.scripts[n];if(r.enabled&&r[t])try{r[t](...e)}catch(t){kh.error(t)}}}}class al extends nl{constructor(t,e,i){super(t,e=e||{children:[]},i=i||new de),!t.config.forceNewID&&this.data.id&&-1!==this.data.id||(this.data.id=kh.generateID().toLowerCase()),this.type="OMNode",this.data.scripts||(this.data.scripts=[]),this.scripts=[],e.scripts.forEach(t=>{this.addScript(t)})}get id(){return this.data.id||-1}get userData(){return this.nodeIndex?this.nodeIndex.userData:this.data.userData}clone(t){var e=this.data.node;delete this.data.node;var i=kh.cloneJSON(this.data);"function"==typeof t?t(i):"object"==typeof t&&Object.assign(i,t),i.id=-1,this.data.node=e;var n=new this.constructor(this.map,i,this.entity);return this.parent&&this.parent.add(n),n}updateTransform(){if(this.data.transform)return this.data.transform.position=this.entity.position.toArray(),this.data.transform.rotation=this.entity.rotation.toArray().slice(0,3),this.data.transform.scale=this.entity.scale.toArray(),this.data.transform}add(){var t=this,e=!1,i=Array.from(arguments);"boolean"==typeof i[i.length-1]&&(e=i.pop()),super.add.apply(this,i),t.parent&&t.parent.data.children&&i.forEach(e=>{kh.findFromArray(t.parent.data.children,"id",e.data.id,function(e,i){t.parent.data.children.splice(i,1)})}),i.forEach(t=>{t instanceof al&&t.updateTransform()}),e&&t.data.children&&i.forEach(e=>{t.data.children.push(e.data)})}remove(t,e){var i=this;if(super.remove.apply(this,Array.from(arguments)),i.data&&i.data.children){var n=Array.from(arguments);"boolean"==typeof n[n.length-1]&&n.pop();for(var r=n.reduce((t,e)=>(void 0!==e.data.id&&t.push(e.data.id),t),[]),a=i.data.children.length-1;a>-1;a--){var o=i.data.children[a];r.includes(o.id)&&i.data.children.splice(a,1)}}}setTransform(t){(t=t||this.data.transform)&&(this.setPosition(t.position),this.setRotation(t.rotation),this.setScale(t.scale))}setPosition(t){t instanceof Lt&&(t=t.toArray()),this.data.transform.position=t,this.entity.position.fromArray(t),this.entity.updateMatrix()}setRotation(t){t instanceof ae&&(t=t.toArray().slice(0,3)),this.data.transform.rotation=t,this.entity.rotation.fromArray(t)}setScale(t){t instanceof Lt&&(t=t.toArray()),this.data.transform.scale=t,this.entity.scale.fromArray(t)}getAncestor(){if(!this.entity)return null;var t={sceneID:"",buildingID:"",floorNumber:0,scene:null,building:null,floor:null};return this.entity.traverseAncestors(e=>{e.node&&("OMFloor"===e.node.type?(t.floor=e.node,t.floorNumber=e.node.data.floorNumber):"OMBuilding"===e.node.type?(t.building=e.node,t.buildingID=e.node.data.buildingID):"OMScene"===e.node.type&&(t.scene=e.node,t.sceneID=e.node.data.sceneID))}),t}addScript(t){"string"==typeof t&&(t={name:t});var e=t.class||this.map.scriptManager.getClassByName(t.name);if(e){var i=new e(t.data);i.name=t.name,i.node=this;var n=this.data.scripts.findIndex(e=>e.name===t.name);if(this.scripts.push(i),n>-1?this.data.scripts[n]=t:this.data.scripts.push(t),this.map.scriptManager.registerScript(i),i.start)try{i.start()}catch(t){kh.warn(t)}}else kh.warn(`script: ${t.name} is not registered!`)}removeScript(t){this.scripts.length,this.map.scriptManager.removeScript(t);var e=this.data.scripts.findIndex(e=>e.name===t);if(e>-1&&this.data.scripts.splice(e,1)[0],(e=this.scripts.findIndex(e=>e.name===t))>-1)var i=this.scripts.splice(e,1)[0];if(i&&i.onDestroyed)try{i.destroy()}catch(t){kh.warn(t)}}removeAllScriptInstance(t){this.scripts.forEach(t=>{t.node=null}),this.scripts.length=0}getScriptByName(t){return this.scripts.find(e=>e.name===t)}invokeScript(t,...e){var i=this.scripts.length;if(i)for(var n=i-1;n>-1;n--){var r=this.scripts[n];if(r&&r.enabled&&r[t])try{r[t](...e)}catch(t){kh.error(`ooomap script: ${r.name}`,t)}}}}class ol extends al{constructor(t,e,i){super(t,e,i),this.lastVisibles={},this.blockMap={}}getData(){this.data.blocks.length=0,this.data.models.length=0,this.data.route&&(this.data.route=null),this.data.markers&&(this.data.markers.length=0);var t=this.getDataClone();return this.markerNode&&(this.data.markers=this.markerNode.children.map(t=>t.getData())),this.modelNode&&(this.data.models=this.modelNode.children.map(t=>t.getData())),this.blockNode&&(this.data.blocks=this.blockNode.children.map(t=>t.getData())),this.route&&(this.data.route=this.route.getData()),this.getRootModelRadius(),t.blocks=this.data.blocks,t.models=this.data.models,this.data.markers&&(t.markers=this.data.markers),this.data.route&&(t.route=this.data.route),t}getBlockByTypeID(t){return this.blockMap[t]}setBlockByTypeID(t,e){this.blockMap[t]=e}hideNodes(){this.modelNode.visible=!1,this.blockNode.visible=!1,this.markerNode&&(this.markerNode.visible=!1)}keywordsFind(t){var{config:t,checkTag:e,checkWords:i}=kh._keywordsFindConfig(t);return this.findData(t=>t.name&&i([t.name])||t.content&&t.content.texts&&i(t.content.texts)||t.tag&&e(t.tag),t)}showNodesAnimate(t,e){var i=this.map.frameRate;this.map.frameRate=this.map.maxFrameRate,this._showAnim&&(this._showAnim.stop(),this._showAnim=null),e=Object.assign({duration:1e3,easing:t?"cubicOut":"cubicIn",animateAlpha:!0,nodes:[this.modelNode,this.blockNode]},e),t?e.nodes.forEach(t=>t.visible=!0):this.markerNode&&(this.markerNode.show=!1);var n=[],r=[];function a(e,i,n,r){e=Math.max(.01,e),i.nodes.forEach(i=>{i.entity.scale.z=t?e:Math.max(1-e,.01)}),i.animateAlpha&&n.forEach((t,i)=>{t.opacity=r[i].start+r[i].cha*e})}e.animateAlpha&&(n=kh.collectMaterials(e.nodes),r=[],n.forEach(e=>{"_originAlpha"in e||(e._originAlpha=e.opacity),r.push({start:e.opacity,cha:(t?e._originAlpha:0)-e.opacity})})),a(0,e,n,r);var o="string"==typeof e.easing?kh.getEasingByName(e.easing):e.easing;this._showAnim=new wh.Tween({x:.01}).to({x:1},e.duration).onUpdate(t=>{a(t,e,n,r)}).onComplete(()=>{e.nodes.forEach(e=>e.visible=t),t&&this.markerNode&&(this.markerNode.show=!0),n.length=r.length=0,this.map.frameRate=i,this._showAnim=null,e.callback&&e.callback()}).easing(o).start()}showNodes(){this.modelNode.visible=!0,this.blockNode.visible=!0,this.markerNode&&(this.markerNode.visible=!0)}getRootModelRadius(){this.modelNode.children.forEach(t=>{var e=kh.getBoundingSphere(t.entity);t.data.radius=e.radius})}forEachNode(t){["modelNode","markerNode","blockNode","routeNode","buildingNode","floorNode"].forEach(e=>{this[e]&&t&&t(this[e])})}onlyShowNode(t){this.showAllNodes(),this.forEachNode(e=>{this.lastVisibles[e.getProp("id")]=e.visible,e.visible=e.name===t})}showAllNodes(){this.forEachNode(t=>{var e=t.getProp("id"),i=!0;i=!(e in this.lastVisibles)||this.lastVisibles[e],t.visible=i,t.treeNode&&(t.treeNode.tail.value=i)})}setPosition(t){t instanceof Lt&&(t=t.toArray()),(this.nodeIndex||this.data).transform.position=t,this.entity.position.fromArray(t),this.entity.updateMatrix()}setRotation(t){t instanceof ae&&(t=t.toArray().slice(0,3)),(this.nodeIndex||this.data).transform.rotation=t,this.entity.rotation.fromArray(t)}setScale(t){t instanceof Lt&&(t=t.toArray()),(this.nodeIndex||this.data).transform.scale=t,this.entity.scale.fromArray(t)}dispose(){if(this.entity){var t=this.entity.parent;t&&t.remove(this.entity)}this.markerNode&&(this.markerNode.children.forEach(t=>{t.dispose()}),this.markerNode.children.length=0),this.modelNode&&(this.modelNode.children.forEach(t=>{t.dispose()}),this.modelNode.children.length=0),this.route&&this.route.dispose(),this.blockNode&&(this.blockNode.children.forEach(t=>{t.dispose()}),this.blockNode.children.length=0),this.buildingNode&&this.buildingNode.dispose(),this.floorNode&&this.floorNode.dispose()}}class sl extends al{constructor(t,e){super(t,e),this.name="markerNode",this.entity.name="markerNodeEntity",this._cleanChildren=!0,this.cleanChildren=void 0===this.data.cleanChildren||this.data.cleanChildren,this._count=0,this.minLevel=10,this.maxLevel=24,this.isBackground=!0,this.background=!0,this.viewChangedFunc=this.childrenVisible.bind(this),this.map.on("viewChanged",this.viewChangedFunc)}get show(){return this._show}set show(t){this.background=!t,this._show=t,this.visible=t}get background(){return this.isBackground}set background(t){!this.isBackground&&t?this.children.forEach(t=>{t.markerHide&&t.markerHide()}):this.isBackground&&!t&&this.children.forEach(t=>{!t.autoHide&&t.markerShow&&t.markerShow()}),this.isBackground=t}get cleanChildren(){return this._cleanChildren}set cleanChildren(t){this._cleanChildren=t,t||this.children.forEach(t=>{t.targetAlpha=1,t.visible=!0})}bind(t){t.markerNode=this,this.target=t,t.data&&(this.data.children=t.data.markers),t.add(this)}childrenVisible(){var t=this.map.view.zoomLevel;if(this.visible=t>=this.minLevel&&t<this.maxLevel,this.background||!this.show||!this.visible)return;let e=!1;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i];if("PlaneMarkerNode"!==r.type)if(r.autoHide){if(t<r.data.minLevel||t>=r.data.maxLevel)r.markerHide();else if(r.updateRect&&r.updateRect(),"SpriteMarkerNode"!==r.type||r.entity.imageLoaded)if(this._cleanChildren){e=!1;for(var a=0,o=i;a<o;a++){var s=this.children[a];s.autoHide&&"planeMarkerNode"!==s.type&&s.visible&&s._markerShow&&!s.hidding&&r.rect.checkOverlay(s.rect)&&(r.priority>s.priority?s.markerHide():(e=!0,r.markerHide()))}e||r.markerShow()}else r.markerShow()}else r.updateRect&&r.updateRect()}}update(t){this.visible&&(this._count+=t,this._count>1&&(this._count=0,this.childrenVisible()))}dispose(){this.map.off("viewChanged",this.viewChangedFunc),super.dispose()}}var hl={id:-1,name:"",type:"cube",visible:!0,transform:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},children:[],materialID:null,color:"#dddddd",alpha:1,minLevel:0,maxLevel:28,userData:{},tag:""},ll=new Ie(1,1,1),cl=new _r(1,1),ul=new wa(.5,.5,1,8),dl=new Sr(1,2),pl=new wa(.5,.5,1,24),fl=new Ma(.5,1,4),ml=new Ma(.5,1,24);[ll,cl,ul,dl,pl,fl,ml].forEach(t=>{t.scale(5,5,5)}),[ll,ul,pl,fl,ml].forEach(t=>{t.rotateX(Math.PI/2),t.translate(0,0,2.5)}),[fl].forEach(t=>{t.rotateZ(Math.PI/4)});class gl extends al{constructor(t,e,i){if("string"==typeof(e=e||"cube")){var n=kh.cloneJSON(hl);n.type=e,e=n}e.name||(e.name=e.type),super(t,e),this.data.node=this,this.type="OMPrimitive",this.options=i,this.setData(),this.pickIndex=3}createEntity(){var t=null,e=new Na({transparent:!0});switch(this.data.type){case"group":t=new de;break;case"cube":t=new Qe(ll,e);break;case"sphere":t=new Qe(dl,e);break;case"lowSphere":t=new Qe(cl,e);break;case"cylinder":t=new Qe(pl,e);break;case"lowCylinder":t=new Qe(ul,e);break;case"pyramid":t=new Qe(fl,e);break;case"cone":t=new Qe(ml,e)}this.setEntity(t)}getData(t){var e=this.getDataClone(),i=e.transform;return i.position=this.entity.position.toArray(),i.rotation=this.entity.rotation.toArray().slice(0,3),i.scale=this.entity.scale.toArray(),this.children.forEach(t=>{t.getData(e.children)}),t&&t.push(e),e}getData2(){var t=this.data.node;delete this.data.node;var e=kh.cloneJSON(this.data),i=e.transform;return t&&(this.data.node=t),i.position=this.entity.position.toArray(),i.rotation=this.entity.rotation.toArray().slice(0,3),i.scale=this.entity.scale.toArray(),e}setData(){if(this.createEntity(),this.setTransform(),this.entity.material&&(this.setColor(this.data.color),this.setAlpha(this.data.alpha)),!this.options||!1!==this.options.createChildren){var t=this.data.children;this.data.children=[],t.forEach(t=>{var e;e=t.modelID?new gl.OMModel(this.map,t):new this.constructor(this.map,t),this.add(e)})}}setColor(t){this.entity.material&&(kh.setMaterialColor(this.entity.material,t),this.data.color=t)}setAlpha(t){this.entity.material&&(this.entity.material.opacity=t,this.data.alpha=t)}}class vl extends Lt{id=null;constructor(t){if(t=t||{},super(),this.id=t.id||kh.generateID(6),this.enabled=!0,this.pointType=t.type||0,this.segments=[],t.connects&&"string"==typeof t.connects)try{t.connects=JSON.parse(t.connects)}catch(t){kh.log("ERROR: RoadPoint connects parseError!")}this.data=t,this.group=t.group,this.connects=t.connects,this.type="roadPoint",t.coord&&this.fromArray(t.coord)}clone(){return new this.constructor({coord:this.toArray(),type:this.pointType,group:this.group,connects:this.connects})}addSegment(t){this.segments.indexOf(t)<0&&this.segments.push(t)}removeSegment(t){var e=this.segments.indexOf(t);e>-1&&this.segments.splice(e,1)}setPointType(t){this.pointType=t,this.helper&&this.helper.setType(this.type)}isSameLiftPoint(t,e=25){return t.pointType===this.pointType&&this.group===t.group&&!(Math.abs(this.x-t.x)>e||Math.abs(this.y-t.y)>e)}checkConnectFloor(t){if(!this.enabled)return!1;if(0===this.pointType)return!1;if(!this.data.connects)return!0;var e=this.data.connects,i=!1;if(e.include&&Array.isArray(e.include)&&e.include.length&&(i=e.include.indexOf(t)>-1),void 0!==e.gte&&(i=t>=e.gte),void 0!==e.lte&&(i=t<=e.lte),void 0!==e.even){var n=t%2==0;i=e.even?n:!n}return e.exclude&&Array.isArray(e.exclude)&&e.exclude.length&&(i=e.exclude.indexOf(t)<0),i}update(){this.segments.forEach(t=>{t.update()})}getData(){return{id:this.id,coord:this.toArray(),type:this.pointType,group:this.group,connects:"string"==typeof this.connects?this.connects:JSON.stringify(this.connects)}}}var yl=new Lt,xl=new Lt,bl=new Lt;class wl{constructor(t){this.indexes=[],this.points=[],this.lineNode=null,this.direction=null,this.directionLine=null}setPoints(t,e){this.points.length=0,this.points.push(t,e),t.addSegment(this),e.addSegment(this),this.update()}getCenter(){if(!(this.points.length<2))return this.points[0].clone().add(this.points[1]).divideScalar(2)}delta(){return bl.subVectors(this.points[1],this.points[0])}closestPointToPointParameter(t,e=!0){yl.subVectors(t,this.points[0]),xl.subVectors(this.points[1],this.points[0]);var i=xl.dot(xl),n=xl.dot(yl)/i;return e&&(n=Mt.clamp(n,0,1)),n}closestPointToPoint(t,e,i=!0){return e=void 0===e?this.closestPointToPointParameter(t,i):e,this.delta(bl).multiplyScalar(e).add(this.points[0])}getLength(){return 2!==this.points.length?-1:+this.points[0].distanceTo(this.points[1]).toFixed(2)}getOtherPoint(t){if(this.points.length>1)return this.points[0].id===t?this.points[1]:this.points[0]}getLoopSegmentsOut(t,e){let i=[];t.points.forEach((t,n)=>{t.segments.length<3&&(i=t.segments.filter(t=>e.indexOf(t)<0),Array.prototype.push.apply(e,i),i.forEach(t=>this.getLoopSegmentsOut(t,e)))})}sortedLoopSegments(t){let e=null;for(var i=0;i<t.length;i++){let n=t[i].points.find(t=>2!==t.segments.length);if(n){e=n;break}}let n=[e],r=[],a=t.slice();for(;a.length;){let t=n[n.length-1],e=a.findIndex(e=>e.points.indexOf(t)>-1),i=a[e];r.push(i),n.push(i.getOtherPoint(t.id)),a.splice(e,1)}let o=r;return o.sortedPoints=n,o}getLoopSegments(t){let e=[];return this.getLoopSegmentsOut(t,e),this.sortedLoopSegments(e)}update(){this.lineNode&&(this.lineNode.points[0].copy(this.points[0]),this.lineNode.points[1].copy(this.points[1]),this.lineNode.build())}remove(){this.points.forEach(t=>{t.removeSegment(this)}),this.directionLine&&this.directionLine.dispose(),this.lineNode.dispose(),this.lineNode=null,this.points.length=0,this.indexes.length=0}getData(){var t={indexes:this.points.map(t=>t.id)};return null!==this.direction&&2!==this.direction&&(t.direction=this.direction),t}}class _l extends nl{constructor(t,e,i){super(t,e,i),this.draggable=kh.getp(this.data,"draggable",!1),this.fixedPixelSize=kh.getp(this.data,"fixedPixelSize",!0),this._offset=new Lt,this._startPicked=!1,this._isDragged=!1,this.pixelSize=kh.getp(this.data,"pixelSize",15),this.focusFactor=1}update(){if(this.fixedPixelSize){var t=kh.getZoomFactor(this.map,this.entity.position);this.entity.scale.setScalar(t*this.pixelSize*this.focusFactor)}}setEntity(t){super.setEntity(t)}startPick(t){this._isDragged=!1,this.draggable&&(this.map.view.controls.enabled=!1,this.map.mouseTrack.startTrack(this))}endPick(t){this.draggable&&(this.map.view.controls.enabled=!0,this.map.mouseTrack.stopTrack(),this._isDragged&&(this.onDraggedComplete&&this.onDraggedComplete(this),this._isDragged=!1))}mousedown(t){this._startPicked=!!t.trackerIntersect,this._startPicked&&(t.event.stopPropagation(),this._offset.copy(this.entity.position.clone().sub(t.point)))}mousemove(t){if(this.draggable&&t.isMouseDown&&this._startPicked){t.event.stopPropagation(),this._isDragged=!0;let e=t.point.clone().add(this._offset),i=e.clone().sub(this.entity.position);this.entity.position.copy(e),this.onDragged&&this.onDragged(this.entity.position,i)}}}_l.defaultData={draggable:!1,fixedPixelSize:!0},Lt.prototype.toArray=function(t,e,i=3){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=+this.x.toFixed(i),t[e+1]=+this.y.toFixed(i),t[e+2]=+this.z.toFixed(i),t};var Ml=function(){Us.call(this),this.type="LineSegmentsGeometry",new Ee,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.addAttribute("position",new Ae([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.addAttribute("uv",new Ae([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))};Ml.prototype=Object.assign(Object.create(Us.prototype),{constructor:Ml,isLineSegmentsGeometry:!0,applyMatrix:function(t){var e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==e&&(t.applyToBufferAttribute(e),t.applyToBufferAttribute(i),e.data.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},setPositions:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var i=new Gs(e,6,1);return this.addAttribute("instanceStart",new Kn(i,3,0)),this.addAttribute("instanceEnd",new Kn(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this.maxInstancedCount=this.attributes.instanceStart.data.count,this},setColors:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var i=new Gs(e,6,1);return this.addAttribute("instanceColorStart",new Kn(i,3,0)),this.addAttribute("instanceColorEnd",new Kn(i,3,3)),this},fromWireframeGeometry:function(t){return this.setPositions(t.attributes.position.array),this},fromEdgesGeometry:function(t){return this.setPositions(t.attributes.position.array),this},fromMesh:function(t){return this.fromWireframeGeometry(new fr(t.geometry)),this},fromLineSegements:function(t){var e=t.geometry;return e.isGeometry?this.setPositions(e.vertices):e.isBufferGeometry&&this.setPositions(e.position.array),this},computeBoundingBox:function(){var t=new Ut;return function(){null===this.boundingBox&&(this.boundingBox=new Ut);var e=this.attributes.instanceStart,i=this.attributes.instanceEnd;void 0!==e&&void 0!==i&&(this.boundingBox.setFromBufferAttribute(e),t.setFromBufferAttribute(i),this.boundingBox.union(t))}}(),computeBoundingSphere:function(){var t=new Lt;return function(){null===this.boundingSphere&&(this.boundingSphere=new Gt),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(void 0!==e&&void 0!==i){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var r=0,a=0,o=e.count;a<o;a++)t.fromBufferAttribute(e,a),r=Math.max(r,n.distanceToSquared(t)),t.fromBufferAttribute(i,a),r=Math.max(r,n.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)}}}(),toJSON:function(){},clone:function(){},copy:function(t){return this}});var Sl=function(){Ml.call(this),this.type="LineGeometry"};Sl.prototype=Object.assign(Object.create(Ml.prototype),{constructor:Sl,isLineGeometry:!0,setPositions:function(t){for(var e=t.length-3,i=new Float32Array(2*e),n=0;n<e;n+=3)i[2*n]=t[n],i[2*n+1]=t[n+1],i[2*n+2]=t[n+2],i[2*n+3]=t[n+3],i[2*n+4]=t[n+4],i[2*n+5]=t[n+5];return Ml.prototype.setPositions.call(this,i),this},setColors:function(t){for(var e=t.length-3,i=new Float32Array(2*e),n=0;n<e;n+=3)i[2*n]=t[n],i[2*n+1]=t[n+1],i[2*n+2]=t[n+2],i[2*n+3]=t[n+3],i[2*n+4]=t[n+4],i[2*n+5]=t[n+5];return Ml.prototype.setColors.call(this,i),this},fromLine:function(t){var e=t.geometry;return e.isGeometry?this.setPositions(e.vertices):e.isBufferGeometry&&this.setPositions(e.position.array),this},copy:function(t){return this}}),te.line_fade={color_a:{value:[0,0,0]},worldUnits:{value:1},linewidth:{value:1},resolution:{value:new St(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},ee["line-fade"]={uniforms:Jt.merge([te.common,te.fog,te.line_fade]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n uniform vec3 color_a;\n \n \n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\n\t\t\tgl_FragColor = vec4(color_a,diffuseColor.b);\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class Al extends Ye{constructor(t){super({type:"LineMaterial",uniforms:Jt.clone(ee["line-fade"].uniforms),vertexShader:ee["line-fade"].vertexShader,fragmentShader:ee["line-fade"].fragmentShader,clipping:!0}),Object.defineProperties(this,{color_a:{enumerable:!0,get:function(){return this.uniforms.color_a.value},set:function(t){this.uniforms.color_a.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},diffuse:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===t?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(t)}}Al.prototype.isLineMaterial=!0,te.line={linewidth:{value:1},resolution:{value:new St(64,64)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},ee.line={uniforms:Jt.merge([te.common,te.fog,te.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <premultiplied_alpha_fragment>\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\n\t\t}\n\t\t"};var Tl=function(t){Ye.call(this,{type:"LineMaterial",uniforms:Jt.clone(ee.line.uniforms),vertexShader:ee.line.vertexShader,fragmentShader:ee.line.fragmentShader}),Object.defineProperties(this,{dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set:function(t){t?this.defines.USE_DASH="":delete this.defines.USE_DASH,this.needsUpdate=!0}},color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)};(Tl.prototype=Object.create(Ye.prototype)).constructor=Tl,Tl.prototype.isLineMaterial=!0,Tl.prototype.copy=function(t){return Ye.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.resolution=t.resolution,this};var Ll=function(t,e){Qe.call(this),this.type="LineSegments2",this.geometry=void 0!==t?t:new Ml,this.material=void 0!==e?e:new Al({color:16777215*Math.random()}),this.raycast_to_segment=!0};Ll.prototype=Object.assign(Object.create(Qe.prototype),{constructor:Ll,isLineSegments2:!0,computeLineDistances:function(){var t=new Lt,e=new Lt;return function(){for(var i=this.geometry,n=i.attributes.instanceStart,r=i.attributes.instanceEnd,a=new Float32Array(2*n.data.count),o=0,s=0,h=n.data.count;o<h;o++,s+=2)t.fromBufferAttribute(n,o),e.fromBufferAttribute(r,o),a[s]=0===s?0:a[s-1],a[s+1]=a[s]+t.distanceTo(e);var l=new Gs(a,2,1);return i.addAttribute("instanceDistanceStart",new Kn(l,1,0)),i.addAttribute("instanceDistanceEnd",new Kn(l,1,1)),this}}(),copy:function(t){return this},raycast:function(){var t=new At,e=new Ze,i=new Gt;return function(n,r){var a=n.linePrecision,o=this.geometry,s=this.matrixWorld;if(null===o.boundingSphere&&o.computeBoundingSphere(),i.copy(o.boundingSphere),i.applyMatrix4(s),i.radius+=a,!1!==n.ray.intersectsSphere(i)){t.getInverse(s),e.copy(n.ray).applyMatrix4(t);var h=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,c=new Lt,u=new Lt,d=new Lt,p=new Lt;this&&this.isLineSegments;for(var f=o.attributes.instanceStart,m=o.attributes.instanceEnd,g=0;g<f.count;g++)if(c.fromArray(f.data.array,g*f.data.stride+f.offset),u.fromArray(m.data.array,g*m.data.stride+m.offset),!(e.distanceSqToSegment(c,u,p,d)>l)){p.applyMatrix4(this.matrixWorld);var v=n.ray.origin.distanceTo(p);if(!(v<n.near||v>n.far||(r.push({distance:v,point:d.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}),this.raycast_to_segment)))return}}}}()});var Cl=function(t,e){Ll.call(this),this.type="Line2",this.geometry=void 0!==t?t:new Sl,this.material=void 0!==e?e:new Tl({color:16777215*Math.random()})};Cl.prototype=Object.assign(Object.create(Ll.prototype),{constructor:Cl,isLine2:!0,copy:function(t){return this}});class Pl extends _l{constructor(t,e){super(t,e),this.data=this.data||{},this.highlightColor=this.data.highlightColor||16777215,this.normalColor=this.data.color||this.data.normalColor||16435041,this.type="ELineNode",this.class="ELineNode",this.points=[],this.allPoints=[],this.segments=this.data.segments||8,this.pickIndex=1,this.isStraight=this.data.isStraight,this.isClosed=this.data.isClosed,this.isSelected=!1,this.fixedPixelSize=!1,this._color=new Qt(this.normalColor);var i=new Sl,n=new Al({color_a:this._color.toArray(),linewidth:this.data.linewidth||4,transparent:!0}),r=new Cl(i,n);this.setEntity(r),n.dashed=this.data.dashed,n.gapSize=this.data.gapSize,this.offResize=this.map.on("resize",(t,e)=>{n.resolution.set(t,e)}),n.resolution.set(this.map.view.width,this.map.view.height),this.buildFunc=this.build.bind(this),this.data.points&&this.data.points.length&&this.addPoint(this.data.points)}get color(){return this._color}set color(t){t.isColor?this._color.copy(t):this._color.set(t),this.entity.material.color_a?this.entity.material.color_a=this._color.toArray():this.entity.material.color=this._color}doubleClick(t,e){this.noPicked||Pl.doubleClick&&Pl.doubleClick(this,e)}checkBeizer(t,e){var i=0;return"bezier"===t.type&&(i=1),"bezier"===e.type&&(i=i?3:2),i}getSegmentCurvePoints(t,e,i){var n;return n=1===i||3===i?t.outPoint:t.clone(),new So(t,n,2===i||3===i?e.inPoint:e.clone(),e).getPoints(this.segments)}getPoints(){if(!(this.points.length<2)){for(var t=[],e=1,i=this.points.length;e<i;e++){var n=this.points[e-1],r=this.points[e];n.index=e-1;var a=this.checkBeizer(n,r);if(!a||this.isStraight)t.push(n);else{var o=this.getSegmentCurvePoints(n,r,a);o.length--,[].push.apply(t,o)}}return t.push(this.points[i-1]),this.isClosed&&t.push(this.points[0]),this.allPoints=t,t}}addPoint(t){var e=this;(Array.isArray(t)?t:Array.from(arguments)).forEach(t=>{t.index=e.points.length,e.points.push(t)}),e.data.maxPoints&&e.points.length>e.data.maxPoints&&(e.points=e.points.slice(e.points.length-e.data.maxPoints)),e.build()}getCenter(){var t=new Lt;return this.points.forEach(e=>{t.add(e.clone())}),t.divideScalar(this.points.length)}setPivot(t){var e=t;if(!e){var i=this.getCenter();e=i.clone().negate()}this.entity.geometry.applyMatrix((new At).makeTranslation(e.x,e.y,e.z)),this.entity.position.copy(i)}insertPoint(t,e){}deletePoint(t){}updatePointPostion(t,e,i){var n=this.points[t];n[t].x=e,n[t].y=i,n.inPoint&&(n.inPoint.x=e,n.inPoint.y=i),n.outPoint&&(n.outPoint.x=e,n.outPoint.y=i),this.build()}updateGeometry(t){if(t&&!(t.length<2)){var e=new Float32Array(3*t.length);t.forEach((t,i)=>{var n=3*i;e[n]=t.x,e[n+1]=t.y,e[n+2]=t.z}),this.entity.geometry.setPositions(e),this.entity.computeLineDistances(),this.entity.scale.setScalar(1),this.entity.geometry.computeBoundingSphere()}}build(){var t=this.getPoints();this.updateGeometry(t)}dispose(){super.dispose(),this.offResize(),this.allPoints.length=0,this.points.length=0}hideHelpers(t){(t||this).points.forEach(t=>{t.helper&&t.helper.unBind(),t.inPoint&&t.inPoint.helper&&t.inPoint.helper.unBind(),t.outPoint&&t.outPoint.helper&&t.outPoint.helper.unBind()})}showHelpers(t){(t||this).points.forEach(t=>{t.helper||this.map.ehp.getHelper().bind(t),t.inPoint&&!t.inPoint.helper&&this.map.ehp.getHelper().bind(t.inPoint),t.outPoint&&!t.outPoint.helper&&this.map.ehp.getHelper().bind(t.outPoint)})}select(t){(t=void 0===t||t)?(this._lastColorArray||(this._lastColorArray=this.entity.material.color_a.slice()),this.entity.material.color_a=new Qt(this.highlightColor).toArray()):this.entity.material.color_a=this._lastColorArray||new Qt(this.normalColor).toArray(),this.isSelected=t,this.dragable=t}unSelect(){this.entity&&(this.entity.material.color_a=this._lastColorArray||new Qt(this.normalColor).toArray(),this._lastColorArray=null,this.isSelected=!1,this.dragable=!1)}}class El extends ge{constructor(t){super();var e=this;e.path=null,e.radius=1,e.segments=4,e.segLens=[],Object.assign(e,t),e.path||(e.path=[new Lt(-10,-10,0),new Lt(0,-5,0),new Lt(10,-10,0),new Lt(10,-30,0),new Lt(-10,-30,0)],e.path=kh.buildCurvePoints(e.path)),e.path=e.path.slice(),e.yScale=e.yScale||1,e.up||(e.up=new Lt(0,0,1)),e._uvs=[],e._rings=[],e.breakIndexes=[],Dl(e)}setRadius(t){for(var e,i,n=this,r=0,a=n._rings,o=1,s=0;s<a.length;s++){var h=a[s],l=n.path[s];if(l)for(var c=0;c<h.length;c++){var u=h[c];0==c&&1!=n.yScale&&(e=h[0].clone().sub(l).length()/n.yScale),i=u.clone().sub(l),1!=n.yScale&&(o=i.length()/e);var d=l.clone().add(i.normalize().multiplyScalar(t*o));n.vertices[r].copy(d),r++}}t<.1&&(t=.1),n.radius=t,n.verticesNeedUpdate=!0}getPointByLength(t){for(var e,i=this,n=0,r=0,a=1;a<i.path.length;a++){if(e=i.path[a].clone().sub(i.path[a-1]).normalize(),(n+=i.segLens[a-1])>=t)return{point:i.path[a-1].clone().add(e.clone().multiplyScalar(t-r)).add(i.center),direction:e,index:a-1};r=n}return{point:i.path[i.path.length-1].clone().add(i.center),direction:e,index:i.path.length-1}}}var Dl=function(t){!t.path||t.path.length<2||(function(t,e){if(e.length<2)return;let i,n=null,r=null,a=null;for(var o=0;o<e.length-1;o++){a=e[o],r=e[o+1];let t=r.clone().sub(a).normalize();n?(i=t.dot(n),i<-.5&&(e.splice(o,0,a.clone()),n=null)):n=t}}(0,t.path),function(t){for(var e,i,n,r,a,o=[],s=2*Math.PI/t.segments,h=-Math.PI/2,l=0;l<t.segments;l++){var c=new Lt(0,t.radius*t.yScale*Math.sin(s*l+h),t.radius*Math.cos(s*l+h));o.push(c),0==l&&(e=c)}o.push(e);var u,d,p=t.path.length,f=function(t){for(var e=0,i=t[0].clone(),n=[],r=1;r<t.length;r++){var a=t[r].distanceTo(t[r-1]);e+=a,n.push(a),i.add(t[r])}return{length:e,segLens:n,center:i.divideScalar(t.length)}}(t.path);t.length=f.length,t.segLens=f.segLens,t.center=f.center,t.notCenter||(u=t.path,d=t.center,u.forEach(function(t){t.sub(d)})),t.perimeter=2*Math.PI*t.radius;var m,g=0,v=0,y=t.perimeter/t.segments;for(t._uvs=[],t.breakIndexes=[],Il=t.up.clone(),t._up_=null,l=0;l<p;l++){i=0==l?null:t.path[l-1],r=l==p-1?null:t.path[l+1],a=Ol(i,n=t.path[l],r),t._up_||(t._up_=new Lt(0,1,0).applyMatrix4(a).normalize()),l>0&&(g+=n.distanceTo(i)),v=0,t._rings[l]=[],n.clone().y=0;for(var x=0,b=0;b<o.length;b++)m=o[b].clone().applyMatrix4(a),t.vertices.push(m),t._rings[l].push(m.clone()),t._uvs.push(new St((g+x)/t.length,1-v/t.perimeter)),v+=y}}(t),function(t){for(var e,i=t.path.length,n=t.segments+1,r=0;r<i-1;r++){e=r*n;for(var a=0;a<n-1;a++)t.faces.push(new re(e+a+1,e+a,e+n+a)),t.faces.push(new re(e+a+1,e+a+n,e+n+a+1))}}(t),function(t){for(var e=t.faces.length,i=0;i<e;i++){var n=t.faces[i];t.faceVertexUvs[0].push([t._uvs[n.a],t._uvs[n.b],t._uvs[n.c]])}t.uvsNeedUpdate=!0}(t),t.computeFaceNormals())},Il=null;function Ol(t,e,i){var n,r=t&&t.clone(),a=e.clone(),o=i&&i.clone(),s=1,h=null;if(t)if(i){var l=a.clone().sub(r).normalize(),c=o.sub(a).normalize();h=l.angleTo(c)/2,l.length()<.001?n=c:c.length()<.001?n=l:(s=1/Math.cos(h),s=Mt.clamp(s,1,2),n=l.add(c).normalize())}else n=a.sub(r).normalize();else n=o.sub(a).normalize();var u=Il.clone(),d=(new Lt).crossVectors(n,u).normalize(),p=(new Lt).crossVectors(d,n).normalize();d.multiplyScalar(s);var f=(new At).makeBasis(n,p,d).setPosition(e);return f.isBackAngle=!1,f.angle=h,f.vz=d,f}class Nl{constructor(t){this.config={type:"normal",width:128,height:128,color:"#33cc61",dashArray:[2,1],arrowHeightPercent:.4,arrowWidthPercent:.7,arrowPercent:.2,naviHeightPercent:.5,naviEdgePercent:.2,naviArrowPercent:.3,naviEdgeColor:"#4a82d2",naviArrowColor:"#F4FEFB",naviArrowXScale:.6,naviArrowWidthPercent:.07},Object.assign(this.config,t),this.ctx=null,void 0!==document&&(this.ctx=document.createElement("canvas").getContext("2d")),this.update()}get canvas(){return this.ctx.canvas}get texture(){var t=new Nt,e=document.createElement("img");return e.src=this.ctx.canvas.toDataURL("image/png"),e.onload=function(){t.image=e,t.needsUpdate=!0,e.onload=null},t}update(t){var e=this;switch(Object.assign(e.config,t),e._doColor(),e.ctx.canvas.width=e.config.width,e.ctx.canvas.height=e.config.height,e.config.type){case"normal":e._drawNormal();break;case"arrow":e._drawArrow();break;case"naviArrow":e._drawGodArrow()}}_doColor(){var t=this.config;["color","naviEdgeColor","naviArrowColor"].forEach(function(e){"number"==typeof t[e]&&(t[e]=kh.colorToStr(t[e]))})}_drawNormal(){var t=this,e=t.config,i=e.dashArray.reduce(function(t,e){return t+e}),n=0;e.dashArray.forEach(function(r,a){a%2==0&&(t.ctx.fillStyle=e.color,t.ctx.fillRect(n/i*e.width,0,r/i*e.width,e.height)),n+=r})}_drawArrow(){var t=this,e=t.config,i=(1-e.arrowHeightPercent)*e.height/2,n=e.height*e.arrowHeightPercent;t.ctx.beginPath(),t.ctx.moveTo(0,i);var r=e.width*(e.arrowWidthPercent-e.arrowPercent);t.ctx.lineTo(r,i),t.ctx.lineTo(e.width*e.arrowWidthPercent,i+n/2),t.ctx.lineTo(r,i+n),t.ctx.lineTo(0,i+n),t.ctx.lineTo(e.width*e.arrowPercent,i+n/2),t.ctx.closePath(),t.ctx.fillStyle=e.color,t.ctx.fill()}_drawGodArrow(){var t=this,e=t.config;t.ctx.fillStyle=e.naviEdgeColor,t.ctx.fillRect(0,(1-e.naviHeightPercent)*e.height/2,e.width,e.naviHeightPercent*e.height),t.ctx.fillStyle=e.color;var i=(1-e.naviHeightPercent+e.naviEdgePercent)*e.height/2,n=(e.naviHeightPercent-e.naviEdgePercent)*e.height;t.ctx.fillRect(0,i,e.width,n),t.ctx.fillStyle="#ffffff",t.ctx.shadowOffsetX=-2,t.ctx.shadowOffsetY=2,t.ctx.shadowBlur=4,t.ctx.shadowColor="rgba(0,0,0,0.5)";var r=e.width/2,a=e.height/2,o=e.width*e.naviArrowPercent,s=e.width*e.naviArrowWidthPercent,h=e.width*(e.naviArrowPercent-e.naviArrowWidthPercent)*e.naviArrowXScale,l=r-o/2*e.naviArrowXScale,c=a-o/2;t.ctx.beginPath(),t.ctx.moveTo(l,c),t.ctx.lineTo(l+s,c),t.ctx.lineTo(l+s+h,c+o/2),t.ctx.lineTo(l+s,c+o),t.ctx.lineTo(l,c+o),t.ctx.lineTo(l+h,c+o/2),t.ctx.closePath(),t.ctx.fillStyle=e.naviArrowColor,t.ctx.fill()}}te.naviline={passRatio:{value:0},repeat:{value:new St(1,1)},offset:{value:new St(0,0)}},ee.naviline={uniforms:Jt.merge([te.common,te.fog,te.naviline]),vertexShader:"\n #include <common>\n #include <uv_pars_vertex>\n #include <uv2_pars_vertex>\n #include <envmap_pars_vertex>\n #include <color_pars_vertex>\n #include <fog_pars_vertex>\n #include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n void main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n }\n ",fragmentShader:"\n uniform vec3 diffuse;\n uniform float opacity;\n uniform vec2 repeat;\n uniform vec2 offset;\n uniform float passRatio;\n #ifndef FLAT_SHADED\n varying vec3 vNormal;\n #endif\n #include <common>\n #include <color_pars_fragment>\n #include <uv_pars_fragment>\n #include <uv2_pars_fragment>\n #include <map_pars_fragment>\n #include <alphamap_pars_fragment>\n #include <aomap_pars_fragment>\n #include <lightmap_pars_fragment>\n #include <envmap_pars_fragment>\n #include <fog_pars_fragment>\n #include <specularmap_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n void main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n // #include <map_fragment>\n #ifdef USE_MAP\n // support repeat and offset\n vec2 uv = fract(repeat * vUv + offset);\n vec4 texelColor = texture2D( map, uv );\n // 走过的路段变灰\n if (vUv.x < passRatio) {\n float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114));\n texelColor.xyz = vec3(gray);\n }\n \n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n #endif\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n }\n "};class kl extends Ye{constructor(t={}){super({type:"NaviLineMaterial",uniforms:Jt.clone(ee.naviline.uniforms),vertexShader:ee.naviline.vertexShader,fragmentShader:ee.naviline.fragmentShader,clipping:!0}),this.transparent=t.transparent}get color(){return this.uniforms.color.value}set color(t){t instanceof Qt||(t=new Qt(t)),this.uniforms.color.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get passRatio(){return this.uniforms.passRatio.value}set passRatio(t){this.uniforms.passRatio.value=t}get repeat(){return this.uniforms.repeat.value}set repeat(t){this.uniforms.repeat.value=t}get offset(){return this.uniforms.offset.value}set offset(t){this.uniforms.offset.value=t}}class zl extends al{constructor(t,e){"arrow"!==(e=Object.assign({radius:.01},e)).type&&"naviArrow"!==e.type||!(void 0===e.yScale||e.yScale>.5)||(e.yScale=.2);var i=new El(e),n=new kl({color:16777215,transparent:!0}),r=new Qe(i,n);r.position.copy(i.center),super(t,e,r),this.type="LineNode",this.isNaviLineMaterial=n instanceof kl,this.patternLength=this.data.patternLength||32,this.lineWidth=this.data.lineWidth||10,this.lineTexture=new Nl(e),n.map=this.lineTexture.texture,n.map.minFilter=n.map.magFilter=j,n.map.wrapS=n.map.wrapT=F,n.needsUpdate=!0,this._z=0}clone(){return new this.constructor(this.map,this.data)}get animateSpeed(){return this.data.animateSpeed}set animateSpeed(t){this.data.animateSpeed=t}get color(){return lineTexture.config.color}set color(t){this.updateTexture({color:t})}get dashArray(){return this.lineTexture.config.dashArray}set dashArray(t){this.updateTexture({dashArray:t})}get lineType(){return this.lineTexture.config.type}set lineType(t){this.updateTexture({type:t})}updateTexture(t){this.lineTexture.update(t),this.entity.material.map.needsUpdate=!0}updateFactorZ(){let t=new Lt;return this.entity.getWorldPosition(t),this._z=t.z,this._z}update(t){this.map.view.controls.target.clone().z=this._z;var e=kh.getZoomFactor(this.map);this.entity.geometry.setRadius(this.lineWidth*e/2);var i=this.entity.material.map;let n=this.entity.geometry.length/this.patternLength/e;if(this.isNaviLineMaterial?this.entity.material.repeat.x=n:i.repeat.x=n,this.data.animateSpeed){let e=i.offset;this.isNaviLineMaterial&&(e=this.entity.material.offset),e.x-=this.data.animateSpeed*t,e.x>1?e.x=0:e.x<0&&(e.x=1)}this.data.update&&this.data.update.call(this,t)}setRadius(t){this.entity.geometry.setRadius(t)}get length(){return this.entity.geometry.length}getPointByLength(t){return this.entity.geometry.getPointByLength(t)}getPointByRate(t){return t=Math.min(Math.max(t,0),1),this.getPointByLength(this.length*t)}}var Rl={id:"",coord:[0,0,0],major:"",minor:"",scale:1,buildingID:"",floorNumber:0,tag:""};class Bl extends Lt{constructor(t){t=Object.assign({},Rl,t),super(),this.id=t.id=t.id||kh.generateID(6),this.data=t,this.data.node=this,this.type="beaconPoint",t.coord&&this.fromArray(t.coord)}newID(t){return this.id=this.data.id=t||kh.generateID(6),this}clone(t){var e=new this.constructor(this.getData());return e.id=kh.generateID(6),e}update(){this.data.coord=this.toArray()}getData(){var t=this.data.node;delete this.data.node;var e=kh.cloneJSON(this.data),i=Object.assign({},e,{id:this.id,coord:this.toArray()});return t&&(this.data.node=t),i}}var Fl=function(){var t=function(t){var e,i=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.push(e);return i},e=function(t,e){return parseFloat(t)-parseFloat(e)},i=function(i,n,r,a){var o,s={},h={0:[n]},l={},c=function(t,e){var i=""+t;h[i]||(h[i]=[]),h[i].push(e)};for(s[n]=0;h&&(o=t(h)).length;){o.sort(e);var u=o[0],d=h[u],p=d.shift(),f=parseFloat(u),m=i[p]||{};for(var g in d.length||delete h[u],m)if(Object.prototype.hasOwnProperty.call(m,g)){var v=m[g]+f,y=s[g];(void 0===y||y>v)&&(s[g]=v,c(v,g),l[g]=p)}}return void 0===s[r]?null:l},n=function(t,e){for(var i=[],n=e;void 0!==n;)i.push(n),n=t[n];return i.reverse(),i},r=function(t,e){for(var r,a,o,s=e.shift(),h=[];e.length;){if(r=e.shift(),!(a=i(t,s,r)))return null;if(o=n(a,r),!e.length)return h.concat(o);h.push.apply(h,o.slice(0,-1)),s=r}},a=function(t,e){try{return Array.prototype.slice.call(t,e)}catch(a){for(var i=[],n=e||0,r=t.length;n<r;++n)i.push(t[n]);return i}},o=function(t){this.map=t};return o.prototype.findShortestPath=function(t,e){return"[object Array]"===Object.prototype.toString.call(t)?r(this.map,t):r(this.map,2===arguments.length?[t,e]:a(arguments))},o.findShortestPath=function(t,e,i){return"[object Array]"===Object.prototype.toString.call(e)?r(t,e):r(t,3===arguments.length?[e,i]:a(arguments,1))},o}();class Ul extends al{static filterClosestLifts=null;constructor(t,e,i){super(t,e,new de),this.data.node=this,this.points=[],this.segments=[],this.pointsMap={},this.graph={},this.beacons=[],this.lineNodes=[],this.lineStyle=null,this.type="Route",e&&this.createByData(e,i)}removePoints(t){var e=[];return t.forEach(t=>{t.helper&&t.helper.unBind(),t.segments.forEach(t=>{e.indexOf(t)<0&&e.push(t)})}),this.removeSegments(e)}deletePoints(t){var e=[];return t.forEach(t=>{t.helper&&t.helper.unBind(),e.push(t.getData()),delete this.pointsMap[t.id]}),kh.removeFromArray(this.points,t),e}removeSegments(t){var e,i=[],n=[],r=[];return t.forEach(t=>{t.points.forEach(t=>{i.indexOf(t)<0&&i.push(t)}),r.push(t.getData()),t.remove()}),kh.removeFromArray(this.segments,t),i.forEach(t=>{t.segments.length||n.push(t)}),n.length&&(e=this.deletePoints(n)),{points:e||[],segments:r||[]}}getData(){var t=this.parent;return{points:this.points.map(t=>t.getData()),segments:this.segments.map(t=>t.getData()),graph:JSON.stringify(this.graph),beacons:this.beacons.map(e=>{var i=e.getData();return t&&(i.buildingID||"OMBuilding"===t.type&&(i.buildingID=t.data.buildingID)),i})}}getPointsByPath(t){var e=t.map(t=>{let e=this.pointsMap[t];if(e)return e.clone()});return e}clearLines(){this.lineNodes.forEach(t=>{t.dispose()}),this.lineNodes.length=0}createLineNodeByPath(t,e=!0){if(!(t.length<2)){this.clearLines();var i=this.getPointsByPath(t);return i=kh.buildCurvePoints(i),this.createLineNodeByPoints(i)}}createLineNodeByPoints(t,e){if(!(t.length<2)){Array.isArray(t[0])&&(t=t.map(t=>(new Lt).fromArray(t)));var i=new zl(this.map,Object.assign({path:t,type:"naviArrow",color:"#6396FF",animateSpeed:.5},Ul.lineStyle,this.lineStyle,e));return this.entity.add(i.entity),this.lineNodes.push(i),i}}findPathRoadPointIDArrSync(){var t=Array.from(arguments);if(!(t.length<2))return Fl.findShortestPath(this.graph,t)}findPathRoadPointIDArrAsync(){var t=Array.from(arguments),prom=new Nh;t.length<2&&prom.resolve([]);var e=Fl.findShortestPath(this.graph,t);return prom.resolve(e),prom}getClosestRoadPointID(t){return t.endpoint?t.endpoint.id:t.segment.points[0].id}_checkStartEndIDs(t,e){var i=!1,n=!1,r=0;t.segment&&r++,e.segment&&r++;var a=[];if(2===r)t.segment!=e.segment?(a.push(this.getClosestRoadPointID(t)),a.push(this.getClosestRoadPointID(e))):(a.push(t.segment.points[0].id,t.segment.points[1].id),i=n=!0);else if(1===r){var o=!1,s=t.segment?(o=!0,t.segment):e.segment;a.push(o?e.endpoint.id:t.endpoint.id);var h=this.getClosestRoadPointID(o?t:e);h==a[0]&&(h=s.getOtherPoint(h).id),o?a.unshift(h):a.push(h)}else t.endpoint!=e.endpoint&&a.push(t.endpoint.id,e.endpoint.id);return{qiatou:i,quwei:n,ids:a}}calcMiddleRoadPointsAsync(t,e){var i=this._checkStartEndIDs(t,e),n=i.qiatou,r=i.quwei,a=i.ids;return(a.length?this.findPathRoadPointIDArrAsync.apply(this,a):Nh.empty()).then(i=>{if(i)return t.endpoint||i[1]===t.segment.points[1].id&&(n=!0),e.endpoint||i[i.length-2]===e.segment.points[1].id&&(r=!0),n&&i.shift(),r&&i.pop(),i})}calcMiddleRoadPointsSync(t,e){var i=this._checkStartEndIDs(t,e),n=i.qiatou,r=i.quwei,a=i.ids;if(a.length){if(!(a=this.findPathRoadPointIDArrSync.apply(this,a)))return;return t.endpoint||a[1]===t.segment.points[1].id&&(n=!0),e.endpoint||a[a.length-2]===e.segment.points[1].id&&(r=!0),n&&a.shift(),r&&a.pop(),a}}getVectors(t,e,i){if(t&&0===t.length)return[e.pedal,i.pedal];var n=this.getPointsByPath(t);return e.endpoint||n.unshift(e.pedal),e.distance>1&&n.unshift(e.point),(!i.endpoint||n.length<2)&&n.push(i.pedal),i.distance>1&&n.push(i.point),n}toPoint(t){return"roadPoint"===t.type||t.isVector3?t:Array.isArray(t)?(new Lt).fromArray(t):"object"==typeof t?(new Lt).copy(t):t}findPathAsync(){var t=Array.from(arguments);if(Array.isArray(t[0])&&"number"!=typeof t[0][0]&&(t=t[0]),!(t.length<2)){var e=t[t.length-1],i={clearLines:!0,createLines:!0,offsetHeight:.2};Array.isArray(e)||"x"in e||Object.assign(i,t.pop());var n=[];t.forEach((e,i)=>{Array.isArray(e)?t[i]=e=(new Lt).fromArray(e):"object"!=typeof e||e.isVector3||"roadPoint"===e.type||(t[i]=e=(new Lt).copy(e)),"string"==typeof e?n.push({endpoint:this.pointsMap[e]}):e&&"clone"in e&&n.push(this.findClosestSegment(e.clone()))});var r=[],a=[],o=[],s=[];i.clearLines&&this.clearLines();for(var h=this,l=0;l<n.length-1;l++)(function(t,e){var prom=h.calcMiddleRoadPointsAsync(t,e);prom.then(n=>{if(n){var r=h.getVectors(n,t,e);if(o.push(r),s.push(n),i.createLines){var l=h.createLineNodeByPoints(kh.buildCurvePoints(r.slice()));i.offsetHeight&&l&&(l.position.z+=i.offsetHeight),l&&a.push(l)}}}),r.push(prom)})(n[l],n[l+1]);return Nh.all(r).then(()=>({lines:a,vectors:o,ids:s,floorNumber:h.parent.data.floorNumber,floorName:h.parent.data.floorName}))}}findPathSync(){var t=Array.from(arguments);if(Array.isArray(t[0])&&"number"!=typeof t[0][0]&&(t=t[0]),!(t.length<2)){var e=t[t.length-1],i={clearLines:!0,createLines:!0,offsetHeight:.2};Array.isArray(e)||"x"in e||Object.assign(i,t.pop());var n=[];t.forEach((e,i)=>{Array.isArray(e)?t[i]=e=(new Lt).fromArray(e):"object"!=typeof e||e.isVector3||"roadPoint"===e.type||(t[i]=e=(new Lt).copy(e)),"string"==typeof e?n.push({endpoint:this.pointsMap[e]}):e&&"clone"in e&&n.push(this.findClosestSegment(e.clone()))});var r=[],a=[],o=[];i.clearLines&&this.clearLines();for(var s=this,h=0;h<n.length-1;h++)(function(t,e){let n=s.calcMiddleRoadPointsSync(t,e);if(n){var h=s.getVectors(n,t,e);if(a.push(h),o.push(n),i.createLines){var l=s.createLineNodeByPoints(kh.buildCurvePoints(h.slice()));i.offsetHeight&&l&&(l.position.z+=i.offsetHeight),l&&r.push(l)}}})(n[h],n[h+1]);return{lines:r,vectors:a,ids:o,floorNumber:s.parent.data.floorNumber,floorName:s.parent.data.floorName}}}findLiftPair(t,e,i,n){n=n||{};let r=t.point,a=e.point,o=this.findClosestLifts(r,i.floorNumber,n);var s=i.route.points.filter(t=>t.pointType>0&&t.pointType<4);let h,l;for(var c=0;c<o.length;c++)if(h=o[c].point,this.findPathSync(r,h,{clearLines:!1,createLines:!1}).vectors.length){if(h.group){let t=h.group;if(l=s.find(e=>e.group===t),i.route.findPathSync(l,a,{clearLines:!1,createLines:!1}).vectors.length)return{fromLiftPoint:h,toLiftPoint:l};continue}{let t=i.route.findClosestLifts(h);if(!t||!t.length)continue;if(l=t[0].point,i.route.findPathSync(l,a,{clearLines:!1,createLines:!1}).vectors.length&&h.isSameLiftPoint(l))return{fromLiftPoint:h,toLiftPoint:l};continue}}}findClosestLifts(t,e,i){let n=t.pointType>0&&t.pointType<4;t=this.toPoint(t),i=Object.assign({count:10},i),"object"==typeof arguments[1]&&(i=e,e=null);let r=this.points.filter(t=>t.pointType>0&&t.pointType<4);n&&(r=this.points.filter(e=>e.pointType===t.pointType));for(var a=[],o=0;o<r.length;o++){let c=r[o];if(!1!==c.enabled){var s=!0;if(null!=e&&(s=c.checkConnectFloor(e)),s){if(n&&t.isSameLiftPoint(c,this.map.config.liftDistance))return[{point:c,dist2:0}];var h=Number.MAX_SAFE_INTEGER;if(t.group&&c.group&&t.group===c.group)return[{point:c,dis2:0}];h=t.distanceToSquared(c);var l=1;1===c.pointType?l=i.lt||1:2===c.pointType?l=i.zt||1:3===c.pointType&&(l=i.ft||1),h*=1/l,a.push({point:c,dis2:h})}}}return a.sort((t,e)=>t.dis2-e.dis2),Ul.filterClosestLifts?Ul.filterClosestLifts(this,t,a):a.slice(0,i.count)}static tryConnect(t,e,i){let n=t.findPathSync(e,i,{clearLines:!1,createLines:!1}),r={connection:!0,dis2:-1};return n.vectors.length?r.dis2=n.vectors.reduce((t,e)=>t+e.reduce((t,e,i,n)=>0===i?0:t+n[i-1].distanceToSquared(e),0),0):r.connection=!1,r}findClosestSegment(t){Array.isArray(t)&&(t=(new Lt).fromArray(t));var e,i,n=null,r=[];t instanceof Lt&&t instanceof vl||void 0===(t=(new Lt).copy(t)).z&&(t.z=0);var a,o,s,h=Number.MAX_VALUE;return this.segments.forEach(l=>{o=l.closestPointToPointParameter(t),i=l.closestPointToPoint(t,o),(a=i.distanceToSquared(t))<h&&(s=0===o||1===o?l.points[o]:null,h=a,n=l,r.unshift(l),e=i.clone())}),{point:t,pedal:e,segment:n,closestArray:r,distance:Math.sqrt(h),endpoint:s}}snapToRoute(t){var e=this.findClosestSegment(t);return{point:e.endpoint||e.pedal,distance:e.distance,segment:e.segment}}createPointByData(t){var e=new vl(t);return this.points.push(e),this.pointsMap[e.id]=e,e}createSegmentByData(t){var e,i=t.indexes,n=this.pointsMap[i[0]],r=this.pointsMap[i[1]];return n&&r&&(e=this.createRoadSegment(n,r,t.direction),this.segments.push(e)),e}createByData(t){if(this.map.emit("routeData",t),this.clear(),t.points&&t.points.forEach(t=>{this.createPointByData(t)}),"string"==typeof t.graph)try{this.graph=JSON.parse(t.graph)}catch(t){}else this.graph=t.graph;t.segments&&t.segments.forEach(t=>{this.createSegmentByData(t)}),t.beacons&&this.createBeacons(t.beacons)}createBeacons(t){t=t||this.data.beacons;var e=[];return t.forEach(t=>{var i=new Bl(t);this.map.config.forceNewID&&i.newID(),this.beacons.push(i),e.push(i)}),e}createRoadSegment(t,e,i){var n=new wl;return n.direction=i,n.setPoints(t,e),n}createRoadSegmentByData(t){this.pointsMap[t.indexes[0]],this.pointsMap[t.indexes[1]]}registerToGraph(t,e,i){this.graph[t]||(this.graph[t]={}),this.graph[e]||(this.graph[e]={});var n=this.graph[t][e];if(void 0===n&&(n=this.graph[e][t]),void 0===n&&(n=i.getLength()),void 0===i.direction||null===i.direction||2===i.direction)this.graph[t][e]=this.graph[e][t]=n;else{let r=i.direction,a=0!==i.points.findIndex(e=>e.id===t);(0===r&&!a||1===r&&a)&&(this.graph[t][e]=n)}}computeGraph(){this.points.length&&(this.graph={},this.pointsMap={},this.points.forEach(t=>{var e=t.segments;this.pointsMap[t.id]=t,e.forEach(e=>{var i=e.getOtherPoint(t.id);this.registerToGraph(t.id,i.id,e)})}))}clear(){this.clearLines(),this.graph={},this.pointsMap={},this.points.length=0,this.beacons.length=0,this.segments.length=0}removeBeacons(t){kh.removeFromArray(this.beacons,t)}clearBeacons(){this.beacons.length=0,this.data.beacons&&(this.data.beacons.length=0)}getEntrances(t){return this.points.filter(e=>t?e.pointType===t:e.pointType>=4&&e.pointType<=6)}dispose(){this.clear(),super.dispose()}}Ul.lineStyle={lineWidth:10,naviColor:"#33cc61",naviEdgeColor:"#4a82d2",naviArrowColor:"#F4FEFB"};class Gl{constructor(t,e){e=e||{},this.config=e,this.map=t,this.perimeter=2*Math.PI*6378137,this.tilePixelSize=e.tilePixelSize||e.tileSize||256,this.shift=this.perimeter/2,this.tileType="png",this.minTileLevel=1,this.maxTileLevel=19,this.correct=!0,this.mapBoxTilesServer="https://api.mapbox.com/v4/mapbox.streets",this.accessToken=e.token||"pk.eyJ1IjoiZWFzeWZyb2ciLCJhIjoiY2syM2lqMDZ0MDRmOTNpcDk1MXFsZGF3eCJ9.lLCHYmBUBkGOtGaEexic6g"}getTileData(t,e,i){var n=2<<i-1,r=(t+this.shift)/this.perimeter*n,a=(this.shift-e)/this.perimeter*n,o=this.perimeter/n;return{xIndex:~~r,yIndex:~~a,xOffset:(r%1-.5)*o,yOffset:(.5-a%1)*o,tileSize:o,tileCount:n,level:i}}getMapTileDataByBase(t,e){var i=e;if(t.noData)return null;var n=t.xIndex,r=t.yIndex,a=n-i.xIndex,o=i.yIndex-r,s=i.tileSize;return{url:this.buildUrl(t.level,n,r),size:s,coord:{x:s*a-i.xOffset,y:s*o-i.yOffset},xIndex:n,yIndex:r,level:i.level}}getCenterTileData(t){var e=this.map.view.controls.target,i=this.baseLayer.data.center.x+e.x,n=this.baseLayer.data.center.y+e.y,r=this.getTileData(i,n,t.level);return{level:r.level,xIndex:r.xIndex,yIndex:r.yIndex}}getTileDataByLngLat(t,e,i){var n=kh.coordTransform.lngLatToMercator(t,e);return this.getTileData(n.x,n.y,i)}buildUrl(t,e,i){return`${this.mapBoxTilesServer}/${t}/${e}/${i}@2x.${this.tileType}?access_token=${this.accessToken}`}update(t){Object.assign(this.config,t)}}class jl extends Gl{constructor(t,e){super(t,e=Object.assign({server:"wprd01",lang:"zh_cn",size:1,scl:1,style:8},e)),this.config=e,this.mapStyleMap={n1:{scl:1,style:7},n2:{scl:2,style:7,tileSize:512},y1:{scl:1,style:6},y2:{scl:2,style:6},l1:{scl:1,style:8},l2:{scl:2,style:8,tileSize:512}},this.setMapStyle(this.config.mapStyle)}setMapStyle(t){this.config.mapStyle=t;var e=this.mapStyleMap[this.config.mapStyle];e||(e=this.mapStyleMap.n1),this.maxTileLevel=19,this.config.mapStyle&&this.config.mapStyle.startsWith("y")&&(this.maxTileLevel=18),this.config.scl=e.scl,this.config.style=e.style,this.tilePixelSize=this.config.tileSize=this.config.tilePixelSize=e.tileSize||256}buildUrl(t,e,i){return`https://${this.config.server}.is.autonavi.com/appmaptile?x=${e}&y=${i}&z=${t}&lang=${this.config.lang}&size=${this.config.size}&scl=${this.config.scl}&style=${this.config.style}`}}function Vl(t,e,i,n,r,a,o,s,h){Nt.call(this,null,i,n,r,a,o,t,e,s,h);var l=document.createElement("canvas");l.width=1,l.height=1;var c=l.getContext("2d").createImageData(1,1);this.image=c,this.magFilter=void 0!==a?a:H,this.minFilter=void 0!==o?o:q,this.generateMipmaps=!1,this.flipY=!0,this.unpackAlignment=1,this.needsUpdate=!0}Vl.prototype=Object.create(Nt.prototype),Vl.prototype.constructor=Vl,Vl.prototype.isUpdatableTexture=!0,Vl.prototype.setRenderer=function(t){this.renderer=t,this.gl=this.renderer.getContext(),this.utils=En(this.gl,this.renderer.extensions)},Vl.prototype.setSize=function(t,e){if(t!==this.width||e!==this.height){var i=this.renderer.properties.get(this);if(i.__webglTexture){this.width=t,this.height=e;var n=this.gl.getParameter(this.gl.TEXTURE_BINDING_2D);this.gl.bindTexture(this.gl.TEXTURE_2D,i.__webglTexture),i.__webglTexture||(this.width=null),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.utils.convert(this.format),t,e,0,this.utils.convert(this.format),this.utils.convert(this.type),null),this.gl.bindTexture(this.gl.TEXTURE_2D,n)}}},Vl.prototype.update=function(t,e,i){var n=this.renderer.properties.get(this);if(n.__webglTexture){var r=this.gl.getParameter(this.gl.TEXTURE_BINDING_2D);this.gl.bindTexture(this.gl.TEXTURE_2D,n.__webglTexture),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,this.flipY),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,this.unpackAlignment),this.gl.texSubImage2D(this.gl.TEXTURE_2D,0,e,this.height-i-t.height,this.utils.convert(this.format),this.utils.convert(this.type),t),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.bindTexture(this.gl.TEXTURE_2D,r)}};class Wl extends Vl{constructor(t,e){super(),this.map=t,this.data=Object.assign({tileSize:512},e),this.flipY=!1,this.tileSize=this.data.tileSize,this.size=4096,this.count=this.size/this.tileSize,this.setRenderer(this.map.view.renderer),this.dict={},this.indexDict=[],this._index=0}setRenderer(t){super.setRenderer(t),this.renderer.setTexture2D(this,0),this.setSize(4096,4096)}loadImage(t,e){var prom=new Nh,i=__tmpCanvas.createImage();return i.crossOrigin="Anonymous",i.onload=()=>{prom.resolve({img:i,index:e})},i.src=t,prom}addImage(t,e,i,n){var r=n%this.count*this.tileSize,a=Math.floor(n/this.count)*this.tileSize,o=this.indexDict[n];if(o){var s=this.dict[o].mapTile;s.needsUpdate=!0,s.visible=!1,delete this.dict[o]}return this.update(e,r,a),e=null,this.dict[i]={x:r,y:a,mapTile:t},this.indexDict[n]=i,{x:r,y:a}}getTextureIndex(t,e,i,n,r){var a=`${i}_${n}_${r}`,o=this.dict[a];return o?Nh.empty(o):(this._index++,this._index=this._index%(this.count*this.count),this.loadImage(e,this._index).then(({img:e,index:i})=>Nh.empty(this.addImage(t,e,a,i))))}}function Hl(t,e){return new Wl(t,e)}class Xl{constructor(t,e){bh.convert(this),Object.assign(this,t),this.options=e,this.options.opacity=void 0===this.options.opacity?1:this.options.opacity,this.boundingSphere=new Gt,this.boundingSphere.radius=this.size/.7,this.boundingSphere.center.x=t.coord.x,this.boundingSphere.center.y=t.coord.y,this.magFilter=this.minFilter=1003,this.isLoaded=!1}get isMapTile(){return!0}createEntity(t){var e;if(t=t||this,Xl.baseLayer.tileProvider&&Xl.baseLayer.config.demImage){var i=Xl.getGeo(t.level);e=i.geo,this.elevate(e,i.seg)}else e=Xl.tileGeometry.clone();var n=Xl.getTileMaterial({tileSize:Xl.baseLayer.tileProvider.tilePixelSize},this.options);this.entity=new Qe(e,n),this.entity.receiveShadow=Xl.baseLayer.config.receiveShadow,this.entity.castShadow=Xl.baseLayer.config.castShadow,this.initUV(),this.entity.visible=!1;var r=t.size;this.entity.scale.set(r,r,1),this.entity.position.x=t.coord.x,this.entity.position.y=t.coord.y,this.uvLoc={x:0,y:0},setTimeout(()=>{this.requestTile()},0)}getPixelHeight(t,e,i){var n=t.data,r=4*(i*t.width+e);return void 0!==n[r]?.1*(65536*n[r]+256*n[r+1]+n[r+2])-1e4-Xl.baseLayer.config.elevation:0}elevate(t,e){t.dynamic=!0,this.level;for(var i=Xl.baseLayer.demPixels,n=Xl.baseLayer.demRect,r=t.attributes.position.array,a=r.length,o=e+1,s=this.size/e,h=0;h<a;h+=3){var l=h/3,c=l%o,u=~~(l/o),d=Xl.baseLayer.tileProvider.shift,p=this.xIndex*this.size+c*s-d,f=d-this.yIndex*this.size-u*s;if(!(p<n.lt.x||p>n.rb.x||f<n.rb.y||f>n.lt.y)){p-=n.lt.x,f-=n.rb.y;var m=Math.floor(p/n.width*i.width),g=i.height-Math.floor(f/n.height*i.height);r[h+2]=this.getPixelHeight(i,m,g)}}t.attributes.position.needsUpdate=!0}show(t){void 0===t&&(t=!0),this.showAnim&&this.showAnim.stop(),this.entity.material.opacity=t?0:1,this.showAnim=new wh.Tween(this.entity.material).to({opacity:t?this.options.opacity:0},200).onComplete(()=>{this.isLoaded=!0,this.entity.material.depthWrite=!0,this.entity.material.depthTest=!0,this.emit("shown",this)}).start()}initUV(){for(var t=this.entity.geometry.attributes.uv,e=(Xl.baseLayer.tileProvider.tilePixelSize-1)/4096,i=0;i<t.count;i++){var n=t.getX(i),r=t.getY(i);n*=e,r=-r*e,t.setXY(i,n,r)}}updateUV(t,e,i=4096){for(var n=this.entity.geometry.attributes.uv,r=(t+.3)/i,a=(i-e-.3)/i,o=0;o<n.count;o++){var s=n.getX(o),h=n.getY(o);s=r+s-this.uvLoc.x,h=a+h-this.uvLoc.y,n.setXY(o,s,h)}this.uvLoc={x:r,y:a},n.needsUpdate=!0}requestTile(){this.entity.material.map.getTextureIndex(this,this.url,this.level,this.xIndex,this.yIndex).then(({x:t,y:e})=>{this.updateUV(t,e),this.entity.visible=!0,this.isLoaded=!0,this.needsUpdate=!1})}dispose(){this.showAnim&&this.showAnim.stop(),this.entity&&(this.entity.parent&&this.entity.parent.remove(this.entity),this.entity.material.dispose(),this.entity.material.map&&this.entity.material.map.dispose()),this.entity=null,this.boundingSphere=null}get visible(){if(this.entity)return this.entity.visible}set visible(t){this.entity&&(this.entity.visible=t)}}Xl.tileSize=256,Xl.tileGeometry=new Ne(1,1,1,1),Xl.getGeo=function(t){return t=Math.pow(2,21-t),{seg:t=Math.min(32,Math.max(t,8)),geo:new Ne(1,1,t,t)}},Xl.tileMaterials=[],Xl.tileMaterials.clear=function(){var t=Xl.tileMaterials;t.forEach(t=>{t.map.dispose(),t.dispose()}),t.length=0,ql=0,Xl.map=null,Xl.tileMaterials.length=0};var ql=0;Xl.getTileMaterial=function(t,e){var i;ql++;var n=4096/(t=t||{tileSize:512}).tileSize;return ql>n*n&&(ql=1),i=1===ql?function(t,e,i){var n,r=Object.assign({map:Hl(t,e),transparent:!0},i);return n="standard"===Xl.baseLayer.config.materialType?new Pa(r):new Ke(r),Xl.tileMaterials.push(n),n}(Xl.map,t,e):Xl.tileMaterials[Xl.tileMaterials.length-1],i};var Yl={center:{x:12957302.75,y:4852766.24},offset:[0,0,0],scale:1,color:"#ffffff",provider:"amap",mapStyle:"",demImage:""};class Zl{constructor(t,e){bh.convert(this),this.map=t,Xl.map||(Xl.map=t),this.config=Object.assign({center:{x:12957302.75,y:4852766.24},offset:[0,0,0],scale:1,color:"#ffffff",provider:"amap",mapStyle:"n1",maxTilesCount:88,needsHide:!0,demImage:"",demIsGray:"",elevation:0,elevationScale:1.5,demRect:null,laps:3,materialType:"",castShadow:!1,receiveShadow:!0},e),this.data=this.config,Xl.baseLayer=this,this.tileProvider=this.config.tileProvider||new jl(this.map,this.data),this.tileProvider.baseLayer=this,this.tileTree={},this.baseTileDatas={},this.tilesCount=0,this.entity=new Dn,this.entity.name="BaseLayerEntity",this.map.sceneManager.base.add(this.entity),this.tileGroups={},this.updateOffset(this.data.offset),this.entity.scale.setScalar(this.data.scale),this.config.demImage&&this.config.demRect&&(this.entity.scale.z=this.config.elevationScale),this.map&&this.map.baseLayers.push(this),this._hidden=!1,this.init()}init(){this.getDemImage(()=>{this.map.config.center||this.map.config.viewCenter,this.map.config.zoomLevel,this.getDemRect(),this.viewToShowOrLoadFunc=this.viewToShowOrLoad.bind(this),this.map.on("viewChanged",this.viewToShowOrLoadFunc),this.map.view.controls.dispatchEvent({type:"change"}),this.emit("ready")})}getDemRect(){if(!this.demRect&&this.data.demRect){var t=this.data.demRect.southWest.split(","),e=kh.coordTransform.lngLatToMercator(+t[0],+t[1]),i=this.data.demRect.northEast.split(","),n=kh.coordTransform.lngLatToMercator(+i[0],+i[1]);this.demRect={lt:{x:e.x,y:n.y},rb:{x:n.x,y:e.y},width:n.x-e.x,height:n.y-e.y,center:{x:(e.x+n.x)/2,y:(e.y+n.y)/2}}}return this.demRect}getDemImage(t){if(this.config.demImage&&this.config.demRect){var e=this,i=document.createElement("img");i.onload=function(){var n=document.createElement("canvas");n.width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0,i.width,i.height),e.demPixels=n.getContext("2d").getImageData(0,0,i.width,i.height),t()},i.src=this.config.demImage}else t()}get visible(){return!this._hidden}set visible(t){this._hidden=!t,this.entity.visible=t}getData(){var t={};return Object.keys(Yl).forEach(e=>{t[e]=this.data[e]}),t.offset=this.entity.position.toArray(),t}updateTileProvider(t){this.disposeAllTiles(),this.tileProvider.update(t),this.map.view.controls.dispatchEvent({type:"change"})}updateColor(t){this.data.color=t,this.updateTileProvider({color:t})}updateMapStyle(t){this.disposeAllTiles(),this.data.mapStyle=t,this.tileProvider.setMapStyle(t),this.map.view.controls.dispatchEvent({type:"change"})}updateCenter(t){t=t||this.data.center,this.disposeAllTiles(),this.data.center=t,this.map.view.controls.dispatchEvent({type:"change"})}updateOffset(t){this.data.offset=t,this.entity.position.add((new Lt).fromArray(this.data.offset))}updateScale(t){this.data.scale=t,this.entity.scale.setScalar(t)}viewToShowOrLoad(t){if(!this._hidden){var e=t||this.map.view.zoomLevel;if(e>this.tileProvider.maxTileLevel)this.config.needsHide&&(this.entity.visible=!1);else{this.entity.visible=!0;var i=this.baseTileDatas[e];if(!i){var n=this.config.center||this.map.config.viewCenter||this.map.config.center;i=this.tileProvider.getTileData(n.x,n.y,e),this.baseTileDatas[e]=i}var r=this;t?a():(clearTimeout(this._vcID),this._vcID=setTimeout(()=>{a()},t?0:60))}}function a(){var t=r.tileProvider.getCenterTileData(i);r.loadOrVisibleTile(t)}}createTile(t){var e=this.baseTileDatas[t.level],i=this.tileProvider.getMapTileDataByBase(t,e);if(!i)return null;var n={imageNearest:this.config.imageNearest,color:this.config.color,opacity:this.config.opacity},r=new Xl(i,n);return this.addToTree(r),r}loadOrVisibleTile(t){this.doNeighbors(t)}createTileGroup(t){var e=new Dn;this.tileGroups[t]=e,this.entity.add(e),e.renderOrder=t-1e3,e.beforeRender=t=>t.clearDepth()}doNeighbors(t,e){e=e||1;var i=this.getLapNeighbor(t,e);1===e&&(this.tileProvider.checkTileExists&&!this.tileProvider.checkTileExists(t.xIndex,t.yIndex,t.level)&&(t.noData=!0),i.unshift(t));var n=!1;i.forEach((t,i)=>{if(t.noData)e<4&&this.hideAllChildren(t);else{var r=this.getTileByData(t);r||(r=this.createTile(t)),this.isInView(r)?(r.entity?r.isLoaded&&(r.needsUpdate?r.requestTile():r.visible=!0,e<4&&this.hideAllChildren(t)):(r.createEntity(),r.once("shown",()=>{this.tilesCount++,e<4&&this.hideAllChildren(t)}),this.tileGroups[r.level]||this.createTileGroup(r.level),this.tileGroups[r.level].add(r.entity)),n=!0):r&&r.entity&&(r.visible=!1)}}),n&&e<this.config.laps?this.doNeighbors(t,e+1):this.tilesCount>this.config.maxTilesCount&&this.disposeTiles(this.tilesCount-this.config.maxTilesCount+40)}findFarOfMyLevel(t){t=t||this.map.view.zoomLevel;for(var e,i=0,n=-1,r=Object.keys(this.tileTree),a=0,o=r.length;a<o;a++)r[a]!=t&&(e=Math.abs(t-r[a]))>i&&(i=e,n=a);return-1===n?null:r[n]}disposeTiles(t){if(!(t<=0)){var e=this.findFarOfMyLevel();if(null!==e){for(var i=Object.keys(this.tileTree[e]),n=i.length-1;n>-1;n--){for(var r=Object.keys(this.tileTree[e][i[n]]),a=r.length-1;a>-1&&(this.tileTree[e][i[n]][r[a]].dispose(),delete this.tileTree[e][i[n]][r[a]],t--,this.tilesCount--,0!==t);a--);if(a<=0&&delete this.tileTree[e][i[n]],0===t)break}n<=0&&delete this.tileTree[e],t>0&&this.disposeTiles(t)}}}traverseAllTiles(t){Object.keys(this.tileTree).forEach(e=>{Object.keys(this.tileTree[e]).forEach(i=>{Object.keys(this.tileTree[e][i]).forEach(n=>{var r=this.tileTree[e][i][n];t&&t(r)})})})}updateColor(t,e=1){this.config.color=t,this.config.opacity=e,this.traverseAllTiles(i=>{i.options.color=t,i.options.opacity=e,i.entity&&(i.entity.material.color.set(t),i.entity.material.opacity=e)})}disposeAllTiles(){this.traverseAllTiles(t=>t.dispose()),Xl.tileMaterials.clear(),this.tileTree={},this.baseTileDatas={},this.tilesCount=0}hideAllChildren(t){for(var e,i,n,r,a,o=t.level;o<20;)if(o++,this.tileTree[o]){n=Math.pow(2,o-t.level),e=t.xIndex*n,i=t.yIndex*n;for(var s=0;s<n;s++)if(r=this.tileTree[o][e+s])for(var h=0;h<n;h++)(a=r[i+h])&&(a.visible=!1)}}isInView(t){return!!t&&this.map.view.frustum.intersectsSphere(t.boundingSphere)}addToTree(t){var e=t.level,i=t.xIndex,n=t.yIndex;this.tileTree[e]||(this.tileTree[e]={}),this.tileTree[e][i]||(this.tileTree[e][i]={}),this.tileTree[e][i][n]=t}getTileByData(t,e,i){try{return"object"==typeof t?this.tileTree[t.level][t.xIndex][t.yIndex]:this.tileTree[t][e][i]}catch(t){}}getLapNeighbor(t,e){for(var i=[],n=2*e,r=!1,a={x:t.xIndex+e,y:t.yIndex+e},o=[{x:0,y:-1},{x:-1,y:0},{x:0,y:1},{x:1,y:0}],s=0;s<4;s++)for(var h=0;h<n;h++){a.x+=o[s].x,a.y+=o[s].y;var l={level:t.level,xIndex:a.x,yIndex:a.y};this.tileProvider.checkTileExists&&(r=!this.tileProvider.checkTileExists(a.x,a.y,t.level)),r&&(l.noData=!0),i.push(l)}return i}dispose(){clearTimeout(this._vcID),this.disposeAllTiles(),this.visible=!1;var t=this.entity.parent;t&&t.remove(this.entity),this.data=this.config=null;var e=this.map.baseLayers.indexOf(this);-1!==e&&this.map.baseLayers.splice(e,1)}}var Jl={id:-1,name:"model",modelID:"",transform:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},children:[],color:16777215,alpha:1,fixedSize:null,pickabled:null,playClipName:"",radius:5,minLevel:0,maxLevel:28,userData:{},tag:""};class Kl extends al{constructor(t,e,i,n){if("string"==typeof e){var r=kh.cloneJSON(Jl);r.modelID=e,e=r}(e=e||kh.cloneJSON(Jl)).children||(e.children=[]),super(t,e),this.data.node=this,this.parentNode=n,this.callback=i,this.type="OMModel",this.setData(),this.isPlaying=!1,this.currentAction=null,this.actions={},this.setTransform(),this._initCallback=null}clone(){var t=(e=this.data).node;delete e.node;var e=JSON.parse(JSON.stringify(e));this.data.node=t;var i=new this.constructor(this.map,e,null,this.parentNode);return this.parent&&this.parent.add(i),i}_getMesh(t){return t.material?t.parent&&t.parent.children>1?t.parent:t:t.children&&t.children.length?this._getMesh(t.children[0]):void 0}get mesh(){if(this.entity)return this._getMesh(this.entity)}setData(t){(t=t||this.data).modelID&&(this.load(this.callback),delete this.callback),t.children.forEach(t=>{var e;e=t.modelID?new this.constructor(this.map,t):new gl(this.map,t),this.add(e)})}play(t,e=1){var i=this.actions[t],n=Object.keys(this.actions);if(!i){if(!n.length)return;i=this.actions[n[0]]}n.forEach(t=>{this.actions[t].stop()}),i.time=0,i.timeScale=e,i.play(),this.isPlaying=!0,this.currentAction=i}crossFadeTo(t,e,i=1){var n=this.actions[t],r=this.actions[e];n&&r&&(Object.keys(this.actions).forEach(e=>{e!==t?this.actions[e].stop():this.actions[e].enabled||this.actions[e].play()}),r.weight=1,r.time=0,r.play(),this.currentAction=r,this.isPlaying=!0,n.crossFadeTo(r,i))}fadeTo(t,e=1){if(this.currentAction)this.crossFadeTo(this.currentAction.name,t,e);else{this.stopAll();var i=this.actions[t];if(!i)return;i.play(),i.fadeIn(e),this.isPlaying=!0,this.currentAction=i}}stop(t){var e=this.actions[t];e&&e.stop()}stopAll(){Object.keys(this.actions).forEach(t=>{this.actions[t].stop()}),this.currentAction=null,this.isPlaying=!1}setTransform(t){super.setTransform(t)}load(t){this.map.modelLoader.loadByID(this,this.data.modelID,e=>{this.animations=e.animations,this.actions=e.actions||{},this.isSkinnedMesh=kh.traverse([e.scene],t=>{if("SkinnedMesh"===t.type)return!0},!1).length>0,this.model&&this.removeEntity(this.model),this.model=e.scene,this.processMat(this.model),this.entity.add(e.scene),this.play(this.data.playClipName),this.setTransform(),this.originScale||(this.originScale=this.entity.scale.clone()),t&&t(this),this.callback&&(this.callback(this),delete this.callback),this._initCallback&&(this._initCallback(this),delete this._initCallback),this.map.emit("modelCreated",this),this.map.emit("nodeCreated",this)},null,null,this.parentNode)}processMat(t){var e=[];let i=this.map.config.noMetalness;t.traverse(t=>{t.material&&!e.includes(t.material.uuid)&&[].concat(t.material).forEach(t=>{e.includes(t.uuid)||(e.push(t.uuid),t.processed||(t.processed=!0,i&&(t.metalness=0),t.map&&(t.map.encoding=3e3,t.map.needsUpdate=!0)))})})}setEmissive(t){var e=[];if(!this.map.config.noEmissive&&0!==this.map.config.modelEmissive){var i=this.map.config.modelEmissive||.35;t.traverse(t=>{t.material&&!e.includes(t.material.uuid)&&[].concat(t.material).forEach(t=>{e.includes(t.uuid)||(e.push(t.uuid),!t.processed&&t.emissive&&t.emissive.copy(t.color.clone().multiplyScalar(i)))})})}}changeModelID(t,e){this.data.playClipName="",this.currentAction=null,this.isPlaying=!1,this.clearActions(),this.data.modelID=t,this.load(e)}clearActions(){this.actions={}}getScale(){if(!this.map.config.enableModelFixedSize||!this.data.fixedSize||!this.map)return 1;var t=new Lt;return this.entity.getWorldPosition(t),kh.getZoomFactor(this.map,t)}setFixedSize(t){this.originScale||(this.originScale=this.entity.scale.clone()),this.data.fixedSize=t}update(){if(this.map.config.enableModelFixedSize&&this.data.fixedSize){var t=this.map.view.zoomLevel<=this.data.fixedSize.level?this.getScale()*this.data.fixedSize.size:1,e=this.originScale||this.entity.scale;this.entity.scale.set(e.x*t,e.y*t,e.z*t)}}get isInView(){if(this.mesh)return this.map.view.frustum.intersectsSphere(this.mesh.geometry.boundingSphere)}dispose(){super.dispose(),this.currentAction=null,this.isPlaying=!1,this.animations&&(this.animations.length=0),this.model=null}}gl.OMModel=Kl,Kl.prototype.getData=gl.prototype.getData,Kl.fromEntity=function(t,e,i){i=Object.assign(kh.cloneJSON(Jl),i);var n=new Kl(t,i);return n.originScale=n.entity.scale.clone(),n.setEntity(e),n};class Ql{constructor(t){this.map=t}traverse(t,e){e.length&&e.forEach(e=>{var i,n=e;e.modelID?(i=new Kl(this.map,n),t.add(i,!1)):(i=new gl(this.map,n,{createChildren:!1}),t.add(i,!1)),e.children.length&&this.traverse(i,e.children)})}create(t){if(t.modelNode){var e=kh.cloneJSON(t.data.models);e&&e.length&&this.traverse(t.modelNode,e)}}createSingle(t,e,i){var n;if(this.map.emit("modelData",t),this.map.emit("nodeData",t),n=t.modelID?new Kl(this.map,t,null,i):new gl(this.map,t),e.add(n,!1),n.entity.getWorldPosition(n.data.boundingSphere.center),n.visible=!0,"OMFloor"===e.parent.type&&e.parent._isFadeOut&&this.map.config.enableFloorAlpha){var r=this;n._initCallback=function(t){kh.collectMaterials(t).forEach(t=>{t._originAlpha=t.opacity,t.opacity=r.map.config.fadeOutAlpha})}}return n}}var $l=[];class tc{constructor(t,e){var i=this;i.style={},i.setStyle(t),i.ctx=e,i.ctx||void 0===document||(i.ctx=document.createElement("canvas").getContext("2d")),i.isDrawing=!1,i._elements=[],i.ctx.canvas.width=i.style.width,i.ctx.canvas.height=i.style.height}setStyle(t){t&&(this.style={},this.style=Object.assign(this.style,{width:256,height:128,color:4473924,fontColor:0,font:"600 24px Helvetica, monaco, 微软雅黑, Consolas, Courier New, Courier, monospace",elements:[],background:{color:16777215,alpha:0}},t))}readElementSytle(t){var e=this;void 0!==t.color&&(e.ctx.fillStyle=ec(t.color,t.alpha)),void 0!==t.strokeColor&&(e.ctx.strokeStyle=ec(t.strokeColor,t.strokeAlpha)),t.lineWidth&&(e.ctx.lineWidth=t.lineWidth),t.textBaseline?e.ctx.textBaseline=t.textBaseline:e.ctx.textBaseline="top",t.shadow?(void 0!==t.shadow.offsetX&&(e.ctx.shadowOffsetX=t.shadow.offsetX),void 0!==t.shadow.offsetY&&(e.ctx.shadowOffsetY=t.shadow.offsetY),void 0!==t.shadow.blur&&(e.ctx.shadowBlur=t.shadow.blur),void 0!==t.shadow.color&&(e.ctx.shadowColor=ec(t.shadow.color,t.shadow.alpha))):(e.ctx.shadowBlur=0,e.ctx.shadowOffsetX=0,e.ctx.shadowOffsetY=0)}getValue(t,e,i){var n=t[e],r={x:0,y:0};return!t.groups||"x"!=e&&"y"!=e||(r=t.groups.reduce(function(t,e){return{x:t.x+e.x,y:t.y+e.y}},r)),i?n+r.x:n+r.y}getStyleByName(t){var e=null;return function i(n){if(n.elements&&!e)for(var r=0;r<n.elements.length;r++){var a=n.elements[r];a.name==t&&(e=a),i(a)}}(this.style),e}getStylesByType(t){var e=[];return function i(n){if(n.elements)for(var r=0;r<n.elements.length;r++){var a=n.elements[r];a.type===t&&e.push(a),i(a)}}(this.style),e}drawBackground(){var t=ec(this.style.background.color,this.style.background.alpha);this.ctx.fillStyle=t,this.ctx.fillRect(0,0,this.style.width,this.style.height)}drawRoundRect(t,e){var i=this;if(i.readElementSytle(t),t.width&&t.height){var n=i.getValue(t,"x",!0),r=i.getValue(t,"y"),a=i.getValue(t,"width",!0),o=i.getValue(t,"height");i.ctx.beginPath(),e?function(t,e,i,n,r,a){var o=a||this;o.beginPath(),o.moveTo(t+r,e),o.arcTo(t+i,e,t+i,e+n,r),o.arcTo(t+i,e+n,t,e+n,r),o.arcTo(t,e+n,t,e,r),o.arcTo(t,e,t+i,e,r),o.closePath()}(n,r,a,o,t.radius||.1,i.ctx):i.ctx.rect(n,r,a,o),i.ctx.closePath(),void 0!==t.color&&i.ctx.fill(),void 0!==t.lineWidth&&void 0!==t.strokeColor&&i.ctx.stroke(),i.next()}else i.next()}drawCircle(t){var e=this;if(void 0!==t.radius&&void 0!==t.point){e.readElementSytle(t);var i=e.getValue(t.point,"x",!0),n=e.getValue(t.point,"y");e.ctx.beginPath(),e.ctx.arc(i,n,t.radius,0,2*Math.PI,!0),e.ctx.closePath(),void 0!==t.color&&e.ctx.fill(),void 0!==t.lineWidth&&void 0!==t.strokeColor&&e.ctx.stroke(),e.next()}}drawShape(t){var e=this;if(!(void 0===t.points&&t.points.length<2)){e.readElementSytle(t),e.ctx.beginPath();for(var i=0;i<t.points.length;i++){var n=e.getValue(t.points[i],"x",!0),r=e.getValue(t.points[i],"y");0===i?e.ctx.moveTo(n,r):e.ctx.lineTo(n,r)}!1!==t.close&&t.points.length>2&&e.ctx.closePath(),void 0!==t.lineWidth&&void 0!==t.strokeColor&&e.ctx.stroke(),void 0!==t.color&&!1!==t.close&&e.ctx.fill(),e.next()}}drawImage(t){var e=this,i=null;function n(){e.readElementSytle(t);var i,n,r=e.getValue(t,"x",!0),a=e.getValue(t,"y");t.width&&t.height&&(i=e.getValue(t,"width",!0),n=e.getValue(t,"height")),void 0!==t.sourceX&&void 0!==t.sourceY?e.ctx.drawImage(t.image,t.sourceX,t.sourceY,t.sourceW,t.sourceH,r,a,i,n):i&&n?e.ctx.drawImage(t.image,r,a,i,n):e.ctx.drawImage(t.image,r,a)}if(t.url){var r=!1;if(clearTimeout(e.imageLoadTimeout),t.image)n(t.image),e.next();else{(i=__tmpCanvas.createImage()).crossOrigin="Anonymous",e.imageLoadTimeout=setTimeout(()=>{r||(i.src="",e.next())},1e4);var a=e.ctx.canvas.width,o=e.ctx.canvas.height;i.onload=function(){e.ctx.canvas.width===a&&e.ctx.canvas.height===o||(e.ctx.canvas.width=a,e.ctx.canvas.height=o),r=!0,t.image=i,n(),e.next()},i.onerror=function(t){clearTimeout(e.imageLoadTimeout),e.next()},i.src=t.url}}else e.next()}drawText(t){var e=this,i=t.font||e.style.font,n=i.match(/\d+/);n&&n.length>0&&parseInt(n[0]),e.readElementSytle(t),e.ctx.font=i;var r=e.getValue(t,"x",!0),a=e.getValue(t,"y");t.lineWidth&&(e.ctx.lineWidth=t.lineWidth,e.ctx.lineJoin="round",e.ctx.strokeStyle=t.strokeColor||16777215,e.ctx.strokeText(t.text,r,a)),e.ctx.fillText(t.text,r,a),e.next()}drawElement(t){if(!1!==t.visible){if(t.groups)for(var e=0;e<t.groups.length;e++)if(!1===t.groups[e].visible)return void this.next();switch(t.type){case"image":this.drawImage(t);break;case"text":this.drawText(t);break;case"roundRect":this.drawRoundRect(t,!0);break;case"rect":this.drawRoundRect(t,!1);break;case"circle":this.drawCircle(t);break;case"shape":this.drawShape(t)}}else this.next()}normalizeStyle(t,e){if(t.elements)for(var i=0;i<t.elements.length;i++){var n=t.elements[i];if("group"==n.type){var r={x:n.x,y:n.y};void 0!==n.visible&&(r.visible=n.visible);var a=[];e?(a=e.slice()).push(r):a=[r],this.normalizeStyle(t.elements[i],a)}else e&&(n.groups=e),this._elements.push(n)}}next(){var t=this;if(t.index++,t.index<t._elements.length)t.drawElement(t._elements[t.index]);else if(t.isDrawing=!1,t.ctx.isDrawing=!1,t._needsUpdate&&(t._needsUpdate=!1,t.update()),t.callback&&(t.callback(t.ctx.canvas),t.callback=null),$l.length){var e=$l.shift();e.s.update(e.style,e.force)}}init(t){t&&(this.callback=t),this.update()}update(t,e,i){var n=this;if(n.ctx.isDrawing)$l.push({s:n,style:t,force:e});else if(!n.isDrawing||e){i&&(n.callback=i),clearTimeout(n.imageLoadTimeout),t&&n.setStyle(t),n._elements=[],n.normalizeStyle(n.style),n.isDrawing=!0,n.ctx.isDrawing=!0,n.index=-1;var r=n.style.width,a=n.style.height;r!=n.ctx.canvas.width&&(n.ctx.canvas.width=r),a!=n.ctx.canvas.height&&(n.ctx.canvas.height=a),n.ctx.clearRect(0,0,r,a),n.drawBackground(t),n.next()}else n._needsUpdate=!0}}function ec(t,e){function i(t,e,i){return parseInt("0x"+t.slice(e,i))}return e=void 0===e?1:e,"number"==typeof t?t=function(t){if(t.length<6)for(var e=6-t.length,i=0;i<e;i++)t="0"+t;return t}(t=t.toString(16)):"string"==typeof t&&(t=t.slice(1)),6!=t.length&&(t="#ffffff"),"rgba("+i(t,0,2)+", "+i(t,2,4)+", "+i(t,4,6)+", "+e+")"}const ic={renderOrders:(nc={},rc=0,["water","land","road","line","plant","model","marker"].forEach((t,e)=>{rc+=10,nc[t]=rc}),nc.cloud=1e4,nc),markerScale:2.5};var nc,rc,ac;wx.getSystemInfoSync().pixelRatio;var oc=null;ac=ic.markerScale;class sc{constructor(t,e,i,n){this.map=t,oc=n||oc,this.description=new fc(e),this.canvasDrawer=new tc(this.description.description,n)}init(t){this.canvasDrawer.init(e=>{t&&t(e),this.canvasDrawer.callback=null})}rebuild(t,e){e&&(this.canvasDrawer.callback=t=>{e(t),this.canvasDrawer.callback=null}),this.description=new fc(t),this.canvasDrawer.update(this.description.description,!0)}get canvas(){return this.canvasDrawer.ctx.canvas}get width(){return this.description.description.width}get height(){return this.description.description.height}getStyleByName(t){return this.canvasDrawer.getStyleByName(t)}getStylesByType(t){return this.canvasDrawer.getStylesByType(t)}updateTextColor(t,e,i,n){var r=[];if(t){var a=this.getStyleByName(t);a&&(r=[a])}else r=this.getStylesByType("text");r.forEach(t=>{null!=e&&(t.color=e),null!=i&&(t.strokeColor=i)}),this.canvasDrawer.update(null,null,n)}updateText(t,e,i){var n=this.getStyleByName(t);if(n){var r=n.width;oc.font=n.font;var a=oc.measureText(e).width,o=a-r;switch(n.align){case"right":n.x-=o;break;case"center":n.x-=o/2}n.text=e,n.width=a,this.canvasDrawer.update(null,null,i)}}updateImage(t,e,i){var n=this.getStyleByName(t);n&&("string"==typeof e?(delete n.image,n.url=e):e instanceof Image?n.image=e:"object"==typeof e&&Object.assign(n,e),this.canvasDrawer.update(null,null,i))}updateFrame(t,e,i){var n=this.getStyleByName(t);n&&Object.assign(n,e),this.canvasDrawer.update(null,null,i)}}sc.setCanvas=function(t){oc=t.getContext("2d")};class hc{constructor(t){this.config=t,t&&(this.name=t.name),this.description={}}get width(){return this.description.width}get height(){return this.description.height}}class lc extends hc{constructor(t){super(t),this.description=t,t.url&&(this.backgroundImage={type:"image",name:"backgroundImage",url:t.url,x:0,y:0})}}class cc extends hc{constructor(t,e){super(t),this.style=e,this.description={type:"group",name:t.name,x:0,y:0,elements:[]},dc(t,null,e,"textGroup"),this.parse()}getTextProp(t,e,i){return void 0!==t[e]?t[e]:void 0!==this.config[e]?this.config[e]:i}parse(){var t=this,e=0,i=0,n=t.description;if(n.elements.length=0,t.config.elements.length){t.config.elements.forEach((r,a)=>{var o={type:"text"};o.name=r.name||"text_"+a,o.text=r.text,dc(r,null,t.style,"text"),o.color=t.getTextProp(r,"color",0),o.strokeColor=t.getTextProp(r,"strokeColor",16777215),o.align=t.getTextProp(r,"align","center");var s=t.getTextProp(r,"size",18)*ac,h=t.getTextProp(r,"font","Arial"),l=t.getTextProp(r,"weight","normal"),c=t.getTextProp(r,"style","");o.font=c+" "+l+" "+s+"px "+h,oc.font=o.font;var u=oc.measureText(o.text).width;u>i&&(i=u),o.width=u,o.height=1.08*s,o.space=t.getTextProp(r,"space",4)*ac,o.lineWidth=t.getTextProp(r,"lineWidth",Math.max(s/6,2)),void 0!==r.letterSpacing&&(o.letterSpacing=r.letterSpacing),e+=o.height+(a<t.config.elements.length-1?o.space:0),n.elements.push(o)});var r=0;n.elements.forEach((t,e)=>{if(e>0){var a=n.elements[e-1];r+=a.height+a.space}switch(t.align){case"left":t.x=0,t.y=r;break;case"right":t.x=i-t.width,t.y=r;break;case"center":t.x=(i-t.width)/2,t.y=r}}),n.width=i,n.height=e}}}class uc extends hc{constructor(t,e){super(t),this.description={type:"image",x:0,y:0},dc(t,null,e,"image"),this.description=Object.assign(this.description,t),this.description.width*=ac,this.description.height*=ac,this.description.space*=ac}}function dc(t,e,i,n){var r=null;if(i[t.styleName]?r=i[t.styleName]:n&&i[n]?r=i[n]:i[t.type]&&(r=i[t.type]),r){var a=e||t;Object.keys(r).forEach(t=>{void 0===a[t]&&(a[t]=r[t])})}}class pc extends hc{constructor(t,e){super(t),this.style=e||{},this.description={type:"group",name:t.name,x:0,y:0,elements:[]},dc(t,null,this.style,"container"),this.parse()}parse(){var t=this;t.config.elements.length&&t.config.elements.forEach((e,i)=>{switch(e.type){case"textGroup":var n=new cc(e,t.style);!1!==e.visible&&t.description.elements.push(n.description);break;case"image":var r=new uc(e,t.style);!1!==e.visible&&t.description.elements.push(r.description);break;case"container":var a=new pc(e,t.style);!1!==e.visible&&t.description.elements.push(a.description)}}),t.locate()}getMaxSize(){var t=0,e=0;return this.description.elements.forEach(i=>{i.width>t&&(t=i.width),i.height>e&&(e=i.height)}),{maxWidth:t,maxHeight:e}}locate(){var t=this,e=t.getMaxSize(),i="horizontal"===t.config.flowType,n=void 0===t.config.margin?5:t.config.margin,r=n*=ac,a=n,o=!1;t.description.elements.forEach((n,s)=>{if(!1!==n.visible){o=s===t.description.elements.length-1;var h=(t.config.elements[s].space||5)*ac;if(i){switch(n.x=r,t.config.elements[s].align){case"top":case"left":n.y=a;break;case"bottom":case"right":n.y=a+e.maxHeight-n.height;break;default:n.y=a+(e.maxHeight-n.height)/2}r+=n.width+(o?0:h)}else{switch(n.y=a,t.config.elements[s].align){case"top":case"left":n.x=r;break;case"bottom":case"right":n.x=r+e.maxWidth-n.width;break;default:n.x=r+(e.maxWidth-n.width)/2}a+=n.height+(o?0:h)}}}),t.description.width=(i?r:e.maxWidth)+n*(i?1:2),t.description.height=(i?e.maxHeight:a)+n*(i?2:1),t.config.frame&&t.parseFrame()}parseFrame(){var t=this,e=t.description.width,i=t.description.height,n=e<i?e:i,r=t.config.margin||5,a=Math.max(n*(t.config.frame.extend||.05),5),o=Math.min(.05*n,1),s=a+o;t.description.width+=2*s,t.description.height+=2*s;var h=2*r,l={type:"roundRect",name:"frame",x:r,y:r,width:t.description.width-h,height:t.description.height-h,radius:.2*n,lineWidth:o};Object.assign(l,t.config.frame),void 0!==t.config.frame.radius&&(l.radius=n*Math.min(t.config.frame.radius,.5)),dc(t.config.frame,l,t.style,"frame"),l.color||(l.color="#ffffff"),l.strokeColor||(l.strokeColor=3355443),l.alpha||(l.alpha=.5),t.description.elements.forEach(t=>{t.x+=s,t.y+=s}),t.description.elements.unshift(l)}}class fc{constructor(t={}){this.description={elements:[]},this.style=t.style,t.background&&(this.background=new lc(t.background),this.description.background=this.background.description),this.container=new pc(t.container,this.style),this.description.width=this.container.width,this.description.height=this.container.height,this.background&&this.background.backgroundImage&&(this.background.backgroundImage.width=this.container.width,this.background.backgroundImage.height=this.container.height,this.description.elements.unshift(this.background.backgroundImage)),this.description.elements.push(this.container.description)}}var mc,gc=1,vc=!0;function yc(t,e){var i=t.toDataURL("image/png"),n=m.createImage();n.crossOrigin="Anonymous";var r=new Nt;return n.onload=()=>{r.image=n,r.needsUpdate=!0,e&&e(r,n)},n.src=i,r}gc=ic.markerScale;class xc extends $n{constructor(t,e,i){super(),this.map=t,vc&&(vc=!1,gc=this.map.sysInfo.pixelRatio,sc.setCanvas(t.config.canvas2d)),this.config=e||{},this._width=1,this._height=1,this.anchor=new Lt,this.anchorInput=null,this.originPosition=new Lt,this._scale=1,this.originScale=new Lt(1,1,1),this.fixedSize=kh.getp(this.config,"fixSize","fixedSize",!0),this.visible=!1,this.material.opacity=0,this.imageLoaded=!1,this._xcxCallback=this.xcxCallback.bind(this),this.contentConfig=i,this.setContent(i),this.config.width&&this.config.height&&this.setSize(this.config.width,this.config.height),this.config.anchor&&this.setAnchor(this.config.anchor),this.scale.setScalar(.01)}get camera(){return this.map.view.currentCamera}_updateTexture(){this.material.map.minFilter=1006,this.material.map.magFilter=1006,this.material.map.generateMipmaps=!1,this.material.map.needsUpdate=!0,this.material.needsUpdate=!0}_updateImage(t,e){this.material.map?this.material.map.image=t:this.material.map=yc(t,t=>{this._updateTexture(),e&&e()})}clone(){return new this.constructor(this.map,this.config,this.contentConfig)}xcxCallback(t){this.material.map=yc(t,t=>{this._updateTexture()})}updateContent(t){if(t=t||{},this.content&&t.type){switch(t.type){case"text":this.content.updateText(t.name,t.value,this._xcxCallback);break;case"image":this.content.updateImage(t.name,t.value,()=>{if(this.material.map)this.material.map.needsUpdate=!0;else try{setTimeout(()=>{this.material.map.needsUpdate=!0},88)}catch(t){}});break;case"frame":this.content.updateFrame(t.name,t.value,this._xcxCallback);break;case"textColor":this.content.updateTextColor(t.name,t.color,t.strokeColor,this._xcxCallback)}this.material.map&&"image"!==t.type&&(this.material.map.needsUpdate=!0)}}anchorToImageCenter(t){t=t||"image";var e=this.content.getStyleByName(t);if(e){var i=e.x+e.width/2,n=e.y+e.height/2;this.setAnchor(i,n)}}setContent(t,e){this.contentConfig=t||this.contentConfig,this.content?this.content.rebuild(this.contentConfig,t=>{this._xcxCallback(t),this.config.onLoad&&(this.config.onLoad.call(this),delete this.config.onLoad),e&&e(this)}):(this.content=new sc(this.map,this.contentConfig,null,this.map.config.canvas2d?this.map.config.canvas2d.getContext("2d"):null),this.content.init(t=>{this._updateImage(t,()=>{this.update(),this.imageLoaded=!0}),this.fixedSize||(this.content?this.setSize(this.content.width,this.content.height):this.setSize(.01,.01)),this.config.onLoad&&(this.config.onLoad.call(this,this.node),delete this.config.onLoad),e&&e(this)})),this.fixedSize&&(this._width=this.content.width/gc,this._height=this.content.height/gc,this.setSize(this._width,this._height)),this.update()}_setVec3(t,e){e instanceof Lt?this[t].copy(e):4==arguments.length&&this[t].set(arguments[1],arguments[2],arguments[3])}get width(){return this._width}set width(t){this.setSize(t,this.height),this.anchorInput&&this.setAnchor.apply(this,this.anchorInput)}get height(){return this._height}set height(t){this.setSize(this.width,t),this.anchorInput&&this.setAnchor.apply(this,this.anchorInput)}getPosition(){return this.originPosition}setPosition(t){this._setVec3.bind(this,"originPosition").apply(this,arguments)}getAnchorPosition(t,e){var i=this,n=i.width,r=i.height,a=new Lt(n*t+i.anchor.x,r*e+i.anchor.y,0),o=(new At).makeRotationFromQuaternion(i.camera.quaternion),s=a.clone().multiply(i.originScale).applyMatrix4(o).multiplyScalar(i.fixedSize?i._scale:1),h=new Lt;return i.parent.getWorldPosition(h),i.originPosition.clone().add(h).add(s)}setAnchor(t){var e=this,i=arguments;e.anchorInput=Array.prototype.slice.call(arguments);var n=e.width/2,r=e.height/2;if(2==i.length&&"number"==typeof t)(i=Array.from(i))[0]=n-i[0]/gc,i[1]=i[1]/gc-r,i.length<3&&i.push(0);else if("string"==typeof t){var a=2==i.length?i[1]:e.config.anchorOffset||[0,0];switch(1==a.length&&a.push(0),t){case"center":default:i=[0,0,0];break;case"top":i=[0,-r,0];break;case"bottom":i=[0,r,0];break;case"left":i=[n,0,0];break;case"right":i=[-n,0,0];break;case"leftTop":i=[n,-r,0];break;case"rightTop":i=[-n,-r,0];break;case"leftBottom":i=[n,r,0];break;case"rightBottom":i=[-n,r,0];break;case"imageCenter":e.anchorToImageCenter()}i[0]-=a[0]*e.width,i[1]-=a[1]*e.height}this._setVec3.bind(this,"anchor").apply(this,i)}setSize(t,e){this._width=t,this._height=e,this._updateSize(),this.anchorInput&&this.setAnchor.apply(this,this.anchorInput)}getScale(){if(!(this.parent&&this.fixedSize&&this.camera&&this.map))return 1;var t=new Lt;return this.getWorldPosition(t),kh.getZoomFactor(this.map,t)}_updateAnchor(){if(this.camera){var t=(new At).makeRotationFromQuaternion(this.camera.quaternion),e=this.anchor.clone().multiply(this.originScale).applyMatrix4(t).multiplyScalar(this._scale);this.position.copy(this.originPosition.clone().add(e))}}_updateSize(){this._scale=this.getScale(),this.scale.set(this.width*this._scale*this.originScale.x,this.height*this._scale*this.originScale.y,1)}update(){this.fixedSize&&this._updateSize(),this._updateAnchor()}}class bc{constructor(t,e,i,n){this.x=t||0,this.y=e||0,this.width=i||0,this.height=n||0}checkOverlay(t){return!(this.x>t.x+t.width||this.y>t.y+t.height||this.x+this.width<t.x||this.y+this.height<t.y)}}class wc{constructor(t,e){var i=this;i.map=t,i.poiSize=18,i.textSize=14,i.color="#222222",i.strokeColor="#efefef",i.imageData={type:"image",name:"image",url:"",width:i.poiSize,height:i.poiSize},i.textGroup={type:"textGroup",align:"center",color:i.color,strokeColor:i.strokeColor,size:i.textSize,elements:[]},i.textData={text:"文字标注",align:"left"},i.configData={container:{type:"container",elements:[]}}}getStyle(t,e){var i=this,n=null;switch(t){case"image":n=kh.cloneJSON(i.imageData),"string"==typeof e?n.url=e||"":Object.assign(n,e),n.url&&!n.imageID&&(n.imageID=n.url),n.imageID&&(n.url=kh.getResourceUrl(this.map,null,n.imageID,!0),delete n.imageID);break;case"text":n=kh.cloneJSON(i.textData),"string"==typeof e?n.text=e:Object.assign(n,e);break;case"textGroup":n=kh.cloneJSON(i.textGroup);break;case"config":switch(n=kh.cloneJSON(i.configData),e){case"text":n.style={text:{color:"#333333",strokeColor:"#dddddd"}};case"horizontal":n.container.flowType="horizontal";break;case"vertical":n.container.flowType="vertical"}}return n}_getComposite(t,e,i){e=e||"horizontal";var n,r=this.getStyle("config",e),a=this.getStyle("textGroup"),o=this.getStyle("image",t.image);return t.texts=[].concat(t.texts),t.texts.forEach(t=>{n=this.getStyle("text",t),i&&!n.align&&(n.align=i),a.elements.push(n)}),{content:r,image:o,textGroup:a}}getContent(t,e){var i,n,r,a,o;switch(t){case"poi":i=this.getStyle("config"),n=this.getStyle("image",e.image),i.container.elements.push(n);break;case"label":i=this.getStyle("config","text"),a=this.getStyle("textGroup"),e.texts.forEach(t=>{r=this.getStyle("text",t),a.elements.push(r)}),i.container.elements.push(a);break;case"composite":case"imageLeft":(i=(o=this._getComposite(e)).content).container.elements.push(o.image,o.textGroup);break;case"imageRight":(i=(o=this._getComposite(e,null,"right")).content).container.elements.push(o.textGroup,o.image);break;case"imageBottom":(i=(o=this._getComposite(e,"vertical","center")).content).container.elements.push(o.textGroup,o.image);break;case"imageTop":(i=(o=this._getComposite(e,"vertical","center")).content).container.elements.push(o.image,o.textGroup);break;case"border":i=(o=this._getComposite(e)).content,e.frame=e.frame||{},i.container.frame=e.frame,i.container.elements.push(o.image,o.textGroup);break;case"borderText":i=this.getStyle("config","horizontal"),a=this.getStyle("textGroup"),e.frame=e.frame||{},i.container.frame=e.frame,e.texts.forEach(t=>{r=this.getStyle("text",t),a.elements.push(r)}),i.container.elements.push(a);break;case"borderHalf":i=(o=this._getComposite(e)).content,e.frame=e.frame||{},o.textGroup.frame=e.frame;var s=this.getStyle("config","text").container;s.frame=e.frame||{},s.elements.push(o.textGroup),i.container.elements.push(o.image,s)}return i}}function _c(t){var e=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):!!window.XMLHttpRequest&&new XMLHttpRequest;function i(e){t.success&&t.success(e)}function n(e){if(t.fail){var i=e;r&&i instanceof ArrayBuffer&&(n=e,i=window.TextDecoder?new window.TextDecoder("utf-8").decode(n):String.fromCharCode.apply(null,new Uint8Array(n))),t.fail(i)}var n}t.dataType=t.dataType||"json",t.async=void 0===t.async||t.async,e.onreadystatechange=function(){4===e.readyState&&("file:"==window.location.protocol&&0==e.status||e.status>=200&&e.status<300?r?i(e.response):e.responseText&&i("json"!==t.dataType?e.responseText:JSON.parse(e.responseText)):n(e.response),t.complete&&t.complete(e.response))},e.ontimeout=n,e.onerror=n,e.onabort=n,e.responseType=t.responseType?t.responseType.toLowerCase():"";var r="arraybuffer"===e.responseType.toLowerCase();t.type=t.type||"GET",t.type.toUpperCase(),e.open(t.type,t.url,t.async),e.timeout=t.timeout||0,t.headers&&"object"==typeof t.headers?(t.headers["Content-type"]||(t.headers["Content-type"]="application/json;charset=utf-8"),Object.keys(t.headers).forEach(function(i){e.setRequestHeader(i,t.headers[i])})):"post"===t.type.toLowerCase()&&(e.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.headers["Content-type"]||e.setRequestHeader("Content-type","application/json;charset=utf-8")),e.setRequestHeader("withCredentials",!0);try{var a=t.data;t.data&&"object"==typeof t.data&&(a=JSON.stringify(t.data)),e.send(a)}catch(t){n(t)}return e}wc.getInstance=function(t){return mc||(mc=new wc(t)),mc};class Mc extends al{constructor(t,e,i){kh.assign(e,{anchor:"bottom",minLevel:16,maxLevel:23,position:[0,0,0],scale:[1,1,1],renderOrder:3}),e.content&&void 0!==e.type&&(i=wc.getInstance(t).getContent(e.type,e.content)),super(t,e,new xc(t,e,i)),this.map=t,this.data.node=this,this.entity.renderOrder=e.renderOrder,this.contentConfig=i,this.pickIndex=10,this.alpha=0,this.targetAlpha=0,this.rect=new bc,this.setTransform(),this.autoHide=e.autoHide,this.visible=!0,!1===this.autoHide&&this.markerShow(),this.type="SpriteMarkerNode",this.class="SpriteMarkerNode"}get markerType(){return this.data.type}set markerType(t){this.data.type=t,this.refresh()}setTransform(){this.position=this.data.position,this.scale=this.data.scale}setData(t){t=Object.assign({type:"imageLeft",anchor:"bottom",minLevel:16,maxLevel:23,position:[0,0,0],scale:[1,1,1]},t),this.contentConfig=wc.getInstance(this.map).getContent(t.type,t.content),this.entity.setContent(this.contentConfig)}refresh(){this.setData(this.data)}get autoHide(){return void 0===this.data.autoHide||this.data.autoHide}set autoHide(t){this.data.autoHide=t}get anchor(){return this.data.anchor}set anchor(t){this.data.anchor=t,this.entity.setAnchor(t)}get priority(){return this.data.priority||0}set priority(t){this.data.priority=t}get tag(){return this.data.tag||""}set tag(t){this.data.tag=t}get renderOrder(){return this.entity.renderOrder}set renderOrder(t){this.entity.renderOrder=t}get position(){if(this.entity)return this.entity.originPosition}set position(t){t instanceof Lt&&(t=t.toArray()),this.data.position=t,this.entity&&(this.entity.originPosition.fromArray(t),this.entity._updateAnchor(),this.entity.fixedSize&&(this.entity._updateSize(),this.entity._updateAnchor()))}get x(){if(this.entity)return this.entity.originPosition.x}set x(t){this.data.position[0]=t,this.entity&&(this.entity.originPosition.x=t),this.data.point&&(this.data.point.x=t)}get y(){if(this.entity)return this.entity.originPosition.y}set y(t){this.data.position[1]=t,this.entity&&(this.entity.originPosition.y=t),this.data.point&&(this.data.point.y=t)}get z(){if(this.entity)return this.entity.originPosition.z}set z(t){this.data.position[2]=t,this.entity&&(this.entity.originPosition.z=t),this.data.point&&(this.data.point.z=t)}get scale(){if(this.entity)return this.entity.originScale}set scale(t){this.data.scale=t,this.entity&&this.entity.originScale.fromArray(t)}get scaleX(){if(this.entity)return this.entity.originScale.x}set scaleX(t){this.data.scale[0]=t,this.entity&&(this.entity.originScale.x=t)}get scaleY(){if(this.entity)return this.entity.originScale.y}set scaleY(t){this.data.scale[1]=t,this.entity&&(this.entity.originScale.y=t)}get scaleZ(){if(this.entity)return this.entity.originScale.z}set scaleZ(t){this.data.scale[2]=t,this.entity&&(this.entity.originScale.z=t)}clone(t){var e=this.getDataClone();"function"==typeof t?t(e):"object"==typeof t&&Object.assign(e,t);var i=new this.constructor(this.map,e,kh.cloneJSON(this.contentConfig));return i.data.id=kh.generateID().toLowerCase(),this.parent?this.parent.add(i):this.entity.parent&&this.entity.parent.add(i.entity),i.position.copy(this.entity.originPosition),i.entity.update(),this.data.point&&(i.data.point=this.data.point.clone()),i}updateRect(){var t=new Lt;this.entity.getWorldPosition(t);var e=kh.sceneToScreen(this.map,t),i=this.entity.width*this.entity.originScale.x*.9,n=this.entity.height*this.entity.originScale.y*.9;this.rect.x=e.x-i/2,this.rect.y=e.y-n/2,this.rect.width=i,this.rect.height=n}setImage(t){var e="",i=typeof t;return"object"===i?t.url&&(e=t.url):"string"===i&&(e=t,this.data.content.image.url?this.data.content.image.url=e:this.data.content.image=e),e&&(e=kh.getResourceUrl(this.map,null,e,!0)),this.entity&&this.entity.updateContent({type:"image",name:"image",value:e}),this}setImageSize(t,e){this.data.content.image&&t&&(e||(e=t),this.data.content.image.width=t,this.data.content.image.height=e,this.refresh())}setText(t,e){e=e||0;var i=this.data.content.texts;if(i){var n=i[e];return"object"!=typeof n?i[e]=t:n.text=t,this.entity&&this.entity.updateContent({type:"text",name:"text_"+e,value:t}),this}}updateFrame(t){return this.entity&&this.entity.updateContent({type:"frame",name:"frame",value:t}),this}setTextColor(t,e,i){var n=null,r=this.data.content.texts;if(void 0!==i){n="text_"+i;var a=r[i];"string"==typeof a&&(r[i]={text:a},t&&(r[i].color=t),e&&(r[i].strokeColor=e))}else r.forEach((i,n)=>{"string"==typeof i&&(i={text:i},r[n]=i),t&&(i.color=t),e&&(i.strokeColor=e)});this.entity&&this.entity.updateContent({type:"textColor",name:n,color:t,strokeColor:e})}updateContent(t){return this.entity.updateContent(t)}getTextString(){var t,e="";if(!this.data.content.texts)return"";var i=this.data.content.texts.length;return this.data.content.texts.forEach((n,r)=>{t="","string"==typeof n?e+=n:(n.strokeColor&&(t=","+n.strokeColor),n.color&&(t=n.color+t),t.length&&(t=","+t),n.align&&(t=n.align+t),t.length&&(t=","+t),n.size&&(t=n.size+t),t.length&&(t=","+t),t=n.text+t,e+=t),r!==i-1&&(e+="\n")}),e}getTextArray(){return this.getTextString().split("\n").map(t=>t.split(",")[0])}toTargetAlpha(t){var e=this.entity.material.opacity;if(e!==this.targetAlpha){var i=Math.sign(this.targetAlpha-e);this.alpha=e+i*t,(i>0&&this.alpha>=this.targetAlpha||i<0&&this.alpha<=this.targetAlpha)&&(this.alpha=this.targetAlpha),this.entity.material.opacity=this.alpha}}markerShow(){var t=1;this.parent&&this.parent.parent&&"OMFloor"===this.parent.parent.type&&this.parent.parent._isFadeOut&&this.map.config.enableFloorAlpha&&(t=this.map.config.fadeOutAlpha),this.targetAlpha=t,this.pickabled=!0,this._markerShow=!0}markerHide(){this.targetAlpha=0,this.pickabled=!1,this._markerShow=!1}update(t){this.parent&&!this.parent.show||(this.entity.update(),this.entity.imageLoaded&&this.toTargetAlpha(5*t))}flash(t){t=Object.assign({duration:400},t),this._flashAnm&&this._flashAnm.stop();var e=this.priority,i=this.autoHide;return this.priority=100,this.autoHide=!1,this.targetAlpha=1,this._flashAnm=new wh.Tween(this.entity).to({originScale:(new Lt).setScalar(t.scale||1.6),props:["originScale"]},.6*t.duration).onComplete(()=>{this._flashAnm=new wh.Tween(this.entity).to({originScale:(new Lt).setScalar(1),props:["originScale"]},.4*t.duration).onComplete(()=>{this.priority=e,this.autoHide=i}).start()}).start(),this}}var Sc={id:"",url:"",imageID:null,type:"",content:{},minLevel:16,maxLevel:24,autoHide:!1,size:null,scale:1,x:null,y:null,w:null,h:null,position:null,fixedSize:!1,onload:null,resizeByContent:!1,transform:{position:[0,0,0],rotation:[0,0,0],scale:[5,5,1]},tag:""};class Ac extends al{constructor(t,e){var i=new Qe(Ac.PLANE_GEO,Ac.PLANE_MAT.clone());i.material.visible=!1,kh.assign(e,Sc),super(t,e,i),this.data.node=this,this.entity.renderOrder=1,this.fixedSize=e.fixedSize||!1,e.size&&Array.isArray(e.size)&&(this.data.transform.scale[0]=e.size[0]||5,this.data.transform.scale[1]=e.size[1]||5,this.data.transform.scale[2]=e.size[2]||1),this.size=this.data.transform.scale,e.position&&(this.data.transform.position[0]=e.position.x||e.position[0]||0,this.data.transform.position[1]=e.position.y||e.position[1]||0,this.data.transform.position[2]=e.position.z||e.position[2]||0),this.type=this.class="PlaneMarkerNode",this.setData(e),this.zoomLevelChangedOff=this.map.on("zoomLevelChanged",()=>{this._checkVisible()}),this._checkVisible()}_checkVisible(){if(this.data.autoHide){var t=this.map.view.zoomLevel;this.visible=t>=this.data.minLevel&&t<this.data.maxLevel}}get size(){return this.data.transform.scale}set size(t){"number"==typeof t&&(t=[t,t]),this.data.transform.scale[0]=t[0]||5,this.data.transform.scale[1]=t[1]||5,this.entity.scale.x=t[0]||5,this.entity.scale.y=t[1]||5}get angle(){return this.entity.rotation.z*Mt.RAD2DEG*1}set angle(t){this.entity.rotation.z=t*Mt.DEG2RAD*1}getData(){return this.data.transform.position=this.entity.position.toArray(),this.getDataClone()}setImage(t){if(t){this.data.imageID=t;var e=kh.getResourceUrl(this.map,null,t,!0);kh.loadTexture(e,t=>{this.entity.material.map&&this.entity.material.map.dispose(),this.entity.material.map=t,this.entity.material.visible=!0,null!==this.data.x&&void 0!==this.data.x&&this.setSpriteSheet(this.data),this.entity.material.needsUpdate=!0,this.data.onLoad&&(this.data.onLoad(this),delete this.data.onLoad)})}}getTextString(){return Mc.prototype.getTextString.call(this)}getTextData(t){return Mc.prototype.getTextData.call(this,t)}getFrameData(t){return Mc.prototype.getFrameData.call(this,t)}getFrameString(){return Mc.prototype.getFrameString.call(this)}updateContent(t){this.setData(t)}canvasImage(){var t;this.data.type&&this.data.content&&(t=wc.getInstance(this.map).getContent(this.data.type,this.data.content));var e=new sc(this.map,t,null,this.map.config.canvas2d?this.map.config.canvas2d.getContext("2d"):null);this.markerPainter=e,e.init(t=>{var i=this.data.fixedSize?1:this.data.scale||1;Array.isArray(i)&&(i=i[0]);var n=e.width,r=e.height;if(this.data.size=this.data.size||Math.max(this.size[0],this.size[1]),this.data.size)if("number"==typeof this.data.size){var a=n/r;n>r?r=(n=this.data.size)/a:n=(r=this.data.size)*a}else n=this.data.size[0],r=this.data.size[1];let o=n*i,s=r*i;if(this.data.resizeByContent){let t=e.width/e.height;e.width>=e.height?s=o/t:o=s*t}this.size=[o,s];var h=this.entity.material;h.map?(h.map instanceof dr&&h.map.dispose(),h.map.image=t):h.map=yc(t,t=>{xc.prototype._updateTexture.call(this.entity)}),h.map.needsUpdate=!0,h.visible=!0})}setData(t){t=this.data=Object.assign(this.data,t),this.setTransform(),this.data.type&&this.data.content&&(this.data.content.image||this.data.content.texts)?this.canvasImage():(this.data.imageID||(this.data.imageID=this.data.url),this.data.imageID&&this.setImage(this.data.imageID))}refresh(){this.setData(this.data)}getScale(){if(!this.map||!this.entity)return 1;var t=new Lt;return this.entity.getWorldPosition(t),kh.getZoomFactor(this.map,t)}setSize(t,e){this.size=[t,e]}setSpriteSheet(t){var e=this.entity.material.map;if(e&&e.image){var i=e.image.width,n=e.image.height;e.wrapS=e.wrapT=1e3,e.offset.x=t.x/i,e.offset.y=1-(t.y+t.h)/n,e.repeat.x=t.w/i,e.repeat.y=t.h/n}}clone(){var t=this.getDataClone(),e=new this.constructor(this.map,t);return e.data.id=kh.generateID().toLowerCase(),this.parent?this.parent.add(e):this.entity.parent&&this.entity.parent.add(e.entity),e}update(){if(this.fixedSize){var t=this.getScale(),e=this.size;this.entity.scale.set(e[0]*t,e[1]*t,e[2]*t)}}moveTo(t){var e=t.position;Array.isArray(e)&&(e=(new Lt).fromArray(e)),e&&void 0!==e.x&&void 0!==e.y&&(e instanceof Lt||(e.z=e.z||0,e=(new Lt).copy(e)),this._anim&&this._anim.stop(),this._anim=new wh.Tween(this.entity).to({position:e},t.duration||600).onComplete(()=>{t.callback&&t.callback()}).start())}dispose(){this.block&&this.block.removeTopImage(this),this.zoomLevelChangedOff&&this.zoomLevelChangedOff(),super.dispose()}}Ac.PLANE_GEO=new Ne(1,1,1,1),Ac.PLANE_MAT=new Ke({transparent:!0});class Tc{constructor(t){this.map=t,this.queue=[],this.count=0}create(t){if(t.markerNode){var e=kh.cloneJSON(t.data.markers);e&&e.length&&e.forEach(e=>{if(t.markerNode){var i=null;e.anchor?i=new Mc(this.map,e):e.imageID&&(i=new Ac(this.map,e)),i&&t.markerNode.add(i,!1)}})}}createSingleBuffer(t,e){return this.queue.push({data:t,node:e}),clearTimeout(this._id),this._id=setTimeout(()=>{this.createOneByOne()},30),!0}createOneByOne(){this.queue.splice(0,20).forEach(t=>{this.createSingle(t.data,t.node)}),this.queue.length&&setTimeout(()=>{this.createOneByOne()},30)}createSingle(t,e){var i=null;if(this.map.emit("markerData",t),this.map.emit("nodeData",t),t.anchor?i=new Mc(this.map,t):(t.imageID||t.content)&&(i=new Ac(this.map,t)),i){e.add(i,!1),i.entity.renderOrder=t.content?3:2;var n=this;return i.data.onLoad=function(t){if("OMFloor"===e.parent.type&&e.parent._isFadeOut&&n.map.config.enableFloorAlpha){var i=t.entity.material;i._originAlpha=i.opacity,i.opacity=n.map.config.fadeOutAlpha}},this.map.emit("markerCreated",i),this.map.emit("nodeCreated",i),i}}}var Lc={computeTangents:function(t){var e=t.index,i=t.attributes;if(null!==e&&void 0!==i.position&&void 0!==i.normal&&void 0!==i.uv){var n=e.array,r=i.position.array,a=i.normal.array,o=i.uv.array,s=r.length/3;void 0===i.tangent&&t.addAttribute("tangent",new ve(new Float32Array(4*s),4));for(var h=i.tangent.array,l=[],c=[],u=0;u<s;u++)l[u]=new Lt,c[u]=new Lt;var d=new Lt,p=new Lt,f=new Lt,m=new St,g=new St,v=new St,y=new Lt,x=new Lt,b=t.groups;0===b.length&&(b=[{start:0,count:n.length}]),u=0;for(var w=b.length;u<w;++u)for(var _=I=(D=b[u]).start,M=I+D.count;_<M;_+=3)O(n[_+0],n[_+1],n[_+2]);var S,A,T,L=new Lt,C=new Lt,P=new Lt,E=new Lt;for(u=0,w=b.length;u<w;++u){var D,I;for(_=I=(D=b[u]).start,M=I+D.count;_<M;_+=3)N(n[_+0]),N(n[_+1]),N(n[_+2])}}function O(t,e,i){d.fromArray(r,3*t),p.fromArray(r,3*e),f.fromArray(r,3*i),m.fromArray(o,2*t),g.fromArray(o,2*e),v.fromArray(o,2*i);var n=p.x-d.x,a=f.x-d.x,s=p.y-d.y,h=f.y-d.y,u=p.z-d.z,b=f.z-d.z,w=g.x-m.x,_=v.x-m.x,M=g.y-m.y,S=v.y-m.y,A=1/(w*S-_*M);y.set((S*n-M*a)*A,(S*s-M*h)*A,(S*u-M*b)*A),x.set((w*a-_*n)*A,(w*h-_*s)*A,(w*b-_*u)*A),l[t].add(y),l[e].add(y),l[i].add(y),c[t].add(x),c[e].add(x),c[i].add(x)}function N(t){P.fromArray(a,3*t),E.copy(P),A=l[t],L.copy(A),L.sub(P.multiplyScalar(P.dot(A))).normalize(),C.crossVectors(E,A),T=C.dot(c[t]),S=T<0?-1:1,h[4*t]=L.x,h[4*t+1]=L.y,h[4*t+2]=L.z,h[4*t+3]=S}},kaoo:function(t){for(var e=t.map(t=>t.groups),i=e.length,n=e[0].length,r=0,a=[],o=[],s=0,h=0;h<n;h++){var l=t[0].mergedData;if(l){if(a[h]=l[h],0===h){var c=l[h].length;r=l[h][c-1][0]+l[h][c-1][1]}s=1}else s=0,a[h]=[];for(var u=s;u<i;u++){var d=e[u][h];h>0&&u===s&&l&&a[h].forEach(t=>{t[0]=r,r+=t[1]}),a[h].push([r,d.count]),r+=d.count}var p=a[h][0][0];o.push({start:p,count:r-p,materialIndex:e[0][h].materialIndex})}return{mergedData:a,mergedGroups:o}},mergeBufferGeometries:function(t,e){var i,n=null!==t[0].index,r=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),o={},s={},h=null,l=t[0].groups&&t[0].groups.length>1;l&&(h=[],i=this.kaoo(t));for(var c=new Ee,u=0,d=0;d<t.length;++d){var p=t[d];if(n!==(null!==p.index))return null;for(var f in p.attributes){if(!r.has(f))return null;void 0===o[f]&&(o[f]=[]),o[f].push(p.attributes[f])}for(var f in l&&h.push(p.groups),p.morphAttributes){if(!a.has(f))return null;void 0===s[f]&&(s[f]=[]),s[f].push(p.morphAttributes[f])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(p.userData),e){var m;if(n)m=p.index.count;else{if(void 0===p.attributes.position)return null;m=p.attributes.position.count}c.addGroup(u,m,d),u+=m}}if(n){var g=0,v=[];for(d=0;d<t.length;++d){for(var y=t[d].index,x=0;x<y.count;++x)v.push(y.getX(x)+g);g+=t[d].attributes.position.count}c.setIndex(v)}for(var f in o){var b=this.mergeBufferAttributes(o[f],h,i);if(!b)return null;c.addAttribute(f,b)}for(var f in s){var w=s[f][0].length;if(0===w)break;for(c.morphAttributes=c.morphAttributes||{},c.morphAttributes[f]=[],d=0;d<w;++d){var _=[];for(x=0;x<s[f].length;++x)_.push(s[f][x][d]);var M=this.mergeBufferAttributes(_);if(!M)return null;c.morphAttributes[f].push(M)}}return i&&(c.groups=i.mergedGroups,c.mergedData=i.mergedData),c},mergeBufferAttributes:function(t,e,i){for(var n,r,a,o=0,s=0;s<t.length;++s){var h=t[s];if(h.isInterleavedBufferAttribute)return null;if(void 0===n&&(n=h.array.constructor),n!==h.array.constructor)return null;if(void 0===r&&(r=h.itemSize),r!==h.itemSize)return null;if(void 0===a&&(a=h.normalized),a!==h.normalized)return null;o+=h.array.length}var l=new n(o),c=0,u=[];for(e&&(u=i.mergedGroups.map(t=>t.start)),s=0;s<t.length;s++){if(e){var d=e[s];u.forEach((e,i)=>{var n=d[i];l.set(t[s].array.slice(n.start*r,(n.start+n.count)*r),e*r),u[i]=u[i]+n.count})}else l.set(t[s].array,c);c+=t[s].array.length}return new ve(l,r,a)}};function Cc(t,e){if(!(this instanceof Cc))return new Cc(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||Pc,this.length>0)for(var i=this.length>>1;i>=0;i--)this._down(i)}function Pc(t,e){return t<e?-1:t>e?1:0}Cc.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,i=this.compare,n=e[t];t>0;){var r=t-1>>1,a=e[r];if(i(n,a)>=0)break;e[t]=a,t=r}e[t]=n},_down:function(t){for(var e=this.data,i=this.compare,n=this.length,r=n>>1,a=e[t];t<r;){var o=1+(t<<1),s=o+1,h=e[o];if(s<n&&i(e[s],h)<0&&(o=s,h=e[s]),i(h,a)>=0)break;e[t]=h,t=o}e[t]=a}};var Ec=Cc;function Dc(t,e){return e.max-t.max}function Ic(t,e,i,n){this.x=t,this.y=e,this.h=i,this.d=function(t,e,i){for(var n=!1,r=1/0,a=0;a<i.length;a++)for(var o=i[a],s=0,h=o.length,l=h-1;s<h;l=s++){var c=o[s],u=o[l];c[1]>e!=u[1]>e&&t<(u[0]-c[0])*(e-c[1])/(u[1]-c[1])+c[0]&&(n=!n),r=Math.min(r,Oc(t,e,c,u))}return(n?1:-1)*Math.sqrt(r)}(t,e,n),this.max=this.d+this.h*Math.SQRT2}function Oc(t,e,i,n){var r=i[0],a=i[1],o=n[0]-r,s=n[1]-a;if(0!==o||0!==s){var h=((t-r)*o+(e-a)*s)/(o*o+s*s);h>1?(r=n[0],a=n[1]):h>0&&(r+=o*h,a+=s*h)}return(o=t-r)*o+(s=e-a)*s}var Nc=function(t,e,i){var n,r,a,o;e=e||1;for(var s=0;s<t[0].length;s++){var h=t[0][s];(!s||h[0]<n)&&(n=h[0]),(!s||h[1]<r)&&(r=h[1]),(!s||h[0]>a)&&(a=h[0]),(!s||h[1]>o)&&(o=h[1])}var l=a-n,c=o-r,u=Math.min(l,c),d=u/2,p=new Ec(null,Dc);if(0===u)return[n,r];for(var f=n;f<a;f+=u)for(var m=r;m<o;m+=u)p.push(new Ic(f+d,m+d,d,t));var g=function(t){for(var e=0,i=0,n=0,r=t[0],a=0,o=r.length,s=o-1;a<o;s=a++){var h=r[a],l=r[s],c=h[0]*l[1]-l[0]*h[1];i+=(h[0]+l[0])*c,n+=(h[1]+l[1])*c,e+=3*c}return 0===e?new Ic(r[0][0],r[0][1],0,t):new Ic(i/e,n/e,0,t)}(t),v=new Ic(n+l/2,r+c/2,0,t);for(v.d>g.d&&(g=v),p.length;p.length;){var y=p.pop();y.d>g.d&&(g=y),y.max-g.d<=e||(d=y.h/2,p.push(new Ic(y.x-d,y.y-d,d,t)),p.push(new Ic(y.x+d,y.y-d,d,t)),p.push(new Ic(y.x-d,y.y+d,d,t)),p.push(new Ic(y.x+d,y.y+d,d,t)))}return{x:g.x,y:g.y,radius:g.d}},kc=new class{constructor(){this.map=null,this.ctx=null}setData(t,e){this.map=t,this.ctx=e.getContext("2d")}get canvas(){return this.ctx.canvas}_getTexture(){var t=new Nt,e=document.createElement("img");return e.src=this.ctx.canvas.toDataURL("image/png"),e.onload=function(){t.image=e,t.needsUpdate=!0,e.onload=null},t}_setSize(t=128){this.canvas.width=t,this.canvas.height=t}drawWallTexture(){this._setSize();var t=this.ctx.createLinearGradient(0,0,0,128);t.addColorStop(0,"#dfe5e7"),t.addColorStop(1,"#8e9294"),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,128,128)}get wallTexture(){return this.drawWallTexture(),this._getTexture()}drawGradientAlpha(){this._setSize();var t=this.ctx.createLinearGradient(0,0,0,128);t.addColorStop(0,"rgba(255,255,255,0)"),t.addColorStop(.9,"rgba(255,255,255,1)"),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,128,128)}get gradientAlpha(){return this.drawGradientAlpha(),this._getTexture()}},zc={generateTopUV:function(t,e,i,n,r){var a=e[3*i],o=e[3*i+1],s=e[3*n],h=e[3*n+1],l=e[3*r],c=e[3*r+1];return[new St(a,o).divideScalar(5),new St(s,h).divideScalar(5),new St(l,c).divideScalar(5)]},generateSideWallUV:function(t,e,i,n,r,a){var o=e[3*i],s=e[3*i+1],h=e[3*i+2],l=e[3*n],c=e[3*n+1],u=e[3*n+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*a],g=e[3*a+1],v=e[3*a+2];return Math.abs(o-l)<.01?[new St(s/5,h/2),new St(c/5,u/2),new St(p/5,f/2),new St(g/5,v/2)]:[new St(o/5,h/2),new St(l/5,u/2),new St(d/5,f/2),new St(m/5,v/2)]}},Rc={generateTopUV:zc.generateTopUV,generateSideWallUV:function(t,e,i,n,r,a){var o=e[3*i],s=e[3*i+1];e[3*i+2];var h=e[3*n],l=e[3*n+1];e[3*n+2];var c=e[3*r],u=e[3*r+1];e[3*r+2];var d=e[3*a],p=e[3*a+1];return e[3*a+2],Math.abs(o-h)<.01?[new St(s/5,0),new St(l/5,0),new St(u/5,1),new St(p/5,1)]:[new St(o/5,0),new St(h/5,0),new St(c/5,1),new St(d/5,1)]}},Bc=null,Fc="1015",Uc={id:"",imageID:null,transform:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]}},Gc={id:-1,name:"",points:[],noHole:!1,typeID:1e3,minLevel:10,maxLevel:24,userData:{},tag:"",topImages:[],entrances:[]};class jc extends al{constructor(t,e,i){super(t,e=e||kh.cloneJSON(Gc)),this.data.node=this,this.style=null,this.borderLine=null,this.parentNode=i;let n=this.getType();n&&!1===n.mergable&&(this.parentNode=void 0),this.build(),this.type="OMBlock",this.class="OMBlock",["color","alpha","height"].forEach(t=>{t in this.data&&this[`set${kh.capWord(t)}`](this.data[t])})}get noHole(){return this.data.noHole||this.data.userData.noHole}get area(){var t=this.getArea(this.data.points[0]);if(this.data.points.length>1)for(var e=1;e<this.data.points.length;e++)t-=this.getArea(this.data.points[e]);return t}getCenter(){return this._centerVector||(this._centerVector=(new Lt).fromArray(this.center)),this._centerVector}getArea(t,e){var i=t;if(i.length<3)return 0;var n,r,a=i.length,o=0;e?(n="x",r="y"):(n=0,r=1);for(var s=a-1,h=0;h<a;s=h++)o+=i[s][n]*i[h][r]-i[h][n]*i[s][r];return Math.abs(.5*o)}getData(){this.data.topImages=[];var t=this.getDataClone();return t.topImages=[],this.children.forEach(e=>{t.topImages.push(e.getData())}),t}toCenter(t){if(!this.data.points.length)return;this.centerPoints=kh.cloneJSON(this.data.points);let e=this.centerPoints.reduce((t,e)=>{let i=e.reduce((t,e)=>(t[0]+=e[0],t[1]+=e[1],t[2]+=e[2],t),[0,0,0]),n=e.length;return i[0]/=n,i[1]/=n,i[2]/=n,t[0]+=i[0],t[1]+=i[1],t[2]+=i[2],t},[0,0,0]);var i=this.centerPoints.length;e[0]/=i,e[1]/=i,e[2]/=i;var n=t?t.center:e;this.centerPoints.forEach(t=>{t.forEach(t=>{t[0]-=n[0],t[1]-=n[1],t[2]-=n[2]})}),this.center=e}build(t,e){var i;Array.isArray(t)?this.data.points=t:t&&(this.data=t);var n=!1;this.parentNode&&(this.baseNode=i=this.parentNode.getBlockByTypeID(this.data.typeID),i||(n=!0));var r=this.getStyle();if(this.toCenter(i),this.centerPoints.length&&this.centerPoints[0].length){var a=null,o=[];if(this.noHole?(o=this.centerPoints.map(t=>t.map(t=>(new Lt).fromArray(t))),a=o.map(t=>new Oo(t))):this.centerPoints.forEach((t,e)=>{var i=t.map(t=>(new Lt).fromArray(t));0===e?a=new Oo(i):a.holes.push(new Io(i)),o.push(i)}),a){var s,h=null;if(Array.isArray(a)){let t=a.map(t=>new aa(t,{depth:1,bevelEnabled:!1,UVGenerator:this.data.typeID==Fc?Rc:zc}));h=Lc.mergeBufferGeometries(t),t.forEach(t=>t.dispose())}else h=new aa(a,{depth:1,bevelEnabled:!1,UVGenerator:this.data.typeID==Fc?Rc:zc});h.computeBoundingSphere(),"1015"===this.data.typeID&&(h.attributes.uv2=h.attributes.uv),"Object3D"===this.entity.type?(i?(jc.pushToMerge(i,h,this,this.parentNode),s=i.entity):s=new Qe(h,new Na({transparent:!0})),this.setEntity(s),n&&this.parentNode.setBlockByTypeID(this.data.typeID,this)):(this.entity.geometry.dispose(),this.entity.geometry=h)}r.noBorder?this.disposeBorderLine():this.buildBorder(o),this.data.topImages&&(!e||e&&!1!==e.buildTopImage)&&this.buildTopImages(this.data.topImages),this.baseNode||(this.position.fromArray(this.center),this.updateStyle(r))}}fillLineGeo(t,e){var i=new Float32Array(3*e.length);e.forEach((t,e)=>{var n=3*e;i[n]=t.x,i[n+1]=t.y,i[n+2]=t.z});var n=t.geometry.getAttribute("position");n?n.setArray(i):t.geometry.addAttribute("position",new ve(i,3)),t.geometry.attributes.position.needsUpdate=!0,t.geometry.computeBoundingSphere()}getLineGeoByVs(t){var e=new Ee,i=2*t.length*3,n=new Float32Array(i);t.forEach((t,e)=>{if(0===e)n[0]=t.x,n[1]=t.y,n[2]=t.z;else{var i=6*e-3;n[i]=t.x,n[i+1]=t.y,n[i+2]=t.z,n[i+3]=t.x,n[i+4]=t.y,n[i+5]=t.z}}),n[i-3]=t[0].x,n[i-2]=t[0].y,n[i-1]=t[0].z;var r=e.getAttribute("position");return r?r.setArray(n):e.addAttribute("position",new ve(n,3)),e}buildBorder(t){this.disposeBorderLine();var e,i=[];this.baseNode&&i.push(this.baseNode.borderLine.geometry),t.forEach(t=>{i.push(this.getLineGeoByVs(t))});for(var n=Lc.mergeBufferGeometries(i),r=1;r<i.length;r++)i[r].dispose();return this.baseNode?(this.baseNode.borderLine.geometry=n,this.borderLine=this.baseNode.borderLine):(e=new rr({transparent:!0}),this.borderLine=new or(n,e),this.entity.add(this.borderLine),this.borderLine.position.z=1.01,this.borderLine.renderOrder=this.entity.renderOrder+1),this.borderLine}buildTopImages(t){t.forEach(t=>{t.transform.position;var e=new Ac(this.map,t);this.baseNode&&e.entity.position.add(this.getCenter()).sub(this.baseNode.entity.position),e.pickabled=!1,e.entity.renderOrder=2,e.block=this,this.add(e),e.entity.position.z=1.01})}removeTopImages(){this.children.forEach(t=>{t.dispose()}),this.data.topImages&&(this.data.topImages.length=0)}addTopImage(t){if("string"==typeof t){var e=kh.cloneJSON(Uc);e.imageID=t,t=e}"transfrom"in t||(t.transform={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]});var i=this.getMaxArea();t.transform.position[0]=i.x-this.center[0],t.transform.position[1]=i.y-this.center[1],t.transform.position[2]=1.01;var n=t.transform.scale;n[0]=n[1]=n[2]=i.radius;var r=new Ac(this.map,t);return r.pickabled=!1,r.block=this,this.data.topImages||(this.data.topImages=[]),this.add(r),this.data.topImages.push(r.data),r}removeTopImage(t){if(this.children.length){this.children.splice(this.children.indexOf(t),1);for(var e=-1,i=0;i<this.data.topImages.length;i++)if(this.data.topImages[i].id===t.data.id)return void(e=i);e>-1&&this.data.topImages.splice(e,1),t.dispose()}}disposeBorderLine(){this.borderLine&&(this.entity.remove(this.borderLine),this.borderLine.material.dispose(),this.borderLine.geometry.dispose(),this.borderLine.children.forEach(t=>{t.geometry.dispose()}),this.borderLine=null)}getType(){return this.map.omScene.theme.data.typeIDs[this.data.typeID]}getStyle(t){return this.map.omScene.theme.getBlockStyleByTypeID(t||this.data.typeID)}setType(t){this.data.typeID=t,this.updateStyle()}setHeight(t){void 0!==t&&(this.height=t)}get height(){return this.entity.scale.z}set height(t){this.entity.scale.z=t,t<=(this.map.config.blockHideSideHeight||.1)?this.entity.geometry.drawRange.count=this.entity.geometry.groups[0].count:this.entity.geometry.drawRange.count=1/0}setColor(t,e){t&&(kh.setMaterialColor(this.entity.material,t,this.map),e&&this.borderLine&&this.borderLine.material.color.set(e))}setAlpha(t){this.entity.material.opacity=t}updateStyle(t){if(this.style=t||this.getStyle(),this.data.typeID==Fc){if(Bc||(Bc=kc.wallTexture),this._lastTypeID!=Fc){var e=this.entity.material;this.entity.material=[e,e.clone()]}(e=this.entity.material)[1].lightMap=Bc,e[1].lightMapIntensity=.4,e[0].color.set("#333"),e[1].color.set("#ddd"),e[0].emissive.set("#333"),e[1].emissive.setScalar(0),e[0].transparent=!1,e[1].transparent=!1,e[1].needsUpdate=!0,this.data.pickabled=!1}else this._lastTypeID==Fc&&(this.entity.material=this.entity.material[0],this.entity.material.transparent=!0),this.data.pickabled=void 0,kh.setMaterialColor(this.entity.material,this.style.color,this.map),this.entity.material.opacity=this.style.alpha;this.height=this._lastHeight=this.style.blockHeight||1,this.entity.position.z=this.style.height||0,this.borderLine&&this.borderLine.material.color.set(this.style.borderColor),this._lastTypeID=this.data.typeID}getMaxArea(){return Nc(this.data.points)}changeType(t){t=t||this.data.typeID;var e=this.map.omScene.theme;this.data.typeID=t,e.data.typeIDs[t]||(t=1e3),this.updateStyle(this.getStyle(t))}flashHeight(t){return t=Object.assign({duration:700},t),this._flashAnm&&(this._flashAnm.stop(),this._lastHeight&&(this.height=this._lastHeight)),this._lastHeight=this.height,this._flashAnm=new wh.Tween(this).to({height:(t.scale||2.8)*this._lastHeight,props:["height"]},.6*t.duration).onComplete(()=>{this._flashAnm=new wh.Tween(this).to({height:this._lastHeight,props:["height"]},.4*t.duration).start()}).start(),this}containPoint(t,e){e=e||this.data.points;for(var i=t.x,n=t.y,r=!1,a=e.length,o=0,s=a-1;o<a;s=o++){var h=e[o].x,l=e[o].y,c=e[s].x,u=e[s].y;l>n!=u>n&&i<(c-h)*(n-l)/(u-l)+h&&(r=!r)}return r}dispose(){this.centerPoints.length=0,this.center=null,this.disposeBorderLine(),this.removeTopImages(),super.dispose()}}jc.startToMerge=function(){jc.mergeSet&&(clearTimeout(jc.mergeID),jc.mergeID=setTimeout(()=>{Object.keys(jc.mergeSet).forEach(t=>{var e=jc.mergeSet[t],i=e.baseNode.entity.geometry.shareNodes||[],n=e.map(t=>t.geo),r=Lc.mergeBufferGeometries(n,!1);i.length&&e.shift();var a=r.mergedData;a.length;for(var o=1,s=e.length-1;s>-1;s--){for(var h=e[s],l=[],c=0;c<a.length;c++)l.push(a[c][a[c].length-o]);h.node.faceIndex=l,o++}for(s=0;s<n.length;s++)n[s].dispose();e.baseNode.entity.geometry=r,Array.prototype.push.apply(i,e.map(t=>t.node)),r.shareNodes=i,e.baseNode.updateStyle(),delete jc.mergeSet[t]})},200))},jc.pushToMerge=function(t,e,i,n){jc.mergeSet||(jc.mergeSet={});var r=`${n.id}-${t.id}`;jc.mergeSet[r]||(jc.mergeSet[r]=[{geo:t.entity.geometry,node:t}],jc.mergeSet[r].baseNode=t),jc.mergeSet[r].push({geo:e,node:i}),jc.startToMerge()};class Vc{constructor(t){this.map=t}create(t){if(t.blockNode){var e=t.data.blocks;e&&e.length&&e.forEach(e=>{var i=new jc(this.map,e);t.blockNode.add(i,!1)})}}createSingle(t,e){this.map.emit("blockData",t),this.map.emit("nodeData",t);var i=this.map.config.mergeSameTypeBlocks?e.parent:null,n=new jc(this.map,t,i);if(e.add(n,!1),n.entity.getWorldPosition(n.data.boundingSphere.center),"OMFloor"===e.parent.type&&("1001"===n.data.typeID&&e.parent.floorBlocks.push(n),e.parent._isFadeOut&&this.map.config.enableFloorAlpha)){var r=n.entity.material;r._originAlpha=r.opacity,r.opacity=this.map.config.fadeOutAlpha,n.children.forEach(t=>{var e=t.entity.material;e._originAlpha=e.opacity,e.opacity=this.map.config.fadeOutAlpha})}return this.map.emit("blockCreated",n),this.map.emit("nodeCreated",n),n}}class Wc{constructor(){}create(t){t.route&&t.data.route&&t.route.createByData(t.data.route,t.editorData?t.editorData.roadSegments:null)}}var Hc=null;function Xc(t){return Hc&&Hc.modelsCreator.map.id===t.id?Hc:Hc={modelsCreator:new Ql(t),markersCreator:new Tc(t),blocksCreator:new Vc(t),routeCreator:new Wc(t)}}var qc={themeID:"",name:"",version:1,default:{anchor:"bottom",fontSize:14,imageWidth:20,imageHeight:20,blockColor:"#dddddd",blockHeight:2,blockAlpha:.9},_markerID:5,_styleID:200,_typeID:1100,background:{color:"#282a35",alpha:1},typeIDs:{1e3:{name:"默认类型",styleID:"100",mergable:!0},1001:{name:"楼板",styleID:"101"},1002:{name:"类型2",styleID:"102"},1003:{name:"类型3",styleID:"103"},1004:{name:"类型4",styleID:"104"},1005:{name:"类型5",styleID:"105"},1006:{name:"类型6",styleID:"106"},1007:{name:"类型7",styleID:"107"},1008:{name:"类型8",styleID:"108"},1009:{name:"类型9",styleID:"109"},1010:{name:"类型10",styleID:"110"},1011:{name:"类型11",styleID:"111"},1012:{name:"类型12",styleID:"112"},1013:{name:"类型13",styleID:"113"},1014:{name:"类型14",styleID:"114"},1015:{name:"室内墙体",styleID:"115"}},styles:{makers:{0:{type:"sprite",anchor:"bottom",content:{image:{imageAlign:"center"}}},1:{type:"sprite",content:{text:{fontAlign:"center"}}},2:{type:"sprite",content:{text:{fontAlign:"left"},image:{imageAlign:"left"}}},3:{type:"sprite",content:{text:{fontAlign:"right"},image:{imageAlign:"right"}}},4:{type:"sprite",content:{text:{fontAlign:"center"},image:{imageAlign:"top"}}},5:{type:"sprite",content:{text:{fontAlign:"center"},image:{imageAlign:"bottom"}}}},blocks:{100:{color:"#eeeeee"},101:{color:"#cccccc",alpha:1,noBorder:!0,blockHeight:1,height:-1},102:{color:"#eda6a1"},103:{color:"#6beb90"},104:{color:"#f37775"},105:{color:"#e6e072"},106:{color:"#86aae7"},107:{color:"#72ebe3"},108:{color:"#d39fea"},109:{color:"#cfd5d6"},110:{color:"#006824"},111:{color:"#b5ac73"},112:{color:"#3f72d7"},113:{color:"#00927f"},114:{color:"#ede99d"},115:{color:"#dddddd",blockHeight:2.1}}},customize:{}};class Yc{constructor(t,e){this.map=t,this.data=e||kh.cloneJSON(qc),this.data.themeID||(this.data.themeID=kh.generateID(16,"t")),this.map.themes[this.data.themeID]=this}get themeID(){return this.data.themeID}getDefault(){var t=Array.from(arguments),e={};return t.forEach(t=>{e[t]=this.data.default[t]}),e}getDefaultBlockStyle(t){if(t||!this.defaultBlockStyle){var e=this.getDefault("blockColor","blockAlpha","blockHeight");void 0!==e.blockColor&&(e.color=e.blockColor,delete e.blockColor),void 0!==e.blockAlpha&&(e.alpha=e.blockAlpha,delete e.blockAlpha),this.defaultBlockStyle=e}return kh.cloneJSON(this.defaultBlockStyle)}getDefaultBorderColor(t){return"#"+new Qt(t).multiplyScalar(.5).getHexString()}getBlockStyleSets(t){var e=this.getDefaultBlockStyle(),i=this.data.styles.blocks[t]||{};return i.borderColor||(e.borderColor=this.getDefaultBorderColor(i.color||e.color)),{default:e,custom:i,styleID:t}}getBlockStyleByStyleID(t){var e=this.getDefaultBlockStyle(),i=this.data.styles.blocks[t]||{};return Object.assign(e,i),e.borderColor||(e.borderColor=this.getDefaultBorderColor(e.color)),e}getBlockStyleByTypeID(t){var e=this.data.typeIDs[t]||this.data.typeIDs[1e3],i=e.styleID;i&&this.data.styles.blocks[i]||(i="100");var n=this.getBlockStyleByStyleID(i);return n.name=e.name,n.styleID=i,n}_updateTypeFunc(t,e){var i=kh.getRootNode(t,"blockNode"),n=[],r=null;return e&&(r=Array.isArray(e)?t=>e.indexOf(t.data.typeID)>-1:t=>t.data.typeID==e),i.forEach(t=>{t.children.forEach(t=>{e&&!r(t)||(t.changeType(),n.push(t))})}),n}apply(t){return this._updateTypeFunc(t,null),this}updateTypes(t,e){return this._updateTypeFunc(t,e)}updateType(t,e){return this._updateTypeFunc(t,e)}setTypeStyle(t,e,i){var n=t.theme;return i&&!n.data.styles.blocks[i]||(i="100"),n.data.typeIDs[e].styleID=i,n.updateType(t,e)}updateStyle(t,e,i,n){var r=t.theme,a=Object.keys(r.data.typeIDs),o=[];return a.forEach(a=>{var s=r.data.typeIDs[a];s.styleID==e&&(null!=i&&(s.styleID=i||"100"),o.push(a),n&&n.push.apply(n,this.updateType(t,a)))}),o}updateTypeData(t){this.data.typeIDs[t.typeID]&&(this.data.typeIDs[t.typeID].name=t.name,this.data.styleIndex[typeID]=t.styleID)}getTypeData(t){var e={};if(this.data.typeIDs[t]){var i=this.data.typeIDs[t];Object.assign(e,i,{typeID:t})}return e}load(t){}}var Zc={sceneID:"",name:"",themeID:"",version:1,idCount:0,frameRate:12,maxFrameRate:30,viewMode:"3d",viewAngle:30,polarAngle:60,minPolarAngle:0,maxPolarAngle:60,zoomLevel:18,minZoomLevel:14,maxZoomLevel:24,center:[0,0],viewCenter:[0,0],useAOEffect:!1,models:[],markers:[],blocks:[],route:null,buildings:[],scriptCodes:{},scripts:[],userData:{},tag:"",baseLayerDatas:[]},Jc={id:-1,buildingID:null,transform:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},minLevel:0,maxLevel:28,userData:{}};class Kc extends ol{constructor(t,e){(e=e||kh.cloneJSON(Zc)).sceneID||(e.sceneID=kh.generateID(16,"s")),super(t,e,new Zn),this.data.node=this,this.map=t,this.data.scriptCodes||(this.data.scriptCodes={}),this.map.mapEventHandlerManager.clear(),this.map.omScene=this,this._theme=null,this.modelNode=new gl(t,"group"),this.modelNode.name="modelNode",this.modelNode.tags=null,this.modelNode.data.children=this.data.models,this.markerNode=null,new sl(t).bind(this),this.markerNode.background=!1,this.buildingNode=new al(t),this.buildingNode.name="buildingNode",this.route=new Ul(t),this.route.name="route",this.createRoute(),this.blockNode=new al(t),this.blockNode.name="blockNode",this.data.blocks=this.data.blocks||[],this.blockNode.data.children=this.data.blocks,this.add(this.modelNode,this.markerNode,this.route,this.blockNode,this.buildingNode),this.map.sceneManager.addOMScene(this),this.type="OMScene",this._autoInOutdoor=this.map.config.autoInOutdoor||!1,this._buildingLoaded={},this.setData(),this.hideNodes(),this.createBaseLayer(),this.isReady=!1,this.map.once("focusFloors",()=>{this.isReady=!0,this.map.emit("first-focus",this.map),this.map.emit("viewChanged")})}get focusBuilding(){return this.map.visibleManager._lastFocusBuilding}createScene(){Xc(this.map).modelsCreator.create(this),Xc(this.map).markersCreator.create(this),Xc(this.map).blocksCreator.create(this),this.createBaseLayer(),this.createRoute()}createBaseLayer(){var t=this.data.baseLayerDatas;t&&t.length&&t.forEach(t=>{new Zl(this.map,t)})}createRoute(){Xc(this.map).routeCreator.create(this)}getData(){var t=super.getData(),e=this.buildingNode.children.map(t=>{var e=kh.getBoundingSphere(t.entity);return t.nodeIndex.radius=e.radius,t.nodeIndex});return t.buildings=e,t.baseLayerDatas=this.map.baseLayers.map(t=>t.getData()),t}get theme(){return this._theme}set theme(t){this._theme=t,this.map.view.backgroundColor=t.data.background.color,this.map.view.backgroundAlpha=t.data.background.alpha}get autoInOutdoor(){return this._autoInOutdoor}set autoInOutdoor(t){this._autoInOutdoor=t,this.map.emit("viewChanged")}loadBuilding(t){}loadAllDatas(){return this.findData({})}addBuilding(t){t.omScene=this,this.buildingNode.add(t);var e=t.nodeIndex||this.getBuildingIndex(t);e||((e=kh.cloneJSON(Jc)).id=kh.generateID().toLowerCase(),e.buildingID=t.data.buildingID,this.data.buildings.push(e),t.nodeIndex=e),t.setTransform()}getBuildingIndex(t){kh.findFromArray(this.data.buildings,"buildingID",t.data.buildingID,(t,e)=>t)}removeBuilding(t){this.buildingNode.remove(t,!1),delete t.omScene,kh.findFromArray(this.data.buildings,"buildingID",t.getProp("buildingID"),(t,e)=>{this.data.buildings.splice(e,1)})}setData(t){t&&(this.data=t),this.removeChildren(!1),this.clearBaseLayer()}getBuildingByName(t,e){}getBuildingByID(t,e){var prom=new Nh,i=this.data.buildings.find(e=>e.buildingID===t);if(i)if(i.node)prom.resolve(i.node),e&&e(i.node);else{if(this._buildingLoaded[t])return this._buildingLoaded[t].push(prom),prom;this._buildingLoaded[t]=[prom],this.map.omLoader.loadBuilding(i);var n=this.map.on("buildingLoaded",i=>{i.data.buildingID===t&&(n(),this._buildingLoaded[t].forEach(t=>{t.resolve(i)}),e&&e(i))})}else prom.resolve(null),e&&e(null);return prom}getBuildingByIndex(t){var prom=new Nh,e=this.data.buildings[t];return e?this.getBuildingByID(e.buildingID):(prom.resolve(null),prom)}getFloor(t,e){var prom,i=new Nh;return 1===arguments.length&&(e=t,t=0),"string"==typeof t?prom=this.getBuildingByID(t):"number"==typeof t&&(prom=this.getBuildingByIndex(t)),e=[].concat(e),prom.then(t=>{var n=e.map(e=>t.getFloorByFloorNumber(e));Nh.all(n).then(t=>{i.resolve(1===t.length?t[0]:t)})}),i}findData(t,e){e=Object.assign({recursive:!0,multi:!1},e);var i=[],n=el.prototype.findData.call(this,t,{recursive:!1,multi:e.multi});return n.type="scene",n.length&&i.push(Nh.empty(n)),e.recursive&&this.data.buildings.forEach(n=>{var r=new Nh;this.getBuildingByID(n.buildingID).then(i=>{i.findData(t,e).then(t=>{r.resolve(t)})}),i.push(r)}),Nh.all(i)}removeChildren(t=!0){this.entity.children.forEach(e=>{this.removeEntity(e,t)})}isRoadPointNear(t,e,i=.5){let n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y);return n<=i&&r<=i}entranceMatch(t,e){let i=[];for(var n=0;n<t.length;n++){let a=t[n],o=t.building.worldPosition(a);for(var r=0;r<e.length;r++){let n=e[r],s=e.building.worldPosition(n),h=a.data.group&&a.data.group===n.data.group,l=this.isRoadPointNear(o,s,10);(h||l)&&(a.building=t.building,n.building=e.building,i.push({from:a,to:n}))}}return i}entrancesMatch(t,e){let i={};for(var n=0;n<t.length;n++){let r=t[n],a=e.find(t=>t.floorNumber===r.floorNumber);if(r&&a){let t=this.entranceMatch(r,a);t.length&&(i[r.floorNumber]=t)}}return i}findNearestMatchPoint(t,e,i){let n=Object.keys(e),r=Number.MAX_SAFE_INTEGER,a=0;n.forEach(e=>{e=+e;let i=Math.abs(e-t.floorNumber);i<r&&(r=i,a=e)});let o,s=e[a],h=Number.MAX_SAFE_INTEGER;for(var l=0;l<s.length;l++){let e=s[l],n=e[i].distanceToSquared(t.point);n<h&&(h=n,o=e)}return{nearFloor:a,nearEntrance:o}}findPath(t,e){let i;i=Array.isArray(t)?t:Array.from(arguments);let n=i[i.length-1],r={};"object"!=typeof n||"point"in n||(r=Object.assign(r,i.pop())),i.forEach(t=>{Array.isArray(t.point)&&(t.point=(new Lt).fromArray(t.point))});var a=Object.assign({},r,{clearLines:!1});if(i.length<2)return;if(i.length>2){r.clearLines&&this.clearRoutes();for(var o=[],s=0;s<i.length-1;s++){var h=this.findPath(i[s],i[s+1],a);o.push(h)}return Nh.all(o,!0)}r.clearLines&&this.clearRoutes();let l,c,u=t.buildingID,d=e.buildingID;if(t=Object.assign({},t),e=Object.assign({},e),Array.isArray(t.point)?t.point=(new Lt).fromArray(t.point):t.point.isVector3&&(t.point=t.point.clone()),Array.isArray(e.point)?e.point=(new Lt).fromArray(e.point):e.point.isVector3&&(e.point=e.point.clone()),u||d){if(u&&d&&u===d)return this.getBuildingByID(u).then(i=>i.findPath(t,e,r).then(t=>{if(t)return Array.isArray(t)?t.forEach(t=>t.building=i):t.building=i,t}));{let i=u?this.getBuildingByID(u).then(t=>(l=t,t.getEntrancePoints())):Nh.empty(),n=d?this.getBuildingByID(d).then(t=>(c=t,t.getEntrancePoints())):Nh.empty();return Nh.all([i,n]).then(i=>{if(l&&(t.point=l.localPosition(t.point)),c&&(e.point=c.localPosition(e.point)),i.some(t=>!t)){if(i[0]&&!i[1]){let n=i[0].find(t=>1===t.floorNumber),a={point:kh.findNearestPoint(t.point,n),floorNumber:1},o=l.findPath(t,a,r);return this.route.findPathAsync(a.point,e.point,r),Nh.all([o,prom_to]).then(t=>(t[0]&&(t[0].building=l),t))}if(!i[0]&&i[1]){let t=i[1].find(t=>1===t.floorNumber),n={point:kh.findNearestPoint(e.point,t),floorNumber:1},a=c.findPath(e,n,r),o=this.route.findPathAsync(n.point,e.point,r);return Nh.all([o,a]).then(t=>(t[1]&&(t[1].building=c),t))}return this.route.findPathAsync(t.point,e.point,r)}{let n=this.entrancesMatch(i[0],i[1]);if(Object.keys(n).length){let{nearFloor:i,nearEntrance:a}=this.findNearestMatchPoint(t,n,"from"),o=l.findPath(t,{point:a.from,floorNumber:i},r),s=c.findPath({point:a.to,floorNumber:i},e,r);return Nh.all([o,s]).then(t=>(t[0]&&(t[0].building=l),t[1]&&(t[1].building=c),t))}{let n=null,a=null;if(l&&(n=l.connectBuildings),c&&(a=c.connectBuildings),n&&a){let o=n.filter(t=>a.indexOf(t)>-1),s=null;if(o.length)return this.getBuildingByID(o[0]).then(t=>(s=t,t.getEntrancePoints())).then(n=>{let a=this.entrancesMatch(i[0],n),o=this.entrancesMatch(n,i[1]);if(Object.keys(a).length&&Object.keys(o).length){let i=this.findNearestMatchPoint(t,a,"from"),n=l.findPath(t,{point:i.nearEntrance.from,floorNumber:i.nearFloor},r),h=this.findNearestMatchPoint(e,o,"to"),u=s.findPath({point:i.nearEntrance.to,floorNumber:i.nearFloor},{point:h.nearEntrance.from,floorNumber:h.nearFloor},r),d=c.findPath({point:h.nearEntrance.to,floorNumber:h.nearFloor},e,r);return Nh.all([n,u,d]).then(t=>(t[0]&&(t[0].building=l),t[1]&&(t[1].building=s),t[2]&&(t[2].building=c),t))}})}}let a=i[0].find(t=>1===t.floorNumber);i[1].find(t=>1===t.floorNumber);let o=kh.findNearestPoint(t.point,a),s=kh.findNearestPoint(e.point,a),h={point:o,floorNumber:1},u=l.findPath(t,h,r),d={point:s,floorNumber:1},p=c.findPath(d,e,r),f=this.route.findPathAsync(h.point,d.point,r);return Nh.all([u,f,p]).then(t=>(t[0].building=l,t[2].building=c,t))}})}}var p=t.point?t.point:t,f=e.point?e.point:e;return this.route.findPathAsync(p,f)}clearRoutes(){this.route.clearLines(),this.buildingNode.children.forEach(t=>{t.clearRoutes()})}clear(){this.data=null,this.removeChildren(!0),this.clearBaseLayer()}clearBaseLayer(){this.map.baseLayers.length&&(this.map.baseLayers.forEach(t=>{t.dispose()}),this.map.baseLayers.length=0)}dispose(){super.dispose(),this.clear()}}class Qc{constructor(t){this.map=t,this.data=null,this.base=new Zn,this.base.name="base",this.default=new Zn,this.default.name="default",this.mainScene=new Zn,this.mainScene.name="main",this.mainScene.area=new Ut,this.markerScene=new Zn,this.markerScene.name="marker";var e=new Zn;e.name="hud",this.props=kh.getSecret(),this.props.constructor("dit",e),this.globalScene=new Zn,this.globalScene.name="global",this.OMScenes={},this.scenes=[this.default,this.mainScene,this.markerScene,this.globalScene]}addOMScene(t){this.OMScenes[t.data.sceneID]=t,this.mainScene.add(t.entity)}getOMScene(t){return this.OMScenes[t]}getSceneArea(){var t=this.mainScene.area,e=this.map.config.sceneAreaRate;t.expandByObject(this.mainScene);var i=(t.max.x-t.min.x)*(e-1)/2,n=(t.max.y-t.min.y)*(e-1)/2;return t.min.x-=i,t.min.y-=n,t.max.x+=i,t.max.y+=n,t}removeOMScene(t){var e,i;t instanceof Kc?(e=t.ID,i=t):"string"==typeof t&&(e=t,i=this.getOMScene(t)),i&&(i.dispose(),delete this.OMScenes[e])}clearScene(){Object.keys(this.OMScenes).forEach(t=>{this.OMScenes[t].dispose()}),this.OMScenes={}}}var $c={debug:!1,container:null,server:"https://www.ooomap.com/ooomap-sdk-api/",verifyUrl:"",appID:"",standalone:!1,baseUrl:"/",removeLogo:"",frameRate:12,maxFrameRate:30,viewMode:"3d",viewAngle:30,polarAngle:60,viewCenter:null,zoom:null,zoomSpeed:.75,zoomLevel:18,minZoomLevel:14,maxZoomLevel:25,minPolarAngle:0,maxPolarAngle:60,controls_phiThreshold:2,animateDuration:600,viewChangedEventDelay:100,viewChangedTimeStep:300,useAOEffect:!1,useShadowMap:!1,modelPath:null,modelType:".omm",enableModelFixedSize:!0,focusBuildingID:"",viewFloors:null,focusFloors:null,floorSpace:68,fadeOutAlpha:.4,enableFloorAlpha:!1,wallLightMap:"https://www.ooomap.com/assets/textures/wall.png",sceneAreaRate:1,modelEmissive:.3,mouseOverTime:300,doubleClickTime:0,blockHideSideHeight:.1,indoorLevel:10,autoInOutdoor:!1,autoIndoorThreshold:.9,autoIndoorPolarAngle:60,onlyOneIndoor:!1,context:null,mergeSameTypeBlocks:!0,resolution:1,eventsOnContainer:!1,zoomToCursor:!1,webGLConfig:{},onlyShowFocusBuildingMarkers:!1,noMetalness:!0,noEmissive:!1,enableInViewlVisible:!1,linkedFloors:null,liftDistance:25};class tu{constructor(t){this.map=t,this.VIEW_ANIMATING="view_animating",this.ANIMATING="animating",this.INPUTTING="inputting",this._states=[]}get states(){return this._states}haveState(t){return this.states.includes(t)}addState(t){this._states.includes(t)||(this._states.push(t),this.checkStates(),this.map.emit("stateChanged",this._states))}removeState(t){var e=this._states.indexOf(t);e>-1&&(this._states.splice(e,1),this.checkStates(),this.map.emit("stateChanged",this._states))}reset(){this.map.needHeighFrameRate=!1}checkStates(){this.reset(),this._states.includes(this.VIEW_ANIMATING)&&(this.map.needHeighFrameRate=!0)}}class eu{constructor(t){this.map=t,this.enabled=!0,this.raycaster=new Vs,this.raycaster.linePrecision=2.25,this.objects=[],this.nodes=[],this.enableMouseOver=this.map.config.enableMouseOver||!1,this.longPressedTime=400,this.doubleClickTime=t.config.doubleClickTime,this._props={curPick:null,lastPick:null,inters:[],clickCount:0},this._mouseDownFun=this.mouseDown.bind(this),this._mouseMoveFun=this.mouseMove.bind(this),this._mouseUpFun=this.mouseUp.bind(this),this.addEvents()}addEvents(){var t=this,e=t.map.view.domElement;e.addEventListener("mousedown",t._mouseDownFun),e.addEventListener("mousemove",t._mouseMoveFun),e.addEventListener("mouseup",t._mouseUpFun),e.addEventListener("touchstart",t._mouseDownFun),e.addEventListener("touchmove",t._mouseMoveFun),e.addEventListener("touchend",t._mouseUpFun)}dispose(){var t=this,e=t.map.view.domElement;e.removeEventListener("mousedown",t._mouseDownFun),e.removeEventListener("mousemove",t._mouseMoveFun),e.removeEventListener("mouseup",t._mouseUpFun),e.removeEventListener("touchstart",t._mouseDownFun),e.removeEventListener("touchmove",t._mouseMoveFun),e.removeEventListener("touchend",t._mouseUpFun)}getObjects(){if(null===this.objects)return null;var t=[];if(this.nodes&&this.nodes.length&&[].concat(this.nodes).forEach(e=>{e.visible&&e.pickabled&&(t.push(e.entity),e.children.forEach(e=>{!1!==e.data.pickabled&&t.push(e.entity)}))}),this.objects=Array.isArray(this.objects)?this.objects:[].concat(this.objects),this.objects&&this.objects.length&&this.objects.forEach(e=>{t.push(e),Array.prototype.push.apply(t,e.children)}),t.length)return t;var e=this.map.mapEventHandlerManager.entities.filter(t=>{if(t.node&&t.node.data)return!1!==t.node.data.pickabled});return e}intersect(t){var e;this.map.view.currentCamera.update,this.raycaster.setFromCamera(this._props.curPick,this.map.view.currentCamera),e=t||this.getObjects(),this._props.inters.length=0;var i=this.raycaster.intersectObject(eu.plane);return e&&e.length&&(this._props.inters=this.raycaster.intersectObjects(e,!0)),this._props.inters=this._props.inters.concat(i),this._props.inters}mouseDown(t){this.enabled&&(this._isMouseDown=!0,this._props.curPick=kh.getMouse(t,this.map),this._props.lastPick=this._props.curPick.clone(),clearTimeout(this._props.doubleClickID),this.intersect(),this._emitEvent(t,"startPick",!0,!0),this._timeoutID=setTimeout(()=>{this._props.emitLongPressed=!0,this._emitEvent(t,"longPressed")},this.longPressedTime),t.preventDefault())}_isVisible(t){var e=t.entity.visible;if(e)for(var i=t.entity;i.parent;){if(!i.parent.visible)return!1;i=i.parent}return t.checkVisible?t.checkVisible()&&e:e}_checkNode(t){if(t){if("pickerPlane"===t.name)return!0;if("SpriteMarkerNode"===t.type&&!kh.checkSpriteInView(this.map.view,t))return!1}return!!(t instanceof nl&&t.enabled&&t.pickabled&&t.entity&&t.entity.parent&&this._isVisible(t))}getMyFather(t){if(t.parent)return t.parent.node?t.parent.node:this.getMyFather(t.parent)}_getEntityNode(t){if(this.map.config.mergeSameTypeBlocks&&t.object.node&&"OMBlock"===t.object.node.type){var e=3*t.faceIndex,i=t.object.geometry.shareNodes;if(!i)return t.object.node;for(var n=0;n<i.length;n++)for(var r=i[n],a=r.faceIndex,o=0;o<a.length;o++){var s=a[o];if(e>=s[0]&&e<s[0]+s[1])return r}}return this._getObjectNode(t.object)}_getObjectNode(t){return t&&t.node?t.node:this._getObjectNode(t.parent)}_getInterNode(t,e){var i=null;t.sort((t,e)=>{var i=this._getObjectNode(t.object),n=this._getObjectNode(e.object);return void 0===i||void 0===n?0:n.pickIndex-i.pickIndex});for(var n=0;n<t.length;n++){var r=this._getEntityNode(t[n]);if(r||(r=this.getMyFather(t[n].object)),this._checkNode(r)){i={node:"pickerPlane"===r.name?null:r,intersect:t[n],info:{}};break}}return i}mouseMove(t){this.enabled&&(this._isMouseDown?(this._props.curPick=kh.getMouse(t,this.map),this._props.curPick.distanceTo(this._props.lastPick)>.01&&clearTimeout(this._timeoutID)):this.enableMouseOver&&(clearTimeout(this._props.mousemoveID),this._props.mousemoveID=setTimeout(()=>{this._props.curPick=kh.getMouse(t,this.map),this.intersect();var e,i=null,n=null;this._props.inters.length>0&&(e=this._getInterNode(this._props.inters))&&(i=e.node),(i&&i.alwaysEmit||i!==this._props.lastOver)&&((n=this._props.lastOver)&&(this._checkNode(n)&&n.mouseleave&&n.mouseleave(t),this._emitEvent(t,"mouseleave",!0,!0)),this._props.lastOver=i,i&&(this._checkNode(i)&&i.mouseenter&&i.mouseenter(t),this._emitEvent(t,"mouseenter",!0,!0)))},this.map.config.mouseOverTime||300)),t.preventDefault())}_emitEvent(t,e,i=!0,n=!1){var r=null;if(this._props.curPick&&this._props.lastPick&&(n||(0==t.button||t.touches&&1===t.touches.length||t.changedTouches&&1===t.changedTouches.length)&&this._props.curPick.distanceTo(this._props.lastPick)<.01)){var a=this._props.inters;a.length>0&&((r=this._getInterNode(a,t))&&r.node&&(r.node.data.scripts&&r.node.data.scripts.length&&r.node.invokeScript(e,r,t),r.node[e]&&r.node[e](r,t)),i||this.map.emit(e,r,t)),i&&this.map.emit(e,r,t)}}mouseUp(t){t.__hasEmit||(this._emitEvent(t,"endPick",!1,!0),this.enabled&&this._props.curPick&&(this._isMouseDown=!1,clearTimeout(this._timeoutID),t.touches||t.changedTouches||(this._props.curPick=kh.getMouse(t,this.map)),this._props.clickCount++,this._props.doubleClickID=setTimeout(()=>{this._props.clickCount=0,this._props.emitLongPressed||this._emitEvent(t,"picked"),this._props.curPick=null},this.doubleClickTime),2===this._props.clickCount&&(this._emitEvent(t,"doubleClick"),this._props.clickCount=0,clearTimeout(this._props.doubleClickID),this._props.curPick=null),this._props.emitLongPressed=!1,t.preventDefault()))}}eu.plane=new Qe(new Ne(2e6,2e6,1,1),new Ke({visible:!1})),eu.plane.node=eu.plane,eu.plane.name="pickerPlane";class iu{constructor(t){this.map=t,this.raycaster=new Vs,this.raycaster.linePrecision=1,this.map.sceneManager.default.add(iu.plane),this.clickCount=0,this.isMouseDown=!1,this.isTracking=!1,this.isAbort=!1,this.snapSystem=null,this.tracker=null,this._mouseDownFun=this._mouseDown.bind(this),this._mouseMoveFun=this._mouseMove.bind(this),this._mouseUpFun=this._mouseUp.bind(this),this.onStart=null,this.onStop=null,this.addEvents()}addEvents(){var t=this,e=t.map.view.domElement;e.addEventListener("mousedown",t._mouseDownFun),document.addEventListener("mousemove",t._mouseMoveFun),document.addEventListener("mouseup",t._mouseUpFun),e.addEventListener("touchstart",t._mouseDownFun),document.addEventListener("touchmove",t._mouseMoveFun),document.addEventListener("touchend",t._mouseUpFun)}dispose(){this.stopTrack();var t=this,e=t.map.view.domElement;e.removeEventListener("mousedown",t._mouseDownFun),document.removeEventListener("mousemove",t._mouseMoveFun),document.removeEventListener("mouseup",t._mouseUpFun),e.removeEventListener("touchstart",t._mouseDownFun),document.removeEventListener("touchmove",t._mouseMoveFun),document.removeEventListener("touchend",t._mouseUpFun)}invokeTracker(t,e,i){if(e&&(e.preventDefault(),e.stopPropagation()),this.tracker&&this.tracker[t]){var n,r={};r.event=e||{},r.isMouseDown=this.isMouseDown,r.clickCount=this.clickCount,i&&(r.intersect=i,r.point=i.point,r.trackerIntersect=i.trackerIntersect);var a=!1;return["mouseabort","complete"].indexOf(t)<0&&(n=this.tracker[t](r),a=!0),this.tracker&&this.tracker.callbacks&&this.tracker.callbacks[t]&&this.tracker.callbacks[t].call(this.tracker,r,n),a||(n=this.tracker[t](r)),n}}getPick(t){var e=this.currentPick;t instanceof MouseEvent||(e=t),this.raycaster.setFromCamera(e,this.map.view.currentCamera);var i=this.raycaster.intersectObject(iu.plane,!1),n=null,r=this.tracker.entities||(this.tracker.entity?[this.tracker.entity]:null);if(this.tracker&&r&&(n=this.raycaster.intersectObjects(r,!0)),i.length){var a=i[0];return n&&n.length&&(a.trackerIntersect=n[0]),i[0]}return null}updatePlaneHeight(t){t=void 0!==t?t:this.tracker&&this.tracker.entity?this.tracker.entity.position.z:0,iu.plane.position.z=t,iu.plane.updateMatrixWorld()}_mouseDown(t){if(this.isTracking){if(2===t.button)return this.invokeTracker("mouseabort",t),this.isAbort=!0,void this.stopTrack(t);this.isMouseDown=!0,this._lastPick=kh.getMouse(t,this.map),this.currentPick=this._lastPick.clone();var e=this._getInter(t);this.snapSystem&&this.snapSystem.snapPoint&&(e.point=this.snapSystem.snapPoint);var i=this.invokeTracker("mousedown",t,e);i&&this.snapSystem&&this.snapSystem.points.push(i.point),t.preventDefault()}}_mouseMove(t){if(this.isTracking){this.currentPick=kh.getMouse(t,this.map);var e=this._getInter(t);this.snapSystem&&this.snapSystem.getSnap(e.point),this.invokeTracker("mousemove",t,e),t.preventDefault()}}_mouseUp(t){if(this.isTracking){if(this.currentPick.distanceTo(this._lastPick)<(this.tracker.moveDistance||.01)){this.isMouseDown=!1,this.clickCount++;var e=this._getInter(t);this.snapSystem&&this.snapSystem.snapPoint&&(e.point=this.snapSystem.snapPoint);var i=this.invokeTracker("mouseup",t,e);i&&this.snapSystem&&this.snapSystem.points.push(i.point)}t.preventDefault()}}_getInter(t){var e=this.getPick(t);return e&&(this.point=e.point),e}startTrack(t,e,i,n){"function"==typeof e&&(n=i,i=e,e=null),this.isAbort=!1,this.onStart&&this.onStart(),this.snapSystem&&this.snapSystem.init(),this.tracker=t,t.tracker=this,this.tracker.map=this.map,t.stopCallback=i,t.callbacks=n,t.init&&t.init(this,e),n&&n.init&&n.init.call(this,e),this.isTracking=!0,iu.plane.visible=!0}stopTrack(t){this.isTracking&&(this.isTracking=!1,this.onStop&&this.onStop(),this.snapSystem&&this.snapSystem.complete(),this.clickCount=0,this.tracker&&this.tracker.complete&&this.tracker.complete(),this.tracker.stopCallback&&(this.tracker.stopCallback(this.tracker),delete this.tracker.stopCallback),this.tracker=null,this.updatePlaneHeight(0),iu.plane.visible=!1)}}iu.plane=new Qe(new Ne(2e6,2e6,1,1),new Ke({visible:!1}));var nu=function(t){ao.call(this,t),this._parser=nu.parse};nu.prototype=Object.create(ao.prototype),nu.prototype.constructor=nu,nu.parse=function(t,e){var i={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function n(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}function r(t,e,i,n){for(var r=i*n*4,a=new Uint8Array(t,e,r),o=new Uint8Array(r),s=0,h=0,l=0;l<n;l++)for(var c=0;c<i;c++){var u=a[h],d=a[++h],p=a[++h],f=a[++h];h++,o[s]=p,o[++s]=d,o[++s]=u,o[++s]=f,s++}return o}var a,o=n("DXT1"),s=n("DXT3"),h=n("DXT5"),l=n("ETC1"),c=new Int32Array(t,0,31);if(542327876!==c[0])return i;if(4&!c[20])return i;var u=!1;switch(c[21]){case o:a=8,i.format=rt;break;case s:a=16,i.format=ot;break;case h:a=16,i.format=st;break;case l:a=8,i.format=dt;break;default:if(!(32===c[22]&&16711680&c[23]&&65280&c[24]&&255&c[25]&&4278190080&c[26]))return i;u=!0,a=64,i.format=et}i.mipmapCount=1,131072&c[2]&&!1!==e&&(i.mipmapCount=Math.max(1,c[7]));var d=c[28];if(i.isCubemap=!!(512&d),i.isCubemap&&(!(1024&d)||!(2048&d)||!(4096&d)||!(8192&d)||!(16384&d)||!(32768&d)))return i;i.width=c[4],i.height=c[3];for(var p=c[1]+4,f=i.isCubemap?6:1,m=0;m<f;m++)for(var g=i.width,v=i.height,y=0;y<i.mipmapCount;y++){if(u)var x=(b=r(t,p,g,v)).length;else{x=Math.max(4,g)/4*Math.max(4,v)/4*a;var b=new Uint8Array(t,p,x)}var w={data:b,width:g,height:v};i.mipmaps.push(w),p+=x,g=Math.max(g>>1,1),v=Math.max(v>>1,1)}return i};var ru=function(){function t(t){this.manager=void 0!==t?t:eo,this.dracoLoader=null,this.ddsLoader=null}function e(){var t={};return{get:function(e){return t[e]},add:function(e,i){t[e]=i},remove:function(e){delete t[e]},removeAll:function(){t={}}}}t.prototype={constructor:t,crossOrigin:"anonymous",load:function(t,e,i,n){var r,a=this;r=void 0!==this.resourcePath?this.resourcePath:void 0!==this.path?this.path:Xo.extractUrlBase(t),a.manager.itemStart(t);var o=function(e){n&&n(e),a.manager.itemError(t),a.manager.itemEnd(t)},s=new no(a.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),"use-credentials"===a.crossOrigin&&s.setWithCredentials(!0),s.load(t,function(i){a.parse(i,r,function(i){e(i),a.manager.itemEnd(t)},o)},i,o)},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setDRACOLoader:function(t){return this.dracoLoader=t,this},setDDSLoader:function(t){return this.ddsLoader=t,this},parse:function(t,e,s,h){var p,f={};if("string"==typeof t)p=t;else if(Xo.decodeText(new Uint8Array(t,0,4))===o){try{f[i.KHR_BINARY_GLTF]=new l(t)}catch(t){return void(h&&h(t))}p=f[i.KHR_BINARY_GLTF].content}else p=Xo.decodeText(new Uint8Array(t));var m=JSON.parse(p);if(void 0===m.asset||m.asset.version[0]<2)h&&h(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead."));else{if(m.extensionsUsed)for(var g=0;g<m.extensionsUsed.length;++g){var v=m.extensionsUsed[g],y=m.extensionsRequired||[];switch(v){case i.KHR_LIGHTS_PUNCTUAL:f[v]=new r(m);break;case i.KHR_MATERIALS_UNLIT:f[v]=new a;break;case i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:f[v]=new d;break;case i.KHR_DRACO_MESH_COMPRESSION:f[v]=new c(m,this.dracoLoader);break;case i.MSFT_TEXTURE_DDS:f[i.MSFT_TEXTURE_DDS]=new n(this.ddsLoader);break;case i.KHR_TEXTURE_TRANSFORM:f[i.KHR_TEXTURE_TRANSFORM]=new u;break;default:y.indexOf(v)}}new W(m,f,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(s,h)}}};var i={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function n(t){if(!t)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader");this.name=i.MSFT_TEXTURE_DDS,this.ddsLoader=t}function r(t){this.name=i.KHR_LIGHTS_PUNCTUAL;var e=t.extensions&&t.extensions[i.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=e.lights||[]}function a(){this.name=i.KHR_MATERIALS_UNLIT}r.prototype.loadLight=function(t){var e,i=this.lightDefs[t],n=new Qt(16777215);void 0!==i.color&&n.fromArray(i.color);var r=void 0!==i.range?i.range:0;switch(i.type){case"directional":(e=new jo(n)).target.position.set(0,0,-1),e.add(e.target);break;case"point":(e=new Fo(n)).distance=r;break;case"spot":(e=new Bo(n)).distance=r,i.spot=i.spot||{},i.spot.innerConeAngle=void 0!==i.spot.innerConeAngle?i.spot.innerConeAngle:0,i.spot.outerConeAngle=void 0!==i.spot.outerConeAngle?i.spot.outerConeAngle:Math.PI/4,e.angle=i.spot.outerConeAngle,e.penumbra=1-i.spot.innerConeAngle/i.spot.outerConeAngle,e.target.position.set(0,0,-1),e.add(e.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+i.type+'".')}return e.position.set(0,0,0),e.decay=2,void 0!==i.intensity&&(e.intensity=i.intensity),e.name=i.name||"light_"+t,Promise.resolve(e)},a.prototype.getMaterialType=function(){return Ke},a.prototype.extendParams=function(t,e,i){var n=[];t.color=new Qt(1,1,1),t.opacity=1;var r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){var a=r.baseColorFactor;t.color.fromArray(a),t.opacity=a[3]}void 0!==r.baseColorTexture&&n.push(i.assignTexture(t,"map",r.baseColorTexture))}return Promise.all(n)};var o="glTF",s=12,h={JSON:1313821514,BIN:5130562};function l(t){this.name=i.KHR_BINARY_GLTF,this.content=null,this.body=null;var e=new DataView(t,0,s);if(this.header={magic:Xo.decodeText(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==o)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.");for(var n=new DataView(t,s),r=0;r<n.byteLength;){var a=n.getUint32(r,!0);r+=4;var l=n.getUint32(r,!0);if(r+=4,l===h.JSON){var c=new Uint8Array(t,s+r,a);this.content=Xo.decodeText(c)}else if(l===h.BIN){var u=s+r;this.body=t.slice(u,u+a)}r+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function c(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=i.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e}function u(){this.name=i.KHR_TEXTURE_TRANSFORM}function d(){return{name:i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return Ye},extendParams:function(t,e,i){var n=e.extensions[this.name],r=ee.standard,a=Jt.clone(r.uniforms),o=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),s=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),h=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),l=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),c=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","material.specularRoughness = clamp( 1.0 - glossinessFactor, 0.04, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),u=r.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",o).replace("#include <metalnessmap_pars_fragment>",s).replace("#include <roughnessmap_fragment>",h).replace("#include <metalnessmap_fragment>",l).replace("#include <lights_physical_fragment>",c);delete a.roughness,delete a.metalness,delete a.roughnessMap,delete a.metalnessMap,a.specular={value:(new Qt).setHex(1118481)},a.glossiness={value:.5},a.specularMap={value:null},a.glossinessMap={value:null},t.vertexShader=r.vertexShader,t.fragmentShader=u,t.uniforms=a,t.defines={STANDARD:""},t.color=new Qt(1,1,1),t.opacity=1;var d=[];if(Array.isArray(n.diffuseFactor)){var p=n.diffuseFactor;t.color.fromArray(p),t.opacity=p[3]}if(void 0!==n.diffuseTexture&&d.push(i.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new Qt(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new Qt(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var f=n.specularGlossinessTexture;d.push(i.assignTexture(t,"glossinessMap",f)),d.push(i.assignTexture(t,"specularMap",f))}return Promise.all(d)},createMaterial:function(t){var e=new Ye({defines:t.defines,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,fog:!0,lights:!0,opacity:t.opacity,transparent:t.transparent});return e.isGLTFSpecularGlossinessMaterial=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e.extensions.derivatives=!0,e},cloneMaterial:function(t){var e=t.clone();e.isGLTFSpecularGlossinessMaterial=!0;for(var i=this.specularGlossinessParams,n=0,r=i.length;n<r;n++){var a=t[i[n]];e[i[n]]=a&&a.isColor?a.clone():a}return e},refreshUniforms:function(t,e,i,n,r){if(!0===r.isGLTFSpecularGlossinessMaterial){var a,o=r.uniforms,s=r.defines;o.opacity.value=r.opacity,o.diffuse.value.copy(r.color),o.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),o.map.value=r.map,o.specularMap.value=r.specularMap,o.alphaMap.value=r.alphaMap,o.lightMap.value=r.lightMap,o.lightMapIntensity.value=r.lightMapIntensity,o.aoMap.value=r.aoMap,o.aoMapIntensity.value=r.aoMapIntensity,r.map?a=r.map:r.specularMap?a=r.specularMap:r.displacementMap?a=r.displacementMap:r.normalMap?a=r.normalMap:r.bumpMap?a=r.bumpMap:r.glossinessMap?a=r.glossinessMap:r.alphaMap?a=r.alphaMap:r.emissiveMap&&(a=r.emissiveMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),o.uvTransform.value.copy(a.matrix)),r.envMap&&(o.envMap.value=r.envMap,o.envMapIntensity.value=r.envMapIntensity,o.flipEnvMap.value=r.envMap.isCubeTexture?-1:1,o.reflectivity.value=r.reflectivity,o.refractionRatio.value=r.refractionRatio,o.maxMipLevel.value=t.properties.get(r.envMap).__maxMipLevel),o.specular.value.copy(r.specular),o.glossiness.value=r.glossiness,o.glossinessMap.value=r.glossinessMap,o.emissiveMap.value=r.emissiveMap,o.bumpMap.value=r.bumpMap,o.normalMap.value=r.normalMap,o.displacementMap.value=r.displacementMap,o.displacementScale.value=r.displacementScale,o.displacementBias.value=r.displacementBias,null!==o.glossinessMap.value&&void 0===s.USE_GLOSSINESSMAP&&(s.USE_GLOSSINESSMAP="",s.USE_ROUGHNESSMAP=""),null===o.glossinessMap.value&&void 0!==s.USE_GLOSSINESSMAP&&(delete s.USE_GLOSSINESSMAP,delete s.USE_ROUGHNESSMAP)}}}}function p(t,e,i,n){Fa.call(this,t,e,i,n)}c.prototype.decodePrimitive=function(t,e){var i=this.json,n=this.dracoLoader,r=t.extensions[this.name].bufferView,a=t.extensions[this.name].attributes,o={},s={},h={};for(var l in a){var c=T[l]||l.toLowerCase();o[c]=a[l]}for(l in t.attributes)if(c=T[l]||l.toLowerCase(),void 0!==a[l]){var u=i.accessors[t.attributes[l]],d=_[u.componentType];h[c]=d,s[c]=!0===u.normalized}return e.getDependency("bufferView",r).then(function(t){return new Promise(function(e){n.decodeDracoFile(t,function(t){for(var i in t.attributes){var n=t.attributes[i],r=s[i];void 0!==r&&(n.normalized=r)}e(t)},o,h)})})},u.prototype.extendTexture=function(t,e){return t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),e.texCoord,t.needsUpdate=!0,t},p.prototype=Object.create(Fa.prototype),p.prototype.constructor=p,p.prototype.copySampleValue_=function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n*3+n,a=0;a!==n;a++)e[a]=i[r+a];return e},p.prototype.beforeStart_=p.prototype.copySampleValue_,p.prototype.afterEnd_=p.prototype.copySampleValue_,p.prototype.interpolate_=function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,h=3*o,l=n-e,c=(i-e)/l,u=c*c,d=u*c,p=t*h,f=p-h,m=-2*d+3*u,g=d-u,v=1-m,y=g-u+c,x=0;x!==o;x++){var b=a[f+x+o],w=a[f+x+s]*l,_=a[p+x+o],M=a[p+x]*l;r[x]=v*b+y*w+m*_+g*M}return r};var f,m=0,g=1,v=2,y=3,x=4,b=5,w=6,_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},M={9728:j,9729:H,9984:void 0,9985:void 0,9986:void 0,9987:void 0},S={33071:U,33648:G,10497:F},A={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},T={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},L={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},C={CUBICSPLINE:void 0,LINEAR:ft,STEP:pt},P="OPAQUE",E="MASK",D="BLEND",I={"image/png":et,"image/jpeg":tt};function O(){return f=f||new Pa({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})}function N(t,e,i){for(var n in i.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=i.extensions[n])}function k(t,e){void 0!==e.extras&&"object"==typeof e.extras&&Object.assign(t.userData,e.extras)}function z(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var i=0,n=e.weights.length;i<n;i++)t.morphTargetInfluences[i]=e.weights[i];if(e.extras&&Array.isArray(e.extras.targetNames)){var r=e.extras.targetNames;if(t.morphTargetInfluences.length===r.length)for(t.morphTargetDictionary={},i=0,n=r.length;i<n;i++)t.morphTargetDictionary[r[i]]=i}}function R(t){var e=t.extensions&&t.extensions[i.KHR_DRACO_MESH_COMPRESSION];return e?"draco:"+e.bufferView+":"+e.indices+":"+B(e.attributes):t.indices+":"+B(t.attributes)+":"+t.mode}function B(t){for(var e="",i=Object.keys(t).sort(),n=0,r=i.length;n<r;n++)e+=i[n]+":"+t[i[n]]+";";return e}function V(t){if(t.isInterleavedBufferAttribute){for(var e=t.count,i=t.itemSize,n=t.array.slice(0,e*i),r=0,a=0;r<e;++r)n[a++]=t.getX(r),i>=2&&(n[a++]=t.getY(r)),i>=3&&(n[a++]=t.getZ(r)),i>=4&&(n[a++]=t.getW(r));return new ve(n,i,t.normalized)}return t.clone()}function W(t,i,n){this.json=t||{},this.extensions=i||{},this.options=n||{},this.cache=new e,this.primitiveCache={},this.textureLoader=new lo(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new no(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function X(t,e,i){var n=e.attributes,r=[];function a(e,n){return i.getDependency("accessor",e).then(function(e){t.addAttribute(n,e)})}for(var o in n){var s=T[o]||o.toLowerCase();s in t.attributes||r.push(a(n[o],s))}if(void 0!==e.indices&&!t.index){var h=i.getDependency("accessor",e.indices).then(function(e){t.setIndex(e)});r.push(h)}return k(t,e),Promise.all(r).then(function(){return void 0!==e.targets?function(t,e,i){for(var n=!1,r=!1,a=0,o=e.length;a<o&&(void 0!==(l=e[a]).POSITION&&(n=!0),void 0!==l.NORMAL&&(r=!0),!n||!r);a++);if(!n&&!r)return Promise.resolve(t);var s=[],h=[];for(a=0,o=e.length;a<o;a++){var l=e[a];if(n){var c=void 0!==l.POSITION?i.getDependency("accessor",l.POSITION):t.attributes.position;s.push(c)}r&&(c=void 0!==l.NORMAL?i.getDependency("accessor",l.NORMAL):t.attributes.normal,h.push(c))}return Promise.all([Promise.all(s),Promise.all(h)]).then(function(i){for(var a=i[0],o=i[1],s=0,h=a.length;s<h;s++)t.attributes.position!==a[s]&&(a[s]=V(a[s]));for(s=0,h=o.length;s<h;s++)t.attributes.normal!==o[s]&&(o[s]=V(o[s]));for(s=0,h=e.length;s<h;s++){var l=e[s],c="morphTarget"+s;if(n&&void 0!==l.POSITION){var u=a[s];u.name=c;for(var d=t.attributes.position,p=0,f=u.count;p<f;p++)u.setXYZ(p,u.getX(p)+d.getX(p),u.getY(p)+d.getY(p),u.getZ(p)+d.getZ(p))}if(r&&void 0!==l.NORMAL){var m=o[s];m.name=c;var g=t.attributes.normal;for(p=0,f=m.count;p<f;p++)m.setXYZ(p,m.getX(p)+g.getX(p),m.getY(p)+g.getY(p),m.getZ(p)+g.getZ(p))}}return n&&(t.morphAttributes.position=a),r&&(t.morphAttributes.normal=o),t})}(t,e.targets,i):t})}return W.prototype.parse=function(t,e){var i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.markDefs();var a=this.getDependencies("scene").then(t=>t).catch(t=>{}),o=this.getDependencies("animation").then(t=>t).catch(t=>{}),s=this.getDependencies("camera").then(t=>t).catch(t=>{});Promise.all([a,o,s]).then(function(e){var a={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:i,userData:{}};N(r,a,n),k(a,n),t(a)}).catch(e)},W.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[],n={},r={},a=0,o=e.length;a<o;a++)for(var s=e[a].joints,h=0,l=s.length;h<l;h++)t[s[h]].isBone=!0;for(var c=0,u=t.length;c<u;c++){var d=t[c];void 0!==d.mesh&&(void 0===n[d.mesh]&&(n[d.mesh]=r[d.mesh]=0),n[d.mesh]++,void 0!==d.skin&&(i[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=n,this.json.meshUses=r},W.prototype.getDependency=function(t,e){var n=t+":"+e,r=this.cache.get(n);if(!r){switch(t){case"scene":r=this.loadScene(e);break;case"node":r=this.loadNode(e);break;case"mesh":r=this.loadMesh(e);break;case"accessor":r=this.loadAccessor(e);break;case"bufferView":r=this.loadBufferView(e);break;case"buffer":r=this.loadBuffer(e);break;case"material":r=this.loadMaterial(e);break;case"texture":r=this.loadTexture(e);break;case"skin":r=this.loadSkin(e);break;case"animation":r=this.loadAnimation(e);break;case"camera":r=this.loadCamera(e);break;case"light":r=this.extensions[i.KHR_LIGHTS_PUNCTUAL].loadLight(e);break;default:throw new Error("Unknown type: "+t)}this.cache.add(n,r)}return r},W.prototype.getDependencies=function(t){var e=this.cache.get(t);if(!e){var i=this,n=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(n.map(function(e,n){return i.getDependency(t,n)})),this.cache.add(t,e)}return e},W.prototype.loadBuffer=function(t){var e=this.json.buffers[t],n=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[i.KHR_BINARY_GLTF].body);var r=this.options;return new Promise(function(t,i){var a,o;n.load((a=e.uri,o=r.path,"string"!=typeof a||""===a?"":(/^https?:\/\//i.test(o)&&/^\//.test(a)&&(o=o.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(a)||/^data:.*,.*$/i.test(a)||/^blob:.*$/i.test(a)?a:o+a)),t,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})},W.prototype.loadBufferView=function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(t){var i=e.byteLength||0,n=e.byteOffset||0;return t.slice(n,n+i)})},W.prototype.loadAccessor=function(t){var e=this,i=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var r=[];return void 0!==n.bufferView?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),void 0!==n.sparse&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(t){var r,a=t[0],o=A[n.type],s=_[n.componentType],h=s.BYTES_PER_ELEMENT,l=h*o,c=n.byteOffset||0,u=void 0!==n.bufferView?i.bufferViews[n.bufferView].byteStride:void 0,d=!0===n.normalized;if(u&&u!==l){var p=Math.floor(c/u),f="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+p+":"+n.count,m=e.cache.get(f);m||(m=new Jn(new s(a,p*u,n.count*u/h),u/h),e.cache.add(f,m)),r=new Kn(m,o,c%u/h,d)}else r=new ve(null===a?new s(n.count*o):new s(a,c,n.count*o),o,d);if(void 0!==n.sparse){var g=A.SCALAR,v=_[n.sparse.indices.componentType],y=n.sparse.indices.byteOffset||0,x=n.sparse.values.byteOffset||0,b=new v(t[1],y,n.sparse.count*g),w=new s(t[2],x,n.sparse.count*o);null!==a&&r.setArray(r.array.slice());for(var M=0,S=b.length;M<S;M++){var T=b[M];if(r.setX(T,w[M*o]),o>=2&&r.setY(T,w[M*o+1]),o>=3&&r.setZ(T,w[M*o+2]),o>=4&&r.setW(T,w[M*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r})},W.prototype.loadTexture=function(t){var e=this,n=this.json;this.options;var r,a=this.textureLoader,o=n.textures[t],s=o.extensions||{},h=(r=s[i.MSFT_TEXTURE_DDS]?n.images[s[i.MSFT_TEXTURE_DDS].source]:n.images[o.source]).uri;return void 0!==r.bufferView&&(h=e.getDependency("bufferView",r.bufferView).then(function(t){return h="data:image/png;base64,"+wx.arrayBufferToBase64(t)})),Promise.resolve(h).then(function(t){var n=ls.Handlers.get(t);return n||(n=s[i.MSFT_TEXTURE_DDS]?e.extensions[i.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise(function(e,i){n.load(t,e,void 0,i)})}).then(function(t){t.flipY=!1,void 0!==o.name&&(t.name=o.name),r.mimeType in I&&(t.format=I[r.mimeType]);var e=(n.samplers||{})[o.sampler]||{};return t.magFilter=M[e.magFilter]||H,t.minFilter=M[e.minFilter]||void 0,t.wrapS=S[e.wrapS]||F,t.wrapT=S[e.wrapT]||F,t})},W.prototype.assignTexture=function(t,e,n){var r=this,a=this.getDependency("texture",n.index);if("then"in a)return a.then(function(a){if(!a.isCompressedTexture)switch(e){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=tt}if(r.extensions[i.KHR_TEXTURE_TRANSFORM]){var o=void 0!==n.extensions?n.extensions[i.KHR_TEXTURE_TRANSFORM]:void 0;o&&(a=r.extensions[i.KHR_TEXTURE_TRANSFORM].extendTexture(a,o))}t[e]=a})},W.prototype.assignFinalMaterial=function(t){var e=t.geometry,n=t.material,r=this.extensions,a=void 0!==e.attributes.tangent,o=void 0!==e.attributes.color,s=void 0===e.attributes.normal,h=!0===t.isSkinnedMesh,l=Object.keys(e.morphAttributes).length>0,c=l&&void 0!==e.morphAttributes.normal;if(t.isPoints){var u="PointsMaterial:"+n.uuid,d=this.cache.get(u);d||(d=new hr,qe.prototype.copy.call(d,n),d.color.copy(n.color),d.map=n.map,d.lights=!1,d.sizeAttenuation=!1,this.cache.add(u,d)),n=d}else if(t.isLine){u="LineBasicMaterial:"+n.uuid;var p=this.cache.get(u);p||(p=new rr,qe.prototype.copy.call(p,n),p.color.copy(n.color),p.lights=!1,this.cache.add(u,p)),n=p}if(a||o||s||h||l){u="ClonedMaterial:"+n.uuid+":",n.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),h&&(u+="skinning:"),a&&(u+="vertex-tangents:"),o&&(u+="vertex-colors:"),s&&(u+="flat-shading:"),l&&(u+="morph-targets:"),c&&(u+="morph-normals:");var f=this.cache.get(u);f||(f=n.isGLTFSpecularGlossinessMaterial?r[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(n):n.clone(),h&&(f.skinning=!0),a&&(f.vertexTangents=!0),o&&(f.vertexColors=2),s&&(f.flatShading=!0),l&&(f.morphTargets=!0),c&&(f.morphNormals=!0),this.cache.add(u,f)),n=f}n.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.addAttribute("uv2",new ve(e.attributes.uv.array,2)),n.isGLTFSpecularGlossinessMaterial&&(t.onBeforeRender=r[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].refreshUniforms),t.material=n},W.prototype.loadMaterial=function(t){var e,n=this,r=this.json,a=this.extensions,o=r.materials[t],s={},h=o.extensions||{},l=[];if(h[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var c=a[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];e=c.getMaterialType(),l.push(c.extendParams(s,o,n))}else if(h[i.KHR_MATERIALS_UNLIT]){var u=a[i.KHR_MATERIALS_UNLIT];e=u.getMaterialType(),l.push(u.extendParams(s,o,n))}else{e=Pa;var d=o.pbrMetallicRoughness||{};if(s.color=new Qt(1,1,1),s.opacity=1,Array.isArray(d.baseColorFactor)){var p=d.baseColorFactor;s.color.fromArray(p),s.opacity=p[3]}void 0!==d.baseColorTexture&&l.push(n.assignTexture(s,"map",d.baseColorTexture)),s.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,s.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(l.push(n.assignTexture(s,"metalnessMap",d.metallicRoughnessTexture)),l.push(n.assignTexture(s,"roughnessMap",d.metallicRoughnessTexture)))}!0===o.doubleSided&&(s.side=2);var f=o.alphaMode||P;return f===D?s.transparent=!0:(s.transparent=!1,f===E&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&e!==Ke&&(l.push(n.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new St(1,1),void 0!==o.normalTexture.scale&&s.normalScale.set(o.normalTexture.scale,o.normalTexture.scale)),void 0!==o.occlusionTexture&&e!==Ke&&(l.push(n.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&e!==Ke&&(s.emissive=(new Qt).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&e!==Ke&&l.push(n.assignTexture(s,"emissiveMap",o.emissiveTexture)),Promise.all(l).then(function(){var t;return t=e===Ye?a[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new e(s),void 0!==o.name&&(t.name=o.name),t.map&&(t.map.encoding=bt),t.emissiveMap&&(t.emissiveMap.encoding=bt),t.specularMap&&(t.specularMap.encoding=bt),k(t,o),o.extensions&&N(a,t,o),t})},W.prototype.loadGeometries=function(t){var e=this,n=this.extensions,r=this.primitiveCache;function a(t){return n[i.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then(function(i){return X(i,t,e)})}for(var o=[],s=0,h=t.length;s<h;s++){var l,c=t[s],u=R(c),d=r[u];d?o.push(d.promise):(l=c.extensions&&c.extensions[i.KHR_DRACO_MESH_COMPRESSION]?a(c):X(new Ee,c,e),r[u]={primitive:c,promise:l},o.push(l))}return Promise.all(o)},W.prototype.loadMesh=function(t){for(var e=this,i=this.json.meshes[t],n=i.primitives,r=[],a=0,o=n.length;a<o;a++){var s=void 0===n[a].material?O():this.getDependency("material",n[a].material);r.push(s)}return Promise.all(r).then(function(r){return e.loadGeometries(n).then(function(a){for(var o=[],s=0,h=a.length;s<h;s++){var l,c=a[s],u=n[s],d=r[s];if(u.mode===x||u.mode===b||u.mode===w||void 0===u.mode)!0!==(l=!0===i.isSkinnedMesh?new er(c,d):new Qe(c,d)).isSkinnedMesh||l.geometry.attributes.skinWeight.normalized||l.normalizeSkinWeights(),u.mode===b?l.drawMode=1:u.mode===w&&(l.drawMode=2);else if(u.mode===g)l=new or(c,d);else if(u.mode===y)l=new ar(c,d);else if(u.mode===v)l=new sr(c,d);else{if(u.mode!==m)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+u.mode);l=new lr(c,d)}Object.keys(l.geometry.morphAttributes).length>0&&z(l,i),l.name=i.name||"mesh_"+t,a.length>1&&(l.name+="_"+s),k(l,i),e.assignFinalMaterial(l),o.push(l)}if(1===o.length)return o[0];var p=new Dn;for(s=0,h=o.length;s<h;s++)p.add(o[s]);return p})})},W.prototype.loadCamera=function(t){var e,i=this.json.cameras[t],n=i[i.type];if(n)return"perspective"===i.type?e=new On(Mt.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===i.type&&(e=new Uo(n.xmag/-2,n.xmag/2,n.ymag/2,n.ymag/-2,n.znear,n.zfar)),void 0!==i.name&&(e.name=i.name),k(e,i),Promise.resolve(e)},W.prototype.loadSkin=function(t){var e=this.json.skins[t],i={joints:e.joints};return void 0===e.inverseBindMatrices?Promise.resolve(i):this.getDependency("accessor",e.inverseBindMatrices).then(function(t){return i.inverseBindMatrices=t,i})},W.prototype.loadAnimation=function(t){for(var e=this.json.animations[t],i=[],n=[],r=[],a=[],o=[],s=0,h=e.channels.length;s<h;s++){var l=e.channels[s],c=e.samplers[l.sampler],u=l.target,d=void 0!==u.node?u.node:u.id,f=void 0!==e.parameters?e.parameters[c.input]:c.input,m=void 0!==e.parameters?e.parameters[c.output]:c.output;i.push(this.getDependency("node",d)),n.push(this.getDependency("accessor",f)),r.push(this.getDependency("accessor",m)),a.push(c),o.push(u)}return Promise.all([Promise.all(i),Promise.all(n),Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(i){for(var n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],h=[],l=0,c=n.length;l<c;l++){var u=n[l],d=r[l],f=a[l],m=o[l],g=s[l];if(void 0!==u){var v;switch(u.updateMatrix(),u.matrixAutoUpdate=!0,L[g.path]){case L.weights:v=Xa;break;case L.rotation:v=Ya;break;default:v=Ja}var y=u.name?u.name:u.uuid,x=void 0!==m.interpolation?C[m.interpolation]:ft,b=[];L[g.path]===L.weights?u.traverse(function(t){!0===t.isMesh&&t.morphTargetInfluences&&b.push(t.name?t.name:t.uuid)}):b.push(y);var w=f.array;if(f.normalized){var _;if(w.constructor===Int8Array)_=1/127;else if(w.constructor===Uint8Array)_=1/255;else if(w.constructor==Int16Array)_=1/32767;else{if(w.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");_=1/65535}for(var M=new Float32Array(w.length),S=0,A=w.length;S<A;S++)M[S]=w[S]*_;w=M}for(S=0,A=b.length;S<A;S++){var T=new v(b[S]+"."+L[g.path],d.array,w,x);"CUBICSPLINE"===m.interpolation&&(T.createInterpolant=function(t){return new p(this.times,this.values,this.getValueSize()/3,t)},T.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),h.push(T)}}}return new Ka(void 0!==e.name?e.name:"animation_"+t,void 0,h)})},W.prototype.loadNode=function(t){var e,n=this.json,r=this.extensions,a=this,o=n.meshReferences,s=n.meshUses,h=n.nodes[t];return(e=[],void 0!==h.mesh&&e.push(a.getDependency("mesh",h.mesh).then(function(t){var e;if(o[h.mesh]>1){var i=s[h.mesh]++;(e=t.clone()).name+="_instance_"+i,e.onBeforeRender=t.onBeforeRender;for(var n=0,r=e.children.length;n<r;n++)e.children[n].name+="_instance_"+i,e.children[n].onBeforeRender=t.children[n].onBeforeRender}else e=t;return void 0!==h.weights&&e.traverse(function(t){if(t.isMesh)for(var e=0,i=h.weights.length;e<i;e++)t.morphTargetInfluences[e]=h.weights[e]}),e})),void 0!==h.camera&&e.push(a.getDependency("camera",h.camera)),h.extensions&&h.extensions[i.KHR_LIGHTS_PUNCTUAL]&&void 0!==h.extensions[i.KHR_LIGHTS_PUNCTUAL].light&&e.push(a.getDependency("light",h.extensions[i.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(e)).then(function(t){var e;if((e=!0===h.isBone?new nr:t.length>1?new Dn:1===t.length?t[0]:new de)!==t[0])for(var i=0,n=t.length;i<n;i++)e.add(t[i]);if(void 0!==h.name&&(e.userData.name=h.name,e.name=ks.sanitizeNodeName(h.name)),k(e,h),h.extensions&&N(r,e,h),void 0!==h.matrix){var a=new At;a.fromArray(h.matrix),e.applyMatrix(a)}else void 0!==h.translation&&e.position.fromArray(h.translation),void 0!==h.rotation&&e.quaternion.fromArray(h.rotation),void 0!==h.scale&&e.scale.fromArray(h.scale);return e})},W.prototype.loadScene=function(){function t(e,i,n,r){var a=n.nodes[e];return r.getDependency("node",e).then(function(t){return void 0===a.skin?t:r.getDependency("skin",a.skin).then(function(t){for(var i=[],n=0,a=(e=t).joints.length;n<a;n++)i.push(r.getDependency("node",e.joints[n]));return Promise.all(i)}).then(function(i){return t.traverse(function(t){if(t.isMesh){for(var n=[],r=[],a=0,o=i.length;a<o;a++){var s=i[a];if(s){n.push(s);var h=new At;void 0!==e.inverseBindMatrices&&h.fromArray(e.inverseBindMatrices.array,16*a),r.push(h)}}t.bind(new ir(n,r),t.matrixWorld)}}),t});var e}).then(function(e){i.add(e);var o=[];if(a.children)for(var s=a.children,h=0,l=s.length;h<l;h++){var c=s[h];o.push(t(c,e,n,r))}return Promise.all(o)})}return function(e){var i=this.json,n=this.extensions,r=this.json.scenes[e],a=new Zn;void 0!==r.name&&(a.name=r.name),k(a,r),r.extensions&&N(n,a,r);for(var o=r.nodes||[],s=[],h=0,l=o.length;h<l;h++){var c=t(o[h],a,i,this).then(t=>{}).catch(t=>{});s.push(c)}return Promise.all(s).then(function(){return a})}}(),t}();class au{constructor(t){this.map=t,this.isLoading=!1,this.queue=[],this.userQueue=!0,this.modelCache={},this.loader=new ru,this.off=t.on(["reset","clear-cache"],()=>{this.clearQueue(),this.clearCache()})}clearQueue(){this.queue.length=0}clearCache(){this.modelCache={}}preProcess(t){}onLoaded(t,e){this.isLoading=!1,e&&e(t),this.queue.length&&this.queue.splice(0,10).forEach(t=>{this.load(t.url,t.loaded,t.progress,t.error)})}load(t,e,i,n){var r=t.split("?")[0],a=this.modelCache[r];if(!a||a.isSkinnedMesh)this.modelCache[r]=[];else{if(Array.isArray(a))return void a.push({url:t,loaded:e,progress:i,error:n});var o=a,s=o.scene;if(!o.isSkinnedMesh){var h=s.clone();return o.scene=h,void this.onLoaded(o,e)}}this.isLoading=!0,this.loader.load(t,t=>{t.scene.rotateX(Math.PI/2),t.animations.length&&(t.actions={},t.animations.forEach((e,i)=>{var n=this.map.mixer.clipAction(e,t.scene);n.name=e.name,t.actions[e.name||"anim"+i]=n}));var i=!1;t.scene.traverse(t=>{i||"SkinnedMesh"==t.type&&(i=!0)}),t.isSkinnedMesh=i;var n=this.modelCache[r];this.modelCache[r]=t,this.onLoaded(t,e),t.isSkinnedMesh?Array.isArray(n)&&n.forEach(t=>{this.load(t.url,t.loaded,t.progress,t.error)}):(Array.isArray(n)&&n.forEach(e=>{t.scene=t.scene.clone(),this.onLoaded(t,e.loaded)}),this.map.emit("modelLoaded",t))},function(t){var e=t.loaded/t.total;i&&i(e)})}loadByID(t,e,i,n,r,a){var o=kh.getResourceUrl(this.map,t,e,!1,this.map.config.modelPath,a);this.load(o,i,n,r)}dispose(){this.clearCache(),this.clearQueue(),this.off()}}var ou={floorNumber:0,floorName:"",height:0,models:[],markers:[],blocks:[],route:null,userData:"",tag:""};class su extends ol{constructor(t,e,i){super(t,e=e||kh.cloneJSON(ou),new de),this.data.node=this,this.map=t,this.type="OMFloor",this.nodeIndex=i,this.modelNode=new gl(t,"group"),this.modelNode.data.children=this.data.models,new sl(t).bind(this),this.blockNode=new al(t),this.blockNode.data.children=this.data.blocks,this.route=new Ul(t),this.add(this.modelNode,this.route,this.blockNode),this.initByData(e),this._isFadeOut=!1,this.isLocated=!1,this.floorBlocks=[],this.offFocusFloor=this.map.on("viewFloors",(t,e)=>{if(this.nodeIndex.buildingID!==e.data.buildingID)return void(this.map.config.onlyShowFocusBuildingMarkers&&(this.markerNode.background=!0));let i=t.findIndex(t=>t.floorNumber===this.floorNumber)>-1;this.markerNode.background=!i})}get name(){return this.data.floorName}getData(){return super.getData()}get floorNumber(){return this.data.floorNumber}createFloor(){Xc(this.map).modelsCreator.create(this),Xc(this.map).markersCreator.create(this),Xc(this.map).blocksCreator.create(this),this.createRoute()}createRoute(){Xc(this.map).routeCreator.create(this)}updateRouteLineScaleFactor(){this.route.lineNodes.forEach(t=>{t.updateFactorZ()})}initByData(t){this.position.z=this.data.height||0,this.createRoute()}findData(t,e){var prom=new Nh,i=super.findData(t,e);return prom.resolve(i),prom}setAlpha(t,e=600){this._alphaAnim&&this._alphaAnim.stop();var i=kh.collectMaterials(this,t=>{if(t.node&&"SpriteMarkerNode"===t.node.type&&!t.node._markerShow)return!0}),n=[];i.forEach(e=>{"_originAlpha"in e||(e._originAlpha=e.opacity),e.transparent||(e.transparent=!0),n.push({start:e.opacity,cha:(null!==t?t:e._originAlpha)-e.opacity})}),this._alphaAnim=new wh.Tween({x:0}).to({x:1},e).easing(wh.Easing.Cubic.Out).onUpdate(t=>{i.forEach((e,i)=>{e.opacity=n[i].start+n[i].cha*t})}).onComplete(()=>{n.length=0}).start()}getHeight(){return this.entity.updateMatrix(),this.entity.position.z}updateBoundingSphereCenter(){var t=this.data,e=this.getHeight();t.models.forEach(t=>{t.node&&t.node.data&&t.node.data.boundingSphere?t.node.entity.getWorldPosition(t.boundingSphere.center):t.boundingSphere&&(t.boundingSphere.center.z=e)}),t.blocks.forEach(t=>{t.node&&t.node.data&&t.node.data.boundingSphere?t.node.entity.getWorldPosition(t.boundingSphere.center):t.boundingSphere&&(t.boundingSphere.center.z=e)}),t.markers.forEach(t=>{if(t.content||t.anchor)t.node&&t.node.entity?t.node.entity.getWorldPosition(t.point):t.point&&(t.point.z=e);else{if(!t.boundingSphere)return;t.node&&t.node.entity?t.node.entity.getWorldPosition(t.boundingSphere.center):t.boundingSphere.center.z=e}})}fadeOut(t){this._isFadeOut||(this._isFadeOut=!0,t=t||{},this.setAlpha(this.map.config.fadeOutAlpha,t.duration),this.setFloorRenderOrder(!1))}fadeIn(t){this._isFadeOut&&(this._isFadeOut=!1,t=t||{},this.setAlpha(null,t.duration),this.setFloorRenderOrder(!0))}setFloorRenderOrder(t){var e=t?0:1;this.blockNode.children.forEach(t=>{t.entity.renderOrder=e}),this.floorBlocks.forEach(t=>{})}dispose(){super.dispose(),this.offFocusFloor()}}var hu={name:"",buildingID:"",buildingType:0,buildingInfo:"",indoorLevel:0,models:[],blocks:[],markers:[],floors:[],focus:1,viewFloors:[1],userData:"",tag:"",hasOutdoor:!1,entranceFloors:[]};class lu extends ol{constructor(t,e,i){(e=e||kh.cloneJSON(hu)).buildingID&&!t.config.forceNewID||(e.buildingID=kh.generateID(16,"b"));var n=new de;n.name="building",n.visible=!1,super(t,e,n),this.data.node=this,this.map=t,this.nodeIndex=i,this.lastViewFloors=[],this._tryFloorData={},this.type="OMBuilding",this.omScene=null,this.modelNode=new gl(t,"group"),this.modelNode.data.children=this.data.models,new sl(t).bind(this),this.blockNode=new al(t),this.blockNode.data.children=this.data.blocks,this.floorNode=new al(t),this.floorNode.name="floorNode",this.floorNode.visible=!1,this.add(this.modelNode,this.blockNode,this.floorNode),this.currentFocus=[],this.data.floors.sort((t,e)=>t.floorNumber-e.floorNumber);let r=this.map.config.focusBuildingID;r&&r!==this.data.buildingID||(this.data.viewFloors=[].concat(this.map.config.viewFloors||this.data.viewFloors)),this._floorLoaded={},this.map.once("update",()=>{this.isIndoor&&this.setViewFloorsByConfig()}),this.hideNodes(),this.isIndoor=null}get buildingID(){return this.data.buildingID}setViewFloorsByConfig(){var t=this.map.config.viewFloors||this.data.viewFloors;null!=t&&(Array.isArray(t)||"object"!=typeof t||(t=t[this.data.buildingID]),t&&this.isInView&&(this.map.config.focusBuildingID&&this.map.config.focusBuildingID!==this.data.buildingID||this.focusFloors(this.map.config.focusFloors||this.data.focus,{duration:0,animate:!1})))}setTransform(){if(this.nodeIndex){var t=this.nodeIndex.transform;this.position=t.position,this.entity.rotation.fromArray(t.rotation),this.entity.scale.fromArray(t.scale)}}createBuilding(){Xc(this.map).modelsCreator.create(this),Xc(this.map).blocksCreator.create(this)}getData(){var t=super.getData();return t.floors=this.floorNode.children.map(t=>{var e=kh.getBoundingSphere(t.entity);return t.nodeIndex.radius=e.radius,t.nodeIndex}),t}getOMScene(){for(var t=this;t.parent;){if("OMScene"===t.type)return t;t=t.parent}}remove(){var t=this;t.parent&&t.parent.remove(t,!1),t.omScene&&kh.findFromArray(t.omScene.data.buildings,"buildingID",t.data.buildingID,(e,i)=>{t.omScene.data.buildings.splice(i,1)})}addFloor(t){this.floorNode.add(t);var e=t.nodeIndex||this.getFloorIndex(t);e||(e={id:kh.generateID().toLowerCase(),floorNumber:t.data.floorNumber,floorName:t.data.floorName,userData:{}},this.data.floors.push(e)),t.nodeIndex=e,t.building=this}removeFloor(t){this.floorNode.remove(t,!1),delete t.building,kh.findFromArray(this.data.floors,"floorNumber",t.getProp("floorNumber"),(t,e)=>{this.data.floors.splice(e,1)})}get isInView(){return this.map.visibleManager._buildings.find(t=>t.building===this)}viewFloors(t,e){e=Object.assign({floorSpace:this.map.config.floorSpace,duration:0},e),null!=t&&"all"!==t||(t=this.data.floors.map(t=>t.floorNumber));for(var i=(t=[].concat(t)).length-1;i>-1;i--){var n=t[i],r=this.data.floors.findIndex(t=>t.floorNumber===n);r<0&&t.splice(i,1)}return this.data.viewFloors=t,this.data.viewFloors.sort((t,e)=>t-e),this.locateFloors(e).then((t,e)=>Nh.empty(t,this))}focusFloors(t,e){e=e||{},t=[].concat(t);var prom=new Nh,i=null,n=this.data.viewFloors;1===n.length?i=t:n.length>1&&(i=n.slice(),t.forEach(t=>{i.indexOf(t)<0&&i.push(t)}));var r="2d"===this.map.view.viewMode;this.data.focus=t;var a=[];return this.viewFloors(i,e).then(i=>{var n=i.floors,o=i.heights,s=0;if(1===t.length&&t[0]===this.currentFocus[0])return this.map.emit("focusFloors",t,this,n),e.callback&&e.callback(n),setTimeout(()=>{prom.resolve(n)},0),prom;this.currentFocus=t,n.forEach((e,i)=>{t.indexOf(e.data.floorNumber)>-1?(this.map.config.enableFloorAlpha&&e.fadeIn(),e.setFloorRenderOrder(!0),a.push(e),s+=o[i]):(this.map.config.enableFloorAlpha&&e.fadeOut(),e.setFloorRenderOrder(!1))}),s/=t.length;var h=this.map.view.controls.target.clone();h.z=s,this.map.view.moveTo({viewCenter:h,easing:e.easing||"cubicOut",zoom:e.zoom,viewAngle:e.viewAngle,polarAngle:e.polarAngle,duration:r?0:void 0===e.duration?800:e.duration,isImportant:!0,callback:()=>{e.callback&&e.callback(),this.map.emit("focusFloors",t,this,a),setTimeout(()=>{this.map.emit("viewChanged"),this.map.config.floorSpace<.05&&this.map.emit("viewChanged")},0),prom.resolve(a)}})}),prom}toIndoor(t){let prom=new Nh;if(this.isIndoor||this._showAnim)return Nh.empty(this);-1===this.map.visibleManager.focusBuildings.indexOf(this.data)&&this.map.visibleManager.focusBuildings.push(this.data),t=Object.assign({duration:600},t);var e=this;t.noEvent||e.map.config.autoInOutdoor||(e.map.visibleManager._lastFocusBuilding=e,e.map.emit("focusBuilding",e));var i=null===this.isIndoor?0:t.duration/2;return this.isIndoor=!0,e.firstTimeToIndoor||(e.locateFloors({duration:0,emitViewFloorEvent:!1}),e.firstTimeToIndoor=!0),e.showNodesAnimate(!1,{duration:i,nodes:[e.modelNode,e.blockNode],callback:function(){e.showNodesAnimate(!0,{duration:i,animateAlpha:!1,nodes:[e.floorNode],callback:function(){e.map.emit("viewChanged"),e.map.emit("door",!0,e),prom.resolve(e)}})}}),prom}toOutdoor(t){if(!0!==this.data.hasOutdoor)return;let prom=new Nh;if(!1===this.isIndoor||this._showAnim)return Nh.empty(this);var e=this,i=this.map.visibleManager.focusBuildings.indexOf(this.data);return-1!==i&&this.map.visibleManager.focusBuildings.splice(i,1),t=Object.assign({duration:1e3},t),this.isIndoor=!1,t.noEvent||e.map.config.autoInOutdoor||e.map.visibleManager._lastFocusBuilding!==e||(e.map.visibleManager._lastFocusBuilding=null,e.map.emit("focusBuilding",null)),e.showNodesAnimate(!1,{animateAlpha:!1,nodes:[e.floorNode],duration:t.duration/2,callback:function(){e.showNodesAnimate(!0,{duration:t.duration/2,nodes:[e.modelNode,e.blockNode],callback:function(){e.map.emit("viewChanged"),e.map.emit("door",!1,e),prom.resolve(e)}})}}),prom}locateFloors(t){var e=this;function i(t){t.updateBoundingSphereCenter(),e.map.emit("viewChanged"),e.map.emit("locateFloor",t,e),e.map.emit("viewFloor",t,e)}"number"==typeof t&&(t={floorSpace:t}),t=Object.assign({animate:!0,delay:88,autoDelay:!1,allDelayTime:1e3,floorSpace:this.map.config.floorSpace,compactFloorSpace:4,duration:600,easing:"backout",compact:!1,emitViewFloorEvent:!0},t),this.map.config.floorSpace=t.floorSpace;var n=[],r=[],a=[];return this.data.viewFloors.forEach((o,s)=>{var h;h=e.getFloorByFloorNumber(o).then(n=>{new Nh;let o=n.data.floorNumber;e.data.floors.findIndex(t=>t.floorNumber===o);var h=0;if(t.compact){h=(o>0?o-1:o)*t.compactFloorSpace;let i=e.currentFocus[0],n=e.currentFocus[e.currentFocus.length-1];i<0&&o<=i?h-=t.compactFloorSpace:n>0&&o>n&&(h+=t.compactFloorSpace)}else h=(o>0?o-1:o)*t.floorSpace;a.push(h);var l=t.autoDelay?t.allDelayTime/e.data.viewFloors.length:t.delay;if(t.animate){n._anim&&(n._anim.stop(),n._anim=null);var c="string"==typeof t.easing?kh.getEasingByName(t.easing):t.easing,u=new Nh;r.push(u),Math.abs(n.entity.position.z-h)<.05?(n.entity.position.z=h,setTimeout(()=>{u.resolve(n)},0)):n._anim=new wh.Tween(n.entity).delay(s*l).to({"position.z":h},t.duration).onComplete(()=>{n._anim=null,i(n),u.resolve(n)}).easing(c).start()}else n.entity.position.z=h,n.entity.updateMatrix(),e.map.update(!0),i(n);return n}),n.push(h)}),Nh.all(n).then(i=>{i.forEach(t=>{t.isLocated=!0,t.updateRouteLineScaleFactor()});try{e.map.emit("locateFloors",i,e),t.emitViewFloorEvent&&(e.lastViewFloors=i,e.map.emit("viewFloors",i,e))}catch(t){}return r.length?Nh.all(r).then(t=>(this.map.emit("viewChanged"),{floors:i,heights:a})):(this.map.emit("viewChanged"),{floors:i,heights:a})})}getFloorByFloorNumber(t,e){var prom=new Nh,i=this.data.floors.find(e=>e.floorNumber==t);if(i)if(i.node)prom.resolve(i.node),e&&e(i.node);else{if(this._floorLoaded[t])return this._floorLoaded[t].push(prom),prom;this._floorLoaded[t]=[prom],this.map.omLoader.loadFloor(this.data.buildingID,i);var n=this.map.on("floorLoaded",t=>{t.data.floorNumber===i.floorNumber&&t.data.buildingID===i.buildingID&&(n(),this._floorLoaded[i.floorNumber].forEach(e=>{e.resolve(t)}),e&&e(t))})}else prom.resolve(null),e&&e(null);return prom}getFloorByFloorNumberSync(t){return this.floorNode.children.find(e=>e.data.floorNumber===t)}getFloors(t){var e=[];return(t||this.data.floors.map(t=>t.floorNumber)).forEach(t=>{e.push(this.getFloorByFloorNumber(t))}),Nh.all(e)}findData(t,e){var prom=new Nh;e=Object.assign({recursive:!0,multi:!0},e);var i=[];return i.buildingID=this.data.buildingID,this.getFloors(e.floors).then(n=>{n.forEach((n,r)=>{n.findData(t,e).then(t=>{t.length&&(t.floorNumber=n.data.floorNumber,t.floorName=n.data.floorName,i.push(t))})}),prom.resolve(i)}),prom}getNodeByID(t){var prom=new Nh;return this.findData({id:t}).then(t=>{if(t.length){var e=t[0],i=e[0];i.floorNumber=e.floorNumber,i.floorName=e.floorName,prom.resolve(i)}else prom.resolve(null)}),prom}getFloorIndex(t){return t.getRootModelRadius(),kh.findFromArray(this.data.floors,"floorNumber",t.data.floorNumber,(t,e)=>t)}localPosition(t){return Array.isArray(t)&&(t=(new Lt).fromArray(t)),this.entity.worldToLocal(t.clone())}worldPosition(t){return Array.isArray(t)&&(t=(new Lt).fromArray(t)),this.entity.localToWorld(t.clone())}findPath(t,e,i){var n,prom=new Nh,r=(n=Array.isArray(t)?t:Array.from(arguments))[n.length-1],a={clearLines:!0,createLines:!0,createCrossLines:!0,isPair:!1};"object"!=typeof r||"point"in r||(a=Object.assign(a,n.pop()));var o=Object.assign({},a,{clearLines:!1});if(!(n.length<2)){if(n.length>2){this.clearRoutes();var s=[];let t=a.isPair?2:1;for(var h=0;h<n.length-1;h+=t){var l=this.findPath(n[h],n[h+1],o);s.push(l)}return Nh.all(s,!0)}a.clearLines&&this.clearRoutes();var c=a;return Array.isArray(t.point)?t.point[2]=0:(t.point=t.point.clone(),t.point.z=0),Array.isArray(e.point)?e.point[2]=0:(e.point=e.point.clone(),e.point.z=0),t.floorNumber==e.floorNumber?this.getFloorByFloorNumber(t.floorNumber).then(i=>{i.route.findPathAsync(t.point,e.point,c).then(n=>{n.building=this,n.vectors.length?prom.resolve(n):this.tryConnectTwoFloors(t,e,i,i,c,prom)})}):this.getFloorByFloorNumber(t.floorNumber).then(n=>{this.getFloorByFloorNumber(e.floorNumber).then(r=>{let a=n.route.findLiftPair(t,e,r,i);if(!a||Object.values(a).some(t=>!t))return void this.tryConnectTwoFloors(t,e,n,r,c,prom);let o={point:a.fromLiftPoint},s={point:a.toLiftPoint};var h=n.route.findPathAsync(t.point,o.point,c),l=r.route.findPathAsync(s.point,e.point,c);Nh.all([h,l]).then(i=>{var a=o.point.clone(),h=s.point.clone();n.entity.localToWorld(a),r.entity.localToWorld(h);var l=a.z,u=h.z,d=e.floorNumber>t.floorNumber;a.z-=d?l:u,h.z-=d?l:u;var p=d?n:r;if(c.createLines&&c.createCrossLines){var f=this.createCrossLine(p,a,h);i.push({type:"crossLines",lines:[f],vectors:[a,h]})}i.building=this,i.some(t=>!t.vectors.length)?this.tryConnectTwoFloors(t,e,n,r,c,prom):prom.resolve(i)})})}),prom}}tryFloorConnect(t,e,i,n,r,a,prom){this._tryFloorData[r.floorNumber]||(this._tryFloorData[r.floorNumber]={floor:null,liftsConnection:{}}),this._tryFloorData[r.floorNumber].floor=r;let o=i.route.toPoint(t.point),s=n.route.toPoint(e.point),h=i.route.findClosestLifts(o,r.floorNumber),l=n.route.findClosestLifts(s,r.floorNumber);this._tryFloorData.fromLifts=h,this._tryFloorData.toLifts=l;let c,u,d=r.route.findClosestLifts(o,t.floorNumber,{count:void 0}),p=r.route.findClosestLifts(s,e.floorNumber,{count:void 0});if(this._tryFloorData[r.floorNumber].liftsConnection[t.floorNumber]=d,this._tryFloorData[r.floorNumber].liftsConnection[e.floorNumber]=p,!d.length||!p.length)return Nh.empty();for(var f=0;f<h.length;f++){let o=h[f];if(c=Ul.tryConnect(i.route,t.point,o.point).connection,!c)continue;let s=r.route.findClosestLifts(o.point);if(s&&s.length)for(var m=0;m<l.length;m++){let i=l[m];if(u=Ul.tryConnect(n.route,i.point,e.point).connection,!u)continue;let h=r.route.findClosestLifts(i.point);if(h&&h.length&&Ul.tryConnect(r.route,s[0].point,h[0].point).connection){let n=[t,{point:o.point,floorNumber:t.floorNumber},{point:s[0].point,floorNumber:r.floorNumber},{point:h[0].point,floorNumber:r.floorNumber},{point:i.point,floorNumber:e.floorNumber},e,Object.assign(a,{isPair:!0})];return this.findPath(n).then(t=>{prom.resolve(t)})}}}return Nh.empty()}tryConnectTwoFloors(t,e,i,n,r,prom){let a=this.map.config.linkedFloors||this.nodeIndex.userData.linkedFloors;if(!a||!a.length)return void prom.resolve();let o=[];a.forEach(i=>{let n=Math.abs(t.floorNumber-i)+Math.abs(e.floorNumber-i);o.push({n:i,num:n})}),o.sort((t,e)=>t.num-e.num),o=o.map(t=>t.n),this._tryFloorData={},this.tryWork(t,e,i,n,r,o,0,prom)}tryWork(t,e,i,n,r,a,o,prom){if(o<a.length)this.getFloorByFloorNumber(a[o]).then(s=>{this.tryFloorConnect(t,e,i,n,s,r,prom).then(s=>{!s||Array.isArray(s)&&s.some(t=>!t)?(o+=1,this.tryWork(t,e,i,n,r,a,o,prom)):prom.resolve(s)})});else{let a=Object.assign({},this._tryFloorData);delete a.fromLifts,delete a.toLifts;let o,l,c,u,d=Object.keys(a),p=d.filter(e=>this._tryFloorData[e].liftsConnection[t.floorNumber].length>0),f=d.filter(t=>this._tryFloorData[t].liftsConnection[e.floorNumber].length>0),m=[];for(var s=0;s<p.length;s++){o=p[s],m=[o],c=this._tryFloorData[o].floor;for(var h=0;h<f.length;h++){if(l=f[h],m.indexOf(l)>-1)continue;u=this._tryFloorData[l].floor;let a=c.route.findLiftPair(t,e,u,r);if(a){let s=!1,h=i.route.findLiftPair(t,{point:a.fromLiftPoint},c,r);if(h||(h=i.route.findLiftPair(t,{point:a.toLiftPoint},u,r),s=!0),h){let i=(s?c:u).route.findLiftPair({point:s?a.fromLiftPoint:a.toLiftPoint},e,n,r);if(s){let t=a.toLiftPoint;a.toLiftPoint=a.fromLiftPoint,a.fromLiftPoint=t,t=o,o=l,l=t}if(i){let n=[t,{point:h.fromLiftPoint,floorNumber:t.floorNumber},{point:h.toLiftPoint,floorNumber:o},{point:a.fromLiftPoint,floorNumber:o},{point:a.toLiftPoint,floorNumber:l},{point:i.fromLiftPoint,floorNumber:l},{point:i.toLiftPoint,floorNumber:e.floorNumber},e,Object.assign(r,{isPair:!0})];return this.findPath(n).then(t=>{prom.resolve(t)})}}}}}prom.resolve(null)}}clearRoutes(){this.floorNode.children.forEach(t=>{t.route.clearLines()})}createCrossLine(t,e,i){return t.route.createLineNodeByPoints([e.clone(),i.clone()],{up:new Lt(0,-1,0),update:function(t){this.entity.rotation.z=this.map.view.controls.getAzimuthalAngle()}})}get entranceFloors(){let t=[],e=this.userData;return e&&e.entranceFloors&&(t=[].concat(e.entranceFloors)),this.data.entranceFloors&&this.data.entranceFloors.length&&(t=[].concat(this.data.entranceFloors)),t.length||(t=[1]),t}get connectBuildings(){if(this.userData){let t=this.userData.connectBuildings;return t?[].concat(t):null}}getEntrancePoints(){let t=this.entranceFloors.map(t=>this.getFloorByFloorNumber(t).then(t=>{if(!t)return null;let e=t.route.points.filter(t=>t.pointType>=4&&t.pointType<=6);return e.floorNumber=t.floorNumber,e.buildingPosition=this.position,e.building=this,e}));return Nh.all(t)}dispose(){this.remove(),super.dispose(),this.nodeIndex=null,this.omScene=null}}function cu(t,e){var i,n,r,a;let o=null;o=t.points.flat(),o.forEach((t,e)=>{0===e?(i=r=t[0],n=a=t[1]):(t[0]<i?i=t[0]:t[0]>r&&(r=t[0]),t[1]<n?n=t[1]:t[1]>a&&(a=t[1]))});var s=new Lt(i,n,0),h=new Lt(r,a,0),l=s.clone().add(h).divideScalar(2);if(e){var c=(new Lt).fromArray(e.transform.position);l.add(c)}var u=new Gt(l,s.distanceTo(h)/2);return t.boundingSphere=u,u}function uu(t,e){var i=(new Lt).fromArray(t.transform.position);e&&i.add((new Lt).fromArray(e.transform.position));var n=t.radius;return t.boundingSphere=new Gt(i,n),t.boundingSphere}function du(t,e){if(e)var i=(new Lt).fromArray(e.transform.position);kh.traverseJSON(t,{userData:(t,e)=>{t&&"string"==typeof t&&(e.userData=JSON.parse(t))},scripts:(t,e)=>{t&&(e.scripts=t.map(t=>JSON.parse(t)))},scriptCodes:(t,e)=>{t&&(e.scriptCodes=JSON.parse(t))}}),t.blocks&&t.blocks.forEach(t=>{cu(t,e),t.topImages&&t.topImages.forEach(t=>{t.content&&(t.content=JSON.parse(t.content))})}),t.models&&t.models.forEach(t=>{uu(t,e)}),t.markers&&t.markers.forEach(t=>{t.content&&"string"==typeof t.content&&(t.content=JSON.parse(t.content)),t.position?t.point=(new Lt).fromArray(t.position):t.transform&&(t.point=(new Lt).fromArray(t.transform.position)),e&&t.point&&t.point.add(i)})}function pu(t){return new Gt((new Lt).fromArray(t.transform.position),t.radius||25)}function fu(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function mu(t,e,i,n,r,a){return fu(function(t,e){return t<<e|t>>>32-e}(fu(fu(e,t),fu(n,a)),r),i)}function gu(t,e,i,n,r,a,o){return mu(e&i|~e&n,t,e,r,a,o)}function vu(t,e,i,n,r,a,o){return mu(e&n|i&~n,t,e,r,a,o)}function yu(t,e,i,n,r,a,o){return mu(e^i^n,t,e,r,a,o)}function xu(t,e,i,n,r,a,o){return mu(i^(e|~n),t,e,r,a,o)}function bu(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var i,n,r,a,o,s=1732584193,h=-271733879,l=-1732584194,c=271733878;for(i=0;i<t.length;i+=16)n=s,r=h,a=l,o=c,h=xu(h=xu(h=xu(h=xu(h=yu(h=yu(h=yu(h=yu(h=vu(h=vu(h=vu(h=vu(h=gu(h=gu(h=gu(h=gu(h,l=gu(l,c=gu(c,s=gu(s,h,l,c,t[i],7,-680876936),h,l,t[i+1],12,-389564586),s,h,t[i+2],17,606105819),c,s,t[i+3],22,-1044525330),l=gu(l,c=gu(c,s=gu(s,h,l,c,t[i+4],7,-176418897),h,l,t[i+5],12,1200080426),s,h,t[i+6],17,-1473231341),c,s,t[i+7],22,-45705983),l=gu(l,c=gu(c,s=gu(s,h,l,c,t[i+8],7,1770035416),h,l,t[i+9],12,-1958414417),s,h,t[i+10],17,-42063),c,s,t[i+11],22,-1990404162),l=gu(l,c=gu(c,s=gu(s,h,l,c,t[i+12],7,1804603682),h,l,t[i+13],12,-40341101),s,h,t[i+14],17,-1502002290),c,s,t[i+15],22,1236535329),l=vu(l,c=vu(c,s=vu(s,h,l,c,t[i+1],5,-165796510),h,l,t[i+6],9,-1069501632),s,h,t[i+11],14,643717713),c,s,t[i],20,-373897302),l=vu(l,c=vu(c,s=vu(s,h,l,c,t[i+5],5,-701558691),h,l,t[i+10],9,38016083),s,h,t[i+15],14,-660478335),c,s,t[i+4],20,-405537848),l=vu(l,c=vu(c,s=vu(s,h,l,c,t[i+9],5,568446438),h,l,t[i+14],9,-1019803690),s,h,t[i+3],14,-187363961),c,s,t[i+8],20,1163531501),l=vu(l,c=vu(c,s=vu(s,h,l,c,t[i+13],5,-1444681467),h,l,t[i+2],9,-51403784),s,h,t[i+7],14,1735328473),c,s,t[i+12],20,-1926607734),l=yu(l,c=yu(c,s=yu(s,h,l,c,t[i+5],4,-378558),h,l,t[i+8],11,-2022574463),s,h,t[i+11],16,1839030562),c,s,t[i+14],23,-35309556),l=yu(l,c=yu(c,s=yu(s,h,l,c,t[i+1],4,-1530992060),h,l,t[i+4],11,1272893353),s,h,t[i+7],16,-155497632),c,s,t[i+10],23,-1094730640),l=yu(l,c=yu(c,s=yu(s,h,l,c,t[i+13],4,681279174),h,l,t[i],11,-358537222),s,h,t[i+3],16,-722521979),c,s,t[i+6],23,76029189),l=yu(l,c=yu(c,s=yu(s,h,l,c,t[i+9],4,-640364487),h,l,t[i+12],11,-421815835),s,h,t[i+15],16,530742520),c,s,t[i+2],23,-995338651),l=xu(l,c=xu(c,s=xu(s,h,l,c,t[i],6,-198630844),h,l,t[i+7],10,1126891415),s,h,t[i+14],15,-1416354905),c,s,t[i+5],21,-57434055),l=xu(l,c=xu(c,s=xu(s,h,l,c,t[i+12],6,1700485571),h,l,t[i+3],10,-1894986606),s,h,t[i+10],15,-1051523),c,s,t[i+1],21,-2054922799),l=xu(l,c=xu(c,s=xu(s,h,l,c,t[i+8],6,1873313359),h,l,t[i+15],10,-30611744),s,h,t[i+6],15,-1560198380),c,s,t[i+13],21,1309151649),l=xu(l,c=xu(c,s=xu(s,h,l,c,t[i+4],6,-145523070),h,l,t[i+11],10,-1120210379),s,h,t[i+2],15,718787259),c,s,t[i+9],21,-343485551),s=fu(s,n),h=fu(h,r),l=fu(l,a),c=fu(c,o);return[s,h,l,c]}function wu(t){var e,i="",n=32*t.length;for(e=0;e<n;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i}function _u(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e<i.length;e+=1)i[e]=0;var n=8*t.length;for(e=0;e<n;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i}function Mu(t){var e,i,n="";for(i=0;i<t.length;i+=1)e=t.charCodeAt(i),n+="0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(15&e);return n}function Su(t){return unescape(encodeURIComponent(t))}function Au(t){return function(t){return wu(bu(_u(t),8*t.length))}(Su(t))}function Tu(t,e){return function(t,e){var i,n,r=_u(t),a=[],o=[];for(a[15]=o[15]=void 0,r.length>16&&(r=bu(r,8*t.length)),i=0;i<16;i+=1)a[i]=909522486^r[i],o[i]=1549556828^r[i];return n=bu(a.concat(_u(e)),512+8*e.length),wu(bu(o.concat(n),640))}(Su(t),Su(e))}var Lu,Cu=function(t,e,i){return e?i?Tu(e,t):function(t,e){return Mu(Tu(t,e))}(e,t):i?Au(t):function(t){return Mu(Au(t))}(t)};function Pu(){var t=["s8oGW5RcMsW","W6NcO2JdM8ohALm","WOldHeRdQCkD","omoSW4ldGa","W6iNWRJcPG","gGejW64","chaUtMK","iCoUeCobgG","W5/cK8kMWORcKL88m8oIWQK","w8o3oLf+","FCoOaSozha","fSkGW7nBW6i","CvFdGSodlG","o8o9cSoqgW","jSo1FcebWQZdNdtdVLG","mmoxpse","WOTbWOTt","WQhcO29TtsHxpG","tCo6oG","WRLvvw3cIa","wLTNqdy","cSkKW7eYW4q","W5pcMmk8hCkp","z0ddR8kcoa","F1tdOSo2W4ddO2b/WPWwhMu","WRdcLJVdMmow","pSkRW77cVIBcMmknWPO","W5/cSJ/dSKO","WPLbWPPlW6K","t8k7amknWP0","rN0j","DurMWRGnoK5hECkz","W77dTLzpBq","bHxdTmkHnvBcV8kWW54","E8ojW7ddNSkeee8","l8oXW4i","WQv7jgZcKq","WR/cH0O","WR8bW4xdSZK","5zUVfowER8kn5z2X","W6xdIWCFcG","EKdcQSksna","lSkZWRC1vG","yYPZdfBdS8omFhjp","BWtcTCkPWPu","xYCzha","saqdc8ox","W71UkdVcGa","W6yNWRRcUCoB","nG3cN8kBESkwDSk0DJBcNq","W67dMGRcH8oaq1RdHN8S","W70HWRm","W6xdNXaYgG","zcPWcxxdPmoqAgnc","W6tcNSk6cmkc","WRtcILBdLCoG","WRO+WRZcV8oa","xSoOlfn/","vHjHWQKU","tJZcTITB","W5JdNuFdTmkT","p8oWWR45","W4xcMXFcO8oXB3/cQtVcP8kHpW","WQ1tx3/cIq","rvFcTSkfoG","W6RdNa/cHmoUB3NdJv0Y","q8oJWRiIW7ZcKhasW6tdTG","W4ZdOfP1AG","iCo1W4BdLmkI","aIVdQW","WOLbWOjxW4q","hCkKW6CYW6y","gmkNytRdQCkVvmofBCkt","WQDCzcy","WO5cEq7cUq","ecVdRmobW48","dmoVg8oObG","tCosna","ESo2W5BcJG","vedcQa","WO7cHSkxE8k7","Bf8ne8o6","amk5W6DMW44","t8kNW5xcHr4","WQDqCYxcTq","W4ZcLmkXdSkp","v3BcR8o6W4TTcCkwWQG","W4ldMSo2W5hcHa","W6u7Cc/dJ8o3WQ1EeCk7d8oZWPy","W5VdJa8joW","WPRMM5nF5z2WxW","W6VdNW/cI8k+ev3dJgyUeWC","eCoYW5/dQmkU","iCo8WRiPbW","kSo2WRu6dG","W7u6WRG","DSkLoN4P","W5xcNrBcQSoY","brtdSCogg1BcLmkcW4rD","ACkzdq","DCkwFLmI","jXNcU8opzIJcVCkMWPqowCo3","zCo+W58","oGVcTSk4","i8okpqTHW41sfSojjSoee8kw","nSomnYBcLa","h8k1W6P1W44","dIFdTSopW4u","WQNdML7dHCkN","yCoul8k4WOe","W6H/W6VcLCo8","W7HrWOFcOfO7rItcHmkjW7q"];return(Pu=function(){return t})()}wx.getSystemInfoSync().pixelRatio,Lu=ic.markerScale,function(t){function e(t,e){return Bu(t- -39,e)}for(var i=t();;)try{if(166732==parseInt(e(262,"T]Dn"))/1+-parseInt(e(296,"azuG"))/2*(-parseInt(e(216,"V6Sb"))/3)+-parseInt(e(287,"*G1c"))/4*(parseInt(e(297,"ok!8"))/5)+parseInt(e(252,"VpWB"))/6+-parseInt(e(249,"azuG"))/7*(-parseInt(e(277,"0*xv"))/8)+-parseInt(e(271,"xl@8"))/9*(-parseInt(e(294,"m!N)"))/10)+-parseInt(e(255,"w$np"))/11*(parseInt(e(280,"N&vO"))/12))break;i.push(i.shift())}catch(t){i.push(i.shift())}}(Pu);var Eu,Du,Iu,Ou,Nu,ku,zu=!0;function Ru(t,e){function i(t,e){return Bu(t-538,e)}var n=t[i(791,"MjPs")+"g"];n[i(851,"P9Ge")]?Cu(n[i(817,"JUJE")]+"&"+n[i(869,"wGJV")+i(886,"IALO")])===e?(ju[i(795,"N&vO")+i(842,"G49u")+"in"](),zu=!1):ju[i(804,"zyCi")+i(798,"qr8#")+i(827,"&X6z")]():ju[i(880,"JUJE")+i(840,"!Jg@")+i(877,"V6Sb")]()}function Bu(t,e){var i=Pu();return Bu=function(e,n){var r=i[e-=237];void 0===Bu.JVALND&&(Bu.SkxzBr=function(t,e){var i,n,r=[],a=0,o="";for(t=function(t){for(var e,i,n="",r="",a=0,o=0;i=t.charAt(o++);~i&&(e=a%4?64*e+i:i,a++%4)?n+=String.fromCharCode(255&e>>(-2*a&6)):0)i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(i);for(var s=0,h=n.length;s<h;s++)r+="%"+("00"+n.charCodeAt(s).toString(16)).slice(-2);return decodeURIComponent(r)}(t),n=0;n<256;n++)r[n]=n;for(n=0;n<256;n++)a=(a+r[n]+e.charCodeAt(n%e.length))%256,i=r[n],r[n]=r[a],r[a]=i;n=0,a=0;for(var s=0;s<t.length;s++)a=(a+r[n=(n+1)%256])%256,i=r[n],r[n]=r[a],r[a]=i,o+=String.fromCharCode(t.charCodeAt(s)^r[(r[n]+r[a])%256]);return o},t=arguments,Bu.JVALND=!0);var a=e+i[0],o=t[a];return o?r=o:(void 0===Bu.zbIkIG&&(Bu.zbIkIG=!0),r=Bu.SkxzBr(r,n),t[a]=r),r},Bu(t,e)}function Fu(t){function e(t,e){return Bu(t-797,e)}Eu=t,(Du=function(){function t(t,e){return Bu(e- -644,t)}var e={container:{type:t("Z(TJ",-360)+t("irTn",-337),flowType:t("QX$e",-370)+t("azuG",-375),margin:20,elements:[{type:t("NK1%",-383)+t("IALO",-297),align:t(")t#o",-406),space:0,color:t("*G1c",-298)+"ff",strokeColor:t("G49u",-357)+"00",elements:[{text:t("9cq4",-303)+t("JUJE",-364)+decodeURIComponent("%E5%9B%BE"),size:36},{text:t("sgvC",-317)+t("!Jg@",-371),size:46}]}]}};return new xc(Eu,{fixedSize:!1,onLoad:function(){function e(e,i){return t(i,e- -241)}this[e(-574,"OBF^")]/=2.25*Lu,this[e(-570,"zyCi")+"t"]/=2.25*Lu,Nu=this[e(-564,"MjPs")],ku=this[e(-570,"zyCi")+"t"]}},e)}())[e(1131,"N&vO")+e(1089,"677V")][e(1055,"ok!8")+"ty"]=.5,Du[e(1120,"NK1%")+"r"][e(1129,"$bei")](1,0),Ou=3,Eu[e(1111,"9cq4")+e(1140,"azuG")+"er"][e(1092,"lGTc")][e(1034,"uV$L")+e(1135,"yuqg")+"r"](e(1056,"J&4N"))[e(1117,"OBF^")](Du),Du[e(1045,"&V9%")+"le"]=!1,ju[e(1079,"ok!8")+e(1119,"kDju")+e(1041,"k97v")+e(1074,"xl@8")+e(1097,"w$13")+"ew"](68,28),Eu.on(e(1046,"$i^%")+"e",function(){function t(t,i){return e(t- -881,i)}ju[t(180,"QX$e")+t(206,"w$np")+t(215,"&O7z")+t(166,"G49u")+t(170,"azuG")+"ew"](68,28)}),Eu.on(e(1141,"@z!l")+"se",()=>{clearInterval(Iu)}),Iu=setInterval(function(){zu?(Ou=3,Uu()):clearInterval(Iu)},5e3)}function Uu(){function t(t,e){return Bu(t-629,e)}!function(){function t(t,e){return Bu(e- -620,t)}return Eu[t("ok!8",-315)][t("VpWB",-295)],Eu[t("qr8#",-302)][t("V6Sb",-375)+"t"],!0}()?Eu[t(946,"lGTc")][t(912,"Z(TJ")+"t"]-Ou<=40?(Ou=Eu[t(892,"QX$e")][t(925,"P9Ge")+"t"]-40,ju[t(911,"ok!8")+t(959,"qr8#")+t(871,"JUJE")+t(941,"zyCi")+t(876,"OBF^")+"ew"]()):(Ou+=10,setTimeout(function(){Uu()},20)):ju[t(927,"G49u")+t(915,"0*xv")+t(937,"DNnL")+t(875,")t#o")+t(938,"zyCi")+"ew"]()}var Gu,ju={_wx_utils_chu:function(){var t,e;Du[(t="Y3e]",e=939,Bu(e-669,t)+"le")]=!0},_wx_utils_in:function(){var t,e;Du[(t=16,e="J&4N",Bu(t- -249,e)+"le")]=!1},"_wx_editor_core.panorvrview":function(t,e){var i=Eu[o(1302,")t#o")][o(1268,"P9Ge")],n=Eu[o(1264,"677V")][o(1293,"J&4N")+"t"],r=t||i/2,a=e||n/2;function o(t,e){return Bu(t-996,e)}Du[o(1271,"k97v")]=Nu*Eu[o(1247,"Z(TJ")][o(1336,"T]Dn")+o(1281,")t#o")],Du[o(1320,"k97v")+"t"]=ku*Eu[o(1289,"*G1c")][o(1325,"rR*x")+o(1333,"ok!8")],Du[o(1267,"DiXT")+o(1237,")t#o")][o(1263,"&O7z")](r,1,a)}},Vu=Vu||function(t){var e=Object.create||function(){function t(){}return function(e){var i;return t.prototype=e,i=new t,t.prototype=null,i}}(),i={},n=i.lib={},r=n.Base={extend:function(t){var i=e(this);return t&&i.mixIn(t),i.hasOwnProperty("init")&&this.init!==i.init||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=n.WordArray=r.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,i=t.words,n=this.sigBytes,r=t.sigBytes;if(this.clamp(),n%4)for(var a=0;a<r;a++){var o=i[a>>>2]>>>24-a%4*8&255;e[n+a>>>2]|=o<<24-(n+a)%4*8}else for(a=0;a<r;a+=4)e[n+a>>>2]=i[a>>>2];return this.sigBytes+=r,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=t.ceil(i/4)},clone:function(){var t=r.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var i,n=[],r=function(e){var i=987654321,n=4294967295;return function(){var r=((i=36969*(65535&i)+(i>>16)&n)<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n;return r/=4294967296,(r+=.5)*(t.random()>.5?1:-1)}},o=0;o<e;o+=4){var s=r(4294967296*(i||t.random()));i=987654071*s(),n.push(4294967296*s()|0)}return new a.init(n,e)}}),o=i.enc={},s=o.Hex={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r<i;r++){var a=e[r>>>2]>>>24-r%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n<e;n+=2)i[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new a.init(i,e/2)}},h=o.Latin1={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r<i;r++){var a=e[r>>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n<e;n++)i[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new a.init(i,e)}},l=o.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},c=n.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var i=this._data,n=i.words,r=i.sigBytes,o=this.blockSize,s=r/(4*o),h=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*o,l=t.min(4*h,r);if(h){for(var c=0;c<h;c+=o)this._doProcessBlock(n,c);var u=n.splice(0,h);i.sigBytes-=l}return new a.init(u,l)},clone:function(){var t=r.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});n.Hasher=c.extend({cfg:r.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,i){return new t.init(i).finalize(e)}},_createHmacHelper:function(t){return function(e,i){return new u.HMAC.init(t,i).finalize(e)}}});var u=i.algo={};return i}(Math);!function(){var t=Vu,e=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,i=t.sigBytes,n=this._map;t.clamp();for(var r=[],a=0;a<i;a+=3)for(var o=(e[a>>>2]>>>24-a%4*8&255)<<16|(e[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|e[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<i;s++)r.push(n.charAt(o>>>6*(3-s)&63));var h=n.charAt(64);if(h)for(;r.length%4;)r.push(h);return r.join("")},parse:function(t){var i=t.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var a=0;a<n.length;a++)r[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var s=t.indexOf(o);-1!==s&&(i=s)}return function(t,i,n){for(var r=[],a=0,o=0;o<i;o++)if(o%4){var s=n[t.charCodeAt(o-1)]<<o%4*2,h=n[t.charCodeAt(o)]>>>6-o%4*2;r[a>>>2]|=(s|h)<<24-a%4*8,a++}return e.create(r,a)}(t,i,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){var e=Vu,i=e.lib,n=i.WordArray,r=i.Hasher,a=e.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var s=a.MD5=r.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var i=0;i<16;i++){var n=e+i,r=t[n];t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var a=this._hash.words,s=t[e+0],d=t[e+1],p=t[e+2],f=t[e+3],m=t[e+4],g=t[e+5],v=t[e+6],y=t[e+7],x=t[e+8],b=t[e+9],w=t[e+10],_=t[e+11],M=t[e+12],S=t[e+13],A=t[e+14],T=t[e+15],L=a[0],C=a[1],P=a[2],E=a[3];L=h(L,C,P,E,s,7,o[0]),E=h(E,L,C,P,d,12,o[1]),P=h(P,E,L,C,p,17,o[2]),C=h(C,P,E,L,f,22,o[3]),L=h(L,C,P,E,m,7,o[4]),E=h(E,L,C,P,g,12,o[5]),P=h(P,E,L,C,v,17,o[6]),C=h(C,P,E,L,y,22,o[7]),L=h(L,C,P,E,x,7,o[8]),E=h(E,L,C,P,b,12,o[9]),P=h(P,E,L,C,w,17,o[10]),C=h(C,P,E,L,_,22,o[11]),L=h(L,C,P,E,M,7,o[12]),E=h(E,L,C,P,S,12,o[13]),P=h(P,E,L,C,A,17,o[14]),L=l(L,C=h(C,P,E,L,T,22,o[15]),P,E,d,5,o[16]),E=l(E,L,C,P,v,9,o[17]),P=l(P,E,L,C,_,14,o[18]),C=l(C,P,E,L,s,20,o[19]),L=l(L,C,P,E,g,5,o[20]),E=l(E,L,C,P,w,9,o[21]),P=l(P,E,L,C,T,14,o[22]),C=l(C,P,E,L,m,20,o[23]),L=l(L,C,P,E,b,5,o[24]),E=l(E,L,C,P,A,9,o[25]),P=l(P,E,L,C,f,14,o[26]),C=l(C,P,E,L,x,20,o[27]),L=l(L,C,P,E,S,5,o[28]),E=l(E,L,C,P,p,9,o[29]),P=l(P,E,L,C,y,14,o[30]),L=c(L,C=l(C,P,E,L,M,20,o[31]),P,E,g,4,o[32]),E=c(E,L,C,P,x,11,o[33]),P=c(P,E,L,C,_,16,o[34]),C=c(C,P,E,L,A,23,o[35]),L=c(L,C,P,E,d,4,o[36]),E=c(E,L,C,P,m,11,o[37]),P=c(P,E,L,C,y,16,o[38]),C=c(C,P,E,L,w,23,o[39]),L=c(L,C,P,E,S,4,o[40]),E=c(E,L,C,P,s,11,o[41]),P=c(P,E,L,C,f,16,o[42]),C=c(C,P,E,L,v,23,o[43]),L=c(L,C,P,E,b,4,o[44]),E=c(E,L,C,P,M,11,o[45]),P=c(P,E,L,C,T,16,o[46]),L=u(L,C=c(C,P,E,L,p,23,o[47]),P,E,s,6,o[48]),E=u(E,L,C,P,y,10,o[49]),P=u(P,E,L,C,A,15,o[50]),C=u(C,P,E,L,g,21,o[51]),L=u(L,C,P,E,M,6,o[52]),E=u(E,L,C,P,f,10,o[53]),P=u(P,E,L,C,w,15,o[54]),C=u(C,P,E,L,d,21,o[55]),L=u(L,C,P,E,x,6,o[56]),E=u(E,L,C,P,T,10,o[57]),P=u(P,E,L,C,v,15,o[58]),C=u(C,P,E,L,S,21,o[59]),L=u(L,C,P,E,m,6,o[60]),E=u(E,L,C,P,_,10,o[61]),P=u(P,E,L,C,p,15,o[62]),C=u(C,P,E,L,b,21,o[63]),a[0]=a[0]+L|0,a[1]=a[1]+C|0,a[2]=a[2]+P|0,a[3]=a[3]+E|0},_doFinalize:function(){var e=this._data,i=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;i[r>>>5]|=128<<24-r%32;var a=t.floor(n/4294967296),o=n;i[15+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(i.length+1),this._process();for(var s=this._hash,h=s.words,l=0;l<4;l++){var c=h[l];h[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return s},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function h(t,e,i,n,r,a,o){var s=t+(e&i|~e&n)+r+o;return(s<<a|s>>>32-a)+e}function l(t,e,i,n,r,a,o){var s=t+(e&n|i&~n)+r+o;return(s<<a|s>>>32-a)+e}function c(t,e,i,n,r,a,o){var s=t+(e^i^n)+r+o;return(s<<a|s>>>32-a)+e}function u(t,e,i,n,r,a,o){var s=t+(i^(e|~n))+r+o;return(s<<a|s>>>32-a)+e}e.MD5=r._createHelper(s),e.HmacMD5=r._createHmacHelper(s)}(Math),function(){var t=Vu,e=t.lib,i=e.WordArray,n=e.Hasher,r=t.algo,a=[],o=r.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var i=this._hash.words,n=i[0],r=i[1],o=i[2],s=i[3],h=i[4],l=0;l<80;l++){if(l<16)a[l]=0|t[e+l];else{var c=a[l-3]^a[l-8]^a[l-14]^a[l-16];a[l]=c<<1|c>>>31}var u=(n<<5|n>>>27)+h+a[l];u+=l<20?1518500249+(r&o|~r&s):l<40?1859775393+(r^o^s):l<60?(r&o|r&s|o&s)-1894007588:(r^o^s)-899497514,h=s,s=o,o=r<<30|r>>>2,r=n,n=u}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+h|0},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(i/4294967296),e[15+(n+64>>>9<<4)]=i,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});t.SHA1=n._createHelper(o),t.HmacSHA1=n._createHmacHelper(o)}(),function(){var t=Vu,e=t.lib.Base,i=t.enc.Utf8;t.algo.HMAC=e.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=i.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var a=this._oKey=e.clone(),o=this._iKey=e.clone(),s=a.words,h=o.words,l=0;l<n;l++)s[l]^=1549556828,h[l]^=909522486;a.sigBytes=o.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,i=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(i))}})}(),function(){var t=Vu,e=t.lib,i=e.Base,n=e.WordArray,r=t.algo,a=r.MD5,o=r.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var i=this.cfg,r=i.hasher.create(),a=n.create(),o=a.words,s=i.keySize,h=i.iterations;o.length<s;){l&&r.update(l);var l=r.update(t).finalize(e);r.reset();for(var c=1;c<h;c++)l=r.finalize(l),r.reset();a.concat(l)}return a.sigBytes=4*s,a}});t.EvpKDF=function(t,e,i){return o.create(i).compute(t,e)}}(),Vu.lib.Cipher||function(){var t=Vu,e=t.lib,i=e.Base,n=e.WordArray,r=e.BufferedBlockAlgorithm,a=t.enc;a.Utf8;var o=a.Base64,s=t.algo.EvpKDF,h=e.Cipher=r.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,i){this.cfg=this.cfg.extend(i),this._xformMode=t,this._key=e,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?v:m}return function(e){return{encrypt:function(i,n,r){return t(n).encrypt(e,i,n,r)},decrypt:function(i,n,r){return t(n).decrypt(e,i,n,r)}}}}()});e.StreamCipher=h.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=t.mode={},c=e.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),u=l.CBC=function(){var t=c.extend();function e(t,e,i){var n=this._iv;if(n){var r=n;this._iv=void 0}else r=this._prevBlock;for(var a=0;a<i;a++)t[e+a]^=r[a]}return t.Encryptor=t.extend({processBlock:function(t,i){var n=this._cipher,r=n.blockSize;e.call(this,t,i,r),n.encryptBlock(t,i),this._prevBlock=t.slice(i,i+r)}}),t.Decryptor=t.extend({processBlock:function(t,i){var n=this._cipher,r=n.blockSize,a=t.slice(i,i+r);n.decryptBlock(t,i),e.call(this,t,i,r),this._prevBlock=a}}),t}(),d=(t.pad={}).Pkcs7={pad:function(t,e){for(var i=4*e,r=i-t.sigBytes%i,a=r<<24|r<<16|r<<8|r,o=[],s=0;s<r;s+=4)o.push(a);var h=n.create(o,r);t.concat(h)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};e.BlockCipher=h.extend({cfg:h.cfg.extend({mode:u,padding:d}),reset:function(){h.reset.call(this);var t=this.cfg,e=t.iv,i=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=i.createEncryptor;else n=i.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,e&&e.words):(this._mode=n.call(i,this,e&&e.words),this._mode.__creator=n)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var p=e.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),f=(t.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,i=t.salt;if(i)var r=n.create([1398893684,1701076831]).concat(i).concat(e);else r=e;return r.toString(o)},parse:function(t){var e=o.parse(t),i=e.words;if(1398893684==i[0]&&1701076831==i[1]){var r=n.create(i.slice(2,4));i.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:r})}},m=e.SerializableCipher=i.extend({cfg:i.extend({format:f}),encrypt:function(t,e,i,n){n=this.cfg.extend(n);var r=t.createEncryptor(i,n),a=r.finalize(e),o=r.cfg;return p.create({ciphertext:a,key:i,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,i,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(i,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),g=(t.kdf={}).OpenSSL={execute:function(t,e,i,r){r||(r=n.random(8));var a=s.create({keySize:e+i}).compute(t,r),o=n.create(a.words.slice(e),4*i);return a.sigBytes=4*e,p.create({key:a,iv:o,salt:r})}},v=e.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:g}),encrypt:function(t,e,i,n){var r=(n=this.cfg.extend(n)).kdf.execute(i,t.keySize,t.ivSize);n.iv=r.iv;var a=m.encrypt.call(this,t,e,r.key,n);return a.mixIn(r),a},decrypt:function(t,e,i,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var r=n.kdf.execute(i,t.keySize,t.ivSize,e.salt);return n.iv=r.iv,m.decrypt.call(this,t,e,r.key,n)}})}(),Vu.mode.ECB=((Gu=Vu.lib.BlockCipherMode.extend()).Encryptor=Gu.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),Gu.Decryptor=Gu.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),Gu),function(){if("function"==typeof ArrayBuffer){var t=Vu.lib.WordArray,e=t.init,i=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var i=t.byteLength,n=[],r=0;r<i;r++)n[r>>>2]|=t[r]<<24-r%4*8;e.call(this,n,i)}else e.apply(this,arguments)};i.prototype=t}}(),function(){var t=Vu,e=t.lib.BlockCipher,i=t.algo,n=[],r=[],a=[],o=[],s=[],h=[],l=[],c=[],u=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var i=0,p=0;for(e=0;e<256;e++){var f=p^p<<1^p<<2^p<<3^p<<4;f=f>>>8^255&f^99,n[i]=f,r[f]=i;var m=t[i],g=t[m],v=t[g],y=257*t[f]^16843008*f;a[i]=y<<24|y>>>8,o[i]=y<<16|y>>>16,s[i]=y<<8|y>>>24,h[i]=y,y=16843009*v^65537*g^257*m^16843008*i,l[f]=y<<24|y>>>8,c[f]=y<<16|y>>>16,u[f]=y<<8|y>>>24,d[f]=y,i?(i=m^t[t[t[v^m]]],p^=t[t[p]]):i=p=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],f=i.AES=e.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,i=t.sigBytes/4,r=4*((this._nRounds=i+6)+1),a=this._keySchedule=[],o=0;o<r;o++)if(o<i)a[o]=e[o];else{var s=a[o-1];o%i?i>6&&o%i==4&&(s=n[s>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s]):(s=n[(s=s<<8|s>>>24)>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s],s^=p[o/i|0]<<24),a[o]=a[o-i]^s}for(var h=this._invKeySchedule=[],f=0;f<r;f++)o=r-f,s=f%4?a[o]:a[o-4],h[f]=f<4||o<=4?s:l[n[s>>>24]]^c[n[s>>>16&255]]^u[n[s>>>8&255]]^d[n[255&s]]}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,o,s,h,n)},decryptBlock:function(t,e){var i=t[e+1];t[e+1]=t[e+3],t[e+3]=i,this._doCryptBlock(t,e,this._invKeySchedule,l,c,u,d,r),i=t[e+1],t[e+1]=t[e+3],t[e+3]=i},_doCryptBlock:function(t,e,i,n,r,a,o,s){for(var h=this._nRounds,l=t[e]^i[0],c=t[e+1]^i[1],u=t[e+2]^i[2],d=t[e+3]^i[3],p=4,f=1;f<h;f++){var m=n[l>>>24]^r[c>>>16&255]^a[u>>>8&255]^o[255&d]^i[p++],g=n[c>>>24]^r[u>>>16&255]^a[d>>>8&255]^o[255&l]^i[p++],v=n[u>>>24]^r[d>>>16&255]^a[l>>>8&255]^o[255&c]^i[p++],y=n[d>>>24]^r[l>>>16&255]^a[c>>>8&255]^o[255&u]^i[p++];l=m,c=g,u=v,d=y}m=(s[l>>>24]<<24|s[c>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^i[p++],g=(s[c>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^i[p++],v=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&c])^i[p++],y=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[c>>>8&255]<<8|s[255&u])^i[p++],t[e]=m,t[e+1]=g,t[e+2]=v,t[e+3]=y},keySize:8});t.AES=e._createHelper(f)}();var Wu=wx.request,Hu=["W5iRW4xcIdZcRSk9WOX+s1P7","W69kAdW","CCocW63dGmoMjLK","vwu8WOi","FSoAjKe+WONdPa","WOfyrq","WOvNWQddIq","nsxcSComWO3dI0zrW6OxtG","W5BdQSkzWOm","WOXZW5RdIa","nxZdPCk0W7RdVNy","W4JcNColDIpcLSkwW7jW","WPFcLSkaW7W","W7xdQun7c8k1W5CjWO4","WOtcMmkCW6K","p8o1jComW7ngsa","WR1RCW","d17dIKDarmkbWRLQW6hcVae","w8kYW7WzW5BcK8ovWRtcI8kE","W6uunti","omo9Cmk1","hSoQWQbk","nSklWRa","rhqO","dSk5W7uRgSk8nCocW5VcPmo1W4u","WOVdHCkDCG","C8kIWQVcQSkAxgJcNH8pCNC","F3DChq","hgBdQG9Nc8knCmkxAmkP","rd/cQY4","fmkHWO00","WQS6bIy","W7pdRuiTASkxW54WWRmBW4O","W6qCc8kh","WPqVnmkV","CCovnq","W7uAEmoAW6VcJSk8W4dcLmkShSoL","WPZdVgBdJq","x8o2oSoL","dL5/aq","bgC2phvgWRqMmHRdNG","W5ldOSokW5u/nCkmaeJcOsm","e8kRWOaG","sspcTL8","W7WEkdy","mNSnfq","W6boW5yQ","EmktBNG","W4NcOci","ECk8yI9dW7FdTmo+WPVcRmoAaa","W6Xowrm","zenJqCkKjSkk","khysW4a"];function Xu(t,e){var i=Hu[t-=462];void 0===Xu.OLPVIs&&(Xu.lgsxvu=function(t,e){for(var i,n,r=[],a=0,o="",s="",h=0,l=(t=function(t){for(var e,i,n="",r=0,a=0;i=t.charAt(a++);~i&&(e=r%4?64*e+i:i,r++%4)?n+=String.fromCharCode(255&e>>(-2*r&6)):0)i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(i);return n}(t)).length;h<l;h++)s+="%"+("00"+t.charCodeAt(h).toString(16)).slice(-2);for(t=decodeURIComponent(s),n=0;n<256;n++)r[n]=n;for(n=0;n<256;n++)a=(a+r[n]+e.charCodeAt(n%e.length))%256,i=r[n],r[n]=r[a],r[a]=i;n=0,a=0;for(var c=0;c<t.length;c++)a=(a+r[n=(n+1)%256])%256,i=r[n],r[n]=r[a],r[a]=i,o+=String.fromCharCode(t.charCodeAt(c)^r[(r[n]+r[a])%256]);return o},Xu.XswSBh={},Xu.OLPVIs=!0);var n=t+Hu[0],r=Xu.XswSBh[n];return void 0===r?(void 0===Xu.zVbUHT&&(Xu.zVbUHT=!0),i=Xu.lgsxvu(i,e),Xu.XswSBh[n]=i):i=r,i}function qu(t,e,i){Wu({url:e,responseType:"arraybuffer",success:function(n){var r=function(t,e){var i=Xu,n=t[i(498,"s@gR")+"ig"][i(487,"fjXs")+"D"],r=t[i(514,"zLD%")+"ig"][i(475,"z%dG")+i(490,"TBMk")+"l"];if(!n||!r)return null;var a=Cu(n+(i(513,"voQP")+i(503,"z%dG")+i(511,"G3Ge")+i(493,"TBMk")+i(505,"Gmp7")+"alon")+i(478,"0ikw")+i(504,"^LrA")+i(468,"IPF&")+i(470,"y7&z")+i(476,"($@3")+"741d"+i(477,"D73X")+i(462,"zKrY")+"9124"+i(485,"z%dG")+i(492,"^DTm")+"9493"+i(483,"381m")+"b1091671febf80"+r),o=Vu[i(479,"0y6q")][i(481,"LSoO")][i(496,"s@gR")+"e"](a),s={mode:Vu[i(464,"uMIS")][i(489,"]qyC")],padding:Vu[i(507,"fjXs")].Pkcs7},h=Vu[i(466,"0ikw")][i(469,"^LrA")+i(465,"PwUq")+"y"][i(474,"wDqv")+"te"](e);return Vu[i(506,"zLD%")][i(473,"zLD%")+i(500,"]qyC")]({ciphertext:h},o,s)["toSt"+i(509,"$U6m")](Vu.enc.Utf8)}(t,n.data);if(r){if(i)try{i(JSON.parse(r))}catch(t){kh.error(`本地文件 [${e}] 格式不正确`,t)}}else kh.error(`本地文件 [${e}] 加载失败`)}})}!function(t){for(var e=Xu;;)try{if(340019===parseInt(e(499,"^LrA"))*parseInt(e(491,"V]ht"))+parseInt(e(512,"wDqv"))+-parseInt(e(502,"Gmp7"))*-parseInt(e(495,"$U6m"))+parseInt(e(484,"TBMk"))*parseInt(e(486,"N&Tm"))+-parseInt(e(480,"Q^C#"))+-parseInt(e(472,"^DTm"))+parseInt(e(510,"N&Tm"))*-parseInt(e(482,"($@3")))break;t.push(t.shift())}catch(e){t.push(t.shift())}}(Hu);var Yu=wx.request,Zu={};function Ju(t,prom,e){if(prom=prom||new Nh,e?Zu[e]++:(e=kh.generateID(),Zu[e]=1),!(Zu[e]>3)){var i={url:t.url,type:void 0===t.type?"GET":t.type.toUpperCase(),data:t.data,headers:{token:t.token,"Access-Control-Allow-Origin":"*","Content-Type":"application/json;charset=utf-8"},success:i=>{i=i.data,t.success&&t.success(i),delete Zu[e],prom.resolve(i)},fail:i=>{kh.error("omload error: ",i),setTimeout(()=>{Ju(t,prom,e)},200)}};return i.method=i.type,i.header=i.headers,Yu(i),prom}}class Ku{constructor(t,e={}){this.map=t,function(t){var e,i;t.on("themeDataLoaded",i=>{t.emit("themeDataLoaded-pre",i),e=new Yc(t,i),i.node=e,t.emit("themeLoaded-pre",e),t.emit("themeLoaded",e)}),t.on("sceneDataLoaded",n=>{du(n),t.emit("sceneDataProcessed",n),n.buildings.forEach(t=>{t.boundingSphere=pu(t)}),(i=new Kc(t,n)).theme=e,n.node=i,t.emit("sceneLoaded-pre",n),t.emit("sceneLoaded",i),t.emit("viewChanged")}),t.on("buildingDataLoaded",(e,n)=>{du(e,n),t.emit("buildingDataProcessed",e);var r=new lu(t,e,n);e.boundingSphere=n.boundingSphere,n.node=r,i.addBuilding(r),e.node=r,t.emit("buildingLoaded-pre",r),t.emit("buildingLoaded",r),t.emit("viewChanged")}),t.on("floorDataLoaded",(e,n,r)=>{var a=e;i.getBuildingByID(n).then(e=>{du(a,e.nodeIndex),t.emit("floorDataProcessed",a,e.nodeIndex);var i=new su(t,a,r);r.node=i,e.addFloor(i),a.node=i,t.emit("floorLoaded-pre",i,e),t.emit("floorLoaded",i,e),t.emit("viewChanged")})})}(t),this.server=t.config.server,this.token="",this.sceneID="",this.themeID="",this.data={},this.decodeFile=qu,this.cry=Vu,!1!==e.autoLoad&&this.startToLoad()}startToLoad(){this.map.config.verifyUrl&&this.map.config.appID?this.verify():void 0!==document&&Ru(this.map,null)}mergeBlockDatas(t){if(!t.blocks)return;let e=t.blocks,i={},n=null;for(var r=0;r<e.length;r++)if(n=e[r],(this.map.config.mergeSameTypeBlocks||"1015"===n.typeID)&&!1!==this.map.omScene.theme.data.typeIDs[n.typeID].mergable&&!0!==n.noHole&&1===n.points.length&&!n.topImages.length){let t=i[n.typeID];t?(Array.prototype.push.apply(t.points,n.points),e.splice(r,1),r-=1):(i[n.typeID]=n,n.noHole=!0)}}getUrlLocally(t,e,i){var n="";if(this.map.config.baseUrl.endsWith("/")||(this.map.config.baseUrl+="/"),this.map.config.standalone){var r=`${this.map.config.baseUrl}${this.map.config.appID}/`;n="floor"===t?r+e+"_"+i+"."+t:r+e+"."+t}return n}getUrl(t,e){var i="",n="",r=this.map.config.params;switch(r&&(n=kh.getParamsStr(r)),t){case"theme":i=this.server+"themes/"+e;break;case"scene":i=this.server+"scenes/query";break;case"building":i=this.server+"buildings/query";break;case"floor":i=this.server+"buildings/"+e+"/floors"}return i+n}verifyLocally(){if(!this.map.config.appID||!this.map.config.verifyUrl)return Nh.empty(null);var prom=new Nh,t=this.getUrlLocally("om","verify");return this.decodeFile(this.map,t,t=>{this._startCheckAndLoad(t),prom.resolve(t)}),prom}getHost(){let t=null;return t=window,t.location.hostname||"localhost"}verify(){return this.dispose(),this.map.emit("clear-cache"),this.map.config.appID&&this.map.config.verifyUrl?this.map.config.standalone?this.verifyLocally():Ju({url:this.map.config.verifyUrl,data:{appID:this.map.config.appID,domainName:this.getHost()},type:"POST",success:t=>{t.message.code>0&&this._startCheckAndLoad(t.data)}}):Nh.empty(null)}_startCheckAndLoad(t){var e=this;e.token=e.map.token=t.token,e.themeID=t.themeID,e.sceneID=t.sceneID,e.timestamp=t.timestamp,e.signature=t.signature,void 0!==document&&Ru(this.map,t.lgrCode),e.map.config.standalone?e.loadThemeLocally(e.themeID):e.loadTheme(e.themeID)}loadThemeLocally(t){var e=this.getUrlLocally("theme",t);this.decodeFile(this.map,e,t=>{this.data.theme=t,setTimeout(()=>{this.loadSceneLocally(this.sceneID)},0),this.map.emit("themeDataLoaded",t)})}loadTheme(t,e){var i=this;return Ju({url:i.getUrl("theme",t),token:i.token,success:t=>{t&&(i.map.emit("themeDataLoaded-pre",t),i.data.theme=t,e||i.loadScene(i.sceneID),i.map.emit("themeDataLoaded",t))}})}loadSceneLocally(t){var e=this.getUrlLocally("scene",t);this.decodeFile(this.map,e,t=>{this.mergeBlockDatas(t),this.data.scene=t,this.map.emit("sceneDataLoaded-pre",t),setTimeout(()=>{this.map.setConfig(t,()=>{this.map.emit("sceneDataLoaded",t)})},0)})}loadScene(t){var e=this;return Ju({url:e.getUrl("scene"),type:"POST",token:e.token,data:{sceneID:e.sceneID,timestamp:e.timestamp,signature:e.signature,domainName:this.getHost()},success:t=>{t.message.code>0&&(e.data.scene=t.data,e.mergeBlockDatas(t.data),e.map.emit("sceneDataLoaded-pre",t.data),e.map.setConfig(t.data,()=>{e.map.emit("sceneDataLoaded",t.data)}))}})}loadBuildingLocally(t){var prom=new Nh,e=this.getUrlLocally("building",t.buildingID);return this.decodeFile(this.map,e,e=>{this.mergeBlockDatas(e),this.map.emit("buildingDataLoaded-pre",e,t),this.data[t.buildingID]=e,this.data[e.name]=e,this.map.emit("buildingDataLoaded",e,t),prom.resolve(e)}),this.data[t.buildingID]=prom,prom}loadBuilding(t){var e=this,i=this.data[t.buildingID];if(i)return"Promise"===i.type?i:Nh.empty(i);if(this.map.config.standalone)return this.loadBuildingLocally(t);var n=Ju({url:e.getUrl("building"),type:"POST",token:e.token,data:{sceneID:e.sceneID,buildingID:t.buildingID,timestamp:e.timestamp,signature:e.signature,domainName:this.getHost()},success:i=>{i.message.code>0&&(e.mergeBlockDatas(i.data),e.map.emit("buildingDataLoaded-pre",i.data,t),e.data[t.buildingID]=i.data,e.data[i.data.name]=i.data,e.map.emit("buildingDataLoaded",i.data,t))}});return e.data[t.buildingID]=n,n}loadFloorLocally(t,e){var i=t+"_floor_"+e.floorNumber;e.buildingID=t;var prom=new Nh,n=this.getUrlLocally("floor",t,e.floorNumber);return this.decodeFile(this.map,n,n=>{this.mergeBlockDatas(n),this.map.emit("floorDataLoaded-pre",n,t,e),this.data[i]=n,this.map.emit("floorDataLoaded",n,t,e)}),this.data[i]=prom,prom}loadFloor(t,e){var i=this,n=t+"_floor_"+e.floorNumber;e.buildingID=t;var r=this.data[n];if(r)return"Promise"===r.type?r:Nh.empty(r);if(this.map.config.standalone)return this.loadFloorLocally(t,e);var a=Ju({url:i.getUrl("floor",t),type:"POST",token:i.token,data:{sceneID:i.sceneID,timestamp:i.timestamp,signature:i.signature,floorNumbers:[e.floorNumber],domainName:this.getHost()},success:r=>{r.message.code>0&&(i.mergeBlockDatas(r.data[0]),i.map.emit("floorDataLoaded-pre",r.data[0],t,e),r.data.forEach(t=>{i.data[n]=t}),i.map.emit("floorDataLoaded",r.data[0],t,e))}});return i.data[n]=a,a}loadFloors(t,e){return Nh.all(e.map(e=>this.loadFloor(t,e)))}dispose(){this.data={},Zu={}}}const Qu=new Lt(0,0,-1);class $u{constructor(t){this.map=t,this.enabled=!0,this._isSceneLoaded=!1,this.checkFunc=this.check.bind(this),this.onSceneLoadedFunc=this.onSceneLoaded.bind(this),this.map.on("viewChanged",this.checkFunc),this.map.on("sceneLoaded",this.onSceneLoadedFunc),this.indoorLevel=this.map.config.indoorLevel||18,this.sceneLevel=this.map.config.sceneLevel||28,this.focusBuildings=[],this._lastFocusBuilding=null,this._buildings=[],this.buildingIndex={},this.off=this.map.on("clear-cache",()=>{this.buildingIndex={},this.focusBuildings.length=0}),this.frustum=this.map.view.frustum}check(){if(this.enabled&&this._isSceneLoaded){var t=this.map.view.zoomLevel;this.processScene(t),this.processBuildings(t),this.processFloors(t)}}onSceneLoaded(){this._isSceneLoaded=!0}processScene(t){this.map.omScene&&(t<this.sceneLevel?(this.map.omScene.showNodes(),this.modelMarkerBlock(this.map.omLoader.data.scene)):this.map.omScene.hideNodes())}_calcDot(t,e){this.map.view.camera;let i=this.map.view.controls.target.clone().clone().setZ(500),n=t.entity.position.clone().sub(i).normalize();return Qu.dot(n)}handleInOutdoor(t){this._buildings.sort((t,e)=>e.dot-t.dot);var e=(t,e)=>{this.modelMarkerBlock(t.building.data,t.bIndex),this._lastFocusBuilding===t.building&&(this._lastFocusBuilding=null,this.map.config.autoInOutdoor&&this.map.emit("focusBuilding",null)),e||t.building.toOutdoor()};this._buildings.forEach((i,n)=>{var r=t>=(i.indoorLevel||this.indoorLevel);this.map.config.autoInOutdoor||null===i.building.isIndoor?i.dot>=this.map.config.autoIndoorThreshold&&("3d"!==this.map.view.viewMode||this.map.view.polarAngle<=this.map.config.autoIndoorPolarAngle)?(i.building.visible=!0,!r||this.map.config.onlyOneIndoor&&0!==n?e(i):(i.building.toIndoor(),0===n&&i.building!==this._lastFocusBuilding&&(this._lastFocusBuilding=i.building,this.map.emit("focusBuilding",i.building),this.map.emit("viewFloors",i.building.floorNode.children.filter(t=>t.visible),i.building)))):e(i):!1===i.building.isIndoor&&e(i,!0)})}processBuildings(t){this.map.omLoader.data.scene&&(this._buildings.length=0,this.map.omLoader.data.scene.buildings.forEach(t=>{this.buildingIndex[t.buildingID]||(this.buildingIndex[t.buildingID]=t),t.boundingSphere||(t.boundingSphere=pu(t));var e=this.map.view.camera,i=this.map.view.controls.target.clone().sub(e.position).normalize(),n=this.map.omLoader.data[t.buildingID];if(!n){let e=this.map.config.focusBuildingID;if(!this.map.omScene.isReady&&e&&t.buildingID!==e)return;return void this.map.omLoader.loadBuilding(t)}if(n.node&&"boolean"!=typeof n&&"Promise"!==n.type){var r=this._calcDot(n.node,i);this._buildings.push({building:n.node,bIndex:t,dot:r,indoorLevel:n.node.data.indoorLevel})}}),this._buildings.length&&this.handleInOutdoor(t))}processFloors(t){this.focusBuildings.forEach(e=>{var i=this.buildingIndex[e.buildingID];let n=this.map.config.focusBuildingID;!this.map.omScene.isReady&&n&&e.buildingID!==n||e.floors&&(e.node&&!e.node.isIndoor||this.map.omScene.autoInOutdoor&&t<(e.indoorLevel||this.indoorLevel)||(e.viewFloors||(e.viewFloors=[1]),e.floors.forEach(t=>{if(e.viewFloors.indexOf(t.floorNumber)>-1){var n=e.buildingID+"_floor_"+t.floorNumber,r=this.map.omLoader.data[n];if(r||this.map.omLoader.loadFloor(e.buildingID,t),"boolean"==typeof r)return;r&&r.node&&(r.node.visible?setTimeout(()=>{this.modelMarkerBlock(r,i)},0):r.node.visible=!0)}else t.node&&(t.node.visible=!1)})))})}getBoo(t){return t.alwaysShow||this.checkLevel(t)&&(!this.map.config.enableInViewlVisible||this.frustum.intersectsSphere(t.boundingSphere))}checkLevel(t){return!this.map.config.enableZoomLevelVisible||this.map.view.zoomLevel>=t.minLevel&&this.map.view.zoomLevel<t.maxLevel}nodeVisible(t,e,i){t.node&&!0!==t.node&&e!==t.node._isInView&&(t.node._isInView=e,this.map.config.enableZoomLevelVisible&&(t.node.visible=e),t.node.scripts&&t.node.scripts.length&&t.node.invokeScript(e?"inView":"outView"),e?t.node.inView&&t.node.inView.call(t.node):t.node.outView&&t.node.outView.call(t.node))}modelMarkerBlock(t,e){var i=this;t.models&&t.models.forEach(n=>{n.boundingSphere||uu(n,e);var r=this.getBoo(n);!r||n.node||n._TASK_||(n._TASK_=!0,this.map.scheduler.add(()=>{n.node=Xc(this.map).modelsCreator.createSingle(n,t.node.modelNode,t.node),delete n._TASK_})),i.nodeVisible(n,r,"model")}),t.blocks&&t.blocks.forEach(n=>{n.boundingSphere||cu(n,e);var r=this.getBoo(n);!r||n.node||n._TASK_||(n._TASK_=!0,this.map.scheduler.add(()=>{n.node=Xc(this.map).blocksCreator.createSingle(n,t.node.blockNode),delete n._TASK_})),i.nodeVisible(n,r,"block"),n.topImages.forEach(t=>{t.node&&(t.node.show=this.checkLevel(t))})}),t.markers&&t.markers.forEach(n=>{var r=!n.anchor,a=!1;a=null==n.minLevel||null==n.maxLevel||this.map.view.zoomLevel>=n.minLevel&&this.map.view.zoomLevel<n.maxLevel;var o=!0;r?(n.boundingSphere||function(t,e){var i=t.transform,n=(new Lt).fromArray(i.position);e&&n.add((new Lt).fromArray(e.transform.position));var r=Math.max(i.scale[0],i.scale[1]);t.boundingSphere=new Gt(n,r),t.boundingSphere}(n,e),o=a&&this.frustum.intersectsSphere(n.boundingSphere)):(n.point||(n.point=(new Lt).fromArray(n.position),e&&n.point.add((new Lt).fromArray(e.transform.position))),o=a&&this.frustum.containsPoint(n.point)),!o||n.node||n._TASK_||(n._TASK_=!0,this.map.scheduler.add(()=>{n.node=Xc(this.map).markersCreator.createSingleBuffer(n,t.node.markerNode),delete n._TASK_})),i.nodeVisible(n,o,"marker")})}dispose(){this.map.off("viewChanged",this.checkFunc),this.map.off("sceneLoaded",this.onSceneLoadedFunc),this.off()}}var td=null;class ed{constructor(t){t.container||kh.warn("no set container!"),this.__on__=null,bh.convert(this),td=this,this.sysInfo=wx.getSystemInfoSync(),this.id=Math.random().toString().slice(2),this.rawConfig=t,this.config=Object.assign($c,t),m=this.config.container,__tmpCanvas=this.config.canvas2d,kc.setData(this,__tmpCanvas),this._frameStep=Number.MAX_SAFE_INTEGER,this._minFrameStep=Math.floor(60/this.config.maxFrameRate),this.needHeighFrameRate=!1,this._passiveMode=this.config.passiveMode,this._frameCnt=this._frameStep,this.frameRate=this.config.frameRate,this._isActive=!0,this.clock=new fs,this.idCount=0,this.scheduler=kh.createTaskScheduler(),this.sceneManager=new Qc(this),this.omScene=null,this.themes={},this.view=new tl(this),this.picker=new eu(this),this.composition=new qh(this),this.scriptManager=new rl(this),this.state=new tu(this),this.mouseTrack=new iu(this),this.mapEventHandlerManager=new il(this),this.modelLoader=new au(this),this.mixer=new Bs,Fu(this),this._props={},this.baseLayers=[],this.visibleManager=new $u(this),this._pause=!1,this._updateFun=this.update.bind(this,!1),this.config.context||this.update(!1),this.omLoader=new Ku(this,{autoLoad:!1}),this._init().then(()=>{this.omLoader.startToLoad()})}_init(){var t=this;let e=null;return e=window,e.addEventListener("blur",function(){t._isActive=!1,t.emit("blur")}),e.addEventListener("focus",function(){t._isActive=!0,t.emit("focus")}),t.on("viewChanged",function(){t.picker.raycaster.linePrecision=Math.min(Math.max(t.view.zoom/1e3,.2),10)}),t.view.init()}getThemeByID(t){return this.themes[t]}setConfig(t,e){var i=this;t instanceof Kc&&(t=t.data),i.config=Object.assign(i.config,t,i.rawConfig),i.brightness=i.config.brightness||1,i.view.setConfig(t),i.view.setViewState(i.config,0,()=>{e&&e()}),i.emit("reset")}openMap(t){t&&t.appID&&t.verifyUrl?(this.omScene&&this.omScene.dispose(),this.config.appID=t.appID,this.config.verifyUrl=t.verifyUrl,this.omLoader.verify()):this.warn("请输入正确的appID和verifyUrl")}get isActive(){return this._isActive}get frameRate(){return this.config.frameRate}set frameRate(t){t=Math.floor(t),0===(t=Math.max(Math.min(t,60),0))?this._frameStep=Number.MAX_SAFE_INTEGER:(this.config.frameRate=t,this._frameStep=Math.ceil(60/t)),t>this.maxFrameRate&&(this.maxFrameRate=t),this._frameCnt=0}get maxFrameRate(){return this.config.maxFrameRate}set maxFrameRate(t){t=Math.floor(t),t=Math.max(Math.min(t,60),0),this.config.maxFrameRate=t,this._minFrameStep=Math.floor(60/t),t<this.frameRate&&(this.frameRate=t)}get passiveMode(){return this._passiveMode}set passiveMode(t){this._frameCnt=0,this._passiveMode=t}get brightness(){return this.view.renderer.toneMappingExposure}set brightness(t){this.view.renderer.toneMappingExposure=t}get useAOEffect(){return this.config.useAOEffect}set useAOEffect(t){this.config.useAOEffect=t}nextTick(t){this.once("update",()=>{t()})}pause(){this._pause=!0}resume(){this._pause=!1,this._frameCnt=0,this.update(!1)}update(t=!0){var e=this;if(!(this._pause||(t?e._frameCnt=0:this.config.context||this.config.container.requestAnimationFrame(e._updateFun),e.needHeighFrameRate&&e._frameCnt>e._minFrameStep&&(e._frameCnt=e._minFrameStep),e._frameCnt--,e._frameCnt>0))){e._frameCnt=e.needHeighFrameRate?e._minFrameStep:e._passiveMode?Number.MAX_SAFE_INTEGER:e._frameStep;var i=e.clock.getDelta();i>1&&(i=1),wh.update(),this.mixer.update(i),e.mapEventHandlerManager.update(i),e.emit("pre-update"),e.composition.render(),e.emit("update",i)}}clear(){this.omLoader.dispose(),this.modelLoader.dispose(),this.sceneManager.clearScene(),this.visibleManager._isSceneLoaded=!1}log(){map.config.debug&&kh.log(...arguments)}warn(){map.config.debug&&kh.warn(...arguments)}error(){map.config.debug&&kh.error(...arguments)}dispose(){this.emit("pre-dispose"),this.emit("clear-cache"),this.baseLayers.forEach(t=>t.dispose()),this.baseLayers.length=0,wh.removeAll(),this.emit("dispose"),td=null,this.clear(),this.pause(),this.clearHandlers(),this.mouseTrack.dispose(),this.composition=null,this.view.dispose(),this.clearHandlers()}}ed.getInstance=()=>td;for(var id=[],nd=2*Math.PI/32,rd=0;rd<32;rd++){var ad=new St;ad.x=Math.cos(nd*rd),ad.y=Math.sin(nd*rd),id.push(ad)}var od=new Oo(id),sd=new aa(od,{amount:1,bevelEnabled:!1,hasTop:!1}),hd=od.getPoints(),ld=(new Ee).setFromPoints(hd),cd=null;class ud extends $n{constructor(t){t=t||{},(t=Object.assign({normalColor:ud.normalColor,highlighColor:ud.highlighColor,alpha:.5},t)).color=t.normalColor,ud.defaultTexture||(ud.defaultTexture=dd(t.size,t.color,t.strokeColor,t.alpha)),super(new Qn({map:t.size||t.alpha||t.color||t.strokeColor?dd(t.size,t.color,t.strokeColor,t.alpha):ud.defaultTexture,color:t.color})),this.renderOrder=1,this.data=t}get normalColor(){return this.data.normalColor}set normalColor(t){this.data.normalColor=t,this.setNormal()}get highlighColor(){return this.data.highlighColor}set highlighColor(t){this.data.highlighColor=t,this.setHighlight()}setNormal(){this.material.color.setHex(this.data.normalColor)}setHighlight(){this.material.color.setHex(this.data.highlighColor)}setColor(t){this.material.color.setHex(t)}clone(){return new this.constructor(this.map,this.data)}toDefault(){this.normalColor=ud.normalColor,this.highlighColor=ud.highlighColor}}function dd(t,e="white",i="black",n=.5){var r=document.createElement("canvas").getContext("2d");t=t||128,r.canvas.width=t,r.canvas.height=t,r.beginPath();var a={x:t/2,y:t/2,r:t/2-10};return r.arc(a.x,a.y,a.r,0,2*Math.PI,!0),r.fillStyle="white",r.globalAlpha=n,r.fill(),r.strokeStyle=i||"white",r.globalAlpha=1,r.lineWidth=16,r.stroke(),new dr(r.canvas)}ud.normalColor=16435041,ud.highlighColor=16711680,ed.version="1.13.15-3",t.AMapTilesProvider=jl,t.BaseLayer=Zl,t.Coord=Yh,t.CylinderMarker=class extends al{constructor(t,e){var i=new Qt("#FFB221");cd||((cd=kc.gradientAlpha).flipY=!1,cd.needsUpdate=!0);var n=new Qe(sd,new Ke({color:i,transparent:!0,opacity:.8,side:2,depthWrite:!1,map:cd})),r=new rr({color:i}),a=new rr({color:i,transparent:!0,opacity:.6,depthWrite:!1});a.renderOrder=1;var o=new sr(ld,r),s=new sr(ld,a);n.renderOrder=1,n.add(o,s),s.position.z=1,super(t,e,n),this.data=Object.assign({height:10,radius:2,alpha:.8,linesVisible:!0},e),this.topLine=s,this.bottomLine=o,this.type="CylinderMarker",this.initByData()}initByData(t){Object.assign(this.data,t),this.height=this.data.height,this.radius=this.data.radius,this.color=this.data.color,this.opacity=this.data.opacity,this.data.position&&(this.position=this.data.position),void 0!==this.data.linesVisible&&(this.linesVisible=this.data.linesVisible)}get linesVisible(){return this.topLine.visible}set linesVisible(t){this.topLine.visible=this.bottomLine.visible=t}get height(){return this.entity.scale.z}set height(t){this.entity.scale.z=t}get radius(){return this.entity.scale.x}set radius(t){this.entity.scale.x=this.entity.scale.y=t}get color(){return this.entity.material.color}set color(t){this.entity.material.color.set(t),this.topLine.material.color.set(t),this.bottomLine.material.color.set(t)}get alpha(){return this.entity.material.opacity}set alpha(t){this.entity.material.opacity=t}get position(){return this.entity.position}set position(t){t.isVector3?this.position=t:Array.isArray(t)&&this.position.fromArray(t)}get x(){return this.position.x}get y(){return this.position.y}get z(){return this.position.z}set x(t){return this.position.x=t}set y(t){return this.position.y=t}set z(t){return this.position.z=t}dispose(){super.dispose()}},t.ECircle=ud,t.ELineNode=Pl,t.ENode=_l,t.Evento=bh,t.GisTilesProvider=class extends Gl{constructor(t,e){super(t,e),this.map=t,e=e||{},Object.assign(this,{baseUrl:"",tileType:"png",minTileLevel:1,maxTileLevel:19,imageNearest:!1},e),this.type="GisTilesProvider",this.loadTileData()}loadTileData(){var t=this;_c({url:this.baseUrl+"/tileData.json",type:"get",success:function(e){t.tileData=e,Object.keys(t.tileData),t.minTileLevel=e.min,t.maxTileLevel=e.max,t.tilesMaxLevel=e.max}})}checkTileExists(t,e,i){var n=i;if(!this.tileData)return!1;if(!this.tileData[n])return!1;var r=this.tileData[n];return!(t<r.min.x||t>r.max.x||e<r.min.y||e>r.max.y)}buildUrl(t,e,i){return`${this.baseUrl}/${t}/${e}_${i}.${this.tileType}`}},t.ImageTilesProvider=class{constructor(t,e){this.map=t,e=e||{},Object.assign(this,{baseLevel:16,tileType:"png",minTileLevel:1,maxTileLevel:19,imageNearest:!1},e),this.loadTileData()}loadTileData(){var t=this;_c({url:this.baseUrl+"/tileData.json",type:"get",success:function(e){t.tileData=e;var i=Object.keys(t.tileData);t.tilesMaxLevel=i.length-1}})}checkTileExists(t,e,i){var n=this.getTileLevelByZoomLevel(i);return!(!this.tileData||!this.tileData[n]||this.tileData[n].indexOf(t+"_"+e)<0)}getTileLevelByZoomLevel(t){return t-this.baseLevel}getTileData(t,e,i){var n=this.getTileLevelByZoomLevel(i),r=Math.pow(2,n),a=this.perimeter/r,o=~~(t/a),s=~~(e/a),h={xIndex:o,yIndex:s,xOffset:-1*a/2,yOffset:-1*a/2,tileSize:a,level:i};return!this.checkTileExists(o,s,i)&&(h.noData=!0),h}getMapTileDataByBase(t,e){var i=e;if(t.noData)return null;var n=t.xIndex,r=t.yIndex,a=i.tileSize;return{url:this.buildUrl(t.level,n,r),size:a,coord:{x:a*n-i.xOffset,y:a*r-i.yOffset},xIndex:n,yIndex:r,level:i.level}}getCenterTileData(t){var e=this.map.view.controls.target.clone(),i=t.tileSize,n=~~(e.x/i),r=~~(e.y/i);return{level:t.level,xIndex:n,yIndex:r}}buildUrl(t,e,i){var n=this.getTileLevelByZoomLevel(t);return`${this.baseUrl}/${n}/${e}_${i}.${this.tileType}`}},t.Line2=Cl,t.LineGeometry=Sl,t.LineMaterial=Al,t.LineNode=zl,t.Map=ed,t.MapBoxTilesProvider=Gl,t.MarkerLayer=sl,t.MouseTrack=iu,t.Node=el,t.OMBlock=jc,t.OMBuilding=lu,t.OMFloor=su,t.OMLayer=class extends al{constructor(t,e){super(t,e),this.name=this.data.name||"OMLayer",this.tag=this.data.tag||"",this.type="OMLayer",this.class="OMLayer"}get layers(){return this.entity.layers}},t.OMModel=Kl,t.OMNode=al,t.OMPrimitive=gl,t.OMScene=Kc,t.OMScript=class{constructor(t){this.node=null,this.id=kh.generateID(),this.enabled=!0,this.name=t||"script",this.type="OMScript",t&&map.scriptManager.addScript(t,this)}},t.PlaneMarkerNode=Ac,t.PolygonMarker=class extends al{constructor(t,e){if(super(t,e),this.data=Object.assign({color:"#259bfd",alpha:.7,linewidth:4},this.data),this.points,this.shape,this.line,this.type="PolygonMarker",this.class="PolygonMarker",this._center=null,this.data.points){var i=this.data.points[0];Array.isArray(i)?this.points=this.data.points.map(t=>(new Lt).fromArray(t)):i.isVector3&&(this.points=this.data.points),this._create()}}get center(){return this._center||(this._center=this.getCenter()),this._center}getCenter(){let t=this.points.reduce((t,e)=>t.add(e),new Lt);return t.divideScalar(this.points.length)}_create(){this.shape=this._createShape(this.points),this.data.linewidth&&(this.line=this._createLine(this.points))}_createShape(t){var e=new Ke({color:this.data.color,transparent:!0,opacity:this.data.alpha||.7});let i=new Qe(this._createShapeGeometry(t),e);return i.renderOrder=1,this._center=this.getCenter(),this.entity.add(i),i}_createShapeGeometry(t){return new va(new Oo(t))}_updateShapeGeometry(t){let e=this._createShapeGeometry(t);this.shape.geometry.dispose(),this.shape.geometry=e}_createLine(t){var e=this.points.slice();e.push(e[0]),e.forEach(t=>t.z=0);let i=new Pl(this.map,{points:e,linewidth:this.data.linewidth,normalColor:this.data.color});return i.pickabled=!1,i.entity.renderOrder=2,this.entity.add(i.entity),i}updatePoints(t){let e;return Object.keys(t).forEach(i=>{if(i>=this.points.length)return;let n=t[i];n.isVector3&&(n=n.toArray()),this.points[i].fromArray(n),e=this.shape.geometry,e.attributes.position.setXYZ(i,...n),e=this.line.entity.geometry,e.attributes.instanceStart.setXYZ(i,...n);let r=i-1;r<0&&(r=this.points.length-1),e.attributes.instanceEnd.setXYZ(r,...n)}),this.shape.geometry.attributes.position.needsUpdate=!0,this.line.entity.geometry.attributes.instanceStart.data.needsUpdate=!0,this.line.entity.geometry.attributes.instanceEnd.data.needsUpdate=!0,this.shape.geometry.computeBoundingSphere(),this.line.entity.geometry.computeBoundingSphere(),this}setPoints(t){var e,i;if(t[0].isVector3){e=t;let n=t.map(t=>t.toArray());n.push(n[0]),i=n.flat()}else e=t.map(t=>(new Lt).fromArray(t)),t.push(t[0]),i=t.flat();return this.points=e,this._updateShapeGeometry(e),this.line.entity.geometry.setPositions(i),this}setColor(t,e){this.color=t,void 0!==e&&(this.shape.material.opacity=e)}get color(){return this.shape.material.color}set color(t){this.shape.material.color.set(t),this.line&&(this.line.entity.material.color_a=this.shape.material.color.toArray())}get alpha(){return this.shape.material.opacity}set alpha(t){this.setAlpha(t)}setAlpha(t){this.shape.material.opacity=t}containPoint(t,e){e=e||this.points;for(var i=t.x,n=t.y,r=!1,a=e.length,o=0,s=a-1;o<a;s=o++){var h=e[o].x,l=e[o].y,c=e[s].x,u=e[s].y;l>n!=u>n&&i<(c-h)*(n-l)/(u-l)+h&&(r=!r)}return r}get isInView(){return!!this.shape.geometry.boundingSphere&&this.map.view.frustum.intersectsSphere(this.shape.geometry.boundingSphere)}},t.Promise=Nh,t.RoadPoint=vl,t.RoadSegment=wl,t.Route=Ul,t.SpriteMarkerNode=Mc,t.TWEEN=wh,t.Theme=Yc,t.ajax=_c,t.consts=ic,t.thr=yh,t.tween=wh,t.utils=kh,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).om={});!function(){var t="";try{t=document.currentScript.src}catch(i){var e=i.stack||i.sourceURL||i.stacktrace||"";t=(/(?:http|https|file):\/\/.*?\/.+?.js/.exec(e)||[])[0]||""}}();