(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0bf7ec9a"],{"1d01":function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return c})),n.d(t,"d",(function(){return s}));Number.POSITIVE_INFINITY;const i=Math.PI,o=128/i,a=256/360,r=1/Math.LN2;function l(e,t){return(e%=t)>=0?e:e+t}function s(e){return l(e*o,256)}function u(e){return l(e*a,256)}function c(e){return Math.log(e)*r}function f(e,t,n){return e>=t&&e<=n||e>=n&&e<=t}},"21c1":function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var i=n("be90");const o={shaders:{vertexShader:Object(i["a"])("background/background.vert"),fragmentShader:Object(i["a"])("background/background.frag")},attributes:new Map([["a_pos",0]])}},"3b1a":function(e,t,n){"use strict";n.d(t,"a",(function(){return ie})),n.d(t,"b",(function(){return oe}));var i=n("c9ee"),o=n("f440"),a=n("823a"),r=n("f079"),l=n("d17d"),s=n("beba");class u extends r["a"]{constructor(){super(...arguments),this._desc={lut:{vsPath:"raster/lut",fsPath:"raster/lut",attributes:new Map([["a_position",0],["a_texcoord",1]])},stretch:{vsPath:"raster/stretch",fsPath:"raster/stretch",attributes:new Map([["a_position",0],["a_texcoord",1]])},hillshade:{vsPath:"raster/hillshade",fsPath:"raster/hillshade",attributes:new Map([["a_position",0],["a_texcoord",1]])}},this._rendererUniformInfos=new Map}dispose(){this._quad&&this._quad.dispose()}prepareState({context:e},t){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(l["b"].ONE,l["b"].ONE_MINUS_SRC_ALPHA,l["b"].ONE,l["b"].ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilFunction(l["h"].EQUAL,t.stencilRef,255)}draw(e,t){var n;if(!Object(o["b"])(t)||t.suspended)return;e.timeline.begin(this.name);const i=!(null!=(n=e.context.capabilities.textureFloat)&&n.textureFloatLinear);t.updateTexture(e);const a=this._getShaderVariations(t,i),r=e.painter.materialManager.getProgram(e,this._desc[t.symbolizerParameters.type],a);this._drawWithProgram(e.context,r,t),e.timeline.end(this.name)}_drawWithProgram(e,t,n,i=1,o=[0,0],r=!1){this._quad||(this._quad=new a["a"](e,[0,0,1,0,0,1,1,1]));const{symbolizerParameters:l,transformGrid:u,width:c,height:f,opacity:d}=n,m=l.type;e.useProgram(t);const _=this._getShaderVariations(n),v=this._getUniformInfos(m,e,t,_),{names:p,textures:h}=n.getTextures();Object(s["j"])(e,t,p,h);const g=Object(s["d"])(i,o),x=Object(s["f"])(u,[c,f],[n.source.width,n.source.height],d,r);if(Object(s["k"])(t,v,{u_coordScale:n.coordScale,u_dvsMat3:n.transforms.dvs,...g,...x}),l.colormap){const{colormap:e,colormapOffset:n}=l,i=Object(s["e"])(e,n);Object(s["k"])(t,v,i)}if("stretch"===l.type){const e=Object(s["h"])(l);Object(s["k"])(t,v,e)}else if("hillshade"===l.type){const e=Object(s["g"])(l);Object(s["k"])(t,v,e)}this._quad.draw()}_getUniformInfos(e,t,n,i){const o=i.length>0?e+"-"+i.join("-"):e;if(this._rendererUniformInfos.has(o))return this._rendererUniformInfos.get(o);const a=Object(s["i"])(t,n);return this._rendererUniformInfos.set(o,a),a}_getShaderVariations(e,t=!1){const n=[],{interpolation:i}=e,{type:o,colormap:a}=e.symbolizerParameters;return"cubic"===i?n.push("bicubic"):"bilinear"===i&&"stretch"===o&&null!=a?(n.push("bilinear"),n.push("nnedge")):t&&"bilinear"===i&&n.push("bilinear"),e.isRendereredSource?n.push("noop"):a&&n.push("applyColormap"),e.transformGrid&&(n.push("applyProjection"),1===e.transformGrid.spacing[0]&&n.push("lookupProjection")),n}}var c=n("3bc3"),f=n("8c81");const d={nearest:{defines:[],samplingMode:l["z"].NEAREST,mips:!1},bilinear:{defines:[],samplingMode:l["z"].LINEAR,mips:!1},bicubic:{defines:["bicubic"],samplingMode:l["z"].LINEAR,mips:!1},trilinear:{defines:[],samplingMode:l["z"].LINEAR_MIPMAP_LINEAR,mips:!0}},m=(e,t,n)=>{if("dynamic"===n.samplingMode){const{state:n}=e,i=t.resolution/t.pixelRatio/n.resolution,o=Math.round(e.pixelRatio)!==e.pixelRatio,a=i>1.05||i<.95;return n.rotation||a||o||t.isSourceScaled||t.rotation?d.bilinear:d.nearest}return d[n.samplingMode]};class _ extends r["a"]{constructor(){super(...arguments),this._desc={vsPath:"raster/bitmap",fsPath:"raster/bitmap",attributes:new Map([["a_position",0],["a_texcoord",1]])}}dispose(){this._quad&&this._quad.dispose()}prepareState({context:e},t){e.setBlendingEnabled(!0),"additive"===t.blendFunction?e.setBlendFunctionSeparate(l["b"].ONE,l["b"].ONE,l["b"].ONE,l["b"].ONE):e.setBlendFunctionSeparate(l["b"].ONE,l["b"].ONE_MINUS_SRC_ALPHA,l["b"].ONE,l["b"].ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilFunction(l["h"].EQUAL,t.stencilRef,255)}draw(e,t){const{context:n,renderingOptions:i,painter:o}=e;if(!t.source)return;e.timeline.begin(this.name),this._quad||(this._quad=new a["a"](n,[0,0,1,0,0,1,1,1]));const r=m(e,t,i),l=o.materialManager.getProgram(e,this._desc,r.defines),{coordScale:s,computedOpacity:u,transforms:c}=t;t.setSamplingProfile(r),t.bind(e.context,f["F"]),n.useProgram(l),l.setUniformMatrix3fv("u_dvsMat3",c.dvs),l.setUniform1i("u_texture",f["F"]),l.setUniform2fv("u_coordScale",s),l.setUniform1f("u_opacity",u),this._quad.draw(),e.timeline.end(this.name)}}var v=n("b2b2"),p=n("5ef2"),h=n("c8dd"),g=n("21c1"),x=n("681f");const b=()=>Object(h["g"])("clip",{geometry:[{location:0,name:"a_pos",count:2,type:l["k"].SHORT}]});class y extends r["a"]{constructor(){super(...arguments),this._color=Object(p["c"])(0,1,0,1)}dispose(){this._program&&this._program.dispose()}prepareState({context:e}){e.setStencilTestEnabled(!0),e.setBlendingEnabled(!1),e.setFaceCullingEnabled(!1),e.setColorMask(!1,!1,!1,!1),e.setStencilOp(l["w"].KEEP,l["w"].KEEP,l["w"].REPLACE),e.setStencilWriteMask(255),e.setStencilFunction(l["h"].ALWAYS,0,255)}draw(e,t){const{context:n,state:i}=e,o=b(),a=t.getVAO(n,i,o.attributes,o.bufferLayouts);Object(v["j"])(a.indexBuffer)||(this._program||(this._program=Object(x["a"])(n,g["a"])),n.useProgram(this._program),this._program.setUniform2fv("u_coord_range",[1,1]),this._program.setUniform4fv("u_color",this._color),this._program.setUniformMatrix3fv("u_dvsMat3",i.displayMat3),n.bindVAO(a),n.drawElements(l["r"].TRIANGLES,a.indexBuffer.size,l["k"].UNSIGNED_INT,0),n.bindVAO())}}var T=n("6f75"),S=n("ec5e"),C=n("38a4"),O=n("8c71"),I=n("c84e"),E=n("d114"),A=n("7ce4"),P=n("0fa6");class D extends r["a"]{constructor(){super(...arguments),this._color=Object(p["c"])(1,0,0,1),this._patternMatrix=Object(O["b"])(),this._programOptions={id:!1,pattern:!1}}dispose(){this._vao&&(this._vao.dispose(),this._vao=null)}drawMany(e,t){const{context:n,painter:i,styleLayerUID:o}=e;this._loadWGLResources(e);const a=e.displayLevel,r=e.styleLayer,s=r.backgroundMaterial,u=i.vectorTilesMaterialManager,c=r.getPaintValue("background-color",a),d=r.getPaintValue("background-opacity",a),m=r.getPaintValue("background-pattern",a),_=void 0!==m,p=c[3]*d,h=1|window.devicePixelRatio,g=e.spriteMosaic;let x,b;const y=h>f["Q"]?2:1,T=e.drawPhase===I["c"].HITTEST,S=this._programOptions;S.id=T,S.pattern=_;const O=u.getMaterialProgram(n,s,S);if(n.bindVAO(this._vao),n.useProgram(O),_){const e=g.getMosaicItemPosition(m,!0);if(Object(v["k"])(e)){const{tl:t,br:i,page:o}=e;x=i[0]-t[0],b=i[1]-t[1];const a=g.getPageSize(o);Object(v["k"])(a)&&(g.bind(n,l["z"].LINEAR,o,f["S"]),O.setUniform4f("u_tlbr",t[0],t[1],i[0],i[1]),O.setUniform2fv("u_mosaicSize",a),O.setUniform1i("u_texture",f["S"]))}O.setUniform1f("u_opacity",d)}else this._color[0]=p*c[0],this._color[1]=p*c[1],this._color[2]=p*c[2],this._color[3]=p,O.setUniform4fv("u_color",this._color);if(O.setUniform1f("u_depth",r.z||0),T){const e=Object(E["c"])(o+1);O.setUniform4fv("u_id",e)}for(const f of t){if(O.setUniform1f("u_coord_range",f.rangeX),O.setUniformMatrix3fv("u_dvsMat3",f.transforms.dvs),_){const e=Math.max(2**(Math.round(a)-f.key.level),1),t=y*f.width*e,n=t/Object(C["o"])(x),i=t/Object(C["o"])(b);this._patternMatrix[0]=n,this._patternMatrix[4]=i,O.setUniformMatrix3fv("u_pattern_matrix",this._patternMatrix)}n.setStencilFunction(l["h"].EQUAL,f.stencilRef,255),n.drawArrays(l["r"].TRIANGLE_STRIP,0,4)}}_loadWGLResources(e){if(this._vao)return;const{context:t,styleLayer:n}=e,i=n.backgroundMaterial,o=new Int8Array([0,0,1,0,0,1,1,1]),a=A["a"].createVertex(t,l["D"].STATIC_DRAW,o),r=new P["a"](t,i.getAttributeLocations(),i.getLayoutInfo(),{geometry:a});this._vao=r}}var w=n("ef89");class R extends r["a"]{constructor(){super(...arguments),this._programOptions={id:!1}}dispose(){}drawMany(e,t){const{context:n,displayLevel:i,requiredLevel:o,state:a,drawPhase:r,painter:s,spriteMosaic:u,styleLayerUID:c}=e;if(!t.some(e=>{var t,n;return null!=(t=null==(n=e.layerData.get(c))?void 0:n.circleIndexCount)&&t}))return;const f=e.styleLayer,d=f.circleMaterial,m=s.vectorTilesMaterialManager,_=1.2,p=f.getPaintValue("circle-translate",i),h=f.getPaintValue("circle-translate-anchor",i),g=r===I["c"].HITTEST,x=this._programOptions;x.id=g;const b=m.getMaterialProgram(n,d,x);n.useProgram(b),b.setUniformMatrix3fv("u_displayMat3",h===w["i"].VIEWPORT?a.displayMat3:a.displayViewMat3),b.setUniform2fv("u_circleTranslation",p),b.setUniform1f("u_depth",f.z),b.setUniform1f("u_antialiasingWidth",_);let y=-1;if(g){const e=Object(E["c"])(c+1);b.setUniform4fv("u_id",e)}for(const T of t){if(!T.layerData.has(c))continue;T.key.level!==y&&(y=T.key.level,d.setDataUniforms(b,i,f,y,u));const e=T.layerData.get(c);if(!e.circleIndexCount)continue;e.prepareForRendering(n);const t=e.circleVertexArrayObject;Object(v["j"])(t)||(n.bindVAO(t),b.setUniformMatrix3fv("u_dvsMat3",T.transforms.dvs),o!==T.key.level?n.setStencilFunction(l["h"].EQUAL,T.stencilRef,255):n.setStencilFunction(l["h"].GREATER,255,255),n.drawElements(l["r"].TRIANGLES,e.circleIndexCount,l["k"].UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*e.circleIndexStart),T.triangleCount+=e.circleIndexCount/3)}}}const M=1/65536;class L extends r["a"]{constructor(){super(...arguments),this._fillProgramOptions={id:!1,pattern:!1},this._outlineProgramOptions={id:!1}}dispose(){}drawMany(e,t){const{displayLevel:n,drawPhase:i,renderPass:o,spriteMosaic:a,styleLayerUID:r}=e;let l=!1;for(const b of t)if(b.layerData.has(r)){const e=b.layerData.get(r);if(e.fillIndexCount>0||e.outlineIndexCount>0){l=!0;break}}if(!l)return;const s=e.styleLayer,u=s.getPaintProperty("fill-pattern"),c=void 0!==u,f=c&&u.isDataDriven;let d;if(c&&!f){const e=u.getValue(n);d=a.getMosaicItemPosition(e,!0)}const m=!c&&s.getPaintValue("fill-antialias",n);let _,v=!0,p=1;if(!c){const e=s.getPaintProperty("fill-color"),t=s.getPaintProperty("fill-opacity");if(!(null!=e&&e.isDataDriven||null!=t&&t.isDataDriven)){const e=s.getPaintValue("fill-color",n);p=s.getPaintValue("fill-opacity",n)*e[3],p>=1&&(v=!1)}}if(v&&"opaque"===o)return;i===I["c"].HITTEST&&(_=Object(E["c"])(r+1));const h=s.getPaintValue("fill-translate",n),g=s.getPaintValue("fill-translate-anchor",n);(v||"translucent"!==o)&&this._drawFill(e,r,s,t,h,g,c,d,f,_);const x=!s.hasDataDrivenOutlineColor&&s.outlineUsesFillColor&&p<1;m&&"opaque"!==o&&!x&&this._drawOutline(e,r,s,t,h,g,_)}_drawFill(e,t,n,i,o,a,r,s,u,c){if(r&&!u&&Object(v["j"])(s))return;const{context:d,displayLevel:m,state:_,drawPhase:p,painter:h,pixelRatio:g,spriteMosaic:x}=e,b=n.fillMaterial,y=h.vectorTilesMaterialManager,T=g>f["Q"]?2:1,S=p===I["c"].HITTEST,C=this._fillProgramOptions;C.id=S,C.pattern=r;const O=y.getMaterialProgram(d,b,C);if(d.useProgram(O),Object(v["k"])(s)){const{page:e}=s,t=x.getPageSize(e);Object(v["k"])(t)&&(x.bind(d,l["z"].LINEAR,e,f["S"]),O.setUniform2fv("u_mosaicSize",t),O.setUniform1i("u_texture",f["S"]))}O.setUniformMatrix3fv("u_displayMat3",a===w["i"].VIEWPORT?_.displayMat3:_.displayViewMat3),O.setUniform2fv("u_fillTranslation",o),O.setUniform1f("u_depth",n.z+M),S&&O.setUniform4fv("u_id",c);let E=-1;for(const I of i){if(!I.layerData.has(t))continue;I.key.level!==E&&(E=I.key.level,b.setDataUniforms(O,m,n,E,x));const e=I.layerData.get(t);if(!e.fillIndexCount)continue;e.prepareForRendering(d);const i=e.fillVertexArrayObject;if(!Object(v["j"])(i)){if(d.bindVAO(i),O.setUniformMatrix3fv("u_dvsMat3",I.transforms.dvs),d.setStencilFunction(l["h"].EQUAL,I.stencilRef,255),r){const e=Math.max(2**(Math.round(m)-I.key.level),1),t=I.rangeX/(T*I.width*e);O.setUniform1f("u_patternFactor",t)}if(u){const t=e.patternMap;if(!t)continue;for(const[e,n]of t){const t=x.getPageSize(e);Object(v["k"])(t)&&(x.bind(d,l["z"].LINEAR,e,f["S"]),O.setUniform2fv("u_mosaicSize",t),O.setUniform1i("u_texture",f["S"]),d.drawElements(l["r"].TRIANGLES,n[1],l["k"].UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*n[0]))}}else d.drawElements(l["r"].TRIANGLES,e.fillIndexCount,l["k"].UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*e.fillIndexStart);I.triangleCount+=e.fillIndexCount/3}}}_drawOutline(e,t,n,i,o,a,r){const{context:s,displayLevel:u,state:c,drawPhase:f,painter:d,pixelRatio:m,spriteMosaic:_}=e,p=n.outlineMaterial,h=d.vectorTilesMaterialManager,g=.75/m,x=f===I["c"].HITTEST,b=this._outlineProgramOptions;b.id=x;const y=h.getMaterialProgram(s,p,b);s.useProgram(y),y.setUniformMatrix3fv("u_displayMat3",a===w["i"].VIEWPORT?c.displayMat3:c.displayViewMat3),y.setUniform2fv("u_fillTranslation",o),y.setUniform1f("u_depth",n.z+M),y.setUniform1f("u_outline_width",g),x&&y.setUniform4fv("u_id",r);let T=-1;for(const S of i){if(!S.layerData.has(t))continue;S.key.level!==T&&(T=S.key.level,p.setDataUniforms(y,u,n,T,_));const e=S.layerData.get(t);if(e.prepareForRendering(s),!e.outlineIndexCount)continue;const i=e.outlineVertexArrayObject;Object(v["j"])(i)||(s.bindVAO(i),y.setUniformMatrix3fv("u_dvsMat3",S.transforms.dvs),s.setStencilFunction(l["h"].EQUAL,S.stencilRef,255),s.drawElements(l["r"].TRIANGLES,e.outlineIndexCount,l["k"].UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*e.outlineIndexStart),S.triangleCount+=e.outlineIndexCount/3)}}}class N extends r["a"]{constructor(){super(...arguments),this._programOptions={id:!1,pattern:!1,sdf:!1}}dispose(){}drawMany(e,t){const{context:n,displayLevel:i,state:o,drawPhase:a,painter:r,pixelRatio:s,spriteMosaic:u,styleLayerUID:c}=e;if(!t.some(e=>{var t,n;return null!=(t=null==(n=e.layerData.get(c))?void 0:n.lineIndexCount)&&t}))return;const d=e.styleLayer,m=d.lineMaterial,_=r.vectorTilesMaterialManager,p=d.getPaintValue("line-translate",i),h=d.getPaintValue("line-translate-anchor",i),g=d.getPaintProperty("line-pattern"),x=void 0!==g,b=x&&g.isDataDriven;let y,T;if(x&&!b){const e=g.getValue(i);y=u.getMosaicItemPosition(e)}let S=!1;if(!x){const e=d.getPaintProperty("line-dasharray");if(T=void 0!==e,S=T&&e.isDataDriven,T&&!S){const t=e.getValue(i),n=d.getDashKey(t,d.getLayoutValue("line-cap",i));y=u.getMosaicItemPosition(n)}}const C=1/s,O=a===I["c"].HITTEST,A=this._programOptions;A.id=O,A.pattern=x,A.sdf=T;const P=_.getMaterialProgram(n,m,A);if(n.useProgram(P),P.setUniformMatrix3fv("u_displayViewMat3",o.displayViewMat3),P.setUniformMatrix3fv("u_displayMat3",h===w["i"].VIEWPORT?o.displayMat3:o.displayViewMat3),P.setUniform2fv("u_lineTranslation",p),P.setUniform1f("u_depth",d.z),P.setUniform1f("u_antialiasing",C),O){const e=Object(E["c"])(c+1);P.setUniform4fv("u_id",e)}if(y&&Object(v["k"])(y)){const{page:e}=y,t=u.getPageSize(e);Object(v["k"])(t)&&(u.bind(n,l["z"].LINEAR,e,f["S"]),P.setUniform2fv("u_mosaicSize",t),P.setUniform1i("u_texture",f["S"]))}let D=-1;for(const I of t){if(!I.layerData.has(c))continue;I.key.level!==D&&(D=I.key.level,m.setDataUniforms(P,i,d,D,u));const e=2**(i-D)/s;P.setUniform1f("u_zoomFactor",e);const t=I.layerData.get(c);if(!t.lineIndexCount)continue;t.prepareForRendering(n);const o=t.lineVertexArrayObject;if(!Object(v["j"])(o)){if(n.bindVAO(o),P.setUniformMatrix3fv("u_dvsMat3",I.transforms.dvs),n.setStencilFunction(l["h"].EQUAL,I.stencilRef,255),b||S){const e=t.patternMap;if(!e)continue;for(const[t,i]of e){const e=u.getPageSize(t);Object(v["k"])(e)&&(u.bind(n,l["z"].LINEAR,t,f["S"]),P.setUniform2fv("u_mosaicSize",e),P.setUniform1i("u_texture",f["S"]),n.drawElements(l["r"].TRIANGLES,i[1],l["k"].UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*i[0]))}}else n.drawElements(l["r"].TRIANGLES,t.lineIndexCount,l["k"].UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*t.lineIndexStart);I.triangleCount+=t.lineIndexCount/3}}}}var z=n("738e"),V=n("db21"),U=n("1d01");const F=1/65536;class k extends r["a"]{constructor(){super(...arguments),this._iconProgramOptions={id:!1,sdf:!1},this._sdfProgramOptions={id:!1},this._spritesTextureSize=Object(z["a"])()}dispose(){}drawMany(e,t){const{drawPhase:n,styleLayerUID:i}=e,o=e.styleLayer;let a;n===I["c"].HITTEST&&(a=Object(E["c"])(i+1)),this._drawIcons(e,o,t,a),this._drawText(e,o,t,a)}_drawIcons(e,t,n,i){const{context:o,displayLevel:a,drawPhase:r,painter:l,spriteMosaic:s,state:u,styleLayerUID:c}=e,d=t.iconMaterial,m=l.vectorTilesMaterialManager;let _,p=!1;for(const f of n)if(f.layerData.has(c)&&(_=f.layerData.get(c),_.iconPerPageElementsMap.size>0)){p=!0;break}if(!p)return;const h=t.getPaintValue("icon-translate",a),g=t.getPaintValue("icon-translate-anchor",a);let x=t.getLayoutValue("icon-rotation-alignment",a);x===w["a"].AUTO&&(x=t.getLayoutValue("symbol-placement",a)===w["e"].POINT?w["a"].VIEWPORT:w["a"].MAP);const b=x===w["a"].MAP,y=t.getLayoutValue("icon-keep-upright",a)&&b,T=_.isIconSDF,S=r===I["c"].HITTEST,C=this._iconProgramOptions;C.id=S,C.sdf=T;const O=m.getMaterialProgram(o,d,C);o.useProgram(O),O.setUniformMatrix3fv("u_displayViewMat3",x===w["a"].MAP?u.displayViewMat3:u.displayMat3),O.setUniformMatrix3fv("u_displayMat3",g===w["i"].VIEWPORT?u.displayMat3:u.displayViewMat3),O.setUniform2fv("u_iconTranslation",h),O.setUniform1f("u_depth",t.z),O.setUniform1f("u_mapRotation",Object(U["b"])(u.rotation)),O.setUniform1f("u_keepUpright",y?1:0),O.setUniform1f("u_level",10*a),O.setUniform1i("u_texture",f["S"]),O.setUniform1f("u_fadeDuration",V["d"]/1e3),S&&O.setUniform4fv("u_id",i);let E=-1;for(const f of n){if(!f.layerData.has(c))continue;if(f.key.level!==E&&(E=f.key.level,d.setDataUniforms(O,a,t,E,s)),_=f.layerData.get(c),0===_.iconPerPageElementsMap.size)continue;_.prepareForRendering(o),_.updateOpacityInfo();const n=_.iconVertexArrayObject;if(!Object(v["j"])(n)){o.bindVAO(n),O.setUniformMatrix3fv("u_dvsMat3",f.transforms.dvs),O.setUniform1f("u_time",(performance.now()-_.lastOpacityUpdate)/1e3);for(const[t,n]of _.iconPerPageElementsMap)this._renderIconRange(e,O,n,t,f)}}}_renderIconRange(e,t,n,i,o){const{context:a,spriteMosaic:r}=e;this._spritesTextureSize[0]=r.getWidth(i)/4,this._spritesTextureSize[1]=r.getHeight(i)/4,t.setUniform2fv("u_mosaicSize",this._spritesTextureSize),r.bind(a,l["z"].LINEAR,i,f["S"]),a.setStencilTestEnabled(!0),a.setStencilFunction(l["h"].GREATER,255,255),a.setStencilWriteMask(0),a.drawElements(l["r"].TRIANGLES,n[1],l["k"].UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*n[0]),o.triangleCount+=n[1]/3}_drawText(e,t,n,i){const{context:o,displayLevel:a,drawPhase:r,glyphMosaic:s,painter:u,pixelRatio:c,spriteMosaic:d,state:m,styleLayerUID:_}=e,p=t.textMaterial,h=u.vectorTilesMaterialManager;let g,x=!1;for(const l of n)if(l.layerData.has(_)&&(g=l.layerData.get(_),g.glyphPerPageElementsMap.size>0)){x=!0;break}if(!x)return;const b=t.getPaintProperty("text-opacity");if(b&&!b.isDataDriven&&0===b.getValue(a))return;const y=t.getPaintProperty("text-color"),T=!y||y.isDataDriven||y.getValue(a)[3]>0,S=t.getPaintProperty("text-halo-width"),C=t.getPaintProperty("text-halo-color"),O=(!S||S.isDataDriven||S.getValue(a)>0)&&(!C||C.isDataDriven||C.getValue(a)[3]>0);if(!T&&!O)return;const E=3;let A=t.getLayoutValue("text-rotation-alignment",a);A===w["a"].AUTO&&(A=t.getLayoutValue("symbol-placement",a)===w["e"].POINT?w["a"].VIEWPORT:w["a"].MAP);const P=A===w["a"].MAP,D=t.getLayoutValue("text-keep-upright",a)&&P,R=r===I["c"].HITTEST,M=.8*E/c;this._glyphTextureSize||(this._glyphTextureSize=Object(z["b"])(s.width/4,s.height/4));const L=t.getPaintValue("text-translate",a),N=t.getPaintValue("text-translate-anchor",a),k=this._sdfProgramOptions;k.id=R;const G=h.getMaterialProgram(o,p,k);o.useProgram(G),G.setUniformMatrix3fv("u_displayViewMat3",A===w["a"].MAP?m.displayViewMat3:m.displayMat3),G.setUniformMatrix3fv("u_displayMat3",N===w["i"].VIEWPORT?m.displayMat3:m.displayViewMat3),G.setUniform2fv("u_textTranslation",L),G.setUniform1f("u_depth",t.z+F),G.setUniform2fv("u_mosaicSize",this._glyphTextureSize),G.setUniform1f("u_mapRotation",Object(U["b"])(m.rotation)),G.setUniform1f("u_keepUpright",D?1:0),G.setUniform1f("u_level",10*a),G.setUniform1i("u_texture",f["R"]),G.setUniform1f("u_antialiasingWidth",M),G.setUniform1f("u_fadeDuration",V["d"]/1e3),R&&G.setUniform4fv("u_id",i);let B=-1;for(const f of n){if(!f.layerData.has(_))continue;if(f.key.level!==B&&(B=f.key.level,p.setDataUniforms(G,a,t,B,d)),g=f.layerData.get(_),0===g.glyphPerPageElementsMap.size)continue;g.prepareForRendering(o),g.updateOpacityInfo();const e=g.textVertexArrayObject;if(Object(v["j"])(e))continue;o.bindVAO(e),G.setUniformMatrix3fv("u_dvsMat3",f.transforms.dvs),o.setStencilTestEnabled(!0),o.setStencilFunction(l["h"].GREATER,255,255),o.setStencilWriteMask(0);const n=(performance.now()-g.lastOpacityUpdate)/1e3;G.setUniform1f("u_time",n),g.glyphPerPageElementsMap.forEach((e,t)=>{this._renderGlyphRange(o,e,t,s,G,O,T,f)})}}_renderGlyphRange(e,t,n,i,o,a,r,s){i.bind(e,l["z"].LINEAR,n,f["R"]),a&&(o.setUniform1f("u_halo",1),e.drawElements(l["r"].TRIANGLES,t[1],l["k"].UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*t[0]),s.triangleCount+=t[1]/3),r&&(o.setUniform1f("u_halo",0),e.drawElements(l["r"].TRIANGLES,t[1],l["k"].UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*t[0]),s.triangleCount+=t[1]/3)}}var G=n("880d");class B extends r["a"]{constructor(){super(...arguments),this._computeDesc=new Map}prepareState({context:e},t,n){const i=n&&-1!==n.indexOf("hittest");e.setBlendingEnabled(!i),e.setBlendFunctionSeparate(l["b"].ONE,l["b"].ONE_MINUS_SRC_ALPHA,l["b"].ONE,l["b"].ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilFunction(l["h"].EQUAL,t.stencilRef,255)}draw(e,t,n){const i=this.getGeometryType();t.commit(e);const o=t.getGeometry(i);Object(v["j"])(o)||(e.timeline.begin(this.name),e.attributeView.bindTextures(e.context),o.forEachCommand(i=>this.drawGeometry(e,t,i,n)))}_setSharedUniforms(e,t,n){const{displayLevel:i,pixelRatio:o,state:a,passOptions:r}=t;Object(v["k"])(r)&&"hittest"===r.type&&(e.setUniform2fv("u_hittestPos",r.position),e.setUniform1f("u_hittestDist",r.distance)),e.setUniform1f("u_pixelRatio",o),e.setUniformMatrix3fv("u_tileMat3",n.transforms.tileMat3),e.setUniformMatrix3fv("u_viewMat3",a.viewMat3),e.setUniformMatrix3fv("u_dvsMat3",n.transforms.dvs),e.setUniformMatrix3fv("u_displayViewMat3",a.displayViewMat3),e.setUniform1f("u_currentZoom",Math.round(i*f["w"])),e.setUniform1i("u_attributeTextureSize",t.attributeView.size),e.setUniform1i("u_attributeData0",f["B"]),e.setUniform1i("u_attributeData1",f["C"]),e.setUniform1i("u_attributeData2",f["D"]),e.setUniform1i("u_attributeData3",f["E"])}_setSizeVVUniforms(e,t,n,i){if(e.vvSizeMinMaxValue&&t.setUniform4fv("u_vvSizeMinMaxValue",n.vvSizeMinMaxValue),e.vvSizeScaleStops&&t.setUniform1f("u_vvSizeScaleStopsValue",n.vvSizeScaleStopsValue),e.vvSizeFieldStops){const e=n.getSizeVVFieldStops(i.key.level);t.setUniform1fv("u_vvSizeFieldStopsValues",e.values),t.setUniform1fv("u_vvSizeFieldStopsSizes",e.sizes)}e.vvSizeUnitValue&&t.setUniform1f("u_vvSizeUnitValueWorldToPixelsRatio",n.vvSizeUnitValueToPixelsRatio)}_setColorAndOpacityVVUniforms(e,t,n){e.vvColor&&(t.setUniform1fv("u_vvColorValues",n.vvColorValues),t.setUniform4fv("u_vvColors",n.vvColors)),e.vvOpacity&&(t.setUniform1fv("u_vvOpacityValues",n.vvOpacityValues),t.setUniform1fv("u_vvOpacities",n.vvOpacities))}_setRotationVVUniforms(e,t,n){e.vvRotation&&t.setUniform1f("u_vvRotationType","geographic"===n.vvMaterialParameters.vvRotationType?0:1)}_getTriangleDesc(e,t){let n=this._computeDesc.get(e);if(!n){const i=t.strides,o=t.strides.geometry,a=new Map(t.attributes),r=t.bufferLayouts.geometry.map(e=>({...e})),s=Math.max(...t.attributes.values()),u={geometry:r};u.geometry.push({count:2,name:"a_pos1",divisor:0,normalized:!1,offset:o,stride:o,type:l["k"].SHORT}),u.geometry.push({count:2,name:"a_pos2",divisor:0,normalized:!1,offset:2*o,stride:o,type:l["k"].SHORT}),a.set("a_pos1",s+1),a.set("a_pos2",s+2),n={bufferLayouts:u,attributes:a,strides:i},this._computeDesc.set(e,n)}return n}}var j=n("18c6"),W=n("d267"),H=n("91b0"),Y=n("a1ff");const Z=e=>{const t={geometry:[{location:0,name:"a_pos",count:2,type:l["k"].SHORT},{location:1,name:"a_id",count:3,type:l["k"].UNSIGNED_BYTE},{location:2,name:"a_bitset",count:1,type:l["k"].UNSIGNED_BYTE}]};return e.dotDensity?(t.geometry.push({location:3,name:"a_inverseArea",count:1,type:l["k"].FLOAT}),Object(h["g"])(e.data,t)):(t.geometry.push({location:3,name:"a_color",count:4,type:l["k"].UNSIGNED_BYTE,normalized:!0}),e.simple||t.geometry.push({location:4,name:"a_aux1",count:4,type:l["k"].UNSIGNED_SHORT}),t.geometry.push({location:5,name:"a_aux2",count:4,type:l["k"].UNSIGNED_BYTE},{location:6,name:"a_aux3",count:4,type:l["k"].UNSIGNED_BYTE}),e.simple||t.geometry.push({location:7,name:"a_zoomRange",count:2,type:l["k"].UNSIGNED_SHORT}),Object(h["g"])(e.data,t))};class q extends B{constructor(){super(...arguments),this._dotTextureSize=0,this._dotTextures=null,this._dotSamplers=new Int32Array([f["K"],f["L"]]),this._dotVAO=null,this._dotDesc={vsPath:"dot/dot",fsPath:"dot/dot",attributes:new Map([["a_pos",0]])}}dispose(){this._disposeTextures(),this._dotFBO=Object(v["e"])(this._dotFBO),this._dotVAO=Object(v["e"])(this._dotVAO)}getGeometryType(){return I["d"].FILL}drawGeometry(e,t,n,i){const{context:o,painter:a,rendererInfo:r,requiredLevel:s,passOptions:u}=e,c=j["a"].load(n.materialKey),f=a.materialManager;let d=l["r"].TRIANGLES,m=Z(c);Object(v["k"])(u)&&"hittest"===u.type&&(m=this._getTriangleDesc(n.materialKey,m),d=l["r"].POINTS);const{attributes:_,bufferLayouts:p}=m,h=f.getMaterialProgram(e,c,"materials/fill",_,i);if(o.useProgram(h),this._setSharedUniforms(h,e,t),h.setUniform2f("u_tileOffset",512*t.key.col,512*t.key.row),c.textureBinding){a.textureManager.bindTextures(o,h,c);const n=1/2**(s-t.key.level)/e.pixelRatio;h.setUniform1f("u_zoomFactor",n)}const g=1/e.pixelRatio;h.setUniform1f("u_blur",g),h.setUniform1f("u_antialiasing",g),this._setSizeVVUniforms(c,h,r,t),this._setColorAndOpacityVVUniforms(c,h,r);const x=Object(v["k"])(u)&&"hittest"===u.type,b=n.target.getVAO(o,p,_,x);let y=n.indexCount,T=n.indexFrom*Uint32Array.BYTES_PER_ELEMENT;if(x&&(y/=3,T/=3),o.bindVAO(b),!c.dotDensity||x)o.drawElements(d,y,l["k"].UNSIGNED_INT,T);else{const n=this._drawDotLocations(e,t,h,y,T);this._drawDotDensity(e,t,n)}}_drawDotDensity(e,t,n){const{context:i,painter:o,rendererInfo:a}=e,r=o.materialManager.getProgram(e,this._dotDesc),s=this._createDotDensityMesh(i,this._dotDesc.attributes,{geometry:[{name:"a_pos",count:2,type:l["k"].SHORT,divisor:0,normalized:!1,offset:0,stride:4}]});i.setStencilTestEnabled(!0),i.useProgram(r),r.setUniform1f("u_tileZoomFactor",1),r.setUniform1i("u_texture",this._dotSamplers[0]),r.setUniform1f("u_dotSize",Math.max(a.ddDotSize,1)),r.setUniform1f("u_pixelRatio",window.devicePixelRatio),this._setSharedUniforms(r,e,t),i.bindTexture(n,this._dotSamplers[0]),i.bindVAO(s),i.drawArrays(l["r"].POINTS,0,262144)}_drawDotLocations(e,t,n,i,o){const{context:a,rendererInfo:r,requiredLevel:s}=e,u=a.getViewport();a.setViewport(0,0,512,512);const c=a.getBoundFramebufferObject(),d=this._createFBO(a);a.bindFramebuffer(d),a.setClearColor(0,0,0,0),a.clear(a.gl.COLOR_BUFFER_BIT|a.gl.STENCIL_BUFFER_BIT),a.setStencilTestEnabled(!1);const m=1/2**(s-t.key.level),_=f["P"],v=_*window.devicePixelRatio*_*window.devicePixelRatio,p=1/m*(1/m),h=r.ddDotScale?e.state.scale/r.ddDotScale:1;return n.setUniform1f("u_tileZoomFactor",m),n.setUniform1f("u_tileDotsOverArea",v/(f["P"]*window.devicePixelRatio*f["P"]*window.devicePixelRatio)),n.setUniformMatrix4fv("u_dotColors",r.ddColors),n.setUniform4fv("u_isActive",r.ddActiveDots),n.setUniform4fv("u_dotBackgroundColor",r.ddBackgroundColor),n.setUniform1f("u_dotValue",Math.max(1,r.ddDotValue*h*p)),this._bindDotDensityTextures(a,n,r,_),a.drawElements(l["r"].TRIANGLES,i,l["k"].UNSIGNED_INT,o),a.setViewport(u.x,u.y,u.width,u.height),a.bindFramebuffer(c),d.colorTexture}_createFBO(e){if(Object(v["j"])(this._dotFBO)){const t=512,n=512,i={target:l["A"].TEXTURE_2D,pixelFormat:l["p"].RGBA,dataType:l["q"].UNSIGNED_BYTE,samplingMode:l["z"].NEAREST,wrapMode:l["B"].CLAMP_TO_EDGE,width:t,height:n},o={colorTarget:l["y"].TEXTURE,depthStencilTarget:l["m"].DEPTH_STENCIL_RENDER_BUFFER},a=new H["a"](e,{width:t,height:n,internalFormat:l["s"].DEPTH_STENCIL});this._dotFBO=new W["a"](e,o,i,a)}return this._dotFBO}_disposeTextures(){if(this._dotTextures){for(let e=0;eObject(h["g"])(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:l["k"].SHORT},{location:1,name:"a_id",count:4,type:l["k"].UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:l["k"].UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:l["k"].UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texAndSize",count:4,type:l["k"].UNSIGNED_BYTE},{location:5,name:"a_refSymbolAndPlacementOffset",count:4,type:l["k"].UNSIGNED_BYTE},{location:6,name:"a_glyphData",count:4,type:l["k"].UNSIGNED_BYTE},{location:7,name:"a_vertexOffset",count:2,type:l["k"].SHORT},{location:8,name:"a_texCoords",count:2,type:l["k"].UNSIGNED_SHORT}]});class X extends B{dispose(){}getGeometryType(){return I["d"].LABEL}drawGeometry(e,t,n,i){const{context:o,painter:a,state:r,rendererInfo:s}=e,u=j["b"].load(n.materialKey),c=u.mapAligned?1:0;if(!c&&Math.abs(t.key.level-Math.round(100*e.displayLevel)/100)>=1)return;const{bufferLayouts:f,attributes:d}=K(u),m=a.materialManager.getMaterialProgram(e,u,"materials/label",d,i);e.context.setStencilFunction(l["h"].EQUAL,0,255),o.useProgram(m),this._setSharedUniforms(m,e,t),a.textureManager.bindTextures(o,m,u);const _=1===c?r.displayViewMat3:r.displayMat3;this._setSizeVVUniforms(u,m,s,t),m.setUniform1f("u_mapRotation",Math.floor(r.rotation/360*254)),m.setUniform1f("u_mapAligned",c),m.setUniformMatrix3fv("u_displayMat3",_),m.setUniform1f("u_opacity",1),m.setUniform2fv("u_screenSize",e.state.size),m.setUniform1f("u_isHalo",1);const v=n.target.getVAO(o,f,d),p=n.indexFrom*Uint32Array.BYTES_PER_ELEMENT;o.bindVAO(v),o.drawElements(l["r"].TRIANGLES,n.indexCount,l["k"].UNSIGNED_INT,p),m.setUniform1f("u_isHalo",0),o.drawElements(l["r"].TRIANGLES,n.indexCount,l["k"].UNSIGNED_INT,p),o.setStencilTestEnabled(!0),o.setBlendingEnabled(!0)}}const Q=e=>Object(h["g"])(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:l["k"].SHORT},{location:1,name:"a_id",count:4,type:l["k"].UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:l["k"].UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:l["k"].BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:l["k"].UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:l["k"].UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:l["k"].BYTE},{location:7,name:"a_aux",count:2,type:l["k"].UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:l["k"].UNSIGNED_SHORT}]});class $ extends B{dispose(){}getGeometryType(){return I["d"].LINE}drawGeometry(e,t,n,i){const{context:o,painter:a,rendererInfo:r,displayLevel:s,passOptions:u}=e,c=j["c"].load(n.materialKey);let f=Q(c),d=l["r"].TRIANGLES;Object(v["k"])(u)&&"hittest"===u.type&&(f=this._getTriangleDesc(n.materialKey,f),d=l["r"].POINTS);const{attributes:m,bufferLayouts:_}=f,p=a.materialManager.getMaterialProgram(e,c,"materials/line",m,i),h=1/e.pixelRatio,g=0;o.useProgram(p),this._setSharedUniforms(p,e,t),c.textureBinding&&a.textureManager.bindTextures(o,p,c);const x=2**(s-t.key.level)/e.pixelRatio;p.setUniform1f("u_zoomFactor",x),p.setUniform1f("u_blur",g+h),p.setUniform1f("u_antialiasing",h),this._setSizeVVUniforms(c,p,r,t),this._setColorAndOpacityVVUniforms(c,p,r),o.setFaceCullingEnabled(!1);const b=Object(v["k"])(u)&&"hittest"===u.type,y=n.target.getVAO(o,_,m,b);let T=n.indexCount,S=n.indexFrom*Uint32Array.BYTES_PER_ELEMENT;b&&(T/=3,S/=3),o.bindVAO(y),o.drawElements(d,T,l["k"].UNSIGNED_INT,S)}}const J=e=>Object(h["g"])(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:l["k"].SHORT},{location:1,name:"a_vertexOffset",count:2,type:l["k"].SHORT},{location:2,name:"a_texCoords",count:2,type:l["k"].UNSIGNED_SHORT},{location:3,name:"a_bitSetAndDistRatio",count:2,type:l["k"].UNSIGNED_SHORT},{location:4,name:"a_id",count:4,type:l["k"].UNSIGNED_BYTE},{location:5,name:"a_color",count:4,type:l["k"].UNSIGNED_BYTE,normalized:!0},{location:6,name:"a_outlineColor",count:4,type:l["k"].UNSIGNED_BYTE,normalized:!0},{location:7,name:"a_sizeAndOutlineWidth",count:4,type:l["k"].UNSIGNED_BYTE},{location:8,name:"a_zoomRange",count:2,type:l["k"].UNSIGNED_SHORT}]});class ee extends B{dispose(){}getGeometryType(){return I["d"].MARKER}drawGeometry(e,t,n,i){const{context:o,painter:a,rendererInfo:r,state:s,passOptions:u}=e,c=j["d"].load(n.materialKey),{bufferLayouts:f,attributes:d}=J(c),m=a.materialManager.getMaterialProgram(e,c,"materials/icon",d,i);o.useProgram(m),c.textureBinding&&a.textureManager.bindTextures(o,m,c,!0);let _=l["r"].TRIANGLES;Object(v["k"])(u)&&"hittest"===u.type&&(_=l["r"].POINTS),this._setSharedUniforms(m,e,t);const p=c.vvRotation?s.displayViewMat3:s.displayMat3;m.setUniformMatrix3fv("u_displayMat3",p),this._setSizeVVUniforms(c,m,r,t),this._setColorAndOpacityVVUniforms(c,m,r),this._setRotationVVUniforms(c,m,r);const h=n.target.getVAO(o,f,d),g=n.indexFrom*Uint32Array.BYTES_PER_ELEMENT;o.bindVAO(h),o.drawElements(_,n.indexCount,l["k"].UNSIGNED_INT,g)}}const te=e=>Object(h["g"])(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:l["k"].SHORT},{location:1,name:"a_id",count:4,type:l["k"].UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:l["k"].UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:l["k"].UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texFontSize",count:4,type:l["k"].UNSIGNED_BYTE},{location:5,name:"a_aux",count:4,type:l["k"].BYTE},{location:6,name:"a_zoomRange",count:2,type:l["k"].UNSIGNED_SHORT},{location:7,name:"a_vertexOffset",count:2,type:l["k"].SHORT},{location:8,name:"a_texCoords",count:2,type:l["k"].UNSIGNED_SHORT}]});class ne extends B{dispose(){}getGeometryType(){return I["d"].TEXT}drawGeometry(e,t,n,i){const{context:o,painter:a,rendererInfo:r,state:s,passOptions:u}=e,c=j["f"].load(n.materialKey),{bufferLayouts:f,attributes:d}=te(c),m=a.materialManager.getMaterialProgram(e,c,"materials/text",d,i);o.useProgram(m);let _=l["r"].TRIANGLES;Object(v["k"])(u)&&"hittest"===u.type&&(_=l["r"].POINTS),this._setSharedUniforms(m,e,t),a.textureManager.bindTextures(o,m,c),m.setUniformMatrix3fv("u_displayMat3",s.displayMat3),m.setUniformMatrix3fv("u_displayViewMat3",s.displayViewMat3),this._setSizeVVUniforms(c,m,r,t),this._setColorAndOpacityVVUniforms(c,m,r),this._setRotationVVUniforms(c,m,r),m.setUniform1f("u_isHalo",1);const p=n.target.getVAO(o,f,d),h=n.indexFrom*Uint32Array.BYTES_PER_ELEMENT;o.bindVAO(p),o.drawElements(l["r"].TRIANGLES,n.indexCount,l["k"].UNSIGNED_INT,h),m.setUniform1f("u_isHalo",0),o.drawElements(_,n.indexCount,l["k"].UNSIGNED_INT,h)}}const ie={marker:ee,line:$,fill:q,text:ne,label:X,clip:y,stencil:S["a"],bitmap:_,raster:u,rasterVF:c["a"],flow:i["a"],tileInfo:T["a"],vtlBackground:D,vtlFill:L,vtlLine:N,vtlCircle:R,vtlSymbol:k},oe={vtlBackground:D,vtlFill:L,vtlLine:N,vtlCircle:R,vtlSymbol:k}},"3bc3":function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var i=n("b2b2"),o=n("f079"),a=n("d17d");const r=new Float32Array([.27058823529411763,.4588235294117647,.7098039215686275,1,.396078431372549,.5372549019607843,.7215686274509804,1,.5176470588235295,.6196078431372549,.7294117647058823,1,.6352941176470588,.7058823529411765,.7411764705882353,1,.7529411764705882,.8,.7450980392156863,1,.8705882352941177,.8901960784313725,.7490196078431373,1,1,1,.7490196078431373,1,1,.8627450980392157,.6313725490196078,1,.9803921568627451,.7254901960784313,.5176470588235295,1,.9607843137254902,.596078431372549,.4117647058823529,1,.9294117647058824,.4588235294117647,.3176470588235294,1,.9098039215686274,.08235294117647059,.08235294117647059,1]),l={beaufort_ft:r,beaufort_m:r,beaufort_km:r,beaufort_mi:r,beaufort_kn:new Float32Array([.1568627450980392,.5725490196078431,.7803921568627451,1,.34901960784313724,.6352941176470588,.7294117647058823,1,.5058823529411764,.7019607843137254,.6705882352941176,1,.6274509803921569,.7607843137254902,.6078431372549019,1,.7490196078431373,.8313725490196079,.5411764705882353,1,.8549019607843137,.9019607843137255,.4666666666666667,1,.9803921568627451,.9803921568627451,.39215686274509803,1,.9882352941176471,.8352941176470589,.3254901960784314,1,.9882352941176471,.7019607843137254,.4,1,.9803921568627451,.5529411764705883,.20392156862745098,1,.9686274509803922,.43137254901960786,.16470588235294117,1,.9411764705882353,.2784313725490196,.11372549019607843,1]),classified_arrow:new Float32Array([.2196078431372549,.6588235294117647,0,1,.5450980392156862,1.2117647058823529,0,1,1,1,0,1,1,.5019607843137255,0,1,1,0,0,1]),ocean_current_m:new Float32Array([.3058823529411765,.10196078431372549,.6,1,.7019607843137254,.10588235294117647,.10196078431372549,1,.792156862745098,.5019607843137255,.10196078431372549,1,.6941176470588235,.6941176470588235,.6941176470588235,1]),ocean_current_kn:new Float32Array([0,0,0,1,0,.1450980392156863,.39215686274509803,1,.3058823529411765,.10196078431372549,.6,1,.592156862745098,0,.39215686274509803,1,.7019607843137254,.10588235294117647,.10196078431372549,1,.6941176470588235,.3058823529411765,.10196078431372549,1,.792156862745098,.5019607843137255,.10196078431372549,1,.6941176470588235,.7019607843137254,.20392156862745098,1,.6941176470588235,.6941176470588235,.6941176470588235,1]),single_arrow:new Float32Array([0,92/255,230/255,1]),wind_speed:new Float32Array([0,0,0,1])};class s extends o["a"]{constructor(){super(...arguments),this._desc={magdir:{vsPath:"raster/magdir",fsPath:"raster/magdir",attributes:new Map([["a_pos",0],["a_offset",1],["a_vv",2]])},scalar:{vsPath:"raster/scalar",fsPath:"raster/scalar",attributes:new Map([["a_pos",0],["a_offset",1],["a_vv",2]])}}}dispose(){}prepareState({context:e},t){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(a["b"].ONE,a["b"].ONE_MINUS_SRC_ALPHA,a["b"].ONE,a["b"].ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilOp(a["w"].KEEP,a["w"].KEEP,a["w"].REPLACE),e.setStencilFunction(a["h"].EQUAL,t.stencilRef,255)}draw(e,t){if(Object(i["j"])(t.source)||0===t.source.validPixelCount)return;const{timeline:n}=e;if(n.begin(this.name),t.updateVectorFieldVAO(e),"scalar"===e.renderPass){const n=t.vaoData.scalar;n&&this._drawScalars(e,t,n.vao,n.elementCount)}else{const n=t.vaoData.magdir;n&&this._drawTriangles(e,t,n.vao,n.elementCount)}n.end(this.name)}_drawTriangles(e,t,n,i){const{context:o,painter:r}=e,{symbolizerParameters:s}=t,u=s.dataRange?["dataRange"]:[];"geographic"===s.rotationType&&u.push("rotationGeographic");const c=r.materialManager.getProgram(e,this._desc.magdir,u);o.useProgram(c);const{coordScale:f,opacity:d,transforms:m}=t;c.setUniform2fv("u_coordScale",f),c.setUniform1f("u_opacity",d),c.setUniformMatrix3fv("u_dvsMat3",m.dvs);const{style:_,dataRange:v,rotation:p,symbolPercentRange:h}=s;c.setUniform4fv("u_colors",l[_]||l.single_arrow),c.setUniform2fv("u_dataRange",v),c.setUniform1f("u_rotation",p),c.setUniform2fv("u_symbolPercentRange",h);const g=this._getSymbolSize(e,t);c.setUniform2fv("u_symbolSize",g),o.bindVAO(n),o.drawElements(a["r"].TRIANGLES,i,a["k"].UNSIGNED_INT,0)}_drawScalars(e,t,n,i){const{context:o,painter:r}=e,{symbolizerParameters:l}=t,s=[];"wind_speed"===l.style?s.push("innerCircle"):l.dataRange&&s.push("dataRange"),"geographic"===l.rotationType&&s.push("rotationGeographic");const u=r.materialManager.getProgram(e,this._desc.scalar,s);o.useProgram(u);const{coordScale:c,opacity:f,transforms:d}=t;u.setUniform2fv("u_coordScale",c),u.setUniform1f("u_opacity",f),u.setUniformMatrix3fv("u_dvsMat3",d.dvs);const{dataRange:m,symbolPercentRange:_}=l;u.setUniform2fv("u_dataRange",m),u.setUniform2fv("u_symbolPercentRange",_);const v=this._getSymbolSize(e,t);u.setUniform2fv("u_symbolSize",v),o.bindVAO(n),o.drawElements(a["r"].TRIANGLES,i,a["k"].UNSIGNED_INT,0)}_getSymbolSize(e,t){const n=t.key?2**(e.displayLevel-t.key.level):t.resolution/e.state.resolution,{symbolTileSize:i}=t.symbolizerParameters;return[i/(Math.round((t.width-t.offset[0])/i)*i)/n,i/(Math.round((t.height-t.offset[1])/i)*i)/n]}}},"3e27":function(e,t,n){"use strict";n.d(t,"a",(function(){return v}));var i,o=n("a4ee"),a=(n("c120"),n("ce50")),r=n("6a0ed"),l=n("7ffa"),s=n("e92d"),u=n("b2b2"),c=n("59b2"),f=n("1a3e"),d=n("d386");const m=s["a"].getLogger("esri.layers.support.PixelBlock");let _=i=class extends r["a"]{constructor(e){super(e),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.pixels=null,this.statistics=null}static createEmptyBand(e,t){return new(i.getPixelArrayConstructor(e))(t)}static getPixelArrayConstructor(e){let t;switch(e){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f32":case"c64":case"c128":case"unknown":t=Float32Array;break;case"f64":t=Float64Array}return t}castPixelType(e){if(!e)return"f32";let t=e.toLowerCase();return["u1","u2","u4"].indexOf(t)>-1?t="u8":-1===["unknown","u8","s8","u16","s16","u32","s32","f32","f64"].indexOf(t)&&(t="f32"),t}getPlaneCount(){return this.pixels&&this.pixels.length}addData(e){if(!e.pixels||e.pixels.length!==this.width*this.height)throw new a["a"]("pixelblock:invalid-or-missing-pixels","add data requires valid pixels array that has same length defined by pixel block width * height");this.pixels||(this.pixels=[]),this.statistics||(this.statistics=[]),this.pixels.push(e.pixels),this.statistics.push(e.statistics||{minValue:null,maxValue:null})}getAsRGBA(){const e=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case"s8":case"s16":case"u16":case"s32":case"u32":case"f32":case"f64":this._fillFromNon8Bit(e);break;default:this._fillFrom8Bit(e)}return new Uint8ClampedArray(e)}getAsRGBAFloat(){const e=new Float32Array(this.width*this.height*4);return this._fillFrom32Bit(e),e}updateStatistics(){this.statistics=this.pixels.map(e=>this._calculateBandStatistics(e,this.mask));const e=this.mask;let t=0;if(e)for(let n=0;no?o:ue>=this.pixels.length),o=t===e.length&&!e.some((e,t)=>e!==t);return n||o?this:new i({pixelType:this.pixelType,width:this.width,height:this.height,mask:this.mask,validPixelCount:this.validPixelCount,maskIsAlpha:this.maskIsAlpha,pixels:e.map(e=>this.pixels[e]),statistics:this.statistics&&e.map(e=>this.statistics[e])})}clone(){const e=new i({width:this.width,height:this.height,pixelType:this.pixelType,maskIsAlpha:this.maskIsAlpha,validPixelCount:this.validPixelCount});let t;this.mask&&(this.mask instanceof Uint8Array?e.mask=new Uint8Array(this.mask):e.mask=this.mask.slice(0));const n=i.getPixelArrayConstructor(this.pixelType);if(this.pixels&&this.pixels.length>0){e.pixels=[];const i=this.pixels[0].slice;for(t=0;t=3?(a=i[1],r=i[2]):2===i.length&&(a=i[1]);const s=new Uint32Array(e),u=this.width*this.height;if(o.length===u)if(t&&t.length===u)if(n)for(l=0;l0)r=i.map(e=>e.minValue).reduce((e,t)=>Math.min(e,t)),l=i.map(e=>e.maxValue-e.minValue).reduce((e,t)=>Math.max(e,t)),a=255/l;else{let e=255;"s8"===o?(r=-128,e=127):"u16"===o?e=65535:"s16"===o?(r=-32768,e=32767):"u32"===o?e=4294967295:"s32"===o?(r=-2147483648,e=2147483647):"f32"===o?(r=-34e38,e=34e38):"f64"===o&&(r=-Number.MAX_VALUE,e=Number.MAX_VALUE),a=255/(e-r)}const s=new Uint32Array(e),u=this.width*this.height;let c,f,d,_,v;if(c=f=d=t[0],c.length!==u)return m.error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.");if(t.length>=2)if(f=t[1],t.length>=3&&(d=t[2]),n&&n.length===u)for(_=0;_=3?(o=t[1],a=t[2]):2===t.length&&(o=t[1]);const l=this.width*this.height;if(i.length!==l)return m.error("getAsRGBAFloat()","Unable to convert to RGBA. The pixelblock is invalid.");let s=0;if(n&&n.length===l)for(r=0;ri?r:i);else for(a=0;ai?r:i;return{minValue:n,maxValue:i}}};Object(o["a"])([Object(c["b"])({json:{write:!0}})],_.prototype,"width",void 0),Object(o["a"])([Object(c["b"])({json:{write:!0}})],_.prototype,"height",void 0),Object(o["a"])([Object(c["b"])({json:{write:!0}})],_.prototype,"pixelType",void 0),Object(o["a"])([Object(f["a"])("pixelType")],_.prototype,"castPixelType",null),Object(o["a"])([Object(c["b"])({json:{write:!0}})],_.prototype,"validPixelCount",void 0),Object(o["a"])([Object(c["b"])({json:{write:!0}})],_.prototype,"mask",void 0),Object(o["a"])([Object(c["b"])({json:{write:!0}})],_.prototype,"maskIsAlpha",void 0),Object(o["a"])([Object(c["b"])({json:{write:!0}})],_.prototype,"pixels",void 0),Object(o["a"])([Object(c["b"])({json:{write:!0}})],_.prototype,"statistics",void 0),_=i=Object(o["a"])([Object(d["a"])("esri.layers.support.PixelBlock")],_);const v=_},"49f0":function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));class i{constructor(e){this.readFile=e}resolveIncludes(e){return this._resolve(e)}_resolve(e,t=new Map){if(t.has(e))return t.get(e);const n=this._read(e);if(!n)throw new Error("cannot find shader file "+e);const i=/^[^\S\n]*#include\s+<(\S+)>[^\S\n]?/gm;let o=i.exec(n);const a=[];for(;null!=o;)a.push({path:o[1],start:o.index,length:o[0].length}),o=i.exec(n);let r=0,l="";return a.forEach(e=>{l+=n.slice(r,e.start),l+=t.has(e.path)?"":this._resolve(e.path,t),r=e.start+e.length}),l+=n.slice(r),t.set(e,l),l}_read(e){return this.readFile(e)}}},"681f":function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var i=n("8e37");function o(e,t,n=""){return new i["a"](e,n+t.shaders.vertexShader,n+t.shaders.fragmentShader,t.attributes)}},"6f75":function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var i=n("5ef2"),o=n("2e5c"),a=n("f079"),r=n("21c1"),l=n("be90");const s={shaders:{vertexShader:Object(l["a"])("tileInfo/tileInfo.vert"),fragmentShader:Object(l["a"])("tileInfo/tileInfo.frag")},attributes:new Map([["a_pos",0]])};var u=n("7ce4"),c=n("d17d"),f=n("681f"),d=n("a1ff"),m=n("0fa6");const _=300,v=32;class p extends a["a"]{constructor(){super(...arguments),this._color=Object(i["c"])(1,0,0,1)}dispose(){this._outlineProgram&&(this._outlineProgram.dispose(),this._outlineProgram=null),this._tileInfoProgram&&(this._tileInfoProgram.dispose(),this._tileInfoProgram=null),this._outlineVertexArrayObject&&(this._outlineVertexArrayObject.dispose(),this._outlineVertexArrayObject=null),this._tileInfoVertexArrayObject&&(this._tileInfoVertexArrayObject.dispose(),this._tileInfoVertexArrayObject=null),this._canvas=null}prepareState({context:e}){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(c["b"].ONE,c["b"].ONE_MINUS_SRC_ALPHA,c["b"].ONE,c["b"].ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!1)}draw(e,t){const{context:n}=e;if(!t.isReady)return;this._loadWGLResources(n),n.bindVAO(this._outlineVertexArrayObject),n.useProgram(this._outlineProgram),this._outlineProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.dvs),this._outlineProgram.setUniform2f("u_coord_range",t.rangeX,t.rangeY),this._outlineProgram.setUniform1f("u_depth",0),this._outlineProgram.setUniform4fv("u_color",this._color),n.drawArrays(c["r"].LINE_STRIP,0,4);const i=this._getTexture(n,t);i?(n.bindVAO(this._tileInfoVertexArrayObject),n.useProgram(this._tileInfoProgram),n.bindTexture(i,0),this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.dvs),this._tileInfoProgram.setUniform1f("u_depth",0),this._tileInfoProgram.setUniform2f("u_coord_ratio",t.rangeX/t.width,t.rangeY/t.height),this._tileInfoProgram.setUniform2f("u_delta",8,8),this._tileInfoProgram.setUniform2f("u_dimensions",i.descriptor.width,i.descriptor.height),n.drawArrays(c["r"].TRIANGLE_STRIP,0,4),n.bindVAO()):n.bindVAO()}_loadWGLResources(e){if(this._outlineProgram&&this._tileInfoProgram)return;const t=Object(f["a"])(e,r["a"]),n=Object(f["a"])(e,s),i=new Int8Array([0,0,1,0,1,1,0,1]),a=u["a"].createVertex(e,c["D"].STATIC_DRAW,i),l=new m["a"](e,r["a"].attributes,o["a"],{geometry:a}),d=new Int8Array([0,0,1,0,0,1,1,1]),_=u["a"].createVertex(e,c["D"].STATIC_DRAW,d),v=new m["a"](e,s.attributes,o["a"],{geometry:_});this._outlineProgram=t,this._tileInfoProgram=n,this._outlineVertexArrayObject=l,this._tileInfoVertexArrayObject=v}_getTexture(e,t){if(t.texture&&t.triangleCountReportedInDebug===t.triangleCount)return t.texture;t.triangleCountReportedInDebug=t.triangleCount,this._canvas||(this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","canvas2d"),this._canvas.setAttribute("width",""+_),this._canvas.setAttribute("height",""+v),this._canvas.setAttribute("style","display:none"));const n=t.triangleCount;let i=t.key.id;t.triangleCount>0&&(i+=", "+n);const o=this._canvas,a=o.getContext("2d");return a.font="24px sans-serif",a.textAlign="left",a.textBaseline="top",a.clearRect(0,0,_,v),n>1e5?(a.fillStyle="red",a.fillRect(0,0,_,v),a.fillStyle="black"):(a.clearRect(0,0,_,v),a.fillStyle="blue"),a.fillText(i,0,0),t.texture=new d["a"](e,{target:c["A"].TEXTURE_2D,pixelFormat:c["p"].RGBA,dataType:c["q"].UNSIGNED_BYTE,samplingMode:c["z"].NEAREST,wrapMode:c["B"].CLAMP_TO_EDGE},o),t.texture}}},"823a":function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var i=n("7ce4"),o=n("d17d"),a=n("0fa6"),r=n("3f3e");class l{constructor(e,t){this.rctx=e,this._vertexBuffer=i["a"].createVertex(e,o["D"].STATIC_DRAW,new Uint16Array(t)),this._vao=new a["a"](e,new Map([["a_position",0]]),{geometry:[new r["a"]("a_position",2,o["k"].SHORT,0,4)]},{geometry:this._vertexBuffer}),this._count=t.length/2}bind(){this._vao.bind()}unbind(){this._vao.unbind()}dispose(){this._vao.dispose(!1),this._vertexBuffer.dispose()}draw(){this.rctx.bindVAO(this._vao),this.rctx.drawArrays(o["r"].TRIANGLE_STRIP,0,this._count)}}},"9dee":function(e,t,n){"use strict";n.d(t,"a",(function(){return R})),n.d(t,"b",(function(){return s})),n.d(t,"c",(function(){return l})),n.d(t,"d",(function(){return m})),n.d(t,"e",(function(){return f})),n.d(t,"f",(function(){return c})),n.d(t,"g",(function(){return u})),n.d(t,"h",(function(){return r})),n.d(t,"i",(function(){return w})),n.d(t,"j",(function(){return a})),n.d(t,"k",(function(){return v})),n.d(t,"l",(function(){return b})),n.d(t,"m",(function(){return g})),n.d(t,"n",(function(){return p})),n.d(t,"o",(function(){return T})),n.d(t,"p",(function(){return P})),n.d(t,"q",(function(){return _}));var i=n("b2b2"),o=n("3e27");function a(e){return Object(i["k"])(e)&&"esri.layers.support.PixelBlock"===e.declaredClass&&e.pixels&&e.pixels.length>0}function r(e,t){if(null==t||!t.length||!a(e))return e;const n=e.pixels.length;return t&&t.some(e=>e>=n)||1===n&&1===t.length&&0===t[0]?e:n!==t.length||t.some((e,t)=>e!==t)?new o["a"]({pixelType:e.pixelType,width:e.width,height:e.height,mask:e.mask,validPixelCount:e.validPixelCount,maskIsAlpha:e.maskIsAlpha,pixels:t.map(t=>e.pixels[t]),statistics:e.statistics&&t.map(t=>e.statistics[t])}):e}function l(e){if(!e)return;const t=e.colormap;if(!t||0===t.length)return;const n=t.sort((e,t)=>e[0]-t[0]);let i=0;n[0][0]<0&&(i=n[0][0]);const o=Math.max(256,n[n.length-1][0]-i+1),a=new Uint8Array(4*o),r=[];let l,s=0,u=0;const c=5===n[0].length;if(o>65536)return n.forEach(e=>{r[e[0]-i]=c?e.slice(1):e.slice(1).concat([255])}),{indexed2DColormap:r,offset:i,alphaSpecified:c};if(e.fillUnspecified)for(l=n[u],s=l[0]-i;sf?o[d]=0:(_[d]=l[g],v[d]=l[g+1],p[d]=l[g+2],o[d]=l[g+3]));else{for(o=new Uint8Array(r),d=0;df?o[d]=0:(_[d]=l[g],v[d]=l[g+1],p[d]=l[g+2],o[d]=l[g+3]);n.mask=o}else if(o)for(d=0;d-1&&(f=65536);const m=[],_=[],v=r-a;for(s=0;s=l,h=[];if(p)for(s=0;s1?i[s]>2?h[s]=6.5+(i[s]-2)**2.5:h[s]=6.5+100*(2-i[s])**4:h[s]=1;let g;const x=[];let b,y,T;if(p)for(s=0;s1&&(y-=(1/v)**(g*h[s])),bt[s]?T[u]=Math.floor(y*v*g**(1/i[s]))+a:b>=n[s]?T[u]=r:T[u]=a;x[s]=T}else for(s=0;s=n[s]?T[u]=r:T[u]=Math.floor((b-t[s])/_[s]*v)+a;x[s]=T}if(null!=e.contrastOffset){const t=d(e.contrastOffset,e.brightnessOffset);for(s=0;s0&&n<100?l=(200*r-100*o+2*o*i)/(2*(100-n))+a:n<=0&&n>-100?l=(200*r-100*o+2*o*i)*(100+n)/2e4+a:100===n?(l=200*r-100*o+(o+1)*(100-n)+2*o*i,l=l>0?o:0):-100===n&&(l=a),s[r]=l>o?o:l<0?0:l;return s}function m(e,t=256){t=Math.min(t,256);const{size:n,counts:i}=e,o=new Uint8Array(n),a=i.reduce((e,n)=>e+n/t,0);let r=0,l=0,s=0,u=a;for(let c=0;c=d,T=[];if(y)for(m=0;m1?s[m]>2?T[m]=6.5+(s[m]-2)**2.5:T[m]=6.5+100*(2-s[m])**4:T[m]=1;if(y)if(null!=o){for(_=0;_1&&(p-=(1/g)**(h*T[m])),vr[m]?i[m][_]=Math.floor(p*g*h**(1/s[m]))+u:v>=l[m]?i[m][_]=c:i[m][_]=u}else for(_=0;_1&&(p-=(1/g)**(h*T[m])),vr[m]?i[m][_]=Math.floor(p*g*h**(1/s[m]))+u:v>=l[m]?i[m][_]=c:i[m][_]=u;else if(null!=o){for(_=0;_r[m]?i[m][_]=Math.floor((v-r[m])/b[m]*g)+u:v>=l[m]?i[m][_]=c:i[m][_]=u}else for(_=0;_r[m]?i[m][_]=Math.floor((v-r[m])/b[m]*g)+u:v>=l[m]?i[m][_]=c:i[m][_]=u;return n.pixelType="u8",n.updateStatistics(),n}function v(e,t){if(!a(e))return null;const{pixels:n,mask:i}=e,r=e.width*e.height,l=n.length;let s=t.lut;const{offset:u}=t;let c,f;s&&1===s[0].length&&(s=n.map(()=>s));const d=[];let m,_,v;if(u)if(null==i)for(c=0;c1;){if(c===f.value){p=!0;break}c>f.value?d=v:m=v,v=Math.floor((d+m)/2),f=t[Math.floor(v)]}p||(c===t[d].value?(f=t[d],p=!0):c===t[m].value?(f=t[m],p=!0):ct[d].value&&(ce.pixelBlock);if(!n||Object(i["j"])(n.pixelBlock))return null;const o=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,a=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,r=.01*Math.min(o,a),l=e.sort((e,t)=>Math.abs(e.extent.ymax-t.extent.ymax)>r?t.extent.ymax-e.extent.ymax:Math.abs(e.extent.xmin-t.extent.xmin)>r?e.extent.xmin-t.extent.xmin:0),s=Math.min.apply(null,l.map(e=>e.extent.xmin)),u=Math.min.apply(null,l.map(e=>e.extent.ymin)),c=Math.max.apply(null,l.map(e=>e.extent.xmax)),f=Math.max.apply(null,l.map(e=>e.extent.ymax)),d={x:Math.round((t.xmin-s)/o),y:Math.round((f-t.ymax)/a)},m={width:Math.round((c-s)/o),height:Math.round((f-u)/a)},_={width:Math.round((t.xmax-t.xmin)/o),height:Math.round((t.ymax-t.ymin)/a)};return Math.round(m.width/n.pixelBlock.width)*Math.round(m.height/n.pixelBlock.height)!==l.length||d.x<0||d.y<0||m.width<_.width||m.height<_.height?null:{extent:t,pixelBlock:b(l.map(e=>e.pixelBlock),m,{clipOffset:d,clipSize:_})}}function x(e,t,n,i,o,a){const{width:r,height:l}=n.block,{x:s,y:u}=n.offset,{width:c,height:f}=n.mosaic,d=h(r,l,i,o,s,u,c,f);let m=0,_=0;if(a){const e=a.hasGCSSShiftTransform?360:a.halfWorldWidth,t=r*a.resolutionX,n=a.startX+i*t,o=n+t;ne?_=a.rightPadding:n>=e&&(m=a.leftMargin-a.rightPadding,_=0)}if(d.xmax-=_,"number"!=typeof t)for(let v=d.ymin;va(e));if(Object(i["j"])(c))return null;const f=l?l.width:t.width,d=l?l.height:t.height,m=c.width,_=c.height,v=t.width/m,p=t.height/_,h={offset:r||{x:0,y:0},mosaic:l||t,block:{width:m,height:_}},g=c.pixelType,b=o["a"].getPixelArrayConstructor(g),T=c.pixels.length,S=[];let C,O,I;for(let i=0;iObject(i["j"])(e)||e.mask&&e.mask.length>0)){I=new Uint8Array(f*d);for(let t=0;tObject(i["k"])(e));if(!Object(i["k"])(r))return null;const l=e.some(e=>!Object(i["k"])(e)||!!e.mask),{width:s,height:u}=t,c=l?new Uint8Array(s*u):null,{blockWidths:f}=n,d=[],m=r.getPlaneCount(),_=o["a"].getPixelArrayConstructor(r.pixelType);if(l)for(let i=0,o=0;ii||u>o)return e;if(0===r&&0===l&&s===i&&u===o)return e;e.mask||(e.mask=new Uint8Array(i*o));const c=e.mask;for(let a=0;a=u||t=s?0:1}return e.updateStatistics(),e}function S(e){if(!a(e))return null;const t=e.clone(),{width:n,height:i,pixels:o,mask:r}=e,l=o[0],s=t.pixels[0];for(let a=2;at&&(n=a.value,t=i),a=o.next();return n}function O(e,t,n){if(0===n)return;const i=e.get(t);1===i?e.delete(t):e.set(t,i-1)}function I(e,t,n){0!==n&&e.set(t,e.has(t)?e.get(t)+1:1)}function E(e,t,n){let{x:i,y:r}=t;const{width:l,height:s}=n;if(0===i&&0===r&&s===e.height&&l===e.width)return e;const{width:u,height:c}=e,f=Math.max(0,r),d=Math.max(0,i),m=Math.min(i+l,u),_=Math.min(r+s,c);if(m<0||_<0||!a(e))return null;i=Math.max(0,-i),r=Math.max(0,-r);const{pixels:v,mask:p}=e,h=l*s,g=v.length,x=[];for(let a=0;a{const i=e instanceof Float32Array||e instanceof Float64Array?0:.5;for(let o=0;o 1.0) {\ncolor = lum + ((color - lum) * (1.0 - lum)) / (maxcol - lum);\n}\nreturn color;\n}\nvec3 setLum(vec3 cbase, vec3 clum) {\nfloat lbase = lumv3(cbase);\nfloat llum = lumv3(clum);\nfloat ldiff = llum - lbase;\nvec3 color = cbase + vec3(ldiff);\nreturn clipColor(color);\n}\nvec3 setLumSat(vec3 cbase, vec3 csat, vec3 clum)\n{\nfloat minbase = minv3(cbase);\nfloat sbase = satv3(cbase);\nfloat ssat = satv3(csat);\nvec3 color;\nif (sbase > 0.0) {\ncolor = (cbase - minbase) * ssat / sbase;\n} else {\ncolor = vec3(0.0);\n}\nreturn setLum(color, clum);\n}\nvoid main() {\nvec4 src = texture2D(u_layerTexture, v_uv);\n#ifdef NORMAL\ngl_FragColor = src * u_opacity;\n#else\nvec4 dst = texture2D(u_backbufferTexture, v_uv);\nvec3 Cs = src.a == 0.0 ? src.rgb : vec3(src.rgb / src.a);\nvec3 Cb = dst.a == 0.0 ? dst.rgb : vec3(dst.rgb / dst.a);\nfloat as = u_opacity * src.a;\nfloat ab = dst.a;\n#ifdef DESTINATION_OVER\ngl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb, as + ab - as * ab);\n#endif\n#ifdef SOURCE_IN\nvec4 color = vec4(as * Cs * ab, as * ab);\nvec4 fadeColor = (1.0 - u_opacity) * u_inFadeOpacity * vec4(ab * Cb, ab);\ngl_FragColor = color + fadeColor;\n#endif\n#ifdef DESTINATION_IN\nvec4 color = vec4(ab * Cb * as, ab * as);\nvec4 fadeColor = (1.0 - u_opacity) * u_inFadeOpacity * vec4(ab * Cb, ab);\ngl_FragColor = color + fadeColor;\n#endif\n#ifdef SOURCE_OUT\ngl_FragColor = vec4(as * Cs * (1.0 - ab), as * (1.0 - ab));\n#endif\n#ifdef DESTINATION_OUT\ngl_FragColor = vec4(ab * Cb * (1.0 - as), ab * (1.0 - as));\n#endif\n#ifdef SOURCE_ATOP\ngl_FragColor = vec4(as * Cs * ab + ab * Cb * (1.0 - as), ab);\n#endif\n#ifdef DESTINATION_ATOP\ngl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb * as, as);\n#endif\n#ifdef XOR\ngl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb * (1.0 - as),\nas * (1.0 - ab) + ab * (1.0 - as));\n#endif\n#ifdef MULTIPLY\ngl_FragColor = vec4(as * Cs * ab * Cb + (1.0 - ab) * as * Cs + (1.0 - as) * ab * Cb,\nas + ab * (1.0 - as));\n#endif\n#ifdef SCREEN\ngl_FragColor = vec4((Cs + Cb - Cs * Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef OVERLAY\nvec3 f = vec3(overlay(Cb.r, Cs.r), overlay(Cb.g, Cs.g), overlay(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef DARKEN\ngl_FragColor = vec4(min(Cs, Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef LIGHTER\ngl_FragColor = vec4(as * Cs + ab * Cb, as + ab);\n#endif\n#ifdef LIGHTEN\ngl_FragColor = vec4(max(Cs, Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef COLOR_DODGE\nvec3 f = vec3(colorDodge(Cb.r, Cs.r), colorDodge(Cb.g, Cs.g), colorDodge(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef COLOR_BURN\nvec3 f = vec3(colorBurn(Cb.r, Cs.r), colorBurn(Cb.g, Cs.g), colorBurn(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef HARD_LIGHT\nvec3 f = vec3(hardLight(Cb.r, Cs.r), hardLight(Cb.g, Cs.g), hardLight(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef SOFT_LIGHT\nvec3 f = vec3(softLight(Cb.r, Cs.r), softLight(Cb.g, Cs.g), softLight(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef DIFFERENCE\ngl_FragColor = vec4(abs(Cb - Cs) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef EXCLUSION\nvec3 f = Cs + Cb - 2.0 * Cs * Cb;\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef INVERT\ngl_FragColor = vec4((1.0 - Cb) * as * ab + Cb * ab * (1.0 - as), ab);\n#endif\n#ifdef VIVID_LIGHT\nvec3 f = vec3(vividLight(Cb.r, Cs.r),\nvividLight(Cb.g, Cs.g),\nvividLight(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef HUE\nvec3 f = setLumSat(Cs,Cb,Cb);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef SATURATION\nvec3 f = setLumSat(Cb,Cs,Cb);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef COLOR\nvec3 f = setLum(Cs,Cb);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef LUMINOSITY\nvec3 f = setLum(Cb,Cs);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef PLUS\ngl_FragColor = clamp(vec4(src.r + Cb.r, src.g + Cb.g, src.b + Cb.b, as + ab), 0.0, 1.0);\n#endif\n#ifdef MINUS\ngl_FragColor = vec4(clamp(vec3(Cb.r - src.r, Cb.g - src.g, Cb.b - src.b), 0.0, 1.0), ab * as);\n#endif\n#ifdef AVERAGE\nvec3 f = (Cb + Cs) / 2.0;\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef REFLECT\nvec3 f = vec3(reflectBlend(Cb.r, Cs.r),\nreflectBlend(Cb.g, Cs.g),\nreflectBlend(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#endif\n}","blend.vert":"attribute vec2 a_position;\nvarying mediump vec2 v_uv;\nvoid main(void) {\ngl_Position = vec4(a_position , 0.0, 1.0);\nv_uv = (a_position + 1.0) / 2.0;\n}"},dot:{dot:{"dot.frag":"precision mediump float;\nvarying vec4 v_color;\nvarying float v_dotRatio;\nvarying float v_invEdgeRatio;\nuniform highp float u_tileZoomFactor;\nvoid main()\n{\nfloat dist = length(gl_PointCoord - vec2(.5, .5)) * 2.;\nfloat alpha = smoothstep(0., 1., v_invEdgeRatio * (dist - v_dotRatio) + 1.);\ngl_FragColor = v_color * alpha;\n}","dot.vert":"precision highp float;\nattribute vec2 a_pos;\nuniform sampler2D u_texture;\nuniform highp mat3 u_dvsMat3;\nuniform highp float u_tileZoomFactor;\nuniform highp float u_dotSize;\nuniform highp float u_pixelRatio;\nvarying vec2 v_pos;\nvarying vec4 v_color;\nvarying float v_dotRatio;\nvarying float v_invEdgeRatio;\nconst float EPSILON = 0.000001;\nvoid main()\n{\nmat3 tileToTileTexture = mat3( 1., 0., 0.,\n0., -1., 0.,\n0., 1., 1. );\nvec3 texCoords = tileToTileTexture * vec3(a_pos.xy / 512., 1.);\nv_color = texture2D(u_texture, texCoords.xy);\nfloat smoothEdgeWidth = max(u_dotSize / 2., 1.) ;\nfloat z = 0.;\nz += 2.0 * step(v_color.a, EPSILON);\ngl_PointSize = (smoothEdgeWidth + u_dotSize);\ngl_Position = vec4((u_dvsMat3 * vec3(a_pos + .5, 1.)).xy, z, 1.);\nv_dotRatio = u_dotSize / gl_PointSize;\nv_invEdgeRatio = -1. / ( smoothEdgeWidth / gl_PointSize );\ngl_PointSize *= (u_pixelRatio * u_tileZoomFactor);\n}"}},filtering:{"bicubic.glsl":"vec4 computeWeights(float v) {\nfloat b = 1.0 / 6.0;\nfloat v2 = v * v;\nfloat v3 = v2 * v;\nfloat w0 = b * (-v3 + 3.0 * v2 - 3.0 * v + 1.0);\nfloat w1 = b * (3.0 * v3 - 6.0 * v2 + 4.0);\nfloat w2 = b * (-3.0 * v3 + 3.0 * v2 + 3.0 * v + 1.0);\nfloat w3 = b * v3;\nreturn vec4(w0, w1, w2, w3);\n}\nvec4 bicubicOffsetsAndWeights(float v) {\nvec4 w = computeWeights(v);\nfloat g0 = w.x + w.y;\nfloat g1 = w.z + w.w;\nfloat h0 = 1.0 - (w.y / g0) + v;\nfloat h1 = 1.0 + (w.w / g1) - v;\nreturn vec4(h0, h1, g0, g1);\n}\nvec4 sampleBicubicBSpline(sampler2D sampler, vec2 coords, vec2 texSize) {\nvec2 eX = vec2(1.0 / texSize.x, 0.0);\nvec2 eY = vec2(0.0, 1.0 / texSize.y);\nvec2 texel = coords * texSize - 0.5;\nvec3 hgX = bicubicOffsetsAndWeights(fract(texel).x).xyz;\nvec3 hgY = bicubicOffsetsAndWeights(fract(texel).y).xyz;\nvec2 coords10 = coords + hgX.x * eX;\nvec2 coords00 = coords - hgX.y * eX;\nvec2 coords11 = coords10 + hgY.x * eY;\nvec2 coords01 = coords00 + hgY.x * eY;\ncoords10 = coords10 - hgY.y * eY;\ncoords00 = coords00 - hgY.y * eY;\nvec4 color00 = texture2D(sampler, coords00);\nvec4 color10 = texture2D(sampler, coords10);\nvec4 color01 = texture2D(sampler, coords01);\nvec4 color11 = texture2D(sampler, coords11);\ncolor00 = mix(color00, color01, hgY.z);\ncolor10 = mix(color10, color11, hgY.z);\ncolor00 = mix(color00, color10, hgX.z);\nreturn color00;\n}","bilinear.glsl":"vec4 sampleBilinear(sampler2D sampler, vec2 coords, vec2 texSize) {\nvec2 texelStart = floor(coords * texSize);\nvec2 coord0 = texelStart / texSize;\nvec2 coord1 = (texelStart + vec2(1.0, 0.0)) / texSize;\nvec2 coord2 = (texelStart + vec2(0.0, 1.0)) / texSize;\nvec2 coord3 = (texelStart + vec2(1.0, 1.0)) / texSize;\nvec4 color0 = texture2D(sampler, coord0);\nvec4 color1 = texture2D(sampler, coord1);\nvec4 color2 = texture2D(sampler, coord2);\nvec4 color3 = texture2D(sampler, coord3);\nvec2 blend = fract(coords * texSize);\nvec4 color01 = mix(color0, color1, blend.x);\nvec4 color23 = mix(color2, color3, blend.x);\nvec4 color = mix(color01, color23, blend.y);\n#ifdef NNEDGE\nfloat alpha = floor(color0.a * color1.a * color2.a * color3.a + 0.5);\ncolor = color * alpha + (1.0 - alpha) * texture2D(sampler, coords);\n#endif\nreturn color;\n}","epx.glsl":"vec4 sampleEPX(sampler2D sampler, float size, vec2 coords, vec2 texSize) {\nvec2 invSize = 1.0 / texSize;\nvec2 texel = coords * texSize;\nvec2 texel_i = floor(texel);\nvec2 texel_frac = fract(texel);\nvec4 colorP = texture2D(sampler, texel_i * invSize);\nvec4 colorP1 = vec4(colorP);\nvec4 colorP2 = vec4(colorP);\nvec4 colorP3 = vec4(colorP);\nvec4 colorP4 = vec4(colorP);\nvec4 colorA = texture2D(sampler, (texel_i - vec2(0.0, 1.0)) * invSize);\nvec4 colorB = texture2D(sampler, (texel_i + vec2(1.0, 0.0)) * invSize);\nvec4 colorC = texture2D(sampler, (texel_i - vec2(1.0, 0.0)) * invSize);\nvec4 colorD = texture2D(sampler, (texel_i + vec2(0.0, 1.0)) * invSize);\nif (colorC == colorA && colorC != colorD && colorA != colorB) {\ncolorP1 = colorA;\n}\nif (colorA == colorB && colorA != colorC && colorB != colorD) {\ncolorP2 = colorB;\n}\nif (colorD == colorC && colorD != colorB && colorC != colorA) {\ncolorP3 = colorC;\n}\nif (colorB == colorD && colorB != colorA && colorD != colorC) {\ncolorP4 = colorD;\n}\nvec4 colorP12 = mix(colorP1, colorP2, texel_frac.x);\nvec4 colorP34 = mix(colorP1, colorP2, texel_frac.x);\nreturn mix(colorP12, colorP34, texel_frac.y);\n}"},fx:{integrate:{"integrate.frag":"precision mediump float;\nuniform lowp sampler2D u_sourceTexture;\nuniform lowp sampler2D u_maskTexture;\nuniform mediump float u_zoomLevel;\nuniform highp float u_timeDelta;\nuniform highp float u_animationTime;\nvarying highp vec2 v_texcoord;\n#include \nvoid main()\n{\n#ifdef DELTA\nvec4 texel = texture2D(u_sourceTexture, v_texcoord);\nvec4 data0 = texture2D(u_maskTexture, v_texcoord);\nfloat flags = data0.r * 255.0;\nfloat groupMinZoom = data0.g * 255.0;\nfloat isVisible = getFilterBit(flags, 0);\nfloat wouldClip = step(groupMinZoom, u_zoomLevel);\nfloat direction = wouldClip * 1.0 + (1.0 - wouldClip) * -1.0;\nfloat dt = u_timeDelta / max(u_animationTime, 0.0001);\nvec4 nextState = vec4(texel + direction * dt);\ngl_FragColor = vec4(nextState);\n#elif defined(UPDATE)\nvec4 texel = texture2D(u_sourceTexture, v_texcoord);\ngl_FragColor = texel;\n#endif\n}","integrate.vert":"precision mediump float;\nattribute vec2 a_pos;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos;\ngl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n}"}},highlight:{"blur.frag":"varying mediump vec2 v_texcoord;\nuniform mediump vec4 u_direction;\nuniform mediump mat4 u_channelSelector;\nuniform mediump float u_sigma;\nuniform sampler2D u_texture;\nmediump float gauss1(mediump vec2 dir) {\nreturn exp(-dot(dir, dir) / (2.0 * u_sigma * u_sigma));\n}\nmediump vec4 selectChannel(mediump vec4 sample) {\nreturn u_channelSelector * sample;\n}\nvoid accumGauss1(mediump float i, inout mediump float tot, inout mediump float weight) {\nmediump float w = gauss1(i * u_direction.xy);\ntot += selectChannel(texture2D(u_texture, v_texcoord + i * u_direction.zw))[3] * w;\nweight += w;\n}\nvoid main(void) {\nmediump float tot = 0.0;\nmediump float weight = 0.0;\naccumGauss1(-5.0, tot, weight);\naccumGauss1(-4.0, tot, weight);\naccumGauss1(-3.0, tot, weight);\naccumGauss1(-2.0, tot, weight);\naccumGauss1(-1.0, tot, weight);\naccumGauss1(0.0, tot, weight);\naccumGauss1(1.0, tot, weight);\naccumGauss1(2.0, tot, weight);\naccumGauss1(3.0, tot, weight);\naccumGauss1(4.0, tot, weight);\naccumGauss1(5.0, tot, weight);\ngl_FragColor = vec4(0.0, 0.0, 0.0, tot / weight);\n}","highlight.frag":"varying mediump vec2 v_texcoord;\nuniform sampler2D u_texture;\nuniform mediump float u_sigma;\nuniform sampler2D u_shade;\nuniform mediump vec2 u_minMaxDistance;\nmediump float estimateDistance() {\nmediump float y = texture2D(u_texture, v_texcoord)[3];\nconst mediump float y0 = 0.5;\nmediump float m0 = 1.0 / (sqrt(2.0 * 3.1415) * u_sigma);\nmediump float d = (y - y0) / m0;\nreturn d;\n}\nmediump vec4 shade(mediump float d) {\nmediump float mappedDistance = (d - u_minMaxDistance.x) / (u_minMaxDistance.y - u_minMaxDistance.x);\nmappedDistance = clamp(mappedDistance, 0.0, 1.0);\nreturn texture2D(u_shade, vec2(mappedDistance, 0.5));\n}\nvoid main(void) {\nmediump float d = estimateDistance();\ngl_FragColor = shade(d);\n}","textured.vert":"attribute mediump vec2 a_position;\nattribute mediump vec2 a_texcoord;\nvarying mediump vec2 v_texcoord;\nvoid main(void) {\ngl_Position = vec4(a_position, 0.0, 1.0);\nv_texcoord = a_texcoord;\n}"},magnifier:{"magnifier.frag":"uniform lowp vec4 u_background;\nuniform mediump sampler2D u_readbackTexture;\nuniform mediump sampler2D u_maskTexture;\nuniform mediump sampler2D u_overlayTexture;\nuniform bool u_maskEnabled;\nuniform bool u_overlayEnabled;\nvarying mediump vec2 v_texCoord;\nconst lowp float barrelFactor = 1.1;\nlowp vec2 barrel(lowp vec2 uv) {\nlowp vec2 uvn = uv * 2.0 - 1.0;\nif (uvn.x == 0.0 && uvn.y == 0.0) {\nreturn vec2(0.5, 0.5);\n}\nlowp float theta = atan(uvn.y, uvn.x);\nlowp float r = pow(length(uvn), barrelFactor);\nreturn r * vec2(cos(theta), sin(theta)) * 0.5 + 0.5;\n}\nvoid main(void)\n{\nlowp vec4 color = texture2D(u_readbackTexture, barrel(v_texCoord));\ncolor = (color + (1.0 - color.a) * u_background);\nlowp float mask = u_maskEnabled ? texture2D(u_maskTexture, v_texCoord).a : 1.0;\ncolor *= mask;\nlowp vec4 overlayColor = u_overlayEnabled ? texture2D(u_overlayTexture, v_texCoord) : vec4(0);\ngl_FragColor = overlayColor + (1.0 - overlayColor.a) * color;\n}","magnifier.vert":"precision mediump float;\nattribute mediump vec2 a_pos;\nuniform mediump vec4 u_drawPos;\nvarying mediump vec2 v_texCoord;\nvoid main(void)\n{\nv_texCoord = a_pos;\ngl_Position = vec4(u_drawPos.xy + vec2(a_pos - 0.5) * u_drawPos.zw, 0.0, 1.0);\n}"},materials:{"attributeData.glsl":"uniform highp sampler2D u_attributeData0;\nuniform highp sampler2D u_attributeData1;\nuniform highp sampler2D u_attributeData2;\nuniform highp sampler2D u_attributeData3;\nuniform highp int u_attributeTextureSize;\nhighp vec2 getAttributeDataCoords(in highp vec3 id) {\nhighp vec3 texel = unpackDisplayIdTexel(id);\nhighp float size = float(u_attributeTextureSize);\nhighp float u32 = float(int(texel.r) + int(texel.g) * 256 + int(texel.b) * 256 * 256);\nhighp float col = mod(u32, size);\nhighp float row = (u32 - col) / size;\nhighp float u = col / size;\nhighp float v = row / size;\nreturn vec2(u, v);\n}\nhighp vec2 getAttributeDataTextureCoords(in highp vec3 id) {\nreturn (getAttributeDataCoords(id) * 2.0) - 1.0 + (.5 / vec2(u_attributeTextureSize));\n}\nhighp vec4 getAttributeData0(in highp vec3 id) {\nvec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData0, coords);\n}\nhighp vec4 getAttributeData1(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData1, coords);\n}\nhighp vec4 getAttributeData2(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData2, coords);\n}\nhighp vec4 getAttributeData3(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData3, coords);\n}\nfloat u88VVToFloat(in vec2 v) {\nbool isMagic = v.x == 255.0 && v.y == 255.0;\nif (isMagic) {\nreturn NAN_MAGIC_NUMBER;\n}\nreturn (v.x + v.y * float(0x100)) - 32768.0;\n}","constants.glsl":"const float C_DEG_TO_RAD = 3.14159265359 / 180.0;\nconst float C_256_TO_RAD = 3.14159265359 / 128.0;\nconst float SIGNED_BYTE_TO_UNSIGNED = 128.0;\nconst float POSITION_PRECISION = 1.0 / 8.0;\nconst float FILL_POSITION_PRECISION = 1.0 / 1.0;\nconst float SOFT_EDGE_RATIO = 1.0;\nconst float THIN_LINE_WIDTH_FACTOR = 1.1;\nconst float THIN_LINE_HALF_WIDTH = 1.0;\nconst float EXTRUDE_SCALE_PLACEMENT_PADDING = 1.0 / 4.0;\nconst float OFFSET_PRECISION = 1.0 / 8.0;\nconst float OUTLINE_SCALE = 1.0 / 5.0;\nconst float SDF_FONT_SIZE = 24.0;\nconst float MAX_SDF_DISTANCE = 8.0;\nconst float PLACEMENT_PADDING = 8.0;\nconst float EPSILON = 0.00001;\nconst int MAX_FILTER_COUNT = 2;\nconst int ATTR_VV_SIZE = 0;\nconst int ATTR_VV_COLOR = 1;\nconst int ATTR_VV_OPACITY = 2;\nconst int ATTR_VV_ROTATION = 3;\nconst highp float NAN_MAGIC_NUMBER = 1e-30;\nconst int BITSET_GENERIC_LOCK_COLOR = 1;\nconst int BITSET_MARKER_ALIGNMENT_MAP = 0;\nconst int BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE = 2;\nconst int BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY = 3;\nconst int BITSET_TYPE_FILL_OUTLINE = 0;\nconst int BITSET_LINE_SCALE_DASH = 2;",fill:{"common.glsl":"#ifdef PATTERN\nuniform mediump vec2 u_mosaicSize;\n#endif\n#ifdef DOT_DENSITY\nuniform lowp vec4 u_isActive[ 2 ];\nuniform highp float u_dotValue;\nuniform highp float u_tileDotsOverArea;\nuniform highp float u_dotTextureDotCount;\nuniform mediump float u_tileZoomFactor;\n#endif\nvarying highp vec3 v_id;\nvarying lowp vec4 v_color;\nvarying lowp float v_opacity;\nvarying mediump vec4 v_aux1;\n#ifdef PATTERN\nvarying mediump vec2 v_tileTextureCoord;\n#endif\n#ifdef OUTLINED_FILL\nvarying lowp float v_isOutline;\n#endif\n#ifdef DOT_DENSITY\nvarying highp vec2 v_dotTextureCoords;\nvarying highp vec4 v_dotThresholds[ 2 ];\n#endif","fill.frag":"precision highp float;\n#include \n#include \n#include \n#ifdef PATTERN\nuniform lowp sampler2D u_texture;\n#endif\n#ifdef DOT_DENSITY\nuniform mediump mat4 u_dotColors[ 2 ];\nuniform sampler2D u_dotTextures[ 2 ];\nuniform vec4 u_dotBackgroundColor;\n#endif\n#ifdef OUTLINED_FILL\n#include \n#include \nlowp vec4 drawLine() {\nfloat v_lineWidth = v_aux1.x;\nvec2 v_normal = v_aux1.yz;\nLineData inputs = LineData(\nv_color,\nv_normal,\nv_lineWidth,\nv_opacity,\nv_id\n);\nreturn shadeLine(inputs);\n}\n#endif\nlowp vec4 drawFill() {\nlowp vec4 out_color = vec4(0.);\n#ifdef HITTEST\nout_color = vec4(1.0, 0.0, 0.0, 0.0);\n#elif defined(PATTERN)\nmediump vec4 v_tlbr = v_aux1;\nmediump vec2 normalizedTextureCoord = mod(v_tileTextureCoord, 1.0);\nmediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord);\nlowp vec4 color = texture2D(u_texture, samplePos);\nout_color = v_opacity * v_color * color;\n#elif defined(DOT_DENSITY) && !defined(HIGHLIGHT)\nvec4 textureThresholds0 = texture2D(u_dotTextures[0], v_dotTextureCoords);\nvec4 textureThresholds1 = texture2D(u_dotTextures[1], v_dotTextureCoords);\nvec4 difference0 = v_dotThresholds[0] - textureThresholds0;\nvec4 difference1 = v_dotThresholds[1] - textureThresholds1;\n#ifdef DD_DOT_BLENDING\nvec4 isPositive0 = step(0.0, difference0);\nvec4 isPositive1 = step(0.0, difference1);\nfloat weightSum = dot(isPositive0, difference0) + dot(isPositive1, difference1);\nfloat lessThanEqZero = step(weightSum, 0.0);\nfloat greaterThanZero = 1.0 - lessThanEqZero ;\nfloat divisor = (weightSum + lessThanEqZero);\nvec4 weights0 = difference0 * isPositive0 / divisor;\nvec4 weights1 = difference1 * isPositive1 / divisor;\nvec4 dotColor = u_dotColors[0] * weights0 + u_dotColors[1] * weights1;\nvec4 preEffectColor = greaterThanZero * dotColor + lessThanEqZero * u_dotBackgroundColor;\n#else\nfloat diffMax = max(max4(difference0), max4(difference1));\nfloat lessThanZero = step(diffMax, 0.0);\nfloat greaterOrEqZero = 1.0 - lessThanZero;\nvec4 isMax0 = step(diffMax, difference0);\nvec4 isMax1 = step(diffMax, difference1);\nvec4 dotColor = u_dotColors[0] * isMax0 + u_dotColors[1] * isMax1;\nvec4 preEffectColor = greaterOrEqZero * dotColor + lessThanZero * u_dotBackgroundColor;\n#endif\nout_color = preEffectColor;\n#else\nout_color = v_opacity * v_color;\n#endif\n#ifdef HIGHLIGHT\nout_color.a = 1.0;\n#endif\nreturn out_color;\n}\nvoid main() {\n#ifdef OUTLINED_FILL\nif (v_isOutline > 0.5) {\ngl_FragColor = drawLine();\n} else {\ngl_FragColor = drawFill();\n}\n#else\ngl_FragColor = drawFill();\n#endif\n}","fill.vert":"#define PACKED_LINE\nprecision highp float;\nattribute float a_bitset;\n#ifdef DOT_DENSITY\nattribute float a_inverseArea;\nvec4 a_color = vec4(0.0, 0.0, 0.0, 1.0);\nvec2 a_zoomRange = vec2(0.0, 10000.0);\n#else\nattribute vec4 a_color;\nattribute vec4 a_aux2;\nattribute vec4 a_aux3;\n#ifndef SIMPLE\nattribute vec4 a_aux1;\nattribute vec2 a_zoomRange;\n#else\nvec2 a_zoomRange = vec2(0.0, 10000.0);\n#endif\n#endif\nuniform vec2 u_tileOffset;\n#include \n#include \n#include \n#ifdef DOT_DENSITY\nvec4 dotThreshold(vec4 featureAttrOverFeatureArea, float dotValue, float tileDotsOverArea) {\nreturn featureAttrOverFeatureArea * (1.0 / dotValue) * (1.0 / tileDotsOverArea);\n}\n#endif\n#ifdef OUTLINED_FILL\n#include \n#include \nvoid drawLine(out lowp vec4 out_color, out highp vec3 out_pos) {\nLineData outputs = buildLine(\nout_pos,\na_id,\na_pos,\na_color,\n(a_aux3.xy - 128.) / 16.,\n(a_aux3.zw - 128.) / 16.,\n0.,\na_aux2.z / 16.,\na_bitset,\nvec4(0.),\nvec2(0.),\na_aux2.w / 16.\n);\nv_id = outputs.id;\nv_color = outputs.color;\nv_opacity = outputs.opacity;\nv_aux1 = vec4(outputs.lineHalfWidth, outputs.normal, 0.);\nout_color = outputs.color;\n}\n#endif\nvoid drawFill(out lowp vec4 out_color, out highp vec3 out_pos) {\nfloat a_bitSet = a_bitset;\nv_color = getColor(a_color, a_bitSet, BITSET_GENERIC_LOCK_COLOR);\nv_opacity = getOpacity();\nv_id = norm(a_id);\nout_color = v_color;\n#ifdef DOT_DENSITY\nmat3 tileToTileNormalized = mat3( 2. / 512., 0., 0.,\n0., -2. / 512., 0.,\n-1., 1., 1. );\nout_pos = tileToTileNormalized * vec3((a_pos * FILL_POSITION_PRECISION), 1.);\n#else\nout_pos = u_dvsMat3 * vec3(a_pos * FILL_POSITION_PRECISION, 1.);\n#endif\n#ifdef PATTERN\nvec4 a_tlbr = a_aux1;\nfloat a_width = a_aux2.x;\nfloat a_height = a_aux2.y;\nvec2 a_offset = a_aux2.zw;\nvec2 a_scale = a_aux3.xy;\nfloat a_angle = a_aux3.z;\nvec2 scale = (1.0 / SIGNED_BYTE_TO_UNSIGNED) * a_scale;\nfloat width = u_pixelRatio * u_zoomFactor * a_width * scale.x;\nfloat height = u_pixelRatio * u_zoomFactor * a_height * scale.y;\nfloat angle = C_256_TO_RAD * a_angle;\nfloat sinA = sin(angle);\nfloat cosA = cos(angle);\nmat3 patternMatrix = mat3(cosA / width, sinA / height, 0,\n-sinA / width, cosA / height, 0,\n0, 0, 1);\nvec2 tileOffset = vec2(u_tileOffset.x * cosA - u_tileOffset.y * sinA, u_tileOffset.x * sinA + u_tileOffset.y * cosA);\ntileOffset = mod(tileOffset, vec2(a_aux2.x, a_aux2.y));\nvec2 symbolOffset = (a_offset - tileOffset - SIGNED_BYTE_TO_UNSIGNED) / vec2(width, height);\nv_tileTextureCoord = (patternMatrix * vec3(a_pos * FILL_POSITION_PRECISION, 1.0)).xy - symbolOffset;\nv_aux1 = a_tlbr / u_mosaicSize.xyxy;\n#elif defined(DOT_DENSITY)\nvec4 ddAttributeData0 = getAttributeData2(a_id) * u_isActive[0] * a_inverseArea;\nvec4 ddAttributeData1 = getAttributeData3(a_id) * u_isActive[1] * a_inverseArea;\nfloat size = u_tileZoomFactor * 512.0 * 1.0 / u_pixelRatio;\nv_dotThresholds[0] = dotThreshold(ddAttributeData0, u_dotValue, u_tileDotsOverArea);\nv_dotThresholds[1] = dotThreshold(ddAttributeData1, u_dotValue, u_tileDotsOverArea);\nv_dotTextureCoords = (a_pos * FILL_POSITION_PRECISION + 0.5) / size;\n#endif\n}\n#ifdef HITTEST\nvoid draw(out lowp vec4 out_color, out highp vec3 out_pos) {\n#ifdef OUTLINED_FILL\nif (getBit(a_bitset, BITSET_TYPE_FILL_OUTLINE) > 0.5) {\nout_pos = vec3(0., 0., 2.);\nreturn;\n}\n#endif\nout_pos = hittestFill();\ngl_PointSize = 1.0;\n}\n#elif defined(OUTLINED_FILL)\nvoid draw(out lowp vec4 out_color, out highp vec3 out_pos) {\nv_isOutline = getBit(a_bitset, BITSET_TYPE_FILL_OUTLINE);\nif (v_isOutline > 0.5) {\ndrawLine(out_color, out_pos);\n} else {\ndrawFill(out_color, out_pos);\n}\n}\n#else\n#define draw drawFill\n#endif\nvoid main()\n{\nINIT;\nlowp vec4 color = vec4(0.);\nhighp vec3 pos = vec3(0.);\ndraw(color, pos);\ngl_Position = vec4(clip(color, pos, getFilterFlags(), a_zoomRange), 1.0);\n}","hittest.glsl":"#include \n#ifdef HITTEST\nattribute vec2 a_pos1;\nattribute vec2 a_pos2;\nconst float EPSILON_PARALLEL = 0.05;\nbool hasSameSide(vec3 p0, vec3 p1, vec3 a, vec3 b) {\nvec3 cp0 = cross(b - a, p0 - a);\nvec3 cp1 = cross(b - a, p1 - a);\nreturn dot(cp0, cp1) >= 0.;\n}\nbool intersectPointTriangle(vec3 p, vec3 a, vec3 b, vec3 c) {\nreturn hasSameSide(p, a, b, c) && hasSameSide(p, b, a, c) && hasSameSide(p, c, a, b);\n}\nbool intersectCircleTriange(vec3 p, vec3 a, vec3 b, vec3 c, float radius) {\nvec2 ba = b.xy - a.xy;\nvec2 ca = c.xy - a.xy;\nfloat crossProduct = ba.x * ca.y - ca.x * ba.y;\nbool isParallel = crossProduct < EPSILON_PARALLEL && crossProduct > -EPSILON_PARALLEL;\nif (isParallel) {\nreturn false;\n}\nif (distance(p, a) <= radius) {\nreturn true;\n}\nif (distance(p, b) <= radius) {\nreturn true;\n}\nif (distance(p, c) <= radius) {\nreturn true;\n}\nvec3 p0 = p - normalize(p - a) * radius;\nif (intersectPointTriangle(p0, a, b, c)) {\nreturn true;\n}\nvec3 p1 = p - normalize(p - b) * radius;\nif (intersectPointTriangle(p1, a, b, c)) {\nreturn true;\n}\nvec3 p2 = p - normalize(p - c) * radius;\nreturn intersectPointTriangle(p2, a, b, c);\n}\nvec3 hittestFill() {\nvec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * FILL_POSITION_PRECISION, 1.);\nvec3 pos1 = u_viewMat3 * u_tileMat3 * vec3(a_pos1 * FILL_POSITION_PRECISION, 1.);\nvec3 pos2 = u_viewMat3 * u_tileMat3 * vec3(a_pos2 * FILL_POSITION_PRECISION, 1.);\nvec3 outTextureCoords = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nvec3 hittestPos = vec3(u_hittestPos, 1.);\nfloat hittestDist = u_hittestDist;\nif (!intersectCircleTriange(hittestPos, pos, pos1, pos2, hittestDist)) {\noutTextureCoords.z += 2.0;\n}\nreturn outTextureCoords;\n}\n#endif"},hittest:{"common.glsl":"#ifdef HITTEST\nuniform float u_hittestDist;\nuniform highp vec2 u_hittestPos;\n#endif"},icon:{"common.glsl":"uniform lowp vec2 u_mosaicSize;\nvarying lowp vec4 v_color;\nvarying highp vec3 v_id;\nvarying highp vec4 v_sizeTex;\nvarying mediump vec3 v_pos;\nvarying highp float v_filters;\nvarying lowp float v_opacity;\n#ifdef SDF\nvarying lowp vec4 v_outlineColor;\nvarying mediump float v_outlineWidth;\nvarying mediump float v_distRatio;\nvarying mediump float v_overridingOutlineColor;\nvarying mediump float v_isThin;\n#endif","hittest.glsl":"#include \n#ifdef HITTEST\nvec3 hittestMarker(vec2 size) {\nvec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.);\nvec3 hittestPos = vec3(u_hittestPos, 1.);\nfloat hittestDist = u_hittestDist;\nvec3 outTextureCoords = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nfloat maxHalfSize = max(size.x, size.y) / 2.;\nif (distance(pos, hittestPos) - maxHalfSize > hittestDist) {\noutTextureCoords.z += 2.0;\n}\nreturn outTextureCoords;\n}\n#endif","icon.frag":"precision mediump float;\n#include \n#include \n#include \n#include \n#include \nuniform lowp sampler2D u_texture;\n#ifdef HITTEST\nvec4 getColor() {\nreturn vec4(1.);\n}\n#elif defined(SDF)\nvec4 getColor() {\nvec2 v_size = v_sizeTex.xy;\nvec2 v_tex = v_sizeTex.zw;\nlowp vec4 fillPixelColor = v_color;\nfloat d = 0.5 - rgba2float(texture2D(u_texture, v_tex));\nfloat size = max(v_size.x, v_size.y);\nfloat dist = d * size * SOFT_EDGE_RATIO * v_distRatio;\nfillPixelColor *= clamp(0.5 - dist, 0.0, 1.0);\nfloat outlineWidth = v_outlineWidth;\n#ifdef HIGHLIGHT\noutlineWidth = max(outlineWidth, 4.0 * v_isThin);\n#endif\nif (outlineWidth > 0.25) {\nlowp vec4 outlinePixelColor = v_overridingOutlineColor * v_color + (1.0 - v_overridingOutlineColor) * v_outlineColor;\nfloat clampedOutlineSize = min(outlineWidth, size);\noutlinePixelColor *= clamp(0.5 - abs(dist) + clampedOutlineSize * 0.5, 0.0, 1.0);\nreturn v_opacity * ((1.0 - outlinePixelColor.a) * fillPixelColor + outlinePixelColor);\n}\nreturn v_opacity * fillPixelColor;\n}\n#else\nvec4 getColor() {\nvec2 v_tex = v_sizeTex.zw;\nlowp vec4 texColor = texture2D(u_texture, v_tex);\nreturn v_opacity * texColor * v_color;\n}\n#endif\nvoid main()\n{\nvec4 color = getColor();\n#ifdef HIGHLIGHT\ncolor.a = step(1.0 / 255.0, color.a);\n#endif\ngl_FragColor = color;\n}","icon.vert":"precision highp float;\nattribute vec4 a_color;\nattribute vec4 a_outlineColor;\nattribute vec4 a_sizeAndOutlineWidth;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nattribute vec2 a_bitSetAndDistRatio;\nattribute vec2 a_zoomRange;\n#include \n#include \n#include \nvec2 getMarkerSize(inout vec2 offset, inout vec2 baseSize, inout float outlineSize, in float referenceSize, in float bitSet) {\nvec2 outSize = baseSize;\n#ifdef VV_SIZE\nfloat r = getSize(referenceSize) / referenceSize;\noutSize.xy *= r;\noffset.xy *= r;\nfloat scaleSymbolProportionally = getBit(bitSet, BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY);\noutlineSize *= scaleSymbolProportionally * (r - 1.0) + 1.0;\n#endif\nreturn outSize;\n}\nvec3 getOffset(in vec2 in_offset, float a_bitSet) {\nfloat isMapAligned = getBit(a_bitSet, BITSET_MARKER_ALIGNMENT_MAP);\nvec3 offset = getRotation() * vec3(in_offset, 0.0);\nreturn getMatrix(isMapAligned) * offset;\n}\nvoid main()\n{\nINIT;\nvec2 a_size = a_sizeAndOutlineWidth.xy * a_sizeAndOutlineWidth.xy / 128.0;\nvec2 a_offset = a_vertexOffset / 16.0;\nfloat a_outlineSize = a_sizeAndOutlineWidth.z * a_sizeAndOutlineWidth.z / 128.0;\nfloat a_bitSet = a_bitSetAndDistRatio.x;\nvec2 v_size = getMarkerSize(a_offset, a_size, a_outlineSize, a_sizeAndOutlineWidth.w * a_sizeAndOutlineWidth.w / 128.0, a_bitSet);\nvec2 v_tex = a_texCoords / u_mosaicSize;\nv_color = getColor(a_color, a_bitSet, BITSET_GENERIC_LOCK_COLOR);\nv_opacity = getOpacity();\nv_id = norm(a_id);\nv_filters = getFilterFlags();\nv_pos = u_dvsMat3 * vec3(a_pos * POSITION_PRECISION, 1.0) + getOffset(a_offset, a_bitSet);\nv_sizeTex = vec4(v_size.xy, v_tex.xy);\n#ifdef SDF\nv_isThin = getBit(a_bitSet, BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE);\n#ifdef VV_COLOR\nv_overridingOutlineColor = v_isThin;\n#else\nv_overridingOutlineColor = 0.0;\n#endif\nv_outlineWidth = min(a_outlineSize, max(max(v_size.x, v_size.y) - 0.99, 0.0));\nv_outlineColor = a_outlineColor;\nv_distRatio = a_bitSetAndDistRatio.y / 126.0;\n#endif\n#ifdef HITTEST\nvec3 pos = hittestMarker(v_size.xy);\ngl_PointSize = 1.;\ngl_Position = vec4(clip(v_color, pos, v_filters, a_zoomRange), 1.0);\n#else\ngl_Position = vec4(clip(v_color, v_pos, v_filters, a_zoomRange), 1.0);\n#endif\n}"},label:{"common.glsl":"uniform mediump float u_zoomLevel;\nuniform mediump float u_mapRotation;\nuniform mediump float u_mapAligned;\nuniform mediump vec2 u_mosaicSize;\nvarying mediump float v_antialiasingWidth;\nvarying mediump float v_edgeDistanceOffset;\nvarying mediump vec2 v_tex;\nvarying mediump vec4 v_color;\nvarying lowp vec4 v_animation;","label.frag":"#include ","label.vert":"precision highp float;\n#include \n#include \nattribute vec4 a_color;\nattribute vec4 a_haloColor;\nattribute vec4 a_texAndSize;\nattribute vec4 a_refSymbolAndPlacementOffset;\nattribute vec4 a_glyphData;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nuniform float u_isHalo;\nuniform float u_mapRotation;\nuniform float u_mapAligned;\nfloat getZ(in float minZoom, in float maxZoom, in float angle) {\nfloat glyphAngle = angle * 360.0 / 254.0;\nfloat mapAngle = u_mapRotation * 360.0 / 254.0;\nfloat diffAngle = min(360.0 - abs(mapAngle - glyphAngle), abs(mapAngle - glyphAngle));\nfloat z = 0.0;\nz += u_mapAligned * (2.0 * (1.0 - step(minZoom, u_currentZoom)));\nz += u_mapAligned * 2.0 * step(90.0, diffAngle);\nz += 2.0 * (1.0 - step(u_currentZoom, maxZoom));\nreturn z;\n}\nvoid main()\n{\nINIT;\nfloat groupMinZoom = getMinZoom();\nfloat glyphMinZoom = a_glyphData.x;\nfloat glyphMaxZoom = a_glyphData.y;\nfloat glyphAngle = a_glyphData.z;\nfloat a_minZoom = max(groupMinZoom, glyphMinZoom);\nfloat a_placementPadding = a_refSymbolAndPlacementOffset.x * EXTRUDE_SCALE_PLACEMENT_PADDING;\nvec2 a_placementDir = unpack_u8_nf32(a_refSymbolAndPlacementOffset.zw);\nfloat a_refSymbolSize = a_refSymbolAndPlacementOffset.y;\nfloat fontSize = a_texAndSize.z;\nfloat haloSize = a_texAndSize.w * OUTLINE_SCALE;\nvec2 vertexOffset = a_vertexOffset * OFFSET_PRECISION;\nvec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nfloat z = getZ(a_minZoom, glyphMaxZoom, glyphAngle);\nfloat fontScale = fontSize / SDF_FONT_SIZE;\nfloat halfSize = getSize(a_refSymbolSize) / 2.0;\nfloat animation = pow(getAnimationState(), vec4(2.0)).r;\nv_color = animation * ((1.0 - u_isHalo) * a_color + (u_isHalo * a_haloColor));\nv_opacity = 1.0;\nv_tex = a_texCoords / u_mosaicSize;\nv_edgeDistanceOffset = u_isHalo * haloSize / fontScale / MAX_SDF_DISTANCE;\nv_antialiasingWidth = 0.105 * SDF_FONT_SIZE / fontSize / u_pixelRatio;\nvec2 placementOffset = a_placementDir * (halfSize + a_placementPadding);\nvec3 glyphOffset = u_displayMat3 * vec3(vertexOffset + placementOffset, 0.0);\nvec3 v_pos = vec3((u_dvsMat3 * pos + glyphOffset).xy, z);\ngl_Position = vec4(v_pos, 1.0);\n#ifdef DEBUG\nv_color = vec4(a_color.rgb, z == 0.0 ? 1.0 : 0.645);\n#endif\n}"},line:{"common.glsl":"varying lowp vec4 v_color;\nvarying highp vec3 v_id;\nvarying mediump vec2 v_normal;\nvarying mediump float v_lineHalfWidth;\nvarying lowp float v_opacity;\n#ifdef PATTERN\nvarying mediump vec4 v_tlbr;\nvarying mediump vec2 v_patternSize;\n#endif\n#if defined(PATTERN) || defined(SDF)\nvarying highp float v_accumulatedDistance;\n#endif\n#ifdef SDF\nvarying mediump float v_lineWidthRatio;\n#endif","hittest.glsl":"#include \n#ifdef HITTEST\nattribute vec2 a_pos1;\nattribute vec2 a_pos2;\nbool intersectCircleLineInner(vec3 p, vec3 a, vec3 b, float radius) {\nvec3 v0 = a - p;\nvec3 b2 = b - p;\nvec3 v = b2 - v0;\nfloat D = 4. * dot(v0, v) * dot(v0, v) - 4. * dot(v, v) * ( dot(v0, v0) - radius * radius );\nif (D < 0.) {\nreturn false;\n}\nfloat sqrtD = sqrt(D);\nfloat t0 = (-2. * dot(v0, v) + sqrtD) / (2. * dot(v, v));\nfloat t1 = (-2. * dot(v0, v) - sqrtD) / (2. * dot(v, v));\nreturn ((t0 >= 0. && t0 <= 1.) || (t1 >= 0. && t1 <= 1.));\n}\nbool intersectCircleLine(vec3 p, vec3 a, vec3 b, vec3 c, float radius) {\nreturn intersectCircleLineInner(p, a, b, radius) || intersectCircleLineInner(p, b, c, radius);\n}\nvec3 hittestLine(float halfWidth) {\nvec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.);\nvec3 pos1 = u_viewMat3 * u_tileMat3 * vec3(a_pos1 * POSITION_PRECISION, 1.);\nvec3 pos2 = u_viewMat3 * u_tileMat3 * vec3(a_pos2 * POSITION_PRECISION, 1.);\nvec3 outTextureCoords = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nvec3 hittestPos = vec3(u_hittestPos, 1.);\nfloat hittestDist = u_hittestDist;\nif (!intersectCircleLine(hittestPos, pos, pos1, pos2, hittestDist + halfWidth)) {\noutTextureCoords.z += 2.0;\n}\nreturn outTextureCoords;\n}\n#endif","line.frag":"precision lowp float;\n#include \n#include \n#include \n#include \n#include \n#ifdef HITTEST\nvoid main() {\ngl_FragColor = vec4(1.);\n}\n#else\nvoid main() {\nLineData inputs = LineData(\nv_color,\nv_normal,\nv_lineHalfWidth,\nv_opacity,\n#ifndef OUTLINED_FILL\n#ifdef PATTERN\nv_tlbr,\nv_patternSize,\n#endif\n#ifdef SDF\nv_lineWidthRatio,\n#endif\n#if defined(PATTERN) || defined(SDF)\nv_accumulatedDistance,\n#endif\n#endif\nv_id\n);\ngl_FragColor = shadeLine(inputs);\n}\n#endif","line.vert":"precision highp float;\nattribute vec4 a_color;\nattribute vec4 a_offsetAndNormal;\nattribute vec2 a_accumulatedDistanceAndHalfWidth;\nattribute vec4 a_tlbr;\nattribute vec4 a_segmentDirection;\nattribute vec2 a_aux;\nattribute vec2 a_zoomRange;\n#include \n#include \n#include \n#include \n#include \n#ifdef HITTEST\nvoid draw() {\nfloat aa = 0.5 * u_antialiasing;\nfloat a_halfWidth = a_accumulatedDistanceAndHalfWidth.y / 16.;\nfloat a_cimHalfWidth = a_aux.x / 16. ;\nvec2 a_offset = a_offsetAndNormal.xy / 16.;\nfloat baseWidth = getBaseLineHalfWidth(a_halfWidth, a_cimHalfWidth);\nfloat halfWidth = getLineHalfWidth(baseWidth, aa);\ngl_PointSize = 1.;\nvec3 pos = hittestLine(halfWidth);\ngl_Position = vec4(clip(v_color, pos, getFilterFlags(), a_zoomRange), 1.0);\n}\n#else\nvoid draw()\n{\nhighp vec3 pos = vec3(0.);\nLineData outputs = buildLine(\npos,\na_id,\na_pos,\na_color,\na_offsetAndNormal.xy / 16.,\na_offsetAndNormal.zw / 16.,\na_accumulatedDistanceAndHalfWidth.x,\na_accumulatedDistanceAndHalfWidth.y / 16.,\na_segmentDirection.w,\na_tlbr,\na_segmentDirection.xy / 16.,\na_aux.x / 16.\n);\nv_id = outputs.id;\nv_color = outputs.color;\nv_normal = outputs.normal;\nv_lineHalfWidth = outputs.lineHalfWidth;\nv_opacity = outputs.opacity;\n#ifndef OUTLINED_FILL\n#ifdef PATTERN\nv_tlbr = outputs.tlbr;\nv_patternSize = outputs.patternSize;\n#endif\n#ifdef SDF\nv_lineWidthRatio = outputs.lineWidthRatio;\n#endif\n#if defined(PATTERN) || defined(SDF)\nv_accumulatedDistance = outputs.accumulatedDistance;\n#endif\n#endif\ngl_Position = vec4(clip(outputs.color, pos, getFilterFlags(), a_zoomRange), 1.0);\n}\n#endif\nvoid main() {\nINIT;\ndraw();\n}"},shared:{line:{"common.glsl":"#if !defined(OUTLINED_FILL) && defined(PATTERN)\nuniform mediump vec2 u_mosaicSize;\n#endif\nstruct LineData {\nlowp vec4 color;\nmediump vec2 normal;\nmediump float lineHalfWidth;\nlowp float opacity;\n#ifndef OUTLINED_FILL\n#ifdef PATTERN\nmediump vec4 tlbr;\nmediump vec2 patternSize;\n#endif\n#ifdef SDF\nmediump float lineWidthRatio;\n#endif\n#if defined(PATTERN) || defined(SDF)\nhighp float accumulatedDistance;\n#endif\n#endif\nhighp vec3 id;\n};","line.frag":"uniform lowp float u_blur;\n#if !defined(OUTLINED_FILL) && !defined(HIGHLIGHT)\n#if defined(PATTERN) || defined(SDF)\nuniform sampler2D u_texture;\nuniform highp float u_pixelRatio;\n#endif\n#endif\n#if defined(SDF) && !defined(HIGHLIGHT) && !defined(OUTLINED_FILL)\nlowp vec4 getLineColor(LineData line) {\nmediump float adjustedPatternWidth = line.patternSize.x * 2.0 * line.lineWidthRatio;\nmediump float relativeTexX = fract(u_pixelRatio * line.accumulatedDistance / adjustedPatternWidth);\nmediump float relativeTexY = 0.5 + 0.25 * line.normal.y;\nmediump vec2 texCoord = mix(line.tlbr.xy, line.tlbr.zw, vec2(relativeTexX, relativeTexY));\nmediump float d = rgba2float(texture2D(u_texture, texCoord)) - 0.5;\nfloat dist = d * line.lineHalfWidth;\nreturn line.opacity * clamp(0.5 - dist, 0.0, 1.0) * line.color;\n}\n#elif defined(PATTERN) && !defined(HIGHLIGHT) && !defined(OUTLINED_FILL)\nlowp vec4 getLineColor(LineData line) {\nmediump float lineHalfWidth = line.lineHalfWidth;\nmediump float adjustedPatternWidth = line.patternSize.x * 2.0 * lineHalfWidth / line.patternSize.y;\nmediump float relativeTexX = fract(u_pixelRatio * line.accumulatedDistance / adjustedPatternWidth);\nmediump float relativeTexY = 0.5 + 0.5 * line.normal.y;\nmediump vec2 texCoord = mix(line.tlbr.xy, line.tlbr.zw, vec2(relativeTexY, relativeTexX));\nlowp vec4 color = texture2D(u_texture, texCoord);\nreturn line.opacity * line.color * color;\n}\n#else\nlowp vec4 getLineColor(LineData line) {\nreturn line.opacity * line.color;\n}\n#endif\nvec4 shadeLine(LineData line)\n{\nmediump float thinLineFactor = max(THIN_LINE_WIDTH_FACTOR * step(line.lineHalfWidth, THIN_LINE_HALF_WIDTH), 1.0);\nmediump float fragDist = length(line.normal) * line.lineHalfWidth;\nlowp float alpha = clamp(thinLineFactor * (line.lineHalfWidth - fragDist) / (u_blur + thinLineFactor - 1.0), 0.0, 1.0);\nlowp vec4 out_color = getLineColor(line) * alpha;\n#ifdef HIGHLIGHT\nout_color.a = step(1.0 / 255.0, out_color.a);\n#endif\n#ifdef ID\nif (out_color.a < 1.0 / 255.0) {\ndiscard;\n}\nout_color = vec4(line.id, 0.0);\n#endif\nreturn out_color;\n}","line.vert":"float getBaseLineHalfWidth(in float lineHalfWidth, in float referenceHalfWidth) {\n#ifdef VV_SIZE\nfloat refLineWidth = 2.0 * referenceHalfWidth;\nreturn 0.5 * (lineHalfWidth / referenceHalfWidth) * getSize(refLineWidth);\n#else\nreturn lineHalfWidth;\n#endif\n}\nfloat getLineHalfWidth(in float baseWidth, in float aa) {\nfloat halfWidth = max(baseWidth + aa, 0.45) + 0.1 * aa;\n#ifdef HIGHLIGHT\nhalfWidth = max(halfWidth, 2.0);\n#endif\nreturn halfWidth;\n}\nvec2 getDist(in vec2 offset, in float halfWidth) {\nfloat thinLineFactor = max(THIN_LINE_WIDTH_FACTOR * step(halfWidth, THIN_LINE_HALF_WIDTH), 1.0);\nreturn thinLineFactor * halfWidth * offset;\n}\nLineData buildLine(\nout vec3 out_pos,\nin vec3 in_id,\nin vec2 in_pos,\nin vec4 in_color,\nin vec2 in_offset,\nin vec2 in_normal,\nin float in_accumulatedDist,\nin float in_lineHalfWidth,\nin float in_bitSet,\nin vec4 in_tlbr,\nin vec2 in_segmentDirection,\nin float in_referenceHalfWidth\n)\n{\nfloat aa = 0.5 * u_antialiasing;\nfloat baseWidth = getBaseLineHalfWidth(in_lineHalfWidth, in_referenceHalfWidth);\nfloat halfWidth = getLineHalfWidth(baseWidth, aa);\nfloat z = 2.0 * step(baseWidth, 0.0);\nvec2 dist = getDist(in_offset, halfWidth);\nvec3 offset = u_displayViewMat3 * vec3(dist, 0.0);\nvec3 pos = u_dvsMat3 * vec3(in_pos * POSITION_PRECISION, 1.0) + offset;\n#ifdef OUTLINED_FILL\nvec4 color = in_color;\nfloat opacity = 1.0;\n#else\nvec4 color = getColor(in_color, in_bitSet, 0);\nfloat opacity = getOpacity();\n#ifdef SDF\nconst float SDF_PATTERN_HALF_WIDTH = 15.5;\nfloat scaleDash = getBit(in_bitSet, BITSET_LINE_SCALE_DASH);\nfloat lineWidthRatio = (scaleDash * max(halfWidth - 0.55 * u_antialiasing, 0.25) + (1.0 - scaleDash)) / SDF_PATTERN_HALF_WIDTH;\n#endif\n#endif\nout_pos = vec3(pos.xy, z);\nreturn LineData(\ncolor,\nin_normal,\nhalfWidth,\nopacity,\n#ifndef OUTLINED_FILL\n#ifdef PATTERN\nin_tlbr / u_mosaicSize.xyxy,\nvec2(in_tlbr.z - in_tlbr.x, in_tlbr.w - in_tlbr.y),\n#endif\n#ifdef SDF\nlineWidthRatio,\n#endif\n#if defined(PATTERN) || defined(SDF)\nin_accumulatedDist * u_zoomFactor + dot(in_segmentDirection, dist),\n#endif\n#endif\nnorm(in_id)\n);\n}"}},text:{"common.glsl":"uniform highp vec2 u_mosaicSize;\nvarying highp vec3 v_id;\nvarying mediump vec3 v_pos;\nvarying lowp float v_opacity;\nvarying lowp vec4 v_color;\nvarying highp vec2 v_tex;\nvarying mediump float v_antialiasingWidth;\nvarying mediump float v_edgeDistanceOffset;\nvarying lowp float v_transparency;","hittest.glsl":"#include \n#ifdef HITTEST\nvec3 hittestGlyph(in vec3 in_pos, in vec3 offset, in float fontSize) {\nvec3 pos = u_viewMat3 * u_tileMat3 * in_pos + u_tileMat3 * offset;\nvec3 hittestPos = vec3(u_hittestPos, 1.);\nfloat hittestDist = u_hittestDist;\nvec3 outTextureCoords = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nfloat halfFontSize = fontSize / 2.;\nif (distance(pos, hittestPos) > hittestDist + halfFontSize) {\noutTextureCoords.z += 2.0;\n}\nreturn outTextureCoords;\n}\n#endif","text.frag":"precision mediump float;\n#include \nuniform lowp sampler2D u_texture;\n#ifdef HITTEST\nvec4 getColor() {\nreturn vec4(1.);\n}\n#else\nvec4 getColor()\n{\nfloat SDF_CUTOFF = (2.0 / 8.0);\nfloat SDF_BASE_EDGE_DIST = 1.0 - SDF_CUTOFF;\nlowp float dist = texture2D(u_texture, v_tex).a;\nmediump float edge = SDF_BASE_EDGE_DIST - v_edgeDistanceOffset;\n#ifdef HIGHLIGHT\nedge /= 2.0;\n#endif\nlowp float aa = v_antialiasingWidth;\nlowp float alpha = smoothstep(edge - aa, edge + aa, dist);\nreturn alpha * v_color * v_opacity;\n}\n#endif\nvoid main()\n{\ngl_FragColor = getColor();\n}","text.vert":"precision highp float;\n#include \n#include \n#include \n#include \nattribute vec4 a_color;\nattribute vec4 a_haloColor;\nattribute vec4 a_texFontSize;\nattribute vec4 a_aux;\nattribute vec2 a_zoomRange;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nuniform float u_isHalo;\nfloat getTextSize(inout vec2 offset, inout float baseSize, in float referenceSize) {\n#ifdef VV_SIZE\nfloat r = getSize(referenceSize) / referenceSize;\nbaseSize *= r;\noffset.xy *= r;\nreturn baseSize;\n#endif\nreturn baseSize;\n}\nvoid main()\n{\nINIT;\nfloat a_referenceSize = a_aux.z * a_aux.z / 256.0;\nfloat a_bitSet = a_aux.w;\nfloat a_fontSize = a_texFontSize.z;\nvec2 a_offset = a_vertexOffset * OFFSET_PRECISION;\nvec3 in_pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nfloat fontSize = getTextSize(a_offset, a_fontSize, a_referenceSize);\nfloat fontScale = fontSize / SDF_FONT_SIZE;\nvec3 offset = getRotation() * vec3(a_offset, 0.0);\nmat3 extrudeMatrix = getBit(a_bitSet, 0) == 1.0 ? u_displayViewMat3 : u_displayMat3;\nv_color = u_isHalo * a_haloColor + (1.0 - u_isHalo) * getColor(a_color, a_bitSet, 1);\nv_opacity = getOpacity();\nv_id = norm(a_id);\nv_tex = a_texCoords / u_mosaicSize;\nv_pos = u_dvsMat3 * in_pos + extrudeMatrix * offset;\nv_edgeDistanceOffset = u_isHalo * OUTLINE_SCALE * a_texFontSize.w / fontScale / MAX_SDF_DISTANCE;\nv_antialiasingWidth = 0.105 * SDF_FONT_SIZE / fontSize / u_pixelRatio;\n#ifdef HITTEST\nvec3 pos = hittestGlyph(in_pos, offset, fontSize);\ngl_PointSize = 1.;\ngl_Position = vec4(clip(v_color, pos, getFilterFlags(), a_zoomRange), 1.0);\n#else\ngl_Position = vec4(clip(v_color, v_pos, getFilterFlags(), a_zoomRange), 1.0);\n#endif\n}"},"utils.glsl":"float rshift(in float u32, in int amount) {\nreturn floor(u32 / pow(2.0, float(amount)));\n}\nfloat getBit(in float bitset, in int bitIndex) {\nfloat offset = pow(2.0, float(bitIndex));\nreturn mod(floor(bitset / offset), 2.0);\n}\nfloat getFilterBit(in float bitset, in int bitIndex) {\nreturn getBit(bitset, bitIndex + 1);\n}\nfloat getHighlightBit(in float bitset) {\nreturn getBit(bitset, 0);\n}\nhighp vec3 unpackDisplayIdTexel(in highp vec3 bitset) {\nfloat isAggregate = getBit(bitset.b, 7);\nreturn (1.0 - isAggregate) * bitset + isAggregate * (vec3(bitset.rgb) - vec3(0.0, 0.0, float(0x80)));\n}\nvec4 unpack(in float u32) {\nfloat r = mod(rshift(u32, 0), 255.0);\nfloat g = mod(rshift(u32, 8), 255.0);\nfloat b = mod(rshift(u32, 16), 255.0);\nfloat a = mod(rshift(u32, 24), 255.0);\nreturn vec4(r, g, b, a);\n}\nvec3 norm(in vec3 v) {\nreturn v /= 255.0;\n}\nvec4 norm(in vec4 v) {\nreturn v /= 255.0;\n}\nfloat max4(vec4 target) {\nreturn max(max(max(target.x, target.y), target.z), target.w);\n}\nvec2 unpack_u8_nf32(vec2 bytes) {\nreturn (bytes - 127.0) / 127.0;\n}","vcommon.glsl":"#include \n#include \n#include \n#include \nattribute vec2 a_pos;\nattribute highp vec3 a_id;\nuniform highp mat3 u_dvsMat3;\nuniform highp mat3 u_displayMat3;\nuniform highp mat3 u_displayViewMat3;\nuniform highp mat3 u_tileMat3;\nuniform highp mat3 u_viewMat3;\nuniform highp float u_pixelRatio;\nuniform mediump float u_zoomFactor;\nuniform mediump float u_antialiasing;\nuniform mediump float u_currentZoom;\nvec4 VV_ADATA = vec4(0.0);\nvoid loadVisualVariableData(inout vec4 target) {\n#ifdef OES_TEXTURE_FLOAT\ntarget.rgba = getAttributeData2(a_id);\n#else\nvec4 data0 = getAttributeData2(a_id);\nvec4 data1 = getAttributeData3(a_id);\ntarget.r = u88VVToFloat(data0.rg * 255.0);\ntarget.g = u88VVToFloat(data0.ba * 255.0);\ntarget.b = u88VVToFloat(data1.rg * 255.0);\ntarget.a = u88VVToFloat(data1.ba * 255.0);\n#endif\n}\n#ifdef VV\n#define INIT loadVisualVariableData(VV_ADATA)\n#else\n#define INIT\n#endif\nvec4 getColor(in vec4 a_color, in float a_bitSet, int index) {\n#ifdef VV_COLOR\nfloat isColorLocked = getBit(a_bitSet, index);\nreturn getVVColor(VV_ADATA[ATTR_VV_COLOR], a_color, isColorLocked);\n#else\nreturn a_color;\n#endif\n}\nfloat getOpacity() {\n#ifdef VV_OPACITY\nreturn getVVOpacity(VV_ADATA[ATTR_VV_OPACITY]);\n#else\nreturn 1.0;\n#endif\n}\nfloat getSize(in float in_size) {\n#ifdef VV_SIZE\nreturn getVVSize(in_size, VV_ADATA[ATTR_VV_SIZE]);\n#else\nreturn in_size;\n#endif\n}\nmat3 getRotation() {\n#ifdef VV_ROTATION\nreturn getVVRotationMat3(mod(VV_ADATA[ATTR_VV_ROTATION], 360.0));\n#else\nreturn mat3(1.0);\n#endif\n}\nfloat getFilterFlags() {\n#ifdef IGNORES_SAMPLER_PRECISION\nreturn ceil(getAttributeData0(a_id).x * 255.0);\n#else\nreturn getAttributeData0(a_id).x * 255.0;\n#endif\n}\nvec4 getAnimationState() {\nreturn getAttributeData1(a_id);\n}\nfloat getMinZoom() {\nvec4 data0 = getAttributeData0(a_id) * 255.0;\nreturn data0.g;\n}\nmat3 getMatrix(float isMapAligned) {\nreturn isMapAligned * u_displayViewMat3 + (1.0 - isMapAligned) * u_displayMat3;\n}\nvec3 clip(inout vec4 color, inout vec3 pos, in float filterFlags, in vec2 minMaxZoom) {\npos.z += 2.0 * (1.0 - getFilterBit(filterFlags, 0));\n#ifdef INSIDE\npos.z += 2.0 * (1.0 - getFilterBit(filterFlags, 1));\n#elif defined(OUTSIDE)\npos.z += 2.0 * getFilterBit(filterFlags, 1);\n#elif defined(HIGHLIGHT)\n#if !defined(HIGHLIGHT_ALL)\npos.z += 2.0 * (1.0 - getHighlightBit(filterFlags));\n#endif\n#endif\npos.z += 2.0 * (step(minMaxZoom.y, u_currentZoom) + (1.0 - step(minMaxZoom.x, u_currentZoom)));\nreturn pos;\n}","vv.glsl":"#if defined(VV_SIZE_MIN_MAX_VALUE) || defined(VV_SIZE_SCALE_STOPS) || defined(VV_SIZE_FIELD_STOPS) || defined(VV_SIZE_UNIT_VALUE)\n#define VV_SIZE\n#endif\n#if defined(VV_COLOR) || defined(VV_SIZE) || defined(VV_OPACITY) || defined(VV_ROTATION)\n#define VV\n#endif\n#ifdef VV_COLOR\nuniform highp float u_vvColorValues[8];\nuniform vec4 u_vvColors[8];\n#endif\n#ifdef VV_SIZE_MIN_MAX_VALUE\nuniform highp vec4 u_vvSizeMinMaxValue;\n#endif\n#ifdef VV_SIZE_SCALE_STOPS\nuniform highp float u_vvSizeScaleStopsValue;\n#endif\n#ifdef VV_SIZE_FIELD_STOPS\nuniform highp float u_vvSizeFieldStopsValues[6];\nuniform float u_vvSizeFieldStopsSizes[6];\n#endif\n#ifdef VV_SIZE_UNIT_VALUE\nuniform highp float u_vvSizeUnitValueWorldToPixelsRatio;\n#endif\n#ifdef VV_OPACITY\nuniform highp float u_vvOpacityValues[8];\nuniform float u_vvOpacities[8];\n#endif\n#ifdef VV_ROTATION\nuniform lowp float u_vvRotationType;\n#endif\nbool isNan(float val) {\nreturn (val == NAN_MAGIC_NUMBER);\n}\n#ifdef VV_SIZE_MIN_MAX_VALUE\nfloat getVVMinMaxSize(float sizeValue, float fallback) {\nif (isNan(sizeValue)) {\nreturn fallback;\n}\nfloat interpolationRatio = (sizeValue - u_vvSizeMinMaxValue.x) / (u_vvSizeMinMaxValue.y - u_vvSizeMinMaxValue.x);\ninterpolationRatio = clamp(interpolationRatio, 0.0, 1.0);\nreturn u_vvSizeMinMaxValue.z + interpolationRatio * (u_vvSizeMinMaxValue.w - u_vvSizeMinMaxValue.z);\n}\n#endif\n#ifdef VV_SIZE_FIELD_STOPS\nconst int VV_SIZE_N = 6;\nfloat getVVStopsSize(float sizeValue, float fallback) {\nif (isNan(sizeValue)) {\nreturn fallback;\n}\nif (sizeValue <= u_vvSizeFieldStopsValues[0]) {\nreturn u_vvSizeFieldStopsSizes[0];\n}\nfor (int i = 1; i < VV_SIZE_N; ++i) {\nif (u_vvSizeFieldStopsValues[i] >= sizeValue) {\nfloat f = (sizeValue - u_vvSizeFieldStopsValues[i-1]) / (u_vvSizeFieldStopsValues[i] - u_vvSizeFieldStopsValues[i-1]);\nreturn mix(u_vvSizeFieldStopsSizes[i-1], u_vvSizeFieldStopsSizes[i], f);\n}\n}\nreturn u_vvSizeFieldStopsSizes[VV_SIZE_N - 1];\n}\n#endif\n#ifdef VV_SIZE_UNIT_VALUE\nfloat getVVUnitValue(float sizeValue, float fallback) {\nif (isNan(sizeValue)) {\nreturn fallback;\n}\nreturn u_vvSizeUnitValueWorldToPixelsRatio * sizeValue;\n}\n#endif\n#ifdef VV_OPACITY\nconst int VV_OPACITY_N = 8;\nfloat getVVOpacity(float opacityValue) {\nif (isNan(opacityValue)) {\nreturn 1.0;\n}\nif (opacityValue <= u_vvOpacityValues[0]) {\nreturn u_vvOpacities[0];\n}\nfor (int i = 1; i < VV_OPACITY_N; ++i) {\nif (u_vvOpacityValues[i] >= opacityValue) {\nfloat f = (opacityValue - u_vvOpacityValues[i-1]) / (u_vvOpacityValues[i] - u_vvOpacityValues[i-1]);\nreturn mix(u_vvOpacities[i-1], u_vvOpacities[i], f);\n}\n}\nreturn u_vvOpacities[VV_OPACITY_N - 1];\n}\n#endif\n#ifdef VV_ROTATION\nmat4 getVVRotation(float rotationValue) {\nif (isNan(rotationValue)) {\nreturn mat4(1, 0, 0, 0,\n0, 1, 0, 0,\n0, 0, 1, 0,\n0, 0, 0, 1);\n}\nfloat rotation = rotationValue;\nif (u_vvRotationType == 1.0) {\nrotation = 90.0 - rotation;\n}\nfloat angle = C_DEG_TO_RAD * rotation;\nfloat sinA = sin(angle);\nfloat cosA = cos(angle);\nreturn mat4(cosA, sinA, 0, 0,\n-sinA, cosA, 0, 0,\n0, 0, 1, 0,\n0, 0, 0, 1);\n}\nmat3 getVVRotationMat3(float rotationValue) {\nif (isNan(rotationValue)) {\nreturn mat3(1, 0, 0,\n0, 1, 0,\n0, 0, 1);\n}\nfloat rotation = rotationValue;\nif (u_vvRotationType == 1.0) {\nrotation = 90.0 - rotation;\n}\nfloat angle = C_DEG_TO_RAD * -rotation;\nfloat sinA = sin(angle);\nfloat cosA = cos(angle);\nreturn mat3(cosA, -sinA, 0,\nsinA, cosA, 0,\n0, 0, 1);\n}\n#endif\n#ifdef VV_COLOR\nconst int VV_COLOR_N = 8;\nvec4 getVVColor(float colorValue, vec4 fallback, float isColorLocked) {\nif (isNan(colorValue) || isColorLocked == 1.0) {\nreturn fallback;\n}\nif (colorValue <= u_vvColorValues[0]) {\nreturn u_vvColors[0];\n}\nfor (int i = 1; i < VV_COLOR_N; ++i) {\nif (u_vvColorValues[i] >= colorValue) {\nfloat f = (colorValue - u_vvColorValues[i-1]) / (u_vvColorValues[i] - u_vvColorValues[i-1]);\nreturn mix(u_vvColors[i-1], u_vvColors[i], f);\n}\n}\nreturn u_vvColors[VV_COLOR_N - 1];\n}\n#endif\nfloat getVVSize(in float size, in float vvSize) {\n#ifdef VV_SIZE_MIN_MAX_VALUE\nreturn getVVMinMaxSize(vvSize, size);\n#elif defined(VV_SIZE_SCALE_STOPS)\nreturn u_vvSizeScaleStopsValue;\n#elif defined(VV_SIZE_FIELD_STOPS)\nfloat outSize = getVVStopsSize(vvSize, size);\nreturn isNan(outSize) ? size : outSize;\n#elif defined(VV_SIZE_UNIT_VALUE)\nreturn getVVUnitValue(vvSize, size);\n#else\nreturn size;\n#endif\n}"},"post-processing":{blit:{"blit.frag":"precision mediump float;\nuniform sampler2D u_texture;\nvarying vec2 v_uv;\nvoid main() {\ngl_FragColor = texture2D(u_texture, v_uv);\n}"},bloom:{composite:{"composite.frag":"precision mediump float;\nvarying vec2 v_uv;\nuniform sampler2D u_blurTexture1;\nuniform sampler2D u_blurTexture2;\nuniform sampler2D u_blurTexture3;\nuniform sampler2D u_blurTexture4;\nuniform sampler2D u_blurTexture5;\nuniform float u_bloomStrength;\nuniform float u_bloomRadius;\nuniform float u_bloomFactors[NUMMIPS];\nuniform vec3 u_bloomTintColors[NUMMIPS];\nfloat lerpBloomFactor(const in float factor) {\nfloat mirrorFactor = 1.2 - factor;\nreturn mix(factor, mirrorFactor, u_bloomRadius);\n}\nvoid main() {\ngl_FragColor = u_bloomStrength * (\nlerpBloomFactor(u_bloomFactors[0]) * vec4(u_bloomTintColors[0], 1.0) * texture2D(u_blurTexture1, v_uv) +\nlerpBloomFactor(u_bloomFactors[1]) * vec4(u_bloomTintColors[1], 1.0) * texture2D(u_blurTexture2, v_uv) +\nlerpBloomFactor(u_bloomFactors[2]) * vec4(u_bloomTintColors[2], 1.0) * texture2D(u_blurTexture3, v_uv) +\nlerpBloomFactor(u_bloomFactors[3]) * vec4(u_bloomTintColors[3], 1.0) * texture2D(u_blurTexture4, v_uv) +\nlerpBloomFactor(u_bloomFactors[4]) * vec4(u_bloomTintColors[4], 1.0) * texture2D(u_blurTexture5, v_uv)\n);\n}"},gaussianBlur:{"gaussianBlur.frag":"precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform vec2 u_texSize;\nuniform vec2 u_direction;\nvarying vec2 v_uv;\n#define KERNEL_RADIUS RADIUS\n#define SIGMA RADIUS\nfloat gaussianPdf(in float x, in float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x / ( sigma * sigma)) / sigma;\n}\nvoid main() {\nvec2 invSize = 1.0 / u_texSize;\nfloat fSigma = float(SIGMA);\nfloat weightSum = gaussianPdf(0.0, fSigma);\nvec4 pixelColorSum = texture2D(u_colorTexture, v_uv) * weightSum;\nfor (int i = 1; i < KERNEL_RADIUS; i ++) {\nfloat x = float(i);\nfloat w = gaussianPdf(x, fSigma);\nvec2 uvOffset = u_direction * invSize * x;\nvec4 sample1 = texture2D(u_colorTexture, v_uv + uvOffset);\nvec4 sample2 = texture2D(u_colorTexture, v_uv - uvOffset);\npixelColorSum += (sample1 + sample2) * w;\nweightSum += 2.0 * w;\n}\ngl_FragColor = pixelColorSum /weightSum;\n}"},luminosityHighPass:{"luminosityHighPass.frag":"precision mediump float;\nuniform sampler2D u_texture;\nuniform vec3 u_defaultColor;\nuniform float u_defaultOpacity;\nuniform float u_luminosityThreshold;\nuniform float u_smoothWidth;\nvarying vec2 v_uv;\nvoid main() {\nvec4 texel = texture2D(u_texture, v_uv);\nvec3 luma = vec3(0.299, 0.587, 0.114);\nfloat v = dot(texel.xyz, luma);\nvec4 outputColor = vec4(u_defaultColor.rgb, u_defaultOpacity);\nfloat alpha = smoothstep(u_luminosityThreshold, u_luminosityThreshold + u_smoothWidth, v);\ngl_FragColor = mix(outputColor, texel, alpha);\n}"}},blur:{gaussianBlur:{"gaussianBlur.frag":"precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform vec2 u_texSize;\nuniform vec2 u_direction;\nuniform float u_sigma;\nvarying vec2 v_uv;\n#define KERNEL_RADIUS RADIUS\nfloat gaussianPdf(in float x, in float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x / ( sigma * sigma)) / sigma;\n}\nvoid main() {\nvec2 invSize = 1.0 / u_texSize;\nfloat fSigma = u_sigma;\nfloat weightSum = gaussianPdf(0.0, fSigma);\nvec4 pixelColorSum = texture2D(u_colorTexture, v_uv) * weightSum;\nfor (int i = 1; i < KERNEL_RADIUS; i ++) {\nfloat x = float(i);\nfloat w = gaussianPdf(x, fSigma);\nvec2 uvOffset = u_direction * invSize * x;\nvec4 sample1 = texture2D(u_colorTexture, v_uv + uvOffset);\nvec4 sample2 = texture2D(u_colorTexture, v_uv - uvOffset);\npixelColorSum += (sample1 + sample2) * w;\nweightSum += 2.0 * w;\n}\ngl_FragColor = pixelColorSum /weightSum;\n}"},"radial-blur":{"radial-blur.frag":"precision mediump float;\nuniform sampler2D u_colorTexture;\nvarying vec2 v_uv;\nconst float sampleDist = 1.0;\nconst float sampleStrength = 2.2;\nvoid main(void) {\nfloat samples[10];\nsamples[0] = -0.08;\nsamples[1] = -0.05;\nsamples[2] = -0.03;\nsamples[3] = -0.02;\nsamples[4] = -0.01;\nsamples[5] = 0.01;\nsamples[6] = 0.02;\nsamples[7] = 0.03;\nsamples[8] = 0.05;\nsamples[9] = 0.08;\nvec2 dir = 0.5 - v_uv;\nfloat dist = sqrt(dir.x * dir.x + dir.y * dir.y);\ndir = dir / dist;\nvec4 color = texture2D(u_colorTexture,v_uv);\nvec4 sum = color;\nfor (int i = 0; i < 10; i++) {\nsum += texture2D(u_colorTexture, v_uv + dir * samples[i] * sampleDist);\n}\nsum *= 1.0 / 11.0;\nfloat t = dist * sampleStrength;\nt = clamp(t, 0.0, 1.0);\ngl_FragColor = mix(color, sum, t);\n}"}},dra:{"dra.frag":"precision mediump float;\nuniform sampler2D u_minColor;\nuniform sampler2D u_maxColor;\nuniform sampler2D u_texture;\nvarying vec2 v_uv;\nvoid main() {\nvec4 minColor = texture2D(u_minColor, vec2(0.5));\nvec4 maxColor = texture2D(u_maxColor, vec2(0.5));\nvec4 color = texture2D(u_texture, v_uv);\nvec3 minColorUnpremultiply = minColor.rgb / minColor.a;\nvec3 maxColorUnpremultiply = maxColor.rgb / maxColor.a;\nvec3 colorUnpremultiply = color.rgb / color.a;\nvec3 range = maxColorUnpremultiply - minColorUnpremultiply;\ngl_FragColor = vec4(color.a * (colorUnpremultiply - minColorUnpremultiply) / range, color.a);\n}","min-max":{"min-max.frag":"#extension GL_EXT_draw_buffers : require\nprecision mediump float;\n#define CELL_SIZE 2\nuniform sampler2D u_minTexture;\nuniform sampler2D u_maxTexture;\nuniform vec2 u_srcResolution;\nuniform vec2 u_dstResolution;\nvarying vec2 v_uv;\nvoid main() {\nvec2 srcPixel = floor(gl_FragCoord.xy) * float(CELL_SIZE);\nvec2 onePixel = vec2(1.0) / u_srcResolution;\nvec2 uv = (srcPixel + 0.5) / u_srcResolution;\nvec4 minColor = vec4(1.0);\nvec4 maxColor = vec4(0.0);\nfor (int y = 0; y < CELL_SIZE; ++y) {\nfor (int x = 0; x < CELL_SIZE; ++x) {\nvec2 offset = uv + vec2(x, y) * onePixel;\nminColor = min(minColor, texture2D(u_minTexture, offset));\nmaxColor = max(maxColor, texture2D(u_maxTexture, offset));\n}\n}\ngl_FragData[0] = minColor;\ngl_FragData[1] = maxColor;\n}"}},"drop-shadow":{composite:{"composite.frag":"precision mediump float;\nuniform sampler2D u_layerFBOTexture;\nuniform sampler2D u_blurTexture;\nuniform vec4 u_shadowColor;\nuniform vec2 u_shadowOffset;\nuniform highp mat3 u_displayViewMat3;\nvarying vec2 v_uv;\nvoid main() {\nvec3 offset = u_displayViewMat3 * vec3(u_shadowOffset, 0.0);\nvec4 layerColor = texture2D(u_layerFBOTexture, v_uv);\nvec4 blurColor = texture2D(u_blurTexture, v_uv - offset.xy / 2.0);\ngl_FragColor = ((1.0 - layerColor.a) * blurColor.a * u_shadowColor + layerColor);\n}"}},"edge-detect":{"frei-chen":{"frei-chen.frag":"precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform vec2 u_texSize;\nvarying vec2 v_uv;\nvec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y);\nmat3 G[9];\nconst mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 );\nconst mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 );\nconst mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 );\nconst mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 );\nconst mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 );\nconst mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 );\nconst mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 );\nconst mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 );\nconst mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 );\nvoid main() {\nG[0] = g0,\nG[1] = g1,\nG[2] = g2,\nG[3] = g3,\nG[4] = g4,\nG[5] = g5,\nG[6] = g6,\nG[7] = g7,\nG[8] = g8;\nmat3 I;\nfloat cnv[9];\nvec3 sample;\nfor (float i = 0.0; i < 3.0; i++) {\nfor (float j = 0.0; j < 3.0; j++) {\nsample = texture2D(u_colorTexture, v_uv + texel * vec2(i - 1.0,j - 1.0)).rgb;\nI[int(i)][int(j)] = length(sample);\n}\n}\nfor (int i = 0; i < 9; i++) {\nfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\ncnv[i] = dp3 * dp3;\n}\nfloat M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);\nfloat S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);\ngl_FragColor = vec4(vec3(sqrt(M / S)), texture2D(u_colorTexture, v_uv).a);\n}"},sobel:{"sobel.frag":"precision mediump float;\nuniform sampler2D u_colorTexture;\nvarying vec2 v_uv;\nuniform vec2 u_texSize;\nvec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y);\nmat3 G[2];\nconst mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );\nconst mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );\nvoid main() {\nmat3 I;\nfloat cnv[2];\nvec3 sample;\nG[0] = g0;\nG[1] = g1;\nfor (float i = 0.0; i < 3.0; i++) {\nfor (float j = 0.0; j < 3.0; j++) {\nsample = texture2D( u_colorTexture, v_uv + texel * vec2(i-1.0,j-1.0) ).rgb;\nI[int(i)][int(j)] = length(sample);\n}\n}\nfor (int i = 0; i < 2; i++) {\nfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\ncnv[i] = dp3 * dp3;\n}\ngl_FragColor = vec4(vec3(0.5 * sqrt(cnv[0] * cnv[0] + cnv[1] * cnv[1])), texture2D(u_colorTexture, v_uv).a);\n}"}},"edge-enhance":{"edge-enhance.frag":"precision mediump float;\nuniform sampler2D u_colorTexture;\nvarying vec2 v_uv;\nuniform vec2 u_texSize;\nvec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y);\nmat3 G[2];\nconst mat3 g0 = mat3( 1.0, 0.0, -1.0, 1.0, 0.0, -1.0, 1.0, 0.0, -1.0 );\nconst mat3 g1 = mat3( 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, -1.0, -1.0, -1.0 );\nvoid main() {\nmat3 I;\nfloat cnv[2];\nvec3 sample;\nG[0] = g0;\nG[1] = g1;\nfor (float i = 0.0; i < 3.0; i++) {\nfor (float j = 0.0; j < 3.0; j++) {\nsample = texture2D( u_colorTexture, v_uv + texel * vec2(i-1.0,j-1.0) ).rgb;\nI[int(i)][int(j)] = length(sample);\n}\n}\nfor (int i = 0; i < 2; i++) {\nfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\ncnv[i] = dp3 * dp3;\n}\nvec4 color = texture2D(u_colorTexture, v_uv);\ngl_FragColor = vec4(0.5 * sqrt(cnv[0] * cnv[0] + cnv[1] * cnv[1]) * color);\n}"},filterEffect:{"filterEffect.frag":"precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform mat4 u_coefficients;\nvarying vec2 v_uv;\nvoid main() {\nvec4 color = texture2D(u_colorTexture, v_uv);\nvec4 rgbw = u_coefficients * vec4(color.a > 0.0 ? color.rgb / color.a : vec3(0.0), 1.0);\nfloat a = color.a;\ngl_FragColor = vec4(a * rgbw.rgb, a);\n}"},pp:{"pp.vert":"precision mediump float;\nattribute vec2 a_position;\nvarying vec2 v_uv;\nvoid main() {\ngl_Position = vec4(a_position, 0.0, 1.0);\nv_uv = (a_position + 1.0) / 2.0;\n}"}},raster:{bitmap:{"bitmap.frag":"precision mediump float;\nvarying highp vec2 v_texcoord;\nuniform sampler2D u_texture;\nuniform highp vec2 u_coordScale;\nuniform lowp float u_opacity;\n#include \nvoid main() {\n#ifdef BICUBIC\nvec4 color = sampleBicubicBSpline(u_texture, v_texcoord, u_coordScale);\n#else\nvec4 color = texture2D(u_texture, v_texcoord);\n#endif\nfloat alpha = u_opacity * color.a;\ngl_FragColor = vec4(alpha * color.rgb, alpha);\n}","bitmap.vert":"precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}"},common:{"common.glsl":"uniform sampler2D u_image;\nuniform int u_bandCount;\nuniform bool u_isFloatTexture;\nuniform bool u_flipY;\nuniform float u_opacity;\nuniform int u_resampling;\nuniform vec2 u_srcImageSize;\n#ifdef APPLY_PROJECTION\n#include \n#endif\n#ifdef BICUBIC\n#include \n#endif\n#ifdef BILINEAR\n#include \n#endif\nvec2 getPixelLocation(vec2 coords) {\nvec2 targetLocation = u_flipY ? vec2(coords.s, 1.0 - coords.t) : coords;\n#ifdef APPLY_PROJECTION\ntargetLocation = projectPixelLocation(targetLocation);\n#endif\nreturn targetLocation;\n}\nbool isOutside(vec2 coords){\nif (coords.t>1.00001 ||coords.t<-0.00001 || coords.s>1.00001 ||coords.s<-0.00001) {\nreturn true;\n} else {\nreturn false;\n}\n}\nvec4 getPixel(vec2 pixelLocation) {\n#ifdef BICUBIC\nvec4 color = sampleBicubicBSpline(u_image, pixelLocation, u_srcImageSize);\n#elif defined(BILINEAR)\nvec4 color = sampleBilinear(u_image, pixelLocation, u_srcImageSize);\n#else\nvec4 color = texture2D(u_image, pixelLocation);\n#endif\nreturn color;\n}","contrastBrightness.glsl":"uniform float u_contrastOffset;\nuniform float u_brightnessOffset;\nvec4 adjustContrastBrightness(vec4 currentPixel, bool isFloat) {\nvec4 pixelValue = isFloat ? currentPixel * 255.0 : currentPixel;\nfloat maxI = 255.0;\nfloat mid = 128.0;\nfloat c = u_contrastOffset;\nfloat b = u_brightnessOffset;\nvec4 v;\nif (c > 0.0 && c < 100.0) {\nv = (200.0 * pixelValue - 100.0 * maxI + 2.0 * maxI * b) / (2.0 * (100.0 - c)) + mid;\n} else if (c <= 0.0 && c > -100.0) {\nv = (200.0 * pixelValue - 100.0 * maxI + 2.0 * maxI * b) * (100.0 + c) / 20000.0 + mid;\n} else if (c == 100.0) {\nv = (200.0 * pixelValue - 100.0 * maxI + (maxI + 1.0) * (100.0 - c) + 2.0 * maxI * b);\nv = (sign(v) + 1.0) / 2.0;\n} else if (c == -100.0) {\nv = vec4(mid, mid, mid, currentPixel.a);\n}\nreturn vec4(v.r / 255.0, v.g / 255.0, v.b / 255.0, currentPixel.a);\n}","projection.glsl":"uniform sampler2D u_transformGrid;\nuniform vec2 u_transformSpacing;\nuniform vec2 u_transformGridSize;\nuniform vec2 u_targetImageSize;\nvec2 projectPixelLocation(vec2 coords) {\n#ifdef LOOKUP_PROJECTION\nvec4 pv = texture2D(u_transformGrid, coords);\nreturn vec2(pv.r, pv.g);\n#endif\nvec2 index_image = floor(coords * u_targetImageSize);\nvec2 oneTransformPixel = vec2(0.25 / u_transformGridSize.s, 1.0 / u_transformGridSize.t);\nvec2 index_transform = floor(index_image / u_transformSpacing) / u_transformGridSize;\nvec2 pos = fract((index_image + vec2(0.5, 0.5)) / u_transformSpacing);\nvec2 srcLocation;\nvec2 transform_location = index_transform + oneTransformPixel * 0.5;\nif (pos.s <= pos.t) {\nvec4 ll_abc = texture2D(u_transformGrid, vec2(transform_location.s, transform_location.t));\nvec4 ll_def = texture2D(u_transformGrid, vec2(transform_location.s + oneTransformPixel.s, transform_location.t));\nsrcLocation.s = dot(ll_abc.rgb, vec3(pos, 1.0));\nsrcLocation.t = dot(ll_def.rgb, vec3(pos, 1.0));\n} else {\nvec4 ur_abc = texture2D(u_transformGrid, vec2(transform_location.s + 2.0 * oneTransformPixel.s, transform_location.t));\nvec4 ur_def = texture2D(u_transformGrid, vec2(transform_location.s + 3.0 * oneTransformPixel.s, transform_location.t));\nsrcLocation.s = dot(ur_abc.rgb, vec3(pos, 1.0));\nsrcLocation.t = dot(ur_def.rgb, vec3(pos, 1.0));\n}\nreturn srcLocation;\n}"},flow:{"flow.frag":"precision highp float;\nvarying float v_side;\nvarying float v_time;\nvarying float v_totalTime;\nvarying float v_timeSeed;\nvarying vec4 v_lineColor;\nvarying float v_lineRenderWidth;\nuniform float u_time;\nuniform float u_fadeDuration;\nuniform float u_lineSpeed;\nvoid main(void) {\nvec4 color = v_lineColor;\nfloat edgeWidth = min(2.0 * v_lineRenderWidth - 1.0, 1.0);\nfloat edgeStart = (v_lineRenderWidth - edgeWidth) / v_lineRenderWidth;\nif (edgeStart < 0.95) {\nfloat s = step(edgeStart, abs(v_side));\ncolor.a *= (1.0 - s) + s * (1.0 - (abs(v_side) - edgeStart) / (1.0 - edgeStart));\n}\nfloat t = mod(v_timeSeed * (v_totalTime + u_fadeDuration) + u_time * u_lineSpeed, v_totalTime + u_fadeDuration) - v_time;\ncolor.a *= step(0.0, t) * exp(-2.3 * t / u_fadeDuration);\ncolor.rgb *= color.a;\ngl_FragColor = color;\n}","flow.vert":"precision highp float;\nattribute vec3 a_positionAndSide;\nattribute vec3 a_timeInfo;\nattribute vec2 a_extrude;\nattribute float a_speed;\nuniform mat3 u_dvsMat3;\nuniform mat3 u_displayViewMat3;\nvarying float v_side;\nvarying float v_time;\nvarying float v_totalTime;\nvarying float v_timeSeed;\nvarying vec4 v_lineColor;\nvarying float v_lineRenderWidth;\n#define MAX_STOPS 8\n#ifdef VV_LINE_COLOR\nuniform float u_lineColor_stops[MAX_STOPS];\nuniform vec4 u_lineColor_values[MAX_STOPS];\nuniform int u_lineColor_count;\n#else\nuniform vec4 u_lineColor;\n#endif\n#ifdef VV_LINE_OPACITY\nuniform float u_lineOpacity_stops[MAX_STOPS];\nuniform float u_lineOpacity_values[MAX_STOPS];\nuniform int u_lineOpacity_count;\n#else\nuniform float u_lineOpacity;\n#endif\n#ifdef VV_LINE_RENDER_WIDTH\nuniform float u_lineRenderWidth_stops[MAX_STOPS];\nuniform float u_lineRenderWidth_values[MAX_STOPS];\nuniform int u_lineRenderWidth_count;\n#else\nuniform float u_lineRenderWidth;\n#endif\nvoid main(void) {\nfloat x = a_speed;\n#ifdef VV_LINE_COLOR\nvec4 lineColor = u_lineColor_values[0];\n{\nfor (int i = 1; i < MAX_STOPS; i++) {\nif (i >= u_lineColor_count) {\nbreak;\n}\nfloat x1 = u_lineColor_stops[i - 1];\nif (x < x1) {\nbreak;\n}\nfloat x2 = u_lineColor_stops[i];\nvec4 y2 = u_lineColor_values[i];\nif (x < x2) {\nvec4 y1 = u_lineColor_values[i - 1];\nlineColor = y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n} else {\nlineColor = y2;\n}\n}\n}\n#else\nvec4 lineColor = u_lineColor;\n#endif\n#ifdef VV_LINE_OPACITY\nfloat lineOpacity = u_lineOpacity_values[0];\n{\nfor (int i = 1; i < MAX_STOPS; i++) {\nif (i >= u_lineOpacity_count) {\nbreak;\n}\nfloat x1 = u_lineOpacity_stops[i - 1];\nif (x < x1) {\nbreak;\n}\nfloat x2 = u_lineOpacity_stops[i];\nfloat y2 = u_lineOpacity_values[i];\nif (x < x2) {\nfloat y1 = u_lineOpacity_values[i - 1];\nlineOpacity = y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n} else {\nlineOpacity = y2;\n}\n}\n}\n#else\nfloat lineOpacity = u_lineOpacity;\n#endif\n#ifdef VV_LINE_RENDER_WIDTH\nfloat lineRenderWidth = u_lineRenderWidth_values[0];\n{\nfor (int i = 1; i < MAX_STOPS; i++) {\nif (i >= u_lineRenderWidth_count) {\nbreak;\n}\nfloat x1 = u_lineRenderWidth_stops[i - 1];\nif (x < x1) {\nbreak;\n}\nfloat x2 = u_lineRenderWidth_stops[i];\nfloat y2 = u_lineRenderWidth_values[i];\nif (x < x2) {\nfloat y1 = u_lineRenderWidth_values[i - 1];\nlineRenderWidth = y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n} else {\nlineRenderWidth = y2;\n}\n}\n}\n#else\nfloat lineRenderWidth = u_lineRenderWidth;\n#endif\nvec2 position = a_positionAndSide.xy;\nfloat side = a_positionAndSide.z;\nvec2 xy = (u_dvsMat3 * vec3(position, 1.0) + u_displayViewMat3 * vec3(a_extrude * lineRenderWidth, 0.0)).xy;\ngl_Position = vec4(xy, 0.0, 1.0);\nv_side = side;\nv_time = a_timeInfo.x;\nv_totalTime = a_timeInfo.y;\nv_timeSeed = a_timeInfo.z;\nv_lineColor = vec4(lineColor.rgb, lineColor.a * lineOpacity);\nv_lineRenderWidth = lineRenderWidth;\n}"},hillshade:{"hillshade.frag":"precision mediump float;\nvarying highp vec2 v_texcoord;\n#include \nuniform int u_hillshadeType;\nuniform float u_sinZcosAs[6];\nuniform float u_sinZsinAs[6];\nuniform float u_cosZs[6];\nuniform float u_weights[6];\nuniform vec2 u_factor;\nuniform float u_minValue;\nuniform float u_maxValue;\n#include \nfloat getNeighborHoodAlpha(float a, float b, float c, float d, float e, float f, float g, float h, float i){\nif (a == 0.0 || a == 0.0 || a==0.0 || a == 0.0 || a == 0.0 || a==0.0 || a == 0.0 || a == 0.0 || a==0.0) {\nreturn 0.0;\n}\nelse {\nreturn e;\n}\n}\nvec3 rgb2hsv(vec3 c) {\nvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\nvec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\nfloat d = q.x - min(q.w, q.y);\nfloat e = 1.0e-10;\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x);\n}\nvec3 hsv2rgb(vec3 c) {\nvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\nreturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\nvec4 overlay(float val, float minValue, float maxValue, float hillshade) {\nval = clamp((val - minValue) / (maxValue - minValue), 0.0, 1.0);\nvec4 rgb = colorize(vec4(val, val, val, 1.0), 255.0);\nvec3 hsv = rgb2hsv(rgb.xyz);\nhsv.z = hillshade;\nreturn vec4(hsv2rgb(hsv), 1.0) * rgb.a;\n}\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\nif (currentPixel.a == 0.0) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec2 axy = vec2(-1.0, -1.0);\nvec2 bxy = vec2(0.0, -1.0);\nvec2 cxy = vec2(1.0, -1.0);\nvec2 dxy = vec2(-1.0, 0.0);\nvec2 fxy = vec2(1.0, 0.0);\nvec2 gxy = vec2(-1.0, 1.0);\nvec2 hxy = vec2(0.0, 1.0);\nvec2 ixy = vec2(1.0, 1.0);\nvec2 onePixel = 1.0 / u_srcImageSize;\nif (pixelLocation.s < onePixel.s) {\naxy[0] = 1.0;\ndxy[0] = 1.0;\ngxy[0] = 1.0;\n}\nif (pixelLocation.t < onePixel.t) {\naxy[1] = 1.0;\nbxy[1] = 1.0;\ncxy[1] = 1.0;\n}\nif (pixelLocation.s > 1.0 - onePixel.s) {\ncxy[0] = -1.0;\nfxy[0] = -1.0;\nixy[0] = -1.0;\n}\nif (pixelLocation.t > 1.0 - onePixel.t) {\ngxy[1] = -1.0;\nhxy[1] = -1.0;\nixy[1] = -1.0;\n}\nvec4 va = texture2D(u_image, pixelLocation + onePixel * axy);\nvec4 vb = texture2D(u_image, pixelLocation + onePixel * bxy);\nvec4 vc = texture2D(u_image, pixelLocation + onePixel * cxy);\nvec4 vd = texture2D(u_image, pixelLocation + onePixel * dxy);\nvec4 ve = texture2D(u_image, pixelLocation);\nvec4 vf = texture2D(u_image, pixelLocation + onePixel * fxy);\nvec4 vg = texture2D(u_image, pixelLocation + onePixel * gxy);\nvec4 vh = texture2D(u_image, pixelLocation + onePixel * hxy);\nvec4 vi = texture2D(u_image, pixelLocation + onePixel * ixy);\nfloat dzx = (vc + 2.0 * vf + vi - va - 2.0 * vd - vg).r * u_factor.s;\nfloat dzy = (vg + 2.0 * vh + vi - va - 2.0 * vb - vc).r * u_factor.t;\nfloat dzd = sqrt(1.0 + dzx * dzx + dzy * dzy);\nfloat hillshade = 0.0;\nif (u_hillshadeType == 0){\nfloat cosDelta = u_sinZsinAs[0] * dzy - u_sinZcosAs[0] * dzx;\nfloat z = (u_cosZs[0] + cosDelta) / dzd;\nif (z < 0.0) z = 0.0;\nhillshade = z;\n} else {\nfor (int k = 0; k < 6; k++) {\nfloat cosDelta = u_sinZsinAs[k] * dzy - u_sinZcosAs[k] * dzx;\nfloat z = (u_cosZs[k] + cosDelta) / dzd;\nif (z < 0.0) z = 0.0;\nhillshade = hillshade + z * u_weights[k];\nif (k == 5) break;\n}\n}\nfloat alpha = getNeighborHoodAlpha(va.a, vb.a, vc.a, vd.a, ve.a, vf.a, vg.a, vh.a, vi.a);\n#ifdef APPLY_COLORMAP\ngl_FragColor = overlay(ve.r, u_minValue, u_maxValue, hillshade) * alpha * u_opacity;\n#else\ngl_FragColor = vec4(hillshade, hillshade, hillshade, 1.0) * alpha * u_opacity;\n#endif\n}","hillshade.vert":"precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}"},lut:{"colorize.glsl":"uniform sampler2D u_colormap;\nuniform float u_colormapOffset;\nuniform float u_colormapMaxIndex;\nvec4 colorize(vec4 currentPixel, float scaleFactor) {\nfloat clrIndex = clamp(currentPixel.r * scaleFactor - u_colormapOffset, 0.0, u_colormapMaxIndex);\nvec2 clrPosition = vec2((clrIndex + 0.5) / (u_colormapMaxIndex + 1.0), 0.0);\nvec4 color = texture2D(u_colormap, clrPosition);\nvec4 result = vec4(color.rgb, color.a * currentPixel.a);\nreturn result;\n}","lut.frag":"precision mediump float;\nvarying highp vec2 v_texcoord;\n#include \n#include \nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\nvec4 result = colorize(currentPixel, 1.0);\ngl_FragColor = vec4(result.xyz, 1.0) * result.a * u_opacity;\n}","lut.vert":"precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform highp float u_scale;\nuniform highp vec2 u_offset;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos * u_scale + u_offset;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}"},magdir:{"magdir.frag":"precision mediump float;\nvarying vec4 v_color;\nuniform lowp float u_opacity;\nvoid main() {\ngl_FragColor = v_color * u_opacity;\n}","magdir.vert":"precision mediump float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_vv;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform vec2 u_symbolSize;\nuniform vec2 u_symbolPercentRange;\nuniform vec2 u_dataRange;\nuniform float u_rotation;\nuniform vec4 u_colors[12];\nvarying vec4 v_color;\nvoid main()\n{\nfloat angle = a_offset.y + u_rotation;\n#ifndef ROTATION_GEOGRAPHIC\nangle = 3.14159265359 * 2.0 - angle - 3.14159265359 / 2.0;\n#endif\nvec2 offset = vec2(cos(angle), sin(angle)) * a_offset.x;\n#ifdef DATA_RANGE\nfloat valuePercentage = clamp((a_vv.y - u_dataRange.x) / (u_dataRange.y - u_dataRange.x), 0.0, 1.0);\nfloat sizeRatio = u_symbolPercentRange.x + valuePercentage * (u_symbolPercentRange.y - u_symbolPercentRange.x);\nfloat sizePercentage = clamp(sizeRatio, u_symbolPercentRange.x, u_symbolPercentRange.y);\n#else\nfloat sizePercentage = (u_symbolPercentRange.x + u_symbolPercentRange.y) / 2.0;\n#endif\nvec2 pos = a_pos + offset * sizePercentage * u_symbolSize;\nv_color = u_colors[int(a_vv.x)];\ngl_Position = vec4(u_dvsMat3 * vec3(pos * u_coordScale, 1.0), 1.0);\n}"},reproject:{"reproject.frag":"precision mediump float;\nvarying vec2 v_texcoord;\n#include \nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\ngl_FragColor = vec4(currentPixel.rgb, 1.0) * currentPixel.a * u_opacity;\n}","reproject.vert":"precision mediump float;\nattribute vec2 a_position;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_position;\ngl_Position = vec4(2.0 * (a_position - 0.5), 0.0, 1.0);\n}"},scalar:{"scalar.frag":"precision mediump float;\nuniform lowp float u_opacity;\nvarying vec2 v_pos;\nconst vec4 outlineColor = vec4(0.2, 0.2, 0.2, 1.0);\nconst float outlineSize = 0.02;\nconst float innerRadius = 0.25;\nconst float outerRadius = 0.42;\nconst float innerSquareLength = 0.15;\nvoid main() {\nmediump float dist = length(v_pos);\nmediump float fillalpha1 = smoothstep(outerRadius, outerRadius + outlineSize, dist);\nfillalpha1 *= (1.0-smoothstep(outerRadius + outlineSize, outerRadius + 0.1 + outlineSize, dist));\n#ifdef INNER_CIRCLE\nmediump float fillalpha2 = smoothstep(innerRadius, innerRadius + outlineSize, dist);\nfillalpha2 *= (1.0-smoothstep(innerRadius + outlineSize, innerRadius + 0.1 + outlineSize, dist));\n#else\nmediump float fillalpha2 = (abs(v_pos.x) < innerSquareLength ? 1.0 : 0.0) * (abs(v_pos.y) < innerSquareLength ? 1.0 : 0.0);\n#endif\ngl_FragColor = (fillalpha2 + fillalpha1) * outlineColor * u_opacity;\n}","scalar.vert":"precision mediump float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_vv;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform vec2 u_symbolSize;\nuniform vec2 u_symbolPercentRange;\nuniform vec2 u_dataRange;\nvarying vec2 v_pos;\nvoid main()\n{\n#ifdef DATA_RANGE\nfloat valuePercentage = clamp((a_vv.y - u_dataRange.x) / (u_dataRange.y - u_dataRange.x), 0.0, 1.0);\nfloat sizeRatio = u_symbolPercentRange.x + valuePercentage * (u_symbolPercentRange.y - u_symbolPercentRange.x);\nfloat sizePercentage = clamp(sizeRatio, u_symbolPercentRange.x, u_symbolPercentRange.y);\n#else\nfloat sizePercentage = (u_symbolPercentRange.x + u_symbolPercentRange.y) / 2.0;\n#endif\nvec2 size = u_symbolSize * sizePercentage;\nvec2 pos = a_pos + a_offset * size;\nv_pos = a_offset;\ngl_Position = vec4(u_dvsMat3 * vec3(pos * u_coordScale, 1.0), 1.0);\n}"},stretch:{"stretch.frag":"precision mediump float;\nvarying highp vec2 v_texcoord;\n#include \nuniform float u_minCutOff[3];\nuniform float u_maxCutOff[3];\nuniform float u_minOutput;\nuniform float u_maxOutput;\nuniform float u_factor[3];\nuniform bool u_useGamma;\nuniform float u_gamma[3];\nuniform float u_gammaCorrection[3];\n#include \nfloat stretchOneValue(float val, float minCutOff, float maxCutOff, float minOutput, float maxOutput, float factor, bool useGamma, float gamma, float gammaCorrection) {\nif (val >= maxCutOff) {\nreturn maxOutput;\n} else if (val <= minCutOff) {\nreturn minOutput;\n}\nfloat stretchedVal;\nif (useGamma) {\nfloat tempf = 1.0;\nfloat outRange = maxOutput - minOutput;\nfloat relativeVal = (val - minCutOff) / (maxCutOff - minCutOff);\nif (gamma > 1.0) {\ntempf -= pow(1.0 / outRange, relativeVal * gammaCorrection);\n}\nstretchedVal = (tempf * outRange * pow(relativeVal, 1.0 / gamma) + minOutput) / 255.0;\n} else {\nstretchedVal = minOutput + (val - minCutOff) * factor;\n}\nreturn stretchedVal;\n}\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\n#ifdef NOOP\ngl_FragColor = vec4(currentPixel.rgb, 1.0) * currentPixel.a * u_opacity;\nreturn;\n#endif\nif (u_bandCount == 1) {\nfloat grayVal = stretchOneValue(currentPixel.r, u_minCutOff[0], u_maxCutOff[0], u_minOutput, u_maxOutput, u_factor[0], u_useGamma, u_gamma[0], u_gammaCorrection[0]);\n#ifdef APPLY_COLORMAP\nvec4 result = colorize(vec4(grayVal, grayVal, grayVal, 1.0), u_useGamma ? 255.0 : 1.0);\ngl_FragColor = vec4(result.xyz, 1.0) * result.a * currentPixel.a * u_opacity;\n#else\ngl_FragColor = vec4(grayVal, grayVal, grayVal, 1.0) * currentPixel.a * u_opacity;\n#endif\n} else {\nfloat redVal = stretchOneValue(currentPixel.r, u_minCutOff[0], u_maxCutOff[0], u_minOutput, u_maxOutput, u_factor[0], u_useGamma, u_gamma[0], u_gammaCorrection[0]);\nfloat greenVal = stretchOneValue(currentPixel.g, u_minCutOff[1], u_maxCutOff[1], u_minOutput, u_maxOutput, u_factor[1], u_useGamma, u_gamma[1], u_gammaCorrection[1]);\nfloat blueVal = stretchOneValue(currentPixel.b, u_minCutOff[2], u_maxCutOff[2], u_minOutput, u_maxOutput, u_factor[2], u_useGamma, u_gamma[2], u_gammaCorrection[2]);\ngl_FragColor = vec4(redVal, greenVal, blueVal, 1.0) * currentPixel.a * u_opacity;\n}\n}","stretch.vert":"precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform highp float u_scale;\nuniform highp vec2 u_offset;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos * u_scale + u_offset;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}"}},stencil:{"stencil.frag":"void main() {\ngl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n}","stencil.vert":"attribute vec2 a_pos;\nvoid main() {\ngl_Position = vec4(a_pos, 0.0, 1.0);\n}"},tileInfo:{"tileInfo.frag":"uniform mediump sampler2D u_texture;\nvarying mediump vec2 v_tex;\nvoid main(void) {\nlowp vec4 color = texture2D(u_texture, v_tex);\ngl_FragColor = 0.75 * color;\n}","tileInfo.vert":"attribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform mediump float u_depth;\nuniform mediump vec2 u_coord_ratio;\nuniform mediump vec2 u_delta;\nuniform mediump vec2 u_dimensions;\nvarying mediump vec2 v_tex;\nvoid main() {\nmediump vec2 offset = u_coord_ratio * vec2(u_delta + a_pos * u_dimensions);\nvec3 v_pos = u_dvsMat3 * vec3(offset, 1.0);\ngl_Position = vec4(v_pos.xy, 0.0, 1.0);\nv_tex = a_pos;\n}"},util:{"encoding.glsl":"const vec4 rgba2float_factors = vec4(\n255.0 / (256.0),\n255.0 / (256.0 * 256.0),\n255.0 / (256.0 * 256.0 * 256.0),\n255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n);\nfloat rgba2float(vec4 rgba) {\nreturn dot(rgba, rgba2float_factors);\n}"}};var o=n("49f0");function a(e){let t=i;return e.split("/").forEach(e=>{t&&(t=t[e])}),t}const r=new o["a"](a);function l(e){return r.resolveIncludes(e)}},c9ee:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var i=n("b2b2"),o=n("f079"),a=n("d17d");class r extends o["a"]{dispose(){}prepareState(e){const{context:t}=e;t.setColorMask(!0,!0,!0,!0),t.setStencilFunction(a["h"].EQUAL,0,255)}draw(e,t){const{context:n}=e,{displayData:o}=t;if(Object(i["j"])(o))return;if("loaded"===o.state.name&&o.prepareForRendering(n),"attached"!==o.state.name)return;const r=o.state.resources;n.setFaceCullingEnabled(!1),n.setBlendingEnabled(!0),n.setBlendFunctionSeparate(a["b"].ONE,a["b"].ONE_MINUS_SRC_ALPHA,a["b"].ONE,a["b"].ONE);const l=[];"ramp"===r.values.lineColor.kind&&l.push("vvLineColor"),"ramp"===r.values.lineOpacity.kind&&l.push("vvLineOpacity"),"ramp"===r.values.lineRenderWidth.kind&&l.push("vvLineRenderWidth");const u=e.painter.materialManager.getProgram(e,{vsPath:"raster/flow",fsPath:"raster/flow",attributes:r.locations},l);n.useProgram(u),u.setUniform1f("u_time",e.time/1e3),u.setUniform1f("u_fadeDuration",o.flowStyle.renderSettings.fadeDuration),u.setUniform1f("u_lineSpeed",o.flowStyle.renderSettings.lineSpeed),u.setUniformMatrix3fv("u_dvsMat3",t.transforms.dvs),u.setUniformMatrix3fv("u_displayViewMat3",e.state.displayViewMat3),s(u,"lineColor","vec4",o.flowStyle.renderSettings.lineColor),s(u,"lineOpacity","float",o.flowStyle.renderSettings.lineOpacity),s(u,"lineRenderWidth","float",o.flowStyle.renderSettings.lineRenderWidth),n.bindVAO(r.vertexArray),n.drawElements(a["r"].TRIANGLES,r.indexBuffer.size,a["k"].UNSIGNED_INT,0),o.flowStyle.animated&&t.requestRender()}}function l(e,t,n,i){switch(t){case"int":e.setUniform1iv(n,i);break;case"float":e.setUniform1fv(n,i);break;case"vec2":e.setUniform2fv(n,i);break;case"vec3":e.setUniform3fv(n,i);break;case"vec4":e.setUniform4fv(n,i)}}function s(e,t,n,i){"constant"===i.kind?l(e,n,"u_"+t,i.value):(l(e,"float",`u_${t}_stops`,i.stops),l(e,n,`u_${t}_values`,i.values),l(e,"int",`u_${t}_count`,[i.count]))}},ec5e:function(e,t,n){"use strict";n.d(t,"a",(function(){return f}));var i=n("5ef2"),o=n("2e5c"),a=n("f079"),r=n("21c1"),l=n("7ce4"),s=n("d17d"),u=n("681f"),c=n("0fa6");class f extends a["a"]{constructor(){super(...arguments),this._color=Object(i["c"])(1,0,0,1),this._initialized=!1}dispose(){this._solidProgram&&(this._solidProgram.dispose(),this._solidProgram=null),this._solidVertexArrayObject&&(this._solidVertexArrayObject.dispose(),this._solidVertexArrayObject=null)}prepareState({context:e},t){e.setDepthWriteEnabled(!1),e.setDepthTestEnabled(!1),e.setStencilTestEnabled(!0),e.setBlendingEnabled(!1),e.setColorMask(!1,!1,!1,!1),e.setStencilOp(s["w"].KEEP,s["w"].KEEP,s["w"].REPLACE),e.setStencilWriteMask(255),e.setStencilFunctionSeparate(s["n"].FRONT_AND_BACK,s["h"].GREATER,t.stencilRef,255)}draw(e,t){const{context:n}=e;this._initialized||this._initialize(n),n.bindVAO(this._solidVertexArrayObject),n.useProgram(this._solidProgram),this._solidProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.dvs),this._solidProgram.setUniform2fv("u_coord_range",[t.rangeX,t.rangeY]),this._solidProgram.setUniform1f("u_depth",0),this._solidProgram.setUniform4fv("u_color",this._color),n.drawArrays(s["r"].TRIANGLE_STRIP,0,4),n.bindVAO()}_initialize(e){if(this._initialized)return!0;const t=Object(u["a"])(e,r["a"]);if(!t)return!1;const n=new Int8Array([0,0,1,0,0,1,1,1]),i=l["a"].createVertex(e,s["D"].STATIC_DRAW,n),a=new c["a"](e,r["a"].attributes,o["a"],{geometry:i});return this._solidProgram=t,this._solidVertexArrayObject=a,this._initialized=!0,!0}}},ef89:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return m})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return s})),n.d(t,"e",(function(){return a})),n.d(t,"f",(function(){return l})),n.d(t,"g",(function(){return u})),n.d(t,"h",(function(){return f})),n.d(t,"i",(function(){return c})),n.d(t,"j",(function(){return o}));var i,o,a,r,l,s,u,c,f,d=n("ab39");!function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.FILL=1]="FILL",e[e.LINE=2]="LINE",e[e.SYMBOL=3]="SYMBOL",e[e.CIRCLE=4]="CIRCLE"}(i||(i={})),function(e){e[e.VISIBLE=0]="VISIBLE",e[e.NONE=1]="NONE"}(o||(o={})),function(e){e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.LINE_CENTER=2]="LINE_CENTER"}(a||(a={})),function(e){e[e.MAP=0]="MAP",e[e.VIEWPORT=1]="VIEWPORT",e[e.AUTO=2]="AUTO"}(r||(r={})),function(e){e[e.AUTO=0]="AUTO",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT"}(l||(l={})),function(e){e[e.CENTER=0]="CENTER",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.TOP=3]="TOP",e[e.BOTTOM=4]="BOTTOM",e[e.TOP_LEFT=5]="TOP_LEFT",e[e.TOP_RIGHT=6]="TOP_RIGHT",e[e.BOTTOM_LEFT=7]="BOTTOM_LEFT",e[e.BOTTOM_RIGHT=8]="BOTTOM_RIGHT"}(s||(s={})),function(e){e[e.NONE=0]="NONE",e[e.UPPERCASE=1]="UPPERCASE",e[e.LOWERCASE=2]="LOWERCASE"}(u||(u={})),function(e){e[e.MAP=0]="MAP",e[e.VIEWPORT=1]="VIEWPORT"}(c||(c={})),function(e){e[e.HORIZONTAL=0]="HORIZONTAL",e[e.VERTICAL=1]="VERTICAL"}(f||(f={}));class m{}m.backgroundLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:o.VISIBLE}},m.fillLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:o.VISIBLE}},m.lineLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:o.VISIBLE},"line-cap":{type:"enum",values:["butt","round","square"],default:d["d"].BUTT},"line-join":{type:"enum",values:["bevel","round","miter"],default:d["o"].MITER},"line-miter-limit":{type:"number",default:2},"line-round-limit":{type:"number",default:1.05}},m.symbolLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:o.VISIBLE},"symbol-avoid-edges":{type:"boolean",default:!1},"symbol-placement":{type:"enum",values:["point","line","line-center"],default:a.POINT},"symbol-sort-key":{type:"number",default:-1},"symbol-spacing":{type:"number",minimum:1,default:250},"icon-allow-overlap":{type:"boolean",default:!1},"icon-anchor":{type:"enum",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:s.CENTER},"icon-ignore-placement":{type:"boolean",default:!1},"icon-image":{type:"string"},"icon-keep-upright":{type:"boolean",default:!1},"icon-offset":{type:"array",value:"number",length:2,default:[0,0]},"icon-optional":{type:"boolean",default:!1},"icon-padding":{type:"number",minimum:0,default:2},"icon-rotate":{type:"number",default:0},"icon-rotation-alignment":{type:"enum",values:["map","viewport","auto"],default:r.AUTO},"icon-size":{type:"number",minimum:0,default:1},"text-allow-overlap":{type:"boolean",default:!1},"text-anchor":{type:"enum",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:s.CENTER},"text-field":{type:"string"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"]},"text-ignore-placement":{type:"boolean",default:!1},"text-justify":{type:"enum",values:["auto","left","center","right"],default:l.CENTER},"text-keep-upright":{type:"boolean",default:!0},"text-letter-spacing":{type:"number",default:0},"text-line-height":{type:"number",default:1.2},"text-max-angle":{type:"number",minimum:0,default:45},"text-max-width":{type:"number",minimum:0,default:10},"text-offset":{type:"array",value:"number",length:2,default:[0,0]},"text-optional":{type:"boolean",default:!1},"text-padding":{type:"number",minimum:0,default:2},"text-rotate":{type:"number",default:0},"text-rotation-alignment":{type:"enum",values:["map","viewport","auto"],default:r.AUTO},"text-size":{type:"number",minimum:0,default:16},"text-transform":{type:"enum",values:["none","uppercase","lowercase"],default:u.NONE},"text-writing-mode":{type:"array",value:"enum",values:["horizontal","vertical"],default:[f.HORIZONTAL]}},m.circleLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:o.VISIBLE}},m.backgroundPaintDefinition={"background-color":{type:"color",default:[0,0,0,1]},"background-opacity":{type:"number",minimum:0,maximum:1,default:1},"background-pattern":{type:"string"}},m.fillPaintDefinition={"fill-antialias":{type:"boolean",default:!0},"fill-color":{type:"color",default:[0,0,0,1]},"fill-opacity":{type:"number",minimum:0,maximum:1,default:1},"fill-outline-color":{type:"color",default:[0,0,0,0]},"fill-pattern":{type:"string"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0]},"fill-translate-anchor":{type:"enum",values:["map","viewport"],default:c.MAP}},m.linePaintDefinition={"line-blur":{type:"number",minimum:0,default:0},"line-color":{type:"color",default:[0,0,0,1]},"line-dasharray":{type:"array",value:"number",default:[]},"line-gap-width":{type:"number",minimum:0,default:0},"line-offset":{type:"number",default:0},"line-opacity":{type:"number",minimum:0,maximum:1,default:1},"line-pattern":{type:"string"},"line-translate":{type:"array",value:"number",length:2,default:[0,0]},"line-translate-anchor":{type:"enum",values:["map","viewport"],default:c.MAP},"line-width":{type:"number",minimum:0,default:1}},m.symbolPaintDefinition={"icon-color":{type:"color",default:[0,0,0,1]},"icon-halo-blur":{type:"number",minimum:0,default:0},"icon-halo-color":{type:"color",default:[0,0,0,0]},"icon-halo-width":{type:"number",minimum:0,default:0},"icon-opacity":{type:"number",minimum:0,maximum:1,default:1},"icon-translate":{type:"array",value:"number",length:2,default:[0,0]},"icon-translate-anchor":{type:"enum",values:["map","viewport"],default:c.MAP},"text-color":{type:"color",default:[0,0,0,1]},"text-halo-blur":{type:"number",minimum:0,default:0},"text-halo-color":{type:"color",default:[0,0,0,0]},"text-halo-width":{type:"number",minimum:0,default:0},"text-opacity":{type:"number",minimum:0,maximum:1,default:1},"text-translate":{type:"array",value:"number",length:2,default:[0,0]},"text-translate-anchor":{type:"enum",values:["map","viewport"],default:c.MAP}},m.rasterPaintDefinition={"raster-opacity":{type:"number",minimum:0,maximum:1,default:1},"raster-hue-rotate":{type:"number",default:0},"raster-brightness-min":{type:"number",minimum:0,maximum:1,default:0},"raster-brightness-max":{type:"number",minimum:0,maximum:1,default:1},"raster-saturation":{type:"number",minimum:-1,maximum:1,default:0},"raster-contrast":{type:"number",minimum:-1,maximum:1,default:0},"raster-fade-duration":{type:"number",minimum:0,default:300}},m.circlePaintDefinition={"circle-blur":{type:"number",minimum:0,default:0},"circle-color":{type:"color",default:[0,0,0,1]},"circle-opacity":{type:"number",minimum:0,maximum:1,default:1},"circle-radius":{type:"number",minimum:0,default:5},"circle-stroke-color":{type:"color",default:[0,0,0,1]},"circle-stroke-opacity":{type:"number",minimum:0,maximum:1,default:1},"circle-stroke-width":{type:"number",minimum:0,default:0},"circle-translate":{type:"array",value:"number",length:2,default:[0,0]},"circle-translate-anchor":{type:"enum",values:["map","viewport"],default:c.MAP}}},f079:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));class i{constructor(){this.name=this.constructor.name||"UnnamedBrush"}prepareState(e,t,n){}draw(e,t,n){}drawMany(e,t,n){for(const i of t)this.draw(e,i,n)}}},f440:function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return m}));var i=n("b2b2"),o=n("1c92"),a=n("8c71"),r=n("738e"),l=n("9dee"),s=n("7c4b"),u=n("d17d"),c=n("beba");const f={bandCount:3,outMin:0,outMax:1,minCutOff:[0,0,0],maxCutOff:[255,255,255],factor:[1/255,1/255,1/255],useGamma:!1,gamma:[1,1,1],gammaCorrection:[1,1,1],colormap:null,colormapOffset:null,stretchType:"none",type:"stretch"};class d extends s["a"]{constructor(e=null,t=null,n=null){super(),this._textureInvalidated=!0,this._colormapTextureInvalidated=!0,this._supportsBilinearTexture=!0,this.stencilRef=0,this.coordScale=[1,1],this._symbolizerParameters=null,this.height=null,this.isRendereredSource=!1,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this.rawPixelData=null,this._suspended=!1,this._bandIds=null,this._interpolation=null,this._transformGrid=null,this.width=null,this.x=0,this.y=0,this.source=e,this.transformGrid=t,this.interpolation=n}destroy(){const e=this.getTextures();null==e||e.textures.forEach(e=>e.dispose()),this._rasterTexture=null,this._transformGridTexture=null,this._colormapTexture=null}get symbolizerParameters(){return this._symbolizerParameters||f}set symbolizerParameters(e){this._symbolizerParameters!==e&&(this._symbolizerParameters=e,this._colormapTextureInvalidated=!0)}get source(){return this._source}set source(e){this._source!==e&&(this._source=e,this._rasterTexture&&(this._rasterTexture.dispose(),this._rasterTexture=null,this._rasterTextureBandIds=null),this.invalidateTexture())}get suspended(){return this._suspended}set suspended(e){this._suspended&&!e&&this.stage&&(this.ready(),this.requestRender()),this._suspended=e}get bandIds(){return this._bandIds}set bandIds(e){this._bandIds=e,this._isBandIdschanged(e)&&this.invalidateTexture()}get interpolation(){return this._interpolation||"nearest"}set interpolation(e){this._interpolation=e,this._rasterTexture&&this._rasterTexture.setSamplingMode("bilinear"===this._getTextureSamplingMethod(e)?u["z"].LINEAR:u["z"].NEAREST)}get transformGrid(){return this._transformGrid}set transformGrid(e){this._transformGrid=e,this._transformGridTexture&&(this._transformGridTexture.dispose(),this._transformGridTexture=null)}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this.requestRender())}_createTransforms(){return{dvs:Object(a["b"])()}}setTransform(e){const t=Object(o["b"])(this.transforms.dvs),[n,i]=e.toScreenNoRotation([0,0],[this.x,this.y]),a=this.resolution/this.pixelRatio/e.resolution,l=a*this.width,s=a*this.height,u=Math.PI*this.rotation/180;Object(o["c"])(t,t,Object(r["b"])(n,i)),Object(o["c"])(t,t,Object(r["b"])(l/2,s/2)),Object(o["n"])(t,t,-u),Object(o["c"])(t,t,Object(r["b"])(-l/2,-s/2)),Object(o["j"])(t,t,Object(r["b"])(l,s)),Object(o["l"])(this.transforms.dvs,e.displayViewMat3,t)}getTextures(){if(!this._rasterTexture)return null;const e=[],t=[];return this._transformGridTexture&&(t.push(this._transformGridTexture),e.push("u_transformGrid")),this._rasterTexture&&(t.push(this._rasterTexture),e.push("u_image")),this._colormapTexture&&(t.push(this._colormapTexture),e.push("u_colormap")),{names:e,textures:t}}onAttach(){this.invalidateTexture()}onDetach(){this.invalidateTexture()}updateTexture({context:e}){var t,n,i;if(!this.stage)return null==(t=this._rasterTexture)||t.dispose(),null==(n=this._transformGridTexture)||n.dispose(),null==(i=this._colormapTexture)||i.dispose(),this._rasterTexture=null,this._rasterTextureBandIds=null,this._transformGridTexture=null,void(this._colormapTexture=null);const o=this._isValidSource(this.source);o&&this._colormapTextureInvalidated&&(this._colormapTextureInvalidated=!1,this._updateColormapTexture(e)),this._textureInvalidated&&(this._textureInvalidated=!1,this._createOrDestroyRasterTexture(e),this._rasterTexture&&(o?this.transformGrid&&!this._transformGridTexture&&(this._transformGridTexture=Object(c["c"])(e,this.transformGrid)):this._rasterTexture.setData(null)),this.suspended||(this.ready(),this.requestRender()))}_createOrDestroyRasterTexture(e){var t,n;const o=Object(i["k"])(this.source)?Object(l["h"])(this.source,this.bandIds):null;if(!this._isValidSource(o))return void(this._rasterTexture&&(this._rasterTexture.dispose(),this._rasterTextureBandIds=null,this._rasterTexture=null));const a=!this._isBandIdschanged(this.bandIds);if(this._rasterTexture){if(a)return;this._rasterTexture.dispose(),this._rasterTextureBandIds=null,this._rasterTexture=null}this._supportsBilinearTexture=null==(t=e.capabilities.textureFloat)?void 0:t.textureFloatLinear;const r=this._getTextureSamplingMethod(this.interpolation),s=this.isRendereredSource||!(null!=(n=e.capabilities.textureFloat)&&n.textureFloat);this._rasterTexture=Object(c["b"])(e,o,r,s),this._rasterTextureBandIds=this.bandIds?[...this.bandIds]:null}_isBandIdschanged(e){const t=this._rasterTextureBandIds;return!(null==t&&null==e||t&&e&&t.join("")===e.join(""))}_isValidSource(e){var t;return Object(i["k"])(e)&&(null==(t=e.pixels)?void 0:t.length)>0}_getTextureSamplingMethod(e){const{type:t,colormap:n}=this.symbolizerParameters,o="lut"===t||"stretch"===t&&Object(i["k"])(n);return!this._supportsBilinearTexture||o||"bilinear"!==e&&"cubic"!==e?"nearest":"bilinear"}_updateColormapTexture(e){const t=this._colormap,n=this.symbolizerParameters.colormap;return n?t?n.length!==t.length||n.some((e,n)=>e!==t[n])?(this._colormapTexture&&(this._colormapTexture.dispose(),this._colormapTexture=null),this._colormapTexture=Object(c["a"])(e,n),void(this._colormap=n)):void 0:(this._colormapTexture=Object(c["a"])(e,n),void(this._colormap=n)):(this._colormapTexture&&(this._colormapTexture.dispose(),this._colormapTexture=null),void(this._colormap=null))}}function m(e){return Object(i["k"])(e.source)}}}]); //# sourceMappingURL=chunk-0bf7ec9a.d2a544bf.js.map