@deck.gl/extensions 9.0.6 → 9.0.8

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 Rt=Object.create;var Q=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var Fe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Le=(r,e)=>{for(var t in e)Q(r,t,{get:e[t],enumerable:!0})},X=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of St(e))!Nt.call(r,s)&&s!==t&&Q(r,s,{get:()=>e[s],enumerable:!(i=Ct(e,s))||i.enumerable});return r},P=(r,e,t)=>(X(r,e,"default"),t&&X(t,e,"default")),d=(r,e,t)=>(t=r!=null?Rt(kt(r)):{},X(e||!r||!r.__esModule?Q(t,"default",{value:r,enumerable:!0}):t,r)),Bt=r=>X(Q({},"__esModule",{value:!0}),r);var m=Fe((xi,Oe)=>{Oe.exports=globalThis.deck});var ze=Fe((Ei,je)=>{je.exports=globalThis.luma});var Z={};Le(Z,{BrushingExtension:()=>F,ClipExtension:()=>D,CollisionFilterExtension:()=>z,DataFilterExtension:()=>L,FillStyleExtension:()=>w,Fp64Extension:()=>S,MaskExtension:()=>q,PathStyleExtension:()=>N,_TerrainExtension:()=>K,project64:()=>oe});var v={},Ie=d(m(),1);P(v,d(m(),1));if(!Ie.Layer)throw new Error("@deck.gl/core is not found");P(Z,v);var Se=d(m(),1);var Re=d(m(),1);var wt=`
7
+ "use strict";var __exports__=(()=>{var Rt=Object.create;var Q=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var Fe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Le=(r,e)=>{for(var t in e)Q(r,t,{get:e[t],enumerable:!0})},X=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of St(e))!Nt.call(r,o)&&o!==t&&Q(r,o,{get:()=>e[o],enumerable:!(i=Ct(e,o))||i.enumerable});return r},P=(r,e,t)=>(X(r,e,"default"),t&&X(t,e,"default")),d=(r,e,t)=>(t=r!=null?Rt(kt(r)):{},X(e||!r||!r.__esModule?Q(t,"default",{value:r,enumerable:!0}):t,r)),Bt=r=>X(Q({},"__esModule",{value:!0}),r);var m=Fe((xi,Oe)=>{Oe.exports=globalThis.deck});var ze=Fe((Ei,je)=>{je.exports=globalThis.luma});var Z={};Le(Z,{BrushingExtension:()=>F,ClipExtension:()=>D,CollisionFilterExtension:()=>z,DataFilterExtension:()=>L,FillStyleExtension:()=>w,Fp64Extension:()=>S,MaskExtension:()=>q,PathStyleExtension:()=>N,_TerrainExtension:()=>K,project64:()=>se});var v={},Ie=d(m(),1);P(v,d(m(),1));if(!Ie.Layer)throw new Error("@deck.gl/core is not found");P(Z,v);var Se=d(m(),1);var Re=d(m(),1);var wt=`
8
8
  uniform bool brushing_enabled;
9
9
  uniform int brushing_target;
10
10
  uniform vec2 brushing_mousePos;
@@ -61,23 +61,22 @@ brushing_setVisible(visible);
61
61
  if (brushing_enabled && brushing_isVisible < 0.5) {
62
62
  discard;
63
63
  }
64
- `},Ce={name:"brushing",dependencies:[Re.project],vs:wt,fs:Dt,inject:jt,getUniforms:r=>{if(!r||!("viewport"in r))return{};let{brushingEnabled:e=!0,brushingRadius:t=1e4,brushingTarget:i="source",mousePosition:s,viewport:o}=r;return{brushing_enabled:Boolean(e&&s&&o.containsPixel(s)),brushing_radius:t,brushing_target:Vt[i]||0,brushing_mousePos:s?o.unproject([s.x-o.x,s.y-o.y]):[0,0]}}};var zt={getBrushingTarget:{type:"accessor",value:[0,0]},brushingTarget:"source",brushingEnabled:!0,brushingRadius:1e4},J=class extends Se.LayerExtension{getShaders(){return{modules:[Ce]}}initializeState(e,t){let i=this.getAttributeManager();i&&i.add({brushingTargets:{size:2,accessor:"getBrushingTarget",shaderAttributes:{brushingTargets:{divisor:0},instanceBrushingTargets:{divisor:1}}}});let s=()=>{this.getCurrentLayer()?.setNeedsRedraw()};this.state.onMouseMove=s,e.deck&&e.deck.eventManager.on({pointermove:s,pointerleave:s})}finalizeState(e,t){if(e.deck){let i=this.state.onMouseMove;e.deck.eventManager.off({pointermove:i,pointerleave:i})}}},F=J;(()=>{J.defaultProps=zt})(),(()=>{J.extensionName="BrushingExtension"})();var T=d(m(),1);var ke=`
65
- uniform DATAFILTER_TYPE filter_min;
66
- uniform DATAFILTER_TYPE filter_softMin;
67
- uniform DATAFILTER_TYPE filter_softMax;
68
- uniform DATAFILTER_TYPE filter_max;
64
+ `},Ce={name:"brushing",dependencies:[Re.project],vs:wt,fs:Dt,inject:jt,getUniforms:r=>{if(!r||!("viewport"in r))return{};let{brushingEnabled:e=!0,brushingRadius:t=1e4,brushingTarget:i="source",mousePosition:o,viewport:s}=r;return{brushing_enabled:Boolean(e&&o&&s.containsPixel(o)),brushing_radius:t,brushing_target:Vt[i]||0,brushing_mousePos:o?s.unproject([o.x-s.x,o.y-s.y]):[0,0]}}};var zt={getBrushingTarget:{type:"accessor",value:[0,0]},brushingTarget:"source",brushingEnabled:!0,brushingRadius:1e4},J=class extends Se.LayerExtension{getShaders(){return{modules:[Ce]}}initializeState(e,t){let i=this.getAttributeManager();i&&i.add({brushingTargets:{size:2,accessor:"getBrushingTarget",shaderAttributes:{brushingTargets:{divisor:0},instanceBrushingTargets:{divisor:1}}}});let o=()=>{this.getCurrentLayer()?.setNeedsRedraw()};this.state.onMouseMove=o,e.deck&&e.deck.eventManager.on({pointermove:o,pointerleave:o})}finalizeState(e,t){if(e.deck){let i=this.state.onMouseMove;e.deck.eventManager.off({pointermove:i,pointerleave:i})}}},F=J;(()=>{J.defaultProps=zt})(),(()=>{J.extensionName="BrushingExtension"})();var y=d(m(),1);var ke=`
69
65
  uniform bool filter_useSoftMargin;
70
66
  uniform bool filter_enabled;
71
67
  uniform bool filter_transformSize;
72
68
  uniform ivec4 filter_categoryBitMask;
69
+ #ifdef DATAFILTER_TYPE
70
+ uniform DATAFILTER_TYPE filter_min;
71
+ uniform DATAFILTER_TYPE filter_softMin;
72
+ uniform DATAFILTER_TYPE filter_softMax;
73
+ uniform DATAFILTER_TYPE filter_max;
73
74
  #ifdef NON_INSTANCED_MODEL
74
75
  #define DATAFILTER_ATTRIB filterValues
75
76
  #define DATAFILTER_ATTRIB_64LOW filterValues64Low
76
- #define DATACATEGORY_ATTRIB filterCategoryValues
77
77
  #else
78
78
  #define DATAFILTER_ATTRIB instanceFilterValues
79
79
  #define DATAFILTER_ATTRIB_64LOW instanceFilterValues64Low
80
- #define DATACATEGORY_ATTRIB instanceFilterCategoryValues
81
80
  #endif
82
81
  in DATAFILTER_TYPE DATAFILTER_ATTRIB;
83
82
  #ifdef DATAFILTER_DOUBLE
@@ -85,7 +84,15 @@ in DATAFILTER_TYPE DATAFILTER_ATTRIB_64LOW;
85
84
  uniform DATAFILTER_TYPE filter_min64High;
86
85
  uniform DATAFILTER_TYPE filter_max64High;
87
86
  #endif
87
+ #endif
88
+ #ifdef DATACATEGORY_TYPE
89
+ #ifdef NON_INSTANCED_MODEL
90
+ #define DATACATEGORY_ATTRIB filterCategoryValues
91
+ #else
92
+ #define DATACATEGORY_ATTRIB instanceFilterCategoryValues
93
+ #endif
88
94
  in DATACATEGORY_TYPE DATACATEGORY_ATTRIB;
95
+ #endif
89
96
  out float dataFilter_value;
90
97
  float dataFilter_reduceValue(float value) {
91
98
  return value;
@@ -99,8 +106,8 @@ return min(min(value.x, value.y), value.z);
99
106
  float dataFilter_reduceValue(vec4 value) {
100
107
  return min(min(value.x, value.y), min(value.z, value.w));
101
108
  }
102
- void dataFilter_setValue(DATAFILTER_TYPE valueFromMin, DATAFILTER_TYPE valueFromMax, DATACATEGORY_TYPE category) {
103
- if (filter_enabled) {
109
+ #ifdef DATAFILTER_ATTRIB
110
+ void dataFilter_setValue(DATAFILTER_TYPE valueFromMin, DATAFILTER_TYPE valueFromMax) {
104
111
  if (filter_useSoftMargin) {
105
112
  dataFilter_value = dataFilter_reduceValue(
106
113
  smoothstep(filter_min, filter_softMin, valueFromMin) *
@@ -111,6 +118,10 @@ dataFilter_value = dataFilter_reduceValue(
111
118
  step(filter_min, valueFromMin) * step(valueFromMax, filter_max)
112
119
  );
113
120
  }
121
+ }
122
+ #endif
123
+ #ifdef DATACATEGORY_ATTRIB
124
+ void dataFilter_setCategoryValue(DATACATEGORY_TYPE category) {
114
125
  #if DATACATEGORY_CHANNELS == 1
115
126
  int dataFilter_masks = filter_categoryBitMask[int(category / 32.0)];
116
127
  #elif DATACATEGORY_CHANNELS == 2
@@ -130,23 +141,28 @@ if(dataFilter_bits == 0.0) dataFilter_value = 0.0;
130
141
  #else
131
142
  if(any(equal(dataFilter_bits, DATACATEGORY_TYPE(0.0)))) dataFilter_value = 0.0;
132
143
  #endif
133
- } else {
134
- dataFilter_value = 1.0;
135
- }
136
144
  }
145
+ #endif
137
146
  `,Ne=`
138
147
  uniform bool filter_transformColor;
139
148
  in float dataFilter_value;
140
- `;function Be(r){if(!r||!("extensions"in r))return{};let{filterRange:e=[-1,1],filterEnabled:t=!0,filterTransformSize:i=!0,filterTransformColor:s=!0}=r,o=r.filterSoftRange||e;return{...Number.isFinite(e[0])?{filter_min:e[0],filter_softMin:o[0],filter_softMax:o[1],filter_max:e[1]}:{filter_min:e.map(n=>n[0]),filter_softMin:o.map(n=>n[0]),filter_softMax:o.map(n=>n[1]),filter_max:e.map(n=>n[1])},filter_enabled:t,filter_useSoftMargin:Boolean(r.filterSoftRange),filter_transformSize:t&&i,filter_transformColor:t&&s}}function Gt(r){if(!r||!("extensions"in r))return{};let e=Be(r);if(Number.isFinite(e.filter_min)){let t=Math.fround(e.filter_min);e.filter_min-=t,e.filter_softMin-=t,e.filter_min64High=t;let i=Math.fround(e.filter_max);e.filter_max-=i,e.filter_softMax-=i,e.filter_max64High=i}else{let t=e.filter_min.map(Math.fround);e.filter_min=e.filter_min.map((s,o)=>s-t[o]),e.filter_softMin=e.filter_softMin.map((s,o)=>s-t[o]),e.filter_min64High=t;let i=e.filter_max.map(Math.fround);e.filter_max=e.filter_max.map((s,o)=>s-i[o]),e.filter_softMax=e.filter_softMax.map((s,o)=>s-i[o]),e.filter_max64High=i}return e}var we={"vs:#main-start":`
149
+ `;function Be(r){if(!r||!("extensions"in r))return{};let{filterRange:e=[-1,1],filterEnabled:t=!0,filterTransformSize:i=!0,filterTransformColor:o=!0}=r,s=r.filterSoftRange||e;return{...Number.isFinite(e[0])?{filter_min:e[0],filter_softMin:s[0],filter_softMax:s[1],filter_max:e[1]}:{filter_min:e.map(n=>n[0]),filter_softMin:s.map(n=>n[0]),filter_softMax:s.map(n=>n[1]),filter_max:e.map(n=>n[1])},filter_enabled:t,filter_useSoftMargin:Boolean(r.filterSoftRange),filter_transformSize:t&&i,filter_transformColor:t&&o}}function Gt(r){if(!r||!("extensions"in r))return{};let e=Be(r);if(Number.isFinite(e.filter_min)){let t=Math.fround(e.filter_min);e.filter_min-=t,e.filter_softMin-=t,e.filter_min64High=t;let i=Math.fround(e.filter_max);e.filter_max-=i,e.filter_softMax-=i,e.filter_max64High=i}else{let t=e.filter_min.map(Math.fround);e.filter_min=e.filter_min.map((o,s)=>o-t[s]),e.filter_softMin=e.filter_softMin.map((o,s)=>o-t[s]),e.filter_min64High=t;let i=e.filter_max.map(Math.fround);e.filter_max=e.filter_max.map((o,s)=>o-i[s]),e.filter_softMax=e.filter_softMax.map((o,s)=>o-i[s]),e.filter_max64High=i}return e}var we={"vs:#main-start":`
150
+ dataFilter_value = 1.0;
151
+ if (filter_enabled) {
152
+ #ifdef DATAFILTER_ATTRIB
141
153
  #ifdef DATAFILTER_DOUBLE
142
154
  dataFilter_setValue(
143
155
  DATAFILTER_ATTRIB - filter_min64High + DATAFILTER_ATTRIB_64LOW,
144
- DATAFILTER_ATTRIB - filter_max64High + DATAFILTER_ATTRIB_64LOW,
145
- DATACATEGORY_ATTRIB
156
+ DATAFILTER_ATTRIB - filter_max64High + DATAFILTER_ATTRIB_64LOW
146
157
  );
147
158
  #else
148
- dataFilter_setValue(DATAFILTER_ATTRIB, DATAFILTER_ATTRIB, DATACATEGORY_ATTRIB);
159
+ dataFilter_setValue(DATAFILTER_ATTRIB, DATAFILTER_ATTRIB);
149
160
  #endif
161
+ #endif
162
+ #ifdef DATACATEGORY_ATTRIB
163
+ dataFilter_setCategoryValue(DATACATEGORY_ATTRIB);
164
+ #endif
165
+ }
150
166
  `,"vs:#main-end":`
151
167
  if (dataFilter_value == 0.0) {
152
168
  gl_Position = vec4(0.);
@@ -205,7 +221,7 @@ void main() {
205
221
  }
206
222
  fragColor = vColor;
207
223
  }
208
- `,Wt=["float32-renderable-webgl","texture-blend-float-webgl"];function Ue(r){return Wt.every(e=>r.features.has(e))}function qe(r,e){return e?r.createFramebuffer({width:1,height:1,colorAttachments:[r.createTexture({format:"rgba32float",type:5126,mipmaps:!1})]}):r.createFramebuffer({width:256,height:64,colorAttachments:[r.createTexture({format:"rgba8unorm",type:5126,mipmaps:!1})]})}function We(r,e,t){return e.defines.NON_INSTANCED_MODEL=1,t&&(e.defines.FLOAT_TARGET=1),new Ge.Model(r,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,drawMode:0,vs:Ut,fs:qt,...e})}var He={blend:!0,blendFunc:[1,1,1,1],blendEquation:[32774,32774],depthTest:!1};var Yt={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},Kt={categorySize:1,filterSize:1,fp64:!1,countItems:!1},Ye={1:"float",2:"vec2",3:"vec3",4:"vec4"},ee=class extends T.LayerExtension{constructor(e={}){super({...Kt,...e})}getShaders(e){let{categorySize:t,filterSize:i,fp64:s}=e.opts;return{modules:[s?Ve:De],defines:{DATACATEGORY_TYPE:Ye[t],DATACATEGORY_CHANNELS:t,DATAFILTER_TYPE:Ye[i],DATAFILTER_DOUBLE:Boolean(s)}}}initializeState(e,t){let i=this.getAttributeManager(),{categorySize:s,filterSize:o,fp64:n}=t.opts;i&&i.add({filterValues:{size:o,type:n?"float64":"float32",accessor:"getFilterValue",shaderAttributes:{filterValues:{divisor:0},instanceFilterValues:{divisor:1}}},filterCategoryValues:{size:s,accessor:"getFilterCategory",transform:s===1?l=>t._getCategoryKey.call(this,l,0):l=>l.map((f,c)=>t._getCategoryKey.call(this,f,c)),shaderAttributes:{filterCategoryValues:{divisor:0},instanceFilterCategoryValues:{divisor:1}}}});let{device:a}=this.context;if(i&&t.opts.countItems){let l=Ue(a);i.add({filterIndices:{size:l?1:2,vertexOffset:1,type:"unorm8",accessor:(u,{index:_})=>{let p=u&&u.__source?u.__source.index:_;return l?(p+1)%255:[(p+1)%255,Math.floor(p/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let f=qe(a,l),c=We(a,t.getShaders.call(this,t),l);this.setState({filterFBO:f,filterModel:c})}}updateState({props:e,oldProps:t,changeFlags:i},s){let o=this.getAttributeManager(),{categorySize:n}=s.opts;if(this.state.filterModel){let a=o.attributes.filterValues.needsUpdate()||o.attributes.filterCategoryValues?.needsUpdate()||e.filterEnabled!==t.filterEnabled||e.filterRange!==t.filterRange||e.filterSoftRange!==t.filterSoftRange||e.filterCategories!==t.filterCategories;a&&this.setState({filterNeedsUpdate:a})}if(o?.attributes.filterCategoryValues){let a=o.attributes.filterCategoryValues.needsUpdate()||!(0,T._deepEqual)(e.filterCategories,t.filterCategories,2);a&&this.setState({categoryBitMaskNeedsUpdate:a}),i.dataChanged&&(this.setState({categoryMap:Array(n).fill(0).map(()=>({}))}),o.attributes.filterCategoryValues.setNeedsUpdate("categoryMap"))}}draw(e,t){let i=this.state.filterFBO,s=this.state.filterModel,o=this.state.filterNeedsUpdate,n=this.state.categoryBitMaskNeedsUpdate,{onFilteredItemsChange:a}=this.props;if(n&&t._updateCategoryBitMask.call(this,e,t),o&&a&&s){let{attributes:{filterValues:l,filterCategoryValues:f,filterIndices:c}}=this.getAttributeManager();s.setVertexCount(this.getNumInstances()),this.context.device.clearWebGL({framebuffer:i,color:[0,0,0,0]}),s.updateModuleSettings(e.moduleParameters),s.setAttributes({...l.getValue(),...f?.getValue(),...c?.getValue()}),s.setUniforms(e.uniforms),s.device.withParametersWebGL({framebuffer:i,...He,viewport:[0,0,i.width,i.height]},()=>{s.draw(this.context.renderPass)});let u=s.device.readPixelsToArrayWebGL(i),_=0;for(let p=0;p<u.length;p++)_+=u[p];a({id:this.id,count:_}),this.state.filterNeedsUpdate=!1}}finalizeState(){let e=this.state.filterFBO,t=this.state.filterModel;e?.destroy(),t?.destroy()}_updateCategoryBitMask(e,t){let{categorySize:i}=t.opts,{filterCategories:s}=this.props,o=new Uint32Array([0,0,0,0]),n=i===1?[s]:s,a=i===1?128:i===2?64:32;for(let l=0;l<n.length;l++){let f=n[l];for(let c of f){let u=t._getCategoryKey.call(this,c,l);if(u<a){let _=l*(a/32)+Math.floor(u/32);o[_]+=Math.pow(2,u%32)}else T.log.warn(`Exceeded maximum number of categories (${a})`)()}}e.uniforms.filter_categoryBitMask=o,this.state.categoryBitMaskNeedsUpdate=!1}_getCategoryKey(e,t){let i=this.state.categoryMap[t];return e in i||(i[e]=Object.keys(i).length),i[e]}},L=ee;(()=>{ee.defaultProps=Yt})(),(()=>{ee.extensionName="DataFilterExtension"})();var C=d(m(),1);function te(r,e=[],t=0){let i=Math.fround(r),s=r-i;return e[t]=i,e[t+1]=s,e}function ge(r){return r-Math.fround(r)}function xe(r){let e=new Float32Array(32);for(let t=0;t<4;++t)for(let i=0;i<4;++i){let s=t*4+i;te(r[i*4+t],e,s*2)}return e}var Ke=`uniform float ONE;
224
+ `,Wt=["float32-renderable-webgl","texture-blend-float-webgl"];function Ue(r){return Wt.every(e=>r.features.has(e))}function qe(r,e){return e?r.createFramebuffer({width:1,height:1,colorAttachments:[r.createTexture({format:"rgba32float",type:5126,mipmaps:!1})]}):r.createFramebuffer({width:256,height:64,colorAttachments:[r.createTexture({format:"rgba8unorm",type:5126,mipmaps:!1})]})}function We(r,e,t){return e.defines.NON_INSTANCED_MODEL=1,t&&(e.defines.FLOAT_TARGET=1),new Ge.Model(r,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,drawMode:0,vs:Ut,fs:qt,...e})}var He={blend:!0,blendFunc:[1,1,1,1],blendEquation:[32774,32774],depthTest:!1};var Yt={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},Kt={categorySize:0,filterSize:1,fp64:!1,countItems:!1},Ye={1:"float",2:"vec2",3:"vec3",4:"vec4"},ee=class extends y.LayerExtension{constructor(e={}){super({...Kt,...e})}getShaders(e){let{categorySize:t,filterSize:i,fp64:o}=e.opts,s={};return t&&(s.DATACATEGORY_TYPE=Ye[t],s.DATACATEGORY_CHANNELS=t),i&&(s.DATAFILTER_TYPE=Ye[i],s.DATAFILTER_DOUBLE=Boolean(o)),{modules:[o?Ve:De],defines:s}}initializeState(e,t){let i=this.getAttributeManager(),{categorySize:o,filterSize:s,fp64:n}=t.opts;i&&(s&&i.add({filterValues:{size:s,type:n?"float64":"float32",accessor:"getFilterValue",shaderAttributes:{filterValues:{divisor:0},instanceFilterValues:{divisor:1}}}}),o&&i.add({filterCategoryValues:{size:o,accessor:"getFilterCategory",transform:o===1?l=>t._getCategoryKey.call(this,l,0):l=>l.map((f,c)=>t._getCategoryKey.call(this,f,c)),shaderAttributes:{filterCategoryValues:{divisor:0},instanceFilterCategoryValues:{divisor:1}}}}));let{device:a}=this.context;if(i&&t.opts.countItems){let l=Ue(a);i.add({filterIndices:{size:l?1:2,vertexOffset:1,type:"unorm8",accessor:(u,{index:_})=>{let p=u&&u.__source?u.__source.index:_;return l?(p+1)%255:[(p+1)%255,Math.floor(p/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let f=qe(a,l),c=We(a,t.getShaders.call(this,t),l);this.setState({filterFBO:f,filterModel:c})}}updateState({props:e,oldProps:t,changeFlags:i},o){let s=this.getAttributeManager(),{categorySize:n}=o.opts;if(this.state.filterModel){let a=s.attributes.filterValues?.needsUpdate()||s.attributes.filterCategoryValues?.needsUpdate()||e.filterEnabled!==t.filterEnabled||e.filterRange!==t.filterRange||e.filterSoftRange!==t.filterSoftRange||e.filterCategories!==t.filterCategories;a&&this.setState({filterNeedsUpdate:a})}if(s?.attributes.filterCategoryValues){let a=s.attributes.filterCategoryValues.needsUpdate()||!(0,y._deepEqual)(e.filterCategories,t.filterCategories,2);a&&this.setState({categoryBitMaskNeedsUpdate:a}),i.dataChanged&&(this.setState({categoryMap:Array(n).fill(0).map(()=>({}))}),s.attributes.filterCategoryValues.setNeedsUpdate("categoryMap"))}}draw(e,t){let i=this.state.filterFBO,o=this.state.filterModel,s=this.state.filterNeedsUpdate,n=this.state.categoryBitMaskNeedsUpdate,{onFilteredItemsChange:a}=this.props;if(n&&t._updateCategoryBitMask.call(this,e,t),s&&a&&o){let{attributes:{filterValues:l,filterCategoryValues:f,filterIndices:c}}=this.getAttributeManager();o.setVertexCount(this.getNumInstances()),this.context.device.clearWebGL({framebuffer:i,color:[0,0,0,0]}),o.updateModuleSettings(e.moduleParameters),o.setAttributes({...l?.getValue(),...f?.getValue(),...c?.getValue()}),o.setUniforms(e.uniforms),o.device.withParametersWebGL({framebuffer:i,...He,viewport:[0,0,i.width,i.height]},()=>{o.draw(this.context.renderPass)});let u=o.device.readPixelsToArrayWebGL(i),_=0;for(let p=0;p<u.length;p++)_+=u[p];a({id:this.id,count:_}),this.state.filterNeedsUpdate=!1}}finalizeState(){let e=this.state.filterFBO,t=this.state.filterModel;e?.destroy(),t?.destroy()}_updateCategoryBitMask(e,t){let{categorySize:i}=t.opts,{filterCategories:o}=this.props,s=new Uint32Array([0,0,0,0]),n=i===1?[o]:o,a=i===1?128:i===2?64:32;for(let l=0;l<n.length;l++){let f=n[l];for(let c of f){let u=t._getCategoryKey.call(this,c,l);if(u<a){let _=l*(a/32)+Math.floor(u/32);s[_]+=Math.pow(2,u%32)}else y.log.warn(`Exceeded maximum number of categories (${a})`)()}}e.uniforms.filter_categoryBitMask=s,this.state.categoryBitMaskNeedsUpdate=!1}_getCategoryKey(e,t){let i=this.state.categoryMap[t];return e in i||(i[e]=Object.keys(i).length),i[e]}},L=ee;(()=>{ee.defaultProps=Yt})(),(()=>{ee.extensionName="DataFilterExtension"})();var C=d(m(),1);function te(r,e=[],t=0){let i=Math.fround(r),o=r-i;return e[t]=i,e[t+1]=o,e}function ge(r){return r-Math.fround(r)}function xe(r){let e=new Float32Array(32);for(let t=0;t<4;++t)for(let i=0;i<4;++i){let o=t*4+i;te(r[i*4+t],e,o*2)}return e}var Ke=`uniform float ONE;
209
225
  vec2 split(float a) {
210
226
  const float SPLIT = 4097.0;
211
227
  float t = a * SPLIT;
@@ -850,7 +866,7 @@ tmp[j] = b[j + i * 4];
850
866
  vec4_dot_fp64(a, tmp, out_val[i]);
851
867
  }
852
868
  }
853
- `;var Zt={ONE:1};function $t(){return Zt}var $e={name:"fp64-arithmetic",vs:Ke,getUniforms:$t,fp64ify:te,fp64LowPart:ge,fp64ifyMatrix4:xe},re={name:"fp64",vs:Ze,dependencies:[$e],fp64ify:te,fp64LowPart:ge,fp64ifyMatrix4:xe};var Ni=1/Math.PI*180,Bi=1/180*Math.PI,Xt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Xt}};var O=globalThis.mathgl.config;function Pe(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function b(r,e,t){let i=O.EPSILON;t&&(O.EPSILON=t);try{if(r===e)return!0;if(Pe(r)&&Pe(e)){if(r.length!==e.length)return!1;for(let s=0;s<r.length;++s)if(!b(r[s],e[s]))return!1;return!0}return r&&r.equals?r.equals(e):e&&e.equals?e.equals(r):typeof r=="number"&&typeof e=="number"?Math.abs(r-e)<=O.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{O.EPSILON=i}}var I=typeof Float32Array<"u"?Float32Array:Array,ye=Math.random;function ie(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}var Di=Math.PI/180;var R={};Le(R,{add:()=>ir,angle:()=>Mr,bezier:()=>gr,ceil:()=>sr,clone:()=>Jt,copy:()=>tr,create:()=>Xe,cross:()=>dr,dist:()=>kr,distance:()=>rt,div:()=>Sr,divide:()=>tt,dot:()=>be,equals:()=>Ir,exactEquals:()=>Or,floor:()=>or,forEach:()=>Dr,fromValues:()=>er,hermite:()=>vr,inverse:()=>_r,len:()=>Br,length:()=>Qe,lerp:()=>mr,max:()=>ar,min:()=>nr,mul:()=>Cr,multiply:()=>et,negate:()=>ur,normalize:()=>pr,random:()=>xr,rotateX:()=>br,rotateY:()=>Ar,rotateZ:()=>Er,round:()=>lr,scale:()=>fr,scaleAndAdd:()=>cr,set:()=>rr,slerp:()=>hr,sqrDist:()=>Nr,sqrLen:()=>wr,squaredDistance:()=>it,squaredLength:()=>st,str:()=>Lr,sub:()=>Rr,subtract:()=>Je,transformMat3:()=>yr,transformMat4:()=>Pr,transformQuat:()=>Tr,zero:()=>Fr});function Xe(){let r=new I(3);return I!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Jt(r){let e=new I(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Qe(r){let e=r[0],t=r[1],i=r[2];return Math.sqrt(e*e+t*t+i*i)}function er(r,e,t){let i=new I(3);return i[0]=r,i[1]=e,i[2]=t,i}function tr(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function rr(r,e,t,i){return r[0]=e,r[1]=t,r[2]=i,r}function ir(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function Je(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function et(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function tt(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function sr(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function or(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function nr(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function ar(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function lr(r,e){return r[0]=ie(e[0]),r[1]=ie(e[1]),r[2]=ie(e[2]),r}function fr(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function cr(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r}function rt(r,e){let t=e[0]-r[0],i=e[1]-r[1],s=e[2]-r[2];return Math.sqrt(t*t+i*i+s*s)}function it(r,e){let t=e[0]-r[0],i=e[1]-r[1],s=e[2]-r[2];return t*t+i*i+s*s}function st(r){let e=r[0],t=r[1],i=r[2];return e*e+t*t+i*i}function ur(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function _r(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function pr(r,e){let t=e[0],i=e[1],s=e[2],o=t*t+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r}function be(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function dr(r,e,t){let i=e[0],s=e[1],o=e[2],n=t[0],a=t[1],l=t[2];return r[0]=s*l-o*a,r[1]=o*n-i*l,r[2]=i*a-s*n,r}function mr(r,e,t,i){let s=e[0],o=e[1],n=e[2];return r[0]=s+i*(t[0]-s),r[1]=o+i*(t[1]-o),r[2]=n+i*(t[2]-n),r}function hr(r,e,t,i){let s=Math.acos(Math.min(Math.max(be(e,t),-1),1)),o=Math.sin(s),n=Math.sin((1-i)*s)/o,a=Math.sin(i*s)/o;return r[0]=n*e[0]+a*t[0],r[1]=n*e[1]+a*t[1],r[2]=n*e[2]+a*t[2],r}function vr(r,e,t,i,s,o){let n=o*o,a=n*(2*o-3)+1,l=n*(o-2)+o,f=n*(o-1),c=n*(3-2*o);return r[0]=e[0]*a+t[0]*l+i[0]*f+s[0]*c,r[1]=e[1]*a+t[1]*l+i[1]*f+s[1]*c,r[2]=e[2]*a+t[2]*l+i[2]*f+s[2]*c,r}function gr(r,e,t,i,s,o){let n=1-o,a=n*n,l=o*o,f=a*n,c=3*o*a,u=3*l*n,_=l*o;return r[0]=e[0]*f+t[0]*c+i[0]*u+s[0]*_,r[1]=e[1]*f+t[1]*c+i[1]*u+s[1]*_,r[2]=e[2]*f+t[2]*c+i[2]*u+s[2]*_,r}function xr(r,e){e=e===void 0?1:e;let t=ye()*2*Math.PI,i=ye()*2-1,s=Math.sqrt(1-i*i)*e;return r[0]=Math.cos(t)*s,r[1]=Math.sin(t)*s,r[2]=i*e,r}function Pr(r,e,t){let i=e[0],s=e[1],o=e[2],n=t[3]*i+t[7]*s+t[11]*o+t[15];return n=n||1,r[0]=(t[0]*i+t[4]*s+t[8]*o+t[12])/n,r[1]=(t[1]*i+t[5]*s+t[9]*o+t[13])/n,r[2]=(t[2]*i+t[6]*s+t[10]*o+t[14])/n,r}function yr(r,e,t){let i=e[0],s=e[1],o=e[2];return r[0]=i*t[0]+s*t[3]+o*t[6],r[1]=i*t[1]+s*t[4]+o*t[7],r[2]=i*t[2]+s*t[5]+o*t[8],r}function Tr(r,e,t){let i=t[0],s=t[1],o=t[2],n=t[3],a=e[0],l=e[1],f=e[2],c=s*f-o*l,u=o*a-i*f,_=i*l-s*a,p=s*_-o*u,x=o*c-i*_,$=i*u-s*c,h=n*2;return c*=h,u*=h,_*=h,p*=2,x*=2,$*=2,r[0]=a+c+p,r[1]=l+u+x,r[2]=f+_+$,r}function br(r,e,t,i){let s=[],o=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],o[0]=s[0],o[1]=s[1]*Math.cos(i)-s[2]*Math.sin(i),o[2]=s[1]*Math.sin(i)+s[2]*Math.cos(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function Ar(r,e,t,i){let s=[],o=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],o[0]=s[2]*Math.sin(i)+s[0]*Math.cos(i),o[1]=s[1],o[2]=s[2]*Math.cos(i)-s[0]*Math.sin(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function Er(r,e,t,i){let s=[],o=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],o[0]=s[0]*Math.cos(i)-s[1]*Math.sin(i),o[1]=s[0]*Math.sin(i)+s[1]*Math.cos(i),o[2]=s[2],r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function Mr(r,e){let t=r[0],i=r[1],s=r[2],o=e[0],n=e[1],a=e[2],l=Math.sqrt((t*t+i*i+s*s)*(o*o+n*n+a*a)),f=l&&be(r,e)/l;return Math.acos(Math.min(Math.max(f,-1),1))}function Fr(r){return r[0]=0,r[1]=0,r[2]=0,r}function Lr(r){return`vec3(${r[0]}, ${r[1]}, ${r[2]})`}function Or(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function Ir(r,e){let t=r[0],i=r[1],s=r[2],o=e[0],n=e[1],a=e[2];return Math.abs(t-o)<=1e-6*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(i-n)<=1e-6*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var Rr=Je,Cr=et,Sr=tt,kr=rt,Nr=it,Br=Qe,wr=st,Dr=function(){let r=Xe();return function(e,t,i,s,o,n){let a,l;for(t||(t=3),i||(i=0),s?l=Math.min(s*t+i,e.length):l=e.length,a=i;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],r[2]=e[a+2],o(r,r,n),e[a]=r[0],e[a+1]=r[1],e[a+2]=r[2];return e}}();var se=d(m(),1);var ot=`const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
869
+ `;var Zt={ONE:1};function $t(){return Zt}var $e={name:"fp64-arithmetic",vs:Ke,getUniforms:$t,fp64ify:te,fp64LowPart:ge,fp64ifyMatrix4:xe},re={name:"fp64",vs:Ze,dependencies:[$e],fp64ify:te,fp64LowPart:ge,fp64ifyMatrix4:xe};var Ni=1/Math.PI*180,Bi=1/180*Math.PI,Xt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Xt}};var O=globalThis.mathgl.config;function Pe(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function A(r,e,t){let i=O.EPSILON;t&&(O.EPSILON=t);try{if(r===e)return!0;if(Pe(r)&&Pe(e)){if(r.length!==e.length)return!1;for(let o=0;o<r.length;++o)if(!A(r[o],e[o]))return!1;return!0}return r&&r.equals?r.equals(e):e&&e.equals?e.equals(r):typeof r=="number"&&typeof e=="number"?Math.abs(r-e)<=O.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{O.EPSILON=i}}var I=typeof Float32Array<"u"?Float32Array:Array,Te=Math.random;function ie(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}var Di=Math.PI/180;var R={};Le(R,{add:()=>ir,angle:()=>Mr,bezier:()=>gr,ceil:()=>or,clone:()=>Jt,copy:()=>tr,create:()=>Xe,cross:()=>dr,dist:()=>kr,distance:()=>rt,div:()=>Sr,divide:()=>tt,dot:()=>Ae,equals:()=>Ir,exactEquals:()=>Or,floor:()=>sr,forEach:()=>Dr,fromValues:()=>er,hermite:()=>vr,inverse:()=>_r,len:()=>Br,length:()=>Qe,lerp:()=>mr,max:()=>ar,min:()=>nr,mul:()=>Cr,multiply:()=>et,negate:()=>ur,normalize:()=>pr,random:()=>xr,rotateX:()=>Ar,rotateY:()=>br,rotateZ:()=>Er,round:()=>lr,scale:()=>fr,scaleAndAdd:()=>cr,set:()=>rr,slerp:()=>hr,sqrDist:()=>Nr,sqrLen:()=>wr,squaredDistance:()=>it,squaredLength:()=>ot,str:()=>Lr,sub:()=>Rr,subtract:()=>Je,transformMat3:()=>Tr,transformMat4:()=>Pr,transformQuat:()=>yr,zero:()=>Fr});function Xe(){let r=new I(3);return I!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Jt(r){let e=new I(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Qe(r){let e=r[0],t=r[1],i=r[2];return Math.sqrt(e*e+t*t+i*i)}function er(r,e,t){let i=new I(3);return i[0]=r,i[1]=e,i[2]=t,i}function tr(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function rr(r,e,t,i){return r[0]=e,r[1]=t,r[2]=i,r}function ir(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function Je(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function et(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function tt(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function or(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function sr(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function nr(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function ar(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function lr(r,e){return r[0]=ie(e[0]),r[1]=ie(e[1]),r[2]=ie(e[2]),r}function fr(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function cr(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r}function rt(r,e){let t=e[0]-r[0],i=e[1]-r[1],o=e[2]-r[2];return Math.sqrt(t*t+i*i+o*o)}function it(r,e){let t=e[0]-r[0],i=e[1]-r[1],o=e[2]-r[2];return t*t+i*i+o*o}function ot(r){let e=r[0],t=r[1],i=r[2];return e*e+t*t+i*i}function ur(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function _r(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function pr(r,e){let t=e[0],i=e[1],o=e[2],s=t*t+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r}function Ae(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function dr(r,e,t){let i=e[0],o=e[1],s=e[2],n=t[0],a=t[1],l=t[2];return r[0]=o*l-s*a,r[1]=s*n-i*l,r[2]=i*a-o*n,r}function mr(r,e,t,i){let o=e[0],s=e[1],n=e[2];return r[0]=o+i*(t[0]-o),r[1]=s+i*(t[1]-s),r[2]=n+i*(t[2]-n),r}function hr(r,e,t,i){let o=Math.acos(Math.min(Math.max(Ae(e,t),-1),1)),s=Math.sin(o),n=Math.sin((1-i)*o)/s,a=Math.sin(i*o)/s;return r[0]=n*e[0]+a*t[0],r[1]=n*e[1]+a*t[1],r[2]=n*e[2]+a*t[2],r}function vr(r,e,t,i,o,s){let n=s*s,a=n*(2*s-3)+1,l=n*(s-2)+s,f=n*(s-1),c=n*(3-2*s);return r[0]=e[0]*a+t[0]*l+i[0]*f+o[0]*c,r[1]=e[1]*a+t[1]*l+i[1]*f+o[1]*c,r[2]=e[2]*a+t[2]*l+i[2]*f+o[2]*c,r}function gr(r,e,t,i,o,s){let n=1-s,a=n*n,l=s*s,f=a*n,c=3*s*a,u=3*l*n,_=l*s;return r[0]=e[0]*f+t[0]*c+i[0]*u+o[0]*_,r[1]=e[1]*f+t[1]*c+i[1]*u+o[1]*_,r[2]=e[2]*f+t[2]*c+i[2]*u+o[2]*_,r}function xr(r,e){e=e===void 0?1:e;let t=Te()*2*Math.PI,i=Te()*2-1,o=Math.sqrt(1-i*i)*e;return r[0]=Math.cos(t)*o,r[1]=Math.sin(t)*o,r[2]=i*e,r}function Pr(r,e,t){let i=e[0],o=e[1],s=e[2],n=t[3]*i+t[7]*o+t[11]*s+t[15];return n=n||1,r[0]=(t[0]*i+t[4]*o+t[8]*s+t[12])/n,r[1]=(t[1]*i+t[5]*o+t[9]*s+t[13])/n,r[2]=(t[2]*i+t[6]*o+t[10]*s+t[14])/n,r}function Tr(r,e,t){let i=e[0],o=e[1],s=e[2];return r[0]=i*t[0]+o*t[3]+s*t[6],r[1]=i*t[1]+o*t[4]+s*t[7],r[2]=i*t[2]+o*t[5]+s*t[8],r}function yr(r,e,t){let i=t[0],o=t[1],s=t[2],n=t[3],a=e[0],l=e[1],f=e[2],c=o*f-s*l,u=s*a-i*f,_=i*l-o*a,p=o*_-s*u,x=s*c-i*_,$=i*u-o*c,h=n*2;return c*=h,u*=h,_*=h,p*=2,x*=2,$*=2,r[0]=a+c+p,r[1]=l+u+x,r[2]=f+_+$,r}function Ar(r,e,t,i){let o=[],s=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],s[0]=o[0],s[1]=o[1]*Math.cos(i)-o[2]*Math.sin(i),s[2]=o[1]*Math.sin(i)+o[2]*Math.cos(i),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function br(r,e,t,i){let o=[],s=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],s[0]=o[2]*Math.sin(i)+o[0]*Math.cos(i),s[1]=o[1],s[2]=o[2]*Math.cos(i)-o[0]*Math.sin(i),r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Er(r,e,t,i){let o=[],s=[];return o[0]=e[0]-t[0],o[1]=e[1]-t[1],o[2]=e[2]-t[2],s[0]=o[0]*Math.cos(i)-o[1]*Math.sin(i),s[1]=o[0]*Math.sin(i)+o[1]*Math.cos(i),s[2]=o[2],r[0]=s[0]+t[0],r[1]=s[1]+t[1],r[2]=s[2]+t[2],r}function Mr(r,e){let t=r[0],i=r[1],o=r[2],s=e[0],n=e[1],a=e[2],l=Math.sqrt((t*t+i*i+o*o)*(s*s+n*n+a*a)),f=l&&Ae(r,e)/l;return Math.acos(Math.min(Math.max(f,-1),1))}function Fr(r){return r[0]=0,r[1]=0,r[2]=0,r}function Lr(r){return`vec3(${r[0]}, ${r[1]}, ${r[2]})`}function Or(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function Ir(r,e){let t=r[0],i=r[1],o=r[2],s=e[0],n=e[1],a=e[2];return Math.abs(t-s)<=1e-6*Math.max(1,Math.abs(t),Math.abs(s))&&Math.abs(i-n)<=1e-6*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(o-a)<=1e-6*Math.max(1,Math.abs(o),Math.abs(a))}var Rr=Je,Cr=et,Sr=tt,kr=rt,Nr=it,Br=Qe,wr=ot,Dr=function(){let r=Xe();return function(e,t,i,o,s,n){let a,l;for(t||(t=3),i||(i=0),o?l=Math.min(o*t+i,e.length):l=e.length,a=i;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],r[2]=e[a+2],s(r,r,n),e[a]=r[0],e[a+1]=r[1],e[a+2]=r[2];return e}}();var oe=d(m(),1);var st=`const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
854
870
  uniform vec2 project_uViewProjectionMatrixFP64[16];
855
871
  void mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {
856
872
  #if defined(NVIDIA_FP64_WORKAROUND)
@@ -910,7 +926,7 @@ return project_position_to_clipspace(
910
926
  position, position64xyLow, offset, commonPosition
911
927
  );
912
928
  }
913
- `;var{fp64ify:Vr,fp64ifyMatrix4:jr}=re,oe={name:"project64",dependencies:[se.project,re],vs:ot,getUniforms:Gr},zr=(0,se._memoize)(Ur);function Gr(r){if(r&&"viewport"in r){let{viewProjectionMatrix:e,scale:t}=r.viewport;return zr({viewProjectionMatrix:e,scale:t})}return{}}function Ur({viewProjectionMatrix:r,scale:e}){let t=jr(r),i=Vr(e);return{project_uViewProjectionMatrixFP64:t,project64_uViewProjectionMatrix:t,project64_uScale:i}}var Ae=class extends C.LayerExtension{getShaders(){let{coordinateSystem:e}=this.props;if(e!==C.COORDINATE_SYSTEM.LNGLAT&&e!==C.COORDINATE_SYSTEM.DEFAULT)throw new Error("fp64: coordinateSystem must be LNGLAT");return{modules:[oe]}}},S=Ae;(()=>{Ae.extensionName="Fp64Extension"})();var k=d(m(),1);var nt={inject:{"vs:#decl":`
929
+ `;var{fp64ify:Vr,fp64ifyMatrix4:jr}=re,se={name:"project64",dependencies:[oe.project,re],vs:st,getUniforms:Gr},zr=(0,oe._memoize)(Ur);function Gr(r){if(r&&"viewport"in r){let{viewProjectionMatrix:e,scale:t}=r.viewport;return zr({viewProjectionMatrix:e,scale:t})}return{}}function Ur({viewProjectionMatrix:r,scale:e}){let t=jr(r),i=Vr(e);return{project_uViewProjectionMatrixFP64:t,project64_uViewProjectionMatrix:t,project64_uScale:i}}var be=class extends C.LayerExtension{getShaders(){let{coordinateSystem:e}=this.props;if(e!==C.COORDINATE_SYSTEM.LNGLAT&&e!==C.COORDINATE_SYSTEM.DEFAULT)throw new Error("fp64: coordinateSystem must be LNGLAT");return{modules:[se]}}},S=be;(()=>{be.extensionName="Fp64Extension"})();var k=d(m(),1);var nt={inject:{"vs:#decl":`
914
930
  in vec2 instanceDashArrays;
915
931
  in float instanceDashOffsets;
916
932
  out vec2 vDashArray;
@@ -972,7 +988,7 @@ isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
972
988
  if (isInside == 0.0) {
973
989
  discard;
974
990
  }
975
- `}};var qr={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},ne=class extends k.LayerExtension{constructor({dash:e=!1,offset:t=!1,highPrecisionDash:i=!1}={}){super({dash:e||i,offset:t,highPrecisionDash:i})}isEnabled(e){return"pathTesselator"in e.state}getShaders(e){if(!e.isEnabled(this))return null;let t={};return e.opts.dash&&(t=(0,k._mergeShaders)(t,nt)),e.opts.offset&&(t=(0,k._mergeShaders)(t,at)),t}initializeState(e,t){let i=this.getAttributeManager();!i||!t.isEnabled(this)||(t.opts.dash&&i.addInstanced({instanceDashArrays:{size:2,accessor:"getDashArray"},instanceDashOffsets:t.opts.highPrecisionDash?{size:1,accessor:"getPath",transform:t.getDashOffsets.bind(this)}:{size:1,update:s=>{s.constant=!0,s.value=[0]}}}),t.opts.offset&&i.addInstanced({instanceOffsets:{size:1,accessor:"getOffset"}}))}updateState(e,t){if(!t.isEnabled(this))return;let i={};t.opts.dash&&(i.dashAlignMode=this.props.dashJustified?1:0,i.dashGapPickable=Boolean(this.props.dashGapPickable)),this.state.model?.setUniforms(i)}getDashOffsets(e){let t=[0],i=this.props.positionFormat==="XY"?2:3,s=Array.isArray(e[0]),o=s?e.length:e.length/i,n,a;for(let l=0;l<o-1;l++)n=s?e[l]:e.slice(l*i,l*i+i),n=this.projectPosition(n),l>0&&(t[l]=t[l-1]+R.dist(a,n)),a=n;return t[o-1]=0,t}},N=ne;(()=>{ne.defaultProps=qr})(),(()=>{ne.extensionName="PathStyleExtension"})();var ft=d(m(),1);var B=d(m(),1);var Wr=`
991
+ `}};var qr={getDashArray:{type:"accessor",value:[0,0]},getOffset:{type:"accessor",value:0},dashJustified:!1,dashGapPickable:!1},ne=class extends k.LayerExtension{constructor({dash:e=!1,offset:t=!1,highPrecisionDash:i=!1}={}){super({dash:e||i,offset:t,highPrecisionDash:i})}isEnabled(e){return"pathTesselator"in e.state}getShaders(e){if(!e.isEnabled(this))return null;let t={};return e.opts.dash&&(t=(0,k._mergeShaders)(t,nt)),e.opts.offset&&(t=(0,k._mergeShaders)(t,at)),t}initializeState(e,t){let i=this.getAttributeManager();!i||!t.isEnabled(this)||(t.opts.dash&&i.addInstanced({instanceDashArrays:{size:2,accessor:"getDashArray"},instanceDashOffsets:t.opts.highPrecisionDash?{size:1,accessor:"getPath",transform:t.getDashOffsets.bind(this)}:{size:1,update:o=>{o.constant=!0,o.value=[0]}}}),t.opts.offset&&i.addInstanced({instanceOffsets:{size:1,accessor:"getOffset"}}))}updateState(e,t){if(!t.isEnabled(this))return;let i={};t.opts.dash&&(i.dashAlignMode=this.props.dashJustified?1:0,i.dashGapPickable=Boolean(this.props.dashGapPickable)),this.state.model?.setUniforms(i)}getDashOffsets(e){let t=[0],i=this.props.positionFormat==="XY"?2:3,o=Array.isArray(e[0]),s=o?e.length:e.length/i,n,a;for(let l=0;l<s-1;l++)n=o?e[l]:e.slice(l*i,l*i+i),n=this.projectPosition(n),l>0&&(t[l]=t[l-1]+R.dist(a,n)),a=n;return t[s-1]=0,t}},N=ne;(()=>{ne.defaultProps=qr})(),(()=>{ne.extensionName="PathStyleExtension"})();var ft=d(m(),1);var B=d(m(),1);var Wr=`
976
992
  #ifdef NON_INSTANCED_MODEL
977
993
  #define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
978
994
  #define FILL_PATTERN_SCALE_ATTRIB fillPatternScales
@@ -1020,7 +1036,7 @@ if (!fill_patternMask) {
1020
1036
  color.rgb = patternColor.rgb;
1021
1037
  }
1022
1038
  }
1023
- `};function Kr(r,e){if(!r)return{};if("fillPatternTexture"in r){let{fillPatternTexture:t}=r;return{fill_patternTexture:t,fill_patternTextureSize:[t.width,t.height]}}if("viewport"in r){let{fillPatternMask:t=!0,fillPatternEnabled:i=!0}=r,{project_uCommonOrigin:s}=e,o=[(0,B.fp64LowPart)(s[0]),(0,B.fp64LowPart)(s[1])];return{fill_uvCoordinateOrigin:s.slice(0,2),fill_uvCoordinateOrigin64Low:o,fill_patternMask:t,fill_patternEnabled:i}}return{}}var lt={name:"fill-pattern",vs:Wr,fs:Hr,inject:Yr,dependencies:[B.project],getUniforms:Kr};var Zr={fillPatternEnabled:!0,fillPatternAtlas:{type:"image",value:null,async:!0,parameters:{lodMaxClamp:0}},fillPatternMapping:{type:"object",value:{},async:!0},fillPatternMask:!0,getFillPattern:{type:"accessor",value:r=>r.pattern},getFillPatternScale:{type:"accessor",value:1},getFillPatternOffset:{type:"accessor",value:[0,0]}},ae=class extends ft.LayerExtension{constructor({pattern:e=!1}={}){super({pattern:e})}isEnabled(e){return e.getAttributeManager()!==null&&!("pathTesselator"in e.state)}getShaders(e){return e.isEnabled(this)?{modules:[e.opts.pattern&&lt].filter(Boolean)}:null}initializeState(e,t){if(!t.isEnabled(this))return;let i=this.getAttributeManager();t.opts.pattern&&i.add({fillPatternFrames:{size:4,accessor:"getFillPattern",transform:t.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:e,oldProps:t},i){i.isEnabled(this)&&e.fillPatternMapping&&e.fillPatternMapping!==t.fillPatternMapping&&this.getAttributeManager().invalidate("getFillPattern")}draw(e,t){if(!t.isEnabled(this))return;let{fillPatternAtlas:i}=this.props;this.setModuleParameters({fillPatternTexture:i||this.state.emptyTexture})}finalizeState(){this.state.emptyTexture?.delete()}getPatternFrame(e){let{fillPatternMapping:t}=this.getCurrentLayer().props,i=t&&t[e];return i?[i.x,i.y,i.width,i.height]:[0,0,0,0]}},w=ae;(()=>{ae.defaultProps=Zr})(),(()=>{ae.extensionName="FillStyleExtension"})();var ct=d(m(),1);var $r={clipBounds:[0,0,1,1],clipByInstance:void 0},ut=`
1039
+ `};function Kr(r,e){if(!r)return{};if("fillPatternTexture"in r){let{fillPatternTexture:t}=r;return{fill_patternTexture:t,fill_patternTextureSize:[t.width,t.height]}}if("viewport"in r){let{fillPatternMask:t=!0,fillPatternEnabled:i=!0}=r,{project_uCommonOrigin:o}=e,s=[(0,B.fp64LowPart)(o[0]),(0,B.fp64LowPart)(o[1])];return{fill_uvCoordinateOrigin:o.slice(0,2),fill_uvCoordinateOrigin64Low:s,fill_patternMask:t,fill_patternEnabled:i}}return{}}var lt={name:"fill-pattern",vs:Wr,fs:Hr,inject:Yr,dependencies:[B.project],getUniforms:Kr};var Zr={fillPatternEnabled:!0,fillPatternAtlas:{type:"image",value:null,async:!0,parameters:{lodMaxClamp:0}},fillPatternMapping:{type:"object",value:{},async:!0},fillPatternMask:!0,getFillPattern:{type:"accessor",value:r=>r.pattern},getFillPatternScale:{type:"accessor",value:1},getFillPatternOffset:{type:"accessor",value:[0,0]}},ae=class extends ft.LayerExtension{constructor({pattern:e=!1}={}){super({pattern:e})}isEnabled(e){return e.getAttributeManager()!==null&&!("pathTesselator"in e.state)}getShaders(e){return e.isEnabled(this)?{modules:[e.opts.pattern&&lt].filter(Boolean)}:null}initializeState(e,t){if(!t.isEnabled(this))return;let i=this.getAttributeManager();t.opts.pattern&&i.add({fillPatternFrames:{size:4,accessor:"getFillPattern",transform:t.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:e,oldProps:t},i){i.isEnabled(this)&&e.fillPatternMapping&&e.fillPatternMapping!==t.fillPatternMapping&&this.getAttributeManager().invalidate("getFillPattern")}draw(e,t){if(!t.isEnabled(this))return;let{fillPatternAtlas:i}=this.props;this.setModuleParameters({fillPatternTexture:i||this.state.emptyTexture})}finalizeState(){this.state.emptyTexture?.delete()}getPatternFrame(e){let{fillPatternMapping:t}=this.getCurrentLayer().props,i=t&&t[e];return i?[i.x,i.y,i.width,i.height]:[0,0,0,0]}},w=ae;(()=>{ae.defaultProps=Zr})(),(()=>{ae.extensionName="FillStyleExtension"})();var ct=d(m(),1);var $r={clipBounds:[0,0,1,1],clipByInstance:void 0},ut=`
1024
1040
  uniform vec4 clip_bounds;
1025
1041
  bool clip_isInBounds(vec2 position) {
1026
1042
  return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
@@ -1041,7 +1057,7 @@ clip_commonPosition = geometry.position.xy;
1041
1057
  in vec2 clip_commonPosition;
1042
1058
  `,"fs:DECKGL_FILTER_COLOR":`
1043
1059
  if (!clip_isInBounds(clip_commonPosition)) discard;
1044
- `},le=class extends ct.LayerExtension{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=Boolean(this.props.clipByInstance)),this.state.clipByInstance=e,e?{modules:[Xr],inject:Qr}:{modules:[Jr],inject:ei}}draw({uniforms:e}){let{clipBounds:t}=this.props;if(this.state.clipByInstance)e.clip_bounds=t;else{let i=this.projectPosition([t[0],t[1],0]),s=this.projectPosition([t[2],t[3],0]);e.clip_bounds=[Math.min(i[0],s[0]),Math.min(i[1],s[1]),Math.max(i[0],s[0]),Math.max(i[1],s[1])]}}},D=le;(()=>{le.defaultProps=$r})(),(()=>{le.extensionName="ClipExtension"})();var ht=d(m(),1);var _t=d(m(),1);var ti=`
1060
+ `},le=class extends ct.LayerExtension{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=Boolean(this.props.clipByInstance)),this.state.clipByInstance=e,e?{modules:[Xr],inject:Qr}:{modules:[Jr],inject:ei}}draw({uniforms:e}){let{clipBounds:t}=this.props;if(this.state.clipByInstance)e.clip_bounds=t;else{let i=this.projectPosition([t[0],t[1],0]),o=this.projectPosition([t[2],t[3],0]);e.clip_bounds=[Math.min(i[0],o[0]),Math.min(i[1],o[1]),Math.max(i[0],o[0]),Math.max(i[1],o[1])]}}},D=le;(()=>{le.defaultProps=$r})(),(()=>{le.extensionName="ClipExtension"})();var ht=d(m(),1);var _t=d(m(),1);var ti=`
1045
1061
  #ifdef NON_INSTANCED_MODEL
1046
1062
  in float collisionPriorities;
1047
1063
  #else
@@ -1101,7 +1117,7 @@ position = vec4(0.0, 0.0, 2.0, 1.0);
1101
1117
  }
1102
1118
  `,"vs:DECKGL_FILTER_COLOR":`
1103
1119
  color.a *= collision_fade;
1104
- `},ii=(r,e)=>{if(!r||!("dummyCollisionMap"in r))return{};let{collisionFBO:t,drawToCollisionMap:i,dummyCollisionMap:s}=r;return{collision_sort:Boolean(i),collision_texture:!i&&t?t.colorAttachments[0]:s}},pt={name:"collision",dependencies:[_t.project],vs:ti,inject:ri,getUniforms:ii};var mt=d(m(),1);var dt=d(m(),1),V=class extends dt._LayersPass{renderCollisionMap(e,t){let s=[0,0,0,0],o=[1,1,e.width-2*1,e.height-2*1];this.render({...t,clearColor:s,scissorRect:o,target:e,pass:"collision"})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}getModuleParameters(){return{drawToCollisionMap:!0,picking:{isActive:1,isAttribute:!1},lightSources:{}}}};var Ee=2,j=class{constructor(){this.id="collision-filter-effect",this.props=null,this.useInPicking=!0,this.order=1,this.channels={},this.collisionFBOs={}}setup(e){this.context=e;let{device:t}=e;this.dummyCollisionMap=t.createTexture({width:1,height:1}),this.collisionFilterPass=new V(t,{id:"default-collision-filter"})}preRender({effects:e,layers:t,layerFilter:i,viewports:s,onViewportActive:o,views:n,isPicking:a,preRenderStats:l={}}){let{device:f}=this.context;if(a)return;let c=t.filter(({props:{visible:h,collisionEnabled:ve}})=>h&&ve);if(c.length===0){this.channels={};return}let u=e?.filter(h=>h.useInPicking&&l[h.id]),_=l["mask-effect"]?.didRender,p=this._groupByCollisionGroup(f,c),x=s[0],$=!this.lastViewport||!this.lastViewport.equals(x)||_;for(let h in p){let ve=this.collisionFBOs[h],Lt=p[h],[Ot,It]=f.canvasContext.getPixelSize();ve.resize({width:Ot/Ee,height:It/Ee}),this._render(Lt,{effects:u,layerFilter:i,onViewportActive:o,views:n,viewport:x,viewportChanged:$})}}_render(e,{effects:t,layerFilter:i,onViewportActive:s,views:o,viewport:n,viewportChanged:a}){let{collisionGroup:l}=e,f=this.channels[l];if(!f)return;let c=a||e===f||!(0,mt._deepEqual)(f.layers,e.layers,1)||e.layerBounds.some((u,_)=>!b(u,f.layerBounds[_]))||e.allLayersLoaded!==f.allLayersLoaded||e.layers.some(u=>u.props.transitions);if(this.channels[l]=e,c){this.lastViewport=n;let u=this.collisionFBOs[l];this.collisionFilterPass.renderCollisionMap(u,{pass:"collision-filter",isPicking:!0,layers:e.layers,effects:t,layerFilter:i,viewports:n?[n]:[],onViewportActive:s,views:o,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:u.device.canvasContext.getDevicePixelRatio()/Ee}})}}_groupByCollisionGroup(e,t){let i={};for(let s of t){let{collisionGroup:o}=s.props,n=i[o];n||(n={collisionGroup:o,layers:[],layerBounds:[],allLayersLoaded:!0},i[o]=n),n.layers.push(s),n.layerBounds.push(s.getBounds()),s.isLoaded||(n.allLayersLoaded=!1)}for(let s of Object.keys(i))this.collisionFBOs[s]||this.createFBO(e,s),this.channels[s]||(this.channels[s]=i[s]);for(let s of Object.keys(this.collisionFBOs))i[s]||this.destroyFBO(s);return i}getModuleParameters(e){let{collisionGroup:t}=e.props,{collisionFBOs:i,dummyCollisionMap:s}=this;return{collisionFBO:i[t],dummyCollisionMap:s}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let e of Object.keys(this.collisionFBOs))this.destroyFBO(e);this.collisionFBOs={},this.lastViewport=void 0}createFBO(e,t){let{width:i,height:s}=e.gl.canvas,o=e.createTexture({format:"rgba8unorm",width:i,height:s,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),n=e.createTexture({format:"depth16unorm",width:i,height:s,mipmaps:!1,dataFormat:6402,type:5125});this.collisionFBOs[t]=e.createFramebuffer({id:`collision-${t}`,width:i,height:s,colorAttachments:[o],depthStencilAttachment:n})}destroyFBO(e){let t=this.collisionFBOs[e];t.colorAttachments[0]?.destroy(),t.depthStencilAttachment?.destroy(),t.destroy(),delete this.collisionFBOs[e]}};var si={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},fe=class extends ht.LayerExtension{getShaders(){return{modules:[pt]}}draw({uniforms:e,context:t,moduleParameters:i}){let{collisionEnabled:s}=this.props,{collisionFBO:o,drawToCollisionMap:n}=i,a=s&&Boolean(o);e.collision_enabled=a,n&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(e,t){if(this.getAttributeManager()===null)return;this.context.deck?._addDefaultEffect(new j),this.getAttributeManager().add({collisionPriorities:{size:1,accessor:"getCollisionPriority",shaderAttributes:{collisionPriorities:{divisor:0},instanceCollisionPriorities:{divisor:1}}}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}},z=fe;(()=>{fe.defaultProps=si})(),(()=>{fe.extensionName="CollisionFilterExtension"})();var y=d(m(),1);var vt=d(m(),1);var oi=`
1120
+ `},ii=(r,e)=>{if(!r||!("dummyCollisionMap"in r))return{};let{collisionFBO:t,drawToCollisionMap:i,dummyCollisionMap:o}=r;return{collision_sort:Boolean(i),collision_texture:!i&&t?t.colorAttachments[0]:o}},pt={name:"collision",dependencies:[_t.project],vs:ti,inject:ri,getUniforms:ii};var mt=d(m(),1);var dt=d(m(),1),V=class extends dt._LayersPass{renderCollisionMap(e,t){let o=[0,0,0,0],s=[1,1,e.width-2*1,e.height-2*1];this.render({...t,clearColor:o,scissorRect:s,target:e,pass:"collision"})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}getModuleParameters(){return{drawToCollisionMap:!0,picking:{isActive:1,isAttribute:!1},lightSources:{}}}};var Ee=2,j=class{constructor(){this.id="collision-filter-effect",this.props=null,this.useInPicking=!0,this.order=1,this.channels={},this.collisionFBOs={}}setup(e){this.context=e;let{device:t}=e;this.dummyCollisionMap=t.createTexture({width:1,height:1}),this.collisionFilterPass=new V(t,{id:"default-collision-filter"})}preRender({effects:e,layers:t,layerFilter:i,viewports:o,onViewportActive:s,views:n,isPicking:a,preRenderStats:l={}}){let{device:f}=this.context;if(a)return;let c=t.filter(({props:{visible:h,collisionEnabled:ve}})=>h&&ve);if(c.length===0){this.channels={};return}let u=e?.filter(h=>h.useInPicking&&l[h.id]),_=l["mask-effect"]?.didRender,p=this._groupByCollisionGroup(f,c),x=o[0],$=!this.lastViewport||!this.lastViewport.equals(x)||_;for(let h in p){let ve=this.collisionFBOs[h],Lt=p[h],[Ot,It]=f.canvasContext.getPixelSize();ve.resize({width:Ot/Ee,height:It/Ee}),this._render(Lt,{effects:u,layerFilter:i,onViewportActive:s,views:n,viewport:x,viewportChanged:$})}}_render(e,{effects:t,layerFilter:i,onViewportActive:o,views:s,viewport:n,viewportChanged:a}){let{collisionGroup:l}=e,f=this.channels[l];if(!f)return;let c=a||e===f||!(0,mt._deepEqual)(f.layers,e.layers,1)||e.layerBounds.some((u,_)=>!A(u,f.layerBounds[_]))||e.allLayersLoaded!==f.allLayersLoaded||e.layers.some(u=>u.props.transitions);if(this.channels[l]=e,c){this.lastViewport=n;let u=this.collisionFBOs[l];this.collisionFilterPass.renderCollisionMap(u,{pass:"collision-filter",isPicking:!0,layers:e.layers,effects:t,layerFilter:i,viewports:n?[n]:[],onViewportActive:o,views:s,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:u.device.canvasContext.getDevicePixelRatio()/Ee}})}}_groupByCollisionGroup(e,t){let i={};for(let o of t){let{collisionGroup:s}=o.props,n=i[s];n||(n={collisionGroup:s,layers:[],layerBounds:[],allLayersLoaded:!0},i[s]=n),n.layers.push(o),n.layerBounds.push(o.getBounds()),o.isLoaded||(n.allLayersLoaded=!1)}for(let o of Object.keys(i))this.collisionFBOs[o]||this.createFBO(e,o),this.channels[o]||(this.channels[o]=i[o]);for(let o of Object.keys(this.collisionFBOs))i[o]||this.destroyFBO(o);return i}getModuleParameters(e){let{collisionGroup:t}=e.props,{collisionFBOs:i,dummyCollisionMap:o}=this;return{collisionFBO:i[t],dummyCollisionMap:o}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let e of Object.keys(this.collisionFBOs))this.destroyFBO(e);this.collisionFBOs={},this.lastViewport=void 0}createFBO(e,t){let{width:i,height:o}=e.gl.canvas,s=e.createTexture({format:"rgba8unorm",width:i,height:o,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),n=e.createTexture({format:"depth16unorm",width:i,height:o,mipmaps:!1,dataFormat:6402,type:5125});this.collisionFBOs[t]=e.createFramebuffer({id:`collision-${t}`,width:i,height:o,colorAttachments:[s],depthStencilAttachment:n})}destroyFBO(e){let t=this.collisionFBOs[e];t.colorAttachments[0]?.destroy(),t.depthStencilAttachment?.destroy(),t.destroy(),delete this.collisionFBOs[e]}};var oi={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},fe=class extends ht.LayerExtension{getShaders(){return{modules:[pt]}}draw({uniforms:e,context:t,moduleParameters:i}){let{collisionEnabled:o}=this.props,{collisionFBO:s,drawToCollisionMap:n}=i,a=o&&Boolean(s);e.collision_enabled=a,n&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(e,t){if(this.getAttributeManager()===null)return;this.context.deck?._addDefaultEffect(new j),this.getAttributeManager().add({collisionPriorities:{size:1,accessor:"getCollisionPriority",shaderAttributes:{collisionPriorities:{divisor:0},instanceCollisionPriorities:{divisor:1}}}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}},z=fe;(()=>{fe.defaultProps=oi})(),(()=>{fe.extensionName="CollisionFilterExtension"})();var T=d(m(),1);var vt=d(m(),1);var si=`
1105
1121
  uniform vec4 mask_bounds;
1106
1122
  uniform bool mask_maskByInstance;
1107
1123
  vec2 mask_getCoords(vec4 position) {
@@ -1151,8 +1167,8 @@ bool mask = mask_isInBounds(mask_texCoords);
1151
1167
  fragColor = texture(mask_texture, mask_texCoords);
1152
1168
  if (!mask) discard;
1153
1169
  }
1154
- `},li=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:{},gt={name:"mask",dependencies:[vt.project],vs:oi,fs:ni,inject:ai,getUniforms:li};var Me=d(m(),1);var xt=d(m(),1),fi={blendColorOperation:"subtract",blendColorSrcFactor:"zero",blendColorDstFactor:"one",blendAlphaOperation:"subtract",blendAlphaSrcFactor:"zero",blendAlphaDstFactor:"one"},G=class extends xt._LayersPass{constructor(e,t){super(e,t);let{mapSize:i=2048}=t;this.maskMap=e.createTexture({format:"rgba8unorm",width:i,height:i,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.fbo=e.createFramebuffer({id:"maskmap",width:i,height:i,colorAttachments:[this.maskMap]})}render(e){let t=2**e.channel,i=[255,255,255,255];super.render({...e,clearColor:i,colorMask:t,target:this.fbo,pass:"mask"})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!0,depthTest:!1,...fi}}shouldDrawLayer(e){return e.props.operation.includes("mask")}delete(){this.fbo.delete(),this.maskMap.delete()}};var ce=d(m(),1);function A(r,e){let t=[1/0,1/0,-1/0,-1/0];for(let i of r){let s=i.getBounds();if(s){let o=i.projectPosition(s[0],{viewport:e,autoOffset:!1}),n=i.projectPosition(s[1],{viewport:e,autoOffset:!1});t[0]=Math.min(t[0],o[0]),t[1]=Math.min(t[1],o[1]),t[2]=Math.max(t[2],n[0]),t[3]=Math.max(t[3],n[1])}}return Number.isFinite(t[0])?t:null}var ci=2048;function E(r){let{bounds:e,viewport:t,border:i=0}=r,{isGeospatial:s}=t;if(e[2]<=e[0]||e[3]<=e[1])return null;let o=t.unprojectPosition([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),{width:n,height:a,zoom:l}=r;if(l===void 0){n=n-i*2,a=a-i*2;let f=Math.min(n/(e[2]-e[0]),a/(e[3]-e[1]));l=Math.min(Math.log2(f),20)}else if(!n||!a){let f=2**l;n=Math.round(Math.abs(e[2]-e[0])*f),a=Math.round(Math.abs(e[3]-e[1])*f);let c=ci-i*2;if(n>c||a>c){let u=c/Math.max(n,a);n=Math.round(n*u),a=Math.round(a*u),l+=Math.log2(u)}}return s?new ce.WebMercatorViewport({id:t.id,x:i,y:i,width:n,height:a,longitude:o[0],latitude:o[1],zoom:l,orthographic:!0}):new ce.OrthographicViewport({id:t.id,x:i,y:i,width:n,height:a,target:o,zoom:l,flipY:!1})}function ui(r,e){let t;if(e&&e.length===2){let[o,n]=e,a=r.getBounds({z:o}),l=r.getBounds({z:n});t=[Math.min(a[0],l[0]),Math.min(a[1],l[1]),Math.max(a[2],l[2]),Math.max(a[3],l[3])]}else t=r.getBounds();let i=r.projectPosition(t.slice(0,2)),s=r.projectPosition(t.slice(2,4));return[i[0],i[1],s[0],s[1]]}function M(r,e,t){if(!r)return[0,0,1,1];let i=ui(e,t),s=_i(i);return r[2]-r[0]<=s[2]-s[0]&&r[3]-r[1]<=s[3]-s[1]?r:[Math.max(r[0],s[0]),Math.max(r[1],s[1]),Math.min(r[2],s[2]),Math.min(r[3],s[3])]}function _i(r){let e=r[2]-r[0],t=r[3]-r[1],i=(r[0]+r[2])/2,s=(r[1]+r[3])/2;return[i-e,s-t,i+e,s+t]}var U=class{constructor(){this.id="mask-effect",this.props=null,this.useInPicking=!0,this.order=0,this.channels=[],this.masks=null}setup({device:e}){this.dummyMaskMap=e.createTexture({width:1,height:1}),this.maskPass=new G(e,{id:"default-mask"}),this.maskMap=this.maskPass.maskMap}preRender({layers:e,layerFilter:t,viewports:i,onViewportActive:s,views:o,isPicking:n}){let a=!1;if(n)return{didRender:a};let l=e.filter(_=>_.props.visible&&_.props.operation.includes("mask"));if(l.length===0)return this.masks=null,this.channels.length=0,{didRender:a};this.masks={};let f=this._sortMaskChannels(l),c=i[0],u=!this.lastViewport||!this.lastViewport.equals(c);if(c.resolution!==void 0)return Me.log.warn("MaskExtension is not supported in GlobeView")(),{didRender:a};for(let _ in f){let p=this._renderChannel(f[_],{layerFilter:t,onViewportActive:s,views:o,viewport:c,viewportChanged:u});a||=p}return{didRender:a}}_renderChannel(e,{layerFilter:t,onViewportActive:i,views:s,viewport:o,viewportChanged:n}){let a=!1,l=this.channels[e.index];if(!l)return a;let f=e===l||e.layers.length!==l.layers.length||e.layers.some((c,u)=>c!==l.layers[u]||c.props.transitions)||e.layerBounds.some((c,u)=>c!==l.layerBounds[u]);if(e.bounds=l.bounds,e.maskBounds=l.maskBounds,this.channels[e.index]=e,f||n){this.lastViewport=o;let c=A(e.layers,o);if(e.bounds=c&&M(c,o),f||!b(e.bounds,l.bounds)){let{maskPass:u,maskMap:_}=this,p=c&&E({bounds:e.bounds,viewport:o,width:_.width,height:_.height,border:1});e.maskBounds=p?p.getBounds():[0,0,1,1],u.render({pass:"mask",channel:e.index,layers:e.layers,layerFilter:t,viewports:p?[p]:[],onViewportActive:i,views:s,moduleParameters:{devicePixelRatio:1}}),a=!0}}return this.masks[e.id]={index:e.index,bounds:e.maskBounds,coordinateOrigin:e.coordinateOrigin,coordinateSystem:e.coordinateSystem},a}_sortMaskChannels(e){let t={},i=0;for(let s of e){let{id:o}=s.root,n=t[o];if(!n){if(++i>4){Me.log.warn("Too many mask layers. The max supported is 4")();continue}n={id:o,index:this.channels.findIndex(a=>a?.id===o),layers:[],layerBounds:[],coordinateOrigin:s.root.props.coordinateOrigin,coordinateSystem:s.root.props.coordinateSystem},t[o]=n}n.layers.push(s),n.layerBounds.push(s.getBounds())}for(let s=0;s<4;s++){let o=this.channels[s];(!o||!(o.id in t))&&(this.channels[s]=null)}for(let s in t){let o=t[s];o.index<0&&(o.index=this.channels.findIndex(n=>!n),this.channels[o.index]=o)}return t}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 pi={maskId:"",maskByInstance:void 0,maskInverted:!1},ue=class extends y.LayerExtension{initializeState(){this.context.deck?._addDefaultEffect(new U)}getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.maskByInstance!==void 0&&(e=Boolean(this.props.maskByInstance)),this.state.maskByInstance=e,{modules:[gt]}}draw({uniforms:e,context:t,moduleParameters:i}){e.mask_maskByInstance=this.state.maskByInstance;let{maskId:s,maskInverted:o}=this.props,{maskChannels:n}=i,{viewport:a}=t;if(n&&n[s]){let{index:l,bounds:f,coordinateOrigin:c}=n[s],{coordinateSystem:u}=n[s];e.mask_enabled=!0,e.mask_channel=l,e.mask_inverted=o,u===y.COORDINATE_SYSTEM.DEFAULT&&(u=a.isGeospatial?y.COORDINATE_SYSTEM.LNGLAT:y.COORDINATE_SYSTEM.CARTESIAN);let _={modelMatrix:null,fromCoordinateOrigin:c,fromCoordinateSystem:u},p=this.projectPosition([f[0],f[1],0],_),x=this.projectPosition([f[2],f[3],0],_);e.mask_bounds=[p[0],p[1],x[0],x[1]]}else s&&y.log.warn(`Could not find a mask layer with id: ${s}`)(),e.mask_enabled=!1}},q=ue;(()=>{ue.defaultProps=pi})(),(()=>{ue.extensionName="MaskExtension"})();var Ft=d(m(),1);var Mt=d(m(),1);var yt=d(m(),1);var g={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},Pt=Object.keys(g).map(r=>`const float TERRAIN_MODE_${r} = ${g[r]}.0;`).join(`
1155
- `),W={name:"terrain",dependencies:[yt.project],inject:{"vs:#decl":`
1170
+ `},li=r=>r&&"maskMap"in r?{mask_texture:r.maskMap}:{},gt={name:"mask",dependencies:[vt.project],vs:si,fs:ni,inject:ai,getUniforms:li};var Me=d(m(),1);var xt=d(m(),1),fi={blendColorOperation:"subtract",blendColorSrcFactor:"zero",blendColorDstFactor:"one",blendAlphaOperation:"subtract",blendAlphaSrcFactor:"zero",blendAlphaDstFactor:"one"},G=class extends xt._LayersPass{constructor(e,t){super(e,t);let{mapSize:i=2048}=t;this.maskMap=e.createTexture({format:"rgba8unorm",width:i,height:i,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.fbo=e.createFramebuffer({id:"maskmap",width:i,height:i,colorAttachments:[this.maskMap]})}render(e){let t=2**e.channel,i=[255,255,255,255];super.render({...e,clearColor:i,colorMask:t,target:this.fbo,pass:"mask"})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!0,depthTest:!1,...fi}}shouldDrawLayer(e){return e.props.operation.includes("mask")}delete(){this.fbo.delete(),this.maskMap.delete()}};var ce=d(m(),1);function b(r,e){let t=[1/0,1/0,-1/0,-1/0];for(let i of r){let o=i.getBounds();if(o){let s=i.projectPosition(o[0],{viewport:e,autoOffset:!1}),n=i.projectPosition(o[1],{viewport:e,autoOffset:!1});t[0]=Math.min(t[0],s[0]),t[1]=Math.min(t[1],s[1]),t[2]=Math.max(t[2],n[0]),t[3]=Math.max(t[3],n[1])}}return Number.isFinite(t[0])?t:null}var ci=2048;function E(r){let{bounds:e,viewport:t,border:i=0}=r,{isGeospatial:o}=t;if(e[2]<=e[0]||e[3]<=e[1])return null;let s=t.unprojectPosition([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),{width:n,height:a,zoom:l}=r;if(l===void 0){n=n-i*2,a=a-i*2;let f=Math.min(n/(e[2]-e[0]),a/(e[3]-e[1]));l=Math.min(Math.log2(f),20)}else if(!n||!a){let f=2**l;n=Math.round(Math.abs(e[2]-e[0])*f),a=Math.round(Math.abs(e[3]-e[1])*f);let c=ci-i*2;if(n>c||a>c){let u=c/Math.max(n,a);n=Math.round(n*u),a=Math.round(a*u),l+=Math.log2(u)}}return o?new ce.WebMercatorViewport({id:t.id,x:i,y:i,width:n,height:a,longitude:s[0],latitude:s[1],zoom:l,orthographic:!0}):new ce.OrthographicViewport({id:t.id,x:i,y:i,width:n,height:a,target:s,zoom:l,flipY:!1})}function ui(r,e){let t;if(e&&e.length===2){let[s,n]=e,a=r.getBounds({z:s}),l=r.getBounds({z:n});t=[Math.min(a[0],l[0]),Math.min(a[1],l[1]),Math.max(a[2],l[2]),Math.max(a[3],l[3])]}else t=r.getBounds();let i=r.projectPosition(t.slice(0,2)),o=r.projectPosition(t.slice(2,4));return[i[0],i[1],o[0],o[1]]}function M(r,e,t){if(!r)return[0,0,1,1];let i=ui(e,t),o=_i(i);return r[2]-r[0]<=o[2]-o[0]&&r[3]-r[1]<=o[3]-o[1]?r:[Math.max(r[0],o[0]),Math.max(r[1],o[1]),Math.min(r[2],o[2]),Math.min(r[3],o[3])]}function _i(r){let e=r[2]-r[0],t=r[3]-r[1],i=(r[0]+r[2])/2,o=(r[1]+r[3])/2;return[i-e,o-t,i+e,o+t]}var U=class{constructor(){this.id="mask-effect",this.props=null,this.useInPicking=!0,this.order=0,this.channels=[],this.masks=null}setup({device:e}){this.dummyMaskMap=e.createTexture({width:1,height:1}),this.maskPass=new G(e,{id:"default-mask"}),this.maskMap=this.maskPass.maskMap}preRender({layers:e,layerFilter:t,viewports:i,onViewportActive:o,views:s,isPicking:n}){let a=!1;if(n)return{didRender:a};let l=e.filter(_=>_.props.visible&&_.props.operation.includes("mask"));if(l.length===0)return this.masks=null,this.channels.length=0,{didRender:a};this.masks={};let f=this._sortMaskChannels(l),c=i[0],u=!this.lastViewport||!this.lastViewport.equals(c);if(c.resolution!==void 0)return Me.log.warn("MaskExtension is not supported in GlobeView")(),{didRender:a};for(let _ in f){let p=this._renderChannel(f[_],{layerFilter:t,onViewportActive:o,views:s,viewport:c,viewportChanged:u});a||=p}return{didRender:a}}_renderChannel(e,{layerFilter:t,onViewportActive:i,views:o,viewport:s,viewportChanged:n}){let a=!1,l=this.channels[e.index];if(!l)return a;let f=e===l||e.layers.length!==l.layers.length||e.layers.some((c,u)=>c!==l.layers[u]||c.props.transitions)||e.layerBounds.some((c,u)=>c!==l.layerBounds[u]);if(e.bounds=l.bounds,e.maskBounds=l.maskBounds,this.channels[e.index]=e,f||n){this.lastViewport=s;let c=b(e.layers,s);if(e.bounds=c&&M(c,s),f||!A(e.bounds,l.bounds)){let{maskPass:u,maskMap:_}=this,p=c&&E({bounds:e.bounds,viewport:s,width:_.width,height:_.height,border:1});e.maskBounds=p?p.getBounds():[0,0,1,1],u.render({pass:"mask",channel:e.index,layers:e.layers,layerFilter:t,viewports:p?[p]:[],onViewportActive:i,views:o,moduleParameters:{devicePixelRatio:1}}),a=!0}}return this.masks[e.id]={index:e.index,bounds:e.maskBounds,coordinateOrigin:e.coordinateOrigin,coordinateSystem:e.coordinateSystem},a}_sortMaskChannels(e){let t={},i=0;for(let o of e){let{id:s}=o.root,n=t[s];if(!n){if(++i>4){Me.log.warn("Too many mask layers. The max supported is 4")();continue}n={id:s,index:this.channels.findIndex(a=>a?.id===s),layers:[],layerBounds:[],coordinateOrigin:o.root.props.coordinateOrigin,coordinateSystem:o.root.props.coordinateSystem},t[s]=n}n.layers.push(o),n.layerBounds.push(o.getBounds())}for(let o=0;o<4;o++){let s=this.channels[o];(!s||!(s.id in t))&&(this.channels[o]=null)}for(let o in t){let s=t[o];s.index<0&&(s.index=this.channels.findIndex(n=>!n),this.channels[s.index]=s)}return t}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 pi={maskId:"",maskByInstance:void 0,maskInverted:!1},ue=class extends T.LayerExtension{initializeState(){this.context.deck?._addDefaultEffect(new U)}getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.maskByInstance!==void 0&&(e=Boolean(this.props.maskByInstance)),this.state.maskByInstance=e,{modules:[gt]}}draw({uniforms:e,context:t,moduleParameters:i}){e.mask_maskByInstance=this.state.maskByInstance;let{maskId:o,maskInverted:s}=this.props,{maskChannels:n}=i,{viewport:a}=t;if(n&&n[o]){let{index:l,bounds:f,coordinateOrigin:c}=n[o],{coordinateSystem:u}=n[o];e.mask_enabled=!0,e.mask_channel=l,e.mask_inverted=s,u===T.COORDINATE_SYSTEM.DEFAULT&&(u=a.isGeospatial?T.COORDINATE_SYSTEM.LNGLAT:T.COORDINATE_SYSTEM.CARTESIAN);let _={modelMatrix:null,fromCoordinateOrigin:c,fromCoordinateSystem:u},p=this.projectPosition([f[0],f[1],0],_),x=this.projectPosition([f[2],f[3],0],_);e.mask_bounds=[p[0],p[1],x[0],x[1]]}else o&&T.log.warn(`Could not find a mask layer with id: ${o}`)(),e.mask_enabled=!1}},q=ue;(()=>{ue.defaultProps=pi})(),(()=>{ue.extensionName="MaskExtension"})();var Ft=d(m(),1);var Mt=d(m(),1);var Tt=d(m(),1);var g={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},Pt=Object.keys(g).map(r=>`const float TERRAIN_MODE_${r} = ${g[r]}.0;`).join(`
1171
+ `),W={name:"terrain",dependencies:[Tt.project],inject:{"vs:#decl":`
1156
1172
  uniform float terrain_mode;
1157
1173
  uniform sampler2D terrain_map;
1158
1174
  uniform vec4 terrain_bounds;
@@ -1201,6 +1217,6 @@ color = pixel + color * (1.0 - pixel.a);
1201
1217
  }
1202
1218
  return;
1203
1219
  }
1204
- `},getUniforms:(r={},e)=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:t,heightMap:i,heightMapBounds:s,dummyHeightMap:o,terrainCover:n,useTerrainHeightMap:a,terrainSkipRender:l}=r,{project_uCommonOrigin:f}=e,c=l?g.SKIP:g.NONE,u=o,_=null;if(t)c=g.WRITE_HEIGHT_MAP,_=s;else if(a&&i)c=g.USE_HEIGHT_MAP,u=i,_=s;else if(n){let p=r.picking?.isActive;u=(p?n.getPickingFramebuffer():n.getRenderFramebuffer())?.colorAttachments[0].texture,p&&(c=g.SKIP),u?(c=c===g.SKIP?g.USE_COVER_ONLY:g.USE_COVER,_=n.bounds):u=o}return{terrain_mode:c,terrain_map:u,terrain_bounds:_?[_[0]-f[0],_[1]-f[1],_[2]-_[0],_[3]-_[1]]:[0,0,0,0]}}return null}};function H(r,e){return r.createFramebuffer({id:e.id,colorAttachments:[r.createTexture({id:e.id,...e.float&&{format:"rgba32float",type:5126},mipmaps:!1,sampler:e.interpolate===!1?{minFilter:"nearest",magFilter:"nearest"}:{minFilter:"linear",magFilter:"linear"}})]})}var _e=class{constructor(e){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=e,this.tile=Tt(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:i,layerNeedsRedraw:s}){e&&(this.targetLayer=e);let o=t?this._updateViewport(t):!1,n=i?this._updateLayers(i):!1;if(s){for(let a of this.layers)if(s[a]){n=!0;break}}return n||o}_updateLayers(e){let t=!1;if(e=this.tile?di(this.tile,e):e,e.length!==this.layers.length)t=!0;else for(let i=0;i<e.length;i++)if(e[i].id!==this.layers[i]){t=!0;break}return t&&(this.layers=e.map(i=>i.id)),t}_updateViewport(e){let t=this.targetLayer,i=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){i=!0,this.targetBounds=this.tile.boundingBox;let o=e.projectPosition(this.targetBounds[0]),n=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[o[0],o[1],n[0],n[1]]}}else this.targetBounds!==t.getBounds()&&(i=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=A([t],e));if(!this.targetBoundsCommon)return!1;let s=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let o=this.renderViewport?.zoom;i=i||s!==o;let n=M(this.targetBoundsCommon,e),a=this.bounds;i=i||!a||n.some((l,f)=>l!==a[f]),this.bounds=n}return i&&(this.renderViewport=E({bounds:this.bounds,zoom:s,viewport:e})),i}getRenderFramebuffer(){return!this.renderViewport||this.layers.length===0?null:(this.fbo||(this.fbo=H(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=H(this.targetLayer.context.device,{id:`${this.id}-picking`,interpolate:!1})),this.pickingFbo)}filterLayers(e){return e.filter(({id:t})=>this.layers.includes(t))}delete(){let{fbo:e,pickingFbo:t}=this;e&&(e.colorAttachments[0].destroy(),e.destroy()),t&&(t.colorAttachments[0].destroy(),t.destroy())}};function di(r,e){return e.filter(t=>{let i=Tt(t);return i?mi(r.boundingBox,i.boundingBox):!0})}function Tt(r){for(;r;){let{tile:e}=r.props;if(e)return e;r=r.parent}return null}function mi(r,e){return r&&e?r[0][0]<e[1][0]&&e[0][0]<r[1][0]&&r[0][1]<e[1][1]&&e[0][1]<r[1][1]:!1}var bt=d(m(),1),hi={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},pe=class extends bt._LayersPass{getRenderableLayers(e,t){let{layers:i}=t,s=[],o=this._getDrawLayerParams(e,t,!0);for(let n=0;n<i.length;n++){let a=i[n];!a.isComposite&&o[n].shouldDrawLayer&&s.push(a)}return s}renderHeightMap(e,t){let i=e.getRenderFramebuffer(),s=e.renderViewport;!i||!s||(i.resize(s),this.render({...t,target:i,pass:"terrain-height-map",layers:t.layers,viewports:[s],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){let i=e.getRenderFramebuffer(),s=e.renderViewport;if(!i||!s)return;let o=e.filterLayers(t.layers);i.resize(s),this.render({...t,target:i,pass:`terrain-cover-${e.id}`,layers:o,effects:[],viewports:[s],clearColor:[0,0,0,0]})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!0,depthTest:!1,...e.props.operation.includes("terrain")&&hi}}};var At=d(m(),1),de=class extends At._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){let{layers:i}=t,s=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);let o=this._getDrawLayerParams(e,t);for(let n=0;n<i.length;n++){let a=i[n];!a.isComposite&&o[n].shouldDrawLayer&&(s.push(a),this.drawParameters[a.id]=o[n].layerParameters)}return s}renderTerrainCover(e,t){let i=e.getPickingFramebuffer(),s=e.renderViewport;if(!i||!s)return;let o=e.filterLayers(t.layers),n=e.targetLayer;n.props.pickable&&o.unshift(n),i.resize(s),this.render({...t,pickingFBO:i,pass:`terrain-cover-picking-${e.id}`,layers:o,effects:[],viewports:[s],cullRect:void 0,deviceRect:s,pickZ:!1})}getLayerParameters(e,t,i){let s;return this.drawParameters[e.id]?s=this.drawParameters[e.id]:(s=super.getLayerParameters(e,t,i),s.blend=!0),{...s,depthTest:!1}}};var Et=2048,Y=class{static isSupported(e){return e.isTextureFormatRenderable("rgba32float")}constructor(e){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=e}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=H(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){let i=e.length!==this.layers.length||e.some((o,n)=>o!==this.layers[n]||o.props.transitions||o.getBounds()!==this.layersBounds[n]);i&&(this.layers=e,this.layersBounds=e.map(o=>o.getBounds()),this.layersBoundsCommon=A(e,t));let s=!this.lastViewport||!t.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(i||s){let o=M(this.layersBoundsCommon,t);if(o[2]<=o[0]||o[3]<=o[1])return this.renderViewport=null,!1;this.bounds=o,this.lastViewport=t;let n=t.scale,a=(o[2]-o[0])*n,l=(o[3]-o[1])*n;return this.renderViewport=a>0||l>0?E({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(a,Et),height:Math.min(l,Et),viewport:t}):null,!0}return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}};var me=class{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}setup({device:e,deck:t}){this.dummyHeightMap=e.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new pe(e,{id:"terrain"}),this.terrainPickingPass=new de(e,{id:"terrain-picking"}),Y.isSupported(e)?this.heightMap=new Y(e):Mt.log.warn("Terrain offset mode is not supported by this browser")(),t._addDefaultShaderModule(W)}preRender(e){if(e.pickZ){this.isDrapingEnabled=!1;return}let{viewports:t}=e,i=e.pass.startsWith("picking");this.isPicking=i,this.isDrapingEnabled=!0;let s=t[0],o=(i?this.terrainPickingPass:this.terrainPass).getRenderableLayers(s,e),n=o.filter(l=>l.props.operation.includes("terrain"));if(n.length===0)return;i||o.filter(f=>f.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(n,s,e);let a=o.filter(l=>l.state.terrainDrawMode==="drape");this._updateTerrainCovers(n,a,s,e)}getModuleParameters(e){let{terrainDrawMode:t}=e.state;return{heightMap:this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture||null,heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:this.isDrapingEnabled?this.terrainCovers.get(e.id):null,useTerrainHeightMap:t==="offset",terrainSkipRender:t==="drape"||!e.props.operation.includes("draw")}}cleanup({deck:e}){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(),e._removeDefaultShaderModule(W)}_updateHeightMap(e,t,i){!this.heightMap||!this.heightMap.shouldUpdate({layers:e,viewport:t})||this.terrainPass.renderHeightMap(this.heightMap,{...i,layers:e,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(e,t,i,s){let o={};for(let n of t)n.state.terrainCoverNeedsRedraw&&(o[n.id]=!0,n.state.terrainCoverNeedsRedraw=!1);for(let n of this.terrainCovers.values())n.isDirty=n.isDirty||n.shouldUpdate({layerNeedsRedraw:o});for(let n of e)this._updateTerrainCover(n,t,i,s);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,i,s){let o=this.isPicking?this.terrainPickingPass:this.terrainPass,n=this.terrainCovers.get(e.id);n||(n=new _e(e),this.terrainCovers.set(e.id,n));try{let a=n.shouldUpdate({targetLayer:e,viewport:i,layers:t});(this.isPicking||n.isDirty||a)&&(o.renderTerrainCover(n,{...s,layers:t,moduleParameters:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1,devicePixelRatio:1}}),this.isPicking||(n.isDirty=!1))}catch(a){e.raiseError(a,`Error rendering terrain cover ${n.id}`)}}_pruneTerrainCovers(){let e=[];for(let[t,i]of this.terrainCovers)i.isActive||e.push(t);for(let t of e)this.terrainCovers.delete(t)}};var vi={terrainDrawMode:void 0},he=class extends Ft.LayerExtension{getShaders(){return{modules:[W]}}initializeState(){this.context.deck?._addDefaultEffect(new me)}updateState(e){let{props:t,oldProps:i}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===i.terrainDrawMode&&t.extruded===i.extruded)return;let{terrainDrawMode:s}=t;if(!s){let o=this.props.extruded,n=this.getAttributeManager()?.attributes,a=n&&"instancePositions"in n;s=o||a?"offset":"drape"}this.setState({terrainDrawMode:s})}onNeedsRedraw(){let e=this.state;e.terrainDrawMode==="drape"&&(e.terrainCoverNeedsRedraw=!0)}},K=he;(()=>{he.defaultProps=vi})(),(()=>{he.extensionName="TerrainExtension"})();return Bt(Z);})();
1220
+ `},getUniforms:(r={},e)=>{if("dummyHeightMap"in r){let{drawToTerrainHeightMap:t,heightMap:i,heightMapBounds:o,dummyHeightMap:s,terrainCover:n,useTerrainHeightMap:a,terrainSkipRender:l}=r,{project_uCommonOrigin:f}=e,c=l?g.SKIP:g.NONE,u=s,_=null;if(t)c=g.WRITE_HEIGHT_MAP,_=o;else if(a&&i)c=g.USE_HEIGHT_MAP,u=i,_=o;else if(n){let p=r.picking?.isActive;u=(p?n.getPickingFramebuffer():n.getRenderFramebuffer())?.colorAttachments[0].texture,p&&(c=g.SKIP),u?(c=c===g.SKIP?g.USE_COVER_ONLY:g.USE_COVER,_=n.bounds):u=s}return{terrain_mode:c,terrain_map:u,terrain_bounds:_?[_[0]-f[0],_[1]-f[1],_[2]-_[0],_[3]-_[1]]:[0,0,0,0]}}return null}};function H(r,e){return r.createFramebuffer({id:e.id,colorAttachments:[r.createTexture({id:e.id,...e.float&&{format:"rgba32float",type:5126},mipmaps:!1,sampler:e.interpolate===!1?{minFilter:"nearest",magFilter:"nearest"}:{minFilter:"linear",magFilter:"linear"}})]})}var _e=class{constructor(e){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=e,this.tile=yt(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:i,layerNeedsRedraw:o}){e&&(this.targetLayer=e);let s=t?this._updateViewport(t):!1,n=i?this._updateLayers(i):!1;if(o){for(let a of this.layers)if(o[a]){n=!0;break}}return n||s}_updateLayers(e){let t=!1;if(e=this.tile?di(this.tile,e):e,e.length!==this.layers.length)t=!0;else for(let i=0;i<e.length;i++)if(e[i].id!==this.layers[i]){t=!0;break}return t&&(this.layers=e.map(i=>i.id)),t}_updateViewport(e){let t=this.targetLayer,i=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){i=!0,this.targetBounds=this.tile.boundingBox;let s=e.projectPosition(this.targetBounds[0]),n=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[s[0],s[1],n[0],n[1]]}}else this.targetBounds!==t.getBounds()&&(i=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=b([t],e));if(!this.targetBoundsCommon)return!1;let o=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{let s=this.renderViewport?.zoom;i=i||o!==s;let n=M(this.targetBoundsCommon,e),a=this.bounds;i=i||!a||n.some((l,f)=>l!==a[f]),this.bounds=n}return i&&(this.renderViewport=E({bounds:this.bounds,zoom:o,viewport:e})),i}getRenderFramebuffer(){return!this.renderViewport||this.layers.length===0?null:(this.fbo||(this.fbo=H(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=H(this.targetLayer.context.device,{id:`${this.id}-picking`,interpolate:!1})),this.pickingFbo)}filterLayers(e){return e.filter(({id:t})=>this.layers.includes(t))}delete(){let{fbo:e,pickingFbo:t}=this;e&&(e.colorAttachments[0].destroy(),e.destroy()),t&&(t.colorAttachments[0].destroy(),t.destroy())}};function di(r,e){return e.filter(t=>{let i=yt(t);return i?mi(r.boundingBox,i.boundingBox):!0})}function yt(r){for(;r;){let{tile:e}=r.props;if(e)return e;r=r.parent}return null}function mi(r,e){return r&&e?r[0][0]<e[1][0]&&e[0][0]<r[1][0]&&r[0][1]<e[1][1]&&e[0][1]<r[1][1]:!1}var At=d(m(),1),hi={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},pe=class extends At._LayersPass{getRenderableLayers(e,t){let{layers:i}=t,o=[],s=this._getDrawLayerParams(e,t,!0);for(let n=0;n<i.length;n++){let a=i[n];!a.isComposite&&s[n].shouldDrawLayer&&o.push(a)}return o}renderHeightMap(e,t){let i=e.getRenderFramebuffer(),o=e.renderViewport;!i||!o||(i.resize(o),this.render({...t,target:i,pass:"terrain-height-map",layers:t.layers,viewports:[o],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){let i=e.getRenderFramebuffer(),o=e.renderViewport;if(!i||!o)return;let s=e.filterLayers(t.layers);i.resize(o),this.render({...t,target:i,pass:`terrain-cover-${e.id}`,layers:s,effects:[],viewports:[o],clearColor:[0,0,0,0]})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!0,depthTest:!1,...e.props.operation.includes("terrain")&&hi}}};var bt=d(m(),1),de=class extends bt._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){let{layers:i}=t,o=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);let s=this._getDrawLayerParams(e,t);for(let n=0;n<i.length;n++){let a=i[n];!a.isComposite&&s[n].shouldDrawLayer&&(o.push(a),this.drawParameters[a.id]=s[n].layerParameters)}return o}renderTerrainCover(e,t){let i=e.getPickingFramebuffer(),o=e.renderViewport;if(!i||!o)return;let s=e.filterLayers(t.layers),n=e.targetLayer;n.props.pickable&&s.unshift(n),i.resize(o),this.render({...t,pickingFBO:i,pass:`terrain-cover-picking-${e.id}`,layers:s,effects:[],viewports:[o],cullRect:void 0,deviceRect:o,pickZ:!1})}getLayerParameters(e,t,i){let o;return this.drawParameters[e.id]?o=this.drawParameters[e.id]:(o=super.getLayerParameters(e,t,i),o.blend=!0),{...o,depthTest:!1}}};var Et=2048,Y=class{static isSupported(e){return e.isTextureFormatRenderable("rgba32float")}constructor(e){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=e}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=H(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){let i=e.length!==this.layers.length||e.some((s,n)=>s!==this.layers[n]||s.props.transitions||s.getBounds()!==this.layersBounds[n]);i&&(this.layers=e,this.layersBounds=e.map(s=>s.getBounds()),this.layersBoundsCommon=b(e,t));let o=!this.lastViewport||!t.equals(this.lastViewport);if(!this.layersBoundsCommon)this.renderViewport=null;else if(i||o){let s=M(this.layersBoundsCommon,t);if(s[2]<=s[0]||s[3]<=s[1])return this.renderViewport=null,!1;this.bounds=s,this.lastViewport=t;let n=t.scale,a=(s[2]-s[0])*n,l=(s[3]-s[1])*n;return this.renderViewport=a>0||l>0?E({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(a,Et),height:Math.min(l,Et),viewport:t}):null,!0}return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}};var me=class{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}setup({device:e,deck:t}){this.dummyHeightMap=e.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new pe(e,{id:"terrain"}),this.terrainPickingPass=new de(e,{id:"terrain-picking"}),Y.isSupported(e)?this.heightMap=new Y(e):Mt.log.warn("Terrain offset mode is not supported by this browser")(),t._addDefaultShaderModule(W)}preRender(e){if(e.pickZ){this.isDrapingEnabled=!1;return}let{viewports:t}=e,i=e.pass.startsWith("picking");this.isPicking=i,this.isDrapingEnabled=!0;let o=t[0],s=(i?this.terrainPickingPass:this.terrainPass).getRenderableLayers(o,e),n=s.filter(l=>l.props.operation.includes("terrain"));if(n.length===0)return;i||s.filter(f=>f.state.terrainDrawMode==="offset").length>0&&this._updateHeightMap(n,o,e);let a=s.filter(l=>l.state.terrainDrawMode==="drape");this._updateTerrainCovers(n,a,o,e)}getModuleParameters(e){let{terrainDrawMode:t}=e.state;return{heightMap:this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture||null,heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:this.isDrapingEnabled?this.terrainCovers.get(e.id):null,useTerrainHeightMap:t==="offset",terrainSkipRender:t==="drape"||!e.props.operation.includes("draw")}}cleanup({deck:e}){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(),e._removeDefaultShaderModule(W)}_updateHeightMap(e,t,i){!this.heightMap||!this.heightMap.shouldUpdate({layers:e,viewport:t})||this.terrainPass.renderHeightMap(this.heightMap,{...i,layers:e,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(e,t,i,o){let s={};for(let n of t)n.state.terrainCoverNeedsRedraw&&(s[n.id]=!0,n.state.terrainCoverNeedsRedraw=!1);for(let n of this.terrainCovers.values())n.isDirty=n.isDirty||n.shouldUpdate({layerNeedsRedraw:s});for(let n of e)this._updateTerrainCover(n,t,i,o);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,i,o){let s=this.isPicking?this.terrainPickingPass:this.terrainPass,n=this.terrainCovers.get(e.id);n||(n=new _e(e),this.terrainCovers.set(e.id,n));try{let a=n.shouldUpdate({targetLayer:e,viewport:i,layers:t});(this.isPicking||n.isDirty||a)&&(s.renderTerrainCover(n,{...o,layers:t,moduleParameters:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1,devicePixelRatio:1}}),this.isPicking||(n.isDirty=!1))}catch(a){e.raiseError(a,`Error rendering terrain cover ${n.id}`)}}_pruneTerrainCovers(){let e=[];for(let[t,i]of this.terrainCovers)i.isActive||e.push(t);for(let t of e)this.terrainCovers.delete(t)}};var vi={terrainDrawMode:void 0},he=class extends Ft.LayerExtension{getShaders(){return{modules:[W]}}initializeState(){this.context.deck?._addDefaultEffect(new me)}updateState(e){let{props:t,oldProps:i}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===i.terrainDrawMode&&t.extruded===i.extruded)return;let{terrainDrawMode:o}=t;if(!o){let s=this.props.extruded,n=this.getAttributeManager()?.attributes,a=n&&"instancePositions"in n;o=s||a?"offset":"drape"}this.setState({terrainDrawMode:o})}onNeedsRedraw(){let e=this.state;e.terrainDrawMode==="drape"&&(e.terrainCoverNeedsRedraw=!0)}},K=he;(()=>{he.defaultProps=vi})(),(()=>{he.extensionName="TerrainExtension"})();return Bt(Z);})();
1205
1221
  return __exports__;
1206
1222
  });
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.6",
6
+ "version": "9.0.8",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -47,5 +47,5 @@
47
47
  "@luma.gl/core": "^9.0.0",
48
48
  "@luma.gl/engine": "^9.0.0"
49
49
  },
50
- "gitHead": "fdbf68be3761c1a7e4bf5d2c6b20792fd8796937"
50
+ "gitHead": "bca774eae5c0b2da3901e2bc57268ccc2eec81fe"
51
51
  }
@@ -22,7 +22,7 @@ import type {Framebuffer} from '@luma.gl/core';
22
22
  import type {Model} from '@luma.gl/engine';
23
23
  import type {Layer, LayerContext, Accessor, UpdateParameters} from '@deck.gl/core';
24
24
  import {_deepEqual as deepEqual, LayerExtension, log} from '@deck.gl/core';
25
- import {shaderModule, shaderModule64} from './shader-module';
25
+ import {Defines, shaderModule, shaderModule64} from './shader-module';
26
26
  import * as aggregator from './aggregator';
27
27
 
28
28
  const defaultProps = {
@@ -96,15 +96,15 @@ export type DataFilterExtensionProps<DataT = any> = {
96
96
 
97
97
  type DataFilterExtensionOptions = {
98
98
  /**
99
- * The size of the category filter (number of columns to filter by). The category filter can show/hide data based on 1-4 properties of each object.
100
- * @default 1
99
+ * The size of the category filter (number of columns to filter by). The category filter can show/hide data based on 1-4 properties of each object. Set to `0` to disable category filtering.
100
+ * @default 0
101
101
  */
102
- categorySize?: 1 | 2 | 3 | 4;
102
+ categorySize?: 0 | 1 | 2 | 3 | 4;
103
103
  /**
104
- * The size of the filter (number of columns to filter by). The data filter can show/hide data based on 1-4 numeric properties of each object.
104
+ * The size of the filter (number of columns to filter by). The data filter can show/hide data based on 1-4 numeric properties of each object. Set to `0` to disable numeric filtering.
105
105
  * @default 1
106
106
  */
107
- filterSize?: 1 | 2 | 3 | 4;
107
+ filterSize?: 0 | 1 | 2 | 3 | 4;
108
108
  /**
109
109
  * Use 64-bit precision instead of 32-bit.
110
110
  * @default false
@@ -118,17 +118,17 @@ type DataFilterExtensionOptions = {
118
118
  };
119
119
 
120
120
  const defaultOptions: Required<DataFilterExtensionOptions> = {
121
- categorySize: 1,
121
+ categorySize: 0,
122
122
  filterSize: 1,
123
123
  fp64: false,
124
124
  countItems: false
125
125
  };
126
126
 
127
127
  const DATA_TYPE_FROM_SIZE = {
128
- 1: 'float',
129
- 2: 'vec2',
130
- 3: 'vec3',
131
- 4: 'vec4'
128
+ 1: 'float' as const,
129
+ 2: 'vec2' as const,
130
+ 3: 'vec3' as const,
131
+ 4: 'vec4' as const
132
132
  };
133
133
 
134
134
  /** Adds GPU-based data filtering functionalities to layers. It allows the layer to show/hide objects based on user-defined properties. */
@@ -144,16 +144,17 @@ export default class DataFilterExtension extends LayerExtension<
144
144
 
145
145
  getShaders(this: Layer<DataFilterExtensionProps>, extension: this): any {
146
146
  const {categorySize, filterSize, fp64} = extension.opts;
147
+ const defines: Defines = {};
148
+ if (categorySize) {
149
+ defines.DATACATEGORY_TYPE = DATA_TYPE_FROM_SIZE[categorySize];
150
+ defines.DATACATEGORY_CHANNELS = categorySize;
151
+ }
152
+ if (filterSize) {
153
+ defines.DATAFILTER_TYPE = DATA_TYPE_FROM_SIZE[filterSize];
154
+ defines.DATAFILTER_DOUBLE = Boolean(fp64);
155
+ }
147
156
 
148
- return {
149
- modules: [fp64 ? shaderModule64 : shaderModule],
150
- defines: {
151
- DATACATEGORY_TYPE: DATA_TYPE_FROM_SIZE[categorySize],
152
- DATACATEGORY_CHANNELS: categorySize,
153
- DATAFILTER_TYPE: DATA_TYPE_FROM_SIZE[filterSize],
154
- DATAFILTER_DOUBLE: Boolean(fp64)
155
- }
156
- };
157
+ return {modules: [fp64 ? shaderModule64 : shaderModule], defines};
157
158
  }
158
159
 
159
160
  initializeState(this: Layer<DataFilterExtensionProps>, context: LayerContext, extension: this) {
@@ -161,37 +162,44 @@ export default class DataFilterExtension extends LayerExtension<
161
162
  const {categorySize, filterSize, fp64} = extension.opts;
162
163
 
163
164
  if (attributeManager) {
164
- attributeManager.add({
165
- filterValues: {
166
- size: filterSize,
167
- type: fp64 ? 'float64' : 'float32',
168
- accessor: 'getFilterValue',
169
- shaderAttributes: {
170
- filterValues: {
171
- divisor: 0
172
- },
173
- instanceFilterValues: {
174
- divisor: 1
165
+ if (filterSize) {
166
+ attributeManager.add({
167
+ filterValues: {
168
+ size: filterSize,
169
+ type: fp64 ? 'float64' : 'float32',
170
+ accessor: 'getFilterValue',
171
+ shaderAttributes: {
172
+ filterValues: {
173
+ divisor: 0
174
+ },
175
+ instanceFilterValues: {
176
+ divisor: 1
177
+ }
175
178
  }
176
179
  }
177
- },
178
- filterCategoryValues: {
179
- size: categorySize,
180
- accessor: 'getFilterCategory',
181
- transform:
182
- categorySize === 1
183
- ? d => extension._getCategoryKey.call(this, d, 0)
184
- : d => d.map((x, i) => extension._getCategoryKey.call(this, x, i)),
185
- shaderAttributes: {
186
- filterCategoryValues: {
187
- divisor: 0
188
- },
189
- instanceFilterCategoryValues: {
190
- divisor: 1
180
+ });
181
+ }
182
+
183
+ if (categorySize) {
184
+ attributeManager.add({
185
+ filterCategoryValues: {
186
+ size: categorySize,
187
+ accessor: 'getFilterCategory',
188
+ transform:
189
+ categorySize === 1
190
+ ? d => extension._getCategoryKey.call(this, d, 0)
191
+ : d => d.map((x, i) => extension._getCategoryKey.call(this, x, i)),
192
+ shaderAttributes: {
193
+ filterCategoryValues: {
194
+ divisor: 0
195
+ },
196
+ instanceFilterCategoryValues: {
197
+ divisor: 1
198
+ }
191
199
  }
192
200
  }
193
- }
194
- });
201
+ });
202
+ }
195
203
  }
196
204
 
197
205
  const {device} = this.context;
@@ -240,7 +248,7 @@ export default class DataFilterExtension extends LayerExtension<
240
248
  if (this.state.filterModel) {
241
249
  const filterNeedsUpdate =
242
250
  // attributeManager must be defined for filterModel to be set
243
- attributeManager!.attributes.filterValues.needsUpdate() ||
251
+ attributeManager!.attributes.filterValues?.needsUpdate() ||
244
252
  attributeManager!.attributes.filterCategoryValues?.needsUpdate() ||
245
253
  props.filterEnabled !== oldProps.filterEnabled ||
246
254
  props.filterRange !== oldProps.filterRange ||
@@ -294,7 +302,7 @@ export default class DataFilterExtension extends LayerExtension<
294
302
  filterModel.updateModuleSettings(params.moduleParameters);
295
303
  // @ts-expect-error filterValue and filterIndices should always have buffer value
296
304
  filterModel.setAttributes({
297
- ...filterValues.getValue(),
305
+ ...filterValues?.getValue(),
298
306
  ...filterCategoryValues?.getValue(),
299
307
  ...filterIndices?.getValue()
300
308
  });