@deck.gl/extensions 9.0.0-beta.4 → 9.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist.min.js CHANGED
@@ -4,7 +4,7 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['deck'] = factory();
6
6
  else root['deck'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var yt=Object.create;var m=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var Vt=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty;var Ue=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ge=(e,t)=>{for(var _ in t)m(e,_,{get:t[_],enumerable:!0})},$=(e,t,_,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ht(t))!Xt.call(e,i)&&i!==_&&m(e,i,{get:()=>t[i],enumerable:!(r=bt(t,i))||r.enumerable});return e},M=(e,t,_)=>($(e,t,"default"),_&&$(_,t,"default")),E=(e,t,_)=>(_=e!=null?yt(Vt(e)):{},$(t||!e||!e.__esModule?m(_,"default",{value:e,enumerable:!0}):_,e)),ut=e=>$(m({},"__esModule",{value:!0}),e);var p=Ue((Sr,xe)=>{xe.exports=globalThis.deck});var je=Ue((Br,Ye)=>{Ye.exports=globalThis.luma});var Q={};ge(Q,{BrushingExtension:()=>v,ClipExtension:()=>W,CollisionFilterExtension:()=>Y,DataFilterExtension:()=>U,FillStyleExtension:()=>u,Fp64Extension:()=>b,MaskExtension:()=>j,PathStyleExtension:()=>V,_TerrainExtension:()=>q,project64:()=>oe});var d={},ye=E(p(),1);M(d,E(p(),1));if(!ye.Layer)throw new Error("@deck.gl/core is not found");M(Q,d);var Ve=E(p(),1);var be=E(p(),1),Wt=`
7
+ "use strict";var __exports__=(()=>{var yt=Object.create;var m=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var Vt=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty;var Ue=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ge=(e,t)=>{for(var _ in t)m(e,_,{get:t[_],enumerable:!0})},$=(e,t,_,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ht(t))!Xt.call(e,i)&&i!==_&&m(e,i,{get:()=>t[i],enumerable:!(r=bt(t,i))||r.enumerable});return e},M=(e,t,_)=>($(e,t,"default"),_&&$(_,t,"default")),E=(e,t,_)=>(_=e!=null?yt(Vt(e)):{},$(t||!e||!e.__esModule?m(_,"default",{value:e,enumerable:!0}):_,e)),ut=e=>$(m({},"__esModule",{value:!0}),e);var p=Ue((Nr,xe)=>{xe.exports=globalThis.deck});var je=Ue((hr,Ye)=>{Ye.exports=globalThis.luma});var Q={};ge(Q,{BrushingExtension:()=>v,ClipExtension:()=>W,CollisionFilterExtension:()=>Y,DataFilterExtension:()=>U,FillStyleExtension:()=>u,Fp64Extension:()=>b,MaskExtension:()=>j,PathStyleExtension:()=>V,_TerrainExtension:()=>q,project64:()=>oe});var d={},ye=E(p(),1);M(d,E(p(),1));if(!ye.Layer)throw new Error("@deck.gl/core is not found");M(Q,d);var Ve=E(p(),1);var be=E(p(),1),Wt=`
8
8
  uniform bool brushing_enabled;
9
9
  uniform int brushing_target;
10
10
  uniform vec2 brushing_mousePos;
@@ -220,7 +220,7 @@ void main() {
220
220
  }
221
221
  fragColor = vColor;
222
222
  }
223
- `;function Ze(e){let t=e.gl;return Boolean(t.getExtension("EXT_float_blend")&&(t.getExtension("EXT_color_buffer_float")||t.getExtension("WEBGL_color_buffer_float")))}function qe(e,t){return t?e.createFramebuffer({width:1,height:1,colorAttachments:[e.createTexture({format:e.info.type==="webgl2"?"rgba32float":"rgba8unorm",type:n.FLOAT,mipmaps:!1})]}):e.createFramebuffer({width:256,height:64,colorAttachments:[e.createTexture({format:"rgba8unorm",type:n.FLOAT,mipmaps:!1})]})}function Qe(e,t,_){return t.defines.NON_INSTANCED_MODEL=1,_&&(t.defines.FLOAT_TARGET=1),new ze.Model(e,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,drawMode:n.POINTS,vs:zt,fs:Zt,...t})}var Je={blend:!0,blendFunc:[n.ONE,n.ONE,n.ONE,n.ONE],blendEquation:[n.FUNC_ADD,n.FUNC_ADD],depthTest:!1};var Qt={getFilterValue:{type:"accessor",value:0},getFilterCategory:{type:"accessor",value:0},onFilteredItemsChange:{type:"function",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterCategories:[0],filterTransformSize:!0,filterTransformColor:!0},$e={1:"float",2:"vec2",3:"vec3",4:"vec4"},G=class extends F.LayerExtension{getShaders(t){let{categorySize:_,filterSize:r,fp64:i}=t.opts;return{modules:[i?Ke:we],defines:{DATACATEGORY_TYPE:$e[_||1],DATACATEGORY_CHANNELS:_,DATAFILTER_TYPE:$e[r||1],DATAFILTER_DOUBLE:Boolean(i)}}}initializeState(t,_){let r=this.getAttributeManager(),{categorySize:i,filterSize:s,fp64:o}=_.opts;r&&r.add({filterValues:{size:s,type:o?n.DOUBLE:n.FLOAT,accessor:"getFilterValue",shaderAttributes:{filterValues:{divisor:0},instanceFilterValues:{divisor:1}}},filterCategoryValues:{size:i,type:n.FLOAT,accessor:"getFilterCategory",transform:i===1?R=>_._getCategoryKey.call(this,R,0):R=>R.map((l,T)=>_._getCategoryKey.call(this,l,T)),shaderAttributes:{filterCategoryValues:{divisor:0},instanceFilterCategoryValues:{divisor:1}}}});let{device:a}=this.context;if(r&&_.opts.countItems){let R=Ze(a);r.add({filterIndices:{size:R?1:2,vertexOffset:1,type:n.UNSIGNED_BYTE,normalized:!0,accessor:(A,{index:f})=>{let c=A&&A.__source?A.__source.index:f;return R?(c+1)%255:[(c+1)%255,Math.floor(c/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let l=qe(a,R),T=Qe(a,_.getShaders.call(this,_),R);this.setState({filterFBO:l,filterModel:T})}}updateState({props:t,oldProps:_,changeFlags:r},i){let s=this.getAttributeManager(),{categorySize:o}=i.opts;if(this.state.filterModel){let a=s.attributes.filterValues.needsUpdate()||s.attributes.filterCategoryValues?.needsUpdate()||t.filterEnabled!==_.filterEnabled||t.filterRange!==_.filterRange||t.filterSoftRange!==_.filterSoftRange||t.filterCategories!==_.filterCategories;a&&this.setState({filterNeedsUpdate:a})}if(s?.attributes.filterCategoryValues){let a=s.attributes.filterCategoryValues.needsUpdate()||!(0,F._deepEqual)(t.filterCategories,_.filterCategories,2);a&&this.setState({categoryBitMaskNeedsUpdate:a}),r.dataChanged&&(this.setState({categoryMap:Array(o).fill(0).map(()=>({}))}),s.attributes.filterCategoryValues.setNeedsUpdate("categoryMap"))}}draw(t,_){let r=this.state.filterFBO,i=this.state.filterModel,s=this.state.filterNeedsUpdate,o=this.state.categoryBitMaskNeedsUpdate,{onFilteredItemsChange:a}=this.props;if(o&&_._updateCategoryBitMask.call(this,t,_),s&&a&&i){let{attributes:{filterValues:R,filterCategoryValues:l,filterIndices:T}}=this.getAttributeManager();i.setVertexCount(this.getNumInstances()),this.context.device.clearWebGL({framebuffer:r,color:[0,0,0,0]}),i.updateModuleSettings(t.moduleParameters),i.setAttributes({...R.getValue(),...l?.getValue(),...T?.getValue()}),i.setUniforms(t.uniforms),i.device.withParametersWebGL({framebuffer:r,...Je,viewport:[0,0,r.width,r.height]},()=>{i.draw(this.context.renderPass)});let A=i.device.readPixelsToArrayWebGL(r),f=0;for(let c=0;c<A.length;c++)f+=A[c];a({id:this.id,count:f}),this.state.filterNeedsUpdate=!1}}finalizeState(){let t=this.state.filterFBO,_=this.state.filterModel;t?.destroy(),_?.destroy()}_updateCategoryBitMask(t,_){let{categorySize:r}=_.opts,{filterCategories:i}=this.props,s=new Uint32Array([0,0,0,0]),o=r===1?[i]:i,a=r===1?128:r===2?64:32;for(let R=0;R<o.length;R++){let l=o[R];for(let T of l){let A=_._getCategoryKey.call(this,T,R);if(A<a){let f=R*(a/32)+Math.floor(A/32);s[f]+=Math.pow(2,A%32)}else F.log.warn(`Exceeded maximum number of categories (${a})`)()}}t.uniforms.filter_categoryBitMask=s,this.state.categoryBitMaskNeedsUpdate=!1}_getCategoryKey(t,_){let r=this.state.categoryMap[_];return t in r||(r[t]=Object.keys(r).length),r[t]}},U=G;(()=>{G.defaultProps=Qt})(),(()=>{G.extensionName="DataFilterExtension"})();var y=E(p(),1);var ee=e=>`${e}`;function te(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=Math.fround(e),i=e-r;return t[_]=r,t[_+1]=i,t}function Me(e){return e-Math.fround(e)}function Oe(e){let t=new Float32Array(32);for(let _=0;_<4;++_)for(let r=0;r<4;++r){let i=_*4+r;te(e[r*4+_],t,i*2)}return t}var me=ee`\
223
+ `;function Ze(e){let t=e.gl;return Boolean(t.getExtension("EXT_float_blend")&&(t.getExtension("EXT_color_buffer_float")||t.getExtension("WEBGL_color_buffer_float")))}function qe(e,t){return t?e.createFramebuffer({width:1,height:1,colorAttachments:[e.createTexture({format:e.info.type==="webgl2"?"rgba32float":"rgba8unorm",type:n.FLOAT,mipmaps:!1})]}):e.createFramebuffer({width:256,height:64,colorAttachments:[e.createTexture({format:"rgba8unorm",type:n.FLOAT,mipmaps:!1})]})}function Qe(e,t,_){return t.defines.NON_INSTANCED_MODEL=1,_&&(t.defines.FLOAT_TARGET=1),new ze.Model(e,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,drawMode:n.POINTS,vs:zt,fs:Zt,...t})}var Je={blend:!0,blendFunc:[n.ONE,n.ONE,n.ONE,n.ONE],blendEquation:[n.FUNC_ADD,n.FUNC_ADD],depthTest:!1};var Qt={getFilterValue:{type:"accessor",value:0},getFilterCategory:{type:"accessor",value:0},onFilteredItemsChange:{type:"function",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterCategories:[0],filterTransformSize:!0,filterTransformColor:!0},Jt={categorySize:1,filterSize:1,fp64:!1,countItems:!1},$e={1:"float",2:"vec2",3:"vec3",4:"vec4"},G=class extends F.LayerExtension{constructor(t){super({...Jt,...t})}getShaders(t){let{categorySize:_,filterSize:r,fp64:i}=t.opts;return{modules:[i?Ke:we],defines:{DATACATEGORY_TYPE:$e[_],DATACATEGORY_CHANNELS:_,DATAFILTER_TYPE:$e[r],DATAFILTER_DOUBLE:Boolean(i)}}}initializeState(t,_){let r=this.getAttributeManager(),{categorySize:i,filterSize:s,fp64:o}=_.opts;r&&r.add({filterValues:{size:s,type:o?n.DOUBLE:n.FLOAT,accessor:"getFilterValue",shaderAttributes:{filterValues:{divisor:0},instanceFilterValues:{divisor:1}}},filterCategoryValues:{size:i,type:n.FLOAT,accessor:"getFilterCategory",transform:i===1?R=>_._getCategoryKey.call(this,R,0):R=>R.map((l,T)=>_._getCategoryKey.call(this,l,T)),shaderAttributes:{filterCategoryValues:{divisor:0},instanceFilterCategoryValues:{divisor:1}}}});let{device:a}=this.context;if(r&&_.opts.countItems){let R=Ze(a);r.add({filterIndices:{size:R?1:2,vertexOffset:1,type:n.UNSIGNED_BYTE,normalized:!0,accessor:(A,{index:f})=>{let c=A&&A.__source?A.__source.index:f;return R?(c+1)%255:[(c+1)%255,Math.floor(c/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let l=qe(a,R),T=Qe(a,_.getShaders.call(this,_),R);this.setState({filterFBO:l,filterModel:T})}}updateState({props:t,oldProps:_,changeFlags:r},i){let s=this.getAttributeManager(),{categorySize:o}=i.opts;if(this.state.filterModel){let a=s.attributes.filterValues.needsUpdate()||s.attributes.filterCategoryValues?.needsUpdate()||t.filterEnabled!==_.filterEnabled||t.filterRange!==_.filterRange||t.filterSoftRange!==_.filterSoftRange||t.filterCategories!==_.filterCategories;a&&this.setState({filterNeedsUpdate:a})}if(s?.attributes.filterCategoryValues){let a=s.attributes.filterCategoryValues.needsUpdate()||!(0,F._deepEqual)(t.filterCategories,_.filterCategories,2);a&&this.setState({categoryBitMaskNeedsUpdate:a}),r.dataChanged&&(this.setState({categoryMap:Array(o).fill(0).map(()=>({}))}),s.attributes.filterCategoryValues.setNeedsUpdate("categoryMap"))}}draw(t,_){let r=this.state.filterFBO,i=this.state.filterModel,s=this.state.filterNeedsUpdate,o=this.state.categoryBitMaskNeedsUpdate,{onFilteredItemsChange:a}=this.props;if(o&&_._updateCategoryBitMask.call(this,t,_),s&&a&&i){let{attributes:{filterValues:R,filterCategoryValues:l,filterIndices:T}}=this.getAttributeManager();i.setVertexCount(this.getNumInstances()),this.context.device.clearWebGL({framebuffer:r,color:[0,0,0,0]}),i.updateModuleSettings(t.moduleParameters),i.setAttributes({...R.getValue(),...l?.getValue(),...T?.getValue()}),i.setUniforms(t.uniforms),i.device.withParametersWebGL({framebuffer:r,...Je,viewport:[0,0,r.width,r.height]},()=>{i.draw(this.context.renderPass)});let A=i.device.readPixelsToArrayWebGL(r),f=0;for(let c=0;c<A.length;c++)f+=A[c];a({id:this.id,count:f}),this.state.filterNeedsUpdate=!1}}finalizeState(){let t=this.state.filterFBO,_=this.state.filterModel;t?.destroy(),_?.destroy()}_updateCategoryBitMask(t,_){let{categorySize:r}=_.opts,{filterCategories:i}=this.props,s=new Uint32Array([0,0,0,0]),o=r===1?[i]:i,a=r===1?128:r===2?64:32;for(let R=0;R<o.length;R++){let l=o[R];for(let T of l){let A=_._getCategoryKey.call(this,T,R);if(A<a){let f=R*(a/32)+Math.floor(A/32);s[f]+=Math.pow(2,A%32)}else F.log.warn(`Exceeded maximum number of categories (${a})`)()}}t.uniforms.filter_categoryBitMask=s,this.state.categoryBitMaskNeedsUpdate=!1}_getCategoryKey(t,_){let r=this.state.categoryMap[_];return t in r||(r[t]=Object.keys(r).length),r[t]}},U=G;(()=>{G.defaultProps=Qt})(),(()=>{G.extensionName="DataFilterExtension"})();var y=E(p(),1);var ee=e=>`${e}`;function te(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=Math.fround(e),i=e-r;return t[_]=r,t[_+1]=i,t}function Me(e){return e-Math.fround(e)}function Oe(e){let t=new Float32Array(32);for(let _=0;_<4;++_)for(let r=0;r<4;++r){let i=_*4+r;te(e[r*4+_],t,i*2)}return t}var me=ee`\
224
224
  uniform float ONE;
225
225
 
226
226
  /*
@@ -1056,7 +1056,7 @@ void mat4_vec4_mul_fp64(vec2 b[16], vec2 a[4], out vec2 out_val[4]) {
1056
1056
  vec4_dot_fp64(a, tmp, out_val[i]);
1057
1057
  }
1058
1058
  }
1059
- `;var Jt={ONE:1};function $t(){return Jt}var Ge={name:"fp64-arithmetic",vs:me,getUniforms:$t,fp64ify:te,fp64LowPart:Me,fp64ifyMatrix4:Oe},_e={name:"fp64",vs:Le,dependencies:[Ge],fp64ify:te,fp64LowPart:Me,fp64ifyMatrix4:Oe};var wr=1/Math.PI*180,Kr=1/180*Math.PI,mt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...mt}};var g=globalThis.mathgl.config;function Ce(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function P(e,t,_){let r=g.EPSILON;_&&(g.EPSILON=_);try{if(e===t)return!0;if(Ce(e)&&Ce(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!P(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=g.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{g.EPSILON=r}}var x=typeof Float32Array<"u"?Float32Array:Array,Fe=Math.random;function re(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var jr=Math.PI/180;var ie={};ge(ie,{add:()=>r_,angle:()=>B_,bezier:()=>N_,ceil:()=>i_,clone:()=>Gt,copy:()=>t_,create:()=>et,cross:()=>n_,dist:()=>b_,distance:()=>st,div:()=>y_,divide:()=>it,dot:()=>Be,equals:()=>U_,exactEquals:()=>v_,floor:()=>s_,forEach:()=>u_,fromValues:()=>e_,hermite:()=>S_,inverse:()=>f_,len:()=>V_,length:()=>tt,lerp:()=>E_,max:()=>a_,min:()=>o_,mul:()=>x_,multiply:()=>rt,negate:()=>A_,normalize:()=>c_,random:()=>d_,rotateX:()=>C_,rotateY:()=>F_,rotateZ:()=>P_,round:()=>R_,scale:()=>l_,scaleAndAdd:()=>T_,set:()=>__,slerp:()=>p_,sqrDist:()=>H_,sqrLen:()=>X_,squaredDistance:()=>ot,squaredLength:()=>at,str:()=>D_,sub:()=>g_,subtract:()=>_t,transformMat3:()=>M_,transformMat4:()=>I_,transformQuat:()=>O_,zero:()=>h_});function et(){let e=new x(3);return x!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gt(e){let t=new x(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function tt(e){let t=e[0],_=e[1],r=e[2];return Math.sqrt(t*t+_*_+r*r)}function e_(e,t,_){let r=new x(3);return r[0]=e,r[1]=t,r[2]=_,r}function t_(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function __(e,t,_,r){return e[0]=t,e[1]=_,e[2]=r,e}function r_(e,t,_){return e[0]=t[0]+_[0],e[1]=t[1]+_[1],e[2]=t[2]+_[2],e}function _t(e,t,_){return e[0]=t[0]-_[0],e[1]=t[1]-_[1],e[2]=t[2]-_[2],e}function rt(e,t,_){return e[0]=t[0]*_[0],e[1]=t[1]*_[1],e[2]=t[2]*_[2],e}function it(e,t,_){return e[0]=t[0]/_[0],e[1]=t[1]/_[1],e[2]=t[2]/_[2],e}function i_(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function s_(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function o_(e,t,_){return e[0]=Math.min(t[0],_[0]),e[1]=Math.min(t[1],_[1]),e[2]=Math.min(t[2],_[2]),e}function a_(e,t,_){return e[0]=Math.max(t[0],_[0]),e[1]=Math.max(t[1],_[1]),e[2]=Math.max(t[2],_[2]),e}function R_(e,t){return e[0]=re(t[0]),e[1]=re(t[1]),e[2]=re(t[2]),e}function l_(e,t,_){return e[0]=t[0]*_,e[1]=t[1]*_,e[2]=t[2]*_,e}function T_(e,t,_,r){return e[0]=t[0]+_[0]*r,e[1]=t[1]+_[1]*r,e[2]=t[2]+_[2]*r,e}function st(e,t){let _=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(_*_+r*r+i*i)}function ot(e,t){let _=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return _*_+r*r+i*i}function at(e){let t=e[0],_=e[1],r=e[2];return t*t+_*_+r*r}function A_(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function f_(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function c_(e,t){let _=t[0],r=t[1],i=t[2],s=_*_+r*r+i*i;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function Be(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function n_(e,t,_){let r=t[0],i=t[1],s=t[2],o=_[0],a=_[1],R=_[2];return e[0]=i*R-s*a,e[1]=s*o-r*R,e[2]=r*a-i*o,e}function E_(e,t,_,r){let i=t[0],s=t[1],o=t[2];return e[0]=i+r*(_[0]-i),e[1]=s+r*(_[1]-s),e[2]=o+r*(_[2]-o),e}function p_(e,t,_,r){let i=Math.acos(Math.min(Math.max(Be(t,_),-1),1)),s=Math.sin(i),o=Math.sin((1-r)*i)/s,a=Math.sin(r*i)/s;return e[0]=o*t[0]+a*_[0],e[1]=o*t[1]+a*_[1],e[2]=o*t[2]+a*_[2],e}function S_(e,t,_,r,i,s){let o=s*s,a=o*(2*s-3)+1,R=o*(s-2)+s,l=o*(s-1),T=o*(3-2*s);return e[0]=t[0]*a+_[0]*R+r[0]*l+i[0]*T,e[1]=t[1]*a+_[1]*R+r[1]*l+i[1]*T,e[2]=t[2]*a+_[2]*R+r[2]*l+i[2]*T,e}function N_(e,t,_,r,i,s){let o=1-s,a=o*o,R=s*s,l=a*o,T=3*s*a,A=3*R*o,f=R*s;return e[0]=t[0]*l+_[0]*T+r[0]*A+i[0]*f,e[1]=t[1]*l+_[1]*T+r[1]*A+i[1]*f,e[2]=t[2]*l+_[2]*T+r[2]*A+i[2]*f,e}function d_(e,t){t=t===void 0?1:t;let _=Fe()*2*Math.PI,r=Fe()*2-1,i=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(_)*i,e[1]=Math.sin(_)*i,e[2]=r*t,e}function I_(e,t,_){let r=t[0],i=t[1],s=t[2],o=_[3]*r+_[7]*i+_[11]*s+_[15];return o=o||1,e[0]=(_[0]*r+_[4]*i+_[8]*s+_[12])/o,e[1]=(_[1]*r+_[5]*i+_[9]*s+_[13])/o,e[2]=(_[2]*r+_[6]*i+_[10]*s+_[14])/o,e}function M_(e,t,_){let r=t[0],i=t[1],s=t[2];return e[0]=r*_[0]+i*_[3]+s*_[6],e[1]=r*_[1]+i*_[4]+s*_[7],e[2]=r*_[2]+i*_[5]+s*_[8],e}function O_(e,t,_){let r=_[0],i=_[1],s=_[2],o=_[3],a=t[0],R=t[1],l=t[2],T=i*l-s*R,A=s*a-r*l,f=r*R-i*a,c=i*f-s*A,S=s*T-r*f,J=r*A-i*T,N=o*2;return T*=N,A*=N,f*=N,c*=2,S*=2,J*=2,e[0]=a+T+c,e[1]=R+A+S,e[2]=l+f+J,e}function C_(e,t,_,r){let i=[],s=[];return i[0]=t[0]-_[0],i[1]=t[1]-_[1],i[2]=t[2]-_[2],s[0]=i[0],s[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),s[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),e[0]=s[0]+_[0],e[1]=s[1]+_[1],e[2]=s[2]+_[2],e}function F_(e,t,_,r){let i=[],s=[];return i[0]=t[0]-_[0],i[1]=t[1]-_[1],i[2]=t[2]-_[2],s[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),s[1]=i[1],s[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),e[0]=s[0]+_[0],e[1]=s[1]+_[1],e[2]=s[2]+_[2],e}function P_(e,t,_,r){let i=[],s=[];return i[0]=t[0]-_[0],i[1]=t[1]-_[1],i[2]=t[2]-_[2],s[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),s[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),s[2]=i[2],e[0]=s[0]+_[0],e[1]=s[1]+_[1],e[2]=s[2]+_[2],e}function B_(e,t){let _=e[0],r=e[1],i=e[2],s=t[0],o=t[1],a=t[2],R=Math.sqrt((_*_+r*r+i*i)*(s*s+o*o+a*a)),l=R&&Be(e,t)/R;return Math.acos(Math.min(Math.max(l,-1),1))}function h_(e){return e[0]=0,e[1]=0,e[2]=0,e}function D_(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function v_(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function U_(e,t){let _=e[0],r=e[1],i=e[2],s=t[0],o=t[1],a=t[2];return Math.abs(_-s)<=1e-6*Math.max(1,Math.abs(_),Math.abs(s))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))}var g_=_t,x_=rt,y_=it,b_=st,H_=ot,V_=tt,X_=at,u_=function(){let e=et();return function(t,_,r,i,s,o){let a,R;for(_||(_=3),r||(r=0),i?R=Math.min(i*_+r,t.length):R=t.length,a=r;a<R;a+=_)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],s(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();var se=E(p(),1);var Rt=`
1059
+ `;var $t={ONE:1};function mt(){return $t}var Ge={name:"fp64-arithmetic",vs:me,getUniforms:mt,fp64ify:te,fp64LowPart:Me,fp64ifyMatrix4:Oe},_e={name:"fp64",vs:Le,dependencies:[Ge],fp64ify:te,fp64LowPart:Me,fp64ifyMatrix4:Oe};var Kr=1/Math.PI*180,Yr=1/180*Math.PI,Lt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Lt}};var g=globalThis.mathgl.config;function Ce(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function P(e,t,_){let r=g.EPSILON;_&&(g.EPSILON=_);try{if(e===t)return!0;if(Ce(e)&&Ce(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!P(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=g.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{g.EPSILON=r}}var x=typeof Float32Array<"u"?Float32Array:Array,Fe=Math.random;function re(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var zr=Math.PI/180;var ie={};ge(ie,{add:()=>i_,angle:()=>h_,bezier:()=>d_,ceil:()=>s_,clone:()=>e_,copy:()=>__,create:()=>et,cross:()=>E_,dist:()=>H_,distance:()=>st,div:()=>b_,divide:()=>it,dot:()=>Be,equals:()=>g_,exactEquals:()=>U_,floor:()=>o_,forEach:()=>W_,fromValues:()=>t_,hermite:()=>N_,inverse:()=>c_,len:()=>X_,length:()=>tt,lerp:()=>p_,max:()=>R_,min:()=>a_,mul:()=>y_,multiply:()=>rt,negate:()=>f_,normalize:()=>n_,random:()=>I_,rotateX:()=>F_,rotateY:()=>P_,rotateZ:()=>B_,round:()=>l_,scale:()=>T_,scaleAndAdd:()=>A_,set:()=>r_,slerp:()=>S_,sqrDist:()=>V_,sqrLen:()=>u_,squaredDistance:()=>ot,squaredLength:()=>at,str:()=>v_,sub:()=>x_,subtract:()=>_t,transformMat3:()=>O_,transformMat4:()=>M_,transformQuat:()=>C_,zero:()=>D_});function et(){let e=new x(3);return x!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function e_(e){let t=new x(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function tt(e){let t=e[0],_=e[1],r=e[2];return Math.sqrt(t*t+_*_+r*r)}function t_(e,t,_){let r=new x(3);return r[0]=e,r[1]=t,r[2]=_,r}function __(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function r_(e,t,_,r){return e[0]=t,e[1]=_,e[2]=r,e}function i_(e,t,_){return e[0]=t[0]+_[0],e[1]=t[1]+_[1],e[2]=t[2]+_[2],e}function _t(e,t,_){return e[0]=t[0]-_[0],e[1]=t[1]-_[1],e[2]=t[2]-_[2],e}function rt(e,t,_){return e[0]=t[0]*_[0],e[1]=t[1]*_[1],e[2]=t[2]*_[2],e}function it(e,t,_){return e[0]=t[0]/_[0],e[1]=t[1]/_[1],e[2]=t[2]/_[2],e}function s_(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function o_(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function a_(e,t,_){return e[0]=Math.min(t[0],_[0]),e[1]=Math.min(t[1],_[1]),e[2]=Math.min(t[2],_[2]),e}function R_(e,t,_){return e[0]=Math.max(t[0],_[0]),e[1]=Math.max(t[1],_[1]),e[2]=Math.max(t[2],_[2]),e}function l_(e,t){return e[0]=re(t[0]),e[1]=re(t[1]),e[2]=re(t[2]),e}function T_(e,t,_){return e[0]=t[0]*_,e[1]=t[1]*_,e[2]=t[2]*_,e}function A_(e,t,_,r){return e[0]=t[0]+_[0]*r,e[1]=t[1]+_[1]*r,e[2]=t[2]+_[2]*r,e}function st(e,t){let _=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(_*_+r*r+i*i)}function ot(e,t){let _=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return _*_+r*r+i*i}function at(e){let t=e[0],_=e[1],r=e[2];return t*t+_*_+r*r}function f_(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function c_(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function n_(e,t){let _=t[0],r=t[1],i=t[2],s=_*_+r*r+i*i;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function Be(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function E_(e,t,_){let r=t[0],i=t[1],s=t[2],o=_[0],a=_[1],R=_[2];return e[0]=i*R-s*a,e[1]=s*o-r*R,e[2]=r*a-i*o,e}function p_(e,t,_,r){let i=t[0],s=t[1],o=t[2];return e[0]=i+r*(_[0]-i),e[1]=s+r*(_[1]-s),e[2]=o+r*(_[2]-o),e}function S_(e,t,_,r){let i=Math.acos(Math.min(Math.max(Be(t,_),-1),1)),s=Math.sin(i),o=Math.sin((1-r)*i)/s,a=Math.sin(r*i)/s;return e[0]=o*t[0]+a*_[0],e[1]=o*t[1]+a*_[1],e[2]=o*t[2]+a*_[2],e}function N_(e,t,_,r,i,s){let o=s*s,a=o*(2*s-3)+1,R=o*(s-2)+s,l=o*(s-1),T=o*(3-2*s);return e[0]=t[0]*a+_[0]*R+r[0]*l+i[0]*T,e[1]=t[1]*a+_[1]*R+r[1]*l+i[1]*T,e[2]=t[2]*a+_[2]*R+r[2]*l+i[2]*T,e}function d_(e,t,_,r,i,s){let o=1-s,a=o*o,R=s*s,l=a*o,T=3*s*a,A=3*R*o,f=R*s;return e[0]=t[0]*l+_[0]*T+r[0]*A+i[0]*f,e[1]=t[1]*l+_[1]*T+r[1]*A+i[1]*f,e[2]=t[2]*l+_[2]*T+r[2]*A+i[2]*f,e}function I_(e,t){t=t===void 0?1:t;let _=Fe()*2*Math.PI,r=Fe()*2-1,i=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(_)*i,e[1]=Math.sin(_)*i,e[2]=r*t,e}function M_(e,t,_){let r=t[0],i=t[1],s=t[2],o=_[3]*r+_[7]*i+_[11]*s+_[15];return o=o||1,e[0]=(_[0]*r+_[4]*i+_[8]*s+_[12])/o,e[1]=(_[1]*r+_[5]*i+_[9]*s+_[13])/o,e[2]=(_[2]*r+_[6]*i+_[10]*s+_[14])/o,e}function O_(e,t,_){let r=t[0],i=t[1],s=t[2];return e[0]=r*_[0]+i*_[3]+s*_[6],e[1]=r*_[1]+i*_[4]+s*_[7],e[2]=r*_[2]+i*_[5]+s*_[8],e}function C_(e,t,_){let r=_[0],i=_[1],s=_[2],o=_[3],a=t[0],R=t[1],l=t[2],T=i*l-s*R,A=s*a-r*l,f=r*R-i*a,c=i*f-s*A,S=s*T-r*f,J=r*A-i*T,N=o*2;return T*=N,A*=N,f*=N,c*=2,S*=2,J*=2,e[0]=a+T+c,e[1]=R+A+S,e[2]=l+f+J,e}function F_(e,t,_,r){let i=[],s=[];return i[0]=t[0]-_[0],i[1]=t[1]-_[1],i[2]=t[2]-_[2],s[0]=i[0],s[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),s[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),e[0]=s[0]+_[0],e[1]=s[1]+_[1],e[2]=s[2]+_[2],e}function P_(e,t,_,r){let i=[],s=[];return i[0]=t[0]-_[0],i[1]=t[1]-_[1],i[2]=t[2]-_[2],s[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),s[1]=i[1],s[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),e[0]=s[0]+_[0],e[1]=s[1]+_[1],e[2]=s[2]+_[2],e}function B_(e,t,_,r){let i=[],s=[];return i[0]=t[0]-_[0],i[1]=t[1]-_[1],i[2]=t[2]-_[2],s[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),s[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),s[2]=i[2],e[0]=s[0]+_[0],e[1]=s[1]+_[1],e[2]=s[2]+_[2],e}function h_(e,t){let _=e[0],r=e[1],i=e[2],s=t[0],o=t[1],a=t[2],R=Math.sqrt((_*_+r*r+i*i)*(s*s+o*o+a*a)),l=R&&Be(e,t)/R;return Math.acos(Math.min(Math.max(l,-1),1))}function D_(e){return e[0]=0,e[1]=0,e[2]=0,e}function v_(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function U_(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function g_(e,t){let _=e[0],r=e[1],i=e[2],s=t[0],o=t[1],a=t[2];return Math.abs(_-s)<=1e-6*Math.max(1,Math.abs(_),Math.abs(s))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))}var x_=_t,y_=rt,b_=it,H_=st,V_=ot,X_=tt,u_=at,W_=function(){let e=et();return function(t,_,r,i,s,o){let a,R;for(_||(_=3),r||(r=0),i?R=Math.min(i*_+r,t.length):R=t.length,a=r;a<R;a+=_)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],s(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();var se=E(p(),1);var Rt=`
1060
1060
  const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
1061
1061
 
1062
1062
  uniform vec2 project_uViewProjectionMatrixFP64[16];
@@ -1135,7 +1135,7 @@ vec4 project_position_to_clipspace(
1135
1135
  position, position64xyLow, offset, commonPosition
1136
1136
  );
1137
1137
  }
1138
- `;var{fp64ify:W_,fp64ifyMatrix4:k_}=_e,oe={name:"project64",dependencies:[se.project,_e],vs:Rt,getUniforms:K_},w_=(0,se._memoize)(Y_);function K_(e){if(e&&"viewport"in e){let{viewProjectionMatrix:t,scale:_}=e.viewport;return w_({viewProjectionMatrix:t,scale:_})}return{}}function Y_({viewProjectionMatrix:e,scale:t}){let _=k_(e),r=W_(t);return{project_uViewProjectionMatrixFP64:_,project64_uViewProjectionMatrix:_,project64_uScale:r}}var he=class extends y.LayerExtension{getShaders(){let{coordinateSystem:t}=this.props;if(t!==y.COORDINATE_SYSTEM.LNGLAT&&t!==y.COORDINATE_SYSTEM.DEFAULT)throw new Error("fp64: coordinateSystem must be LNGLAT");return{modules:[oe]}}},b=he;(()=>{he.extensionName="Fp64Extension"})();var H=E(p(),1);var lt={inject:{"vs:#decl":`
1138
+ `;var{fp64ify:k_,fp64ifyMatrix4:w_}=_e,oe={name:"project64",dependencies:[se.project,_e],vs:Rt,getUniforms:Y_},K_=(0,se._memoize)(j_);function Y_(e){if(e&&"viewport"in e){let{viewProjectionMatrix:t,scale:_}=e.viewport;return K_({viewProjectionMatrix:t,scale:_})}return{}}function j_({viewProjectionMatrix:e,scale:t}){let _=w_(e),r=k_(t);return{project_uViewProjectionMatrixFP64:_,project64_uViewProjectionMatrix:_,project64_uScale:r}}var he=class extends y.LayerExtension{getShaders(){let{coordinateSystem:t}=this.props;if(t!==y.COORDINATE_SYSTEM.LNGLAT&&t!==y.COORDINATE_SYSTEM.DEFAULT)throw new Error("fp64: coordinateSystem must be LNGLAT");return{modules:[oe]}}},b=he;(()=>{he.extensionName="Fp64Extension"})();var H=E(p(),1);var lt={inject:{"vs:#decl":`
1139
1139
  in vec2 instanceDashArrays;
1140
1140
  in float instanceDashOffsets;
1141
1141
  out vec2 vDashArray;
@@ -1202,7 +1202,7 @@ in float instanceOffsets;
1202
1202
  if (isInside == 0.0) {
1203
1203
  discard;
1204
1204
  }
1205
- `}};var j_={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},ae=class extends H.LayerExtension{constructor({dash:t=!1,offset:_=!1,highPrecisionDash:r=!1}={}){super({dash:t||r,offset:_,highPrecisionDash:r})}isEnabled(t){return"pathTesselator"in t.state}getShaders(t){if(!t.isEnabled(this))return null;let _={};return t.opts.dash&&(_=(0,H._mergeShaders)(_,lt)),t.opts.offset&&(_=(0,H._mergeShaders)(_,Tt)),_}initializeState(t,_){let r=this.getAttributeManager();!r||!_.isEnabled(this)||(_.opts.dash&&r.addInstanced({instanceDashArrays:{size:2,accessor:"getDashArray"},instanceDashOffsets:_.opts.highPrecisionDash?{size:1,accessor:"getPath",transform:_.getDashOffsets.bind(this)}:{size:1,update:i=>{i.constant=!0,i.value=[0]}}}),_.opts.offset&&r.addInstanced({instanceOffsets:{size:1,accessor:"getOffset"}}))}updateState(t,_){if(!_.isEnabled(this))return;let r={};_.opts.dash&&(r.dashAlignMode=this.props.dashJustified?1:0,r.dashGapPickable=Boolean(this.props.dashGapPickable)),this.state.model?.setUniforms(r)}getDashOffsets(t){let _=[0],r=this.props.positionFormat==="XY"?2:3,i=Array.isArray(t[0]),s=i?t.length:t.length/r,o,a;for(let R=0;R<s-1;R++)o=i?t[R]:t.slice(R*r,R*r+r),o=this.projectPosition(o),R>0&&(_[R]=_[R-1]+ie.dist(a,o)),a=o;return _}},V=ae;(()=>{ae.defaultProps=j_})(),(()=>{ae.extensionName="PathStyleExtension"})();var ft=E(p(),1);var X=E(p(),1),z_=`
1205
+ `}};var z_={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},ae=class extends H.LayerExtension{constructor({dash:t=!1,offset:_=!1,highPrecisionDash:r=!1}={}){super({dash:t||r,offset:_,highPrecisionDash:r})}isEnabled(t){return"pathTesselator"in t.state}getShaders(t){if(!t.isEnabled(this))return null;let _={};return t.opts.dash&&(_=(0,H._mergeShaders)(_,lt)),t.opts.offset&&(_=(0,H._mergeShaders)(_,Tt)),_}initializeState(t,_){let r=this.getAttributeManager();!r||!_.isEnabled(this)||(_.opts.dash&&r.addInstanced({instanceDashArrays:{size:2,accessor:"getDashArray"},instanceDashOffsets:_.opts.highPrecisionDash?{size:1,accessor:"getPath",transform:_.getDashOffsets.bind(this)}:{size:1,update:i=>{i.constant=!0,i.value=[0]}}}),_.opts.offset&&r.addInstanced({instanceOffsets:{size:1,accessor:"getOffset"}}))}updateState(t,_){if(!_.isEnabled(this))return;let r={};_.opts.dash&&(r.dashAlignMode=this.props.dashJustified?1:0,r.dashGapPickable=Boolean(this.props.dashGapPickable)),this.state.model?.setUniforms(r)}getDashOffsets(t){let _=[0],r=this.props.positionFormat==="XY"?2:3,i=Array.isArray(t[0]),s=i?t.length:t.length/r,o,a;for(let R=0;R<s-1;R++)o=i?t[R]:t.slice(R*r,R*r+r),o=this.projectPosition(o),R>0&&(_[R]=_[R-1]+ie.dist(a,o)),a=o;return _}},V=ae;(()=>{ae.defaultProps=z_})(),(()=>{ae.extensionName="PathStyleExtension"})();var ft=E(p(),1);var X=E(p(),1),Z_=`
1206
1206
  #ifdef NON_INSTANCED_MODEL
1207
1207
  #define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
1208
1208
  #define FILL_PATTERN_SCALE_ATTRIB fillPatternScales
@@ -1223,7 +1223,7 @@ uniform vec2 fill_patternTextureSize;
1223
1223
  out vec2 fill_uv;
1224
1224
  out vec4 fill_patternBounds;
1225
1225
  out vec4 fill_patternPlacement;
1226
- `,Z_=`
1226
+ `,q_=`
1227
1227
  uniform bool fill_patternEnabled;
1228
1228
  uniform bool fill_patternMask;
1229
1229
  uniform sampler2D fill_patternTexture;
@@ -1235,7 +1235,7 @@ in vec4 fill_patternPlacement;
1235
1235
  in vec2 fill_uv;
1236
1236
 
1237
1237
  const float FILL_UV_SCALE = 512.0 / 40000000.0;
1238
- `,q_={"vs:DECKGL_FILTER_GL_POSITION":`
1238
+ `,Q_={"vs:DECKGL_FILTER_GL_POSITION":`
1239
1239
  fill_uv = geometry.position.xy;
1240
1240
  `,"vs:DECKGL_FILTER_COLOR":`
1241
1241
  if (fill_patternEnabled) {
@@ -1257,13 +1257,13 @@ const float FILL_UV_SCALE = 512.0 / 40000000.0;
1257
1257
  color.rgb = patternColor.rgb;
1258
1258
  }
1259
1259
  }
1260
- `};function Q_(e,t){if(!e)return{};if("fillPatternTexture"in e){let{fillPatternTexture:_}=e;return{fill_patternTexture:_,fill_patternTextureSize:[_.width,_.height]}}if("viewport"in e){let{fillPatternMask:_=!0,fillPatternEnabled:r=!0}=e,{project_uCommonOrigin:i}=t,s=[(0,X.fp64LowPart)(i[0]),(0,X.fp64LowPart)(i[1])];return{fill_uvCoordinateOrigin:i.slice(0,2),fill_uvCoordinateOrigin64Low:s,fill_patternMask:_,fill_patternEnabled:r}}return{}}var At={name:"fill-pattern",vs:z_,fs:Z_,inject:q_,dependencies:[X.project],getUniforms:Q_};var J_={fillPatternEnabled:!0,fillPatternAtlas:{type:"image",value:null,async:!0,parameters:{minFilter:"linear"}},fillPatternMapping:{type:"object",value:{},async:!0},fillPatternMask:!0,getFillPattern:{type:"accessor",value:e=>e.pattern},getFillPatternScale:{type:"accessor",value:1},getFillPatternOffset:{type:"accessor",value:[0,0]}},Re=class extends ft.LayerExtension{constructor({pattern:t=!1}={}){super({pattern:t})}isEnabled(t){return t.getAttributeManager()!==null&&!("pathTesselator"in t.state)}getShaders(t){return t.isEnabled(this)?{modules:[t.opts.pattern&&At].filter(Boolean)}:null}initializeState(t,_){if(!_.isEnabled(this))return;let r=this.getAttributeManager();_.opts.pattern&&r.add({fillPatternFrames:{size:4,accessor:"getFillPattern",transform:_.getPatternFrame.bind(this),shaderAttributes:{fillPatternFrames:{divisor:0},instanceFillPatternFrames:{divisor:1}}},fillPatternScales:{size:1,accessor:"getFillPatternScale",defaultValue:1,shaderAttributes:{fillPatternScales:{divisor:0},instanceFillPatternScales:{divisor:1}}},fillPatternOffsets:{size:2,accessor:"getFillPatternOffset",shaderAttributes:{fillPatternOffsets:{divisor:0},instanceFillPatternOffsets:{divisor:1}}}}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState({props:t,oldProps:_},r){r.isEnabled(this)&&t.fillPatternMapping&&t.fillPatternMapping!==_.fillPatternMapping&&this.getAttributeManager().invalidate("getFillPattern")}draw(t,_){if(!_.isEnabled(this))return;let{fillPatternAtlas:r}=this.props;this.setModuleParameters({fillPatternTexture:r||this.state.emptyTexture})}finalizeState(){this.state.emptyTexture?.delete()}getPatternFrame(t){let{fillPatternMapping:_}=this.getCurrentLayer().props,r=_&&_[t];return r?[r.x,r.y,r.width,r.height]:[0,0,0,0]}},u=Re;(()=>{Re.defaultProps=J_})(),(()=>{Re.extensionName="FillStyleExtension"})();var ct=E(p(),1),$_={clipBounds:[0,0,1,1],clipByInstance:void 0},nt=`
1260
+ `};function J_(e,t){if(!e)return{};if("fillPatternTexture"in e){let{fillPatternTexture:_}=e;return{fill_patternTexture:_,fill_patternTextureSize:[_.width,_.height]}}if("viewport"in e){let{fillPatternMask:_=!0,fillPatternEnabled:r=!0}=e,{project_uCommonOrigin:i}=t,s=[(0,X.fp64LowPart)(i[0]),(0,X.fp64LowPart)(i[1])];return{fill_uvCoordinateOrigin:i.slice(0,2),fill_uvCoordinateOrigin64Low:s,fill_patternMask:_,fill_patternEnabled:r}}return{}}var At={name:"fill-pattern",vs:Z_,fs:q_,inject:Q_,dependencies:[X.project],getUniforms:J_};var $_={fillPatternEnabled:!0,fillPatternAtlas:{type:"image",value:null,async:!0,parameters:{minFilter:"linear"}},fillPatternMapping:{type:"object",value:{},async:!0},fillPatternMask:!0,getFillPattern:{type:"accessor",value:e=>e.pattern},getFillPatternScale:{type:"accessor",value:1},getFillPatternOffset:{type:"accessor",value:[0,0]}},Re=class extends ft.LayerExtension{constructor({pattern:t=!1}={}){super({pattern:t})}isEnabled(t){return t.getAttributeManager()!==null&&!("pathTesselator"in t.state)}getShaders(t){return t.isEnabled(this)?{modules:[t.opts.pattern&&At].filter(Boolean)}:null}initializeState(t,_){if(!_.isEnabled(this))return;let r=this.getAttributeManager();_.opts.pattern&&r.add({fillPatternFrames:{size:4,accessor:"getFillPattern",transform:_.getPatternFrame.bind(this),shaderAttributes:{fillPatternFrames:{divisor:0},instanceFillPatternFrames:{divisor:1}}},fillPatternScales:{size:1,accessor:"getFillPatternScale",defaultValue:1,shaderAttributes:{fillPatternScales:{divisor:0},instanceFillPatternScales:{divisor:1}}},fillPatternOffsets:{size:2,accessor:"getFillPatternOffset",shaderAttributes:{fillPatternOffsets:{divisor:0},instanceFillPatternOffsets:{divisor:1}}}}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState({props:t,oldProps:_},r){r.isEnabled(this)&&t.fillPatternMapping&&t.fillPatternMapping!==_.fillPatternMapping&&this.getAttributeManager().invalidate("getFillPattern")}draw(t,_){if(!_.isEnabled(this))return;let{fillPatternAtlas:r}=this.props;this.setModuleParameters({fillPatternTexture:r||this.state.emptyTexture})}finalizeState(){this.state.emptyTexture?.delete()}getPatternFrame(t){let{fillPatternMapping:_}=this.getCurrentLayer().props,r=_&&_[t];return r?[r.x,r.y,r.width,r.height]:[0,0,0,0]}},u=Re;(()=>{Re.defaultProps=$_})(),(()=>{Re.extensionName="FillStyleExtension"})();var ct=E(p(),1),m_={clipBounds:[0,0,1,1],clipByInstance:void 0},nt=`
1261
1261
  uniform vec4 clip_bounds;
1262
1262
 
1263
1263
  bool clip_isInBounds(vec2 position) {
1264
1264
  return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
1265
1265
  }
1266
- `,m_={name:"clip-vs",vs:nt},L_={"vs:#decl":`
1266
+ `,L_={name:"clip-vs",vs:nt},G_={"vs:#decl":`
1267
1267
  out float clip_isVisible;
1268
1268
  `,"vs:DECKGL_FILTER_GL_POSITION":`
1269
1269
  clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
@@ -1271,7 +1271,7 @@ out float clip_isVisible;
1271
1271
  in float clip_isVisible;
1272
1272
  `,"fs:DECKGL_FILTER_COLOR":`
1273
1273
  if (clip_isVisible < 0.5) discard;
1274
- `},G_={name:"clip-fs",fs:nt},er={"vs:#decl":`
1274
+ `},er={name:"clip-fs",fs:nt},tr={"vs:#decl":`
1275
1275
  out vec2 clip_commonPosition;
1276
1276
  `,"vs:DECKGL_FILTER_GL_POSITION":`
1277
1277
  clip_commonPosition = geometry.position.xy;
@@ -1279,7 +1279,7 @@ out vec2 clip_commonPosition;
1279
1279
  in vec2 clip_commonPosition;
1280
1280
  `,"fs:DECKGL_FILTER_COLOR":`
1281
1281
  if (!clip_isInBounds(clip_commonPosition)) discard;
1282
- `},le=class extends ct.LayerExtension{getShaders(){let t="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(t=Boolean(this.props.clipByInstance)),this.state.clipByInstance=t,t?{modules:[m_],inject:L_}:{modules:[G_],inject:er}}draw({uniforms:t}){let{clipBounds:_}=this.props;if(this.state.clipByInstance)t.clip_bounds=_;else{let r=this.projectPosition([_[0],_[1],0]),i=this.projectPosition([_[2],_[3],0]);t.clip_bounds=[Math.min(r[0],i[0]),Math.min(r[1],i[1]),Math.max(r[0],i[0]),Math.max(r[1],i[1])]}}},W=le;(()=>{le.defaultProps=$_})(),(()=>{le.extensionName="ClipExtension"})();var It=E(p(),1);var Et=E(p(),1),tr=`
1282
+ `},le=class extends ct.LayerExtension{getShaders(){let t="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(t=Boolean(this.props.clipByInstance)),this.state.clipByInstance=t,t?{modules:[L_],inject:G_}:{modules:[er],inject:tr}}draw({uniforms:t}){let{clipBounds:_}=this.props;if(this.state.clipByInstance)t.clip_bounds=_;else{let r=this.projectPosition([_[0],_[1],0]),i=this.projectPosition([_[2],_[3],0]);t.clip_bounds=[Math.min(r[0],i[0]),Math.min(r[1],i[1]),Math.max(r[0],i[0]),Math.max(r[1],i[1])]}}},W=le;(()=>{le.defaultProps=m_})(),(()=>{le.extensionName="ClipExtension"})();var It=E(p(),1);var Et=E(p(),1),_r=`
1283
1283
  #ifdef NON_INSTANCED_MODEL
1284
1284
  in float collisionPriorities;
1285
1285
  #else
@@ -1328,7 +1328,7 @@ float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
1328
1328
  float W = 2.0 * floatN + 1.0;
1329
1329
  return pow(accumulator / (W * W), 2.2);
1330
1330
  }
1331
- `,_r={"vs:#decl":`
1331
+ `,rr={"vs:#decl":`
1332
1332
  float collision_fade = 1.0;
1333
1333
  `,"vs:DECKGL_FILTER_GL_POSITION":`
1334
1334
  if (collision_sort) {
@@ -1351,13 +1351,13 @@ float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
1351
1351
  }
1352
1352
  `,"vs:DECKGL_FILTER_COLOR":`
1353
1353
  color.a *= collision_fade;
1354
- `},rr=(e,t)=>{if(!e||!("dummyCollisionMap"in e))return{};let{collisionFBO:_,drawToCollisionMap:r,dummyCollisionMap:i}=e;return{collision_sort:Boolean(r),collision_texture:!r&&_?_.colorAttachments[0]:i}},pt={name:"collision",dependencies:[Et.project],vs:tr,inject:_r,getUniforms:rr};var dt=E(p(),1);var St=E(p(),1),k=class extends St._LayersPass{renderCollisionMap(t,_){let i=[0,0,0,0];return this.device.withParametersWebGL({scissorTest:!0,scissor:[1,1,t.width-2*1,t.height-2*1],blend:!1,depthTest:!0,depthRange:[0,1]},()=>this.render({..._,clearColor:i,target:t,pass:"collision"}))}getModuleParameters(){return{drawToCollisionMap:!0,picking:{isActive:1,isAttribute:!1},lightSources:{}}}};var De=E(p(),1);var Nt=E(p(),1),w=class extends Nt._LayersPass{constructor(t,_){super(t,_);let{mapSize:r=2048}=_;this.maskMap=t.createTexture({format:"rgba8unorm",width:r,height:r,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.fbo=t.createFramebuffer({id:"maskmap",width:r,height:r,colorAttachments:[this.maskMap]})}render(t){let _=[!1,!1,!1,!1];_[t.channel]=!0;let r=[255,255,255,255];return this.device.withParametersWebGL({blend:!0,blendFunc:[n.ZERO,n.ONE],blendEquation:n.FUNC_SUBTRACT,colorMask:_,depthTest:!1},()=>super.render({...t,clearColor:r,target:this.fbo,pass:"mask"}))}shouldDrawLayer(t){return t.props.operation.includes("mask")}delete(){this.fbo.delete(),this.maskMap.delete()}};var Te=E(p(),1);function B(e,t){let _=[1/0,1/0,-1/0,-1/0];for(let r of e){let i=r.getBounds();if(i){let s=r.projectPosition(i[0],{viewport:t,autoOffset:!1}),o=r.projectPosition(i[1],{viewport:t,autoOffset:!1});_[0]=Math.min(_[0],s[0]),_[1]=Math.min(_[1],s[1]),_[2]=Math.max(_[2],o[0]),_[3]=Math.max(_[3],o[1])}}return Number.isFinite(_[0])?_:null}var ir=2048;function h(e){let{bounds:t,viewport:_,border:r=0}=e,{isGeospatial:i}=_;if(t[2]<=t[0]||t[3]<=t[1])return null;let s=_.unprojectPosition([(t[0]+t[2])/2,(t[1]+t[3])/2,0]),{width:o,height:a,zoom:R}=e;if(R===void 0){o=o-r*2,a=a-r*2;let l=Math.min(o/(t[2]-t[0]),a/(t[3]-t[1]));R=Math.min(Math.log2(l),20)}else if(!o||!a){let l=2**R;o=Math.round(Math.abs(t[2]-t[0])*l),a=Math.round(Math.abs(t[3]-t[1])*l);let T=ir-r*2;if(o>T||a>T){let A=T/Math.max(o,a);o=Math.round(o*A),a=Math.round(a*A),R+=Math.log2(A)}}return i?new Te.WebMercatorViewport({id:_.id,x:r,y:r,width:o,height:a,longitude:s[0],latitude:s[1],zoom:R,orthographic:!0}):new Te.OrthographicViewport({id:_.id,x:r,y:r,width:o,height:a,target:s,zoom:R,flipY:!1})}function sr(e,t){let _;if(t&&t.length===2){let[s,o]=t,a=e.getBounds({z:s}),R=e.getBounds({z:o});_=[Math.min(a[0],R[0]),Math.min(a[1],R[1]),Math.max(a[2],R[2]),Math.max(a[3],R[3])]}else _=e.getBounds();let r=e.projectPosition(_.slice(0,2)),i=e.projectPosition(_.slice(2,4));return[r[0],r[1],i[0],i[1]]}function D(e,t,_){if(!e)return[0,0,1,1];let r=sr(t,_),i=or(r);return e[2]-e[0]<=i[2]-i[0]&&e[3]-e[1]<=i[3]-i[1]?e:[Math.max(e[0],i[0]),Math.max(e[1],i[1]),Math.min(e[2],i[2]),Math.min(e[3],i[3])]}function or(e){let t=e[2]-e[0],_=e[3]-e[1],r=(e[0]+e[2])/2,i=(e[1]+e[3])/2;return[r-t,i-_,r+t,i+_]}var C=class{constructor(){this.id="mask-effect",this.props=null,this.useInPicking=!0,this.order=0,this.channels=[],this.masks=null}preRender(t,{layers:_,layerFilter:r,viewports:i,onViewportActive:s,views:o,isPicking:a}){let R=!1;if(this.dummyMaskMap||(this.dummyMaskMap=t.createTexture({width:1,height:1})),a)return{didRender:R};let l=_.filter(c=>c.props.visible&&c.props.operation.includes("mask"));if(l.length===0)return this.masks=null,this.channels.length=0,{didRender:R};this.masks={},this.maskPass||(this.maskPass=new w(t,{id:"default-mask"}),this.maskMap=this.maskPass.maskMap);let T=this._sortMaskChannels(l),A=i[0],f=!this.lastViewport||!this.lastViewport.equals(A);if(A.resolution!==void 0)return De.log.warn("MaskExtension is not supported in GlobeView")(),{didRender:R};for(let c in T){let S=this._renderChannel(T[c],{layerFilter:r,onViewportActive:s,views:o,viewport:A,viewportChanged:f});R||=S}return{didRender:R}}_renderChannel(t,{layerFilter:_,onViewportActive:r,views:i,viewport:s,viewportChanged:o}){let a=!1,R=this.channels[t.index];if(!R)return a;let l=t===R||t.layers.length!==R.layers.length||t.layers.some((T,A)=>T!==R.layers[A]||T.props.transitions)||t.layerBounds.some((T,A)=>T!==R.layerBounds[A]);if(t.bounds=R.bounds,t.maskBounds=R.maskBounds,this.channels[t.index]=t,l||o){this.lastViewport=s;let T=B(t.layers,s);if(t.bounds=T&&D(T,s),l||!P(t.bounds,R.bounds)){let{maskPass:A,maskMap:f}=this,c=T&&h({bounds:t.bounds,viewport:s,width:f.width,height:f.height,border:1});t.maskBounds=c?c.getBounds():[0,0,1,1],A.render({pass:"mask",channel:t.index,layers:t.layers,layerFilter:_,viewports:c?[c]:[],onViewportActive:r,views:i,moduleParameters:{devicePixelRatio:1}}),a=!0}}return this.masks[t.id]={index:t.index,bounds:t.maskBounds,coordinateOrigin:t.coordinateOrigin,coordinateSystem:t.coordinateSystem},a}_sortMaskChannels(t){let _={},r=0;for(let i of t){let{id:s}=i.root,o=_[s];if(!o){if(++r>4){De.log.warn("Too many mask layers. The max supported is 4")();continue}o={id:s,index:this.channels.findIndex(a=>a?.id===s),layers:[],layerBounds:[],coordinateOrigin:i.root.props.coordinateOrigin,coordinateSystem:i.root.props.coordinateSystem},_[s]=o}o.layers.push(i),o.layerBounds.push(i.getBounds())}for(let i=0;i<4;i++){let s=this.channels[i];(!s||!(s.id in _))&&(this.channels[i]=null)}for(let i in _){let s=_[i];s.index<0&&(s.index=this.channels.findIndex(o=>!o),this.channels[s.index]=s)}return _}getModuleParameters(){return{maskMap:this.masks?this.maskMap:this.dummyMaskMap,maskChannels:this.masks}}cleanup(){this.dummyMaskMap&&(this.dummyMaskMap.delete(),this.dummyMaskMap=void 0),this.maskPass&&(this.maskPass.delete(),this.maskPass=void 0,this.maskMap=void 0),this.lastViewport=void 0,this.masks=null,this.channels.length=0}};var ve=2,K=class{constructor(){this.id="collision-filter-effect",this.props=null,this.useInPicking=!0,this.order=1,this.channels={},this.collisionFBOs={}}preRender(t,{effects:_,layers:r,layerFilter:i,viewports:s,onViewportActive:o,views:a,isPicking:R,preRenderStats:l={}}){if(this.dummyCollisionMap||(this.dummyCollisionMap=t.createTexture({width:1,height:1})),R)return;let T=r.filter(({props:{visible:N,collisionEnabled:Ie}})=>N&&Ie);if(T.length===0){this.channels={};return}this.collisionFilterPass||(this.collisionFilterPass=new k(t,{id:"default-collision-filter"}));let A=_?.filter(N=>N.constructor===C),f=l["mask-effect"]?.didRender,c=this._groupByCollisionGroup(t,T),S=s[0],J=!this.lastViewport||!this.lastViewport.equals(S)||f;for(let N in c){let Ie=this.collisionFBOs[N],Ut=c[N],[gt,xt]=t.canvasContext.getPixelSize();Ie.resize({width:gt/ve,height:xt/ve}),this._render(Ut,{effects:A,layerFilter:i,onViewportActive:o,views:a,viewport:S,viewportChanged:J})}}_render(t,{effects:_,layerFilter:r,onViewportActive:i,views:s,viewport:o,viewportChanged:a}){let{collisionGroup:R}=t,l=this.channels[R];if(!l)return;let T=a||t===l||!(0,dt._deepEqual)(l.layers,t.layers,1)||t.layerBounds.some((A,f)=>!P(A,l.layerBounds[f]))||t.allLayersLoaded!==l.allLayersLoaded||t.layers.some(A=>A.props.transitions);if(this.channels[R]=t,T){this.lastViewport=o;let A=this.collisionFBOs[R];this.collisionFilterPass.renderCollisionMap(A,{pass:"collision-filter",isPicking:!0,layers:t.layers,effects:_,layerFilter:r,viewports:o?[o]:[],onViewportActive:i,views:s,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:A.device.canvasContext.getDevicePixelRatio()/ve}})}}_groupByCollisionGroup(t,_){let r={};for(let i of _){let{collisionGroup:s}=i.props,o=r[s];o||(o={collisionGroup:s,layers:[],layerBounds:[],allLayersLoaded:!0},r[s]=o),o.layers.push(i),o.layerBounds.push(i.getBounds()),i.isLoaded||(o.allLayersLoaded=!1)}for(let i of Object.keys(r))this.collisionFBOs[i]||this.createFBO(t,i),this.channels[i]||(this.channels[i]=r[i]);for(let i of Object.keys(this.collisionFBOs))r[i]||this.destroyFBO(i);return r}getModuleParameters(t){let{collisionGroup:_}=t.props,{collisionFBOs:r,dummyCollisionMap:i}=this;return{collisionFBO:r[_],dummyCollisionMap:i}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let t of Object.keys(this.collisionFBOs))this.destroyFBO(t);this.collisionFBOs={},this.lastViewport=void 0}createFBO(t,_){let{width:r,height:i}=t.gl.canvas,s=t.createTexture({format:"rgba8unorm",width:r,height:i,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),o=t.createTexture({format:"depth16unorm",width:r,height:i,mipmaps:!1,dataFormat:6402,type:5125});this.collisionFBOs[_]=t.createFramebuffer({id:`collision-${_}`,width:r,height:i,colorAttachments:[s],depthStencilAttachment:o})}destroyFBO(t){let _=this.collisionFBOs[t];_.colorAttachments[0]?.destroy(),_.depthStencilAttachment?.destroy(),_.destroy(),delete this.collisionFBOs[t]}};var ar={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},Ae=class extends It.LayerExtension{getShaders(){return{modules:[pt]}}draw({uniforms:t,context:_,moduleParameters:r}){let{collisionEnabled:i}=this.props,{collisionFBO:s,drawToCollisionMap:o}=r,a=i&&Boolean(s);t.collision_enabled=a,o&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(t,_){if(this.getAttributeManager()===null)return;this.context.deck?._addDefaultEffect(new K),this.getAttributeManager().add({collisionPriorities:{size:1,accessor:"getCollisionPriority",shaderAttributes:{collisionPriorities:{divisor:0},instanceCollisionPriorities:{divisor:1}}}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}},Y=Ae;(()=>{Ae.defaultProps=ar})(),(()=>{Ae.extensionName="CollisionFilterExtension"})();var O=E(p(),1);var Mt=E(p(),1),Rr=`
1354
+ `},ir=(e,t)=>{if(!e||!("dummyCollisionMap"in e))return{};let{collisionFBO:_,drawToCollisionMap:r,dummyCollisionMap:i}=e;return{collision_sort:Boolean(r),collision_texture:!r&&_?_.colorAttachments[0]:i}},pt={name:"collision",dependencies:[Et.project],vs:_r,inject:rr,getUniforms:ir};var dt=E(p(),1);var St=E(p(),1),k=class extends St._LayersPass{renderCollisionMap(t,_){let i=[0,0,0,0];return this.device.withParametersWebGL({scissorTest:!0,scissor:[1,1,t.width-2*1,t.height-2*1],blend:!1,depthTest:!0,depthRange:[0,1]},()=>this.render({..._,clearColor:i,target:t,pass:"collision"}))}getModuleParameters(){return{drawToCollisionMap:!0,picking:{isActive:1,isAttribute:!1},lightSources:{}}}};var De=E(p(),1);var Nt=E(p(),1),w=class extends Nt._LayersPass{constructor(t,_){super(t,_);let{mapSize:r=2048}=_;this.maskMap=t.createTexture({format:"rgba8unorm",width:r,height:r,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.fbo=t.createFramebuffer({id:"maskmap",width:r,height:r,colorAttachments:[this.maskMap]})}render(t){let _=[!1,!1,!1,!1];_[t.channel]=!0;let r=[255,255,255,255];return this.device.withParametersWebGL({blend:!0,blendFunc:[n.ZERO,n.ONE],blendEquation:n.FUNC_SUBTRACT,colorMask:_,depthTest:!1},()=>super.render({...t,clearColor:r,target:this.fbo,pass:"mask"}))}shouldDrawLayer(t){return t.props.operation.includes("mask")}delete(){this.fbo.delete(),this.maskMap.delete()}};var Te=E(p(),1);function B(e,t){let _=[1/0,1/0,-1/0,-1/0];for(let r of e){let i=r.getBounds();if(i){let s=r.projectPosition(i[0],{viewport:t,autoOffset:!1}),o=r.projectPosition(i[1],{viewport:t,autoOffset:!1});_[0]=Math.min(_[0],s[0]),_[1]=Math.min(_[1],s[1]),_[2]=Math.max(_[2],o[0]),_[3]=Math.max(_[3],o[1])}}return Number.isFinite(_[0])?_:null}var sr=2048;function h(e){let{bounds:t,viewport:_,border:r=0}=e,{isGeospatial:i}=_;if(t[2]<=t[0]||t[3]<=t[1])return null;let s=_.unprojectPosition([(t[0]+t[2])/2,(t[1]+t[3])/2,0]),{width:o,height:a,zoom:R}=e;if(R===void 0){o=o-r*2,a=a-r*2;let l=Math.min(o/(t[2]-t[0]),a/(t[3]-t[1]));R=Math.min(Math.log2(l),20)}else if(!o||!a){let l=2**R;o=Math.round(Math.abs(t[2]-t[0])*l),a=Math.round(Math.abs(t[3]-t[1])*l);let T=sr-r*2;if(o>T||a>T){let A=T/Math.max(o,a);o=Math.round(o*A),a=Math.round(a*A),R+=Math.log2(A)}}return i?new Te.WebMercatorViewport({id:_.id,x:r,y:r,width:o,height:a,longitude:s[0],latitude:s[1],zoom:R,orthographic:!0}):new Te.OrthographicViewport({id:_.id,x:r,y:r,width:o,height:a,target:s,zoom:R,flipY:!1})}function or(e,t){let _;if(t&&t.length===2){let[s,o]=t,a=e.getBounds({z:s}),R=e.getBounds({z:o});_=[Math.min(a[0],R[0]),Math.min(a[1],R[1]),Math.max(a[2],R[2]),Math.max(a[3],R[3])]}else _=e.getBounds();let r=e.projectPosition(_.slice(0,2)),i=e.projectPosition(_.slice(2,4));return[r[0],r[1],i[0],i[1]]}function D(e,t,_){if(!e)return[0,0,1,1];let r=or(t,_),i=ar(r);return e[2]-e[0]<=i[2]-i[0]&&e[3]-e[1]<=i[3]-i[1]?e:[Math.max(e[0],i[0]),Math.max(e[1],i[1]),Math.min(e[2],i[2]),Math.min(e[3],i[3])]}function ar(e){let t=e[2]-e[0],_=e[3]-e[1],r=(e[0]+e[2])/2,i=(e[1]+e[3])/2;return[r-t,i-_,r+t,i+_]}var C=class{constructor(){this.id="mask-effect",this.props=null,this.useInPicking=!0,this.order=0,this.channels=[],this.masks=null}preRender(t,{layers:_,layerFilter:r,viewports:i,onViewportActive:s,views:o,isPicking:a}){let R=!1;if(this.dummyMaskMap||(this.dummyMaskMap=t.createTexture({width:1,height:1})),a)return{didRender:R};let l=_.filter(c=>c.props.visible&&c.props.operation.includes("mask"));if(l.length===0)return this.masks=null,this.channels.length=0,{didRender:R};this.masks={},this.maskPass||(this.maskPass=new w(t,{id:"default-mask"}),this.maskMap=this.maskPass.maskMap);let T=this._sortMaskChannels(l),A=i[0],f=!this.lastViewport||!this.lastViewport.equals(A);if(A.resolution!==void 0)return De.log.warn("MaskExtension is not supported in GlobeView")(),{didRender:R};for(let c in T){let S=this._renderChannel(T[c],{layerFilter:r,onViewportActive:s,views:o,viewport:A,viewportChanged:f});R||=S}return{didRender:R}}_renderChannel(t,{layerFilter:_,onViewportActive:r,views:i,viewport:s,viewportChanged:o}){let a=!1,R=this.channels[t.index];if(!R)return a;let l=t===R||t.layers.length!==R.layers.length||t.layers.some((T,A)=>T!==R.layers[A]||T.props.transitions)||t.layerBounds.some((T,A)=>T!==R.layerBounds[A]);if(t.bounds=R.bounds,t.maskBounds=R.maskBounds,this.channels[t.index]=t,l||o){this.lastViewport=s;let T=B(t.layers,s);if(t.bounds=T&&D(T,s),l||!P(t.bounds,R.bounds)){let{maskPass:A,maskMap:f}=this,c=T&&h({bounds:t.bounds,viewport:s,width:f.width,height:f.height,border:1});t.maskBounds=c?c.getBounds():[0,0,1,1],A.render({pass:"mask",channel:t.index,layers:t.layers,layerFilter:_,viewports:c?[c]:[],onViewportActive:r,views:i,moduleParameters:{devicePixelRatio:1}}),a=!0}}return this.masks[t.id]={index:t.index,bounds:t.maskBounds,coordinateOrigin:t.coordinateOrigin,coordinateSystem:t.coordinateSystem},a}_sortMaskChannels(t){let _={},r=0;for(let i of t){let{id:s}=i.root,o=_[s];if(!o){if(++r>4){De.log.warn("Too many mask layers. The max supported is 4")();continue}o={id:s,index:this.channels.findIndex(a=>a?.id===s),layers:[],layerBounds:[],coordinateOrigin:i.root.props.coordinateOrigin,coordinateSystem:i.root.props.coordinateSystem},_[s]=o}o.layers.push(i),o.layerBounds.push(i.getBounds())}for(let i=0;i<4;i++){let s=this.channels[i];(!s||!(s.id in _))&&(this.channels[i]=null)}for(let i in _){let s=_[i];s.index<0&&(s.index=this.channels.findIndex(o=>!o),this.channels[s.index]=s)}return _}getModuleParameters(){return{maskMap:this.masks?this.maskMap:this.dummyMaskMap,maskChannels:this.masks}}cleanup(){this.dummyMaskMap&&(this.dummyMaskMap.delete(),this.dummyMaskMap=void 0),this.maskPass&&(this.maskPass.delete(),this.maskPass=void 0,this.maskMap=void 0),this.lastViewport=void 0,this.masks=null,this.channels.length=0}};var ve=2,K=class{constructor(){this.id="collision-filter-effect",this.props=null,this.useInPicking=!0,this.order=1,this.channels={},this.collisionFBOs={}}preRender(t,{effects:_,layers:r,layerFilter:i,viewports:s,onViewportActive:o,views:a,isPicking:R,preRenderStats:l={}}){if(this.dummyCollisionMap||(this.dummyCollisionMap=t.createTexture({width:1,height:1})),R)return;let T=r.filter(({props:{visible:N,collisionEnabled:Ie}})=>N&&Ie);if(T.length===0){this.channels={};return}this.collisionFilterPass||(this.collisionFilterPass=new k(t,{id:"default-collision-filter"}));let A=_?.filter(N=>N.constructor===C),f=l["mask-effect"]?.didRender,c=this._groupByCollisionGroup(t,T),S=s[0],J=!this.lastViewport||!this.lastViewport.equals(S)||f;for(let N in c){let Ie=this.collisionFBOs[N],Ut=c[N],[gt,xt]=t.canvasContext.getPixelSize();Ie.resize({width:gt/ve,height:xt/ve}),this._render(Ut,{effects:A,layerFilter:i,onViewportActive:o,views:a,viewport:S,viewportChanged:J})}}_render(t,{effects:_,layerFilter:r,onViewportActive:i,views:s,viewport:o,viewportChanged:a}){let{collisionGroup:R}=t,l=this.channels[R];if(!l)return;let T=a||t===l||!(0,dt._deepEqual)(l.layers,t.layers,1)||t.layerBounds.some((A,f)=>!P(A,l.layerBounds[f]))||t.allLayersLoaded!==l.allLayersLoaded||t.layers.some(A=>A.props.transitions);if(this.channels[R]=t,T){this.lastViewport=o;let A=this.collisionFBOs[R];this.collisionFilterPass.renderCollisionMap(A,{pass:"collision-filter",isPicking:!0,layers:t.layers,effects:_,layerFilter:r,viewports:o?[o]:[],onViewportActive:i,views:s,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:A.device.canvasContext.getDevicePixelRatio()/ve}})}}_groupByCollisionGroup(t,_){let r={};for(let i of _){let{collisionGroup:s}=i.props,o=r[s];o||(o={collisionGroup:s,layers:[],layerBounds:[],allLayersLoaded:!0},r[s]=o),o.layers.push(i),o.layerBounds.push(i.getBounds()),i.isLoaded||(o.allLayersLoaded=!1)}for(let i of Object.keys(r))this.collisionFBOs[i]||this.createFBO(t,i),this.channels[i]||(this.channels[i]=r[i]);for(let i of Object.keys(this.collisionFBOs))r[i]||this.destroyFBO(i);return r}getModuleParameters(t){let{collisionGroup:_}=t.props,{collisionFBOs:r,dummyCollisionMap:i}=this;return{collisionFBO:r[_],dummyCollisionMap:i}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let t of Object.keys(this.collisionFBOs))this.destroyFBO(t);this.collisionFBOs={},this.lastViewport=void 0}createFBO(t,_){let{width:r,height:i}=t.gl.canvas,s=t.createTexture({format:"rgba8unorm",width:r,height:i,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),o=t.createTexture({format:"depth16unorm",width:r,height:i,mipmaps:!1,dataFormat:6402,type:5125});this.collisionFBOs[_]=t.createFramebuffer({id:`collision-${_}`,width:r,height:i,colorAttachments:[s],depthStencilAttachment:o})}destroyFBO(t){let _=this.collisionFBOs[t];_.colorAttachments[0]?.destroy(),_.depthStencilAttachment?.destroy(),_.destroy(),delete this.collisionFBOs[t]}};var Rr={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},Ae=class extends It.LayerExtension{getShaders(){return{modules:[pt]}}draw({uniforms:t,context:_,moduleParameters:r}){let{collisionEnabled:i}=this.props,{collisionFBO:s,drawToCollisionMap:o}=r,a=i&&Boolean(s);t.collision_enabled=a,o&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(t,_){if(this.getAttributeManager()===null)return;this.context.deck?._addDefaultEffect(new K),this.getAttributeManager().add({collisionPriorities:{size:1,accessor:"getCollisionPriority",shaderAttributes:{collisionPriorities:{divisor:0},instanceCollisionPriorities:{divisor:1}}}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}},Y=Ae;(()=>{Ae.defaultProps=Rr})(),(()=>{Ae.extensionName="CollisionFilterExtension"})();var O=E(p(),1);var Mt=E(p(),1),lr=`
1355
1355
  uniform vec4 mask_bounds;
1356
1356
  uniform bool mask_maskByInstance;
1357
1357
  vec2 mask_getCoords(vec4 position) {
1358
1358
  return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
1359
1359
  }
1360
- `,lr=`
1360
+ `,Tr=`
1361
1361
  uniform sampler2D mask_texture;
1362
1362
  uniform int mask_channel;
1363
1363
  uniform bool mask_enabled;
@@ -1384,7 +1384,7 @@ bool mask_isInBounds(vec2 texCoords) {
1384
1384
  return maskValue < 0.5;
1385
1385
  }
1386
1386
  }
1387
- `,Tr={"vs:#decl":`
1387
+ `,Ar={"vs:#decl":`
1388
1388
  out vec2 mask_texCoords;
1389
1389
  `,"vs:#main-end":`
1390
1390
  vec4 mask_common_position;
@@ -1406,7 +1406,7 @@ in vec2 mask_texCoords;
1406
1406
 
1407
1407
  if (!mask) discard;
1408
1408
  }
1409
- `},Ar=e=>e&&"maskMap"in e?{mask_texture:e.maskMap}:{},Ot={name:"mask",dependencies:[Mt.project],vs:Rr,fs:lr,inject:Tr,getUniforms:Ar};var fr={maskId:"",maskByInstance:void 0,maskInverted:!1},fe=class extends O.LayerExtension{initializeState(){this.context.deck?._addDefaultEffect(new C)}getShaders(){let t="instancePositions"in this.getAttributeManager().attributes;return this.props.maskByInstance!==void 0&&(t=Boolean(this.props.maskByInstance)),this.state.maskByInstance=t,{modules:[Ot]}}draw({uniforms:t,context:_,moduleParameters:r}){t.mask_maskByInstance=this.state.maskByInstance;let{maskId:i,maskInverted:s}=this.props,{maskChannels:o}=r,{viewport:a}=_;if(o&&o[i]){let{index:R,bounds:l,coordinateOrigin:T}=o[i],{coordinateSystem:A}=o[i];t.mask_enabled=!0,t.mask_channel=R,t.mask_inverted=s,A===O.COORDINATE_SYSTEM.DEFAULT&&(A=a.isGeospatial?O.COORDINATE_SYSTEM.LNGLAT:O.COORDINATE_SYSTEM.CARTESIAN);let f={modelMatrix:null,fromCoordinateOrigin:T,fromCoordinateSystem:A},c=this.projectPosition([l[0],l[1],0],f),S=this.projectPosition([l[2],l[3],0],f);t.mask_bounds=[c[0],c[1],S[0],S[1]]}else i&&O.log.warn(`Could not find a mask layer with id: ${i}`)(),t.mask_enabled=!1}},j=fe;(()=>{fe.defaultProps=fr})(),(()=>{fe.extensionName="MaskExtension"})();var vt=E(p(),1);var Ne=E(p(),1);var Ft=E(p(),1),I={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},Ct=Object.keys(I).map(e=>`const float TERRAIN_MODE_${e} = ${I[e]}.0;`).join(`
1409
+ `},fr=e=>e&&"maskMap"in e?{mask_texture:e.maskMap}:{},Ot={name:"mask",dependencies:[Mt.project],vs:lr,fs:Tr,inject:Ar,getUniforms:fr};var cr={maskId:"",maskByInstance:void 0,maskInverted:!1},fe=class extends O.LayerExtension{initializeState(){this.context.deck?._addDefaultEffect(new C)}getShaders(){let t="instancePositions"in this.getAttributeManager().attributes;return this.props.maskByInstance!==void 0&&(t=Boolean(this.props.maskByInstance)),this.state.maskByInstance=t,{modules:[Ot]}}draw({uniforms:t,context:_,moduleParameters:r}){t.mask_maskByInstance=this.state.maskByInstance;let{maskId:i,maskInverted:s}=this.props,{maskChannels:o}=r,{viewport:a}=_;if(o&&o[i]){let{index:R,bounds:l,coordinateOrigin:T}=o[i],{coordinateSystem:A}=o[i];t.mask_enabled=!0,t.mask_channel=R,t.mask_inverted=s,A===O.COORDINATE_SYSTEM.DEFAULT&&(A=a.isGeospatial?O.COORDINATE_SYSTEM.LNGLAT:O.COORDINATE_SYSTEM.CARTESIAN);let f={modelMatrix:null,fromCoordinateOrigin:T,fromCoordinateSystem:A},c=this.projectPosition([l[0],l[1],0],f),S=this.projectPosition([l[2],l[3],0],f);t.mask_bounds=[c[0],c[1],S[0],S[1]]}else i&&O.log.warn(`Could not find a mask layer with id: ${i}`)(),t.mask_enabled=!1}},j=fe;(()=>{fe.defaultProps=cr})(),(()=>{fe.extensionName="MaskExtension"})();var vt=E(p(),1);var Ne=E(p(),1);var Ft=E(p(),1),I={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},Ct=Object.keys(I).map(e=>`const float TERRAIN_MODE_${e} = ${I[e]}.0;`).join(`
1410
1410
  `),ce={name:"terrain",dependencies:[Ft.project],inject:{"vs:#decl":`
1411
1411
  uniform float terrain_mode;
1412
1412
  uniform sampler2D terrain_map;
@@ -1459,6 +1459,6 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
1459
1459
  }
1460
1460
  return;
1461
1461
  }
1462
- `},getUniforms:(e={},t)=>{if("dummyHeightMap"in e){let{drawToTerrainHeightMap:_,heightMap:r,heightMapBounds:i,dummyHeightMap:s,terrainCover:o,useTerrainHeightMap:a,terrainSkipRender:R}=e,{project_uCommonOrigin:l}=t,T=R?I.SKIP:I.NONE,A=s,f=null;if(_)T=I.WRITE_HEIGHT_MAP,f=i;else if(a&&r)T=I.USE_HEIGHT_MAP,A=r,f=i;else if(o){let c=e.picking?.isActive;A=c?o.getPickingFramebuffer():o.getRenderFramebuffer(),c&&(T=I.SKIP),A?(T=T===I.SKIP?I.USE_COVER_ONLY:I.USE_COVER,f=o.bounds):A=s}return{terrain_mode:T,terrain_map:A,terrain_bounds:f?[f[0]-l[0],f[1]-l[1],f[2]-f[0],f[3]-f[1]]:[0,0,0,0]}}return null}};function z(e,t){return e.createFramebuffer({id:t.id,colorAttachments:[e.createTexture({...t.float&&{format:e.info.type==="webgl2"?"rgba32float":"rgba8unorm",type:n.FLOAT},mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}})]})}var ne=class{constructor(t){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=t,this.tile=Pt(t)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:t,viewport:_,layers:r,layerNeedsRedraw:i}){t&&(this.targetLayer=t);let s=_?this._updateViewport(_):!1,o=r?this._updateLayers(r):!1;if(i){for(let a of this.layers)if(i[a]){o=!0;break}}return o||s}_updateLayers(t){let _=!1;if(t=this.tile?cr(this.tile,t):t,t.length!==this.layers.length)_=!0;else for(let r=0;r<t.length;r++)if(t[r].id!==this.layers[r]){_=!0;break}return _&&(this.layers=t.map(r=>r.id)),_}_updateViewport(t){let _=this.targetLayer,r=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){r=!0,this.targetBounds=this.tile.boundingBox;let s=t.projectPosition(this.targetBounds[0]),o=t.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[s[0],s[1],o[0],o[1]]}}else this.targetBounds!==_.getBounds()&&(r=!0,this.targetBounds=_.getBounds(),this.targetBoundsCommon=B([_],t));if(!this.targetBoundsCommon)return!1;let i=Math.ceil(t.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let s=this.renderViewport?.zoom;r=r||i!==s;let o=D(this.targetBoundsCommon,t),a=this.bounds;r=r||!a||o.some((R,l)=>R!==a[l]),this.bounds=o}return r&&(this.renderViewport=h({bounds:this.bounds,zoom:i,viewport:t})),r}getRenderFramebuffer(){return!this.renderViewport||this.layers.length===0?null:(this.fbo||(this.fbo=z(this.targetLayer.context.device,{id:this.id})),this.fbo)}getPickingFramebuffer(){return!this.renderViewport||this.layers.length===0&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=z(this.targetLayer.context.device,{id:`${this.id}-picking`})),this.pickingFbo)}filterLayers(t){return t.filter(({id:_})=>this.layers.includes(_))}delete(){let{fbo:t,pickingFbo:_}=this;t&&(t.colorAttachments[0].destroy(),t.destroy()),_&&(_.colorAttachments[0].destroy(),_.destroy())}};function cr(e,t){return t.filter(_=>{let r=Pt(_);return r?nr(e.boundingBox,r.boundingBox):!0})}function Pt(e){for(;e;){let{tile:t}=e.props;if(t)return t;e=e.parent}return null}function nr(e,t){return e&&t?e[0][0]<t[1][0]&&t[0][0]<e[1][0]&&e[0][1]<t[1][1]&&t[0][1]<e[1][1]:!1}var Bt=E(p(),1),Ee=class extends Bt._LayersPass{getRenderableLayers(t,_){let{layers:r}=_,i=[],s=this._getDrawLayerParams(t,_,!0);for(let o=0;o<r.length;o++){let a=r[o];!a.isComposite&&s[o].shouldDrawLayer&&i.push(a)}return i}renderHeightMap(t,_){let r=t.getRenderFramebuffer(),i=t.renderViewport;!r||!i||(r.resize(i),this.device.withParametersWebGL({clearColor:[0,0,0,0],blend:!0,blendFunc:[n.ONE,n.ONE],blendEquation:n.MAX,depthTest:!1},()=>this.render({..._,target:r,pass:"terrain-height-map",layers:_.layers,viewports:[i],effects:[]})))}renderTerrainCover(t,_){let r=t.getRenderFramebuffer(),i=t.renderViewport;if(!r||!i)return;let s=t.filterLayers(_.layers);r.resize(i),this.device.withParametersWebGL({clearColor:[0,0,0,0],depthTest:!1},()=>this.render({..._,target:r,pass:`terrain-cover-${t.id}`,layers:s,effects:[],viewports:[i]}))}};var ht=E(p(),1),pe=class extends ht._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(t,_){let{layers:r}=_,i=[];this.drawParameters={},this._resetColorEncoder(_.pickZ);let s=this._getDrawLayerParams(t,_);for(let o=0;o<r.length;o++){let a=r[o];!a.isComposite&&s[o].shouldDrawLayer&&(i.push(a),this.drawParameters[a.id]=s[o].layerParameters)}return i}renderTerrainCover(t,_){let r=t.getPickingFramebuffer(),i=t.renderViewport;if(!r||!i)return;let s=t.filterLayers(_.layers),o=t.targetLayer;o.props.pickable&&s.unshift(o),r.resize(i),this.device.withParametersWebGL({depthTest:!1},()=>this.render({..._,pickingFBO:r,pass:`terrain-cover-picking-${t.id}`,layers:s,effects:[],viewports:[i],cullRect:void 0,deviceRect:i,pickZ:!1}))}getLayerParameters(t,_,r){if(this.drawParameters[t.id])return this.drawParameters[t.id];let i=super.getLayerParameters(t,_,r);return i.blend=!0,i}};var Dt=2048,Z=class{static isSupported(t){return t.isTextureFormatRenderable("rgba32float")}constructor(t){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=t}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=z(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:t,viewport:_}){let r=t.length!==this.layers.length||t.some((s,o)=>s!==this.layers[o]||s.props.transitions||s.getBounds()!==this.layersBounds[o]);r&&(this.layers=t,this.layersBounds=t.map(s=>s.getBounds()),this.layersBoundsCommon=B(t,_));let i=!this.lastViewport||!_.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(r||i){let s=D(this.layersBoundsCommon,_);if(s[2]<=s[0]||s[3]<=s[1])return this.renderViewport=null,!1;this.bounds=s,this.lastViewport=_;let o=_.scale,a=(s[2]-s[0])*o,R=(s[3]-s[1])*o;return this.renderViewport=a>0||R>0?h({bounds:[_.center[0]-1,_.center[1]-1,_.center[0]+1,_.center[1]+1],zoom:_.zoom,width:Math.min(a,Dt),height:Math.min(R,Dt),viewport:_}):null,!0}return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}};var Se=class{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}initialize(t){this.dummyHeightMap=t.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new Ee(t,{id:"terrain"}),this.terrainPickingPass=new pe(t,{id:"terrain-picking"}),Z.isSupported(t)?this.heightMap=new Z(t):Ne.log.warn("Terrain offset mode is not supported by this browser")(),(0,Ne.getShaderAssembler)().addDefaultModule(ce)}preRender(t,_){if(!this.dummyHeightMap){this.initialize(t);for(let l of _.layers)l.props.operation.includes("terrain")&&l.setChangeFlags({extensionsChanged:!0})}if(_.pickZ){this.isDrapingEnabled=!1;return}let{viewports:r}=_,i=_.pass.startsWith("picking");this.isPicking=i,this.isDrapingEnabled=!0;let s=r[0],o=(i?this.terrainPickingPass:this.terrainPass).getRenderableLayers(s,_),a=o.filter(l=>l.props.operation.includes("terrain"));if(a.length===0)return;i||o.filter(T=>T.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(a,s,_);let R=o.filter(l=>l.state.terrainDrawMode==="drape");this._updateTerrainCovers(a,R,s,_)}getModuleParameters(t){let{terrainDrawMode:_}=t.state;return{heightMap:this.heightMap?.getRenderFramebuffer(),heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:this.isDrapingEnabled?this.terrainCovers.get(t.id):null,useTerrainHeightMap:_==="offset",terrainSkipRender:_==="drape"||!t.props.operation.includes("draw")}}cleanup(){this.dummyHeightMap&&(this.dummyHeightMap.delete(),this.dummyHeightMap=void 0),this.heightMap&&(this.heightMap.delete(),this.heightMap=void 0);for(let t of this.terrainCovers.values())t.delete();this.terrainCovers.clear()}_updateHeightMap(t,_,r){!this.heightMap||!this.heightMap.shouldUpdate({layers:t,viewport:_})||this.terrainPass.renderHeightMap(this.heightMap,{...r,layers:t,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(t,_,r,i){let s={};for(let o of _)o.state.terrainCoverNeedsRedraw&&(s[o.id]=!0,o.state.terrainCoverNeedsRedraw=!1);for(let o of this.terrainCovers.values())o.isDirty=o.isDirty||o.shouldUpdate({layerNeedsRedraw:s});for(let o of t)this._updateTerrainCover(o,_,r,i);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(t,_,r,i){let s=this.isPicking?this.terrainPickingPass:this.terrainPass,o=this.terrainCovers.get(t.id);o||(o=new ne(t),this.terrainCovers.set(t.id,o));try{let a=o.shouldUpdate({targetLayer:t,viewport:r,layers:_});(this.isPicking||o.isDirty||a)&&(s.renderTerrainCover(o,{...i,layers:_,moduleParameters:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1,devicePixelRatio:1}}),this.isPicking||(o.isDirty=!1))}catch(a){t.raiseError(a,`Error rendering terrain cover ${o.id}`)}}_pruneTerrainCovers(){let t=[];for(let[_,r]of this.terrainCovers)r.isActive||t.push(_);for(let _ of t)this.terrainCovers.delete(_)}};var Er={terrainDrawMode:void 0},de=class extends vt.LayerExtension{getShaders(){return{modules:[ce]}}initializeState(){this.context.deck?._addDefaultEffect(new Se)}updateState(t){let{props:_,oldProps:r}=t;if(this.state.terrainDrawMode&&_.terrainDrawMode===r.terrainDrawMode&&_.extruded===r.extruded)return;let{terrainDrawMode:i}=_;if(!i){let s=this.props.extruded,o=this.getAttributeManager()?.attributes,a=o&&"instancePositions"in o;i=s||a?"offset":"drape"}this.setState({terrainDrawMode:i})}onNeedsRedraw(){let t=this.state;t.terrainDrawMode==="drape"&&(t.terrainCoverNeedsRedraw=!0)}},q=de;(()=>{de.defaultProps=Er})(),(()=>{de.extensionName="TerrainExtension"})();return ut(Q);})();
1462
+ `},getUniforms:(e={},t)=>{if("dummyHeightMap"in e){let{drawToTerrainHeightMap:_,heightMap:r,heightMapBounds:i,dummyHeightMap:s,terrainCover:o,useTerrainHeightMap:a,terrainSkipRender:R}=e,{project_uCommonOrigin:l}=t,T=R?I.SKIP:I.NONE,A=s,f=null;if(_)T=I.WRITE_HEIGHT_MAP,f=i;else if(a&&r)T=I.USE_HEIGHT_MAP,A=r,f=i;else if(o){let c=e.picking?.isActive;A=c?o.getPickingFramebuffer():o.getRenderFramebuffer(),c&&(T=I.SKIP),A?(T=T===I.SKIP?I.USE_COVER_ONLY:I.USE_COVER,f=o.bounds):A=s}return{terrain_mode:T,terrain_map:A,terrain_bounds:f?[f[0]-l[0],f[1]-l[1],f[2]-f[0],f[3]-f[1]]:[0,0,0,0]}}return null}};function z(e,t){return e.createFramebuffer({id:t.id,colorAttachments:[e.createTexture({...t.float&&{format:e.info.type==="webgl2"?"rgba32float":"rgba8unorm",type:n.FLOAT},mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}})]})}var ne=class{constructor(t){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=t,this.tile=Pt(t)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:t,viewport:_,layers:r,layerNeedsRedraw:i}){t&&(this.targetLayer=t);let s=_?this._updateViewport(_):!1,o=r?this._updateLayers(r):!1;if(i){for(let a of this.layers)if(i[a]){o=!0;break}}return o||s}_updateLayers(t){let _=!1;if(t=this.tile?nr(this.tile,t):t,t.length!==this.layers.length)_=!0;else for(let r=0;r<t.length;r++)if(t[r].id!==this.layers[r]){_=!0;break}return _&&(this.layers=t.map(r=>r.id)),_}_updateViewport(t){let _=this.targetLayer,r=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){r=!0,this.targetBounds=this.tile.boundingBox;let s=t.projectPosition(this.targetBounds[0]),o=t.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[s[0],s[1],o[0],o[1]]}}else this.targetBounds!==_.getBounds()&&(r=!0,this.targetBounds=_.getBounds(),this.targetBoundsCommon=B([_],t));if(!this.targetBoundsCommon)return!1;let i=Math.ceil(t.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let s=this.renderViewport?.zoom;r=r||i!==s;let o=D(this.targetBoundsCommon,t),a=this.bounds;r=r||!a||o.some((R,l)=>R!==a[l]),this.bounds=o}return r&&(this.renderViewport=h({bounds:this.bounds,zoom:i,viewport:t})),r}getRenderFramebuffer(){return!this.renderViewport||this.layers.length===0?null:(this.fbo||(this.fbo=z(this.targetLayer.context.device,{id:this.id})),this.fbo)}getPickingFramebuffer(){return!this.renderViewport||this.layers.length===0&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=z(this.targetLayer.context.device,{id:`${this.id}-picking`})),this.pickingFbo)}filterLayers(t){return t.filter(({id:_})=>this.layers.includes(_))}delete(){let{fbo:t,pickingFbo:_}=this;t&&(t.colorAttachments[0].destroy(),t.destroy()),_&&(_.colorAttachments[0].destroy(),_.destroy())}};function nr(e,t){return t.filter(_=>{let r=Pt(_);return r?Er(e.boundingBox,r.boundingBox):!0})}function Pt(e){for(;e;){let{tile:t}=e.props;if(t)return t;e=e.parent}return null}function Er(e,t){return e&&t?e[0][0]<t[1][0]&&t[0][0]<e[1][0]&&e[0][1]<t[1][1]&&t[0][1]<e[1][1]:!1}var Bt=E(p(),1),Ee=class extends Bt._LayersPass{getRenderableLayers(t,_){let{layers:r}=_,i=[],s=this._getDrawLayerParams(t,_,!0);for(let o=0;o<r.length;o++){let a=r[o];!a.isComposite&&s[o].shouldDrawLayer&&i.push(a)}return i}renderHeightMap(t,_){let r=t.getRenderFramebuffer(),i=t.renderViewport;!r||!i||(r.resize(i),this.device.withParametersWebGL({clearColor:[0,0,0,0],blend:!0,blendFunc:[n.ONE,n.ONE],blendEquation:n.MAX,depthTest:!1},()=>this.render({..._,target:r,pass:"terrain-height-map",layers:_.layers,viewports:[i],effects:[]})))}renderTerrainCover(t,_){let r=t.getRenderFramebuffer(),i=t.renderViewport;if(!r||!i)return;let s=t.filterLayers(_.layers);r.resize(i),this.device.withParametersWebGL({clearColor:[0,0,0,0],depthTest:!1},()=>this.render({..._,target:r,pass:`terrain-cover-${t.id}`,layers:s,effects:[],viewports:[i]}))}};var ht=E(p(),1),pe=class extends ht._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(t,_){let{layers:r}=_,i=[];this.drawParameters={},this._resetColorEncoder(_.pickZ);let s=this._getDrawLayerParams(t,_);for(let o=0;o<r.length;o++){let a=r[o];!a.isComposite&&s[o].shouldDrawLayer&&(i.push(a),this.drawParameters[a.id]=s[o].layerParameters)}return i}renderTerrainCover(t,_){let r=t.getPickingFramebuffer(),i=t.renderViewport;if(!r||!i)return;let s=t.filterLayers(_.layers),o=t.targetLayer;o.props.pickable&&s.unshift(o),r.resize(i),this.device.withParametersWebGL({depthTest:!1},()=>this.render({..._,pickingFBO:r,pass:`terrain-cover-picking-${t.id}`,layers:s,effects:[],viewports:[i],cullRect:void 0,deviceRect:i,pickZ:!1}))}getLayerParameters(t,_,r){if(this.drawParameters[t.id])return this.drawParameters[t.id];let i=super.getLayerParameters(t,_,r);return i.blend=!0,i}};var Dt=2048,Z=class{static isSupported(t){return t.isTextureFormatRenderable("rgba32float")}constructor(t){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=t}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=z(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:t,viewport:_}){let r=t.length!==this.layers.length||t.some((s,o)=>s!==this.layers[o]||s.props.transitions||s.getBounds()!==this.layersBounds[o]);r&&(this.layers=t,this.layersBounds=t.map(s=>s.getBounds()),this.layersBoundsCommon=B(t,_));let i=!this.lastViewport||!_.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(r||i){let s=D(this.layersBoundsCommon,_);if(s[2]<=s[0]||s[3]<=s[1])return this.renderViewport=null,!1;this.bounds=s,this.lastViewport=_;let o=_.scale,a=(s[2]-s[0])*o,R=(s[3]-s[1])*o;return this.renderViewport=a>0||R>0?h({bounds:[_.center[0]-1,_.center[1]-1,_.center[0]+1,_.center[1]+1],zoom:_.zoom,width:Math.min(a,Dt),height:Math.min(R,Dt),viewport:_}):null,!0}return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}};var Se=class{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}initialize(t){this.dummyHeightMap=t.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new Ee(t,{id:"terrain"}),this.terrainPickingPass=new pe(t,{id:"terrain-picking"}),Z.isSupported(t)?this.heightMap=new Z(t):Ne.log.warn("Terrain offset mode is not supported by this browser")(),(0,Ne.getShaderAssembler)().addDefaultModule(ce)}preRender(t,_){if(!this.dummyHeightMap){this.initialize(t);for(let l of _.layers)l.props.operation.includes("terrain")&&l.setChangeFlags({extensionsChanged:!0})}if(_.pickZ){this.isDrapingEnabled=!1;return}let{viewports:r}=_,i=_.pass.startsWith("picking");this.isPicking=i,this.isDrapingEnabled=!0;let s=r[0],o=(i?this.terrainPickingPass:this.terrainPass).getRenderableLayers(s,_),a=o.filter(l=>l.props.operation.includes("terrain"));if(a.length===0)return;i||o.filter(T=>T.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(a,s,_);let R=o.filter(l=>l.state.terrainDrawMode==="drape");this._updateTerrainCovers(a,R,s,_)}getModuleParameters(t){let{terrainDrawMode:_}=t.state;return{heightMap:this.heightMap?.getRenderFramebuffer(),heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:this.isDrapingEnabled?this.terrainCovers.get(t.id):null,useTerrainHeightMap:_==="offset",terrainSkipRender:_==="drape"||!t.props.operation.includes("draw")}}cleanup(){this.dummyHeightMap&&(this.dummyHeightMap.delete(),this.dummyHeightMap=void 0),this.heightMap&&(this.heightMap.delete(),this.heightMap=void 0);for(let t of this.terrainCovers.values())t.delete();this.terrainCovers.clear()}_updateHeightMap(t,_,r){!this.heightMap||!this.heightMap.shouldUpdate({layers:t,viewport:_})||this.terrainPass.renderHeightMap(this.heightMap,{...r,layers:t,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(t,_,r,i){let s={};for(let o of _)o.state.terrainCoverNeedsRedraw&&(s[o.id]=!0,o.state.terrainCoverNeedsRedraw=!1);for(let o of this.terrainCovers.values())o.isDirty=o.isDirty||o.shouldUpdate({layerNeedsRedraw:s});for(let o of t)this._updateTerrainCover(o,_,r,i);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(t,_,r,i){let s=this.isPicking?this.terrainPickingPass:this.terrainPass,o=this.terrainCovers.get(t.id);o||(o=new ne(t),this.terrainCovers.set(t.id,o));try{let a=o.shouldUpdate({targetLayer:t,viewport:r,layers:_});(this.isPicking||o.isDirty||a)&&(s.renderTerrainCover(o,{...i,layers:_,moduleParameters:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1,devicePixelRatio:1}}),this.isPicking||(o.isDirty=!1))}catch(a){t.raiseError(a,`Error rendering terrain cover ${o.id}`)}}_pruneTerrainCovers(){let t=[];for(let[_,r]of this.terrainCovers)r.isActive||t.push(_);for(let _ of t)this.terrainCovers.delete(_)}};var pr={terrainDrawMode:void 0},de=class extends vt.LayerExtension{getShaders(){return{modules:[ce]}}initializeState(){this.context.deck?._addDefaultEffect(new Se)}updateState(t){let{props:_,oldProps:r}=t;if(this.state.terrainDrawMode&&_.terrainDrawMode===r.terrainDrawMode&&_.extruded===r.extruded)return;let{terrainDrawMode:i}=_;if(!i){let s=this.props.extruded,o=this.getAttributeManager()?.attributes,a=o&&"instancePositions"in o;i=s||a?"offset":"drape"}this.setState({terrainDrawMode:i})}onNeedsRedraw(){let t=this.state;t.terrainDrawMode==="drape"&&(t.terrainCoverNeedsRedraw=!0)}},q=de;(()=>{de.defaultProps=pr})(),(()=>{de.extensionName="TerrainExtension"})();return ut(Q);})();
1463
1463
  return __exports__;
1464
1464
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Plug-and-play functionalities for deck.gl layers",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "9.0.0-beta.4",
6
+ "version": "9.0.0-beta.5",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -51,5 +51,5 @@
51
51
  "@math.gl/core": "^4.0.0",
52
52
  "@math.gl/web-mercator": "^4.0.0"
53
53
  },
54
- "gitHead": "7063cbec75a5fbcefc51f33f6e2488134533d34a"
54
+ "gitHead": "02588aba7cbf25d48cec20b30a686bba9be32bff"
55
55
  }
@@ -118,6 +118,13 @@ type DataFilterExtensionOptions = {
118
118
  countItems?: boolean;
119
119
  };
120
120
 
121
+ const defaultOptions: Required<DataFilterExtensionOptions> = {
122
+ categorySize: 1,
123
+ filterSize: 1,
124
+ fp64: false,
125
+ countItems: false
126
+ };
127
+
121
128
  const DATA_TYPE_FROM_SIZE = {
122
129
  1: 'float',
123
130
  2: 'vec2',
@@ -126,19 +133,25 @@ const DATA_TYPE_FROM_SIZE = {
126
133
  };
127
134
 
128
135
  /** Adds GPU-based data filtering functionalities to layers. It allows the layer to show/hide objects based on user-defined properties. */
129
- export default class DataFilterExtension extends LayerExtension<DataFilterExtensionOptions> {
136
+ export default class DataFilterExtension extends LayerExtension<
137
+ Required<DataFilterExtensionOptions>
138
+ > {
130
139
  static defaultProps = defaultProps;
131
140
  static extensionName = 'DataFilterExtension';
132
141
 
142
+ constructor(opts: DataFilterExtensionOptions) {
143
+ super({...defaultOptions, ...opts});
144
+ }
145
+
133
146
  getShaders(this: Layer<DataFilterExtensionProps>, extension: this): any {
134
147
  const {categorySize, filterSize, fp64} = extension.opts;
135
148
 
136
149
  return {
137
150
  modules: [fp64 ? shaderModule64 : shaderModule],
138
151
  defines: {
139
- DATACATEGORY_TYPE: DATA_TYPE_FROM_SIZE[categorySize || 1],
152
+ DATACATEGORY_TYPE: DATA_TYPE_FROM_SIZE[categorySize],
140
153
  DATACATEGORY_CHANNELS: categorySize,
141
- DATAFILTER_TYPE: DATA_TYPE_FROM_SIZE[filterSize || 1],
154
+ DATAFILTER_TYPE: DATA_TYPE_FROM_SIZE[filterSize],
142
155
  DATAFILTER_DOUBLE: Boolean(fp64)
143
156
  }
144
157
  };