swc/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js

61 lines
889 KiB
JavaScript
Raw Normal View History

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[634],{6158:function(b,c,a){var d=a(3454);!function(c,a){b.exports=a()}(this,function(){"use strict";var c,e,b;function a(g,a){if(c){if(e){var f="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+c+")(sharedChunk); ("+e+")(sharedChunk); self.onerror = null;",d={};c(d),b=a(d),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(b.workerUrl=window.URL.createObjectURL(new Blob([f],{type:"text/javascript"})))}else e=a}else c=a}return a(["exports"],function(a){var bq="2.7.0",eG=H;function H(a,c,d,b){this.cx=3*a,this.bx=3*(d-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*c,this.by=3*(b-c)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=b,this.p2x=d,this.p2y=b}H.prototype.sampleCurveX=function(a){return((this.ax*a+this.bx)*a+this.cx)*a},H.prototype.sampleCurveY=function(a){return((this.ay*a+this.by)*a+this.cy)*a},H.prototype.sampleCurveDerivativeX=function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},H.prototype.solveCurveX=function(c,e){var b,d,a,f,g;for(void 0===e&&(e=1e-6),a=c,g=0;g<8;g++){if(Math.abs(f=this.sampleCurveX(a)-c)<e)return a;var h=this.sampleCurveDerivativeX(a);if(1e-6>Math.abs(h))break;a-=f/h}if((a=c)<(b=0))return b;if(a>(d=1))return d;for(;b<d&&!(Math.abs((f=this.sampleCurveX(a))-c)<e);)c>f?b=a:d=a,a=.5*(d-b)+b;return a},H.prototype.solve=function(a,b){return this.sampleCurveY(this.solveCurveX(a,b))};var aF=aG;function aG(a,b){this.x=a,this.y=b}aG.prototype={clone:function(){return new aG(this.x,this.y)},add:function(a){return this.clone()._add(a)},sub:function(a){return this.clone()._sub(a)},multByPoint:function(a){return this.clone()._multByPoint(a)},divByPoint:function(a){return this.clone()._divByPoint(a)},mult:function(a){return this.clone()._mult(a)},div:function(a){return this.clone()._div(a)},rotate:function(a){return this.clone()._rotate(a)},rotateAround:function(a,b){return this.clone()._rotateAround(a,b)},matMult:function(a){return this.clone()._matMult(a)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(a){return this.x===a.x&&this.y===a.y},dist:function(a){return Math.sqrt(this.distSqr(a))},distSqr:function(a){var b=a.x-this.x,c=a.y-this.y;return b*b+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith:function(a){return this.angleWithSep(a.x,a.y)},angleWithSep:function(a,b){return Math.atan2(this.x*b-this.y*a,this.x*a+this.y*b)},_matMult:function(a){var b=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=b,this},_add:function(a){return this.x+=a.x,this.y+=a.y,this},_sub:function(a){return this.x-=a.x,this.y-=a.y,this},_mult:function(a){return this.x*=a,this.y*=a,this},_div:function(a){return this.x/=a,this.y/=a,this},_multByPoint:function(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint:function(a){return this.x/=a.x,this.y/=a.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var a=this.y;return this.y=this.x,this.x=-a,this},_rotate:function(a){var b=Math.cos(a),c=Math.sin(a),d=c*this.x+b*this.y;return this.x=b*this.x-c*this.y,this.y=d,this},_rotateAround:function(b,a){var c=Math.cos(b),d=Math.sin(b),e=a.y+d*(this.x-a.x)+c*(this.y-a.y);return this.x=a.x+c*(this.x-a.x)-d*(this.y-a.y),this.y=e,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},aG.convert=function(a){return a instanceof aG?a:Array.isArray(a)?new aG(a[0],a[1]):a};var s="undefined"!=typeof self?self:{},I="undefined"!=typeof Float32Array?Float32Array:Array;function aH(){var a=new I(9);return I!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function aI(a){return a[0]=1,a[1]=0,a[2]=0,a
This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
and paste the contents of this message in the report.
Thank you!
Filter Expression:
${JSON.stringify(c,null,2)}
`)}const f=b[`filter_${k}`],g=cN(d,f);let h=null;if("error"===g.result)throw Error(g.value.map(a=>`${a.key}: ${a.message}`).join(", "));h=(a,b,c)=>g.value.evaluate(a,b,{},c);let i=null,j=null;if(d!==c){const e=cN(c,f);if("error"===e.result)throw Error(e.value.map(a=>`${a.key}: ${a.message}`).join(", "));i=(a,b,c,d,f)=>e.value.evaluate(a,b,{},c,void 0,void 0,d,f),j=!f$(e.value.expression)}return{filter:h,dynamicFilter:i||void 0,needGeometry:gH(d),needFeature:!!j}}function gC(a){if(!Array.isArray(a))return a;const b=function(a){if(gF.has(a[0])){for(let b=1;b<a.length;b++)if(gE(a[b]))return!0}return a}(a);return!0===b?b:b.map(a=>gC(a))}function gD(a){let b=!1;const c=[];if("case"===a[0]){for(let d=1;d<a.length-1;d+=2)b=b||gE(a[d]),c.push(a[d+1]);c.push(a[a.length-1])}else if("match"===a[0]){b=b||gE(a[1]);for(let e=2;e<a.length-1;e+=2)c.push(a[e+1]);c.push(a[a.length-1])}else if("step"===a[0]){b=b||gE(a[1]);for(let f=1;f<a.length-1;f+=2)c.push(a[f+1])}b&&(a.length=0,a.push("any",...c));for(let g=1;g<a.length;g++)gD(a[g])}function gE(a){var c;if(!Array.isArray(a))return!1;if("pitch"===(c=a[0])||"distance-from-center"===c)return!0;for(let b=1;b<a.length;b++)if(gE(a[b]))return!0;return!1}const gF=new Set(["in","==","!=",">",">=","<","<=","to-boolean",]);function gG(a,b){return a<b?-1:a>b?1:0}function gH(a){if(!Array.isArray(a))return!1;if("within"===a[0])return!0;for(let b=1;b<a.length;b++)if(gH(a[b]))return!0;return!1}function gI(a){if(!a)return!0;const b=a[0];return a.length<=1?"any"!==b:"=="===b?gJ(a[1],a[2],"=="):"!="===b?gM(gJ(a[1],a[2],"==")):"<"===b||">"===b||"<="===b||">="===b?gJ(a[1],a[2],b):"any"===b?["any"].concat(a.slice(1).map(gI)):"all"===b?["all"].concat(a.slice(1).map(gI)):"none"===b?["all"].concat(a.slice(1).map(gI).map(gM)):"in"===b?gK(a[1],a.slice(2)):"!in"===b?gM(gK(a[1],a.slice(2))):"has"===b?gL(a[1]):"!has"===b?gM(gL(a[1])):"within"!==b||a}function gJ(c,a,b){switch(c){case"$type":return[`filter-type-${b}`,a];case"$id":return[`filter-id-${b}`,a];default:return[`filter-${b}`,c,a]}}function gK(b,a){if(0===a.length)return!1;switch(b){case"$type":return["filter-type-in",["literal",a]];case"$id":return["filter-id-in",["literal",a]];default:return a.length>200&&!a.some(b=>typeof b!=typeof a[0])?["filter-in-large",b,["literal",a.sort(gG)],]:["filter-in-small",b,["literal",a],]}}function gL(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function gM(a){return["!",a]}function a_(a){if(gA(fq(a.value))){const b=fq(a.layerType);return gy(ce({},a,{expressionContext:"filter",valueSpec:a.styleSpec[`filter_${b||"fill"}`]}))}return gN(a)}function gN(e){const a=e.value,c=e.key;if("array"!==gm(a))return[new cc(c,a,`array expected, ${gm(a)} found`),];const h=e.styleSpec;let d,b=[];if(a.length<1)return[new cc(c,a,"filter array must have at least 1 element"),];switch(b=b.concat(cV({key:`${c}[0]`,value:a[0],valueSpec:h.filter_operator,style:e.style,styleSpec:e.styleSpec})),fp(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===fp(a[1])&&b.push(new cc(c,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":3!==a.length&&b.push(new cc(c,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&"string"!==(d=gm(a[1]))&&b.push(new cc(`${c}[1]`,a[1],`string expected, ${d} found`));for(let f=2;f<a.length;f++)d=gm(a[f]),"$type"===fp(a[1])?b=b.concat(cV({key:`${c}[${f}]`,value:a[f],valueSpec:h.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==d&&"number"!==d&&"boolean"!==d&&b.push(new cc(`${c}[${f}]`,a[f],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let g=1;g<a.length;g++)b=b.concat(gN({key:`${c}[${g}]`,value:a[g],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":d=gm(a[1]),2!==a.length?b.push(new cc(c,a,`filter array for "${a[0]}" operator must have 2 elements`)):"string"!==d&&b.push(new cc(`${c}[1]`,a[1],`string expected, ${d} found`));break;case"within":d=gm(a[1]),2!==a.length?b.push(new cc(c,a,`filter array for "${a[0]}" operator mus
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(l[1])} }\`.`),];const k=[];return"symbol"===b.layerType&&("text-field"===c&&e&&!e.glyphs&&k.push(new cc(d,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===c&&gn(fq(a))&&"identity"===fp(a.type)&&k.push(new cc(d,a,'"text-font" does not support identity functions'))),k.concat(gR({key:b.key,value:a,valueSpec:h,style:e,styleSpec:f,expressionContext:"property",propertyType:i,propertyKey:c}))}function cW(a){return gO(a,"paint")}function cX(a){return gO(a,"layout")}function a0(d){let b=[];const a=d.value,c=d.key,g=d.style,l=d.styleSpec;a.type||a.ref||b.push(new cc(c,a,'either "type" or "ref" is required'));let e=fp(a.type);const m=fp(a.ref);if(a.id){const n=fp(a.id);for(let i=0;i<d.arrayIndex;i++){const k=g.layers[i];fp(k.id)===n&&b.push(new cc(c,a.id,`duplicate layer id "${a.id}", previously used at line ${k.id.__line__}`))}}if("ref"in a){let j;["type","source","source-layer","filter","layout",].forEach(d=>{d in a&&b.push(new cc(c,a[d],`"${d}" is prohibited for ref layers`))}),g.layers.forEach(a=>{fp(a.id)===m&&(j=a)}),j?j.ref?b.push(new cc(c,a.ref,"ref cannot reference another ref layer")):e=fp(j.type):b.push(new cc(c,a.ref,`ref layer "${m}" not found`))}else if("background"!==e&&"sky"!==e){if(a.source){const h=g.sources&&g.sources[a.source],f=h&&fp(h.type);h?"vector"===f&&"raster"===e?b.push(new cc(c,a.source,`layer "${a.id}" requires a raster source`)):"raster"===f&&"raster"!==e?b.push(new cc(c,a.source,`layer "${a.id}" requires a vector source`)):"vector"!==f||a["source-layer"]?"raster-dem"===f&&"hillshade"!==e?b.push(new cc(c,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===e&&a.paint&&a.paint["line-gradient"]&&("geojson"!==f||!h.lineMetrics)&&b.push(new cc(c,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):b.push(new cc(c,a,`layer "${a.id}" must specify a "source-layer"`)):b.push(new cc(c,a.source,`source "${a.source}" not found`))}else b.push(new cc(c,a,'missing required property "source"'))}return b=b.concat(cR({key:c,value:a,valueSpec:l.layer,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{"*":()=>[],type:()=>gR({key:`${c}.type`,value:a.type,valueSpec:l.layer.type,style:d.style,styleSpec:d.styleSpec,object:a,objectKey:"type"}),filter:a=>a_(ce({layerType:e},a)),layout:b=>cR({layer:a,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":a=>cX(ce({layerType:e},a))}}),paint:b=>cR({layer:a,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":a=>cW(ce({layerType:e},a))}})}}))}function cY(a){const b=a.value,d=a.key,c=gm(b);return"string"!==c?[new cc(d,b,`string expected, ${c} found`)]:[]}const gP={promoteId:function({key:b,value:a}){if("string"===gm(a))return cY({key:b,value:a});{const c=[];for(const d in a)c.push(...cY({key:`${b}.${d}`,value:a[d]}));return c}}};function a1(d){const a=d.value,b=d.key,c=d.styleSpec,e=d.style;if(!a.type)return[new cc(b,a,'"type" is required')];const i=fp(a.type);let f;switch(i){case"vector":case"raster":case"raster-dem":return cR({key:b,value:a,valueSpec:c[`source_${i.replace("-","_")}`],style:d.style,styleSpec:c,objectElementValidators:gP});case"geojson":if(f=cR({key:b,value:a,valueSpec:c.source_geojson,style:e,styleSpec:c,objectElementValidators:gP}),a.cluster)for(const g in a.clusterProperties){const[h,j]=a.clusterProperties[g],k="string"==typeof h?[h,["accumulated"],["get",g],]:h;f.push(...gy({key:`${b}.${g}.map`,value:j,expressionContext:"cluster-map"})),f.push(...gy({key:`${b}.${g}.reduce`,value:k,expressionContext:"cluster-reduce"}))}return f;case"video":return cR({key:b,value:a,valueSpec:c.source_video,style:e,styleSpec:c});case"image":return cR({key:b,value:a,valueSpec:c.source_image,style:e,styleSpec:c});case"canvas":return[new cc(b,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas"),];default:return cV({key:`${b}.type`,val
#ifndef HAS_UNIFORM_u_${a}
varying ${b} ${c} ${a};
#else
uniform ${b} ${c} u_${a};
#endif
`:`
#ifdef HAS_UNIFORM_u_${a}
${b} ${c} ${a} = u_${a};
#endif
`)),vertexSource:b=b.replace(e,(g,f,b,c,a)=>{const e="float"===c?"vec2":"vec4",d=a.match(/color/)?"color":e;return k[a]?"define"===f?`
#ifndef HAS_UNIFORM_u_${a}
uniform lowp float u_${a}_t;
attribute ${b} ${e} a_${a};
varying ${b} ${c} ${a};
#else
uniform ${b} ${c} u_${a};
#endif
`:"vec4"===d?`
#ifndef HAS_UNIFORM_u_${a}
${a} = a_${a};
#else
${b} ${c} ${a} = u_${a};
#endif
`:`
#ifndef HAS_UNIFORM_u_${a}
${a} = unpack_mix_${d}(a_${a}, u_${a}_t);
#else
${b} ${c} ${a} = u_${a};
#endif
`:"define"===f?`
#ifndef HAS_UNIFORM_u_${a}
uniform lowp float u_${a}_t;
attribute ${b} ${e} a_${a};
#else
uniform ${b} ${c} u_${a};
#endif
`:"vec4"===d?`
#ifndef HAS_UNIFORM_u_${a}
${b} ${c} ${a} = a_${a};
#else
${b} ${c} ${a} = u_${a};
#endif
`:`
#ifndef HAS_UNIFORM_u_${a}
${b} ${c} ${a} = unpack_mix_${d}(a_${a}, u_${a}_t);
#else
${b} ${c} ${a} = u_${a};
#endif
`}),staticAttributes:i,staticUniforms:a}}class bc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(f,h,i,b,a,j,c,d){this.context=f;let g=this.boundPaintVertexBuffers.length!==b.length;for(let e=0;!g&&e<b.length;e++)this.boundPaintVertexBuffers[e]!==b[e]&&(g=!0);f.extVertexArrayObject&&this.vao&&this.boundProgram===h&&this.boundLayoutVertexBuffer===i&&!g&&this.boundIndexBuffer===a&&this.boundVertexOffset===j&&this.boundDynamicVertexBuffer===c&&this.boundDynamicVertexBuffer2===d?(f.bindVertexArrayOES.set(this.vao),c&&c.bind(),a&&a.dynamicDraw&&a.bind(),d&&d.bind()):this.freshBind(h,i,b,a,j,c,d)}freshBind(a,g,h,i,f,c,d){let j;const l=a.numAttributes,e=this.context,b=e.gl;if(e.extVertexArrayObject)this.vao&&this.destroy(),this.vao=e.extVertexArrayObject.createVertexArrayOES(),e.bindVertexArrayOES.set(this.vao),j=0,this.boundProgram=a,this.boundLayoutVertexBuffer=g,this.boundPaintVertexBuffers=h,this.boundIndexBuffer=i,this.boundVertexOffset=f,this.boundDynamicVertexBuffer=c,this.boundDynamicVertexBuffer2=d;else{j=e.currentNumAttributes||0;for(let k=l;k<j;k++)b.disableVertexAttribArray(k)}for(const n of(g.enableAttributes(b,a),h))n.enableAttributes(b,a);for(const m of(c&&c.enableAttributes(b,a),d&&d.enableAttributes(b,a),g.bind(),g.setVertexAttribPointers(b,a,f),h))m.bind(),m.setVertexAttribPointers(b,a,f);c&&(c.bind(),c.setVertexAttribPointers(b,a,f)),i&&i.bind(),d&&(d.bind(),d.setVertexAttribPointers(b,a,f)),e.currentNumAttributes=l}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function bd(b,e,f,g,j,k,l){const c=b.context,d=c.gl,h=f.fbo;if(!h)return;b.prepareDrawTile(e);const i=b.useProgram("hillshade");c.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,h.colorAttachment.get());const m=((c,d,b,f)=>{const g=b.paint.get("hillshade-shadow-color"),h=b.paint.get("hillshade-highlight-color"),i=b.paint.get("hillshade-accent-color");let e=b.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===b.paint.get("hillshade-illumination-anchor")&&(e-=c.transform.angle);const j=!c.options.moving;return{u_matrix:f||c.transform.calculateProjMatrix(d.tileID.toUnwrapped(),j),u_image:0,u_latrange:function(e,b){const c=Math.pow(2,b.canonical.z),d=b.canonical.y;return[new a.MercatorCoordinate(0,d/c).toLngLat().lat,new a.MercatorCoordinate(0,(d+1)/c).toLngLat().lat,]}(0,d.tileID),u_light:[b.paint.get("hillshade-exaggeration"),e,],u_shadow:g,u_highlight:h,u_accent:i}})(b,f,g,b.terrain?e.projMatrix:null);b.prepareDrawProgram(c,i,e.toUnwrapped());const{tileBoundsBuffer:n,tileBoundsIndexBuffer:o,tileBoundsSegments:p}=b.getTileBoundsBuffers(f);i.draw(c,d.TRIANGLES,j,k,l,a.CullFaceMode.disabled,m,g.id,n,o,p)}function be(d,b,e){if(!b.needsDEMTextureUpload)return;const c=d.context,g=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),b.demTexture=b.demTexture||d.getTileTexture(e.stride);const f=e.getPixels();b.demTexture?b.demTexture.update(f,{premultiply:!1}):b.demTexture=new a.Texture(c,f,g.RGBA,{premultiply:!1}),b.needsDEMTextureUpload=!1}function bf(f,b,j,k,l,m){const c=f.context,d=c.gl;if(!b.dem)return;const g=b.dem;if(c.activeTexture.set(d.TEXTURE1),be(f,b,g),!b.demTexture)return;b.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const e=g.dim;c.activeTexture.set(d.TEXTURE0);let h=b.fbo;if(!h){const i=new a.Texture(c,{width:e,height:e,data:null},d.RGBA);i.bind(d.LINEAR,d.CLAMP_TO_EDGE),(h=b.fbo=c.createFramebuffer(e,e,!0)).colorAttachment.set(i.texture)}c.bindFramebuffer.set(h.framebuffer),c.viewport.set([0,0,e,e]);const{tileBoundsBuffer:n,tileBoundsIndexBuffer:o,tileBoundsSegments:p}=f.getMercatorTileBoundsBuffers();f.useProgram("hillshadePrepare").draw(c,d.TRIANGLES,k,l,m,a.CullFaceMode.disabled,((e,c)=>{const d=c.stride,b=a.create();return a.ortho(b,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(b,b,[0,-a.EXTENT,0]),{u_matrix:b,u_image:1,u_dimension:[d,d],u_zoom:e.overscaledZ,u_unpack:c.unpackVector}})(b.tileID,g),j.id,n,
This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const b=this.getScaledDemTileSize();this.sourceCache.update(c,b,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,e(),this._initializing=!0),e(),c.updateElevation(!f),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(c),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(a){this._findCoveringTileCache[a]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const b=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==b.efficiency&&a.warnOnce(`Terrain render cache efficiency is not optimal (${b.efficiency}%) and performance
may be affected negatively, consider placing all background, fill and line layers before layer
with id '${b.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(a){a.coord&&"source"===a.dataType?this._clearRenderCacheForTile(a.sourceCacheId,a.coord):"style"===a.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const a in this._style._sourceCaches)this._style._sourceCaches[a].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(a=>a.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const a=2*this.proxySourceCache.getSource().tileSize;return[a,a]}set useVertexMorphing(a){this._useVertexMorphing=a}updateTileBinding(h){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,d=this.painter.transform;this._initializing&&(this._initializing=0===d._centerAltitude&& -1===this.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(d.center),-1),this._emptyDEMTextureDirty=!this._initializing);const c=this.proxyCoords=i.getIds().map(b=>{const a=i.getTileByID(b).tileID;return a.projMatrix=d.calculateProjMatrix(a.toUnwrapped()),a});(function(d,b){const c=b.transform.pointCoordinate(b.transform.getCameraPoint()),e=new a.pointGeometry(c.x,c.y);d.sort((b,c)=>{if(c.overscaledZ-b.overscaledZ)return c.overscaledZ-b.overscaledZ;const f=new a.pointGeometry(b.canonical.x+(1<<b.canonical.z)*b.wrap,b.canonical.y),g=new a.pointGeometry(c.canonical.x+(1<<c.canonical.z)*c.wrap,c.canonical.y),d=e.mult(1<<b.canonical.z);return d.x-=.5,d.y-=.5,d.distSqr(f)-d.distSqr(g)})})(c,this.painter),this._previousZoom=d.zoom;const j=this.proxyToSource||{};this.proxyToSource={},c.forEach(a=>{this.proxyToSource[a.key]={}}),this.terrainTileForTile={};const k=this._style._sourceCaches;for(const e in k){const b=k[e];if(!b.used||(b!==this.sourceCache&&this.resetTileLookupCache(b.id),this._setupProxiedCoordsForOrtho(b,h[e],j),b.usedForTerrain))continue;const m=h[e];b.getSource().reparseOverscaled&&this._assignTerrainTiles(m)}this.proxiedCoords[i.id]=c.map(a=>new bq(a,a.key,this.orthoMatrix)),this._assignTerrainTiles(c),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(j),this.renderingToTexture=!1,this._updateTimestamp=a.exported.now();const l={};for(const n of(this._visibleDemTiles=[],this.proxyCoords)){const f=this.terrainTileForTile[n.key];if(!f)continue;const g=f.tileID.key;g in l||(this._visibleDemTiles.push(f),l[g]=g)}}_assignTerrainTiles(a){this._initializing||a.forEach(a=>{if(this.terrainTileForTile[a.key])return;const b=this._findTileCoveringTileID(a,this.sourceCache);b&&(this.terrainTileForTile[a.key]=b)})}_prepareDEMTextures(){const b=this.painter.context,d=b.gl;for(const e in this.terrainTileForTile){const a=this.terrainTileForTile[e],c=a.dem;c&&(!a.demTexture||a.needsDEMTextureUpload)&&(b.activeTexture.set(d.TEXTURE1),be(this.painter,a,c))}}_prepareDemTileUniforms(f,a,d,g){if(!a||null==a.demTexture)return!1;const b=f.tileID.canonical,c=Math.pow(2,a.tileID.canonical.z-b.z),e=g||"";return d[`u_dem_tl${e}`]=[b.x*c%1,b.y*c%1,],d[`u_dem_scale${e}`]=c,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const b=this.painter.context,c=b.gl;if(!this._emptyDepthBufferTexture){const d={width:1,height:1,data:new Uint8Array([255,255,255,255,])};this._emptyDepthBufferTexture=new a.Texture(b,d,c.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let a=0;const b=this._visibleDemTiles.reduce((b,c)=>{if(!c.dem)return b;const d=c.dem.tree.minimums[0];return d>0&&a++,b+d},0);return a