!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],t):"object"==typeof exports?exports["echarts-gl"]=t(require("echarts")):e["echarts-gl"]=t(e.echarts)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=99)}([function(t,r){t.exports=e},function(e,t,r){!function(e){"use strict";var r={};r.exports=t,function(e){if(!t)var t=1e-6;if(!r)var r="undefined"!=typeof Float32Array?Float32Array:Array;if(!n)var n=Math.random;var i={};i.setMatrixArrayType=function(e){r=e},void 0!==e&&(e.glMatrix=i);var a=Math.PI/180;i.toRadian=function(e){return e*a};var o={};o.create=function(){var e=new r(2);return e[0]=0,e[1]=0,e},o.clone=function(e){var t=new r(2);return t[0]=e[0],t[1]=e[1],t},o.fromValues=function(e,t){var n=new r(2);return n[0]=e,n[1]=t,n},o.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},o.set=function(e,t,r){return e[0]=t,e[1]=r,e},o.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},o.subtract=function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e},o.sub=o.subtract,o.multiply=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e},o.mul=o.multiply,o.divide=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e},o.div=o.divide,o.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e},o.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e},o.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},o.scaleAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e},o.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)},o.dist=o.distance,o.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n},o.sqrDist=o.squaredDistance,o.length=function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},o.len=o.length,o.squaredLength=function(e){var t=e[0],r=e[1];return t*t+r*r},o.sqrLen=o.squaredLength,o.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},o.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},o.normalize=function(e,t){var r=t[0],n=t[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),e[0]=t[0]*i,e[1]=t[1]*i),e},o.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},o.cross=function(e,t,r){var n=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=n,e},o.lerp=function(e,t,r,n){var i=t[0],a=t[1];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e},o.random=function(e,t){t=t||1;var r=2*n()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e},o.transformMat2=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e},o.transformMat2d=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e},o.transformMat3=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e},o.transformMat4=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e},o.forEach=function(){var e=o.create();return function(t,r,n,i,a,o){var s,u;for(r||(r=2),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e},s.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},s.cross=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e},s.lerp=function(e,t,r,n){var i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e},s.random=function(e,t){t=t||1;var r=2*n()*Math.PI,i=2*n()-1,a=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*a,e[1]=Math.sin(r)*a,e[2]=i*t,e},s.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e},s.transformMat3=function(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e},s.transformQuat=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],h=r[3],l=h*n+s*a-u*i,c=h*i+u*n-o*a,d=h*a+o*i-s*n,f=-o*n-s*i-u*a;return e[0]=l*h+f*-o+c*-u-d*-s,e[1]=c*h+f*-s+d*-o-l*-u,e[2]=d*h+f*-u+l*-s-c*-o,e},s.rotateX=function(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},s.rotateY=function(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},s.rotateZ=function(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},s.forEach=function(){var e=s.create();return function(t,r,n,i,a,o){var s,u;for(r||(r=3),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s1?0:Math.acos(i)},s.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},void 0!==e&&(e.vec3=s);var u={};u.create=function(){var e=new r(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},u.clone=function(e){var t=new r(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},u.fromValues=function(e,t,n,i){var a=new r(4);return a[0]=e,a[1]=t,a[2]=n,a[3]=i,a},u.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},u.set=function(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e},u.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},u.subtract=function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e},u.sub=u.subtract,u.multiply=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e},u.mul=u.multiply,u.divide=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e},u.div=u.divide,u.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e},u.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e},u.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},u.scaleAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e},u.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(r*r+n*n+i*i+a*a)},u.dist=u.distance,u.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return r*r+n*n+i*i+a*a},u.sqrDist=u.squaredDistance,u.length=function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)},u.len=u.length,u.squaredLength=function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i},u.sqrLen=u.squaredLength,u.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},u.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},u.normalize=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e[3]=t[3]*o),e},u.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},u.lerp=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e},u.random=function(e,t){return t=t||1,e[0]=n(),e[1]=n(),e[2]=n(),e[3]=n(),u.normalize(e,e),u.scale(e,e,t),e},u.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e},u.transformQuat=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],h=r[3],l=h*n+s*a-u*i,c=h*i+u*n-o*a,d=h*a+o*i-s*n,f=-o*n-s*i-u*a;return e[0]=l*h+f*-o+c*-u-d*-s,e[1]=c*h+f*-s+d*-o-l*-u,e[2]=d*h+f*-u+l*-s-c*-o,e},u.forEach=function(){var e=u.create();return function(t,r,n,i,a,o){var s,u;for(r||(r=4),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(s.cross(e,i,a),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+o,f.normalize(n,n))}}(),f.setAxes=function(){var e=c.create();return function(t,r,n,i){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=i[0],e[4]=i[1],e[7]=i[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],f.normalize(t,f.fromMat3(t,e))}}(),f.clone=u.clone,f.fromValues=u.fromValues,f.copy=u.copy,f.set=u.set,f.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},f.setAxisAngle=function(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e},f.add=u.add,f.multiply=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],h=r[2],l=r[3];return e[0]=n*l+o*s+i*h-a*u,e[1]=i*l+o*u+a*s-n*h,e[2]=a*l+o*h+n*u-i*s,e[3]=o*l-n*s-i*u-a*h,e},f.mul=f.multiply,f.scale=u.scale,f.rotateX=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e},f.rotateY=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e},f.rotateZ=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e},f.calculateW=function(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e},f.dot=u.dot,f.lerp=u.lerp,f.slerp=function(e,t,r,n){var i,a,o,s,u,h=t[0],l=t[1],c=t[2],d=t[3],f=r[0],p=r[1],_=r[2],m=r[3];return a=h*f+l*p+c*_+d*m,a<0&&(a=-a,f=-f,p=-p,_=-_,m=-m),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,u=Math.sin(n*i)/o):(s=1-n,u=n),e[0]=s*h+u*f,e[1]=s*l+u*p,e[2]=s*c+u*_,e[3]=s*d+u*m,e},f.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e},f.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},f.length=u.length,f.len=f.length,f.squaredLength=u.squaredLength,f.sqrLen=f.squaredLength,f.normalize=u.normalize,f.fromMat3=function(e,t){var r,n=t[0]+t[4]+t[8];if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+i]+t[3*i+a])*r,e[o]=(t[3*o+i]+t[3*i+o])*r}return e},f.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},void 0!==e&&(e.quat=f)}(r.exports)}()},function(e,t,r){function n(e){return!e||"none"===e}function i(e){return e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof Image}function a(e){return e.getZr&&e.setOption}function o(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function s(e){if((e.wrapS===c.REPEAT||e.wrapT===c.REPEAT)&&e.image){var t=o(e.width),r=o(e.height);if(t!==e.width||r!==e.height){var n=document.createElement("canvas");n.width=t,n.height=r;n.getContext("2d").drawImage(e.image,0,0,t,r),e.image=n}}}var u=r(25),h=r(52),l=r(5),c=r(6),d=r(7),f=r(16),p=r(35),_=r(13),m=r(0),g=r(26),v=r(60),y=r(47),x=r(169),T=r(203),b=r(204),w=r(231),E=r(4),S=r(171);m.util.extend(p.prototype,S),d.import(r(227)),d.import(r(82)),d.import(r(179)),d.import(r(178)),d.import(r(183)),d.import(r(186)),d.import(r(181)),d.import(r(187));var A=g.prototype.addToScene,M=g.prototype.removeFromScene;g.prototype.addToScene=function(e){if(A.call(this,e),this.__zr){var t=this.__zr;e.traverse(function(e){e.__zr=t,e.addAnimatorsToZr&&e.addAnimatorsToZr(t)})}},g.prototype.removeFromScene=function(e){M.call(this,e),e.traverse(function(e){var t=e.__zr;e.__zr=null,t&&e.removeAnimatorsFromZr&&e.removeAnimatorsFromZr(t)})},f.prototype.setTextureImage=function(e,t,r,i){if(this.shader){var a,o=r.getZr(),s=this;return s.shader.disableTexture(e),n(t)||(a=N.loadTexture(t,r,i,function(t){s.shader.enableTexture(e),o&&o.refresh()}),s.set(e,a)),a}};var N={};N.Renderer=h,N.Node=p,N.Mesh=u,N.Shader=d,N.Material=f,N.Texture=c,N.Texture2D=l,N.Geometry=_,N.SphereGeometry=r(75),N.PlaneGeometry=r(46),N.CubeGeometry=r(74),N.AmbientLight=r(202),N.DirectionalLight=r(76),N.PointLight=r(77),N.SpotLight=r(78),N.PerspectiveCamera=r(44),N.OrthographicCamera=r(36),N.Vector2=r(28),N.Vector3=r(3),N.Vector4=r(209),N.Quaternion=r(55),N.Matrix2=r(206),N.Matrix2d=r(207),N.Matrix3=r(208),N.Matrix4=r(9),N.Plane=r(79),N.Ray=r(56),N.BoundingBox=r(14),N.Frustum=r(54);var C=y.createBlank("rgba(255,255,255,0)").image;N.loadTexture=function(e,t,r,n){"function"==typeof r&&(n=r,r={}),r=r||{};for(var o=Object.keys(r).sort(),u="",h=0;h3?t[3]=e[3]:t[3]=1,t):(t=m.color.parse(e||"#000",t)||[0,0,0,0],t[0]/=255,t[1]/=255,t[2]/=255,t)},N.directionFromAlphaBeta=function(e,t){var r=e/180*Math.PI+Math.PI/2,n=-t/180*Math.PI+Math.PI/2,i=[],a=Math.sin(r);return i[0]=a*Math.cos(n),i[1]=-Math.cos(r),i[2]=a*Math.sin(n),i},N.getShadowResolution=function(e){var t=1024;switch(e){case"low":t=512;break;case"medium":break;case"high":t=2048;break;case"ultra":t=4096}return t},N.COMMON_SHADERS=["lambert","color","realistic","hatching"],N.createShader=function(e){var t=d.source(e+".vertex"),r=d.source(e+".fragment");return t||console.error("Vertex shader of '%s' not exits",e),r||console.error("Fragment shader of '%s' not exits",e),new d({name:e,vertex:t,fragment:r})},N.setMaterialFromModel=function(e,t,r,n){var i=r.getModel(e+"Material"),a=i.get("detailTexture"),o=E.firstNotNull(i.get("textureTiling"),1),s=E.firstNotNull(i.get("textureOffset"),0);"number"==typeof o&&(o=[o,o]),"number"==typeof s&&(s=[s,s]);var u=o[0]>1||o[1]>1?N.Texture.REPEAT:N.Texture.CLAMP_TO_EDGE,h={anisotropic:8,wrapS:u,wrapT:u};if("realistic"===e){var l=i.get("roughness"),c=i.get("metalness");null!=c?isNaN(c)&&(t.setTextureImage("metalnessMap",c,n,h),c=E.firstNotNull(i.get("metalnessAdjust"),.5)):c=0,null!=l?isNaN(l)&&(t.setTextureImage("roughnessMap",l,n,h),l=E.firstNotNull(i.get("roughnessAdjust"),.5)):l=.5;var d=i.get("normalTexture");t.setTextureImage("detailMap",a,n,h),t.setTextureImage("normalMap",d,n,h),t.set({roughness:l,metalness:c,detailUvRepeat:o,detailUvOffset:s})}else if("lambert"===e)t.setTextureImage("detailMap",a,n,h),t.set({detailUvRepeat:o,detailUvOffset:s});else if("color"===e)t.setTextureImage("detailMap",a,n,h),t.set({detailUvRepeat:o,detailUvOffset:s});else if("hatching"===e){for(var f=i.get("hatchingTextures")||[],p=0;p<6;p++)t.setTextureImage("hatch"+(p+1),f[p],n,{anisotropic:8,wrapS:N.Texture.REPEAT,wrapT:N.Texture.REPEAT});t.set({detailUvRepeat:o,detailUvOffset:s})}},N.updateVertexAnimation=function(e,t,r,n){var i=n.get("animation"),a=n.get("animationDurationUpdate"),o=n.get("animationEasingUpdate"),s=r.shadowDepthMaterial;if(i&&t&&a>0&&t.geometry.vertexCount===r.geometry.vertexCount){r.material.shader.define("vertex","VERTEX_ANIMATION"),r.ignorePreZ=!0,s&&s.shader.define("vertex","VERTEX_ANIMATION");for(var u=0;ur?r:e}var i=r(1),a=i.vec3,o=function(e,t,r){e=e||0,t=t||0,r=r||0,this._array=a.fromValues(e,t,r),this._dirty=!0};o.prototype={constructor:o,add:function(e){return a.add(this._array,this._array,e._array),this._dirty=!0,this},set:function(e,t,r){return this._array[0]=e,this._array[1]=t,this._array[2]=r,this._dirty=!0,this},setArray:function(e){return this._array[0]=e[0],this._array[1]=e[1],this._array[2]=e[2],this._dirty=!0,this},clone:function(){return new o(this.x,this.y,this.z)},copy:function(e){return a.copy(this._array,e._array),this._dirty=!0,this},cross:function(e,t){return a.cross(this._array,e._array,t._array),this._dirty=!0,this},dist:function(e){return a.dist(this._array,e._array)},distance:function(e){return a.distance(this._array,e._array)},div:function(e){return a.div(this._array,this._array,e._array),this._dirty=!0,this},divide:function(e){return a.divide(this._array,this._array,e._array),this._dirty=!0,this},dot:function(e){return a.dot(this._array,e._array)},len:function(){return a.len(this._array)},length:function(){return a.length(this._array)},lerp:function(e,t,r){return a.lerp(this._array,e._array,t._array,r),this._dirty=!0,this},min:function(e){return a.min(this._array,this._array,e._array),this._dirty=!0,this},max:function(e){return a.max(this._array,this._array,e._array),this._dirty=!0,this},mul:function(e){return a.mul(this._array,this._array,e._array),this._dirty=!0,this},multiply:function(e){return a.multiply(this._array,this._array,e._array),this._dirty=!0,this},negate:function(){return a.negate(this._array,this._array),this._dirty=!0,this},normalize:function(){return a.normalize(this._array,this._array),this._dirty=!0,this},random:function(e){return a.random(this._array,e),this._dirty=!0,this},scale:function(e){return a.scale(this._array,this._array,e),this._dirty=!0,this},scaleAndAdd:function(e,t){return a.scaleAndAdd(this._array,this._array,e._array,t),this._dirty=!0,this},sqrDist:function(e){return a.sqrDist(this._array,e._array)},squaredDistance:function(e){return a.squaredDistance(this._array,e._array)},sqrLen:function(){return a.sqrLen(this._array)},squaredLength:function(){return a.squaredLength(this._array)},sub:function(e){return a.sub(this._array,this._array,e._array),this._dirty=!0,this},subtract:function(e){return a.subtract(this._array,this._array,e._array),this._dirty=!0,this},transformMat3:function(e){return a.transformMat3(this._array,this._array,e._array),this._dirty=!0,this},transformMat4:function(e){return a.transformMat4(this._array,this._array,e._array),this._dirty=!0,this},transformQuat:function(e){return a.transformQuat(this._array,this._array,e._array),this._dirty=!0,this},applyProjection:function(e){var t=this._array;if(e=e._array,0===e[15]){var r=-1/t[2];t[0]=e[0]*t[0]*r,t[1]=e[5]*t[1]*r,t[2]=(e[10]*t[2]+e[14])*r}else t[0]=e[0]*t[0]+e[12],t[1]=e[5]*t[1]+e[13],t[2]=e[10]*t[2]+e[14];return this._dirty=!0,this},eulerFromQuat:function(e,t){o.eulerFromQuat(this,e,t)},eulerFromMat3:function(e,t){o.eulerFromMat3(this,e,t)},toString:function(){return"["+Array.prototype.join.call(this._array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this._array)}};var s=Object.defineProperty;if(s){var u=o.prototype;s(u,"x",{get:function(){return this._array[0]},set:function(e){this._array[0]=e,this._dirty=!0}}),s(u,"y",{get:function(){return this._array[1]},set:function(e){this._array[1]=e,this._dirty=!0}}),s(u,"z",{get:function(){return this._array[2]},set:function(e){this._array[2]=e,this._dirty=!0}})}o.add=function(e,t,r){return a.add(e._array,t._array,r._array),e._dirty=!0,e},o.set=function(e,t,r,n){a.set(e._array,t,r,n),e._dirty=!0},o.copy=function(e,t){return a.copy(e._array,t._array),e._dirty=!0,e},o.cross=function(e,t,r){return a.cross(e._array,t._array,r._array),e._dirty=!0,e},o.dist=function(e,t){return a.distance(e._array,t._array)},o.distance=o.dist,o.div=function(e,t,r){return a.divide(e._array,t._array,r._array),e._dirty=!0,e},o.divide=o.div,o.dot=function(e,t){return a.dot(e._array,t._array)},o.len=function(e){return a.length(e._array)},o.lerp=function(e,t,r,n){return a.lerp(e._array,t._array,r._array,n),e._dirty=!0,e},o.min=function(e,t,r){return a.min(e._array,t._array,r._array),e._dirty=!0,e},o.max=function(e,t,r){return a.max(e._array,t._array,r._array),e._dirty=!0,e},o.mul=function(e,t,r){return a.multiply(e._array,t._array,r._array),e._dirty=!0,e},o.multiply=o.mul,o.negate=function(e,t){return a.negate(e._array,t._array),e._dirty=!0,e},o.normalize=function(e,t){return a.normalize(e._array,t._array),e._dirty=!0,e},o.random=function(e,t){return a.random(e._array,t),e._dirty=!0,e},o.scale=function(e,t,r){return a.scale(e._array,t._array,r),e._dirty=!0,e},o.scaleAndAdd=function(e,t,r,n){return a.scaleAndAdd(e._array,t._array,r._array,n),e._dirty=!0,e},o.sqrDist=function(e,t){return a.sqrDist(e._array,t._array)},o.squaredDistance=o.sqrDist,o.sqrLen=function(e){return a.sqrLen(e._array)},o.squaredLength=o.sqrLen,o.sub=function(e,t,r){return a.subtract(e._array,t._array,r._array),e._dirty=!0,e},o.subtract=o.sub,o.transformMat3=function(e,t,r){return a.transformMat3(e._array,t._array,r._array),e._dirty=!0,e},o.transformMat4=function(e,t,r){return a.transformMat4(e._array,t._array,r._array),e._dirty=!0,e},o.transformQuat=function(e,t,r){return a.transformQuat(e._array,t._array,r._array),e._dirty=!0,e};var h=Math.atan2,l=Math.asin,c=Math.abs;o.eulerFromQuat=function(e,t,r){e._dirty=!0,t=t._array;var i=e._array,a=t[0],o=t[1],s=t[2],u=t[3],c=a*a,d=o*o,f=s*s,p=u*u,r=(r||"XYZ").toUpperCase();switch(r){case"XYZ":i[0]=h(2*(a*u-o*s),p-c-d+f),i[1]=l(n(2*(a*s+o*u),-1,1)),i[2]=h(2*(s*u-a*o),p+c-d-f);break;case"YXZ":i[0]=l(n(2*(a*u-o*s),-1,1)),i[1]=h(2*(a*s+o*u),p-c-d+f),i[2]=h(2*(a*o+s*u),p-c+d-f);break;case"ZXY":i[0]=l(n(2*(a*u+o*s),-1,1)),i[1]=h(2*(o*u-s*a),p-c-d+f),i[2]=h(2*(s*u-a*o),p-c+d-f);break;case"ZYX":i[0]=h(2*(a*u+s*o),p-c-d+f),i[1]=l(n(2*(o*u-a*s),-1,1)),i[2]=h(2*(a*o+s*u),p+c-d-f);break;case"YZX":i[0]=h(2*(a*u-s*o),p-c+d-f),i[1]=h(2*(o*u-a*s),p+c-d-f),i[2]=l(n(2*(a*o+s*u),-1,1));break;case"XZY":i[0]=h(2*(a*u+o*s),p-c+d-f),i[1]=h(2*(a*s+o*u),p+c-d-f),i[2]=l(n(2*(s*u-a*o),-1,1));break;default:console.warn("Unkown order: "+r)}return e},o.eulerFromMat3=function(e,t,r){var i=t._array,a=i[0],o=i[3],s=i[6],u=i[1],d=i[4],f=i[7],p=i[2],_=i[5],m=i[8],g=e._array,r=(r||"XYZ").toUpperCase();switch(r){case"XYZ":g[1]=l(n(s,-1,1)),c(s)<.99999?(g[0]=h(-f,m),g[2]=h(-o,a)):(g[0]=h(_,d),g[2]=0);break;case"YXZ":g[0]=l(-n(f,-1,1)),c(f)<.99999?(g[1]=h(s,m),g[2]=h(u,d)):(g[1]=h(-p,a),g[2]=0);break;case"ZXY":g[0]=l(n(_,-1,1)),c(_)<.99999?(g[1]=h(-p,m),g[2]=h(-o,d)):(g[1]=0,g[2]=h(u,a));break;case"ZYX":g[1]=l(-n(p,-1,1)),c(p)<.99999?(g[0]=h(_,m),g[2]=h(u,a)):(g[0]=0,g[2]=h(-o,d));break;case"YZX":g[2]=l(n(u,-1,1)),c(u)<.99999?(g[0]=h(-f,d),g[1]=h(-p,a)):(g[0]=0,g[1]=h(s,m));break;case"XZY":g[2]=l(-n(o,-1,1)),c(o)<.99999?(g[0]=h(_,d),g[1]=h(s,a)):(g[0]=h(-f,m),g[1]=0);break;default:console.warn("Unkown order: "+r)}return e._dirty=!0,e},o.POSITIVE_X=new o(1,0,0),o.NEGATIVE_X=new o(-1,0,0),o.POSITIVE_Y=new o(0,1,0),o.NEGATIVE_Y=new o(0,-1,0),o.POSITIVE_Z=new o(0,0,1),o.NEGATIVE_Z=new o(0,0,-1),o.UP=new o(0,1,0),o.ZERO=new o(0,0,0),e.exports=o},function(e,t,r){var n=r(0),i={firstNotNull:function(){for(var e=0,t=arguments.length;e1&&e.texParameterf(e.TEXTURE_2D,n.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===r){i.getExtension(e,"OES_texture_half_float")||(r=a.FLOAT)}if(this.mipmaps.length)for(var o=this.width,s=this.height,u=0;u=n.COMPRESSED_RGB_S3TC_DXT1_EXT?e.compressedTexImage2D(e.TEXTURE_2D,r,o,i,a,0,t.pixels):e.texImage2D(e.TEXTURE_2D,r,o,i,a,0,o,s,t.pixels)},generateMipmap:function(e){this.useMipmap&&!this.NPOT&&(e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),e.generateMipmap(e.TEXTURE_2D))},isPowerOfTwo:function(){var e,t;return this.image?(e=this.image.width,t=this.image.height):(e=this.width,t=this.height),s(e)&&s(t)},isRenderable:function(){return this.image?"CANVAS"===this.image.nodeName||"VIDEO"===this.image.nodeName||this.image.complete:!(!this.width||!this.height)},bind:function(e){e.bindTexture(e.TEXTURE_2D,this.getWebGLTexture(e))},unbind:function(e){e.bindTexture(e.TEXTURE_2D,null)},load:function(e,t){var r=new Image;t&&(r.crossOrigin=t);var n=this;return r.onload=function(){n.dirty(),n.trigger("success",n),r.onload=null},r.onerror=function(){n.trigger("error",n),r.onerror=null},r.src=e,this.image=r,this}});Object.defineProperty(u.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(e){this.image?console.warn("Texture from image can't set width"):(this._width!==e&&this.dirty(),this._width=e)}}),Object.defineProperty(u.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(e){this.image?console.warn("Texture from image can't set height"):(this._height!==e&&this.dirty(),this._height=e)}}),e.exports=u},function(e,t,r){"use strict";var n=r(8),i=r(11),a=r(45),o=r(17),s=n.extend({width:512,height:512,type:i.UNSIGNED_BYTE,format:i.RGBA,wrapS:i.CLAMP_TO_EDGE,wrapT:i.CLAMP_TO_EDGE,minFilter:i.LINEAR_MIPMAP_LINEAR,magFilter:i.LINEAR,useMipmap:!0,anisotropic:1,flipY:!0,unpackAlignment:4,premultiplyAlpha:!1,dynamic:!1,NPOT:!1},function(){this._cache=new a},{getWebGLTexture:function(e){var t=this._cache;return t.use(e.__GLID__),t.miss("webgl_texture")&&t.put("webgl_texture",e.createTexture()),this.dynamic?this.update(e):t.isDirty()&&(this.update(e),t.fresh()),t.get("webgl_texture")},bind:function(){},unbind:function(){},dirty:function(){this._cache&&this._cache.dirtyAll()},update:function(e){},updateCommon:function(e){e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,this.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,this.unpackAlignment),this._fallBack(e)},_fallBack:function(e){var t=this.isPowerOfTwo();this.format===i.DEPTH_COMPONENT&&(this.useMipmap=!1);var r=o.getExtension(e,"EXT_sRGB");this.format!==s.SRGB||r||(this.format=s.RGB),this.format!==s.SRGB_ALPHA||r||(this.format=s.RGBA),t&&this.useMipmap?(this.NPOT=!1,this._minFilterOriginal&&(this.minFilter=this._minFilterOriginal),this._magFilterOriginal&&(this.magFilter=this._magFilterOriginal),this._wrapSOriginal&&(this.wrapS=this._wrapSOriginal),this._wrapTOriginal&&(this.wrapT=this._wrapTOriginal)):(this.NPOT=!0,this._minFilterOriginal=this.minFilter,this._magFilterOriginal=this.magFilter,this._wrapSOriginal=this.wrapS,this._wrapTOriginal=this.wrapT,this.minFilter==i.NEAREST_MIPMAP_NEAREST||this.minFilter==i.NEAREST_MIPMAP_LINEAR?this.minFilter=i.NEAREST:this.minFilter!=i.LINEAR_MIPMAP_LINEAR&&this.minFilter!=i.LINEAR_MIPMAP_NEAREST||(this.minFilter=i.LINEAR),this.wrapS=i.CLAMP_TO_EDGE,this.wrapT=i.CLAMP_TO_EDGE)},nextHighestPowerOfTwo:function(e){--e;for(var t=1;t<32;t<<=1)e|=e>>t;return e+1},dispose:function(e){var t=this._cache;t.use(e.__GLID__);var r=t.get("webgl_texture");r&&e.deleteTexture(r),t.deleteContext(e.__GLID__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty(s.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e}}),Object.defineProperty(s.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e}}),s.BYTE=i.BYTE,s.UNSIGNED_BYTE=i.UNSIGNED_BYTE,s.SHORT=i.SHORT,s.UNSIGNED_SHORT=i.UNSIGNED_SHORT,s.INT=i.INT,s.UNSIGNED_INT=i.UNSIGNED_INT,s.FLOAT=i.FLOAT,s.HALF_FLOAT=36193,s.UNSIGNED_INT_24_8_WEBGL=34042,s.DEPTH_COMPONENT=i.DEPTH_COMPONENT,s.DEPTH_STENCIL=i.DEPTH_STENCIL,s.ALPHA=i.ALPHA,s.RGB=i.RGB,s.RGBA=i.RGBA,s.LUMINANCE=i.LUMINANCE,s.LUMINANCE_ALPHA=i.LUMINANCE_ALPHA,s.SRGB=35904,s.SRGB_ALPHA=35906,s.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,s.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,s.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,s.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,s.NEAREST=i.NEAREST,s.LINEAR=i.LINEAR,s.NEAREST_MIPMAP_NEAREST=i.NEAREST_MIPMAP_NEAREST,s.LINEAR_MIPMAP_NEAREST=i.LINEAR_MIPMAP_NEAREST,s.NEAREST_MIPMAP_LINEAR=i.NEAREST_MIPMAP_LINEAR,s.LINEAR_MIPMAP_LINEAR=i.LINEAR_MIPMAP_LINEAR,s.REPEAT=i.REPEAT,s.CLAMP_TO_EDGE=i.CLAMP_TO_EDGE,s.MIRRORED_REPEAT=i.MIRRORED_REPEAT,e.exports=s},function(e,t,r){"use strict";function n(){return{locations:{},attriblocations:{}}}function i(e,t,r){if(!e.getShaderParameter(t,e.COMPILE_STATUS))return[e.getShaderInfoLog(t),a(r)].join("\n")}function a(e){for(var t=e.split("\n"),r=0,n=t.length;r0&&n.push("#define "+i.toUpperCase()+"_COUNT "+a)}for(var o in r){r[o].enabled&&n.push("#define "+o.toUpperCase()+"_ENABLED")}for(var o in e){var s=e[o];null===s?n.push("#define "+o):n.push("#define "+o+" "+s.toString())}return n.join("\n")},_unrollLoop:function(e,t){function r(e,r,i,a){var o="";isNaN(r)&&(r=r in t?t[r]:n[r]),isNaN(i)&&(i=i in t?t[i]:n[i]);for(var s=parseInt(r);s=0)r.attribSemantics[u]={symbol:a,type:l},c=!1;else if(x.indexOf(u)>=0){var d=!1,f=u;u.match(/TRANSPOSE$/)&&(d=!0,f=u.slice(0,-9)),r.matrixSemantics[u]={symbol:a,type:l,isTranspose:d,semanticNoTranspose:f},c=!1}else if(y.indexOf(u)>=0)r.uniformSemantics[u]={symbol:a,type:l},c=!1;else if("unconfigurable"===u)c=!1;else{if(!(h=r._parseDefaultValue(i,u)))throw new Error('Unkown semantic "'+u+'"');u=""}c&&(t[a]={type:l,value:o?g.array:h||g[i],semantic:u||null})}return["uniform",i,a,o].join(" ")+";\n"}}var t={},r=this,n="vertex";this._uniformList=[],this._vertexProcessedWithoutDefine=this._vertexProcessedWithoutDefine.replace(p,e),n="fragment",this._fragmentProcessedWithoutDefine=this._fragmentProcessedWithoutDefine.replace(p,e),r.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=t},_parseDefaultValue:function(e,t){var r=/\[\s*(.*)\s*\]/;{if("vec2"!==e&&"vec3"!==e&&"vec4"!==e)return"bool"===e?function(){return"true"===t.toLowerCase()}:"float"===e?function(){return parseFloat(t)}:"int"===e?function(){return parseInt(t)}:void 0;var n=r.exec(t)[1];if(n){var i=n.split(/\s*,\s*/);return function(){return new h.Float32Array(i)}}}},createUniforms:function(){var e={};for(var t in this.uniformTemplates){var r=this.uniformTemplates[t];e[t]={type:r.type,value:r.value()}}return e},attached:function(){this._attacheMaterialNumber++},detached:function(){this._attacheMaterialNumber--},isAttachedToAny:function(){return 0!==this._attacheMaterialNumber},_parseAttributes:function(){function e(e,n,i,a,o){if(n&&i){var s=1;switch(n){case"vec4":s=4;break;case"vec3":s=3;break;case"vec2":s=2;break;case"float":s=1}if(t[i]={type:"float",size:s,semantic:o||null},o){if(v.indexOf(o)<0)throw new Error('Unkown semantic "'+o+'"');r.attribSemantics[o]={symbol:i,type:n}}}return["attribute",n,i].join(" ")+";\n"}var t={},r=this;this._vertexProcessedWithoutDefine=this._vertexProcessedWithoutDefine.replace(/attribute\s+(float|int|vec2|vec3|vec4)\s+(\w*)\s*(:\s*(\w+))?;/g,e),this.attributeTemplates=t},_parseDefines:function(){function e(e,n,i){var a="vertex"===r?t.vertexDefines:t.fragmentDefines;return a[n]||(a[n]="false"!=i&&("true"==i||(i?isNaN(parseFloat(i))?i:parseFloat(i):null))),""}var t=this,r="vertex";this._vertexProcessedWithoutDefine=this._vertexProcessedWithoutDefine.replace(_,e),r="fragment",this._fragmentProcessedWithoutDefine=this._fragmentProcessedWithoutDefine.replace(_,e)},_buildProgram:function(e,t,r){var n=this._cache;n.get("program")&&e.deleteProgram(n.get("program"));var a=e.createProgram(),o=e.createShader(e.VERTEX_SHADER);e.shaderSource(o,t),e.compileShader(o);var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,r),e.compileShader(s);var u=i(e,o,t);if(u)return u;if(u=i(e,s,r))return u;if(e.attachShader(a,o),e.attachShader(a,s),this.attribSemantics.POSITION)e.bindAttribLocation(a,0,this.attribSemantics.POSITION.symbol);else{var h=Object.keys(this.attributeTemplates);e.bindAttribLocation(a,0,h[0])}if(e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))return"Could not link program\nVALIDATE_STATUS: "+e.getProgramParameter(a,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]";for(var l=0;l=r.COLOR_ATTACHMENT0&&a<=r.COLOR_ATTACHMENT0+8&&i.push(a);n.drawBuffersEXT(i)}}this.trigger("beforerender",this,e);var o=this.clearDepth?r.DEPTH_BUFFER_BIT:0;if(r.depthMask(!0),this.clearColor){o|=r.COLOR_BUFFER_BIT,r.colorMask(!0,!0,!0,!0);var s=this.clearColor;s instanceof Array&&r.clearColor(s[0],s[1],s[2],s[3])}r.clear(o),this.blendWithPrevious?(r.enable(r.BLEND),this.material.transparent=!0):(r.disable(r.BLEND),this.material.transparent=!1),this.renderQuad(e),this.trigger("afterrender",this,e),t&&this.unbind(e,t)},renderQuad:function(e){d.material=this.material,e.renderQueue([d],f)},dispose:function(e){this.material.dispose(e)}});e.exports=p},function(e,t,r){"use strict";function n(e){return"attr_"+e}var i=r(196),a=r(14),o=r(1),s=r(20),u=r(11),h=o.mat4,l=o.vec3,c=i.StaticAttribute,d=l.create,f=l.add,p=l.set,_=i.extend(function(){return{attributes:{position:new c("position","float",3,"POSITION"),texcoord0:new c("texcoord0","float",2,"TEXCOORD_0"),texcoord1:new c("texcoord1","float",2,"TEXCOORD_1"),normal:new c("normal","float",3,"NORMAL"),tangent:new c("tangent","float",4,"TANGENT"),color:new c("color","float",4,"COLOR"),weight:new c("weight","float",3,"WEIGHT"),joint:new c("joint","float",4,"JOINT"),barycentric:new c("barycentric","float",3,null)},hint:u.STATIC_DRAW,indices:null,_normalType:"vertex",_enabledAttributes:null}},{updateBoundingBox:function(){var e=this.boundingBox;e||(e=this.boundingBox=new a);var t=this.attributes.position.value;if(t&&t.length){var r=e.min,n=e.max,i=r._array,o=n._array;l.set(i,t[0],t[1],t[2]),l.set(o,t[0],t[1],t[2]);for(var s=3;so[0]&&(o[0]=u),h>o[1]&&(o[1]=h),c>o[2]&&(o[2]=c)}r._dirty=!0,n._dirty=!0}},dirty:function(){for(var e=this.getEnabledAttributes(),t=0;t=0){t||(t=d());var r=this.indices;return t[0]=r[3*e],t[1]=r[3*e+1],t[2]=r[3*e+2],t}},setTriangleIndices:function(e,t){var r=this.indices;r[3*e]=t[0],r[3*e+1]=t[1],r[3*e+2]=t[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(e){var t,r=this.vertexCount>65535?s.Uint32Array:s.Uint16Array;if(e[0]&&e[0].length){var n=0;t=new r(3*e.length);for(var i=0;i=0&&(t.splice(r,1),delete this.attributes[e],!0)},getEnabledAttributes:function(){var e=this._enabledAttributes,t=this._attributeList;if(e)return e;for(var r=[],n=this.vertexCount,i=0;i65535&&(this.indices=new s.Uint32Array(this.indices));for(var e=this.attributes,t=this.indices,r=this.getEnabledAttributes(),n={},i=0;i0){var t=this.min,r=this.max,n=t._array,i=r._array;o(n,e[0]),o(i,e[0]);for(var a=1;ai[0]&&(i[0]=s[0]),s[1]>i[1]&&(i[1]=s[1]),s[2]>i[2]&&(i[2]=s[2])}t._dirty=!0,r._dirty=!0}},union:function(e){var t=this.min,r=this.max;return a.min(t._array,t._array,e.min._array),a.max(r._array,r._array,e.max._array),t._dirty=!0,r._dirty=!0,this},intersection:function(e){var t=this.min,r=this.max;return a.max(t._array,t._array,e.min._array),a.min(r._array,r._array,e.max._array),t._dirty=!0,r._dirty=!0,this},intersectBoundingBox:function(e){var t=this.min._array,r=this.max._array,n=e.min._array,i=e.max._array;return!(t[0]>i[0]||t[1]>i[1]||t[2]>i[2]||r[0]=i[0]&&r[1]>=i[1]&&r[2]>=i[2]},containPoint:function(e){var t=this.min._array,r=this.max._array,n=e._array;return t[0]<=n[0]&&t[1]<=n[1]&&t[2]<=n[2]&&r[0]>=n[0]&&r[1]>=n[1]&&r[2]>=n[2]},isFinite:function(){var e=this.min._array,t=this.max._array;return isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])&&isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])},applyTransform:function(){var e=a.create(),t=a.create(),r=a.create(),n=a.create(),i=a.create(),o=a.create();return function(a){var s=this.min._array,u=this.max._array,h=a._array;return e[0]=h[0]*s[0],e[1]=h[1]*s[0],e[2]=h[2]*s[0],t[0]=h[0]*u[0],t[1]=h[1]*u[0],t[2]=h[2]*u[0],r[0]=h[4]*s[1],r[1]=h[5]*s[1],r[2]=h[6]*s[1],n[0]=h[4]*u[1],n[1]=h[5]*u[1],n[2]=h[6]*u[1],i[0]=h[8]*s[2],i[1]=h[9]*s[2],i[2]=h[10]*s[2],o[0]=h[8]*u[2],o[1]=h[9]*u[2],o[2]=h[10]*u[2],s[0]=Math.min(e[0],t[0])+Math.min(r[0],n[0])+Math.min(i[0],o[0])+h[12],s[1]=Math.min(e[1],t[1])+Math.min(r[1],n[1])+Math.min(i[1],o[1])+h[13],s[2]=Math.min(e[2],t[2])+Math.min(r[2],n[2])+Math.min(i[2],o[2])+h[14],u[0]=Math.max(e[0],t[0])+Math.max(r[0],n[0])+Math.max(i[0],o[0])+h[12],u[1]=Math.max(e[1],t[1])+Math.max(r[1],n[1])+Math.max(i[1],o[1])+h[13],u[2]=Math.max(e[2],t[2])+Math.max(r[2],n[2])+Math.max(i[2],o[2])+h[14],this.min._dirty=!0,this.max._dirty=!0,this}}(),applyProjection:function(e){var t=this.min._array,r=this.max._array,n=e._array,i=t[0],a=t[1],o=t[2],s=r[0],u=r[1],h=t[2],l=r[0],c=r[1],d=r[2];if(1===n[15])t[0]=n[0]*i+n[12],t[1]=n[5]*a+n[13],r[2]=n[10]*o+n[14],r[0]=n[0]*l+n[12],r[1]=n[5]*c+n[13],t[2]=n[10]*d+n[14];else{var f=-1/o;t[0]=n[0]*i*f,t[1]=n[5]*a*f,r[2]=(n[10]*o+n[14])*f,f=-1/h,r[0]=n[0]*s*f,r[1]=n[5]*u*f,f=-1/d,t[2]=(n[10]*d+n[14])*f}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var e=this.vertices;if(!e){for(var e=[],t=0;t<8;t++)e[t]=a.fromValues(0,0,0);this.vertices=e}var r=this.min._array,n=this.max._array;return s(e[0],r[0],r[1],r[2]),s(e[1],r[0],n[1],r[2]),s(e[2],n[0],r[1],r[2]),s(e[3],n[0],n[1],r[2]),s(e[4],r[0],r[1],n[2]),s(e[5],r[0],n[1],n[2]),s(e[6],n[0],r[1],n[2]),s(e[7],n[0],n[1],n[2]),this},copy:function(e){var t=this.min,r=this.max;return o(t._array,e.min._array),o(r._array,e.max._array),t._dirty=!0,r._dirty=!0,this},clone:function(){var e=new u;return e.copy(this),e}},e.exports=u},function(e,t){function r(e){if(null==e||"object"!=typeof e)return e;var t=e,n=G.call(e);if("[object Array]"===n){t=[];for(var i=0,a=e.length;i=0},set:function(e,t){if("object"==typeof e)for(var r in e){var n=e[r];this.set(r,n)}else{var i=this.uniforms[e];i&&(void 0===t&&(console.warn('Uniform value "'+e+'" is undefined'),t=null),i.value=t)}},get:function(e){var t=this.uniforms[e];if(t)return t.value},attachShader:function(e,t){this.shader&&this.shader.detached();var r=this.uniforms;this.uniforms=e.createUniforms(),this.shader=e;var n=this.uniforms;if(this._enabledUniforms=Object.keys(n),this._enabledUniforms.sort(),t)for(var i in r)n[i]&&(n[i].value=r[i].value);e.attached()},detachShader:function(){this.shader.detached(),this.shader=null,this.uniforms={}},clone:function(){var e=new this.constructor({name:this.name,shader:this.shader});for(var t in this.uniforms)e.uniforms[t].value=this.uniforms[t].value;return e.depthTest=this.depthTest,e.depthMask=this.depthMask,e.transparent=this.transparent,e.blend=this.blend,e},dispose:function(e,t){if(t)for(var r in this.uniforms){var n=this.uniforms[r].value;if(n)if(n instanceof i)n.dispose(e);else if(n instanceof Array)for(var a=0;a=r.x&&t>=r.y&&e<=r.x+r.width&&t<=r.y+r.height};var m=new c;n.prototype.castRay=function(e,t,r){var n=this.layer.renderer,i=n.viewport;return n.viewport=this.viewport,n.screenToNDC(e,t,m),this.camera.castRay(m,r),n.viewport=i,r},n.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this._needsSortProgressively=!1;for(var e=0;e30},n.prototype._doRender=function(e,t,r){var n=this.scene,i=this.camera;if(r=r||0,this._updateTransparent(e,n,i,r),t||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(e,n,i,!0)),this._updateShadowPCFKernel(r),e.gl.clearColor(0,0,0,0),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(e,i),this._compositor.updateNormal(e,n,i,this._temporalSS.getFrame())),this._updateSSAO(e,n,i,this._temporalSS.getFrame()),this._enablePostEffect){var a=this._compositor.getSourceFrameBuffer();a.bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT),e.render(n,i,!0,!0),a.unbind(e),this.needsTemporalSS()&&t?(this._compositor.composite(e,i,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),e.setViewport(this.viewport),this._temporalSS.render(e)):(e.setViewport(this.viewport),this._compositor.composite(e,i,null,0))}else if(this.needsTemporalSS()&&t){var a=this._temporalSS.getSourceFrameBuffer();a.bind(e),e.saveClear(),e.clearBit=e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT,e.render(n,i,!0),e.restoreClear(),a.unbind(e),e.setViewport(this.viewport),this._temporalSS.render(e)}else e.setViewport(this.viewport),e.render(n,i,!0,!0)},n.prototype._updateTransparent=function(e,t,r,n){for(var i=new l,a=new h,o=r.getWorldPosition(),s=0;sthis.camera.far||e65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,n){return 1/(i.dist(e,t)+i.dist(r,t)+i.dist(n,r)+1)*this.segmentScale},getCubicCurveVertexCount:function(e,t,r,n){var i=this._getCubicCurveApproxStep(e,t,r,n),a=Math.ceil(1/i);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,n){var i=this._getCubicCurveApproxStep(e,t,r,n),a=Math.ceil(1/i);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(s)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(s)},getPolylineVertexCount:function(e){var t="number"!=typeof e[0],r=t?e.length:e.length/3;return this.useNativeLine?2*(r-1):2*(r-1)+2},getPolylineTriangleCount:function(e){var t="number"!=typeof e[0],r=t?e.length:e.length/3;return this.useNativeLine?0:2*Math.max(r-1,0)},addCubicCurve:function(e,t,r,n,i,a){null==a&&(a=1);for(var o=e[0],s=e[1],u=e[2],h=t[0],l=t[1],c=t[2],d=r[0],f=r[1],p=r[2],_=n[0],m=n[1],g=n[2],v=this._getCubicCurveApproxStep(e,t,r,n),y=v*v,x=y*v,T=3*v,b=3*y,w=6*y,E=6*x,S=o-2*h+d,A=s-2*l+f,M=u-2*c+p,N=3*(h-d)-o+_,C=3*(l-f)-s+m,L=3*(c-p)-u+g,D=o,I=s,R=u,P=(h-o)*T+S*b+N*x,O=(l-s)*T+A*b+C*x,F=(c-u)*T+M*b+L*x,B=S*w+N*E,U=A*w+C*E,z=M*w+L*E,G=N*E,k=C*E,H=L*E,V=0,W=0,q=Math.ceil(1/v),X=new Float32Array(3*(q+1)),X=[],j=0,W=0;W1&&(D=P>0?Math.min(D,_):Math.max(D,_),I=O>0?Math.min(I,m):Math.max(I,m),R=F>0?Math.min(R,g):Math.max(R,g));return this.addPolyline(X,i,a,!1)},addLine:function(e,t,r,n){return this.addPolyline([e,t],r,n,!1)},addPolyline:function(e,t,r,n){if(e.length){this._itemVertexOffsets.push(this._vertexOffset);var i,a,o="number"!=typeof e[0],s=this.attributes.position,u=this.attributes.positionPrev,h=this.attributes.positionNext,l=this.attributes.color,c=this.attributes.offset,d=this.indices,f=this._vertexOffset,p=o?e.length:e.length/3,_=p;if(!(p<2)){null==r&&(r=1),r=Math.max(r,.01);for(var m=0;m<_;m++){if(o)i=e[m],a=n?t[m]:t;else{var g=3*m;if(i=i||[],i[0]=e[g],i[1]=e[g+1],i[2]=e[g+2],n){var v=4*m;a=a||[],a[0]=t[v],a[1]=t[v+1],a[2]=t[v+2],a[3]=t[v+3]}else a=t}if(this.useNativeLine?m>1&&(s.copy(f,f-1),l.copy(f,f-1),f++):(m<_-1&&(u.set(f+2,i),u.set(f+3,i)),m>0&&(h.set(f-2,i),h.set(f-1,i)),s.set(f,i),s.set(f+1,i),l.set(f,a),l.set(f+1,a),c.set(f,r/2),c.set(f+1,-r/2),f+=2),this.useNativeLine)l.set(f,a),s.set(f,i),f++;else if(m>0){var y=3*this._triangleOffset,d=this.indices;d[y]=f-4,d[y+1]=f-3,d[y+2]=f-2,d[y+3]=f-3,d[y+4]=f-1,d[y+5]=f-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,T=this._vertexOffset+2*p;u.copy(x,x+2),u.copy(x+1,x+3),h.copy(T-1,T-3),h.copy(T-2,T-4)}return this._vertexOffset=f,this._vertexOffset}}},setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],n=e1&&e.texParameterf(e.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===r){a.getExtension(e,"OES_texture_half_float")||(r=o.FLOAT)}if(this.mipmaps.length)for(var i=this.width,s=this.height,u=0;u256?64:a>64?32:a>16?16:8;var o=this.getSkinMatricesTexture();o.width=i,o.height=i,o.pixels&&o.pixels.length===i*i*4||(o.pixels=new Float32Array(i*i*4)),o.pixels.set(r),o.dirty(),t.setUniform(e,"1f","skinMatricesTextureSize",i)}else t.setUniformOfSemantic(e,"SKIN_MATRIX",r)}return n.prototype.render.call(this,e,t)},getSkinMatricesTexture:function(){return this._skinMatricesTexture=this._skinMatricesTexture||new a({type:i.FLOAT,minFilter:i.NEAREST,magFilter:i.NEAREST,useMipmap:!1,flipY:!1}),this._skinMatricesTexture}});o.POINTS=i.POINTS,o.LINES=i.LINES,o.LINE_LOOP=i.LINE_LOOP,o.LINE_STRIP=i.LINE_STRIP,o.TRIANGLES=i.TRIANGLES,o.TRIANGLE_STRIP=i.TRIANGLE_STRIP,o.TRIANGLE_FAN=i.TRIANGLE_FAN,o.BACK=i.BACK,o.FRONT=i.FRONT,o.FRONT_AND_BACK=i.FRONT_AND_BACK,o.CW=i.CW,o.CCW=i.CCW,e.exports=o},function(e,t,r){"use strict";function n(e,t){if(t.castShadow&&!e.castShadow)return!0}var i=r(35),a=r(19),o=r(14),s=i.extend(function(){return{material:null,autoUpdate:!0,opaqueQueue:[],transparentQueue:[],lights:[],viewBoundingBoxLastFrame:new o,_lightUniforms:{},_lightNumber:{},_opaqueObjectCount:0,_transparentObjectCount:0,_nodeRepository:{}}},function(){this._scene=this},{addToScene:function(e){e.name&&(this._nodeRepository[e.name]=e)},removeFromScene:function(e){e.name&&delete this._nodeRepository[e.name]},getNode:function(e){return this._nodeRepository[e]},cloneNode:function(e){var t=e.clone(),r={},n=function(i,a){i.skeleton&&(a.skeleton=i.skeleton.clone(e,t),a.joints=i.joints.slice()),i.material&&(r[i.material.__GUID__]={oldMat:i.material});for(var o=0;o0&&this._updateRenderQueue(n)}},_updateLightUniforms:function(){var e=this.lights;e.sort(n);var t=this._lightUniforms;for(var r in t)for(var i in t[r])t[r][i].value.length=0;for(var a=0;a":"")+u.join(s?"
":", ")}(o):i.format.encodeHTML(i.format.addCommas(o)),u=a.getName(t),h=a.getItemVisual(t,"color");i.util.isObject(h)&&h.colorStops&&(h=(h.colorStops[0]||{}).color),h=h||"transparent";var l=i.format.getTooltipMarker(h),c=e.name;return"\0-"===c&&(c=""),c=c?i.format.encodeHTML(c)+(r?": ":"
"):"",r?l+c+s:c+l+(u?i.format.encodeHTML(u)+": "+s:s)}},function(e,t,r){function n(){}var i=r(2),a=r(57),o=r(58),s=r(0);n.prototype={constructor:n,setScene:function(e){this._scene=e,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(e){this._lightRoot=e,this.mainLight=new i.DirectionalLight({shadowBias:.005}),this.ambientLight=new i.AmbientLight,e.add(this.mainLight),e.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(e){var t=this.mainLight,r=this.ambientLight,n=e.getModel("light"),a=n.getModel("main"),o=n.getModel("ambient");t.intensity=a.get("intensity"),r.intensity=o.get("intensity"),t.color=i.parseColor(a.get("color")).slice(0,3),r.color=i.parseColor(o.get("color")).slice(0,3);var s=a.get("alpha")||0,u=a.get("beta")||0;t.position.setArray(i.directionFromAlphaBeta(s,u)),t.lookAt(i.Vector3.ZERO),t.castShadow=a.get("shadow"),t.shadowResolution=i.getShadowResolution(a.get("shadowQuality"))},updateAmbientCubemap:function(e,t,r){var n=t.getModel("light.ambientCubemap"),o=n.get("texture");if(o){this._cubemapLightsCache=this._cubemapLightsCache||{};var s=this._cubemapLightsCache[o];if(!s){var u=this;s=this._cubemapLightsCache[o]=i.createAmbientCubemap(n.option,e,r,function(){u._skybox instanceof a&&u._skybox.setEnvironmentMap(s.specular.cubemap),r.getZr().refresh()})}this._lightRoot.add(s.diffuse),this._lightRoot.add(s.specular),this._currentCubemapLights=s}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(e,t,r){function n(){return h._skybox instanceof o||(h._skybox&&h._skybox.dispose(e.gl),h._skybox=new o),h._skybox}var u=t.get("environment"),h=this;if(u&&"none"!==u)if("auto"===u)if(this._currentCubemapLights){var l=function(){return h._skybox instanceof a||(h._skybox&&h._skybox.dispose(e.gl),h._skybox=new a),h._skybox}(),c=this._currentCubemapLights.specular.cubemap;l.setEnvironmentMap(c),this._scene&&l.attachScene(this._scene),l.material.set("lod",2)}else this._skybox&&this._skybox.detachScene();else if("object"==typeof u&&u.colorStops||"string"==typeof u&&s.color.parse(u)){var d=n(),f=new i.Texture2D({anisotropic:8,flipY:!1});d.setEnvironmentMap(f);var p=f.image=document.createElement("canvas");p.width=p.height=16;var _=p.getContext("2d"),m=new s.graphic.Rect({shape:{x:0,y:0,width:16,height:16},style:{fill:u}});m.brush(_),d.attachScene(this._scene)}else{var d=n(),f=i.loadTexture(u,r,{anisotropic:8,flipY:!1});d.setEnvironmentMap(f),d.attachScene(this._scene)}else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var g=t.coordinateSystem;if(this._skybox)if(!g||!g.viewGL||"auto"===u||u.match&&u.match(/.hdr$/))this._skybox.material.shader.undefine("fragment","SRGB_DECODE");else{var v=g.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material.shader[v]("fragment","SRGB_DECODE")}}},e.exports=n},function(e,t){e.exports={defaultOption:{light:{main:{shadow:!1,shadowQuality:"high",color:"#fff",intensity:1,alpha:0,beta:0},ambient:{color:"#fff",intensity:.2},ambientCubemap:{texture:null,exposure:1,diffuseIntensity:.5,specularIntensity:.5}}}}},function(e,t){e.exports={defaultOption:{postEffect:{enable:!1,bloom:{enable:!0,intensity:.1},depthOfField:{enable:!1,focalRange:20,focalDistance:50,blurRadius:10,fstop:2.8,quality:"medium"},screenSpaceAmbientOcclusion:{enable:!1,radius:2,quality:"medium",intensity:1},screenSpaceReflection:{enable:!1,quality:"medium",maxRoughness:.8},colorCorrection:{enable:!0,exposure:0,brightness:0,contrast:1,saturation:1,lookupTexture:""},edge:{enable:!1},FXAA:{enable:!1}},temporalSuperSampling:{enable:"auto"}}}},function(e,t){e.exports={defaultOption:{shading:null,realisticMaterial:{textureTiling:1,textureOffset:0,detailTexture:null},lambertMaterial:{textureTiling:1,textureOffset:0,detailTexture:null},colorMaterial:{textureTiling:1,textureOffset:0,detailTexture:null},hatchingMaterial:{textureTiling:1,textureOffset:0,paperColor:"#fff"}}}},function(e,t){e.exports={convertToDynamicArray:function(e){e&&this.resetOffset();var t=this.attributes;for(var r in t)e||!t[r].value?t[r].value=[]:t[r].value=Array.prototype.slice.call(t[r].value);e||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var e=this.attributes;for(var t in e)e[t].value&&e[t].value.length>0?e[t].value=new Float32Array(e[t].value):e[t].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}}},function(e,t,r){"use strict";var n=r(8),i=r(3),a=r(55),o=r(9),s=r(1),u=r(14),h=s.mat4,l=0,c=n.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},function(){this.name||(this.name=(this.type||"NODE")+"_"+l++),this.position||(this.position=new i),this.rotation||(this.rotation=new a),this.scale||(this.scale=new i(1,1,1)),this.worldTransform=new o,this.localTransform=new o,this._children=[]},{target:null,invisible:!1,isRenderable:function(){return!1},setName:function(e){var t=this._scene;if(t){var r=t._nodeRepository;delete r[this.name],r[e]=this}this.name=e},add:function(e){this._inIterating&&console.warn("Add operation can cause unpredictable error when in iterating");var t=e._parent;if(t!==this){t&&t.remove(e),e._parent=this,this._children.push(e);var r=this._scene;r&&r!==e.scene&&e.traverse(this._addSelfToScene,this),e._needsUpdateWorldTransform=!0}},remove:function(e){this._inIterating&&console.warn("Remove operation can cause unpredictable error when in iterating");var t=this._children,r=t.indexOf(e);r<0||(t.splice(r,1),e._parent=null,this._scene&&e.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var e=this._children,t=0;t0){var t=this.outputs[e];t.keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e])}}});e.exports=i},function(e,t){e.exports={defaultOption:{viewControl:{projection:"perspective",autoRotate:!1,autoRotateDirection:"cw",autoRotateSpeed:10,autoRotateAfterStill:3,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",distance:150,minDistance:40,maxDistance:400,orthographicSize:150,maxOrthographicSize:400,minOrthographicSize:20,center:[0,0,0],alpha:0,beta:0,minAlpha:-90,maxAlpha:90}},setView:function(e){e=e||{},this.option.viewControl=this.option.viewControl||{},null!=e.alpha&&(this.option.viewControl.alpha=e.alpha),null!=e.beta&&(this.option.viewControl.beta=e.beta),null!=e.distance&&(this.option.viewControl.distance=e.distance),null!=e.center&&(this.option.viewControl.center=e.center)}}},function(e,t){function r(e,t){for(var r=0,n=1/t,i=e;i>0;)r+=n*(i%t),i=Math.floor(i/t),n/=t;return r}e.exports=r},function(e,t,r){function n(e){return e instanceof Array||(e=[e,e]),e}var i=r(8),a=r(28),o=r(3),s=(r(55),r(4)),u=s.firstNotNull,h={left:0,middle:1,right:2},l=i.extend(function(){return{zr:null,viewGL:null,_center:new o,minDistance:.5,maxDistance:1.5,maxOrthographicSize:300,minOrthographicSize:30,minAlpha:-90,maxAlpha:90,minBeta:-1/0,maxBeta:1/0,autoRotateAfterStill:0,autoRotateDirection:"cw",autoRotateSpeed:60,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",_mode:"rotate",_camera:null,_needsUpdate:!1,_rotating:!1,_phi:0,_theta:0,_mouseX:0,_mouseY:0,_rotateVelocity:new a,_panVelocity:new a,_distance:500,_zoomSpeed:0,_stillTimeout:0,_animators:[]}},function(){["_mouseDownHandler","_mouseWheelHandler","_mouseMoveHandler","_mouseUpHandler","_pinchHandler","_contextMenuHandler","_update"].forEach(function(e){this[e]=this[e].bind(this)},this)},{init:function(){var e=this.zr;e&&(e.on("mousedown",this._mouseDownHandler),e.on("globalout",this._mouseUpHandler),e.on("mousewheel",this._mouseWheelHandler),e.on("pinch",this._pinchHandler),e.animation.on("frame",this._update),e.dom.addEventListener("contextmenu",this._contextMenuHandler))},dispose:function(){var e=this.zr;e&&(e.off("mousedown",this._mouseDownHandler),e.off("mousemove",this._mouseMoveHandler),e.off("mouseup",this._mouseUpHandler),e.off("mousewheel",this._mouseWheelHandler),e.off("pinch",this._pinchHandler),e.off("globalout",this._mouseUpHandler),e.dom.removeEventListener("contextmenu",this._contextMenuHandler),e.animation.off("frame",this._update)),this.stopAllAnimation()},getDistance:function(){return this._distance},setDistance:function(e){this._distance=e,this._needsUpdate=!0},getOrthographicSize:function(){return this._orthoSize},setOrthographicSize:function(e){this._orthoSize=e,this._needsUpdate=!0},getAlpha:function(){return this._theta/Math.PI*180},getBeta:function(){return-this._phi/Math.PI*180},getCenter:function(){return this._center.toArray()},setAlpha:function(e){e=Math.max(Math.min(this.maxAlpha,e),this.minAlpha),this._theta=e/180*Math.PI,this._needsUpdate=!0},setBeta:function(e){e=Math.max(Math.min(this.maxBeta,e),this.minBeta),this._phi=-e/180*Math.PI,this._needsUpdate=!0},setCenter:function(e){this._center.setArray(e)},setViewGL:function(e){this.viewGL=e},getCamera:function(){return this.viewGL.camera},setFromViewControlModel:function(e,t){t=t||{};var r=t.baseDistance||0,n=t.baseOrthoSize||1,i=e.get("projection");"perspective"!==i&&"orthographic"!==i&&"isometric"!==i&&(i="perspective"),this._projection=i,this.viewGL.setProjection(i);var a=e.get("distance")+r,o=e.get("orthographicSize")+n;[["damping",.8],["autoRotate",!1],["autoRotateAfterStill",3],["autoRotateDirection","cw"],["autoRotateSpeed",10],["minDistance",30],["maxDistance",400],["minOrthographicSize",30],["maxOrthographicSize",300],["minAlpha",-90],["maxAlpha",90],["minBeta",-1/0],["maxBeta",1/0],["rotateSensitivity",1],["zoomSensitivity",1],["panSensitivity",1],["panMouseButton","left"],["rotateMouseButton","middle"]].forEach(function(t){this[t[0]]=u(e.get(t[0]),t[1])},this),this.minDistance+=r,this.maxDistance+=r,this.minOrthographicSize+=n,this.maxOrthographicSize+=n;var s=e.ecModel,h={};["animation","animationDurationUpdate","animationEasingUpdate"].forEach(function(t){h[t]=u(e.get(t),s&&s.get(t))});var l=u(t.alpha,e.get("alpha"))||0,c=u(t.beta,e.get("beta"))||0,d=u(t.center,e.get("center"))||[0,0,0];h.animation&&h.animationDurationUpdate>0&&this._notFirst?this.animateTo({alpha:l,beta:c,center:d,distance:a,targetOrthographicSize:o,easing:h.animationEasingUpdate,duration:h.animationDurationUpdate}):(this.setDistance(a),this.setAlpha(l),this.setBeta(c),this.setCenter(d),this.setOrthographicSize(o)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){},animateTo:function(e){var t=this.zr,r=this,n={},i={};return null!=e.distance&&(n.distance=this.getDistance(),i.distance=e.distance),null!=e.orthographicSize&&(n.orthographicSize=this.getOrthographicSize(),i.orthographicSize=e.orthographicSize),null!=e.alpha&&(n.alpha=this.getAlpha(),i.alpha=e.alpha),null!=e.beta&&(n.beta=this.getBeta(),i.beta=e.beta),null!=e.center&&(n.center=this.getCenter(),i.center=e.center),this._addAnimator(t.animation.animate(n).when(e.duration||1e3,i).during(function(){null!=n.alpha&&r.setAlpha(n.alpha),null!=n.beta&&r.setBeta(n.beta),null!=n.distance&&r.setDistance(n.distance),null!=n.center&&r.setCenter(n.center),null!=n.orthographicSize&&r.setOrthographicSize(n.orthographicSize),r._needsUpdate=!0})).start(e.easing||"linear")},stopAllAnimation:function(){for(var e=0;e0},_update:function(e){if(this._rotating){var t=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=t*e/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(e=Math.min(e,50),this._updateDistanceOrSize(e),this._updatePan(e),this._updateRotate(e),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(e){var t=this._rotateVelocity;this._phi=t.y*e/20+this._phi,this._theta=t.x*e/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(t,Math.pow(this.damping,e/16))},_updateDistanceOrSize:function(e){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*e/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*e/20),this._zoomSpeed*=Math.pow(this.damping,e/16)},_setDistance:function(e){this._distance=Math.max(Math.min(e,this.maxDistance),this.minDistance)},_setOrthoSize:function(e){this._orthoSize=Math.max(Math.min(e,this.maxOrthographicSize),this.minOrthographicSize);var t=this.getCamera(),r=this._orthoSize,n=r/this.viewGL.viewport.height*this.viewGL.viewport.width;t.left=-n/2,t.right=n/2,t.top=r/2,t.bottom=-r/2},_updatePan:function(e){var t=this._panVelocity,r=this._distance,n=this.getCamera(),i=n.worldTransform.y,a=n.worldTransform.x;this._center.scaleAndAdd(a,-t.x*r/200).scaleAndAdd(i,-t.y*r/200),this._vectorDamping(t,0)},_updateTransform:function(){var e=this.getCamera(),t=new o,r=this._theta+Math.PI/2,n=this._phi+Math.PI/2,i=Math.sin(r);t.x=i*Math.cos(n),t.y=-Math.cos(r),t.z=i*Math.sin(n),e.position.copy(this._center).scaleAndAdd(t,this._distance),e.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var e=this.autoRotateAfterStill,t=this;!isNaN(e)&&e>0&&(this._stillTimeout=setTimeout(function(){t._rotating=!0},1e3*e))},_vectorDamping:function(e,t){var r=e.len();r*=t,r<1e-4&&(r=0),e.normalize().scale(r)},_decomposeTransform:function(){if(this.getCamera()){var e=new o;e.eulerFromQuat(this.getCamera().rotation.normalize(),"ZYX"),this._theta=-e.x,this._phi=-e.y,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(e){if(!e.target&&!this._isAnimating()){var t=e.offsetX,r=e.offsetY;this.viewGL&&!this.viewGL.containPoint(t,r)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),e.event.targetTouches?1===e.event.targetTouches.length&&(this._mode="rotate"):e.event.button===h[this.rotateMouseButton]?this._mode="rotate":e.event.button===h[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=e.offsetX,this._mouseY=e.offsetY)}},_mouseMoveHandler:function(e){if(!(e.target&&e.target.__isGLToZRProxy||this._isAnimating())){var t=n(this.panSensitivity),r=n(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(e.offsetX-this._mouseX)/this.zr.getHeight()*2*r[0],this._rotateVelocity.x=(e.offsetY-this._mouseY)/this.zr.getWidth()*2*r[1]):"pan"===this._mode&&(this._panVelocity.x=(e.offsetX-this._mouseX)/this.zr.getWidth()*t[0]*400,this._panVelocity.y=(-e.offsetY+this._mouseY)/this.zr.getHeight()*t[1]*400),this._mouseX=e.offsetX,this._mouseY=e.offsetY,e.event.preventDefault()}},_mouseWheelHandler:function(e){if(!this._isAnimating()){var t=e.event.wheelDelta||-e.event.detail;this._zoomHandler(e,t)}},_pinchHandler:function(e){this._isAnimating()||(this._zoomHandler(e,e.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(e,t){if(0!==t){var r=e.offsetX,n=e.offsetY;if(!this.viewGL||this.viewGL.containPoint(r,n)){var i;i="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(t>0?-1:1)*i*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),e.event.preventDefault()}}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(e){this._isRightMouseButtonUsed()&&e.preventDefault()},_addAnimator:function(e){var t=this._animators;return t.push(e),e.done(function(){var r=t.indexOf(e);r>=0&&t.splice(r,1)}),e}});Object.defineProperty(l.prototype,"autoRotate",{get:function(e){return this._autoRotate},set:function(e){this._autoRotate=e,this._rotating=e}}),e.exports=l},function(e,t){e.exports="@export ecgl.lines3D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, 1.0);\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import qtek.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n}\n@end\n\n\n\n@export ecgl.lines3D.clipNear\n\nvec4 clipNear(vec4 p1, vec4 p2) {\n float n = (p1.w - near) / (p1.w - p2.w);\n return vec4(mix(p1.xy, p2.xy, n), -near, near);\n}\n\n@end\n\n@export ecgl.lines3D.expandLine\n#ifdef VERTEX_ANIMATION\n vec4 prevProj = worldViewProjection * vec4(mix(prevPositionPrev, positionPrev, percent), 1.0);\n vec4 currProj = worldViewProjection * vec4(mix(prevPosition, position, percent), 1.0);\n vec4 nextProj = worldViewProjection * vec4(mix(prevPositionNext, positionNext, percent), 1.0);\n#else\n vec4 prevProj = worldViewProjection * vec4(positionPrev, 1.0);\n vec4 currProj = worldViewProjection * vec4(position, 1.0);\n vec4 nextProj = worldViewProjection * vec4(positionNext, 1.0);\n#endif\n\n if (currProj.w < 0.0) {\n if (nextProj.w > 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import qtek.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"},function(e,t,r){"use strict";function n(e,t,r,n,i){var a=0,o=0;null==n&&(n=1/0),null==i&&(i=1/0);var s=0;t.eachChild(function(u,h){var l,c,d=u.position,f=u.getBoundingRect(),p=t.childAt(h+1),_=p&&p.getBoundingRect();if("horizontal"===e){var m=f.width+(_?-_.x+f.x:0);l=a+m,l>n||u.newline?(a=0,l=m,o+=s+r,s=f.height):s=Math.max(s,f.height)}else{var g=f.height+(_?-_.y+f.y:0);c=o+g,c>i||u.newline?(a+=s+r,o=0,c=g,s=f.width):s=Math.max(s,f.width)}u.newline||(d[0]=a,d[1]=o,"horizontal"===e?a=l+r:o=c+r)})}var i=r(15),a=r(84),o=r(68),s=r(195),u=o.parsePercent,h=i.each,l={},c=l.LOCATION_PARAMS=["left","right","top","bottom","width","height"],d=l.HV_NAMES=[["width","left","right"],["height","top","bottom"]];l.box=n,l.vbox=i.curry(n,"vertical"),l.hbox=i.curry(n,"horizontal"),l.getAvailableSize=function(e,t,r){var n=t.width,i=t.height,a=u(e.x,n),o=u(e.y,i),h=u(e.x2,n),l=u(e.y2,i);return(isNaN(a)||isNaN(parseFloat(e.x)))&&(a=0),(isNaN(h)||isNaN(parseFloat(e.x2)))&&(h=n),(isNaN(o)||isNaN(parseFloat(e.y)))&&(o=0),(isNaN(l)||isNaN(parseFloat(e.y2)))&&(l=i),r=s.normalizeCssArray(r||0),{width:Math.max(h-a-r[1]-r[3],0),height:Math.max(l-o-r[0]-r[2],0)}},l.getLayoutRect=function(e,t,r){r=s.normalizeCssArray(r||0);var n=t.width,i=t.height,o=u(e.left,n),h=u(e.top,i),l=u(e.right,n),c=u(e.bottom,i),d=u(e.width,n),f=u(e.height,i),p=r[2]+r[0],_=r[1]+r[3],m=e.aspect;switch(isNaN(d)&&(d=n-l-_-o),isNaN(f)&&(f=i-c-p-h),null!=m&&(isNaN(d)&&isNaN(f)&&(m>n/i?d=.8*n:f=.8*i),isNaN(d)&&(d=m*f),isNaN(f)&&(f=d/m)),isNaN(o)&&(o=n-l-d-_),isNaN(h)&&(h=i-c-f-p),e.left||e.right){case"center":o=n/2-d/2-r[3];break;case"right":o=n-d-_}switch(e.top||e.bottom){case"middle":case"center":h=i/2-f/2-r[0];break;case"bottom":h=i-f-p}o=o||0,h=h||0,isNaN(d)&&(d=n-_-o-(l||0)),isNaN(f)&&(f=i-p-h-(c||0));var g=new a(o+r[3],h+r[0],d,f);return g.margin=r,g},l.positionElement=function(e,t,r,n,o){var s=!o||!o.hv||o.hv[0],u=!o||!o.hv||o.hv[1],h=o&&o.boundingMode||"all";if(s||u){var c;if("raw"===h)c="group"===e.type?new a(0,0,+t.width||0,+t.height||0):e.getBoundingRect();else if(c=e.getBoundingRect(),e.needLocalTransform()){var d=e.getLocalTransform();c=c.clone(),c.applyTransform(d)}t=l.getLayoutRect(i.defaults({width:c.width,height:c.height},t),r,n);var f=e.position,p=s?t.x-c.x:0,_=u?t.y-c.y:0;e.attr("position","raw"===h?[p,_]:[f[0]+p,f[1]+_])}},l.sizeCalculable=function(e,t){return null!=e[d[t][0]]||null!=e[d[t][1]]&&null!=e[d[t][2]]},l.mergeLayoutParam=function(e,t,r){function n(r,n){var i={},s=0,l={},c=0;if(h(r,function(t){l[t]=e[t]}),h(r,function(e){a(t,e)&&(i[e]=l[e]=t[e]),o(i,e)&&s++,o(l,e)&&c++}),u[n])return o(t,r[1])?l[r[2]]=null:o(t,r[2])&&(l[r[1]]=null),l;if(2!==c&&s){if(s>=2)return i;for(var d=0;d1?(d[0]=l.maxSize,d[1]=l.maxSize/l.aspect):(d[1]=l.maxSize,d[0]=l.maxSize*l.aspect);var f=e.getModel("itemStyle").getItemStyle();d[0]=d[0]||1,d[1]=d[1]||1,this._symbolType===l.type&&n(this._symbolSize,d)&&this._lineWidth===f.lineWidth||(s.createSymbolSprite(l.type,d,{fill:"#fff",lineWidth:f.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(d[0]/2,10)},this._spriteImageCanvas),s.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),20,this._mesh.material.get("sprite").image),this._symbolType=l.type,this._symbolSize=d,this._lineWidth=f.lineWidth);var p=this._mesh.geometry,_=h.getLayout("points"),m=p.attributes;m.position.init(h.count()),m.size.init(h.count()),m.color.init(h.count());var g=m.position.value,v=[],y=this.is2D,x=this._spriteImageCanvas.width/l.maxSize*c;this._originalOpacity=new Float32Array(h.count());for(var T=0;T0,r={},n=0;n=2e4},doSortTriangles:function(e,t){var r=this.indices;if(0===t){var i=this.attributes.position,e=e._array;this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new r.constructor(r.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var u,h=0,l=0;l0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var e=this._clearStack.pop();this.clearColor=e.clearColor,this.clearBit=e.clearBit}},bindSceneRendering:function(e){this._sceneRendering=e},beforeRenderObject:function(){},afterRenderObject:function(){},render:function(e,t,r,n){var i=this.gl;this._sceneRendering=e;var a=this.clearColor;if(this.clearBit){i.colorMask(!0,!0,!0,!0),i.depthMask(!0);var o=this.viewport,s=!1,u=o.devicePixelRatio;(o.width!==this._width||o.height!==this._height||u&&u!==this.devicePixelRatio||o.x||o.y)&&(s=!0,i.enable(i.SCISSOR_TEST),i.scissor(o.x*u,o.y*u,o.width*u,o.height*u)),i.clearColor(a[0],a[1],a[2],a[3]),i.clear(this.clearBit),s&&i.disable(i.SCISSOR_TEST)}r||e.update(!1),t.getScene()||t.update(!0);for(var h=e.opaqueQueue,l=e.transparentQueue,c=e.material,_=0;_0)for(var g=p(),v=f.create(),_=0;_0&&e.min._array[2]<0&&(e.max._array[2]=-1e-20),e.applyProjection(t);var u=e.min._array,h=e.max._array;if(h[0]<-1||u[0]>1||h[1]<-1||u[1]>1||h[2]<-1||u[2]>1)return!0}return!1}}(),disposeScene:function(e){this.disposeNode(e,!0,!0),e.dispose()},disposeNode:function(e,t,r){var n={},i=this.gl;e.getParent()&&e.getParent().remove(e),e.traverse(function(e){e.geometry&&t&&e.geometry.dispose(i),e.material&&(n[e.material.__GUID__]=e.material),e.dispose&&e.dispose(i)});for(var a in n){n[a].dispose(i,r)}},disposeShader:function(e){e.dispose(this.gl)},disposeGeometry:function(e){e.dispose(this.gl)},disposeTexture:function(e){e.dispose(this.gl)},disposeFrameBuffer:function(e){e.dispose(this.gl)},dispose:function(){i.dispose(this.gl)},screenToNDC:function(e,t,r){r||(r=new h),t=this._height-t;var n=this.viewport,i=r._array;return i[0]=(e-n.x)/n.width,i[0]=2*i[0]-1,i[1]=(t-n.y)/n.height,i[1]=2*i[1]-1,r}});g.opaqueSortFunc=g.prototype.opaqueSortFunc=function(e,t){return e.renderOrder===t.renderOrder?e.material.shader===t.material.shader?e.material===t.material?e.geometry.__GUID__-t.geometry.__GUID__:e.material.__GUID__-t.material.__GUID__:e.material.shader.__GUID__-t.material.shader.__GUID__:e.renderOrder-t.renderOrder},g.transparentSortFunc=g.prototype.transparentSortFunc=function(e,t){return e.renderOrder===t.renderOrder?e.__depth===t.__depth?e.material.shader===t.material.shader?e.material===t.material?e.geometry.__GUID__-t.geometry.__GUID__:e.material.__GUID__-t.material.__GUID__:e.material.shader.__GUID__-t.material.shader.__GUID__:e.__depth-t.__depth:e.renderOrder-t.renderOrder};var v={WORLD:p(),VIEW:p(),PROJECTION:p(),WORLDVIEW:p(),VIEWPROJECTION:p(),WORLDVIEWPROJECTION:p(),WORLDINVERSE:p(),VIEWINVERSE:p(),PROJECTIONINVERSE:p(),WORLDVIEWINVERSE:p(),VIEWPROJECTIONINVERSE:p(),WORLDVIEWPROJECTIONINVERSE:p(),WORLDTRANSPOSE:p(),VIEWTRANSPOSE:p(),PROJECTIONTRANSPOSE:p(),WORLDVIEWTRANSPOSE:p(),VIEWPROJECTIONTRANSPOSE:p(),WORLDVIEWPROJECTIONTRANSPOSE:p(),WORLDINVERSETRANSPOSE:p(),VIEWINVERSETRANSPOSE:p(),PROJECTIONINVERSETRANSPOSE:p(),WORLDVIEWINVERSETRANSPOSE:p(),VIEWPROJECTIONINVERSETRANSPOSE:p(),WORLDVIEWPROJECTIONINVERSETRANSPOSE:p()};g.COLOR_BUFFER_BIT=a.COLOR_BUFFER_BIT,g.DEPTH_BUFFER_BIT=a.DEPTH_BUFFER_BIT,g.STENCIL_BUFFER_BIT=a.STENCIL_BUFFER_BIT,e.exports=g},function(e,t){function r(e,t){this.action=e,this.context=t}var n={trigger:function(e){if(this.hasOwnProperty("__handlers__")&&this.__handlers__.hasOwnProperty(e)){var t=this.__handlers__[e],r=t.length,n=-1,i=arguments;switch(i.length){case 1:for(;++nc)){var d=Math.sqrt(c-l),f=u-d,p=u+d;return i||(i=new n),f<0?p<0?null:(a.scaleAndAdd(i._array,o,s,p),i):(a.scaleAndAdd(i._array,o,s,f),i)}}}(),intersectBoundingBox:function(e,t){var r,i,o,s,u,h,l=this.direction._array,c=this.origin._array,d=e.min._array,f=e.max._array,p=1/l[0],_=1/l[1],m=1/l[2];if(p>=0?(r=(d[0]-c[0])*p,i=(f[0]-c[0])*p):(i=(d[0]-c[0])*p,r=(f[0]-c[0])*p),_>=0?(o=(d[1]-c[1])*_,s=(f[1]-c[1])*_):(s=(d[1]-c[1])*_,o=(f[1]-c[1])*_),r>s||o>i)return null;if((o>r||r!==r)&&(r=o),(s=0?(u=(d[2]-c[2])*m,h=(f[2]-c[2])*m):(h=(d[2]-c[2])*m,u=(f[2]-c[2])*m),r>h||u>i)return null;if((u>r||r!==r)&&(r=u),(h=0?r:i;return t||(t=new n),a.scaleAndAdd(t._array,c,l,g),t},intersectTriangle:function(){var e=a.create(),t=a.create(),r=a.create(),i=a.create();return function(o,s,u,h,l,c){var d=this.direction._array,f=this.origin._array;o=o._array,s=s._array,u=u._array,a.sub(e,s,o),a.sub(t,u,o),a.cross(i,t,d);var p=a.dot(e,i);if(h){if(p>-1e-5)return null}else if(p>-1e-5&&p<1e-5)return null;a.sub(r,f,o);var _=a.dot(i,r)/p;if(_<0||_>1)return null;a.cross(i,e,r);var m=a.dot(d,i)/p;if(m<0||m>1||_+m>1)return null;a.cross(i,e,t);var g=-a.dot(r,i)/p;return g<0?null:(l||(l=new n),c&&n.set(c,1-_-m,_,m),a.scaleAndAdd(l._array,f,d,g),l)}}(),applyTransform:function(e){n.add(this.direction,this.direction,this.origin),n.transformMat4(this.origin,this.origin,e),n.transformMat4(this.direction,this.direction,e),n.sub(this.direction,this.direction,this.origin),n.normalize(this.direction,this.direction)},copy:function(e){n.copy(this.origin,e.origin),n.copy(this.direction,e.direction)},clone:function(){var e=new o;return e.copy(this),e}},e.exports=o},function(e,t,r){var n=r(25),i=r(74),a=r(7),o=r(16);a.import(r(226));var s=n.extend(function(){var e=new a({vertex:a.source("qtek.skybox.vertex"),fragment:a.source("qtek.skybox.fragment")}),t=new o({shader:e,depthMask:!1});return{scene:null,geometry:new i,material:t,environmentMap:null,culling:!1}},function(){var e=this.scene;e&&this.attachScene(e),this.environmentMap&&this.setEnvironmentMap(this.environmentMap)},{attachScene:function(e){this.scene&&this.detachScene(),this.scene=e,e.on("beforerender",this._beforeRenderScene,this)},detachScene:function(){this.scene&&this.scene.off("beforerender",this._beforeRenderScene),this.scene=null},dispose:function(e){this.detachScene(),this.geometry.dispose(e),this.material.dispose(e)},setEnvironmentMap:function(e){this.material.set("environmentMap",e)},getEnvironmentMap:function(){return this.material.get("environmentMap")},_beforeRenderScene:function(e,t,r){this.renderSkybox(e,r)},renderSkybox:function(e,t){this.position.copy(t.getWorldPosition()),this.update(),e.gl.disable(e.gl.BLEND),e.renderQueue([this],t)}});e.exports=s},function(e,t,r){var n=r(25),i=r(75),a=r(7),o=r(16);a.import(r(212));var s=n.extend(function(){var e=new a({vertex:a.source("qtek.basic.vertex"),fragment:a.source("qtek.basic.fragment")});e.enableTexture("diffuseMap");var t=new o({shader:e,depthMask:!1});return{scene:null,geometry:new i({widthSegments:30,heightSegments:30}),material:t,environmentMap:null,culling:!1}},function(){var e=this.scene;e&&this.attachScene(e),this.environmentMap&&this.setEnvironmentMap(this.environmentMap)},{attachScene:function(e){this.scene&&this.detachScene(),this.scene=e,e.on("beforerender",this._beforeRenderScene,this)},detachScene:function(){this.scene&&this.scene.off("beforerender",this._beforeRenderScene),this.scene=null},_beforeRenderScene:function(e,t,r){this.position.copy(r.getWorldPosition()),this.update(),e.renderQueue([this],r)},setEnvironmentMap:function(e){this.material.set("diffuseMap",e)},getEnvironmentMap:function(){return this.material.get("diffuseMap")},dispose:function(e){this.detachScene(),this.geometry.dispose(e),this.material.dispose(e)}});e.exports=s},function(e,t,r){var n=r(8),i=r(3),a=r(44),o=r(10),s=["px","nx","py","ny","pz","nz"],u=n.extend(function(){var e={position:new i,far:1e3,near:.1,texture:null,shadowMapPass:null},t=e._cameras={px:new a({fov:90}),nx:new a({fov:90}),py:new a({fov:90}),ny:new a({fov:90}),pz:new a({fov:90}),nz:new a({fov:90})};return t.px.lookAt(i.POSITIVE_X,i.NEGATIVE_Y),t.nx.lookAt(i.NEGATIVE_X,i.NEGATIVE_Y),t.py.lookAt(i.POSITIVE_Y,i.POSITIVE_Z),t.ny.lookAt(i.NEGATIVE_Y,i.NEGATIVE_Z),t.pz.lookAt(i.POSITIVE_Z,i.NEGATIVE_Y),t.nz.lookAt(i.NEGATIVE_Z,i.NEGATIVE_Y),e._frameBuffer=new o,e},{getCamera:function(e){return this._cameras[e]},render:function(e,t,r){var n=e.gl;r||t.update();for(var a=this.texture.width,o=2*Math.atan(a/(a-.5))/Math.PI*180,u=0;u<6;u++){var h=s[u],l=this._cameras[h];if(i.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=o,this.shadowMapPass){l.update();var c=t.getBoundingBox(function(e){return!e.invisible});c.applyTransform(l.viewMatrix),t.viewBoundingBoxLastFrame.copy(c),this.shadowMapPass.render(e,t,l,!0)}this._frameBuffer.attach(this.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+u),this._frameBuffer.bind(e),e.render(t,l,!0),this._frameBuffer.unbind(e)}},dispose:function(e){this._frameBuffer.dispose(e)}});e.exports=u},function(e,t){var r=function(){this.head=null,this.tail=null,this._len=0},n=r.prototype;n.insert=function(e){var t=new i(e);return this.insertEntry(t),t},n.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},n.remove=function(e){var t=e.prev,r=e.next;t?t.next=r:this.head=r,r?r.prev=t:this.tail=t,e.next=e.prev=null,this._len--},n.len=function(){return this._len},n.clear=function(){this.head=this.tail=null,this._len=0};var i=function(e){this.value=e,this.next,this.prev},a=function(e){this._list=new r,this._map={},this._maxSize=e||10,this._lastRemovedEntry=null},o=a.prototype;o.put=function(e,t){var r=this._list,n=this._map,a=null;if(null==n[e]){var o=r.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var u=r.head;r.remove(u),delete n[u.key],a=u.value,this._lastRemovedEntry=u}s?s.value=t:s=new i(t),s.key=e,r.insertEntry(s),n[e]=s}return a},o.get=function(e){var t=this._map[e],r=this._list;if(null!=t)return t!==r.tail&&(r.remove(t),r.insertEntry(t)),t.value},o.clear=function(){this._list.clear(),this._map={}},e.exports=a},function(e,t,r){function n(e){this.rootNode=new a.Node,this._currentMap="",this._triangulationResults={},this._shadersMap=a.COMMON_SHADERS.reduce(function(e,t){return e[t]=a.createShader("ecgl."+t),e[t].define("fragment","DOUBLE_SIDED"),e},{}),this._linesShader=a.createShader("ecgl.meshLines3D");var t={};a.COMMON_SHADERS.forEach(function(e){t[e]=new a.Material({shader:a.createShader("ecgl."+e)})}),this._groundMaterials=t,this._groundMesh=new a.Mesh({geometry:new a.PlaneGeometry({dynamic:!0}),castShadow:!1,renderNormal:!0,$ignorePicking:!0}),this._groundMesh.rotation.rotateX(-Math.PI/2),this._labelsBuilder=new c(1024,1024,e),this._labelsBuilder.getMesh().renderOrder=100,this._labelsBuilder.getMesh().material.depthTest=!1,this._api=e}var i=r(0),a=r(2),o=r(172),s=r(22),u=r(4),h=r(1),l=r(50),c=r(49),d=h.vec3;a.Shader.import(r(41)),n.prototype={constructor:n,extrudeY:!0,update:function(e,t,r,n){var i=e.get("instancing");this._triangulation(t),(t.map!==this._currentMap||i&&!this._polygonMesh||!i&&!this._polygonMeshesMap)&&(this._currentMap=t.map,this._initMeshes(e,t),this.rootNode.add(this._labelsBuilder.getMesh()));var a=this._getShader(e.get("shading")),o=e.getData();i&&this._prepareInstancingMesh(e,t,a,n),this.rootNode.updateWorldTransform(),this._updateRegionMesh(e,t,a,n,i),this._updateGroundPlane(e,t,n),this._labelsBuilder.updateData(o),this._labelsBuilder.getLabelPosition=function(e,r,n){var i=o.getName(e),a=t.getRegion(i),s=a.center,u=n;return t.dataToPoint([s[0],s[1],u])},this._data=o,this._labelsBuilder.updateLabels(),this._updateDebugWireframe(e,t),this._lastHoverDataIndex=0},_prepareInstancingMesh:function(e,t,r,n){var i=0,a=0;t.regions.forEach(function(e){var t=this._getRegionPolygonGeoInfo(e);i+=t.vertexCount,a+=t.triangleCount},this);var o=this._polygonMesh,s=o.geometry;["position","normal","texcoord0","color"].forEach(function(e){s.attributes[e].init(i)}),s.indices=i>65535?new Uint32Array(3*a):new Uint16Array(3*a),o.material.shader!==r&&o.material.attachShader(r,!0),this._dataIndexOfVertex=new Uint32Array(i),this._vertexRangeOfDataIndex=new Uint32Array(2*t.regions.length)},_updateRegionMesh:function(e,t,r,n,i){var o=e.getData(),s=0,h=0;i&&a.setMaterialFromModel(r.__shading,this._polygonMesh.material,e,n);var l=!1,c={};if(o.each(function(e){c[o.getName(e)]=e}),t.regions.forEach(function(d){var f=c[d.name];null==f&&(f=-1);var p=i?this._polygonMesh:this._polygonMeshesMap[d.name],_=i?this._linesMesh:this._linesMeshesMap[d.name];p.material.shader!==r&&p.material.attachShader(r,!0);var m=e.getRegionModel(d.name),g=m.getModel("itemStyle"),v=g.get("areaColor"),y=u.firstNotNull(g.get("opacity"),1),x=o.getItemVisual(f,"color",!0);null!=x&&o.hasValue(f)&&(v=x),o.setItemVisual(f,"color",v),o.setItemVisual(f,"opacity",y),v=a.parseColor(v);var T=a.parseColor(g.get("borderColor"));v[3]*=y,T[3]*=y;var b=v[3]<.99;i?p.material.set("color",[1,1,1,1]):(a.setMaterialFromModel(r.__shading,p.material,m,n),p.material.set({color:v}),p.material.transparent=b,p.material.depthMask=!b),l=l||b;var w=u.firstNotNull(m.get("height",!0),e.get("regionHeight"));if(i){for(var E=this._updatePolygonGeometry(e,p.geometry,d,w,s,h,v),S=s;S0;i||(M&&(A*=n.getDevicePixelRatio(),this._updateLinesGeometry(_.geometry,d,w,A,t.transform)),_.invisible=!M,_.material.set({color:T})),i||(this._moveRegionToCenter(p,_,M),"geo3D"===e.type?p.eventData={name:d.name}:(p.dataIndex=f,p.seriesIndex=e.seriesIndex),p.on("mouseover",this._onmouseover,this),p.on("mouseout",this._onmouseout,this),p.material.get("normalMap")&&p.geometry.generateTangents())},this),i){var d=this._polygonMesh;d.material.transparent=l,d.material.depthMask=!l,d.geometry.updateBoundingBox(),d.material.get("normalMap")&&d.geometry.generateTangents(),d.seriesIndex=e.seriesIndex,d.on("mousemove",this._onmousemove,this),d.on("mouseout",this._onmouseout,this)}},_updateDebugWireframe:function(e,t){var r=e.getModel("debug.wireframe");if(r.get("show")){var n=a.parseColor(r.get("lineStyle.color")||"rgba(0,0,0,0.5)"),i=u.firstNotNull(r.get("lineStyle.width"),1),o=function(e){e.geometry.generateBarycentric(),e.material.shader.define("both","WIREFRAME_TRIANGLE"),e.material.set("wireframeLineColor",n),e.material.set("wireframeLineWidth",i)};this._polygonMeshesMap?t.regions.forEach(function(e){o(this._polygonMeshesMap[e.name])},this):o(this._polygonMesh)}},_onmousemove:function(e){var t=this._dataIndexOfVertex[e.triangle[0]];null==t&&(t=-1),t!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(t)),this._lastHoverDataIndex=t,this._polygonMesh.dataIndex=t},_onmouseover:function(e){if(e.target){var t=e.target.eventData?this._data.indexOfName(e.target.eventData.name):e.target.dataIndex;null!=t&&(this.highlight(t),this._labelsBuilder.updateLabels([t]))}},_onmouseout:function(e){if(e.target)if(this._polygonMesh)this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1;else{var t=e.target.eventData?this._data.indexOfName(e.target.eventData.name):e.target.dataIndex;null!=t&&(this.downplay(t),e.relatedTarget||this._labelsBuilder.updateLabels())}},_updateGroundPlane:function(e,t,r){var n=e.getModel("groundPlane",e);if(this._groundMesh.invisible=!n.get("show",!0),!this._groundMesh.invisible){var i=e.get("shading"),o=this._groundMaterials[i];o||(o=this._groundMaterials.lambert),a.setMaterialFromModel(i,o,n,r),o.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=o,this._groundMesh.material.set("color",a.parseColor(n.get("color"))),this._groundMesh.scale.set(t.size[0],t.size[2],1)}},_initMeshes:function(e,t){function r(){var e=new a.Mesh({material:new a.Material({shader:o}),culling:!1,geometry:new a.Geometry({sortTriangles:!0,dynamic:!0}),renderNormal:!0});return i.util.extend(e.geometry,l),e}function n(e){return new a.Mesh({material:new a.Material({shader:e}),castShadow:!1,$ignorePicking:!0,geometry:new s({useNativeLine:!1})})}this.rootNode.removeAll();var o=this._getShader(e.get("shading"));if(e.get("instancing")){var u=r(),h=n(this._linesShader);this.rootNode.add(u),this.rootNode.add(h),u.material.shader.define("both","VERTEX_COLOR"),this._polygonMesh=u,this._linesMesh=h,this._polygonMeshesMap=null,this._linesMeshesMap=null}else{var c={},d={};t.regions.forEach(function(e){c[e.name]=r(),d[e.name]=n(this._linesShader),this.rootNode.add(c[e.name]),this.rootNode.add(d[e.name])},this),this._polygonMeshesMap=c,this._linesMeshesMap=d}this.rootNode.add(this._groundMesh)},_getShader:function(e){var t=this._shadersMap[e];return t||(t=this._shadersMap.lambert),t.__shading=e,t},_triangulation:function(e){this._triangulationResults={};var t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];e.regions.forEach(function(n){for(var i=[],a=0;a65535?new Uint32Array(3*T.triangleCount):new Uint16Array(3*T.triangleCount)}for(var b=[this.rootNode.worldTransform.x.len(),this.rootNode.worldTransform.y.len(),this.rootNode.worldTransform.z.len()],w=d.mul([],this._geoBoundingBox[0],b),E=d.mul([],this._geoBoundingBox[1],b),S=Math.max(E[0]-w[0],E[2]-w[2]),A=this.extrudeY?[0,1,0]:[0,0,1],M=d.negate([],A),N=0;N<_.length;N++){var C=i,L=_[N];u(L,0,0),u(L,n,0);for(var D=L.points.length/3,I=0;I1?n:0,P[W][x]=L.points[X+2],l.set(i+W,P[W]),h?(U[0]=(L.points[X]*b[0]-w[0])/S,U[1]=(L.points[X+2]*b[x]-w[x])/S):(U[0]=(q?z:z+V)/S,U[1]=(P[W][y]*b[y]-w[y])/S),f.set(i+W,U)}d.sub(O,P[1],P[0]),d.sub(F,P[3],P[0]),d.cross(B,O,F),d.normalize(B,B);for(var W=0;W<4;W++)c.set(i+W,B),m&&p.set(i+W,o);for(var W=0;W<6;W++)g[3*a+W]=R[W]+i;i+=4,a+=2,z+=V}}return v||t.updateBoundingBox(),t.dirty(),{vertexOffset:i,triangleOffset:a}},_getRegionLinesGeoInfo:function(e,t){var r=0,n=0;return e.geometries.forEach(function(e){var i=e.exterior,a=e.interiors;r+=t.getPolylineVertexCount(i),n+=t.getPolylineTriangleCount(i);for(var o=0;ol&&h.push({pivot:Math.floor((c+l)/2),left:l,right:c});var l=s[u].pivot+1,c=s[u].right;c>l&&h.push({pivot:Math.floor((c+l)/2),left:l,right:c})}s=this._parts=h}else for(var u=0;uo&&(i=this._x=0,a+=this._rowHeight+u,this._y=a,this._rowHeight=0),this._x+=t+u,this._rowHeight=Math.max(this._rowHeight,r),a+r+u>s)return null;e.position[0]+=this.offsetX*this.dpr+i,e.position[1]+=this.offsetY*this.dpr+a,this._zr.add(e);var h=[this.offsetX/this.width,this.offsetY/this.height];return[[i/o+h[0],a/s+h[1]],[(i+t)/o+h[0],(a+r)/s+h[1]]]},_fitElement:function(e,t,r){var n=e.getBoundingRect(),i=t/n.width,a=r/n.height;e.position=[-n.x*i,-n.y*a],e.scale=[i,a],e.update()}},i.prototype={clear:function(){for(var e=0;e=e)){var o=(i+this._nodeWidth)*this._dpr,s=(a+this._nodeHeight)*this._dpr;try{this._zr.resize({width:o,height:s})}catch(e){this._canvas.width=o,this._canvas.height=s}var u=new n(this._zr,i,a,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(u),u}},add:function(e,t,r){if(this._coords[e.id])return this._coords[e.id];var n=this._getCurrentNode().add(e,t,r);if(!n){var i=this._expand();if(!i)return;n=i.add(e,t,r)}return this._coords[e.id]=n,n},getCoordsScale:function(){var e=this._dpr;return[this._nodeWidth/this._canvas.width*e,this._nodeHeight/this._canvas.height*e]},getCoords:function(e){return this._coords[e]}},e.exports=i},function(e,t,r){function n(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function i(e){return Math.floor(Math.log(e)/Math.LN10)}var a=r(15),o={};o.linearMap=function(e,t,r,n){var i=t[1]-t[0],a=r[1]-r[0];if(0===i)return 0===a?r[0]:(r[0]+r[1])/2;if(n)if(i>0){if(e<=t[0])return r[0];if(e>=t[1])return r[1]}else{if(e>=t[0])return r[0];if(e<=t[1])return r[1]}else{if(e===t[0])return r[0];if(e===t[1])return r[1]}return(e-t[0])/i*a+r[0]},o.parsePercent=function(e,t){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%"}return"string"==typeof e?n(e).match(/%$/)?parseFloat(e)/100*t:parseFloat(e):null==e?NaN:+e},o.round=function(e,t,r){return null==t&&(t=10),t=Math.min(Math.max(0,t),20),e=(+e).toFixed(t),r?e:+e},o.asc=function(e){return e.sort(function(e,t){return e-t}),e},o.getPrecision=function(e){if(e=+e,isNaN(e))return 0;for(var t=1,r=0;Math.round(e*t)/t!==e;)t*=10,r++;return r},o.getPrecisionSafe=function(e){var t=e.toString(),r=t.indexOf("e");if(r>0){var n=+t.slice(r+1);return n<0?-n:0}var i=t.indexOf(".");return i<0?0:t.length-1-i},o.getPixelPrecision=function(e,t){var r=Math.log,n=Math.LN10,i=Math.floor(r(e[1]-e[0])/n),a=Math.round(r(Math.abs(t[1]-t[0]))/n),o=Math.min(Math.max(-i+a,0),20);return isFinite(o)?o:20},o.getPercentWithPrecision=function(e,t,r){if(!e[t])return 0;var n=a.reduce(e,function(e,t){return e+(isNaN(t)?0:t)},0);if(0===n)return 0;for(var i=Math.pow(10,r),o=a.map(e,function(e){return(isNaN(e)?0:e)/n*i*100}),s=100*i,u=a.map(o,function(e){return Math.floor(e)}),h=a.reduce(u,function(e,t){return e+t},0),l=a.map(o,function(e,t){return e-u[t]});hc&&(c=l[f],d=f);++u[d],l[d]=0,++h}return u[t]/i},o.MAX_SAFE_INTEGER=9007199254740991,o.remRadian=function(e){var t=2*Math.PI;return(e%t+t)%t},o.isRadianAroundZero=function(e){return e>-1e-4&&e<1e-4};var s=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;o.getTimezoneOffset=function(){return(new Date).getTimezoneOffset()},o.parseDate=function(e){if(e instanceof Date)return e;if("string"==typeof e){var t=s.exec(e);if(!t)return new Date(NaN);var r=o.getTimezoneOffset(),n=t[8]?"Z"===t[8].toUpperCase()?r:60*+t[8].slice(0,3)+r:0;return new Date(+t[1],+(t[2]||1)-1,+t[3]||1,+t[4]||0,+(t[5]||0)-n,+t[6]||0,+t[7]||0)}return null==e?new Date(NaN):new Date(Math.round(e))},o.quantity=function(e){return Math.pow(10,i(e))},o.nice=function(e,t){var r,n=i(e),a=Math.pow(10,n),o=e/a;return r=t?o<1.5?1:o<2.5?2:o<4?3:o<7?5:10:o<1?1:o<2?2:o<3?3:o<5?5:10,e=r*a,n>=-20?+e.toFixed(n<0?-n:0):e},o.reformIntervals=function(e){function t(e,r,n){return e.interval[n]=0},e.exports=o},function(e,t,r){"use strict";var n=r(35),i=r(9),a=r(54),o=r(56),s=r(1),u=s.vec3,h=s.vec4,l=n.extend(function(){return{projectionMatrix:new i,invProjectionMatrix:new i,viewMatrix:new i,frustum:new a}},function(){this.update(!0)},{update:function(e){n.prototype.update.call(this,e),i.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),i.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(e){i.copy(this.viewMatrix,e),i.invert(this.worldTransform,e),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(e){i.copy(this.projectionMatrix,e),i.invert(this.invProjectionMatrix,e),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:function(){var e=h.create();return function(t,r){var n=void 0!==r?r:new o,i=t._array[0],a=t._array[1];return h.set(e,i,a,-1,1),h.transformMat4(e,e,this.invProjectionMatrix._array),h.transformMat4(e,e,this.worldTransform._array),u.scale(n.origin._array,e,1/e[3]),h.set(e,i,a,1,1),h.transformMat4(e,e,this.invProjectionMatrix._array),h.transformMat4(e,e,this.worldTransform._array),u.scale(e,e,1/e[3]),u.sub(n.direction._array,e,n.origin._array),u.normalize(n.direction._array,n.direction._array),n.direction._dirty=!0,n.origin._dirty=!0,n}}()});e.exports=l},function(e,t,r){"use strict";function n(e,t,r){this.availableAttributes=e,this.availableAttributeSymbols=t,this.indicesBuffer=r,this.vao=null}var i,a=r(35),o=r(11),s=r(17),u=0,h=null,l=!0,c=function(){this.triangleCount=0,this.vertexCount=0,this.drawCallCount=0},d=a.extend({material:null,geometry:null,mode:o.TRIANGLES,_drawCache:null,_renderInfo:null},function(){this._drawCache={},this._renderInfo=new c},{renderOrder:0,lineWidth:1,culling:!0,cullFace:o.BACK,frontFace:o.CCW,frustumCulling:!0,receiveShadow:!0,castShadow:!0,ignorePicking:!1,ignorePreZ:!1,isRenderable:function(){return this.geometry&&this.material&&!this.invisible&&this.geometry.vertexCount>0},beforeRender:function(e){},afterRender:function(e,t){},getBoundingBox:function(e,t){return t=a.prototype.getBoundingBox.call(this,e,t),this.geometry&&this.geometry.boundingBox&&t.union(this.geometry.boundingBox),t},render:function(e,t){var t=t||this.material.shader,r=this.geometry,a=this.mode,c=r.vertexCount,d=r.isUseIndices(),f=s.getExtension(e,"OES_element_index_uint"),p=f&&c>65535,_=p?e.UNSIGNED_INT:e.UNSIGNED_SHORT,m=s.getExtension(e,"OES_vertex_array_object"),g=!r.dynamic,v=this._renderInfo;v.vertexCount=c,v.triangleCount=0,v.drawCallCount=0;var y=!1;if(i=e.__GLID__+"-"+r.__GUID__+"-"+t.__GUID__,i!==u?y=!0:(c>65535&&!f&&d||m&&g||r._cache.isDirty())&&(y=!0),u=i,y){var x=this._drawCache[i];if(!x){var T=r.getBufferChunks(e);if(!T)return;x=[];for(var b=0;b65535?Uint32Array:Uint16Array,_=this.indices=new p(t*e*6),m=this.radius,g=this.phiStart,v=this.phiLength,y=this.thetaStart,x=this.thetaLength,m=this.radius,T=[],b=[],w=0,E=1/m;for(f=0;f<=e;f++)for(d=0;d<=t;d++)l=d/t,c=f/e,s=-m*Math.cos(g+l*v)*Math.sin(y+c*x),u=m*Math.cos(y+c*x),h=m*Math.sin(g+l*v)*Math.sin(y+c*x),T[0]=s,T[1]=u,T[2]=h,b[0]=l,b[1]=c,r.set(w,T),n.set(w,b),T[0]*=E,T[1]*=E,T[2]*=E,i.set(w,T),w++;var S,A,M,N,C=t+1,L=0;for(f=0;fthis.distance,i=1;i<8;i++)if(a.dot(t[i]._array,r)>this.distance!=n)return!0},intersectLine:function(){var e=a.create();return function(t,r,i){var o=this.distanceToPoint(t),s=this.distanceToPoint(r);if(o>0&&s>0||o<0&&s<0)return null;var u=this.normal._array,h=this.distance,l=t._array;a.sub(e,r._array,t._array),a.normalize(e,e);var c=a.dot(u,e);if(0===c)return null;i||(i=new n);var d=(a.dot(u,l)-h)/c;return a.scaleAndAdd(i._array,l,e,-d),i._dirty=!0,i}}(),applyTransform:function(){var e=o.create(),t=s.create(),r=s.create();return r[3]=1,function(n){n=n._array,a.scale(r,this.normal._array,this.distance),s.transformMat4(r,r,n),this.distance=a.dot(r,this.normal._array),o.invert(e,n),o.transpose(e,e),t[3]=0,a.copy(t,this.normal._array),s.transformMat4(t,t,e),a.copy(this.normal._array,t)}}(),copy:function(e){a.copy(this.normal._array,e.normal._array),this.normal._dirty=!0,this.distance=e.distance},clone:function(){var e=new u;return e.copy(this),e}},e.exports=u},function(e,t){var r={};r.isPowerOfTwo=function(e){return 0==(e&e-1)},r.nextPowerOfTwo=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},r.nearestPowerOfTwo=function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},e.exports=r},function(e,t,r){function n(){this._pool={}}function i(e,t,r){o[e]={vertex:t,fragment:r}}var a=r(7),o=(r(27),{});n.prototype.get=function(e,t){var r=[],n={},i={};"string"==typeof t?r=Array.prototype.slice.call(arguments,1):"[object Object]"==Object.prototype.toString.call(t)?(r=t.textures||[],n=t.vertexDefines||{},i=t.fragmentDefines||{}):t instanceof Array&&(r=t);var s=Object.keys(n),u=Object.keys(i);r.sort(),s.sort(),u.sort();var h=[e];h=h.concat(r);for(var l=0;l=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height},clone:function(){return new n(this.x,this.y,this.width,this.height)},copy:function(e){this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},n.create=function(e){return new n(e.x,e.y,e.width,e.height)},e.exports=n},function(e,t,r){var n=r(0);r(102),r(101),r(100),n.registerVisual(n.util.curry(r(18),"bar3D")),n.registerProcessor(function(e,t){e.eachSeriesByType("bar3d",function(e){var t=e.getData();t.filterSelf(function(e){return t.hasValue(e)})})})},function(e,t,r){r(0);r(108),r(107)},function(e,t,r){function n(){}var i=r(0);r(113),r(114),i.registerVisual(i.util.curry(r(43),"graphGL","circle",null)),i.registerVisual(i.util.curry(r(18),"graphGL")),i.registerVisual(function(e){var t={};e.eachSeriesByType("graphGL",function(e){var r=e.getCategoriesData(),n=e.getData(),i={};r.each(function(n){var a=r.getName(n);i[a]=n;var o=r.getItemModel(n),s=o.get("itemStyle.color")||e.getColorFromPalette(a,t);r.setItemVisual(n,"color",s)}),r.count()&&n.each(function(e){var t=n.getItemModel(e),a=t.getShallow("category");null!=a&&("string"==typeof a&&(a=i[a]),n.getItemVisual(e,"color",!0)||n.setItemVisual(e,"color",r.getItemVisual(a,"color")))})})}),i.registerVisual(function(e){e.eachSeriesByType("graphGL",function(e){var t=e.getGraph(),r=e.getEdgeData(),n="lineStyle.color".split("."),i="lineStyle.opacity".split(".");r.setVisual("color",e.get(n)),r.setVisual("opacity",e.get(i)),r.each(function(e){var a=r.getItemModel(e),o=t.getEdgeByIndex(e),s=a.get(n),u=a.get(i);switch(s){case"source":s=o.node1.getVisual("color");break;case"target":s=o.node2.getVisual("color")}o.setVisual("color",s),o.setVisual("opacity",u)})})}),i.registerAction({type:"graphGLRoam",event:"graphglroam",update:"series.graphGL:roam"},function(e,t){t.eachComponent({mainType:"series",query:e},function(t){t.setView(e)})}),i.registerAction({type:"graphGLStartLayout",event:"graphgllayoutstarted",update:"series.graphGL:startLayout"},n),i.registerAction({type:"graphGLStopLayout",event:"graphgllayoutstopped",update:"series.graphGL:stopLayout"},n),i.registerAction({type:"graphGLFocusNodeAdjacency",event:"graphGLFocusNodeAdjacency",update:"series.graphGL:focusNodeAdjacency"},n),i.registerAction({type:"graphGLUnfocusNodeAdjacency",event:"graphGLUnfocusNodeAdjacency",update:"series.graphGL:unfocusNodeAdjacency"},n)},function(e,t,r){var n=r(0);r(118),r(119),n.registerVisual(n.util.curry(r(43),"line3D","circle",null)),n.registerVisual(n.util.curry(r(18),"line3D")),n.registerLayout(function(e,t){e.eachSeriesByType("line3D",function(e){var t=e.getData(),r=e.coordinateSystem;if(r){if("cartesian3D"!==r.type)return;var n=new Float32Array(3*t.count()),i=[],a=[],o=r.dimensions,s=o.map(function(t){return e.coordDimToDataDim(t)[0]});r&&t.each(s,function(e,t,o,s){i[0]=e,i[1]=t,i[2]=o,r.dataToPoint(i,a),n[3*s]=a[0],n[3*s+1]=a[1],n[3*s+2]=a[2]}),t.setLayout("points",n)}})})},function(e,t,r){var n=r(0);r(123),r(121),r(120),n.registerVisual(n.util.curry(r(18),"lines3D")),n.registerAction({type:"lines3DPauseEffect",event:"lines3deffectpaused",update:"series.lines3D:pauseEffect"},function(){}),n.registerAction({type:"lines3DResumeEffect",event:"lines3deffectresumed",update:"series.lines3D:resumeEffect"},function(){}),n.registerAction({type:"lines3DToggleEffect",event:"lines3deffectchanged",update:"series.lines3D:toggleEffect"},function(){})},function(e,t,r){function n(e,t){for(var r=[],n=0;ne&&o0&&(f++,l[3]<.99&&(p=!0))}}),s.geometry.setBarCount(f);var _=r.getLayout("orient"),m=this._barIndexOfData=new Int32Array(r.count()),f=0;r.each(function(e){if(!r.hasValue(e))return void(m[e]=-1);var t=r.getItemLayout(e),n=t[0],i=t[1],a=t[2],s=4*e;l[0]=c[s++],l[1]=c[s++],l[2]=c[s++],l[3]=c[s++],l[3]>0&&(o._barMesh.geometry.addBar(n,i,_,a,l,e),m[e]=f++)}),s.geometry.dirty(),s.geometry.updateBoundingBox();var g=s.material;g.transparent=p,g.depthMask=!p,s.geometry.sortTriangles=p,this._initHandler(e,t)},_initHandler:function(e,t){var r=e.getData(),n=this._barMesh,i="cartesian3D"===e.coordinateSystem.type;n.seriesIndex=e.seriesIndex;var a=-1;n.off("mousemove"),n.off("mouseout"),n.on("mousemove",function(e){var o=n.geometry.getDataIndexOfVertex(e.triangle[0]);o!==a&&(this._downplay(a),this._highlight(o),this._labelsBuilder.updateLabels([o]),i&&t.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get("x",o),r.get("y",o),r.get("z",o,!0)]})),a=o,n.dataIndex=o},this),n.on("mouseout",function(e){this._downplay(a),this._labelsBuilder.updateLabels(),a=-1,n.dataIndex=-1,i&&t.dispatchAction({type:"grid3DHideAxisPointer"})},this)},_highlight:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var n=t.getItemModel(e),o=n.getModel("emphasis.itemStyle"),s=o.get("color"),u=o.get("opacity");if(null==s){var h=t.getItemVisual(e,"color");s=i.color.lift(h,-.4)}null==u&&(u=t.getItemVisual(e,"opacity"));var l=a.parseColor(s);l[3]*=u,this._barMesh.geometry.setColor(r,l),this._api.getZr().refresh()}}},_downplay:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var n=t.getItemVisual(e,"color"),i=t.getItemVisual(e,"opacity"),o=a.parseColor(n);o[3]*=i,this._barMesh.geometry.setColor(r,o),this._api.getZr().refresh()}}},highlight:function(e,t,r,n){this._toggleStatus("highlight",e,t,r,n)},downplay:function(e,t,r,n){this._toggleStatus("downplay",e,t,r,n)},_toggleStatus:function(e,t,r,n,a){var u=t.getData(),h=o.queryDataIndex(u,a),l=this;null!=h?i.util.each(s.normalizeToArray(h),function(t){"highlight"===e?this._highlight(t):this._downplay(t)},this):u.each(function(t){"highlight"===e?l._highlight(t):l._downplay(t)})},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}})},function(e,t,r){function n(e,t){var r=e.getData(),n=e.get("minHeight")||0,i=e.get("barSize"),a=["lng","lat","alt"].map(function(t){return e.coordDimToDataDim(t)[0]});if(null==i){var h=t.radius*Math.PI,c=l(r,a[0],a[1]);i=[h/Math.sqrt(r.count()/c),h/Math.sqrt(r.count()/c)]}else o.util.isArray(i)||(i=[i,i]);r.each(a,function(e,o,s,h){var l=r.get(a[2],h,!0),c=r.stackedOn?l-s:t.altitudeAxis.scale.getExtent()[0],d=Math.max(t.altitudeAxis.dataToCoord(s),n),f=t.dataToPoint([e,o,c]),p=t.dataToPoint([e,o,l]),_=u.sub([],p,f);u.normalize(_,_);var m=[i[0],d,i[1]];r.setItemLayout(h,[f,_,m])}),r.setLayout("orient",s.UP._array)}function i(e,t){var r=e.getData(),n=e.get("barSize"),i=e.get("minHeight")||0,a=["lng","lat","alt"].map(function(t){return e.coordDimToDataDim(t)[0]});if(null==n){var s=Math.min(t.size[0],t.size[2]),u=l(r,a[0],a[1]);n=[s/Math.sqrt(r.count()/u),s/Math.sqrt(r.count()/u)]}else o.util.isArray(n)||(n=[n,n]);var h=[0,1,0];r.each(a,function(e,o,s,u){var l=r.get(a[2],u,!0),c=r.stackedOn?l-s:t.altitudeAxis.scale.getExtent()[0],d=Math.max(t.altitudeAxis.dataToCoord(s),i),f=t.dataToPoint([e,o,c]),p=[n[0],d,n[1]];r.setItemLayout(u,[f,h,p])}),r.setLayout("orient",[1,0,0])}function a(e,t){var r=e.getData(),n=e.coordDimToDataDim("lng")[0],i=e.coordDimToDataDim("lat")[0],a=e.coordDimToDataDim("alt")[0],s=e.get("barSize"),u=e.get("minHeight")||0;if(null==s){var h=r.getDataExtent(n),c=r.getDataExtent(i),d=t.dataToPoint([h[0],c[0]]),f=t.dataToPoint([h[1],c[1]]),p=Math.min(Math.abs(d[0]-f[0]),Math.abs(d[1]-f[1]))||1,_=l(r,n,i);s=[p/Math.sqrt(r.count()/_),p/Math.sqrt(r.count()/_)]}else o.util.isArray(s)||(s=[s,s]),s[0]/=t.getScale()/16,s[1]/=t.getScale()/16;var m=[0,0,1];r.each([n,i,a],function(e,n,i,o){var h=r.get(a,o,!0),l=r.stackedOn?h-i:0,c=t.dataToPoint([e,n,l]),d=t.dataToPoint([e,n,h]),f=Math.max(d[2]-c[2],u),p=[s[0],f,s[1]];r.setItemLayout(o,[c,m,p])}),r.setLayout("orient",[1,0,0])}var o=r(0),s=r(3),u=r(1).vec3,h=r(103),l=r(104);o.registerLayout(function(e,t){e.eachSeriesByType("bar3D",function(e){var t=e.coordinateSystem,r=t&&t.type;"globe"===r?n(e,t):"cartesian3D"===r?h(e,t):"geo3D"===r?i(e,t):"mapbox"===r&&a(e,t)})})},function(e,t,r){function n(e){var t=e[0],r=e[1];return!(t>0&&r>0||t<0&&r<0)}function i(e,t){var r=e.getData(),i=e.get("barSize");if(null==i){var s,u,h=t.size,l=t.getAxis("x"),c=t.getAxis("y");s="category"===l.type?.7*l.getBandWidth():.6*Math.round(h[0]/Math.sqrt(r.count())),u="category"===c.type?.7*c.getBandWidth():.6*Math.round(h[1]/Math.sqrt(r.count())),i=[s,u]}else a.util.isArray(i)||(i=[i,i]);var d=t.getAxis("z").scale.getExtent(),f=n(d),p=["x","y","z"].map(function(t){return e.coordDimToDataDim(t)[0]});r.each(p,function(e,n,a,s){var u=r.get(p[2],s,!0),h=r.stackedOn?u-a:f?0:d[0],l=t.dataToPoint([e,n,h]),c=t.dataToPoint([e,n,u]),_=o.dist(l,c),m=[0,c[1]=0;c--){var d;d=this.geometry.indices?this.geometry.indices[c]:c;var f=s[2*d],p=s[2*d+1],_=this.geometry.attributes.size.get(d)/this.sizeScale,m=_/2;if(e>f-m*h&&ep-m*l&&t 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end"},function(e,t,r){var n=r(0);n.extendSeriesModel({type:"series.flowGL",dependencies:["geo","grid","bmap"],visualColorAccessPath:"itemStyle.color",getInitialData:function(e,t){var r=n.getCoordinateSystemDimensions(this.get("coordinateSystem"))||["x","y"];r.push("vx","vy");var i=n.helper.completeDimensions(r,e.data,{encodeDef:this.get("encode"),dimsDef:this.get("dimensions")}),a=new n.List(i,this);return a.initData(e.data),a},defaultOption:{coordinateSystem:"cartesian2d",zlevel:10,particleDensity:128,particleSize:1,particleSpeed:1,particleTrail:2,colorTexture:null,gridWidth:"auto",gridHeight:"auto",itemStyle:{color:"#fff",opacity:.8}}})},function(e,t,r){var n=r(0),i=r(2),a=r(4),o=r(21),s=r(109);n.extendChartView({type:"flowGL",__ecgl__:!0,init:function(e,t){this.viewGL=new o("orthographic"),this.groupGL=new i.Node,this.viewGL.add(this.groupGL),this._particleSurface=new s;var r=new i.Mesh({geometry:new i.PlaneGeometry,material:new i.Material({shader:new i.Shader({vertex:i.Shader.source("ecgl.color.vertex"),fragment:i.Shader.source("ecgl.color.fragment")}),transparent:!0})});r.material.shader.enableTexture("diffuseMap"),this.groupGL.add(r),this._planeMesh=r},render:function(e,t,r){var n=this._particleSurface;this._updateData(e,r),this._updateCamera(r.getWidth(),r.getHeight(),r.getDevicePixelRatio());var o=a.firstNotNull(e.get("particleDensity"),128);n.setParticleDensity(o,o);var s=this._planeMesh,u=+new Date,h=this;s.__percent=0,s.stopAnimation(),s.animate("",{loop:!0}).when(1e5,{__percent:1}).during(function(){var e=+new Date,t=e-u;u=e,h._renderer&&(n.update(h._renderer,t/1e3),s.material.set("diffuseMap",n.getSurfaceTexture()))}).start();var l=e.getModel("itemStyle"),c=i.parseColor(l.get("color"));c[3]*=a.firstNotNull(l.get("opacity"),1),s.material.set("color",c),this._particleSurface.setColorTextureImage(e.get("colorTexture"),r),this._particleSurface.particleSize=e.get("particleSize"),this._particleSurface.particleSpeedScaling=e.get("particleSpeed"),this._particleSurface.motionBlurFactor=1-Math.pow(.1,e.get("particleTrail"))},updateLayout:function(e,t,r){this._updateData(e,r)},afterRender:function(e,t,r,n){var i=n.renderer;this._renderer=i},_updateData:function(e,t){var r=e.coordinateSystem,n=r.dimensions.map(function(t){return e.coordDimToDataDim(t)[0]}),i=e.getData(),a=i.getDataExtent(n[0]),o=i.getDataExtent(n[1]),s=e.get("gridWidth"),u=e.get("gridHeight");if(null==s||"auto"===s){var h=(a[1]-a[0])/(o[1]-o[0]);s=Math.round(Math.sqrt(h*i.count()))}null!=u&&"auto"!==u||(u=Math.ceil(i.count()/s));var l=this._particleSurface.vectorFieldTexture,c=l.pixels;if(c&&c.length===u*s*4)for(var d=0;d 0.0) {\n vec4 vTex = texture2D(velocityTexture, p.xy * region.zw + region.xy);\n vec2 v = vTex.xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.xy = fract(p.xy);\n p.w -= deltaTime;\n }\n else {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.z = 0.0;\n }\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n"},function(e,t,r){var n=r(5),i=r(6),a=r(117),o=a.toString();o=o.slice(o.indexOf("{")+1,o.lastIndexOf("}"));var s={barnesHutOptimize:!0,barnesHutTheta:1.5,repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null},u=function(e){for(var t in s)this[t]=s[t];if(e)for(var t in e)this[t]=e[t];this._nodes=[],this._edges=[],this._disposed=!1,this._positionTex=new n({type:i.FLOAT,flipY:!1,minFilter:i.NEAREST,magFilter:i.NEAREST})};u.prototype.initData=function(e,t){var r=new Blob([o]),n=window.URL.createObjectURL(r);this._worker=new Worker(n),this._worker.onmessage=this._$onupdate.bind(this),this._nodes=e,this._edges=t,this._frame=0;for(var i=e.length,a=t.length,s=new Float32Array(2*i),u=new Float32Array(i),h=new Float32Array(i),l=new Float32Array(2*a),c=new Float32Array(a),d=0;d5e4?10:a>5e3?1:.1,t.scaling=a>100?2:10,t.barnesHutOptimize=a>1e3,e)for(var r in s)null!=e[r]&&(t[r]=e[r]);if(!t.gravityCenter){for(var o=[1/0,1/0],u=[-1/0,-1/0],h=0;h10},u.prototype.getNodePosition=function(e,t){if(t||(t=new Float32Array(2*this._nodes.length)),this._positionArr)for(var r=0;r5e4?10:r>5e3?1:.1,this.scaling=r>100?2:10,e)for(var t in u)null!=e[t]&&(this[t]=e[t]);if(this.repulsionByDegree)for(var n=this._positionSourceTex.pixels,i=0;i10},n.prototype._swapTexture=function(){var e=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=e;var e=this._forcePrevTex;this._forcePrevTex=this._forceTex,this._forceTex=e;var e=this._globalSpeedPrevTex;this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=e},n.prototype._initFromSource=function(e){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(e),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(e),e.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(e)},n.prototype._resize=function(e,t){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach(function(r){this[r].width=e,this[r].height=t,this[r].dirty()},this)},n.prototype.dispose=function(e){var t=e.gl;this._framebuffer.dispose(t),this._copyPass.dispose(t),this._nodeRepulsionPass.dispose(t),this._positionPass.disable(t),this._globalSpeedPass.dispose(t),this._edgeForceMesh.material.shader.dispose(t),this._edgeForceMesh.geometry.dispose(t),this._weightedSumMesh.material.shader.dispose(t),this._weightedSumMesh.geometry.dispose(t),this._positionSourceTex.dispose(t),this._positionTex.dispose(t),this._positionPrevTex.dispose(t),this._forceTex.dispose(t),this._forcePrevTex.dispose(t),this._weightedSumTex.dispose(t),this._globalSpeedTex.disable(t),this._globalSpeedPrevTex.disable(t)},i.ForceAtlas2GPU=n,e.exports=n},function(e,t,r){var n=r(0),i=r(115),a=r(24),o=n.extendSeriesModel({type:"series.graphGL",visualColorAccessPath:"itemStyle.color",init:function(e){o.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this._updateCategoriesData()},mergeOption:function(e){o.superApply(this,"mergeOption",arguments),this._updateCategoriesData()},getFormattedLabel:function(e,t,r,n){var i=a.getFormattedLabel(this,e,t,r,n);if(null==i){var o=this.getData(),s=o.dimensions[o.dimensions.length-1];i=o.get(s,e)}return i},getInitialData:function(e,t){function r(e,r){function i(e){return e=this.parsePath(e),e&&"label"===e[0]?o:this.parentModel}e.wrapMethod("getItemModel",function(e){var t=s._categoriesModels,r=e.getShallow("category"),n=t[r];return n&&(n.parentModel=e.parentModel,e.parentModel=n),e});var a=s.getModel("edgeLabel"),o=new n.Model({label:a.option},a.parentModel,t);r.wrapMethod("getItemModel",function(e){return e.customizeGetParent(i),e})}var a=e.edges||e.links||[],o=e.data||e.nodes||[],s=this;if(o&&a)return i(o,a,this,!0,r).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(e,t,r){if("edge"===r){var i=this.getData(),a=this.getDataParams(e,r),s=i.graph.getEdgeByIndex(e),u=i.getName(s.node1.dataIndex),h=i.getName(s.node2.dataIndex),l=[];return null!=u&&l.push(u),null!=h&&l.push(h),l=n.format.encodeHTML(l.join(" > ")),a.value&&(l+=" : "+n.format.encodeHTML(a.value)),l}return o.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var e=(this.option.categories||[]).map(function(e){return null!=e.value?e:n.util.extend({value:0},e)}),t=new n.List(["value"],this);t.initData(e),this._categoriesData=t,this._categoriesModels=t.mapArray(function(e){return t.getItemModel(e,!0)})},setView:function(e){null!=e.zoom&&(this.option.zoom=e.zoom),null!=e.offset&&(this.option.offset=e.offset)},setNodePosition:function(e){for(var t=0;t=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(e){if(!this._layouting){var t=this._pointsBuilder.getPointsMesh().dataIndex;t>=0?t!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._mouseOutHandler(e),this._lastMouseOverDataIndex=t}},_mouseOutHandler:function(e){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(e,t){var r=this._forceEdgesMesh.geometry,n=t.getEdgeData(),i=0,o=this._forceLayoutInstance,s=2*n.count();r.attributes.node.init(s),r.attributes.color.init(s),n.each(function(t){var s=e[t];r.attributes.node.set(i,o.getNodeUV(s.node1)),r.attributes.node.set(i+1,o.getNodeUV(s.node2));var h=n.getItemVisual(s.dataIndex,"color"),l=a.parseColor(h);l[3]*=u.firstNotNull(n.getItemVisual(s.dataIndex,"opacity"),1),r.attributes.color.set(i,l),r.attributes.color.set(i+1,l),i+=2}),r.dirty()},_updateMeshLinesGeometry:function(){var e=this._model.getEdgeData(),t=this._edgesMesh.geometry,e=this._model.getEdgeData(),r=this._model.getData().getLayout("points");t.resetOffset(),t.setVertexCount(e.count()*t.getLineVertexCount()),t.setTriangleCount(e.count()*t.getLineTriangleCount());var n=[],i=[],o=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*e.count()),this._edgeIndicesMap=new Float32Array(e.count()),e.each(function(s){var h=e.graph.getEdgeByIndex(s),l=2*h.node1.dataIndex,c=2*h.node2.dataIndex;n[0]=r[l],n[1]=r[l+1],i[0]=r[c],i[1]=r[c+1];var d=e.getItemVisual(h.dataIndex,"color"),f=a.parseColor(d);f[3]*=u.firstNotNull(e.getItemVisual(h.dataIndex,"opacity"),1);var p=e.getItemModel(h.dataIndex),_=u.firstNotNull(p.get(o),1)*this._api.getDevicePixelRatio();t.addLine(n,i,f,_);for(var m=0;m<4;m++)this._originalEdgeColors[4*h.dataIndex+m]=f[m];this._edgeIndicesMap[h.dataIndex]=s},!1,this),t.dirty()},_updateForceNodesGeometry:function(e){for(var t=this._pointsBuilder.getPointsMesh(),r=[],n=0;n=p&&(u._syncNodePosition(e),f=0),r.getZr().refresh(),c(function(){m(t)})})};c(function(){u._forceLayoutInstanceToDispose&&(u._forceLayoutInstanceToDispose.dispose(i.layer.renderer),u._forceLayoutInstanceToDispose=null),m(h)}),this._layouting=!0}},stopLayout:function(e,t,r,n){this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(n&&n.beforeLayout||(this._syncNodePosition(e),this._updateAfterLayout(e,t,r)),this._api.getZr().refresh(),this._layouting=!1)},_syncNodePosition:function(e){var t=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);e.getData().setLayout("points",t),e.setNodePosition(t)},_updateAfterLayout:function(e,t,r){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(e,t,r),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(e,t,r,n){var i=this._model.getData();this._downplayAll();var a=n.dataIndex,o=i.graph,s=[],u=o.getNodeByIndex(a);s.push(u),u.edges.forEach(function(e){e.dataIndex<0||(e.node1!==u&&s.push(e.node1),e.node2!==u&&s.push(e.node2))},this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach(function(e){this._pointsBuilder.highlight(i,e.dataIndex)},this),this._pointsBuilder.updateLabels(s.map(function(e){return e.dataIndex}));var h=[];u.edges.forEach(function(e){e.dataIndex>=0&&(this._highlightEdge(e.dataIndex),h.push(e))},this),this._focusNodes=s,this._focusEdges=h},unfocusNodeAdjacency:function(e,t,r,n){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(e){var t=this._model.getEdgeData().getItemModel(e),r=a.parseColor(t.get("emphasis.lineStyle.color")||t.get("lineStyle.color")),n=u.firstNotNull(t.get("emphasis.lineStyle.opacity"),t.get("lineStyle.opacity"),1);r[3]*=n,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],r)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach(function(e){this._pointsBuilder.downplay(this._model.getData(),e.dataIndex)},this),this._focusEdges&&this._focusEdges.forEach(function(e){this._downplayEdge(e.dataIndex)},this)},_downplayEdge:function(e){var t=this._getColor(e,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],t)},_setEdgeFade:function(){var e=[];return function(t,r){this._getColor(t,e),e[3]*=r,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],e)}}(),_getColor:function(e,t){for(var r=0;r<4;r++)t[r]=this._originalEdgeColors[4*e+r];return t},_fadeOutEdgesAll:function(e){this._model.getData().graph.eachEdge(function(t){this._setEdgeFade(t.dataIndex,e)},this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(e,t){this.viewGL.setViewport(0,0,t.getWidth(),t.getHeight(),t.getDevicePixelRatio());for(var r=this.viewGL.camera,n=e.getData(),i=n.getLayout("points"),a=d.create(1/0,1/0),o=d.create(-1/0,-1/0),s=[],u=0;ur.left&&lr.top)){var c=Math.max(o[0]-a[0],10),f=c/t.getWidth()*t.getHeight();c*=1.4,f*=1.4,a[0]-=.2*c,r.left=a[0],r.top=h-f/2,r.bottom=h+f/2,r.right=c+a[0],r.near=0,r.far=100}},dispose:function(){var e=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(e),this.groupGL.removeAll(),this.stopLayout()},remove:function(){this.groupGL.removeAll(),this._control.dispose()}})},function(e,t,r){var n=r(0),i=r(193),a=r(194),o=r(4);e.exports=function(e,t,r,s,u){for(var h=new i(s),l=0;l "+m)),f++)}var g,v=n.helper.completeDimensions(["value"],e);g=new n.List(v,r),g.initData(e);var y=new n.List(["value"],r);return y.initData(d,c),u&&u(g,y),a({mainData:g,struct:h,structAttr:"graph",datas:{node:g,edge:y},datasAttr:{node:"data",edge:"edgeData"}}),h.update(),h}},function(e,t){e.exports="@export ecgl.forceAtlas2.updateNodeRepulsion\n\n#define NODE_COUNT 0\n\nuniform sampler2D positionTex;\n\nuniform vec2 textureSize;\nuniform float gravity;\nuniform float scaling;\nuniform vec2 gravityCenter;\n\nuniform bool strongGravityMode;\nuniform bool preventOverlap;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, v_Texcoord);\n\n vec2 force = vec2(0.0);\n for (int i = 0; i < NODE_COUNT; i++) {\n vec2 uv = vec2(\n mod(float(i), textureSize.x) / (textureSize.x - 1.0),\n floor(float(i) / textureSize.x) / (textureSize.y - 1.0)\n );\n vec4 n1 = texture2D(positionTex, uv);\n\n vec2 dir = n0.xy - n1.xy;\n float d2 = dot(dir, dir);\n\n if (d2 > 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end"},function(e,t){function r(){function e(){this.subRegions=[],this.nSubRegions=0,this.node=null,this.mass=0,this.centerOfMass=null,this.bbox=new Float32Array(4),this.size=0}function t(){this.position=new Float32Array(2),this.force=i.create(),this.forcePrev=i.create(),this.mass=1,this.inDegree=0,this.outDegree=0}function r(e,t){this.source=e,this.target=t,this.weight=1}function n(){this.autoSettings=!0,this.barnesHutOptimize=!0,this.barnesHutTheta=1.5,this.repulsionByDegree=!0,this.linLogMode=!1,this.strongGravityMode=!1,this.gravity=1,this.scaling=1,this.edgeWeightInfluence=1,this.jitterTolerence=.1,this.preventOverlap=!1,this.dissuadeHubs=!1,this.rootRegion=new e,this.rootRegion.centerOfMass=i.create(),this.nodes=[],this.edges=[],this.bbox=new Float32Array(4),this.gravityCenter=null,this._massArr=null,this._swingingArr=null,this._sizeArr=null,this._globalSpeed=0}var i={create:function(){return new Float32Array(2)},dist:function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)},len:function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},scaleAndAdd:function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e},scale:function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},sub:function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e},normalize:function(e,t){var r=t[0],n=t[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),e[0]=t[0]*i,e[1]=t[1]*i),e},negate:function(e,t){return e[0]=-t[0],e[1]=-t[1],e},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e},set:function(e,t,r){return e[0]=t,e[1]=r,e}},a=e.prototype;a.beforeUpdate=function(){for(var e=0;e=e&&this.bbox[1]<=t&&this.bbox[3]>=t},a.setBBox=function(e,t,r,n){this.bbox[0]=e,this.bbox[1]=t,this.bbox[2]=r,this.bbox[3]=n,this.size=(r-e+n-t)/2},a._newSubRegion=function(){var t=this.subRegions[this.nSubRegions];return t||(t=new e,this.subRegions[this.nSubRegions]=t),this.nSubRegions++,t},a._addNodeToSubRegion=function(e){var t=this.findSubRegion(e.position[0],e.position[1]),r=this.bbox;if(!t){var n=(r[0]+r[2])/2,i=(r[1]+r[3])/2,a=(r[2]-r[0])/2,o=(r[3]-r[1])/2,s=e.position[0]>=n?1:0,u=e.position[1]>=i?1:0,t=this._newSubRegion();t.setBBox(s*a+r[0],u*o+r[1],(s+1)*a+r[0],(u+1)*o+r[1])}t.addNode(e)},a._updateCenterOfMass=function(e){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var t=this.centerOfMass[0]*this.mass,r=this.centerOfMass[1]*this.mass;t+=e.position[0]*e.mass,r+=e.position[1]*e.mass,this.mass+=e.mass,this.centerOfMass[0]=t/this.mass,this.centerOfMass[1]=r/this.mass};var o=n.prototype;o.initNodes=function(e,r,n){var i=r.length;this.nodes.length=0;for(var a=void 0!==n,o=0;o0&&(this.strongGravityMode?this.applyNodeStrongGravity(n):this.applyNodeGravity(n))}for(var t=0;t0&&(c=Math.min(c/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=c;for(var t=0;t0&&(d=Math.min(f*d,10)/f,i.scaleAndAdd(r.position,r.position,r.force,d))}},o.applyRegionToNodeRepulsion=function(){var e=i.create();return function(t,r){if(t.node)this.applyNodeToNodeRepulsion(t.node,r,!0);else{i.sub(e,r.position,t.centerOfMass);var n=e[0]*e[0]+e[1]*e[1];if(n>this.barnesHutTheta*t.size*t.size){var a=this.scaling*r.mass*t.mass/n;i.scaleAndAdd(r.force,r.force,e,a)}else for(var o=0;o0)o=this.scaling*t.mass*r.mass/(s*s);else{if(!(s<0))return;o=100*this.scaling*t.mass*r.mass}}else o=this.scaling*t.mass*r.mass/a;i.scaleAndAdd(t.force,t.force,e,o),i.scaleAndAdd(r.force,r.force,e,-o)}}}}(),o.applyEdgeAttraction=function(){var e=i.create();return function(t){var r=t.source,n=t.target;i.sub(e,r.position,n.position);var a,o=i.len(e);a=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?t.weight:Math.pow(t.weight,this.edgeWeightInfluence);var s;this.preventOverlap&&(o=o-r.size-n.size)<=0||(s=this.linLogMode?-a*Math.log(o+1)/(o+1):-a,i.scaleAndAdd(r.force,r.force,e,s),i.scaleAndAdd(n.force,n.force,e,-s))}}(),o.applyNodeGravity=function(){var e=i.create();return function(t){i.sub(e,this.gravityCenter,t.position);var r=i.len(e);i.scaleAndAdd(t.force,t.force,e,this.gravity*t.mass/(r+1))}}(),o.applyNodeStrongGravity=function(){var e=i.create();return function(t){i.sub(e,this.gravityCenter,t.position),i.scaleAndAdd(t.force,t.force,e,this.gravity*t.mass)}}(),o.updateBBox=function(){for(var e=1/0,t=1/0,r=-1/0,n=-1/0,i=0;i=0){var T=3*c,b=new u(this._points[T],this._points[T+1],this._points[T+2]);a.push({dataIndex:c,point:b,pointWorld:b.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(b)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}})},function(e,t,r){var n=r(0);n.extendSeriesModel({type:"series.lines3D",dependencies:["globe"],visualColorAccessPath:"lineStyle.color",getInitialData:function(e,t){var r=new n.List(["value"],this);return r.hasItemOption=!1,r.initData(e.data,[],function(e,t,n,i){if(e instanceof Array)return NaN;r.hasItemOption=!0;var a=e.value;return null!=a?a instanceof Array?a[i]:a:void 0}),r},defaultOption:{coordinateSystem:"globe",globeIndex:0,geo3DIndex:0,zlevel:-10,polyline:!1,effect:{show:!1,period:4,trailWidth:4,trailLength:.2,spotIntensity:6},silent:!0,blendMode:"source-over",lineStyle:{width:1,opacity:.5}}})},function(e,t,r){function n(e){return null!=e.radius?e.radius:null!=e.size?Math.max(e.size[0],e.size[1],e.size[2]):100}var i=r(0),a=r(2),o=r(22),s=r(122);a.Shader.import(r(41)),e.exports=i.extendChartView({type:"lines3D",__ecgl__:!0,init:function(e,t){this.groupGL=new a.Node,this._meshLinesMaterial=new a.Material({shader:a.createShader("ecgl.meshLines3D"),transparent:!0,depthMask:!1}),this._linesMesh=new a.Mesh({geometry:new o,material:this._meshLinesMaterial,$ignorePicking:!0}),this._trailMesh=new s},render:function(e,t,r){this.groupGL.add(this._linesMesh);var n=e.coordinateSystem,i=e.getData();if(n&&n.viewGL){n.viewGL.add(this.groupGL),this._updateLines(e,t,r);var o=n.viewGL.isLinearSpace()?"define":"undefine";this._linesMesh.material.shader[o]("fragment","SRGB_DECODE"),this._trailMesh.material.shader[o]("fragment","SRGB_DECODE")}var s=this._trailMesh;if(s.stopAnimation(),e.get("effect.show")){this.groupGL.add(s),s.updateData(i,r,this._linesMesh.geometry),s.__time=s.__time||0;this._curveEffectsAnimator=s.animate("",{loop:!0}).when(36e5,{__time:36e5}).during(function(){s.setAnimationTime(s.__time)}).start()}else this.groupGL.remove(s),this._curveEffectsAnimator=null;this._linesMesh.material.blend=this._trailMesh.material.blend="lighter"===e.get("blendMode")?a.additiveBlend:null},pauseEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.pause()},resumeEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.resume()},toggleEffect:function(){var e=this._curveEffectsAnimator;e&&(e.isPaused()?e.resume():e.pause())},_updateLines:function(e,t,r){var i=e.getData(),o=e.coordinateSystem,s=this._linesMesh.geometry,u=e.get("polyline");s.expandLine=!0;var h=n(o);s.segmentScale=h/20;var l="lineStyle.width".split("."),c=r.getDevicePixelRatio(),d=0;i.each(function(e){var t=i.getItemModel(e),r=t.get(l);null==r&&(r=1),i.setItemVisual(e,"lineWidth",r),d=Math.max(r,d)}),s.useNativeLine=!1;var f=0,p=0;i.each(function(e){var t=i.getItemLayout(e);u?(f+=s.getPolylineVertexCount(t),p+=s.getPolylineTriangleCount(t)):(f+=s.getCubicCurveVertexCount(t[0],t[1],t[2],t[3]),p+=s.getCubicCurveTriangleCount(t[0],t[1],t[2],t[3]))}),s.setVertexCount(f),s.setTriangleCount(p),s.resetOffset();var _=[];i.each(function(e){var t=i.getItemLayout(e),r=i.getItemVisual(e,"color"),n=i.getItemVisual(e,"opacity"),o=i.getItemVisual(e,"lineWidth")*c;null==n&&(n=1),_=a.parseColor(r,_),_[3]*=n,u?s.addPolyline(t,_,o):s.addCubicCurve(t[0],t[1],t[2],t[3],_,o)}),s.dirty()},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}})},function(e,t,r){function n(e){return e>0?1:-1}var i=(r(0),r(2)),a=r(1).vec3,o=r(22);i.Shader.import(r(124)),e.exports=i.Mesh.extend(function(){var e=new i.Material({shader:new i.Shader({vertex:i.Shader.source("ecgl.trail2.vertex"),fragment:i.Shader.source("ecgl.trail2.fragment")}),transparent:!0,depthMask:!1}),t=new o({dynamic:!0});return t.createAttribute("dist","float",1),t.createAttribute("distAll","float",1),t.createAttribute("start","float",1),{geometry:t,material:e,culling:!1,$ignorePicking:!0}},{updateData:function(e,t,r){var o=e.hostModel,s=this.geometry,u=o.getModel("effect"),h=u.get("trailWidth")*t.getDevicePixelRatio(),l=u.get("trailLength"),c=o.get("effect.constantSpeed"),d=1e3*o.get("effect.period"),f=null!=c;f?this.material.set("speed",c/1e3):this.material.set("period",d),this.material.shader[f?"define":"undefine"]("vertex","CONSTANT_SPEED");var p=o.get("polyline");s.trailLength=l,this.material.set("trailLength",l),s.resetOffset(),["position","positionPrev","positionNext"].forEach(function(e){s.attributes[e].value=r.attributes[e].value}),["dist","distAll","start","offset","color"].forEach(function(e){s.attributes[e].init(s.vertexCount)}),s.indices=r.indices;var _=[],m=u.get("trailColor"),g=u.get("trailOpacity"),v=null!=m,y=null!=g;this.updateWorldTransform();var x=this.worldTransform.x.len(),T=this.worldTransform.y.len(),b=this.worldTransform.z.len(),w=0,E=0;e.each(function(t){var o=e.getItemLayout(t),u=y?g:e.getItemVisual(t,"opacity"),l=e.getItemVisual(t,"color");null==u&&(u=1),_=i.parseColor(v?m:l,_),_[3]*=u;for(var c=p?r.getPolylineVertexCount(o):r.getCubicCurveVertexCount(o[0],o[1],o[2],o[3]),S=0,A=[],M=[],N=w;Nw&&(S+=a.dist(A,M)),s.attributes.dist.set(N,S),a.copy(M,A);E=Math.max(E,S);for(var C=Math.random()*(f?S:d),N=w;N 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end"},function(e,t,r){var n=r(0),i=r(38),a=r(32),o=r(31),s=r(33),u=r(64),h=r(24),l=r(29),c=n.extendSeriesModel({type:"series.map3D",layoutMode:"box",coordinateSystem:null,visualColorAccessPath:"itemStyle.areaColor",optionUpdated:function(e){e=e||{};var t=this.get("coordinateSystem");if(null!=t&&"geo3D"!==t){this.get("groundPlane.show")&&(this.option.groundPlane.show=!1)}},getInitialData:function(e){e.data=this.getFilledRegions(e.data,e.map);var t=n.helper.completeDimensions(["value"],e.data),r=new n.List(t,this);r.initData(e.data);var i={};return r.each(function(e){var t=r.getName(e),n=r.getItemModel(e);i[t]=n}),this._regionModelMap=i,r},formatTooltip:function(e){return l(this,e)},getRegionModel:function(e){return this._regionModelMap[e]||new n.Model(null,this)},getFormattedLabel:function(e,t){var r=h.getFormattedLabel(this,e,t);return null==r&&(r=this.getData().getName(e)),r},defaultOption:{coordinateSystem:"geo3D",data:null}});n.util.merge(c.prototype,u),n.util.merge(c.prototype,i),n.util.merge(c.prototype,a),n.util.merge(c.prototype,o),n.util.merge(c.prototype,s),e.exports=c},function(e,t,r){var n=r(0),i=r(2),a=r(40),o=r(30),s=r(61);e.exports=n.extendChartView({type:"map3D",__ecgl__:!0,init:function(e,t){this._geo3DBuilder=new s(t),this.groupGL=new i.Node},render:function(e,t,r){var n=e.coordinateSystem;if(n&&n.viewGL){this.groupGL.add(this._geo3DBuilder.rootNode),n.viewGL.add(this.groupGL);var i;if("geo3D"===n.type){i=n,this._sceneHelper||(this._sceneHelper=new o,this._sceneHelper.initLight(this.groupGL)),this._sceneHelper.setScene(n.viewGL.scene),this._sceneHelper.updateLight(e),n.viewGL.setPostEffect(e.getModel("postEffect"),r),n.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling"));var s=this._control;s||(s=this._control=new a({zr:r.getZr()}),this._control.init());var u=e.getModel("viewControl");s.setViewGL(n.viewGL),s.setFromViewControlModel(u,0),s.off("update"),s.on("update",function(){r.dispatchAction({type:"map3DChangeCamera",alpha:s.getAlpha(),beta:s.getBeta(),distance:s.getDistance(),from:this.uid,map3DId:e.id})}),this._geo3DBuilder.extrudeY=!0}else this._control&&(this._control.dispose(),this._control=null),this._sceneHelper&&(this._sceneHelper.dispose(),this._sceneHelper=null),i=e.getData().getLayout("geo3D"),this._geo3DBuilder.extrudeY=!1;this._geo3DBuilder.update(e,i,t,r);var h=n.viewGL.isLinearSpace()?"define":"undefine";this._geo3DBuilder.rootNode.traverse(function(e){e.material&&e.material.shader[h]("fragment","SRGB_DECODE")})}},afterRender:function(e,t,r,n){var i=n.renderer,a=e.coordinateSystem;a&&"geo3D"===a.type&&(this._sceneHelper.updateAmbientCubemap(i,e,r),this._sceneHelper.updateSkybox(i,e,r))},dispose:function(){this.groupGL.removeAll(),this._control.dispose()}})},function(e,t,r){var n=r(0),i=r(24),a=r(29);n.extendSeriesModel({type:"series.scatter3D",dependencies:["globe","grid3D","geo3D"],visualColorAccessPath:"itemStyle.color",getInitialData:function(e,t){var r=n.getCoordinateSystemDimensions(this.get("coordinateSystem"))||["x","y","z"],i=n.helper.completeDimensions(r,e.data,{encodeDef:this.get("encode"),dimsDef:this.get("dimensions")}),a=new n.List(i,this);return a.initData(e.data),a},getFormattedLabel:function(e,t,r,n){var a=i.getFormattedLabel(this,e,t,r,n);if(null==a){var o=this.getData(),s=o.dimensions[o.dimensions.length-1];a=o.get(s,e)}return a},formatTooltip:function(e){return a(this,e)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,globeIndex:0,symbol:"circle",symbolSize:10,blendMode:"source-over",label:{show:!1,position:"right",distance:5,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},itemStyle:{opacity:.8},emphasis:{label:{show:!0}},animationDurationUpdate:500}})},function(e,t,r){var n=r(0),i=r(2),a=r(4),o=r(24),s=r(48);n.extendChartView({type:"scatter3D",__ecgl__:!0,init:function(e,t){this.groupGL=new i.Node;var r=new s(!1,t);this._pointsBuilder=r},render:function(e,t,r){this.groupGL.add(this._pointsBuilder.rootNode);var n=e.coordinateSystem;n&&n.viewGL&&(n.viewGL.add(this.groupGL),this._pointsBuilder.update(e,t,r),this._pointsBuilder.updateView(n.viewGL.camera),this._camera=n.viewGL.camera)},updateLayout:function(e,t,r){this._pointsBuilder.updateLayout(e,t,r),this._pointsBuilder.updateView(this._camera)},updateCamera:function(){this._pointsBuilder.updateView(this._camera)},highlight:function(e,t,r,n){this._toggleStatus("highlight",e,t,r,n)},downplay:function(e,t,r,n){this._toggleStatus("downplay",e,t,r,n)},_toggleStatus:function(e,t,r,i,s){var u=t.getData(),h=a.queryDataIndex(u,s),l=this._pointsBuilder;null!=h?n.util.each(o.normalizeToArray(h),function(t){"highlight"===e?l.highlight(u,t):l.downplay(u,t)},this):u.each(function(t){"highlight"===e?l.highlight(u,t):l.downplay(u,t)})},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}})},function(e,t,r){var n=r(0);n.extendSeriesModel({type:"series.scatterGL",dependencies:["grid","polar","geo","singleAxis"],visualColorAccessPath:"itemStyle.color",getInitialData:function(){return n.helper.createList(this)},defaultOption:{coordinateSystem:"cartesian2d",zlevel:10,symbol:"circle",symbolSize:10,blendMode:"source-over",itemStyle:{opacity:.8}}})},function(e,t,r){var n=r(0),i=r(2),a=r(21),o=r(48);n.extendChartView({type:"scatterGL",__ecgl__:!0,init:function(e,t){this.groupGL=new i.Node,this.viewGL=new a("orthographic"),this.viewGL.add(this.groupGL),this._pointsBuilder=new o(!0,t)},render:function(e,t,r){this.groupGL.add(this._pointsBuilder.rootNode),this._updateCamera(r.getWidth(),r.getHeight(),r.getDevicePixelRatio()),this._pointsBuilder.update(e,t,r),this._pointsBuilder.updateView(this.viewGL.camera)},updateLayout:function(e,t,r){this._pointsBuilder.updateLayout(e,t,r),this._pointsBuilder.updateView(this.viewGL.camera)},_updateCamera:function(e,t,r){this.viewGL.setViewport(0,0,e,t,r);var n=this.viewGL.camera;n.left=n.top=0,n.bottom=t,n.right=e,n.near=0,n.far=100},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}})},function(e,t,r){var n=r(0),i=r(33),a=r(29),o=n.extendSeriesModel({type:"series.surface",dependencies:["globe","grid3D","geo3D"],visualColorAccessPath:"itemStyle.color",formatTooltip:function(e){return a(this,e)},getInitialData:function(e,t){function r(e){return!(isNaN(e.min)||isNaN(e.max)||isNaN(e.step))}function i(e){var t=n.number.getPrecisionSafe;return Math.max(t(e.min),t(e.max),t(e.step))+1}var a=e.data;if(!a)if(a=[],e.parametric){var o=e.parametricEquation||{},s=o.u||{},u=o.v||{};["u","v"].forEach(function(e){r(o[e])}),["x","y","z"].forEach(function(e){o[e]});for(var h=i(s),l=i(u),c=u.min;c0;this._updateSurfaceMesh(this._surfaceMesh,e,l,f);var p=this._surfaceMesh.material;f?(p.shader.define("WIREFRAME_QUAD"),p.set("wireframeLineWidth",d),p.set("wireframeLineColor",a.parseColor(c.get("lineStyle.color")))):p.shader.undefine("WIREFRAME_QUAD"),this._initHandler(e,r),this._updateAnimation(e)},_updateAnimation:function(e){a.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,e)},_createSurfaceMesh:function(){var e=new a.Mesh({geometry:new a.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new a.Material({shader:new a.Shader({vertex:a.Shader.source("ecgl.sm.depth.vertex"),fragment:a.Shader.source("ecgl.sm.depth.fragment")})}),culling:!1,renderOrder:10,renderNormal:!0});return e.geometry.createAttribute("barycentric","float",4),e.geometry.createAttribute("prevPosition","float",3),e.geometry.createAttribute("prevNormal","float",3),i.util.extend(e.geometry,s),e},_initHandler:function(e,t){function r(e,t){for(var r=1/0,n=-1,a=[],s=0;s=0){var h=[];i.geometry.attributes.position.get(u,h);for(var l=a.pointToData(h),c=1/0,d=-1,f=[],p=0;p65535?Uint32Array:Uint16Array)((g-1)*(v-1)*6),S=function(e,t,r){r[1]=e*v+t,r[0]=e*v+t+1,r[3]=(e+1)*v+t+1,r[2]=(e+1)*v+t},A=!1;if(c){var M=[],N=[],C=0;x?f.init(s.vertexCount):f.value=null;for(var L=[[],[],[]],D=[],I=[],R=o.create(),P=function(e,t,r){var n=3*t;return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r},O=new Float32Array(h.length),F=new Float32Array(h.length/3*4),B=0;B0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var e=this.getDisplacementTexture(),t=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==e||this._displacementScale!==t,this._displacementTexture=e,this._displacementScale=t},isDisplacementChanged:function(){return this._displacementChanged}});i.util.merge(h.prototype,a),i.util.merge(h.prototype,o),i.util.merge(h.prototype,s),i.util.merge(h.prototype,u),e.exports=h},function(e,t,r){var n=r(0),i=r(2),a=r(40),o=r(30),s=r(189),u=r(4);e.exports=n.extendComponentView({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(e,t){this.groupGL=new i.Node;var r={};i.COMMON_SHADERS.forEach(function(e){r[e]=new i.Material({shader:i.createShader("ecgl."+e)})}),this._materials=r,this._sphereGeometry=new i.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new i.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new i.PlaneGeometry,this._earthMesh=new i.Mesh({renderNormal:!0}),this._lightRoot=new i.Node,this._sceneHelper=new o,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._earthMesh),this._control=new a({zr:t.getZr()}),this._control.init(),this._layerMeshes={}},render:function(e,t,r){var n=e.coordinateSystem,a=e.get("shading");n.viewGL.add(this._lightRoot),e.get("show")?n.viewGL.add(this.groupGL):n.viewGL.remove(this.groupGL),this._sceneHelper.setScene(n.viewGL.scene),n.viewGL.setPostEffect(e.getModel("postEffect"),r),n.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling"));var o=this._earthMesh;o.geometry=this._sphereGeometry,this._materials[a]?o.material=this._materials[a]:o.material=this._materials.lambert,i.setMaterialFromModel(a,o.material,e,r),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach(function(e){var t=o.material.get(e);t&&(t.flipY=!1)}),o.material.set("color",i.parseColor(e.get("baseColor")));var s=.99*n.radius;o.scale.set(s,s,s);var u=o.material.setTextureImage("diffuseMap",e.get("baseTexture"),r,{flipY:!1,anisotropic:8});u&&u.surface&&u.surface.attachToMesh(o);var h=o.material.setTextureImage("bumpMap",e.get("heightTexture"),r,{flipY:!1,anisotropic:8});h&&h.surface&&h.surface.attachToMesh(o),o.material.shader[e.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(e,r),this._displaceVertices(e,r),this._updateViewControl(e,r),this._updateLayers(e,r)},afterRender:function(e,t,r,n){var i=n.renderer;this._sceneHelper.updateAmbientCubemap(i,e,r),this._sceneHelper.updateSkybox(i,e,r)},_updateLayers:function(e,t){var r=e.coordinateSystem,a=e.get("layers"),o=r.radius,s=[],h=[],l=[],c=[];n.util.each(a,function(e){var a=new n.Model(e),d=a.get("type"),f=i.loadTexture(a.get("texture"),t,{flipY:!1,anisotropic:8});if(f.surface&&f.surface.attachToMesh(this._earthMesh),"blend"===d){var p=a.get("blendTo"),_=u.firstNotNull(a.get("intensity"),1);"emission"===p?(l.push(f),c.push(_)):(s.push(f),h.push(_))}else{var m=a.get("id"),g=this._layerMeshes[m];g||(g=this._layerMeshes[m]=new i.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0}));"lambert"===a.get("shading")?(g.material=g.__lambertMaterial||new i.Material({shader:i.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),g.__lambertMaterial=g.material):(g.material=g.__colorMaterial||new i.Material({shader:i.createShader("ecgl.color"),transparent:!0,depthMask:!1}),g.__colorMaterial=g.material),g.material.shader.enableTexture("diffuseMap");var v=a.get("distance"),y=o+(null==v?r.radius/100:v);g.scale.set(y,y,y),o=y;var x=this._blankTexture||(this._blankTexture=i.createBlankTexture("rgba(255, 255, 255, 0)"));g.material.set("diffuseMap",x),i.loadTexture(a.get("texture"),t,{flipY:!1,anisotropic:8},function(e){e.surface&&e.surface.attachToMesh(g),g.material.set("diffuseMap",e),t.getZr().refresh()}),a.get("show")?this.groupGL.add(g):this.groupGL.remove(g)}},this);var d=this._earthMesh.material;d.shader.define("fragment","LAYER_DIFFUSEMAP_COUNT",s.length),d.shader.define("fragment","LAYER_EMISSIVEMAP_COUNT",l.length),d.set("layerDiffuseMap",s),d.set("layerDiffuseIntensity",h),d.set("layerEmissiveMap",l),d.set("layerEmissionIntensity",c);var f=e.getModel("debug.wireframe");if(f.get("show")){d.shader.define("both","WIREFRAME_TRIANGLE");var p=i.parseColor(f.get("lineStyle.color")||"rgba(0,0,0,0.5)"),_=u.firstNotNull(f.get("lineStyle.width"),1);d.set("wireframeLineWidth",_),d.set("wireframeLineColor",p)}else d.shader.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(e,t){function r(){return{type:"globeChangeCamera",alpha:a.getAlpha(),beta:a.getBeta(),distance:a.getDistance()-n.radius,center:a.getCenter(),from:this.uid,globeId:e.id}}var n=e.coordinateSystem,i=e.getModel("viewControl"),a=(n.viewGL.camera,this._control);a.setViewGL(n.viewGL);var o,s,u=i.get("targetCoord");null!=u&&(s=u[0]+90,o=u[1]),a.setFromViewControlModel(i,{baseDistance:n.radius,alpha:o,beta:s}),a.off("update"),a.on("update",function(){t.dispatchAction(r())})},_displaceVertices:function(e,t){var r=e.get("displacementQuality"),n=e.get("debug.wireframe.show"),i=e.coordinateSystem;if(e.isDisplacementChanged()||r!==this._displacementQuality||n!==this._showDebugWireframe){this._displacementQuality=r,this._showDebugWireframe=n;var a=this._sphereGeometry,o={low:100,medium:200,high:400,ultra:800}[r]||200,s=o/2;(a.widthSegments!==o||n)&&(a.widthSegments=o,a.heightSegments=s,a.build()),this._doDisplaceVertices(a,i),n&&a.generateBarycentric()}},_doDisplaceVertices:function(e,t){var r=e.attributes.position.value,n=e.attributes.texcoord0.value,i=e.__originalPosition;i&&i.length===r.length||(i=new Float32Array(r.length),i.set(r),e.__originalPosition=i);for(var a=t.displacementWidth,o=t.displacementHeight,s=t.displacementData,u=0;u0&&e.rotation.rotateY(Math.PI),t.normal.z=-n)}function i(e,t,r){this.rootNode=new o.Node;var n=new o.Mesh({geometry:new u({useNativeLine:!1}),material:t,castShadow:!1,ignorePicking:!0,renderOrder:1}),i=new o.Mesh({geometry:new h,material:r,castShadow:!1,culling:!1,ignorePicking:!0,renderOrder:0});this.rootNode.add(i),this.rootNode.add(n),this.faceInfo=e,this.plane=new o.Plane,this.linesMesh=n,this.quadsMesh=i}var a=r(0),o=r(2),s=r(4),u=r(22),h=r(175),l=s.firstNotNull,c=r(62),d={x:0,y:2,z:1};i.prototype.update=function(e,t,r,i){var a=t.coordinateSystem,o=[a.getAxis(this.faceInfo[0]),a.getAxis(this.faceInfo[1])],s=this.linesMesh.geometry,u=this.quadsMesh.geometry;s.convertToDynamicArray(!0),u.convertToDynamicArray(!0),this._updateSplitLines(s,o,t,e,i),this._udpateSplitAreas(u,o,t,e,i),s.convertToTypedArray(),u.convertToTypedArray();var h=a.getAxis(this.faceInfo[2]);n(this.rootNode,this.plane,h,this.faceInfo[3])},i.prototype._updateSplitLines=function(e,t,r,n,i){var s=i.getDevicePixelRatio();t.forEach(function(i,u){var h=i.model,d=t[1-u].getExtent();if(!i.scale.isBlank()){var f=h.getModel("splitLine",r.getModel("splitLine"));if(f.get("show")){var p=f.getModel("lineStyle"),_=p.get("color"),m=l(p.get("opacity"),1),g=l(p.get("width"),1),v=f.get("interval");null!=v&&"auto"!==v||(v=n[i.dim]),_=a.util.isArray(_)?_:[_];for(var y=i.getTicksCoords(),x=0,T=0;Tn[1]?0:1,s=this._faces[2*r+o],u=this._faces[2*r+1-o];s.rootNode.invisible=!0,u.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var e=this._model.coordinateSystem,t=e.getAxis("x"),r=e.getAxis("y"),n=e.getAxis("z"),i=n.getExtentMax(),a=n.getExtentMin(),o=t.getExtentMin(),s=t.getExtentMax(),u=r.getExtentMax(),h=r.getExtentMin(),l=this._axes[0].rootNode,c=this._axes[1].rootNode,d=this._axes[2].rootNode,f=this._faces,p=f[4].rootNode.invisible?h:u,_=f[2].rootNode.invisible?i:a,m=f[0].rootNode.invisible?o:s,g=f[2].rootNode.invisible?i:a,v=f[0].rootNode.invisible?s:o,y=f[4].rootNode.invisible?h:u;l.rotation.identity(),c.rotation.identity(),d.rotation.identity(),f[4].rootNode.invisible&&(this._axes[0].flipped=!0,l.rotation.rotateX(Math.PI)),f[0].rootNode.invisible&&(this._axes[1].flipped=!0,c.rotation.rotateZ(Math.PI)),f[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),l.position.set(0,_,p),c.position.set(m,g,0),d.position.set(v,0,y),l.update(),c.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var e=this._control.getCamera(),t=[new i.Vector4,new i.Vector4],r=new i.Vector4;this.groupGL.getWorldPosition(r),r.w=1,r.transformMat4(e.viewMatrix).transformMat4(e.projectionMatrix),r.x/=r.w,r.y/=r.w,this._axes.forEach(function(n){for(var i=n.axisLineCoords,a=(n.labelsMesh.geometry,0);ar.y?"bottom":"top"):(s="middle",o=l>r.x?"left":"right"),n.setSpriteAlign(o,s,this._api)},this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(e){function t(e){return s.firstNotNull(e.model.get("axisPointer.show"),l.get("show"))}function r(e){var t=e.model.getModel("axisPointer",l),r=t.getModel("lineStyle"),n=i.parseColor(r.get("color")),a=u(r.get("width"),1),o=u(r.get("opacity"),1);return n[3]*=o,{color:n,lineWidth:a}}var n=this._model.coordinateSystem,a=n.dataToPoint(e),o=this._axisPointerLineMesh,h=o.geometry,l=this._model.getModel("axisPointer"),c=this._api.getDevicePixelRatio();h.convertToDynamicArray(!0);for(var d=0;d=0&&this._viewsToDispose.splice(t,1),this.views.push(e),e.layer=this;var r=this.zr;e.scene.traverse(function(e){e.__zr=r,e.addAnimatorsToZr&&e.addAnimatorsToZr(r)})}},f.prototype.removeView=function(e){if(e.layer===this){var t=this.views.indexOf(e);t>=0&&(this.views.splice(t,1),e.scene.traverse(n,this),e.layer=null,this._viewsToDispose.push(e))}},f.prototype.removeViewsAll=function(){this.views.forEach(function(e){e.scene.traverse(n,this),e.layer=null,this._viewsToDispose.push(e)},this),this.views.length=0},f.prototype.resize=function(e,t){this.renderer.resize(e,t)},f.prototype.clear=function(){var e=this.renderer.gl;e.clearColor(0,0,0,0),e.depthMask(!0),e.colorMask(!0,!0,!0,!0),e.clear(e.DEPTH_BUFFER_BIT|e.COLOR_BUFFER_BIT)},f.prototype.clearDepth=function(){var e=this.renderer.gl;e.clear(e.DEPTH_BUFFER_BIT)},f.prototype.clearColor=function(){var e=this.renderer.gl;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},f.prototype.needsRefresh=function(){this.zr.refresh()},f.prototype.refresh=function(){for(var e=0;e20)){e=e.event;var n=this.pickObject(e.offsetX,e.offsetY);n&&(this._dispatchEvent(e.type,e,n),this._dispatchDataEvent(e.type,e,n));var i=this._clickToSetFocusPoint(e);if(i){i.view.setDOFFocusOnPoint(i.distance)&&this.zr.refresh()}}}},f.prototype._clickToSetFocusPoint=function(e){for(var t=this.renderer,r=t.viewport,n=this.views.length-1;n>=0;n--){var i=this.views[n];if(i.hasDOF()&&i.containPoint(e.offsetX,e.offsetY)){this._picking.scene=i.scene,this._picking.camera=i.camera,t.viewport=i.viewport;var a=this._picking.pick(e.offsetX,e.offsetY,!0);if(a)return a.view=i,a}}t.viewport=r},f.prototype.onglobalout=function(e){var t=this._hovered;t&&this._dispatchEvent("mouseout",e,{target:t.target})},f.prototype.pickObject=function(e,t){for(var r=[],n=this.renderer,i=n.viewport,a=0;a=0&&(u.dataIndex=this._lastDataIndex,u.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(h,"mouseout",t)),s=!0):null!=o&&o!==this._lastEventData&&(null!=this._lastEventData&&(u.eventData=this._lastEventData,this.zr.handler.dispatchToElement(h,"mouseout",t)),s=!0),this._lastEventData=o,this._lastDataIndex=i,this._lastSeriesIndex=a),u.eventData=o,u.dataIndex=i,u.seriesIndex=a,(null!=o||parseInt(i,10)>=0)&&(this.zr.handler.dispatchToElement(h,e,t),s&&this.zr.handler.dispatchToElement(h,"mouseover",t))},f.prototype._dispatchToView=function(e,t){for(var r=0;r= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 0.4) / 0.4000001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import qtek.util.rgbm\n@import qtek.util.float\n\nvoid main()\n{\n vec4 blurredColor = decodeHDR(texture2D(blurred, v_Texcoord));\n vec4 originalColor = decodeHDR(texture2D(original, v_Texcoord));\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = decodeHDR(texture2D(nearfield, v_Texcoord));\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import qtek.util.rgbm\n@import qtek.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = decodeHDR(texel);\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n gl_FragColor = encodeHDR(color);\n#endif\n}\n\n@end"},function(e,t,r){function n(e){e=e||{},this._edgePass=new o({fragment:s.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",e.normalTexture),this._edgePass.setUniform("depthTexture",e.depthTexture),this._targetTexture=new i({type:a.HALF_FLOAT}),this._frameBuffer=new u,this._frameBuffer.attach(this._targetTexture)}var i=(r(9),r(3),r(5)),a=r(6),o=r(12),s=r(7),u=r(10);n.prototype.update=function(e,t,r,n){var i=e.getWidth(),a=e.getHeight(),o=this._targetTexture;o.width=i,o.height=a;var s=this._frameBuffer;s.bind(e),this._edgePass.setUniform("projectionInv",t.invProjectionMatrix._array),this._edgePass.setUniform("textureSize",[i,a]),this._edgePass.setUniform("texture",r),this._edgePass.render(e),s.unbind(e)},n.prototype.getTargetTexture=function(){return this._targetTexture},n.prototype.setParameter=function(e,t){this._edgePass.setUniform(e,t)},n.prototype.dispose=function(e){this._targetTexture.dispose(e),this._frameBuffer.dispose(e)},e.exports=n},function(e,t,r){function n(){this._sourceTexture=new a({type:o.HALF_FLOAT}),this._depthTexture=new a({format:o.DEPTH_COMPONENT,type:o.UNSIGNED_INT}),this._framebuffer=new s,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,s.DEPTH_ATTACHMENT),this._normalPass=new f;var e=new u;this._compositor=e.parse(_);var t=this._compositor.getNodeByName("source");t.texture=this._sourceTexture;var r=this._compositor.getNodeByName("coc");this._sourceNode=t,this._cocNode=r,this._compositeNode=this._compositor.getNodeByName("composite"),this._fxaaNode=this._compositor.getNodeByName("FXAA"),this._dofBlurNodes=["dof_far_blur","dof_near_blur","dof_coc_blur"].map(function(e){return this._compositor.getNodeByName(e)},this),this._dofBlurKernel=0,this._dofBlurKernelSize=new Float32Array(0),this._finalNodesChain=g.map(function(e){return this._compositor.getNodeByName(e)},this);var n={normalTexture:this._normalPass.getNormalTexture(),depthTexture:this._normalPass.getDepthTexture()};this._ssaoPass=new h(n),this._ssrPass=new l(n),this._edgePass=new p(n)}var i=(r(71),r(7)),a=r(5),o=r(6),s=r(10),u=r(205),h=r(161),l=r(163),c=r(167),d=r(2),f=r(159),p=r(157),_=(r(9),r(165));i.import(r(214)),i.import(r(219)),i.import(r(220)),i.import(r(215)),i.import(r(216)),i.import(r(221)),i.import(r(218)),i.import(r(213)),i.import(r(217)),i.import(r(156)),i.import(r(166));var m={color:{parameters:{width:function(e){return e.getWidth()},height:function(e){return e.getHeight()}}}},g=["composite","FXAA"];n.prototype.resize=function(e,t,r){r=r||1;var e=e*r,t=t*r,n=this._sourceTexture,i=this._depthTexture;n.width=e,n.height=t,i.width=e,i.height=t},n.prototype._ifRenderNormalPass=function(){return this._enableSSAO||this._enableEdge||this._enableSSR},n.prototype._getPrevNode=function(e){for(var t=g.indexOf(e.name)-1,r=this._finalNodesChain[t];r&&!this._compositor.getNodeByName(r.name);)t-=1,r=this._finalNodesChain[t];return r},n.prototype._getNextNode=function(e){for(var t=g.indexOf(e.name)+1,r=this._finalNodesChain[t];r&&!this._compositor.getNodeByName(r.name);)t+=1,r=this._finalNodesChain[t];return r},n.prototype._addChainNode=function(e){var t=this._getPrevNode(e),r=this._getNextNode(e);t&&(t.outputs=m,e.inputs.texture=t.name,r?(e.outputs=m,r.inputs.texture=e.name):e.outputs=null,this._compositor.addNode(e))},n.prototype._removeChainNode=function(e){var t=this._getPrevNode(e),r=this._getNextNode(e);t&&(r?(t.outputs=m,r.inputs.texture=t.name):t.outputs=null,this._compositor.removeNode(e))},n.prototype.updateNormal=function(e,t,r,n){this._ifRenderNormalPass()&&this._normalPass.update(e,t,r)},n.prototype.updateSSAO=function(e,t,r,n){this._ssaoPass.update(e,r,n)},n.prototype.enableSSAO=function(){this._enableSSAO=!0},n.prototype.disableSSAO=function(){this._enableSSAO=!1},n.prototype.enableSSR=function(){this._enableSSR=!0},n.prototype.disableSSR=function(){this._enableSSR=!1},n.prototype.getSSAOTexture=function(e,t,r,n){return this._ssaoPass.getTargetTexture()},n.prototype.getSourceFrameBuffer=function(){return this._framebuffer},n.prototype.getSourceTexture=function(){return this._sourceTexture},n.prototype.disableFXAA=function(){this._removeChainNode(this._fxaaNode)},n.prototype.enableFXAA=function(){this._addChainNode(this._fxaaNode)},n.prototype.enableBloom=function(){this._compositeNode.inputs.bloom="bloom_composite"},n.prototype.disableBloom=function(){this._compositeNode.inputs.bloom=null},n.prototype.enableDOF=function(){this._compositeNode.inputs.texture="dof_composite"},n.prototype.disableDOF=function(){this._compositeNode.inputs.texture="source"},n.prototype.enableColorCorrection=function(){this._compositeNode.shaderDefine("COLOR_CORRECTION"),this._enableColorCorrection=!0},n.prototype.disableColorCorrection=function(){this._compositeNode.shaderUndefine("COLOR_CORRECTION"),this._enableColorCorrection=!1},n.prototype.enableEdge=function(){this._enableEdge=!0},n.prototype.disableEdge=function(){this._enableEdge=!1},n.prototype.setBloomIntensity=function(e){this._compositeNode.setParameter("bloomIntensity",e)},n.prototype.setSSAOParameter=function(e,t){switch(e){case"quality":var r={low:6,medium:12,high:32,ultra:62}[t]||12;this._ssaoPass.setParameter("kernelSize",r);break;case"radius":this._ssaoPass.setParameter(e,t),this._ssaoPass.setParameter("bias",t/200);break;case"intensity":this._ssaoPass.setParameter(e,t)}},n.prototype.setDOFParameter=function(e,t){switch(e){case"focalDistance":case"focalRange":case"fstop":this._cocNode.setParameter(e,t);break;case"blurRadius":for(var r=0;r 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n\nuniform sampler2D ssaoTexture;\n\nuniform vec2 textureSize;\n\nvarying vec2 v_Texcoord;\n\nvoid main ()\n{\n\n vec2 texelSize = 1.0 / textureSize;\n\n float ao = 0.0;\n vec2 hlim = vec2(float(-BLUR_SIZE) * 0.5 + 0.5);\n float centerAo = texture2D(ssaoTexture, v_Texcoord).r;\n float weightAll = 0.0;\n float boxWeight = 1.0 / float(BLUR_SIZE) * float(BLUR_SIZE);\n for (int x = 0; x < BLUR_SIZE; x++) {\n for (int y = 0; y < BLUR_SIZE; y++) {\n vec2 coord = (vec2(float(x), float(y)) + hlim) * texelSize + v_Texcoord;\n float sampleAo = texture2D(ssaoTexture, coord).r;\n float closeness = 1.0 - distance(sampleAo, centerAo) / sqrt(3.0);\n float weight = boxWeight * closeness;\n ao += weight * sampleAo;\n weightAll += weight;\n }\n }\n\n gl_FragColor = vec4(vec3(clamp(ao / weightAll, 0.0, 1.0)), 1.0);\n}\n@end"},function(e,t,r){function n(e){for(var t=new Uint8Array(e*e*4),r=0,n=new u,i=0;i rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n if (intersect) {\n break;\n }\n }\n\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import qtek.util.rand\n\n@import qtek.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n if (g <= minGlossiness) {\n discard;\n }\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalAndGloss.rgb * 2.0 - 1.0;\n N = normalize((viewInverseTranspose * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n\n vec3 rayDir = normalize(reflect(normalize(rayOrigin), N));\n vec2 hitPixel;\n vec3 hitPoint;\n float iterationCount;\n\n vec2 uv2 = v_Texcoord * viewportSize;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n float alpha = calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir) * float(intersect);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((viewInverseTranspose * vec4(hitNormal, 0.0)).xyz);\n\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n\n \n if (!intersect) {\n discard;\n }\n vec4 color = decodeHDR(texture2D(sourceTexture, hitPixel));\n gl_FragColor = encodeHDR(vec4(color.rgb * alpha, color.a));\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 4.0;\n\n#ifdef BLEND\nuniform sampler2D sourceTexture;\n#endif\n\n@import qtek.util.rgbm\n\n\nvoid main()\n{\n @import qtek.compositor.kernel.gaussian_13\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g + 0.1, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n for (int i = 0; i < 13; i++) {\n vec2 coord = clamp((float(i) - 6.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i] * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n gl_FragColor = encodeHDR(\n sum / weightAll + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"},function(e,t,r){function n(e){e=e||{},this._ssrPass=new s({fragment:u.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new s({fragment:u.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new s({fragment:u.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._ssrPass.setUniform("gBufferTexture1",e.normalTexture),this._ssrPass.setUniform("gBufferTexture2",e.depthTexture),this._blurPass1.setUniform("gBufferTexture1",e.normalTexture),this._blurPass2.setUniform("gBufferTexture1",e.normalTexture),this._blurPass2.material.shader.define("fragment","VERTICAL"),this._blurPass2.material.shader.define("fragment","BLEND"),this._texture1=new a({type:o.HALF_FLOAT}),this._texture2=new a({type:o.HALF_FLOAT}),this._frameBuffer=new h}var i=r(9),a=(r(3),r(5)),o=r(6),s=r(12),u=r(7),h=r(10);r(39);u.import(r(162)),n.prototype.update=function(e,t,r,n){var a=e.getWidth(),o=e.getHeight(),s=this._texture1,u=this._texture2;s.width=u.width=a,s.height=u.height=o;var h=this._frameBuffer,l=this._ssrPass,c=this._blurPass1,d=this._blurPass2,f=new i;i.transpose(f,t.worldTransform),l.setUniform("sourceTexture",r),l.setUniform("projection",t.projectionMatrix._array),l.setUniform("projectionInv",t.invProjectionMatrix._array),l.setUniform("viewInverseTranspose",f._array),l.setUniform("nearZ",t.near),l.setUniform("jitterOffset",n/30);var p=[a,o];c.setUniform("textureSize",p),d.setUniform("textureSize",p),d.setUniform("sourceTexture",r),h.attach(u),h.bind(e),l.render(e),h.attach(s),c.setUniform("texture",u),c.render(e),h.attach(u),d.setUniform("texture",s),d.render(e),h.unbind(e)},n.prototype.getTargetTexture=function(){return this._texture2},n.prototype.setParameter=function(e,t){"maxIteration"===e?this._ssrPass.material.shader.define("fragment","MAX_ITERATION",t):this._ssrPass.setUniform(e,t)},n.prototype.dispose=function(e){this._texture1.dispose(e),this._texture2.dispose(e),this._frameBuffer.dispose(e)},e.exports=n},function(e,t,r){function n(){for(var e=[],t=0;t<30;t++)e.push([i(t,2),i(t,3)]);this._haltonSequence=e,this._frame=0,this._sourceTex=new s,this._sourceFb=new o,this._sourceFb.attach(this._sourceTex),this._prevFrameTex=new s,this._outputTex=new s;var r=this._blendPass=new a({fragment:u.source("qtek.compositor.blend")});r.material.shader.disableTexturesAll(),r.material.shader.enableTexture(["texture1","texture2"]),this._blendFb=new o({depthBuffer:!1}),this._outputPass=new a({fragment:u.source("qtek.compositor.output"),blendWithPrevious:!0}),this._outputPass.material.shader.define("fragment","OUTPUT_ALPHA"),this._outputPass.material.blend=function(e){e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}}var i=r(39),a=r(12),o=r(10),s=r(5),u=r(7),h=r(9);r(3);n.prototype={constructor:n,jitterProjection:function(e,t){var r=e.viewport,n=r.devicePixelRatio||e.getDevicePixelRatio(),i=r.width*n,a=r.height*n,o=this._haltonSequence[this._frame],s=new h;s._array[12]=(2*o[0]-1)/i,s._array[13]=(2*o[1]-1)/a,h.mul(t.projectionMatrix,s,t.projectionMatrix),h.invert(t.invProjectionMatrix,t.projectionMatrix)},resetFrame:function(){this._frame=0},getFrame:function(){return this._frame},getSourceFrameBuffer:function(){return this._sourceFb},resize:function(e,t){this._sourceTex.width===e&&this._sourceTex.height===t||(this._prevFrameTex.width=e,this._prevFrameTex.height=t,this._outputTex.width=e,this._outputTex.height=t,this._sourceTex.width=e,this._sourceTex.height=t,this._prevFrameTex.dirty(),this._outputTex.dirty(),this._sourceTex.dirty())},isFinished:function(){return this._frame>=this._haltonSequence.length},render:function(e){var t=this._blendPass;0===this._frame?(t.setUniform("weight1",0),t.setUniform("weight2",1)):(t.setUniform("weight1",.9),t.setUniform("weight2",.1)),t.setUniform("texture1",this._prevFrameTex),t.setUniform("texture2",this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(e),t.render(e),this._blendFb.unbind(e),this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(e);var r=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=r,this._frame++},dispose:function(e){this._sourceFb.dispose(e),this._blendFb.dispose(e),this._prevFrameTex.dispose(e),this._outputTex.dispose(e),this._sourceTex.dispose(e),this._outputPass.dispose(e),this._blendPass.dispose(e)}},e.exports=n},function(e,t){e.exports={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(qtek.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(qtek.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(qtek.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(qtek.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(qtek.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(qtek.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 32, height * 1.0 / 32] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blend",shader:"#source(qtek.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blend",shader:"#source(qtek.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blend",shader:"#source(qtek.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(qtek.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bloom_composite",shader:"#source(qtek.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(qtek.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},defines:{}},{name:"FXAA",shader:"#source(qtek.compositor.fxaa)",inputs:{texture:"composite"}}]}},function(e,t){e.exports="@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end"},function(e,t){e.exports=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925]},function(e,t,r){function n(e,t){if(e&&e[t]&&(e[t].normal||e[t].emphasis)){var r=e[t].normal,n=e[t].emphasis;r&&(e[t]=r),n&&(e.emphasis=e.emphasis||{},e.emphasis[t]=n)}}function i(e){n(e,"itemStyle"),n(e,"lineStyle"),n(e,"areaStyle"),n(e,"label")}function a(e){e&&(e instanceof Array||(e=[e]),o.util.each(e,function(e){if(e.axisLabel){var t=e.axisLabel;o.util.extend(t,t.textStyle),t.textStyle=null}}))}var o=r(0),s=["bar3D","line3D","map3D","scatter3D","surface","lines3D","scatterGL","scatter3D"];e.exports=function(e){o.util.each(e.series,function(e){o.util.indexOf(s,e.type)>=0&&i(e)}),a(e.xAxis3D),a(e.yAxis3D),a(e.zAxis3D),a(e.grid3D),n(e.geo3D)}},function(e,t,r){function n(e){return"_on"+e}var i=r(5),a=r(3),o=r(28),s=["mousedown","mouseup","mousemove","mouseover","mouseout","click","dblclick","contextmenu"],u=function(e){var t=this;this._texture=new i({anisotropic:32,flipY:!1,surface:this,dispose:function(e){t.dispose(),i.prototype.dispose.call(this,e)}}),s.forEach(function(e){this[n(e)]=function(t){t.triangle&&this._meshes.forEach(function(r){this.dispatchEvent(e,r,t.triangle,t.point)},this)}},this),this._meshes=[],e&&this.setECharts(e),this.onupdate=null};u.prototype={constructor:u,getTexture:function(){return this._texture},setECharts:function(e){this._chart=e;var t=e.getDom();if(t instanceof HTMLCanvasElement){var r=this,n=e.getZr(),i=n.__oldRefreshImmediately||n.refreshImmediately;n.refreshImmediately=function(){i.call(this),r._texture.dirty(),r.onupdate&&r.onupdate()},n.__oldRefreshImmediately=i}else console.error("ECharts must init on canvas if it is used as texture."),t=document.createElement("canvas");this._texture.image=t,this._texture.dirty(),this.onupdate&&this.onupdate()},dispatchEvent:function(){var e=new a,t=new a,r=new a,n=new o,i=new o,s=new o,u=new o,h=new a;return function(l,c,d,f){var p=c.geometry,_=p.attributes.position,m=p.attributes.texcoord0,g=a.dot,v=a.cross;_.get(d[0],e._array),_.get(d[1],t._array),_.get(d[2],r._array),m.get(d[0],n._array),m.get(d[1],i._array),m.get(d[2],s._array),v(h,t,r);var y=g(e,h),x=g(f,h)/y;v(h,r,e);var T=g(f,h)/y;v(h,e,t);var b=g(f,h)/y;o.scale(u,n,x),o.scaleAndAdd(u,u,i,T),o.scaleAndAdd(u,u,s,b);var w=u.x*this._chart.getWidth(),E=u.y*this._chart.getHeight();this._chart.getZr().handler.dispatch(l,{zrX:w,zrY:E})}}(),attachToMesh:function(e){this._meshes.indexOf(e)>=0||(s.forEach(function(t){e.on(t,this[n(t)],this)},this),this._meshes.push(e))},detachFromMesh:function(e){var t=this._meshes.indexOf(e);t>=0&&this._meshes.splice(t,1),s.forEach(function(t){e.off(t,this[n(t)])},this)},dispose:function(){this._meshes.forEach(function(e){this.detachFromMesh(e)},this)}},e.exports=u},function(e,t,r){var n=r(8),i=(r(4),n.extend(function(){return{zr:null,viewGL:null,minZoom:.2,maxZoom:5,_needsUpdate:!1,_dx:0,_dy:0,_zoom:1}},function(){this._mouseDownHandler=this._mouseDownHandler.bind(this),this._mouseWheelHandler=this._mouseWheelHandler.bind(this),this._mouseMoveHandler=this._mouseMoveHandler.bind(this),this._mouseUpHandler=this._mouseUpHandler.bind(this),this._update=this._update.bind(this)},{init:function(){var e=this.zr;e.on("mousedown",this._mouseDownHandler),e.on("mousewheel",this._mouseWheelHandler),e.on("globalout",this._mouseUpHandler),e.animation.on("frame",this._update)},setTarget:function(e){this._target=e},setZoom:function(e){this._zoom=Math.max(Math.min(e,this.maxZoom),this.minZoom),this._needsUpdate=!0},setOffset:function(e){this._dx=e[0],this._dy=e[1],this._needsUpdate=!0},getZoom:function(){return this._zoom},getOffset:function(){return[this._dx,this._dy]},_update:function(){if(this._target&&this._needsUpdate){var e=this._target,t=this._zoom;e.position.x=this._dx,e.position.y=this._dy,e.scale.set(t,t,t),this.zr.refresh(),this._needsUpdate=!1,this.trigger("update")}},_mouseDownHandler:function(e){if(!e.target){var t=e.offsetX,r=e.offsetY;if(!this.viewGL||this.viewGL.containPoint(t,r)){this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler);var n=this._convertPos(t,r);this._x=n.x,this._y=n.y}}},_convertPos:function(e,t){var r=this.viewGL.camera,n=this.viewGL.viewport;return{x:(e-n.x)/n.width*(r.right-r.left)+r.left,y:(t-n.y)/n.height*(r.bottom-r.top)+r.top}},_mouseMoveHandler:function(e){var t=this._convertPos(e.offsetX,e.offsetY);this._dx+=t.x-this._x,this._dy+=t.y-this._y,this._x=t.x,this._y=t.y,this._needsUpdate=!0},_mouseUpHandler:function(e){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_mouseWheelHandler:function(e){e=e.event;var t=e.wheelDelta||-e.detail;if(0!==t){var r=e.offsetX,n=e.offsetY;if(!this.viewGL||this.viewGL.containPoint(r,n)){var i=t>0?1.1:.9,a=Math.max(Math.min(this._zoom*i,this.maxZoom),this.minZoom);i=a/this._zoom;var o=this._convertPos(r,n),s=(o.x-this._dx)*(i-1),u=(o.y-this._dy)*(i-1);this._dx-=s,this._dy-=u,this._zoom=a,this._needsUpdate=!0}}},dispose:function(){var e=this.zr;e.off("mousedown",this._mouseDownHandler),e.off("mousemove",this._mouseMoveHandler),e.off("mouseup",this._mouseUpHandler),e.off("mousewheel",this._mouseWheelHandler),e.off("globalout",this._mouseUpHandler),e.animation.off("frame",this._update)}}));e.exports=i},function(e,t,r){var n=r(236),i={_animators:null,getAnimators:function(){return this._animators=this._animators||[],this._animators},animate:function(e,t){this._animators=this._animators||[];var r,i=this;if(e){for(var a=e.split("."),o=i,s=0,u=a.length;s=0&&h.splice(e,1)}),h.push(l),this.__zr&&this.__zr.animation.addAnimator(l),l},stopAnimation:function(e){this._animators=this._animators||[];for(var t=this._animators,r=t.length,n=0;n80*r){h=d=e[0],l=f=e[1];for(var g=r;gd&&(d=p),_>f&&(f=_);m=Math.max(d-h,f-l)}return o(s,u,r,h,l,m),u}function i(e,t,r,n,i){var a,o;if(i===D(e,t,r,n)>0)for(a=t;a=t;a-=n)o=N(a,e[a],e[a+1],o);return o&&b(o,o.next)&&(C(o),o=o.next),o}function a(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!b(n,n.next)&&0!==T(n.prev,n,n.next))n=n.next;else{if(C(n),(n=t=n.prev)===n.next)return null;r=!0}}while(r||n!==t);return t}function o(e,t,r,n,i,c,d){if(e){!d&&c&&_(e,n,i,c);for(var f,p,m=e;e.prev!==e.next;)if(f=e.prev,p=e.next,c?u(e,n,i,c):s(e))t.push(f.i/r),t.push(e.i/r),t.push(p.i/r),C(e),e=p.next,m=p.next;else if((e=p)===m){d?1===d?(e=h(e,t,r),o(e,t,r,n,i,c,2)):2===d&&l(e,t,r,n,i,c):o(a(e),t,r,n,i,c,1);break}}}function s(e){var t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(y(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&T(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function u(e,t,r,n){var i=e.prev,a=e,o=e.next;if(T(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,l=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,c=g(s,u,t,r,n),d=g(h,l,t,r,n),f=e.nextZ;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&y(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&T(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=e.prevZ;f&&f.z>=c;){if(f!==e.prev&&f!==e.next&&y(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&T(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function h(e,t,r){var n=e;do{var i=n.prev,a=n.next.next;!b(i,a)&&w(i,n,n.next,a)&&S(i,a)&&S(a,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(a.i/r),C(n),C(n.next),n=e=a),n=n.next}while(n!==e);return n}function l(e,t,r,n,i,s){var u=e;do{for(var h=u.next.next;h!==u.prev;){if(u.i!==h.i&&x(u,h)){var l=M(u,h);return u=a(u,u.next),l=a(l,l.next),o(u,t,r,n,i,s),void o(l,t,r,n,i,s)}h=h.next}u=u.next}while(u!==e)}function c(e,t,r,n){var o,s,u,h,l,c=[];for(o=0,s=t.length;o=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<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=l&&i!==n.x&&y(ar.x)&&S(n,e)&&(r=n,d=u),n=n.next;return r}function _(e,t,r,n){var i=e;do{null===i.z&&(i.z=g(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,m(i)}function m(e){var t,r,n,i,a,o,s,u,h=1;do{for(r=e,e=null,a=null,o=0;r;){for(o++,n=r,s=0,t=0;t0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=n}a.nextZ=null,h*=2}while(o>1);return e}function g(e,t,r,n,i){return e=32767*(e-r)/i,t=32767*(t-n)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function v(e){var t=e,r=e;do{t.x=0&&(e-o)*(n-s)-(r-o)*(t-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function x(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!E(e,t)&&S(e,t)&&S(t,e)&&A(e,t)}function T(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function b(e,t){return e.x===t.x&&e.y===t.y}function w(e,t,r,n){return!!(b(e,t)&&b(r,n)||b(e,n)&&b(r,t))||T(e,t,r)>0!=T(e,t,n)>0&&T(r,n,e)>0!=T(r,n,t)>0}function E(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&w(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function S(e,t){return T(e.prev,e,e.next)<0?T(e,t,e.next)>=0&&T(e,e.prev,t)>=0:T(e,t,e.prev)<0||T(e,e.next,t)<0}function A(e,t){var r=e,n=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}function M(e,t){var r=new L(e.i,e.x,e.y),n=new L(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function N(e,t,r,n){var i=new L(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function C(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function L(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function D(e,t,r,n){for(var i=0,a=t,o=r-n;a65535?new Uint32Array(3*n):new Uint16Array(3*n),this._dataIndices=new Uint32Array(r))},getBarVertexCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarVertexCount(e):this.enableNormal?24:8},getBarTriangleCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarTriangleCount(e):12},_getBevelBarVertexCount:function(e){return 4*(e+1)*(e+1)*2},_getBevelBarTriangleCount:function(e){return(4*e+3+1)*(2*e+1)*2+4},setColor:function(e,t){for(var r=this.getBarVertexCount(),n=r*e,i=r*(e+1),a=n;a0&&this.bevelSegments>0)this._addBevelBar(e,d,m,g,this.bevelSize,this.bevelSegments,v);else{u.copy(i,d),u.normalize(i,i),u.cross(a,m,i),u.normalize(a,a),u.cross(n,i,a),u.normalize(a,a),u.negate(o,n),u.negate(s,i),u.negate(h,a),t(l[0],e,n,g[0]/2),t(l[0],l[0],a,g[2]/2),t(l[1],e,n,g[0]/2),t(l[1],l[1],h,g[2]/2),t(l[2],e,o,g[0]/2),t(l[2],l[2],h,g[2]/2),t(l[3],e,o,g[0]/2),t(l[3],l[3],a,g[2]/2),t(r,e,i,g[1]),t(l[4],r,n,g[0]/2),t(l[4],l[4],a,g[2]/2),t(l[5],r,n,g[0]/2),t(l[5],l[5],h,g[2]/2),t(l[6],r,o,g[0]/2),t(l[6],l[6],h,g[2]/2),t(l[7],r,o,g[0]/2),t(l[7],l[7],a,g[2]/2);var T=this.attributes;if(this.enableNormal){c[0]=n,c[1]=o,c[2]=i,c[3]=s,c[4]=a,c[5]=h;for(var b=this._vertexOffset,w=0;w65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,n){return 1/(i.dist(e,t)+i.dist(r,t)+i.dist(n,r)+1)*this.segmentScale},getCubicCurveVertexCount:function(e,t,r,n){var i=this._getCubicCurveApproxStep(e,t,r,n),a=Math.ceil(1/i);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,n){var i=this._getCubicCurveApproxStep(e,t,r,n),a=Math.ceil(1/i);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(s)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(s)},getPolylineVertexCount:function(e){var t="number"!=typeof e[0],r=t?e.length:e.length/2;return this.useNativeLine?2*(r-1):2*(r-1)+2},getPolylineTriangleCount:function(e){var t="number"!=typeof e[0],r=t?e.length:e.length/2;return this.useNativeLine?0:2*(r-1)},addCubicCurve:function(e,t,r,n,i,a){null==a&&(a=1);for(var o=e[0],s=e[1],u=t[0],h=t[1],l=r[0],c=r[1],d=n[0],f=n[1],p=this._getCubicCurveApproxStep(e,t,r,n),_=p*p,m=_*p,g=3*p,v=3*_,y=6*_,x=6*m,T=o-2*u+l,b=s-2*h+c,w=3*(u-l)-o+d,E=3*(h-c)-s+f,S=o,A=s,M=(u-o)*g+T*v+w*m,N=(h-s)*g+b*v+E*m,C=T*y+w*x,L=b*y+E*x,D=w*x,I=E*x,R=0,P=0,O=Math.ceil(1/p),F=new Float32Array(3*(O+1)),F=[],B=0,P=0;P1&&(S=M>0?Math.min(S,d):Math.max(S,d),A=N>0?Math.min(A,f):Math.max(A,f));this.addPolyline(F,i,a,!1)},addLine:function(e,t,r,n){this.addPolyline([e,t],r,n,!1)},addPolyline:function(e,t,r,n){if(e.length){this._itemVertexOffsets.push(this._vertexOffset);var a="number"!=typeof e[0],o=this.attributes.position,s=this.attributes.color,u=this.attributes.offset,h=this.attributes.normal,l=this.indices;null==r&&(r=1);for(var c,d=this._vertexOffset,f=a?e.length:e.length/2,p=f,_=[],m=[],g=[],v=i.create(),y=i.create(),x=i.create(),T=i.create(),b=0;b1&&(o.copy(d,d-1),s.copy(d,d-1),d++);else{var S;if(b0){i.sub(v,_,g),i.sub(y,m,_),i.normalize(v,v),i.normalize(y,y),i.add(T,v,y),i.normalize(T,T);var A=r/2*Math.min(1/i.dot(v,T),2);x[0]=-T[1],x[1]=T[0],S=A}else i.sub(v,m,_),i.normalize(v,v),x[0]=-v[1],x[1]=v[0],S=r/2}else i.sub(v,_,g),i.normalize(v,v),x[0]=-v[1],x[1]=v[0],S=r/2;h.set(d,x),h.set(d+1,x),u.set(d,S),u.set(d+1,-S),i.copy(g,_),o.set(d,_),o.set(d+1,_),s.set(d,c),s.set(d+1,c),d+=2}if(this.useNativeLine)s.set(d,c),o.set(d,_),d++;else if(b>0){var M=3*this._faceOffset,l=this.indices;l[M]=d-4,l[M+1]=d-3,l[M+2]=d-2,l[M+3]=d-3,l[M+4]=d-1,l[M+5]=d-2,this._faceOffset+=2}}this._vertexOffset=d}},setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],n=e65535?new Uint32Array(3*n):new Uint16Array(3*n))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var e=i.create(),t=i.create(),r=i.create(),n=[0,3,1,3,2,1];return function(a,o){var s=this.attributes.position,u=this.attributes.normal,h=this.attributes.color;i.sub(e,a[1],a[0]),i.sub(t,a[2],a[1]),i.cross(r,e,t),i.normalize(r,r);for(var l=0;l<4;l++)s.set(this._vertexOffset+l,a[l]),h.set(this._vertexOffset+l,o),u.set(this._vertexOffset+l,r);for(var c=3*this._faceOffset,l=0;l<6;l++)this.indices[c+l]=n[l]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});a.util.defaults(s.prototype,o),e.exports=s},function(e,t,r){var n=r(0),i=r(13),a=r(34),o=[0,1,2,0,2,3],s=i.extend(function(){return{attributes:{position:new i.Attribute("position","float",3,"POSITION"),texcoord:new i.Attribute("texcoord","float",2,"TEXCOORD_0"),offset:new i.Attribute("offset","float",2),color:new i.Attribute("color","float",4,"COLOR")}}},{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setSpriteCount:function(e){this._spriteCount=e;var t=4*e,r=2*e;this.vertexCount!==t&&(this.attributes.position.init(t),this.attributes.offset.init(t),this.attributes.color.init(t)),this.triangleCount!==r&&(this.indices=t>65535?new Uint32Array(3*r):new Uint16Array(3*r))},setSpriteAlign:function(e,t,r,n,i){null==r&&(r="left"),null==n&&(n="top");var a,o,s,u;switch(i=i||0,r){case"left":a=i,s=t[0]+i;break;case"center":case"middle":a=-t[0]/2,s=t[0]/2;break;case"right":a=-t[0]-i,s=-i}switch(n){case"bottom":o=i,u=t[1]+i;break;case"middle":o=-t[1]/2,u=t[1]/2;break;case"top":o=-t[1]-i,u=-i}var h=4*e,l=this.attributes.offset;l.set(h,[a,u]),l.set(h+1,[s,u]),l.set(h+2,[s,o]),l.set(h+3,[a,o])},addSprite:function(e,t,r,n,i,a){var s=this._vertexOffset;this.setSprite(this._vertexOffset/4,e,t,r,n,i,a);for(var u=0;u=2e4},doSortVertices:function(e,t){var r=this.indices,i=n.create();if(!r){r=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var a=0;a.05);else for(var a=0;a<3;a++)this._progressiveQuickSort(3*t+a);this.dirtyIndices()},_simpleSort:function(e){function t(e,t){return r[t]-r[e]}var r=this._zList,n=this.indices;e?Array.prototype.sort.call(n,t):i.sort(n,t,0,n.length-1)},_progressiveQuickSort:function(e){var t=this._zList,r=this.indices;this._quickSort=this._quickSort||new i,this._quickSort.step(r,function(e,r){return t[r]-t[e]},e)}}},function(e,t){e.exports="@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import qtek.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"},function(e,t){e.exports="\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"},function(e,t){e.exports="\n@export ecgl.displayShadow.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_WorldPosition;\n\nvarying vec3 v_Normal;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n \n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n\n@end\n\n\n@export ecgl.displayShadow.fragment\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform float roughness: 0.2;\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import qtek.header.directional_light\n#endif\n\n@import ecgl.common.ssaoMap.header\n\n@import qtek.plugin.compute_shadow_map\n\nvoid main()\n{\n float shadow = 1.0;\n\n @import ecgl.common.ssaoMap.main\n\n#if defined(DIRECTIONAL_LIGHT_COUNT) && defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n for (int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++) {\n shadow = min(shadow, shadowContribsDir[i] * 0.5 + 0.5);\n }\n#endif\n\n shadow *= 0.5 + ao * 0.5;\n shadow = clamp(shadow, 0.0, 1.0);\n\n gl_FragColor = vec4(vec3(0.0), 1.0 - shadow);\n}\n\n@end"},function(e,t){e.exports="@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import qtek.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import qtek.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import qtek.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import qtek.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import qtek.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n \n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"},function(e,t){e.exports="@export ecgl.labels.vertex\n\nattribute vec3 position: POSITION;\nattribute vec2 texcoord: TEXCOORD_0;\nattribute vec2 offset;\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec2 v_Texcoord;\n\nvoid main()\n{\n vec4 proj = worldViewProjection * vec4(position, 1.0);\n\n vec2 screen = (proj.xy / abs(proj.w) + 1.0) * 0.5 * viewport.zw;\n\n screen += offset;\n\n proj.xy = (screen / viewport.zw - 0.5) * 2.0 * abs(proj.w);\n gl_Position = proj;\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n v_Texcoord = texcoord;\n}\n@end\n\n\n@export ecgl.labels.fragment\n\nuniform vec3 color : [1.0, 1.0, 1.0];\nuniform float alpha : 1.0;\nuniform sampler2D textureAtlas;\nuniform vec2 uvScale: [1.0, 1.0];\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\nvarying float v_Miter;\n\nvarying vec2 v_Texcoord;\n\nvoid main()\n{\n gl_FragColor = vec4(color, alpha) * texture2D(textureAtlas, v_Texcoord * uvScale);\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n}\n\n@end"},function(e,t){e.exports="/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import qtek.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import qtek.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import qtek.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import qtek.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import qtek.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"},function(e,t){e.exports="@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end"},function(e,t){e.exports="@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"},function(e,t){e.exports="@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import qtek.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import qtek.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import qtek.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import qtek.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import qtek.util.srgb\n\n@import qtek.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import qtek.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 51.5);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"},function(e,t){e.exports="@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import qtek.sm.depth.fragment\n\n@end"},function(e,t,r){function n(e,t,r){var t=t||document.createElement("canvas");t.width=e,t.height=e;var n=t.getContext("2d");return r&&r(n),t}function i(e,t,r,n){o.util.isArray(t)||(t=[t,t]);var i=s.getMarginByStyle(r,n),a=t[0]+i.left+i.right,u=t[1]+i.top+i.bottom,h=o.helper.createSymbol(e,0,0,t[0],t[1]),l=Math.max(a,u);h.position=[i.left,i.top],a>u?h.position[1]+=(l-u)/2:h.position[0]+=(l-a)/2;var c=h.getBoundingRect();return h.position[0]-=c.x,h.position[1]-=c.y,h.setStyle(r),h.update(),h.__size=l,h}function a(e,t,r){function n(e){return e<128?1:-1}for(var i=t.width,a=t.height,o=e.canvas.width,s=e.canvas.height,u=i/o,h=a/s,l=e.createImageData(o,s),c=0;c=0&&e.call(t,r[i],i)},u.eachEdge=function(e,t){for(var r=this.edges,n=r.length,i=0;i=0&&r[i].node1.dataIndex>=0&&r[i].node2.dataIndex>=0&&e.call(t,r[i],i)},u.breadthFirstTraverse=function(e,t,r,a){if(t instanceof i||(t=this._nodesMap[n(t)]),t){for(var o="out"===r?"outEdges":"in"===r?"inEdges":"edges",s=0;s=0&&r.node2.dataIndex>=0});for(var i=0,a=n.length;i=0&&this[e][t].setItemVisual(this.dataIndex,r,n)},getVisual:function(r,n){return this[e][t].getItemVisual(this.dataIndex,r,n)},setLayout:function(r,n){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,r,n)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}};o.mixin(i,h("hostGraph","data")),o.mixin(a,h("hostGraph","edgeData")),s.Node=i,s.Edge=a,e.exports=s},function(e,t,r){function n(e){var t=e.mainData,r=e.datas;r||(r={main:t},e.datasAttr={main:"data"}),e.datas=e.mainData=null,h(t,r,e),d(r,function(r){d(t.TRANSFERABLE_METHODS,function(t){r.wrapMethod(t,c.curry(i,e))})}),t.wrapMethod("cloneShallow",c.curry(o,e)),d(t.CHANGABLE_METHODS,function(r){t.wrapMethod(r,c.curry(a,e))}),c.assert(r[t.dataType]===t)}function i(e,t){if(u(this)){var r=c.extend({},this[f]);r[this.dataType]=t,h(t,r,e)}else l(t,this.dataType,this[p],e);return t}function a(e,t){return e.struct&&e.struct.update(this),t}function o(e,t){return d(t[f],function(r,n){r!==t&&l(r.cloneShallow(),n,t,e)}),t}function s(e){var t=this[p];return null==e||null==t?t:t[f][e]}function u(e){return e[p]===e}function h(e,t,r){e[f]={},d(t,function(t,n){l(t,n,e,r)})}function l(e,t,r,n){r[f][t]=e,e[p]=r,e.dataType=t,n.struct&&(e[n.structAttr]=n.struct,n.struct[n.datasAttr[t]]=e),e.getLinkedData=s}var c=r(15),d=c.each,f="\0__link_datas",p="\0__link_mainData";e.exports=n},function(e,t,r){var n=r(15),i=r(68),a=r(240),o={};o.addCommas=function(e){return isNaN(e)?"-":(e=(e+"").split("."),e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:""))},o.toCamelCase=function(e,t){return e=(e||"").toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e},o.normalizeCssArray=n.normalizeCssArray;var s=o.encodeHTML=function(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},u=["a","b","c","d","e","f","g"],h=function(e,t){return"{"+e+(null==t?"":t)+"}"};o.formatTpl=function(e,t,r){n.isArray(t)||(t=[t]);var i=t.length;if(!i)return"";for(var a=t[0].$vars||[],o=0;o':""};var l=function(e){return e<10?"0"+e:e};o.formatTime=function(e,t,r){"week"!==e&&"month"!==e&&"quarter"!==e&&"half-year"!==e&&"year"!==e||(e="MM-dd\nyyyy");var n=i.parseDate(t),a=r?"UTC":"",o=n["get"+a+"FullYear"](),s=n["get"+a+"Month"]()+1,u=n["get"+a+"Date"](),h=n["get"+a+"Hours"](),c=n["get"+a+"Minutes"](),d=n["get"+a+"Seconds"]();return e=e.replace("MM",l(s)).replace("M",s).replace("yyyy",o).replace("yy",o%100).replace("dd",l(u)).replace("d",u).replace("hh",l(h)).replace("h",h).replace("mm",l(c)).replace("m",c).replace("ss",l(d)).replace("s",d)},o.capitalFirst=function(e){return e?e.charAt(0).toUpperCase()+e.substr(1):e},o.truncateText=a.truncateText,o.getTextRect=a.getBoundingRect,e.exports=o},function(e,t,r){"use strict";function n(e){return{byte:d.Int8Array,ubyte:d.Uint8Array,short:d.Int16Array,ushort:d.Uint16Array}[e]||d.Float32Array}function i(e,t,r,n){this.name=e,this.type=t,this.size=r,n&&(this.semantic=n)}function a(e,t,r,n){switch(i.call(this,e,t,r,n),this.value=null,r){case 1:this.get=function(e){return this.value[e]},this.set=function(e,t){this.value[e]=t},this.copy=function(e,t){this.value[e]=this.value[e]};break;case 2:this.get=function(e,t){var r=this.value;return t[0]=r[2*e],t[1]=r[2*e+1],t},this.set=function(e,t){var r=this.value;r[2*e]=t[0],r[2*e+1]=t[1]},this.copy=function(e,t){var r=this.value;t*=2,e*=2,r[e]=r[t],r[e+1]=r[t+1]};break;case 3:this.get=function(e,t){var r=3*e,n=this.value;return t[0]=n[r],t[1]=n[r+1],t[2]=n[r+2],t},this.set=function(e,t){var r=3*e,n=this.value;n[r]=t[0],n[r+1]=t[1],n[r+2]=t[2]},this.copy=function(e,t){var r=this.value;t*=3,e*=3,r[e]=r[t],r[e+1]=r[t+1],r[e+2]=r[t+2]};break;case 4:this.get=function(e,t){var r=this.value,n=4*e;return t[0]=r[n],t[1]=r[n+1],t[2]=r[n+2],t[3]=r[n+3],t},this.set=function(e,t){var r=this.value,n=4*e;r[n]=t[0],r[n+1]=t[1],r[n+2]=t[2],r[n+3]=t[3]},this.copy=function(e,t){var r=this.value;t*=4,e*=4,r[e]=r[t],r[e+1]=r[t+1],r[e+2]=r[t+2],r[e+3]=r[t+3]}}}function o(e,t,r,n,i){this.name=e,this.type=t,this.buffer=r,this.size=n,this.semantic=i,this.symbol="",this.needsRemove=!1}function s(e){this.buffer=e,this.count=0}function u(){console.warn("Geometry doesn't implement this method, use StaticGeometry instead")}var h=r(8),l=r(11),c=r(45),d=r(20);i.prototype.clone=function(e){var t=new this.constructor(this.name,this.type,this.size,this.semantic);return e&&console.warn("todo"),t},a.prototype.constructor=new i,a.prototype.init=function(e){if(!this.value||this.value.length!=e*this.size){var t=n(this.type);this.value=new t(e*this.size)}},a.prototype.fromArray=function(e){var t,r=n(this.type);if(e[0]&&e[0].length){var i=0,a=this.size;t=new r(e.length*a);for(var o=0;o0){var t=this.outputs[e];t.keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e])}}});e.exports=a},function(e,t,r){"use strict";var n=r(8),i=r(37),a=n.extend(function(){return{nodes:[]}},{dirty:function(){this._dirty=!0},addNode:function(e){this.nodes.indexOf(e)>=0||(this.nodes.push(e),this._dirty=!0)},removeNode:function(e){"string"==typeof e&&(e=this.getNodeByName(e));var t=this.nodes.indexOf(e);t>=0&&(this.nodes.splice(t,1),this._dirty=!0)},getNodeByName:function(e){for(var t=0;t=t.COLOR_ATTACHMENT0&&l<=t.COLOR_ATTACHMENT0+8&&d.push(l);c.drawBuffersEXT(d)}e.saveClear(),e.clearBit=a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT,r=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),e.restoreClear(),n.unbind(e)}else r=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",r),this._rendering=!1,this._rendered=!0}});e.exports=s},function(e,t,r){"use strict";var n=r(37),i=n.extend(function(){return{texture:null,outputs:{color:{}}}},function(){},{getOutput:function(e,t){return this.texture},beforeFrame:function(){},afterFrame:function(){}});e.exports=i},function(e,t,r){"use strict";function n(e,t,r){"object"==typeof t&&(r=t,t=null);var n,o=this;if(!(e instanceof Function)){n=[];for(var s in e)e.hasOwnProperty(s)&&n.push(s)}var u=function(t){if(o.apply(this,arguments),e instanceof Function?i(this,e.call(this,t)):a(this,e,n),this.constructor===u)for(var r=u.__initializers__,s=0;s0&&(d.define("vertex","SKINNING"),d.define("vertex","JOINT_COUNT",h)),s&&d.define("both","SHADOW_TRANSPARENT"),o.useSkinMatricesTexture&&d.define("vertex","USE_SKIN_MATRICES_TEXTURE"),this._depthShaders[a]=d),c||(c=new p({shader:d}),this._depthMaterials[i]=c),o.material=c,this.softShadow===A.VSM?d.define("fragment","USE_VSM"):d.undefine("fragment","USE_VSM"),c.setUniform("bias",t),c.setUniform("slopeScale",r),s&&c.set("shadowTransparentMap",u))}},_bindDistanceMaterial:function(e,t){for(var r=t.getWorldPosition()._array,n=0;n0&&(o.shader.define("vertex","SKINNING"),o.shader.define("vertex","JOINT_COUNT",a)),this._distanceMaterials[a]=o),i.material=o,this.softShadow===A.VSM?o.shader.define("fragment","USE_VSM"):o.shader.undefine("fragment","USE_VSM")),o.set("lightPosition",r),o.set("range",t.range)}},saveMaterial:function(e){for(var t=0;t1&&(m=v,v.shadowCascade>4)){console.warn("Support at most 4 cascade");continue}this.renderDirectionalLightShadow(e,t,r,v,this._opaqueCasters,p,l,h)}else v instanceof c?this.renderSpotLightShadow(e,v,this._opaqueCasters,u,s):v instanceof f&&this.renderPointLightShadow(e,v,this._opaqueCasters,_);this._shadowMapNumber[v.type]++}this.restoreMaterial(this._opaqueCasters);var y=p.slice(),x=p.slice();y.pop(),x.shift(),y.reverse(),x.reverse(),l.reverse();for(var T=s.map(i),b=h.map(i),w={},g=0;g0&&(A.fragmentDefines[L]=C,M=!0)}M&&A.dirty(),m?A.define("fragment","SHADOW_CASCADE",m.shadowCascade):A.undefine("fragment","SHADOW_CASCADE"),w[A.__GUID__]=!0}s.length>0&&(S.setUniform("spotLightShadowMaps",s),S.setUniform("spotLightMatrices",u),S.setUniform("spotLightShadowMapSizes",T)),h.length>0&&(S.setUniform("directionalLightShadowMaps",h),m&&(S.setUniform("shadowCascadeClipsNear",y),S.setUniform("shadowCascadeClipsFar",x)),S.setUniform("directionalLightMatrices",l),S.setUniform("directionalLightShadowMapSizes",b)),_.length>0&&S.setUniform("pointLightShadowMaps",_)}}},renderDirectionalLightShadow:function(){var e=new s,t=new u,r=new o,n=new u,i=new u,a=new u,l=new u;return function(o,s,c,d,f,p,_,m){var g=d.shadowBias;this._bindDepthMaterial(f,g,d.shadowSlopeScale),f.sort(h.opaqueSortFunc);var v=Math.min(-s.viewBoundingBoxLastFrame.min.z,c.far),x=Math.max(-s.viewBoundingBoxLastFrame.max.z,c.near),T=this._getDirectionalLightCamera(d,s,c),b=a._array;l.copy(T.projectionMatrix),E.invert(i._array,T.worldTransform._array),E.multiply(i._array,i._array,c.worldTransform._array),E.multiply(b,l._array,i._array);for(var w=[],S=c instanceof y,M=(c.near+c.far)/(c.near-c.far),N=2*c.near*c.far/(c.near-c.far),C=0;C<=d.shadowCascade;C++){var L=x*Math.pow(v/x,C/d.shadowCascade),D=x+(v-x)*C/d.shadowCascade,I=L*d.cascadeSplitLogFactor+D*(1-d.cascadeSplitLogFactor);w.push(I),p.push(-(-I*M+N)/-I)}var R=this._getTexture(d,d.shadowCascade);m.push(R);var P=o.viewport,O=o.gl;this._frameBuffer.attach(R),this._frameBuffer.bind(o),O.clear(O.COLOR_BUFFER_BIT|O.DEPTH_BUFFER_BIT);for(var C=0;C 0.01)\n {\n gl_FragColor.rgb = gl_FragColor.rgb * mix(lineColor, vec3(1.0), edgeFactor(lineWidth));\n }\n\n#ifdef GAMMA_ENCODE\n gl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(1 / 2.2));\n#endif\n\n#ifdef ALPHA_TEST\n if (gl_FragColor.a < alphaCutoff) {\n discard;\n }\n#endif\n\n gl_FragColor = encodeHDR(gl_FragColor);\n\n}\n\n@end"},function(e,t){e.exports="@export qtek.compositor.blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\n\nvarying vec2 v_Texcoord;\n\n@import qtek.util.rgbm\n\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n\n gl_FragColor = encodeHDR(tex);\n}\n@end"},function(e,t){e.exports="@export qtek.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n\n@export qtek.compositor.kernel.gaussian_13\n\nfloat gaussianKernel[13];\n\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n\n@end\n\n\n@export qtek.compositor.gaussian_blur\n\n#define SHADER_NAME gaussian_blur\n\nuniform sampler2D texture; varying vec2 v_Texcoord;\n\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n\n@import qtek.util.rgbm\n@import qtek.util.clamp_sample\n\nvoid main (void)\n{\n @import qtek.compositor.kernel.gaussian_9\n\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n\n@end\n"},function(e,t){e.exports="@export qtek.compositor.bright\n\nuniform sampler2D texture;\n\nuniform float threshold : 1;\nuniform float scale : 1.0;\n\nuniform vec2 textureSize: [512, 512];\n\nvarying vec2 v_Texcoord;\n\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n\n@import qtek.util.rgbm\n\n\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\n\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n\n#endif\n\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n"},function(e,t){e.exports="@export qtek.compositor.downsample\n\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\n\nvarying vec2 v_Texcoord;\n\n@import qtek.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n\n@import qtek.util.clamp_sample\n\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n\n@end"},function(e,t){e.exports="@export qtek.compositor.fxaa\n\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec2 v_Texcoord;\n\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n\n@import qtek.util.rgbm\n\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n\n float lumaB = dot( rgbB, luma );\n\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n\n }\n else {\n\n gl_FragColor = vec4( rgbB, opacity );\n\n }\n}\n\n@end"},function(e,t){e.exports="@export qtek.compositor.hdr.composite\n\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\n\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\n\nvarying vec2 v_Texcoord;\n\n\n@import qtek.util.srgb\n\n\n\n\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n\n@import qtek.util.rgbm\n\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n\n texel.a = min(texel.a, 1.0);\n\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n texel.rgb *= exposureBias;\n\n texel.rgb = ACESToneMapping(texel.rgb);\n texel = linearTosRGB(texel);\n\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n\n gl_FragColor = encodeHDR(texel);\n\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n\n if (originalTexel.a <= 0.01) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n #ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n\n@end"},function(e,t){e.exports="\n@export qtek.compositor.lut\n\nvarying vec2 v_Texcoord;\n\nuniform sampler2D texture;\nuniform sampler2D lookup;\n\nvoid main()\n{\n\n vec4 tex = texture2D(texture, v_Texcoord);\n\n float blueColor = tex.b * 63.0;\n\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n\n@end"},function(e,t){e.exports="@export qtek.compositor.output\n\n#define OUTPUT_ALPHA\n\nvarying vec2 v_Texcoord;\n\nuniform sampler2D texture;\n\n@import qtek.util.rgbm\n\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n\n gl_FragColor.rgb = tex.rgb;\n\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n\n gl_FragColor = encodeHDR(gl_FragColor);\n\n #ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n\n@end"},function(e,t){e.exports="\n@export qtek.compositor.upsample\n\n#define HIGH_QUALITY\n\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\n\nuniform float sampleScale: 0.5;\n\nvarying vec2 v_Texcoord;\n\n@import qtek.util.rgbm\n\n@import qtek.util.clamp_sample\n\nvoid main()\n{\n\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n\n@end"},function(e,t){e.exports="\n@export qtek.compositor.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\nvarying vec2 v_Texcoord;\n\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n\n@end"},function(e,t){e.exports="vec3 calcAmbientSHLight(int idx, vec3 N) {\n int offset = 9 * idx;\n\n return ambientSHLightCoefficients[0]\n + ambientSHLightCoefficients[1] * N.x\n + ambientSHLightCoefficients[2] * N.y\n + ambientSHLightCoefficients[3] * N.z\n + ambientSHLightCoefficients[4] * N.x * N.z\n + ambientSHLightCoefficients[5] * N.z * N.y\n + ambientSHLightCoefficients[6] * N.y * N.x\n + ambientSHLightCoefficients[7] * (3.0 * N.z * N.z - 1.0)\n + ambientSHLightCoefficients[8] * (N.x * N.x - N.y * N.y);\n}"},function(e,t,r){var n=":unconfigurable;";e.exports=["@export qtek.header.directional_light","uniform vec3 directionalLightDirection[DIRECTIONAL_LIGHT_COUNT]"+n,"uniform vec3 directionalLightColor[DIRECTIONAL_LIGHT_COUNT]"+n,"@end","@export qtek.header.ambient_light","uniform vec3 ambientLightColor[AMBIENT_LIGHT_COUNT]"+n,"@end","@export qtek.header.ambient_sh_light","uniform vec3 ambientSHLightColor[AMBIENT_SH_LIGHT_COUNT]"+n,"uniform vec3 ambientSHLightCoefficients[AMBIENT_SH_LIGHT_COUNT * 9]"+n,r(223),"@end","@export qtek.header.ambient_cubemap_light","uniform vec3 ambientCubemapLightColor[AMBIENT_CUBEMAP_LIGHT_COUNT]"+n,"uniform samplerCube ambientCubemapLightCubemap[AMBIENT_CUBEMAP_LIGHT_COUNT]"+n,"uniform sampler2D ambientCubemapLightBRDFLookup[AMBIENT_CUBEMAP_LIGHT_COUNT]"+n,"@end","@export qtek.header.point_light","uniform vec3 pointLightPosition[POINT_LIGHT_COUNT]"+n,"uniform float pointLightRange[POINT_LIGHT_COUNT]"+n,"uniform vec3 pointLightColor[POINT_LIGHT_COUNT]"+n,"@end","@export qtek.header.spot_light","uniform vec3 spotLightPosition[SPOT_LIGHT_COUNT]"+n,"uniform vec3 spotLightDirection[SPOT_LIGHT_COUNT]"+n,"uniform float spotLightRange[SPOT_LIGHT_COUNT]"+n,"uniform float spotLightUmbraAngleCosine[SPOT_LIGHT_COUNT]"+n,"uniform float spotLightPenumbraAngleCosine[SPOT_LIGHT_COUNT]"+n,"uniform float spotLightFalloffFactor[SPOT_LIGHT_COUNT]"+n,"uniform vec3 spotLightColor[SPOT_LIGHT_COUNT]"+n,"@end"].join("\n")},function(e,t){e.exports="@export qtek.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\n\n#ifdef SHADOW_TRANSPARENT\nattribute vec2 texcoord : TEXCOORD_0;\n#endif\n\n@import qtek.chunk.skinning_header\n\nvarying vec4 v_ViewPosition;\n\n#ifdef SHADOW_TRANSPARENT\nvarying vec2 v_Texcoord;\n#endif\n\nvoid main(){\n\n vec3 skinnedPosition = position;\n\n#ifdef SKINNING\n\n @import qtek.chunk.skin_matrix\n\n skinnedPosition = (skinMatrixWS * vec4(position, 1.0)).xyz;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(skinnedPosition, 1.0);\n gl_Position = v_ViewPosition;\n\n#ifdef SHADOW_TRANSPARENT\n v_Texcoord = texcoord;\n#endif\n}\n@end\n\n@export qtek.sm.depth.fragment\n\nvarying vec4 v_ViewPosition;\n\n#ifdef SHADOW_TRANSPARENT\nvarying vec2 v_Texcoord;\n#endif\n\nuniform float bias : 0.001;\nuniform float slopeScale : 1.0;\n\n#ifdef SHADOW_TRANSPARENT\nuniform sampler2D transparentMap;\n#endif\n\n@import qtek.util.encode_float\n\nvoid main(){\n float depth = v_ViewPosition.z / v_ViewPosition.w;\n \n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n\n#ifdef SHADOW_TRANSPARENT\n if (texture2D(transparentMap, v_Texcoord).a <= 0.1) {\n gl_FragColor = encodeFloat(0.9999);\n return;\n }\n#endif\n\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n\n@export qtek.sm.debug_depth\n\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n\n@import qtek.util.decode_float\n\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n\n@end\n\n\n@export qtek.sm.distance.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\n\nattribute vec3 position : POSITION;\n\n@import qtek.chunk.skinning_header\n\nvarying vec3 v_WorldPosition;\n\nvoid main (){\n\n vec3 skinnedPosition = position;\n#ifdef SKINNING\n @import qtek.chunk.skin_matrix\n\n skinnedPosition = (skinMatrixWS * vec4(position, 1.0)).xyz;\n#endif\n\n gl_Position = worldViewProjection * vec4(skinnedPosition , 1.0);\n v_WorldPosition = (world * vec4(skinnedPosition, 1.0)).xyz;\n}\n\n@end\n\n@export qtek.sm.distance.fragment\n\nuniform vec3 lightPosition;\nuniform float range : 100;\n\nvarying vec3 v_WorldPosition;\n\n@import qtek.util.encode_float\n\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n\n@export qtek.plugin.shadow_map_common\n\n@import qtek.util.decode_float\n\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\n\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n\n return shadowContrib / 9.0;\n#endif\n}\n\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\n\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\n\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\n\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n\n@end\n\n\n\n@export qtek.plugin.compute_shadow_map\n\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT];\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT];\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT];\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1];\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE];\nuniform float directionalLightShadowMapSizes[1];\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE];\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE];\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT];\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT];\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT];\n#endif\n#endif\n\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT];\nuniform float pointLightShadowMapSizes[POINT_LIGHT_SHADOWMAP_COUNT];\n#endif\n\nuniform bool shadowEnabled : true;\n\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n\n@import qtek.plugin.shadow_map_common\n\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\n\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n\n#endif\n\n\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n\n#ifdef SHADOW_CASCADE\n\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n\n float shadowContrib;\n shadowContribs[0] = 1.0;\n\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n\n#else\n\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n\n#endif\n\n\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\n\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n\n#endif\n\n#endif\n\n@end"},function(e,t){e.exports="@export qtek.skybox.vertex\n\nuniform mat4 world : WORLD;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\n\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n\n@end\n\n@export qtek.skybox.fragment\n\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform float lod: 0.0;\n\nvarying vec3 v_WorldPosition;\n\n@import qtek.util.rgbm\n\nvoid main()\n{\n vec3 eyePos = viewInverse[3].xyz;\n vec3 viewDirection = normalize(v_WorldPosition - eyePos);\n\n vec3 tex = decodeHDR(textureCubeLodEXT(environmentMap, viewDirection, lod)).rgb;\n\n#ifdef SRGB_DECODE\n tex.rgb = pow(tex.rgb, vec3(2.2));\n#endif\n\n gl_FragColor = encodeHDR(vec4(tex, 1.0));\n}\n@end"},function(e,t){e.exports="\n@export qtek.util.rand\nhighp float rand(vec2 uv) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(uv.xy, vec2(a,b)), sn = mod(dt, 3.141592653589793);\n return fract(sin(sn) * c);\n}\n@end\n\n@export qtek.util.calculate_attenuation\n\nuniform float attenuationFactor : 5.0;\n\nfloat lightAttenuation(float dist, float range)\n{\n float attenuation = 1.0;\n attenuation = dist*dist/(range*range+1.0);\n float att_s = attenuationFactor;\n attenuation = 1.0/(attenuation*att_s+1.0);\n att_s = 1.0/(att_s+1.0);\n attenuation = attenuation - att_s;\n attenuation /= 1.0 - att_s;\n return clamp(attenuation, 0.0, 1.0);\n}\n\n@end\n\n@export qtek.util.edge_factor\n\nfloat edgeFactor(float width)\n{\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * width, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n\n@end\n\n@export qtek.util.encode_float\nvec4 encodeFloat(const in float depth)\n{\n \n \n const vec4 bitShifts = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\n const vec4 bit_mask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\n vec4 res = fract(depth * bitShifts);\n res -= res.xxyz * bit_mask;\n\n return res;\n}\n@end\n\n@export qtek.util.decode_float\nfloat decodeFloat(const in vec4 color)\n{\n \n \n const vec4 bitShifts = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);\n return dot(color, bitShifts);\n}\n@end\n\n\n@export qtek.util.float\n@import qtek.util.encode_float\n@import qtek.util.decode_float\n@end\n\n\n\n@export qtek.util.rgbm_decode\nvec3 RGBMDecode(vec4 rgbm, float range) {\n return range * rgbm.rgb * rgbm.a;\n }\n@end\n\n@export qtek.util.rgbm_encode\nvec4 RGBMEncode(vec3 color, float range) {\n if (dot(color, color) == 0.0) {\n return vec4(0.0);\n }\n vec4 rgbm;\n color /= range;\n rgbm.a = clamp(max(max(color.r, color.g), max(color.b, 1e-6)), 0.0, 1.0);\n rgbm.a = ceil(rgbm.a * 255.0) / 255.0;\n rgbm.rgb = color / rgbm.a;\n return rgbm;\n}\n@end\n\n@export qtek.util.rgbm\n@import qtek.util.rgbm_decode\n@import qtek.util.rgbm_encode\n\nvec4 decodeHDR(vec4 color)\n{\n#if defined(RGBM_DECODE) || defined(RGBM)\n return vec4(RGBMDecode(color, 51.5), 1.0);\n#else\n return color;\n#endif\n}\n\nvec4 encodeHDR(vec4 color)\n{\n#if defined(RGBM_ENCODE) || defined(RGBM)\n return RGBMEncode(color.xyz, 51.5);\n#else\n return color;\n#endif\n}\n\n@end\n\n\n@export qtek.util.srgb\n\nvec4 sRGBToLinear(in vec4 value) {\n return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.w);\n}\n\nvec4 linearTosRGB(in vec4 value) {\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\n}\n@end\n\n\n@export qtek.chunk.skinning_header\n#ifdef SKINNING\nattribute vec3 weight : WEIGHT;\nattribute vec4 joint : JOINT;\n\n#ifdef USE_SKIN_MATRICES_TEXTURE\nuniform sampler2D skinMatricesTexture;\nuniform float skinMatricesTextureSize: unconfigurable;\nmat4 getSkinMatrix(float idx) {\n float j = idx * 4.0;\n float x = mod(j, skinMatricesTextureSize);\n float y = floor(j / skinMatricesTextureSize) + 0.5;\n vec2 scale = vec2(skinMatricesTextureSize);\n\n return mat4(\n texture2D(skinMatricesTexture, vec2(x + 0.5, y) / scale),\n texture2D(skinMatricesTexture, vec2(x + 1.5, y) / scale),\n texture2D(skinMatricesTexture, vec2(x + 2.5, y) / scale),\n texture2D(skinMatricesTexture, vec2(x + 3.5, y) / scale)\n );\n}\n#else\nuniform mat4 skinMatrix[JOINT_COUNT] : SKIN_MATRIX;\nmat4 getSkinMatrix(float idx) {\n return skinMatrix[int(idx)];\n}\n#endif\n\n#endif\n\n@end\n\n@export qtek.chunk.skin_matrix\n\nmat4 skinMatrixWS;\nif (weight.x > 1e-4)\n{\n skinMatrixWS = getSkinMatrix(joint.x) * weight.x;\n}\nif (weight.y > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-3)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n\n\n\n@export qtek.util.parallax_correct\n\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n\n return normalize(fixedPos - boxCenter);\n}\n\n@end\n\n\n\n@export qtek.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end"},function(e,t,r){var n=r(5),i=r(23),a=r(6),o=r(10),s=r(12),u=r(16),h=r(7),l=r(57),c=r(26),d=r(59),f=r(20),p=r(47),_=r(232),m=r(233),g={},v=["px","nx","py","ny","pz","nz"];g.prefilterEnvironmentMap=function(e,t,r,s,_){_&&s||(s=g.generateNormalDistribution(),_=g.integrateBRDF(e,s)),r=r||{};var y=r.width||64,x=r.height||64,T=r.type||t.type,b=new i({width:y,height:x,type:T,flipY:!1,mipmaps:[]});b.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var w=Math.min(y,x),E=Math.log(w)/Math.log(2)+1,S=new u({shader:new h({vertex:h.source("qtek.skybox.vertex"),fragment:m})});S.set("normalDistribution",s),r.encodeRGBM&&S.shader.define("fragment","RGBM_ENCODE"),r.decodeRGBM&&S.shader.define("fragment","RGBM_DECODE");var A,M=new c;if(t instanceof n){var N=new i({width:y,height:x,type:T===a.FLOAT?a.HALF_FLOAT:T});p.panoramaToCubeMap(e,t,N,{encodeRGBM:r.decodeRGBM}),t=N}A=new l({scene:M,material:S}),A.material.set("environmentMap",t);var C=new d({texture:b});r.encodeRGBM&&(T=b.type=a.UNSIGNED_BYTE);for(var L=new n({width:y,height:x,type:T}),D=new o({depthBuffer:!1}),I=f[T===a.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],R=0;R>>16)>>>0;u=((1431655765&u)<<1|(2863311530&u)>>>1)>>>0,u=((858993459&u)<<2|(3435973836&u)>>>2)>>>0,u=((252645135&u)<<4|(4042322160&u)>>>4)>>>0,u=(((16711935&u)<<8|(4278255360&u)>>>8)>>>0)/4294967296;for(var h=0;h0){var i=Math.pow(2,e[3]-128-8+n);t[r+0]=e[0]*i,t[r+1]=e[1]*i,t[r+2]=e[2]*i}else t[r+0]=0,t[r+1]=0,t[r+2]=0;return t[r+3]=1,t}function i(e,t,r){for(var n="",i=t;i0;)if(e[o][0]=t[r++],e[o][1]=t[r++],e[o][2]=t[r++],e[o][3]=t[r++],1===e[o][0]&&1===e[o][1]&&1===e[o][2]){for(var u=e[o][3]<>>0;u>0;u--)a(e[o-1],e[o]),o++,s--;i+=8}else o++,s--,i=0;return r}function s(e,t,r,n){if(nd)return o(e,t,r,n);var i=t[r++];if(2!=i)return o(e,t,r-1,n);if(e[0][1]=t[r++],e[0][2]=t[r++],i=t[r++],(e[0][2]<<8>>>0|i)>>>0!==n)return null;for(var i=0;i<4;i++)for(var a=0;a128){s=(127&s)>>>0;for(var u=t[r++];s--;)e[a++][i]=u}else for(;s--;)e[a++][i]=t[r++]}return r}var u=r(6),h=r(5),l=String.fromCharCode,c=8,d=32767,f={parseRGBE:function(e,t,r){null==r&&(r=0);var a=new Uint8Array(e),o=a.length;if("#?"===i(a,0,2)){for(var c=2;c=o)){c+=2;for(var d="";c 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"},function(e,t){e.exports="#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\n\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\n\nuniform float roughness : 0.5;\n\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n\nconst float fSampleNumber = float(SAMPLE_NUMBER);\n\n@import qtek.util.rgbm\n\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n\n vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n vec3 tangentX = normalize(cross(upVector, N));\n vec3 tangentY = cross(N, tangentX);\n return tangentX * H.x + tangentY * H.y + N * H.z;\n}\n\nvoid main() {\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n\n vec3 N = V;\n vec3 R = V;\n\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n\n\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"},function(e,t){e.exports="uniform samplerCube environmentMap;\n\nvarying vec2 v_Texcoord;\n\n#define TEXTURE_SIZE 16\n\nmat3 front = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n);\n\nmat3 back = mat3(\n -1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, -1.0\n);\n\nmat3 left = mat3(\n 0.0, 0.0, -1.0,\n 0.0, 1.0, 0.0,\n 1.0, 0.0, 0.0\n);\n\nmat3 right = mat3(\n 0.0, 0.0, 1.0,\n 0.0, 1.0, 0.0,\n -1.0, 0.0, 0.0\n);\n\nmat3 up = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 0.0, 1.0,\n 0.0, -1.0, 0.0\n);\n\nmat3 down = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 0.0, -1.0,\n 0.0, 1.0, 0.0\n);\n\n\nfloat harmonics(vec3 normal){\n int index = int(gl_FragCoord.x);\n\n float x = normal.x;\n float y = normal.y;\n float z = normal.z;\n\n if(index==0){\n return 1.0;\n }\n else if(index==1){\n return x;\n }\n else if(index==2){\n return y;\n }\n else if(index==3){\n return z;\n }\n else if(index==4){\n return x*z;\n }\n else if(index==5){\n return y*z;\n }\n else if(index==6){\n return x*y;\n }\n else if(index==7){\n return 3.0*z*z - 1.0;\n }\n else{\n return x*x - y*y;\n }\n}\n\nvec3 sampleSide(mat3 rot)\n{\n\n vec3 result = vec3(0.0);\n float divider = 0.0;\n for (int i = 0; i < TEXTURE_SIZE * TEXTURE_SIZE; i++) {\n float x = mod(float(i), float(TEXTURE_SIZE));\n float y = float(i / TEXTURE_SIZE);\n\n vec2 sidecoord = ((vec2(x, y) + vec2(0.5, 0.5)) / vec2(TEXTURE_SIZE)) * 2.0 - 1.0;\n vec3 normal = normalize(vec3(sidecoord, -1.0));\n vec3 fetchNormal = rot * normal;\n vec3 texel = textureCube(environmentMap, fetchNormal).rgb;\n\n result += harmonics(fetchNormal) * texel * -normal.z;\n\n divider += -normal.z;\n }\n\n return result / divider;\n}\n\nvoid main()\n{\n vec3 result = (\n sampleSide(front) +\n sampleSide(back) +\n sampleSide(left) +\n sampleSide(right) +\n sampleSide(up) +\n sampleSide(down)\n ) / 6.0;\n gl_FragColor = vec4(result, 1.0);\n}"},function(e,t){e.exports="0.4.3"},function(e,t,r){function n(e,t){return e[t]}function i(e,t,r){e[t]=r}function a(e,t,r){return(t-e)*r+e}function o(e,t,r){return r>.5?t:e}function s(e,t,r,n,i){var o=e.length;if(1==i)for(var s=0;si)e.length=i;else for(var a=n;a=0&&!(N[r]<=t);r--);r=Math.min(r,T-2)}else{for(r=H;rt);r++);r=Math.min(r-1,T-2)}H=r,V=t;var n=N[r+1]-N[r];if(0!==n)if(B=(t-N[r])/n,x)if(z=C[r],U=C[0===r?r:r-1],G=C[r>T-2?T-1:r+1],k=C[r>T-3?T-1:r+2],E)l(U,z,G,k,B,B*B,B*B*B,_(e,i),M);else{var u;if(S)u=l(U,z,G,k,B,B*B,B*B*B,W,1),u=f(W);else{if(A)return o(z,G,B);u=c(U,z,G,k,B,B*B,B*B*B)}v(e,i,u)}else if(E)s(C[r],C[r+1],B,_(e,i),M);else{var u;if(S)s(C[r],C[r+1],B,W,1),u=f(W);else{if(A)return o(C[r],C[r+1],B);u=a(C[r],C[r+1],B)}v(e,i,u)}},X=new m({target:e._target,life:b,loop:e._loop,delay:e._delay,onframe:q,ondestroy:r});return t&&"spline"!==t&&(X.easing=t),X}}}var m=r(237),g=r(244),v=r(15),y=v.isArrayLike,x=Array.prototype.slice,T=function(e,t,r,a){this._tracks={},this._target=e,this._loop=t||!1,this._getter=r||n,this._setter=a||i,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};T.prototype={when:function(e,t){var r=this._tracks;for(var n in t)if(t.hasOwnProperty(n)){if(!r[n]){r[n]=[];var i=this._getter(this._target,n);if(null==i)continue;0!==e&&r[n].push({time:0,value:d(i)})}r[n].push({time:e,value:t[n]})}return this},during:function(e){return this._onframeList.push(e),this},pause:function(){for(var e=0;et+s&&o>n+s||oe+s&&a>r+s||aS&&(E=0,w={}),E++,w[r]=i,i}function i(e,t,r,n,i,s,u){return s?o(e,t,r,n,i,s,u):a(e,t,r,n,i,u)}function a(e,t,r,i,a,o){var h=m(e,t,a,o),l=n(e,t);a&&(l+=a[1]+a[3]);var c=h.outerHeight,d=s(0,l,r),f=u(0,c,i),p=new T(d,f,l,c);return p.lineHeight=h.lineHeight,p}function o(e,t,r,n,i,a,o){var h=g(e,{rich:a,truncate:o,font:t,textAlign:r,textPadding:i}),l=h.outerWidth,c=h.outerHeight,d=s(0,l,r),f=u(0,c,n);return new T(d,f,l,c)}function s(e,t,r){return"right"===r?e-=t:"center"===r&&(e-=t/2),e}function u(e,t,r){return"middle"===r?e-=t/2:"bottom"===r&&(e-=t),e}function h(e,t,r){var n=t.x,i=t.y,a=t.height,o=t.width,s=a/2,u="left",h="top";switch(e){case"left":n-=r,i+=s,u="right",h="middle";break;case"right":n+=r+o,i+=s,h="middle";break;case"top":n+=o/2,i-=r,u="center",h="bottom";break;case"bottom":n+=o/2,i+=a+r,u="center";break;case"inside":n+=o/2,i+=s,u="center",h="middle";break;case"insideLeft":n+=r,i+=s,h="middle";break;case"insideRight":n+=o-r,i+=s,u="right",h="middle";break;case"insideTop":n+=o/2,i+=r,u="center";break;case"insideBottom":n+=o/2,i+=a-r,u="center",h="bottom";break;case"insideTopLeft":n+=r,i+=r;break;case"insideTopRight":n+=o-r,i+=r,u="right";break;case"insideBottomLeft":n+=r,i+=a-r,h="bottom";break;case"insideBottomRight":n+=o-r,i+=a-r,u="right",h="bottom"}return{x:n,y:i,textAlign:u,textVerticalAlign:h}}function l(e,t,r,n,i){if(!t)return"";var a=(e+"").split("\n");i=c(t,r,n,i);for(var o=0,s=a.length;o=o;u++)s-=o;var h=n(r);return h>s&&(r="",h=0),s=e-h,i.ellipsis=r,i.ellipsisWidth=h,i.contentWidth=s,i.containerWidth=e,i}function d(e,t){var r=t.containerWidth,i=t.font,a=t.contentWidth;if(!r)return"";var o=n(e,i);if(o<=r)return e;for(var s=0;;s++){if(o<=a||s>=t.maxIterations){e+=t.ellipsis;break}var u=0===s?f(e,a,t.ascCharWidth,t.cnCharWidth):o>0?Math.floor(e.length*a/o):0;e=e.substr(0,u),o=n(e,i)}return""===e&&(e=t.placeholder),e}function f(e,t,r,n){for(var i=0,a=0,o=e.length;au)e="",a=[];else if(null!=h)for(var l=c(h-(r?r[1]+r[3]:0),t,n.ellipsis,{minChar:n.minChar,placeholder:n.placeholder}),f=0,_=a.length;f<_;f++)a[f]=d(a[f],l)}return{lines:a,height:o,outerHeight:s,lineHeight:i}}function g(e,t){var r={lines:[],width:0,height:0};if(null!=e&&(e+=""),!e)return r;for(var n,i=A.lastIndex=0;null!=(n=A.exec(e));){var a=n.index;a>i&&v(r,e.substring(i,a)),v(r,n[2],n[1]),i=A.lastIndex}ip)return{lines:[],width:0,height:0};T.textWidth=L.getWidth(T.text,S);var D=w.textWidth,I=null==D||"auto"===D;if("string"==typeof D&&"%"===D.charAt(D.length-1))T.percentWidth=D,h.push(T),D=0;else{if(I){D=T.textWidth;var R=w.textBackgroundColor,P=R&&R.image;P&&(P=b.findExistImage(P),b.isImageReady(P)&&(D=Math.max(D,P.width*M/P.height)))}var O=E?E[1]+E[3]:0;D+=O;var F=null!=f?f-y:null;null!=F&&F255?255:e}function i(e){return e=Math.round(e),e<0?0:e>360?360:e}function a(e){return e<0?0:e>1?1:e}function o(e){return n(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100*255:parseInt(e,10))}function s(e){return a(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100:parseFloat(e))}function u(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function h(e,t,r){return e+(t-e)*r}function l(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function d(e,t){A&&c(A,t),A=S.put(e,A||t.slice())}function f(e,t){if(e){t=t||[];var r=S.get(e);if(r)return c(t,r);e+="";var n=e.replace(/ /g,"").toLowerCase();if(n in E)return c(t,E[n]),d(e,t),t;if("#"!==n.charAt(0)){var i=n.indexOf("("),a=n.indexOf(")");if(-1!==i&&a+1===n.length){var u=n.substr(0,i),h=n.substr(i+1,a-(i+1)).split(","),f=1;switch(u){case"rgba":if(4!==h.length)return void l(t,0,0,0,1);f=s(h.pop());case"rgb":return 3!==h.length?void l(t,0,0,0,1):(l(t,o(h[0]),o(h[1]),o(h[2]),f),d(e,t),t);case"hsla":return 4!==h.length?void l(t,0,0,0,1):(h[3]=s(h[3]),p(h,t),d(e,t),t);case"hsl":return 3!==h.length?void l(t,0,0,0,1):(p(h,t),d(e,t),t);default:return}}l(t,0,0,0,1)}else{if(4===n.length){var _=parseInt(n.substr(1),16);return _>=0&&_<=4095?(l(t,(3840&_)>>4|(3840&_)>>8,240&_|(240&_)>>4,15&_|(15&_)<<4,1),d(e,t),t):void l(t,0,0,0,1)}if(7===n.length){var _=parseInt(n.substr(1),16);return _>=0&&_<=16777215?(l(t,(16711680&_)>>16,(65280&_)>>8,255&_,1),d(e,t),t):void l(t,0,0,0,1)}}}}function p(e,t){var r=(parseFloat(e[0])%360+360)%360/360,i=s(e[1]),a=s(e[2]),o=a<=.5?a*(i+1):a+i-a*i,h=2*a-o;return t=t||[],l(t,n(255*u(h,o,r+1/3)),n(255*u(h,o,r)),n(255*u(h,o,r-1/3)),1),4===e.length&&(t[3]=e[3]),t}function _(e){if(e){var t,r,n=e[0]/255,i=e[1]/255,a=e[2]/255,o=Math.min(n,i,a),s=Math.max(n,i,a),u=s-o,h=(s+o)/2;if(0===u)t=0,r=0;else{r=h<.5?u/(s+o):u/(2-s-o);var l=((s-n)/6+u/2)/u,c=((s-i)/6+u/2)/u,d=((s-a)/6+u/2)/u;n===s?t=d-c:i===s?t=1/3+l-d:a===s&&(t=2/3+c-l),t<0&&(t+=1),t>1&&(t-=1)}var f=[360*t,r,h];return null!=e[3]&&f.push(e[3]),f}}function m(e,t){var r=f(e);if(r){for(var n=0;n<3;n++)r[n]=t<0?r[n]*(1-t)|0:(255-r[n])*t+r[n]|0;return b(r,4===r.length?"rgba":"rgb")}}function g(e,t){var r=f(e);if(r)return((1<<24)+(r[0]<<16)+(r[1]<<8)+ +r[2]).toString(16).slice(1)}function v(e,t,r){if(t&&t.length&&e>=0&&e<=1){r=r||[];var i=e*(t.length-1),o=Math.floor(i),s=Math.ceil(i),u=t[o],l=t[s],c=i-o;return r[0]=n(h(u[0],l[0],c)),r[1]=n(h(u[1],l[1],c)),r[2]=n(h(u[2],l[2],c)),r[3]=a(h(u[3],l[3],c)),r}}function y(e,t,r){if(t&&t.length&&e>=0&&e<=1){var i=e*(t.length-1),o=Math.floor(i),s=Math.ceil(i),u=f(t[o]),l=f(t[s]),c=i-o,d=b([n(h(u[0],l[0],c)),n(h(u[1],l[1],c)),n(h(u[2],l[2],c)),a(h(u[3],l[3],c))],"rgba");return r?{color:d,leftIndex:o,rightIndex:s,value:i}:d}}function x(e,t,r,n){if(e=f(e))return e=_(e),null!=t&&(e[0]=i(t)),null!=r&&(e[1]=s(r)),null!=n&&(e[2]=s(n)),b(p(e),"rgba")}function T(e,t){if((e=f(e))&&null!=t)return e[3]=a(t),b(e,"rgba")}function b(e,t){if(e&&e.length){var r=e[0]+","+e[1]+","+e[2];return"rgba"!==t&&"hsva"!==t&&"hsla"!==t||(r+=","+e[3]),t+"("+r+")"}}var w=r(60),E={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},S=new w(20),A=null;e.exports={parse:f,lift:m,toHex:g,fastMapToColor:v,mapToColor:y,modifyHSL:x,modifyAlpha:T,stringify:b}}])});