geoproject-app/public/site/plugins/map-editor/index.js

613 lines
822 KiB
JavaScript
Raw Normal View History

(function(){"use strict";function Rd(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var jo={exports:{}},Fd=jo.exports,zu;function Bd(){return zu||(zu=1,(function(c,x){(function(T,k){c.exports=k()})(Fd,(function(){var T,k,P;function O(o,te){if(!T)T=te;else if(!k)k=te;else{var H="var sharedChunk = {}; ("+T+")(sharedChunk); ("+k+")(sharedChunk);",ve={};T(ve),P=te(ve),typeof window<"u"&&(P.workerUrl=window.URL.createObjectURL(new Blob([H],{type:"text/javascript"})))}}O(["exports"],(function(o){function te(i,e,r,a){return new(r||(r=Promise))((function(l,d){function f(b){try{y(a.next(b))}catch(S){d(S)}}function m(b){try{y(a.throw(b))}catch(S){d(S)}}function y(b){var S;b.done?l(b.value):(S=b.value,S instanceof r?S:new r((function(C){C(S)}))).then(f,m)}y((a=a.apply(i,e||[])).next())}))}function H(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var ve=de;function de(i,e){this.x=i,this.y=e}de.prototype={clone:function(){return new de(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),a=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=a,this},_rotateAround:function(i,e){var r=Math.cos(i),a=Math.sin(i),l=e.y+a*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-a*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},de.convert=function(i){return i instanceof de?i:Array.isArray(i)?new de(i[0],i[1]):i};var ge=H(ve),Ue=rt;function rt(i,e,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(a-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=a}rt.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var d=this.sampleCurveDerivativeX(r);if(Math.abs(d)<1e-6)break;r-=l/d}var f=0,m=1;for(r=i,a=0;a<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));a++)i>l?f=r:m=r,r=.5*(m-f)+f;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Te=H(Ue);let Be,Ze;function He(){return Be==null&&(Be=typeof
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const M=[];return i.layerType==="symbol"&&(m==="text-field"&&l&&!l.glyphs&&M.push(new Ae(r,f,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&Nt(In(f))&&Zt(f.type)==="identity"&&M.push(new Ae(r,f,'"text-font" does not support identity functions'))),M.concat(a({key:i.key,value:f,valueSpec:S,style:l,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:m}))}function bl(i){return vl(i,"paint")}function wl(i){return vl(i,"layout")}function Sl(i){let e=[];const r=i.value,a=i.key,l=i.style,d=i.styleSpec;r.type||r.ref||e.push(new Ae(a,r,'either "type" or "ref" is required'));let f=Zt(r.type);const m=Zt(r.ref);if(r.id){const y=Zt(r.id);for(let b=0;b<i.arrayIndex;b++){const S=l.layers[b];Zt(S.id)===y&&e.push(new Ae(a,r.id,`duplicate layer id "${r.id}", previously used at line ${S.id.__line__}`))}}if("ref"in r){let y;["type","source","source-layer","filter","layout"].forEach((b=>{b in r&&e.push(new Ae(a,r[b],`"${b}" is prohibited for ref layers`))})),l.layers.forEach((b=>{Zt(b.id)===m&&(y=b)})),y?y.ref?e.push(new Ae(a,r.ref,"ref cannot reference another ref layer")):f=Zt(y.type):e.push(new Ae(a,r.ref,`ref layer "${m}" not found`))}else if(f!=="background")if(r.source){const y=l.sources&&l.sources[r.source],b=y&&Zt(y.type);y?b==="vector"&&f==="raster"?e.push(new Ae(a,r.source,`layer "${r.id}" requires a raster source`)):b!=="raster-dem"&&f==="hillshade"?e.push(new Ae(a,r.source,`layer "${r.id}" requires a raster-dem source`)):b==="raster"&&f!=="raster"?e.push(new Ae(a,r.source,`layer "${r.id}" requires a vector source`)):b!=="vector"||r["source-layer"]?b==="raster-dem"&&f!=="hillshade"?e.push(new Ae(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):f!=="line"||!r.paint||!r.paint["line-gradient"]||b==="geojson"&&y.lineMetrics||e.push(new Ae(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ae(a,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Ae(a,r.source,`source "${r.source}" not found`))}else e.push(new Ae(a,r,'missing required property "source"'));return e=e.concat(Bi({key:a,value:r,valueSpec:d.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${a}.type`,value:r.type,valueSpec:d.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:ea,layout:y=>Bi({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":b=>wl(Ar({layerType:f},b))}}),paint:y=>Bi({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":b=>bl(Ar({layerType:f},b))}})}})),e}function kr(i){const e=i.value,r=i.key,a=xt(e);return a!=="string"?[new Ae(r,e,`string expected, ${a} found`)]:[]}const Ia={promoteId:function({key:i,value:e}){if(xt(e)==="string")return kr({key:i,value:e});{const r=[];for(const a in e)r.push(...kr({key:`${i}.${a}`,value:e[a]}));return r}}};function Ki(i){const e=i.value,r=i.key,a=i.styleSpec,l=i.style,d=i.validateSpec;if(!e.type)return[new Ae(r,e,'"type" is required')];const f=Zt(e.type);let m;switch(f){case"vector":case"raster":return m=Bi({key:r,value:e,valueSpec:a[`source_${f.replace("-","_")}`],style:i.style,styleSpec:a,objectElementValidators:Ia,validateSpec:d}),m;case"raster-dem":return m=(function(y){var b;const S=(b=y.sourceName)!==null&&b!==void 0?b:"",C=y.value,M=y.styleSpec,L=M.source_raster_dem,R=y.style;let V=[];const G=xt(C);if(C===void 0)return V;if(G!=="object")return V.push(new Ae("source_raster_dem",C,`object expected, ${G} found`)),V;const K=Zt(C.encoding)==="custom",ne=["redFactor","greenFactor","blueFactor","baseShift"],J=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const se in C)!K&&ne.includes(se)?V.push(new Ae(se,C[se],`In "${S}": "${se}" is only valid when "encoding" is se
2026-02-06 09:21:14 +01:00
precision mediump float;
#else
2026-02-06 09:21:14 +01:00
#if !defined(lowp)
#define lowp
#endif
2026-02-06 09:21:14 +01:00
#if !defined(mediump)
#define mediump
#endif
2026-02-06 09:21:14 +01:00
#if !defined(highp)
#define highp
#endif
#endif
`,`#ifdef GL_ES
precision highp float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
#ifdef TERRAIN3D
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
#endif
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
#ifdef TERRAIN3D
highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
#else
return 1.0;
#endif
}float calculate_visibility(vec4 pos) {
#ifdef TERRAIN3D
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
#else
return 1.0;
#endif
}float ele(vec2 pos) {
#ifdef TERRAIN3D
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
#else
return 0.0;
#endif
}float get_elevation(vec2 pos) {
#ifdef TERRAIN3D
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
#else
return 0.0;
#endif
}`),background:yt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
2026-02-06 09:21:14 +01:00
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:yt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
2026-02-06 09:21:14 +01:00
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:yt(`varying vec3 v_data;varying float v_visibility;
2026-02-06 09:21:14 +01:00
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main(void) {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:yt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:yt(`uniform highp float u_intensity;varying vec2 v_extrude;
2026-02-06 09:21:14 +01:00
#pragma mapbox: define highp float weight
#define GAUSS_COEF 0.3989422804014327
void main() {
#pragma mapbox: initialize highp float weight
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#pragma mapbox: define mediump float radius
const highp float ZERO=1.0/255.0/16.0;
#define GAUSS_COEF 0.3989422804014327
void main(void) {
#pragma mapbox: initialize highp float weight
#pragma mapbox: initialize mediump float radius
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:yt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
2026-02-06 09:21:14 +01:00
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(0.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:yt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:yt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:yt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:yt(`#pragma mapbox: define highp vec4 color
2026-02-06 09:21:14 +01:00
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_FragColor=color*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:yt(`varying vec2 v_pos;
2026-02-06 09:21:14 +01:00
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:yt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
2026-02-06 09:21:14 +01:00
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:yt(`#ifdef GL_ES
2026-02-06 09:21:14 +01:00
precision highp float;
#endif
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:yt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
2026-02-06 09:21:14 +01:00
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
#ifdef TERRAIN3D
attribute vec2 a_centroid;
#endif
varying vec4 v_color;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define highp vec4 color
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize highp vec4 color
vec3 normal=a_normal_ed.xyz;
#ifdef TERRAIN3D
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
#else
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
#endif
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:yt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
2026-02-06 09:21:14 +01:00
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
#ifdef TERRAIN3D
attribute vec2 a_centroid;
#endif
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
#ifdef TERRAIN3D
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
#else
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
#endif
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
? a_pos
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:yt(`#ifdef GL_ES
2026-02-06 09:21:14 +01:00
precision highp float;
#endif
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:yt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
2026-02-06 09:21:14 +01:00
#define PI 3.141592653589793
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:yt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
2026-02-06 09:21:14 +01:00
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`),lineGradient:yt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
2026-02-06 09:21:14 +01:00
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`),linePattern:yt(`#ifdef GL_ES
2026-02-06 09:21:14 +01:00
precision highp float;
#endif
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:yt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
2026-02-06 09:21:14 +01:00
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:yt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
2026-02-06 09:21:14 +01:00
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:yt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
2026-02-06 09:21:14 +01:00
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:yt(`#define SDF_PX 8.0
2026-02-06 09:21:14 +01:00
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:yt(`#define SDF_PX 8.0
2026-02-06 09:21:14 +01:00
#define SDF 1.0
#define ICON 0.0
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:yt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Wn),terrainDepth:yt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Wn),terrainCoords:yt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Wn)};function yt(h,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),g=p?p.concat(u):u,_={};return{fragmentSource:h=h.replace(n,((v,w,I,A,D)=>(_[D]=!0,w==="define"?`
#ifndef HAS_UNIFORM_u_${D}
varying ${I} ${A} ${D};
2026-02-06 09:21:14 +01:00
#else
uniform ${I} ${A} u_${D};
2026-02-06 09:21:14 +01:00
#endif
`:`
#ifdef HAS_UNIFORM_u_${D}
${I} ${A} ${D} = u_${D};
#endif
`))),vertexSource:t=t.replace(n,((v,w,I,A,D)=>{const $=A==="float"?"vec2":"vec4",U=D.match(/color/)?"color":$;return _[D]?w==="define"?`
#ifndef HAS_UNIFORM_u_${D}
uniform lowp float u_${D}_t;
attribute ${I} ${$} a_${D};
varying ${I} ${A} ${D};
#else
uniform ${I} ${A} u_${D};
#endif
`:U==="vec4"?`
#ifndef HAS_UNIFORM_u_${D}
${D} = a_${D};
#else
${I} ${A} ${D} = u_${D};
#endif
2026-02-06 09:21:14 +01:00
`:`
#ifndef HAS_UNIFORM_u_${D}
${D} = unpack_mix_${U}(a_${D}, u_${D}_t);
#else
${I} ${A} ${D} = u_${D};
#endif
`:w==="define"?`
#ifndef HAS_UNIFORM_u_${D}
uniform lowp float u_${D}_t;
attribute ${I} ${$} a_${D};
#else
uniform ${I} ${A} u_${D};
#endif
`:U==="vec4"?`
#ifndef HAS_UNIFORM_u_${D}
${I} ${A} ${D} = a_${D};
#else
${I} ${A} ${D} = u_${D};
#endif
2026-02-06 09:21:14 +01:00
`:`
#ifndef HAS_UNIFORM_u_${D}
${I} ${A} ${D} = unpack_mix_${U}(a_${D}, u_${D}_t);
#else
${I} ${A} ${D} = u_${D};
#endif
`})),staticAttributes:s,staticUniforms:g}}class bn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,u,p,g,_,v,w){this.context=t;let I=this.boundPaintVertexBuffers.length!==u.length;for(let A=0;!I&&A<u.length;A++)this.boundPaintVertexBuffers[A]!==u[A]&&(I=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==s||I||this.boundIndexBuffer!==p||this.boundVertexOffset!==g||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==v||this.boundDynamicVertexBuffer3!==w?this.freshBind(n,s,u,p,g,_,v,w):(t.bindVertexArray.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),v&&v.bind(),w&&w.bind())}freshBind(t,n,s,u,p,g,_,v){const w=t.numAttributes,I=this.context,A=I.gl;this.vao&&this.destroy(),this.vao=I.createVertexArray(),I.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=u,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=g,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=v,n.enableAttributes(A,t);for(const D of s)D.enableAttributes(A,t);g&&g.enableAttributes(A,t),_&&_.enableAttributes(A,t),v&&v.enableAttributes(A,t),n.bind(),n.setVertexAttribPointers(A,t,p);for(const D of s)D.bind(),D.setVertexAttribPointers(A,t,p);g&&(g.bind(),g.setVertexAttribPointers(A,t,p)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(A,t,p)),v&&(v.bind(),v.setVertexAttribPointers(A,t,p)),I.currentNumAttributes=w}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}function qt(h){const t=[];for(let n=0;n<h.length;n++){if(h[n]===null)continue;const s=h[n].split(" ");t.push(s.pop())}return t}class Ha{constructor(t,n,s,u,p,g){const _=t.gl;this.program=_.createProgram();const v=qt(n.staticAttributes),w=s?s.getBinderAttributes():[],I=v.concat(w),A=Ot.prelude.staticUniforms?qt(Ot.prelude.staticUniforms):[],D=n.staticUniforms?qt(n.staticUniforms):[],$=s?s.getBinderUniforms():[],U=A.concat(D).concat($),q=[];for(const ue of U)q.indexOf(ue)<0&&q.push(ue);const N=s?s.defines():[];p&&N.push("#define OVERDRAW_INSPECTOR;"),g&&N.push("#define TERRAIN3D;");const ee=N.concat(Ot.prelude.fragmentSource,n.fragmentSource).join(`
`),oe=N.concat(Ot.prelude.vertexSource,n.vertexSource).join(`
`),X=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(X,ee),_.compileShader(X),!_.getShaderParameter(X,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(X)}`);_.attachShader(this.program,X);const ie=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(ie,oe),_.compileShader(ie),!_.getShaderParameter(ie,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(ie)}`);_.attachShader(this.program,ie),this.attributes={};const ce={};this.numAttributes=I.length;for(let ue=0;ue<this.numAttributes;ue++)I[ue]&&(_.bindAttribLocation(this.program,ue,I[ue]),this.attributes[I[ue]]=ue);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(ie),_.deleteShader(X);for(let ue=0;ue<q.length;ue++){const me=q[ue];if(me&&!ce[me]){const be=_.getUniformLocation(this.program,me);be&&(ce[me]=be)}}this.fixedUniforms=u(t,ce),this.terrainUniforms=((ue,me)=>({u_depth:new o.aL(ue,me.u_depth),u_terrain:new o.aL(ue,me.u_terrain),u_terrain_dim:new o.aM(ue,me.u_terrain_dim),u_terrain_matrix:new o.aN(ue,me.u_terrain_matrix),u_terrain_unpack:new o.aO(ue,me.u_terrain_unpack),u_terrain_exaggeration:new o.aM(ue,me.u_terrain_exaggeration)}))(t,ce),this.binderUniforms=s?s.getUniforms(t,ce):[]}draw(t,n,s,u,p,g,_,v,w,I,A,D,$,U,q,N,ee,oe){const X=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(u),t.setColorMode(p),t.setCullFace(g),v){t.activeTexture.set(X.TEXTURE2),X.bindTexture(X.TEXTURE_2D,v.depthTexture),t.activeTexture.set(X.TEXTURE3),X.bindTexture(X.TEXTURE_2D,v.texture);for(const ce in this.terrainUniforms)this.terrainUniforms[ce].set(v[ce])}for(const ce in this.fixedUniforms)this.fixedUniforms[ce].set(_[ce]);q&&q.setUniforms(t,this.binderUniforms,$,{zoom:U});let ie=0;switch(n){case X.LINES:ie=2;break;case X.TRIANGLES:ie=3;break;case X.LINE_STRIP:ie=1}for(const ce of D.get()){const ue=ce.vaos||(ce.vaos={});(ue[w]||(ue[w]=new bn)).bind(t,this,I,q?q.getPaintVertexBuffers():[],A,ce.vertexOffset,N,ee,oe),X.drawElements(n,ce.primitiveLength*ie,X.UNSIGNED_SHORT,ce.primitiveOffset*ie*2)}}}function ur(h,t,n){const s=1/Q(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,g=p*(n.tileID.canonical.x+n.tileID.wrap*u),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[g>>16,_>>16],u_pixel_coord_lower:[65535&g,65535&_]}}const Bs=(h,t,n,s)=>{const u=t.style.light,p=u.properties.get("position"),g=[p.x,p.y,p.z],_=(function(){var w=new o.A(9);return o.A!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1,w})();u.properties.get("anchor")==="viewport"&&(function(w,I){var A=Math.sin(I),D=Math.cos(I);w[0]=D,w[1]=A,w[2]=0,w[3]=-A,w[4]=D,w[5]=0,w[6]=0,w[7]=0,w[8]=1})(_,-t.transform.angle),(function(w,I,A){var D=I[0],$=I[1],U=I[2];w[0]=D*A[0]+$*A[3]+U*A[6],w[1]=D*A[1]+$*A[4]+U*A[7],w[2]=D*A[2]+$*A[5]+U*A[8]})(g,g,_);const v=u.properties.get("color");return{u_matrix:h,u_lightpos:g,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.b],u_vertical_gradient:+n,u_opacity:s}},nn=(h,t,n,s,u,p,g)=>o.e(Bs(h,t,n,s),ur(p,t,g),{u_height_factor:-Math.pow(2,u.overscaledZ)/g.tileSize/8}),tl=h=>({u_matrix:h}),Os=(h,t,n,s)=>o.e(tl(h),ur(n,t,s)),Wa=(h,t)=>({u_matrix:h,u_world:t}),Xa=(h,t,n,s,u)=>o.e(Os(h,t,n,s),{u_world:u}),an=(h,t,n,s)=>{const u=h.transform;let p,g;if(s.paint.get("circle-pitch-alignment")==="map"){const _=Q(n,1,u.zoom);p=!0,g=[_,_]}else p=!1,g=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:h
<div class="maplibregl-desktop-message">${h}</div>
2026-02-06 09:21:14 +01:00
<div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
`,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){H.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(h,t,n){this._canvas.width=Math.floor(n*h),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",(s=>{t={requestedAttributes:h},s&&(t.statusMessage=s.statusMessage,t.type=s.type)}),{once:!0});const n=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!n){const s="Failed to initialize WebGL";throw t?(t.message=s,new Error(JSON.stringify(t))):new Error(s)}this.painter=new In(n,this.transform),ve.testSupport(n)}_onCooperativeGesture(h,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")}),100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const u=this.transform.zoom,p=o.h.now();this.style.zoomHistory.update(u,p);const g=new o.a8(u,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=g.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),this.style.update(g)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new o.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.bg.mark(o.bh.load),this.fire(new o.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,o.bg.mark(o.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),
`)}async function Ef(c,x){const T=x.fontEmbedCSS!=null?x.fontEmbedCSS:x.skipFonts?null:await kf(c,x);if(T){const k=document.createElement("style"),P=document.createTextNode(T);k.appendChild(P),c.firstChild?c.insertBefore(k,c.firstChild):c.appendChild(k)}}async function Mf(c,x={}){const{width:T,height:k}=Ru(c,x),P=await Go(c,x,!0);return await Ef(P,x),await qu(P,x),Sf(P,x),await Gd(P,T,k)}async function Pf(c,x={}){const{width:T,height:k}=Ru(c,x),P=await Mf(c,x),O=await Zo(P),B=document.createElement("canvas"),o=B.getContext("2d"),te=x.pixelRatio||jd(),H=x.canvasWidth||T,ve=x.canvasHeight||k;return B.width=H*te,B.height=ve*te,x.skipAutoScale||qd(B),B.style.width=`${H}`,B.style.height=`${ve}`,x.backgroundColor&&(o.fillStyle=x.backgroundColor,o.fillRect(0,0,B.width,B.height)),o.drawImage(O,0,0,B.width,B.height),B}async function zf(c,x={}){return(await Pf(c,x)).toDataURL()}function Ho(c,x,T,k,P,O,B,o){var te=typeof c=="function"?c.options:c;return x&&(te.render=x,te.staticRenderFns=T,te._compiled=!0),O&&(te._scopeId="data-v-"+O),{exports:c,options:te}}const Df={props:{center:{type:Object,required:!0},zoom:{type:Number,required:!0},markers:{type:Array,default:()=>[]},selectedMarkerId:{type:String,default:null}},setup(c,{emit:x}){const T=Vue.ref(null),k=Vue.ref(null),P=Vue.ref(!0),O=Vue.ref(new Map),B=Vue.ref(!1);Vue.onMounted(async()=>{await Vue.nextTick(),o()}),Vue.onBeforeUnmount(()=>{k.value&&(k.value.remove(),k.value=null),O.value.clear()}),Vue.watch(()=>c.center,Te=>{if(k.value&&k.value.loaded()&&!B.value){const Be=k.value.getCenter();(Math.abs(Be.lat-Te.lat)>1e-5||Math.abs(Be.lng-Te.lon)>1e-5)&&k.value.setCenter([Te.lon,Te.lat])}},{deep:!0}),Vue.watch(()=>c.zoom,Te=>{if(k.value&&k.value.loaded()){const Be=k.value.getZoom();Math.abs(Be-Te)>.01&&k.value.setZoom(Te)}}),Vue.watch(()=>c.markers,()=>{te()},{deep:!0}),Vue.watch(()=>c.selectedMarkerId,Te=>{ve(Te)});function o(){if(!T.value){console.error("Map container not found");return}P.value=!0;try{k.value=new Du.Map({container:T.value,preserveDrawingBuffer:!0,style:{version:8,sources:{osm:{type:"raster",tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png","https://c.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}},layers:[{id:"osm",type:"raster",source:"osm",minzoom:0,maxzoom:19}]},center:[c.center.lon,c.center.lat],zoom:c.zoom}),k.value.on("load",()=>{P.value=!1,te()}),k.value.on("click",Te=>{if(!Te.originalEvent.target.closest(".custom-marker")){const He={lat:Te.lngLat.lat,lng:Te.lngLat.lng};x("map-click",He)}})}catch(Te){console.error("Error initializing map:",Te),P.value=!1}}function te(){!k.value||!k.value.loaded()||(O.value.forEach(({marker:Te})=>{Te&&Te.remove()}),O.value.clear(),c.markers&&Array.isArray(c.markers)&&c.markers.forEach((Te,Be)=>{H(Te,Be)}))}function H(Te,Be){if(!k.value||!Te||!Te.position)return;const Ze=document.createElement("div");if(Ze.className="custom-marker",Te.iconUrl){Ze.classList.add("custom-icon");const He=document.createElement("img");He.src=Te.iconUrl,He.className="marker-icon-image";const Et=Te.iconSize||40;He.style.width=`${Et}px`,He.style.height=`${Et}px`,c.selectedMarkerId===Te.id&&He.classList.add("selected"),Ze.appendChild(He)}else{const He=document.createElement("div");He.className="marker-inner",c.selectedMarkerId===Te.id&&He.classList.add("selected");const Et=document.createElement("div");Et.className="marker-number",Et.textContent=Be+1,He.appendChild(Et),Ze.appendChild(He)}try{const He=[Te.position.lon,Te.position.lat],Et=new Du.Marker({element:Ze,draggable:!0,anchor:"bottom"}).setLngLat(He).addTo(k.value);Et.on("dragstart",()=>{B.value=!0}),Et.on("dragend",()=>{const Di=Et.getLngLat();x("marker-moved",{markerId:Te.id,position:{lat:Di.lat,lng:Di.lng}}),setTimeout(()=>{B.value=!1},100)}),Ze.addEventListener("click",Di=>{Di.stopPropagation(),x("marker-click",Te.id)}),Ze.addEventListener("dblclick",Di=>{Di.stopPropagation(),x("marker-dblclick",Te.id)}),O.value.set(Te.id
2026-02-06 09:21:14 +01:00
`+c.mark.snippet),k+" "+T):k}function Ps(c,x){Error.call(this),this.name="YAMLException",this.reason=c,this.mark=x,this.message=Yu(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Ps.prototype=Object.create(Error.prototype),Ps.prototype.constructor=Ps,Ps.prototype.toString=function(x){return this.name+": "+Yu(this,x)};var Zi=Ps;function hc(c,x,T,k,P){var O="",B="",o=Math.floor(P/2)-1;return k-x>o&&(O=" ... ",x=k-o+O.length),T-k>o&&(B=" ...",T=k+o-B.length),{str:O+c.slice(x,T).replace(/\t/g,"→")+B,pos:k-x+O.length}}function pc(c,x){return pi.repeat(" ",x-c.length)+c}function lm(c,x){if(x=Object.create(x||null),!c.buffer)return null;x.maxLength||(x.maxLength=79),typeof x.indent!="number"&&(x.indent=1),typeof x.linesBefore!="number"&&(x.linesBefore=3),typeof x.linesAfter!="number"&&(x.linesAfter=2);for(var T=/\r?\n|\r|\0/g,k=[0],P=[],O,B=-1;O=T.exec(c.buffer);)P.push(O.index),k.push(O.index+O[0].length),c.position<=O.index&&B<0&&(B=k.length-2);B<0&&(B=k.length-1);var o="",te,H,ve=Math.min(c.line+x.linesAfter,P.length).toString().length,de=x.maxLength-(x.indent+ve+3);for(te=1;te<=x.linesBefore&&!(B-te<0);te++)H=hc(c.buffer,k[B-te],P[B-te],c.position-(k[B]-k[B-te]),de),o=pi.repeat(" ",x.indent)+pc((c.line-te+1).toString(),ve)+" | "+H.str+`
`+o;for(H=hc(c.buffer,k[B],P[B],c.position,de),o+=pi.repeat(" ",x.indent)+pc((c.line+1).toString(),ve)+" | "+H.str+`
`,o+=pi.repeat("-",x.indent+ve+3+H.pos)+`^
`,te=1;te<=x.linesAfter&&!(B+te>=P.length);te++)H=hc(c.buffer,k[B+te],P[B+te],c.position-(k[B]-k[B+te]),de),o+=pi.repeat(" ",x.indent)+pc((c.line+te+1).toString(),ve)+" | "+H.str+`
`;return o.replace(/\n$/,"")}var cm=lm,um=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],hm=["scalar","sequence","mapping"];function pm(c){var x={};return c!==null&&Object.keys(c).forEach(function(T){c[T].forEach(function(k){x[String(k)]=T})}),x}function dm(c,x){if(x=x||{},Object.keys(x).forEach(function(T){if(um.indexOf(T)===-1)throw new Zi('Unknown option "'+T+'" is met in definition of "'+c+'" YAML type.')}),this.options=x,this.tag=c,this.kind=x.kind||null,this.resolve=x.resolve||function(){return!0},this.construct=x.construct||function(T){return T},this.instanceOf=x.instanceOf||null,this.predicate=x.predicate||null,this.represent=x.represent||null,this.representName=x.representName||null,this.defaultStyle=x.defaultStyle||null,this.multi=x.multi||!1,this.styleAliases=pm(x.styleAliases||null),hm.indexOf(this.kind)===-1)throw new Zi('Unknown kind "'+this.kind+'" is specified for "'+c+'" YAML type.')}var Ti=dm;function Ju(c,x){var T=[];return c[x].forEach(function(k){var P=T.length;T.forEach(function(O,B){O.tag===k.tag&&O.kind===k.kind&&O.multi===k.multi&&(P=B)}),T[P]=k}),T}function fm(){var c={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},x,T;function k(P){P.multi?(c.multi[P.kind].push(P),c.multi.fallback.push(P)):c[P.kind][P.tag]=c.fallback[P.tag]=P}for(x=0,T=arguments.length;x<T;x+=1)arguments[x].forEach(k);return c}function dc(c){return this.extend(c)}dc.prototype.extend=function(x){var T=[],k=[];if(x instanceof Ti)k.push(x);else if(Array.isArray(x))k=k.concat(x);else if(x&&(Array.isArray(x.implicit)||Array.isArray(x.explicit)))x.implicit&&(T=T.concat(x.implicit)),x.explicit&&(k=k.concat(x.explicit));else throw new Zi("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");T.forEach(function(O){if(!(O instanceof Ti))throw new Zi("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(O.loadKind&&O.loadKind!=="scalar")throw new Zi("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(O.multi)throw new Zi("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),k.forEach(function(O){if(!(O instanceof Ti))throw new Zi("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var P=Object.create(dc.prototype);return P.implicit=(this.implicit||[]).concat(T),P.explicit=(this.explicit||[]).concat(k),P.compiledImplicit=Ju(P,"implicit"),P.compiledExplicit=Ju(P,"explicit"),P.compiledTypeMap=fm(P.compiledImplicit,P.compiledExplicit),P};var Qu=dc,eh=new Ti("tag:yaml.org,2002:str",{kind:"scalar",construct:function(c){return c!==null?c:""}}),th=new Ti("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(c){return c!==null?c:[]}}),ih=new Ti("tag:yaml.org,2002:map",{kind:"mapping",construct:function(c){return c!==null?c:{}}}),rh=new Qu({explicit:[eh,th,ih]});function mm(c){if(c===null)return!0;var x=c.length;return x===1&&c==="~"||x===4&&(c==="null"||c==="Null"||c==="NULL")}function gm(){return null}function _m(c){return c===null}var nh=new Ti("tag:yaml.org,2002:null",{kind:"scalar",resolve:mm,construct:gm,predicate:_m,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function ym(c){if(c===null)return!1;var x=c.length;return x===4&&(c==="true"||c==="True"||c==="TRUE")||x===5&&(c==="false"||c==="False"||c==="FALSE")}function xm(c){return c==="true"||c==="True"||c==="TRUE"}function vm(c){return Object.prototype.toString.call(c)==="[object Boolean]"}var ah=new Ti("tag:yaml.org,2002:bool",{kind:"scalar",resolve:ym,construct:xm,predicate:vm,represent:{lowercase:function(c){return c?"true":"false"},uppercase:function(c){return c?"TRUE":"FALSE"},camelcase:function(c){return c?"True":"False"}},defaultStyle:"lowercase"});functio
\r`;function Bm(c){if(c===null)return!1;var x,T,k=0,P=c.length,O=fc;for(T=0;T<P;T++)if(x=O.indexOf(c.charAt(T)),!(x>64)){if(x<0)return!1;k+=6}return k%8===0}function Om(c){var x,T,k=c.replace(/[\r\n=]/g,""),P=k.length,O=fc,B=0,o=[];for(x=0;x<P;x++)x%4===0&&x&&(o.push(B>>16&255),o.push(B>>8&255),o.push(B&255)),B=B<<6|O.indexOf(k.charAt(x));return T=P%4*6,T===0?(o.push(B>>16&255),o.push(B>>8&255),o.push(B&255)):T===18?(o.push(B>>10&255),o.push(B>>2&255)):T===12&&o.push(B>>4&255),new Uint8Array(o)}function Nm(c){var x="",T=0,k,P,O=c.length,B=fc;for(k=0;k<O;k++)k%3===0&&k&&(x+=B[T>>18&63],x+=B[T>>12&63],x+=B[T>>6&63],x+=B[T&63]),T=(T<<8)+c[k];return P=O%3,P===0?(x+=B[T>>18&63],x+=B[T>>12&63],x+=B[T>>6&63],x+=B[T&63]):P===2?(x+=B[T>>10&63],x+=B[T>>4&63],x+=B[T<<2&63],x+=B[64]):P===1&&(x+=B[T>>2&63],x+=B[T<<4&63],x+=B[64],x+=B[64]),x}function Vm(c){return Object.prototype.toString.call(c)==="[object Uint8Array]"}var fh=new Ti("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Bm,construct:Om,predicate:Vm,represent:Nm}),Um=Object.prototype.hasOwnProperty,$m=Object.prototype.toString;function jm(c){if(c===null)return!0;var x=[],T,k,P,O,B,o=c;for(T=0,k=o.length;T<k;T+=1){if(P=o[T],B=!1,$m.call(P)!=="[object Object]")return!1;for(O in P)if(Um.call(P,O))if(!B)B=!0;else return!1;if(!B)return!1;if(x.indexOf(O)===-1)x.push(O);else return!1}return!0}function qm(c){return c!==null?c:[]}var mh=new Ti("tag:yaml.org,2002:omap",{kind:"sequence",resolve:jm,construct:qm}),Zm=Object.prototype.toString;function Gm(c){if(c===null)return!0;var x,T,k,P,O,B=c;for(O=new Array(B.length),x=0,T=B.length;x<T;x+=1){if(k=B[x],Zm.call(k)!=="[object Object]"||(P=Object.keys(k),P.length!==1))return!1;O[x]=[P[0],k[P[0]]]}return!0}function Hm(c){if(c===null)return[];var x,T,k,P,O,B=c;for(O=new Array(B.length),x=0,T=B.length;x<T;x+=1)k=B[x],P=Object.keys(k),O[x]=[P[0],k[P[0]]];return O}var gh=new Ti("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Gm,construct:Hm}),Wm=Object.prototype.hasOwnProperty;function Xm(c){if(c===null)return!0;var x,T=c;for(x in T)if(Wm.call(T,x)&&T[x]!==null)return!1;return!0}function Km(c){return c!==null?c:{}}var _h=new Ti("tag:yaml.org,2002:set",{kind:"mapping",resolve:Xm,construct:Km}),mc=ch.extend({implicit:[ph,dh],explicit:[fh,mh,gh,_h]}),On=Object.prototype.hasOwnProperty,Wo=1,yh=2,xh=3,Xo=4,gc=1,Ym=2,vh=3,Jm=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Qm=/[\x85\u2028\u2029]/,eg=/[,\[\]\{\}]/,bh=/^(?:!|!!|![a-z\-]+!)$/i,wh=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Sh(c){return Object.prototype.toString.call(c)}function Xr(c){return c===10||c===13}function pa(c){return c===9||c===32}function nr(c){return c===9||c===32||c===10||c===13}function Na(c){return c===44||c===91||c===93||c===123||c===125}function tg(c){var x;return 48<=c&&c<=57?c-48:(x=c|32,97<=x&&x<=102?x-97+10:-1)}function ig(c){return c===120?2:c===117?4:c===85?8:0}function rg(c){return 48<=c&&c<=57?c-48:-1}function Th(c){return c===48?"\0":c===97?"\x07":c===98?"\b":c===116||c===9?" ":c===110?`
`:c===118?"\v":c===102?"\f":c===114?"\r":c===101?"\x1B":c===32?" ":c===34?'"':c===47?"/":c===92?"\\":c===78?"…":c===95?" ":c===76?"\u2028":c===80?"\u2029":""}function ng(c){return c<=65535?String.fromCharCode(c):String.fromCharCode((c-65536>>10)+55296,(c-65536&1023)+56320)}function Ih(c,x,T){x==="__proto__"?Object.defineProperty(c,x,{configurable:!0,enumerable:!0,writable:!0,value:T}):c[x]=T}for(var Ah=new Array(256),Ch=new Array(256),Va=0;Va<256;Va++)Ah[Va]=Th(Va)?1:0,Ch[Va]=Th(Va);function ag(c,x){this.input=c,this.filename=x.filename||null,this.schema=x.schema||mc,this.onWarning=x.onWarning||null,this.legacy=x.legacy||!1,this.json=x.json||!1,this.listener=x.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=c.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function kh(c,x){var T={name:c.filename,buffer:c.input.slice(0,-1),position:c.position,line:c.line,column:c.position-c.lineStart};return T.snippet=cm(T),new Zi(x,T)}function Qe(c,x){throw kh(c,x)}function Ko(c,x){c.onWarning&&c.onWarning.call(null,kh(c,x))}var Eh={YAML:function(x,T,k){var P,O,B;x.version!==null&&Qe(x,"duplication of %YAML directive"),k.length!==1&&Qe(x,"YAML directive accepts exactly one argument"),P=/^([0-9]+)\.([0-9]+)$/.exec(k[0]),P===null&&Qe(x,"ill-formed argument of the YAML directive"),O=parseInt(P[1],10),B=parseInt(P[2],10),O!==1&&Qe(x,"unacceptable YAML version of the document"),x.version=k[0],x.checkLineBreaks=B<2,B!==1&&B!==2&&Ko(x,"unsupported YAML version of the document")},TAG:function(x,T,k){var P,O;k.length!==2&&Qe(x,"TAG directive accepts exactly two arguments"),P=k[0],O=k[1],bh.test(P)||Qe(x,"ill-formed tag handle (first argument) of the TAG directive"),On.call(x.tagMap,P)&&Qe(x,'there is a previously declared suffix for "'+P+'" tag handle'),wh.test(O)||Qe(x,"ill-formed tag prefix (second argument) of the TAG directive");try{O=decodeURIComponent(O)}catch{Qe(x,"tag prefix is malformed: "+O)}x.tagMap[P]=O}};function Nn(c,x,T,k){var P,O,B,o;if(x<T){if(o=c.input.slice(x,T),k)for(P=0,O=o.length;P<O;P+=1)B=o.charCodeAt(P),B===9||32<=B&&B<=1114111||Qe(c,"expected valid JSON character");else Jm.test(o)&&Qe(c,"the stream contains non-printable characters");c.result+=o}}function Mh(c,x,T,k){var P,O,B,o;for(pi.isObject(T)||Qe(c,"cannot merge mappings; the provided source object is unacceptable"),P=Object.keys(T),B=0,o=P.length;B<o;B+=1)O=P[B],On.call(x,O)||(Ih(x,O,T[O]),k[O]=!0)}function Ua(c,x,T,k,P,O,B,o,te){var H,ve;if(Array.isArray(P))for(P=Array.prototype.slice.call(P),H=0,ve=P.length;H<ve;H+=1)Array.isArray(P[H])&&Qe(c,"nested arrays are not supported inside keys"),typeof P=="object"&&Sh(P[H])==="[object Object]"&&(P[H]="[object Object]");if(typeof P=="object"&&Sh(P)==="[object Object]"&&(P="[object Object]"),P=String(P),x===null&&(x={}),k==="tag:yaml.org,2002:merge")if(Array.isArray(O))for(H=0,ve=O.length;H<ve;H+=1)Mh(c,x,O[H],T);else Mh(c,x,O,T);else!c.json&&!On.call(T,P)&&On.call(x,P)&&(c.line=B||c.line,c.lineStart=o||c.lineStart,c.position=te||c.position,Qe(c,"duplicated mapping key")),Ih(x,P,O),delete T[P];return x}function _c(c){var x;x=c.input.charCodeAt(c.position),x===10?c.position++:x===13?(c.position++,c.input.charCodeAt(c.position)===10&&c.position++):Qe(c,"a line break is expected"),c.line+=1,c.lineStart=c.position,c.firstTabInLine=-1}function hi(c,x,T){for(var k=0,P=c.input.charCodeAt(c.position);P!==0;){for(;pa(P);)P===9&&c.firstTabInLine===-1&&(c.firstTabInLine=c.position),P=c.input.charCodeAt(++c.position);if(x&&P===35)do P=c.input.charCodeAt(++c.position);while(P!==10&&P!==13&&P!==0);if(Xr(P))for(_c(c),P=c.input.charCodeAt(c.position),k++,c.lineIndent=0;P===32;)c.lineIndent++,P=c.input.charCodeAt(++c.position);else break}return T!==-1&&k!==0&&c.lineIndent<T&&Ko(c,"deficient indentation"),k}function Yo(c){var x=c.position,T;return T=c.input.charCodeAt(x),!!((T===45||T===46)&&T===c.input.charCodeAt(x+1)&&T===c.input.charCodeAt(x+2)&&(x+=3,T=c.input.charCodeAt(x),T===0||nr(T)))}function yc(c,x
`,x-1))}function sg(c,x,T){var k,P,O,B,o,te,H,ve,de=c.kind,ge=c.result,Ue;if(Ue=c.input.charCodeAt(c.position),nr(Ue)||Na(Ue)||Ue===35||Ue===38||Ue===42||Ue===33||Ue===124||Ue===62||Ue===39||Ue===34||Ue===37||Ue===64||Ue===96||(Ue===63||Ue===45)&&(P=c.input.charCodeAt(c.position+1),nr(P)||T&&Na(P)))return!1;for(c.kind="scalar",c.result="",O=B=c.position,o=!1;Ue!==0;){if(Ue===58){if(P=c.input.charCodeAt(c.position+1),nr(P)||T&&Na(P))break}else if(Ue===35){if(k=c.input.charCodeAt(c.position-1),nr(k))break}else{if(c.position===c.lineStart&&Yo(c)||T&&Na(Ue))break;if(Xr(Ue))if(te=c.line,H=c.lineStart,ve=c.lineIndent,hi(c,!1,-1),c.lineIndent>=x){o=!0,Ue=c.input.charCodeAt(c.position);continue}else{c.position=B,c.line=te,c.lineStart=H,c.lineIndent=ve;break}}o&&(Nn(c,O,B,!1),yc(c,c.line-te),O=B=c.position,o=!1),pa(Ue)||(B=c.position+1),Ue=c.input.charCodeAt(++c.position)}return Nn(c,O,B,!1),c.result?!0:(c.kind=de,c.result=ge,!1)}function og(c,x){var T,k,P;if(T=c.input.charCodeAt(c.position),T!==39)return!1;for(c.kind="scalar",c.result="",c.position++,k=P=c.position;(T=c.input.charCodeAt(c.position))!==0;)if(T===39)if(Nn(c,k,c.position,!0),T=c.input.charCodeAt(++c.position),T===39)k=c.position,c.position++,P=c.position;else return!0;else Xr(T)?(Nn(c,k,P,!0),yc(c,hi(c,!1,x)),k=P=c.position):c.position===c.lineStart&&Yo(c)?Qe(c,"unexpected end of the document within a single quoted scalar"):(c.position++,P=c.position);Qe(c,"unexpected end of the stream within a single quoted scalar")}function lg(c,x){var T,k,P,O,B,o;if(o=c.input.charCodeAt(c.position),o!==34)return!1;for(c.kind="scalar",c.result="",c.position++,T=k=c.position;(o=c.input.charCodeAt(c.position))!==0;){if(o===34)return Nn(c,T,c.position,!0),c.position++,!0;if(o===92){if(Nn(c,T,c.position,!0),o=c.input.charCodeAt(++c.position),Xr(o))hi(c,!1,x);else if(o<256&&Ah[o])c.result+=Ch[o],c.position++;else if((B=ig(o))>0){for(P=B,O=0;P>0;P--)o=c.input.charCodeAt(++c.position),(B=tg(o))>=0?O=(O<<4)+B:Qe(c,"expected hexadecimal character");c.result+=ng(O),c.position++}else Qe(c,"unknown escape sequence");T=k=c.position}else Xr(o)?(Nn(c,T,k,!0),yc(c,hi(c,!1,x)),T=k=c.position):c.position===c.lineStart&&Yo(c)?Qe(c,"unexpected end of the document within a double quoted scalar"):(c.position++,k=c.position)}Qe(c,"unexpected end of the stream within a double quoted scalar")}function cg(c,x){var T=!0,k,P,O,B=c.tag,o,te=c.anchor,H,ve,de,ge,Ue,rt=Object.create(null),Te,Be,Ze,He;if(He=c.input.charCodeAt(c.position),He===91)ve=93,Ue=!1,o=[];else if(He===123)ve=125,Ue=!0,o={};else return!1;for(c.anchor!==null&&(c.anchorMap[c.anchor]=o),He=c.input.charCodeAt(++c.position);He!==0;){if(hi(c,!0,x),He=c.input.charCodeAt(c.position),He===ve)return c.position++,c.tag=B,c.anchor=te,c.kind=Ue?"mapping":"sequence",c.result=o,!0;T?He===44&&Qe(c,"expected the node content, but found ','"):Qe(c,"missed comma between flow collection entries"),Be=Te=Ze=null,de=ge=!1,He===63&&(H=c.input.charCodeAt(c.position+1),nr(H)&&(de=ge=!0,c.position++,hi(c,!0,x))),k=c.line,P=c.lineStart,O=c.position,$a(c,x,Wo,!1,!0),Be=c.tag,Te=c.result,hi(c,!0,x),He=c.input.charCodeAt(c.position),(ge||c.line===k)&&He===58&&(de=!0,He=c.input.charCodeAt(++c.position),hi(c,!0,x),$a(c,x,Wo,!1,!0),Ze=c.result),Ue?Ua(c,o,rt,Be,Te,Ze,k,P,O):de?o.push(Ua(c,null,rt,Be,Te,Ze,k,P,O)):o.push(Te),hi(c,!0,x),He=c.input.charCodeAt(c.position),He===44?(T=!0,He=c.input.charCodeAt(++c.position)):T=!1}Qe(c,"unexpected end of the stream within a flow collection")}function ug(c,x){var T,k,P=gc,O=!1,B=!1,o=x,te=0,H=!1,ve,de;if(de=c.input.charCodeAt(c.position),de===124)k=!1;else if(de===62)k=!0;else return!1;for(c.kind="scalar",c.result="";de!==0;)if(de=c.input.charCodeAt(++c.position),de===43||de===45)gc===P?P=de===43?vh:Ym:Qe(c,"repeat of a chomping mode identifier");else if((ve=rg(de))>=0)ve===0?Qe(c,"bad explicit indentation width of a block scalar; it cannot be less than one"):B?Qe(c,"repeat of an indentation width identifier"):(o=x+ve-1,B=!0);else break;if(pa(de)){do de=c.input.charCodeAt(++c.position);while(pa(de));if(de===35)do de=c.input.charCod
`,O?1+te:te):P===gc&&O&&(c.result+=`
`);break}for(k?pa(de)?(H=!0,c.result+=pi.repeat(`
`,O?1+te:te)):H?(H=!1,c.result+=pi.repeat(`
`,te+1)):te===0?O&&(c.result+=" "):c.result+=pi.repeat(`
`,te):c.result+=pi.repeat(`
`,O?1+te:te),O=!0,B=!0,te=0,T=c.position;!Xr(de)&&de!==0;)de=c.input.charCodeAt(++c.position);Nn(c,T,c.position,!1)}return!0}function Ph(c,x){var T,k=c.tag,P=c.anchor,O=[],B,o=!1,te;if(c.firstTabInLine!==-1)return!1;for(c.anchor!==null&&(c.anchorMap[c.anchor]=O),te=c.input.charCodeAt(c.position);te!==0&&(c.firstTabInLine!==-1&&(c.position=c.firstTabInLine,Qe(c,"tab characters must not be used in indentation")),!(te!==45||(B=c.input.charCodeAt(c.position+1),!nr(B))));){if(o=!0,c.position++,hi(c,!0,-1)&&c.lineIndent<=x){O.push(null),te=c.input.charCodeAt(c.position);continue}if(T=c.line,$a(c,x,xh,!1,!0),O.push(c.result),hi(c,!0,-1),te=c.input.charCodeAt(c.position),(c.line===T||c.lineIndent>x)&&te!==0)Qe(c,"bad indentation of a sequence entry");else if(c.lineIndent<x)break}return o?(c.tag=k,c.anchor=P,c.kind="sequence",c.result=O,!0):!1}function hg(c,x,T){var k,P,O,B,o,te,H=c.tag,ve=c.anchor,de={},ge=Object.create(null),Ue=null,rt=null,Te=null,Be=!1,Ze=!1,He;if(c.firstTabInLine!==-1)return!1;for(c.anchor!==null&&(c.anchorMap[c.anchor]=de),He=c.input.charCodeAt(c.position);He!==0;){if(!Be&&c.firstTabInLine!==-1&&(c.position=c.firstTabInLine,Qe(c,"tab characters must not be used in indentation")),k=c.input.charCodeAt(c.position+1),O=c.line,(He===63||He===58)&&nr(k))He===63?(Be&&(Ua(c,de,ge,Ue,rt,null,B,o,te),Ue=rt=Te=null),Ze=!0,Be=!0,P=!0):Be?(Be=!1,P=!0):Qe(c,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),c.position+=1,He=k;else{if(B=c.line,o=c.lineStart,te=c.position,!$a(c,T,yh,!1,!0))break;if(c.line===O){for(He=c.input.charCodeAt(c.position);pa(He);)He=c.input.charCodeAt(++c.position);if(He===58)He=c.input.charCodeAt(++c.position),nr(He)||Qe(c,"a whitespace character is expected after the key-value separator within a block mapping"),Be&&(Ua(c,de,ge,Ue,rt,null,B,o,te),Ue=rt=Te=null),Ze=!0,Be=!1,P=!1,Ue=c.tag,rt=c.result;else if(Ze)Qe(c,"can not read an implicit mapping pair; a colon is missed");else return c.tag=H,c.anchor=ve,!0}else if(Ze)Qe(c,"can not read a block mapping entry; a multiline key may not be an implicit key");else return c.tag=H,c.anchor=ve,!0}if((c.line===O||c.lineIndent>x)&&(Be&&(B=c.line,o=c.lineStart,te=c.position),$a(c,x,Xo,!0,P)&&(Be?rt=c.result:Te=c.result),Be||(Ua(c,de,ge,Ue,rt,Te,B,o,te),Ue=rt=Te=null),hi(c,!0,-1),He=c.input.charCodeAt(c.position)),(c.line===O||c.lineIndent>x)&&He!==0)Qe(c,"bad indentation of a mapping entry");else if(c.lineIndent<x)break}return Be&&Ua(c,de,ge,Ue,rt,null,B,o,te),Ze&&(c.tag=H,c.anchor=ve,c.kind="mapping",c.result=de),Ze}function pg(c){var x,T=!1,k=!1,P,O,B;if(B=c.input.charCodeAt(c.position),B!==33)return!1;if(c.tag!==null&&Qe(c,"duplication of a tag property"),B=c.input.charCodeAt(++c.position),B===60?(T=!0,B=c.input.charCodeAt(++c.position)):B===33?(k=!0,P="!!",B=c.input.charCodeAt(++c.position)):P="!",x=c.position,T){do B=c.input.charCodeAt(++c.position);while(B!==0&&B!==62);c.position<c.length?(O=c.input.slice(x,c.position),B=c.input.charCodeAt(++c.position)):Qe(c,"unexpected end of the stream within a verbatim tag")}else{for(;B!==0&&!nr(B);)B===33&&(k?Qe(c,"tag suffix cannot contain exclamation marks"):(P=c.input.slice(x-1,c.position+1),bh.test(P)||Qe(c,"named tag handle cannot contain such characters"),k=!0,x=c.position+1)),B=c.input.charCodeAt(++c.position);O=c.input.slice(x,c.position),eg.test(O)&&Qe(c,"tag suffix cannot contain flow indicator characters")}O&&!wh.test(O)&&Qe(c,"tag name cannot contain such characters: "+O);try{O=decodeURIComponent(O)}catch{Qe(c,"tag name is malformed: "+O)}return T?c.tag=O:On.call(c.tagMap,P)?c.tag=c.tagMap[P]+O:P==="!"?c.tag="!"+O:P==="!!"?c.tag="tag:yaml.org,2002:"+O:Qe(c,'undeclared tag handle "'+P+'"'),!0}function dg(c){var x,T;if(T=c.input.charCodeAt(c.position),T!==38)return!1;for(c.anchor!==null&&Qe(c,"duplication of an anchor property"),T=c.input.charCodeAt(++c.position),x=c.position;T!==0&&!nr(T)&&!Na(T);)T=c.input.charCodeAt(++c.position);return c.position===x&&Qe(c,"name of an anchor node must contain at least one character"),c.anchor=c.input.slice(x,c.positi
`),c.charCodeAt(0)===65279&&(c=c.slice(1)));var T=new ag(c,x),k=c.indexOf("\0");for(k!==-1&&(T.position=k,Qe(T,"null byte is not allowed in input")),T.input+="\0";T.input.charCodeAt(T.position)===32;)T.lineIndent+=1,T.position+=1;for(;T.position<T.length-1;)mg(T);return T.documents}function gg(c,x,T){x!==null&&typeof x=="object"&&typeof T>"u"&&(T=x,x=null);var k=zh(c,T);if(typeof x!="function")return k;for(var P=0,O=k.length;P<O;P+=1)x(k[P])}function _g(c,x){var T=zh(c,x);if(T.length!==0){if(T.length===1)return T[0];throw new Zi("expected a single document in the stream, but found more")}}var yg=gg,xg=_g,Dh={loadAll:yg,load:xg},Lh=Object.prototype.toString,Rh=Object.prototype.hasOwnProperty,xc=65279,vg=9,zs=10,bg=13,wg=32,Sg=33,Tg=34,vc=35,Ig=37,Ag=38,Cg=39,kg=42,Fh=44,Eg=45,Jo=58,Mg=61,Pg=62,zg=63,Dg=64,Bh=91,Oh=93,Lg=96,Nh=123,Rg=124,Vh=125,zi={};zi[0]="\\0",zi[7]="\\a",zi[8]="\\b",zi[9]="\\t",zi[10]="\\n",zi[11]="\\v",zi[12]="\\f",zi[13]="\\r",zi[27]="\\e",zi[34]='\\"',zi[92]="\\\\",zi[133]="\\N",zi[160]="\\_",zi[8232]="\\L",zi[8233]="\\P";var Fg=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Bg=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Og(c,x){var T,k,P,O,B,o,te;if(x===null)return{};for(T={},k=Object.keys(x),P=0,O=k.length;P<O;P+=1)B=k[P],o=String(x[B]),B.slice(0,2)==="!!"&&(B="tag:yaml.org,2002:"+B.slice(2)),te=c.compiledTypeMap.fallback[B],te&&Rh.call(te.styleAliases,o)&&(o=te.styleAliases[o]),T[B]=o;return T}function Ng(c){var x,T,k;if(x=c.toString(16).toUpperCase(),c<=255)T="x",k=2;else if(c<=65535)T="u",k=4;else if(c<=4294967295)T="U",k=8;else throw new Zi("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+T+pi.repeat("0",k-x.length)+x}var Vg=1,Ds=2;function Ug(c){this.schema=c.schema||mc,this.indent=Math.max(1,c.indent||2),this.noArrayIndent=c.noArrayIndent||!1,this.skipInvalid=c.skipInvalid||!1,this.flowLevel=pi.isNothing(c.flowLevel)?-1:c.flowLevel,this.styleMap=Og(this.schema,c.styles||null),this.sortKeys=c.sortKeys||!1,this.lineWidth=c.lineWidth||80,this.noRefs=c.noRefs||!1,this.noCompatMode=c.noCompatMode||!1,this.condenseFlow=c.condenseFlow||!1,this.quotingType=c.quotingType==='"'?Ds:Vg,this.forceQuotes=c.forceQuotes||!1,this.replacer=typeof c.replacer=="function"?c.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Uh(c,x){for(var T=pi.repeat(" ",x),k=0,P=-1,O="",B,o=c.length;k<o;)P=c.indexOf(`
`,k),P===-1?(B=c.slice(k),k=o):(B=c.slice(k,P+1),k=P+1),B.length&&B!==`
`&&(O+=T),O+=B;return O}function bc(c,x){return`
`+pi.repeat(" ",c.indent*x)}function $g(c,x){var T,k,P;for(T=0,k=c.implicitTypes.length;T<k;T+=1)if(P=c.implicitTypes[T],P.resolve(x))return!0;return!1}function Qo(c){return c===wg||c===vg}function Ls(c){return 32<=c&&c<=126||161<=c&&c<=55295&&c!==8232&&c!==8233||57344<=c&&c<=65533&&c!==xc||65536<=c&&c<=1114111}function $h(c){return Ls(c)&&c!==xc&&c!==bg&&c!==zs}function jh(c,x,T){var k=$h(c),P=k&&!Qo(c);return(T?k:k&&c!==Fh&&c!==Bh&&c!==Oh&&c!==Nh&&c!==Vh)&&c!==vc&&!(x===Jo&&!P)||$h(x)&&!Qo(x)&&c===vc||x===Jo&&P}function jg(c){return Ls(c)&&c!==xc&&!Qo(c)&&c!==Eg&&c!==zg&&c!==Jo&&c!==Fh&&c!==Bh&&c!==Oh&&c!==Nh&&c!==Vh&&c!==vc&&c!==Ag&&c!==kg&&c!==Sg&&c!==Rg&&c!==Mg&&c!==Pg&&c!==Cg&&c!==Tg&&c!==Ig&&c!==Dg&&c!==Lg}function qg(c){return!Qo(c)&&c!==Jo}function Rs(c,x){var T=c.charCodeAt(x),k;return T>=55296&&T<=56319&&x+1<c.length&&(k=c.charCodeAt(x+1),k>=56320&&k<=57343)?(T-55296)*1024+k-56320+65536:T}function qh(c){var x=/^\n* /;return x.test(c)}var Zh=1,wc=2,Gh=3,Hh=4,ja=5;function Zg(c,x,T,k,P,O,B,o){var te,H=0,ve=null,de=!1,ge=!1,Ue=k!==-1,rt=-1,Te=jg(Rs(c,0))&&qg(Rs(c,c.length-1));if(x||B)for(te=0;te<c.length;H>=65536?te+=2:te++){if(H=Rs(c,te),!Ls(H))return ja;Te=Te&&jh(H,ve,o),ve=H}else{for(te=0;te<c.length;H>=65536?te+=2:te++){if(H=Rs(c,te),H===zs)de=!0,Ue&&(ge=ge||te-rt-1>k&&c[rt+1]!==" ",rt=te);else if(!Ls(H))return ja;Te=Te&&jh(H,ve,o),ve=H}ge=ge||Ue&&te-rt-1>k&&c[rt+1]!==" "}return!de&&!ge?Te&&!B&&!P(c)?Zh:O===Ds?ja:wc:T>9&&qh(c)?ja:B?O===Ds?ja:wc:ge?Hh:Gh}function Gg(c,x,T,k,P){c.dump=(function(){if(x.length===0)return c.quotingType===Ds?'""':"''";if(!c.noCompatMode&&(Fg.indexOf(x)!==-1||Bg.test(x)))return c.quotingType===Ds?'"'+x+'"':"'"+x+"'";var O=c.indent*Math.max(1,T),B=c.lineWidth===-1?-1:Math.max(Math.min(c.lineWidth,40),c.lineWidth-O),o=k||c.flowLevel>-1&&T>=c.flowLevel;function te(H){return $g(c,H)}switch(Zg(x,o,c.indent,B,te,c.quotingType,c.forceQuotes&&!k,P)){case Zh:return x;case wc:return"'"+x.replace(/'/g,"''")+"'";case Gh:return"|"+Wh(x,c.indent)+Xh(Uh(x,O));case Hh:return">"+Wh(x,c.indent)+Xh(Uh(Hg(x,B),O));case ja:return'"'+Wg(x)+'"';default:throw new Zi("impossible error: invalid scalar style")}})()}function Wh(c,x){var T=qh(c)?String(x):"",k=c[c.length-1]===`
`,P=k&&(c[c.length-2]===`
`||c===`
`),O=P?"+":k?"":"-";return T+O+`
`}function Xh(c){return c[c.length-1]===`
`?c.slice(0,-1):c}function Hg(c,x){for(var T=/(\n+)([^\n]*)/g,k=(function(){var H=c.indexOf(`
`);return H=H!==-1?H:c.length,T.lastIndex=H,Kh(c.slice(0,H),x)})(),P=c[0]===`
`||c[0]===" ",O,B;B=T.exec(c);){var o=B[1],te=B[2];O=te[0]===" ",k+=o+(!P&&!O&&te!==""?`
`:"")+Kh(te,x),P=O}return k}function Kh(c,x){if(c===""||c[0]===" ")return c;for(var T=/ [^ ]/g,k,P=0,O,B=0,o=0,te="";k=T.exec(c);)o=k.index,o-P>x&&(O=B>P?B:o,te+=`
`+c.slice(P,O),P=O+1),B=o;return te+=`
`,c.length-P>x&&B>P?te+=c.slice(P,B)+`
`+c.slice(B+1):te+=c.slice(P),te.slice(1)}function Wg(c){for(var x="",T=0,k,P=0;P<c.length;T>=65536?P+=2:P++)T=Rs(c,P),k=zi[T],!k&&Ls(T)?(x+=c[P],T>=65536&&(x+=c[P+1])):x+=k||Ng(T);return x}function Xg(c,x,T){var k="",P=c.tag,O,B,o;for(O=0,B=T.length;O<B;O+=1)o=T[O],c.replacer&&(o=c.replacer.call(T,String(O),o)),(fn(c,x,o,!1,!1)||typeof o>"u"&&fn(c,x,null,!1,!1))&&(k!==""&&(k+=","+(c.condenseFlow?"":" ")),k+=c.dump);c.tag=P,c.dump="["+k+"]"}function Yh(c,x,T,k){var P="",O=c.tag,B,o,te;for(B=0,o=T.length;B<o;B+=1)te=T[B],c.replacer&&(te=c.replacer.call(T,String(B),te)),(fn(c,x+1,te,!0,!0,!1,!0)||typeof te>"u"&&fn(c,x+1,null,!0,!0,!1,!0))&&((!k||P!=="")&&(P+=bc(c,x)),c.dump&&zs===c.dump.charCodeAt(0)?P+="-":P+="- ",P+=c.dump);c.tag=O,c.dump=P||"[]"}function Kg(c,x,T){var k="",P=c.tag,O=Object.keys(T),B,o,te,H,ve;for(B=0,o=O.length;B<o;B+=1)ve="",k!==""&&(ve+=", "),c.condenseFlow&&(ve+='"'),te=O[B],H=T[te],c.replacer&&(H=c.replacer.call(T,te,H)),fn(c,x,te,!1,!1)&&(c.dump.length>1024&&(ve+="? "),ve+=c.dump+(c.condenseFlow?'"':"")+":"+(c.condenseFlow?"":" "),fn(c,x,H,!1,!1)&&(ve+=c.dump,k+=ve));c.tag=P,c.dump="{"+k+"}"}function Yg(c,x,T,k){var P="",O=c.tag,B=Object.keys(T),o,te,H,ve,de,ge;if(c.sortKeys===!0)B.sort();else if(typeof c.sortKeys=="function")B.sort(c.sortKeys);else if(c.sortKeys)throw new Zi("sortKeys must be a boolean or a function");for(o=0,te=B.length;o<te;o+=1)ge="",(!k||P!=="")&&(ge+=bc(c,x)),H=B[o],ve=T[H],c.replacer&&(ve=c.replacer.call(T,H,ve)),fn(c,x+1,H,!0,!0,!0)&&(de=c.tag!==null&&c.tag!=="?"||c.dump&&c.dump.length>1024,de&&(c.dump&&zs===c.dump.charCodeAt(0)?ge+="?":ge+="? "),ge+=c.dump,de&&(ge+=bc(c,x)),fn(c,x+1,ve,!0,de)&&(c.dump&&zs===c.dump.charCodeAt(0)?ge+=":":ge+=": ",ge+=c.dump,P+=ge));c.tag=O,c.dump=P||"{}"}function Jh(c,x,T){var k,P,O,B,o,te;for(P=T?c.explicitTypes:c.implicitTypes,O=0,B=P.length;O<B;O+=1)if(o=P[O],(o.instanceOf||o.predicate)&&(!o.instanceOf||typeof x=="object"&&x instanceof o.instanceOf)&&(!o.predicate||o.predicate(x))){if(T?o.multi&&o.representName?c.tag=o.representName(x):c.tag=o.tag:c.tag="?",o.represent){if(te=c.styleMap[o.tag]||o.defaultStyle,Lh.call(o.represent)==="[object Function]")k=o.represent(x,te);else if(Rh.call(o.represent,te))k=o.represent[te](x,te);else throw new Zi("!<"+o.tag+'> tag resolver accepts not "'+te+'" style');c.dump=k}return!0}return!1}function fn(c,x,T,k,P,O,B){c.tag=null,c.dump=T,Jh(c,T,!1)||Jh(c,T,!0);var o=Lh.call(c.dump),te=k,H;k&&(k=c.flowLevel<0||c.flowLevel>x);var ve=o==="[object Object]"||o==="[object Array]",de,ge;if(ve&&(de=c.duplicates.indexOf(T),ge=de!==-1),(c.tag!==null&&c.tag!=="?"||ge||c.indent!==2&&x>0)&&(P=!1),ge&&c.usedDuplicates[de])c.dump="*ref_"+de;else{if(ve&&ge&&!c.usedDuplicates[de]&&(c.usedDuplicates[de]=!0),o==="[object Object]")k&&Object.keys(c.dump).length!==0?(Yg(c,x,c.dump,P),ge&&(c.dump="&ref_"+de+c.dump)):(Kg(c,x,c.dump),ge&&(c.dump="&ref_"+de+" "+c.dump));else if(o==="[object Array]")k&&c.dump.length!==0?(c.noArrayIndent&&!B&&x>0?Yh(c,x-1,c.dump,P):Yh(c,x,c.dump,P),ge&&(c.dump="&ref_"+de+c.dump)):(Xg(c,x,c.dump),ge&&(c.dump="&ref_"+de+" "+c.dump));else if(o==="[object String]")c.tag!=="?"&&Gg(c,c.dump,x,O,te);else{if(o==="[object Undefined]")return!1;if(c.skipInvalid)return!1;throw new Zi("unacceptable kind of an object to dump "+o)}c.tag!==null&&c.tag!=="?"&&(H=encodeURI(c.tag[0]==="!"?c.tag.slice(1):c.tag).replace(/!/g,"%21"),c.tag[0]==="!"?H="!"+H:H.slice(0,18)==="tag:yaml.org,2002:"?H="!!"+H.slice(18):H="!<"+H+">",c.dump=H+" "+c.dump)}return!0}function Jg(c,x){var T=[],k=[],P,O;for(Sc(c,T,k),P=0,O=k.length;P<O;P+=1)x.duplicates.push(T[k[P]]);x.usedDuplicates=new Array(O)}function Sc(c,x,T){var k,P,O;if(c!==null&&typeof c=="object")if(P=x.indexOf(c),P!==-1)T.indexOf(P)===-1&&T.push(P);else if(x.push(c),Array.isArray(c))for(P=0,O=c.length;P<O;P+=1)Sc(c[P],x,T);else for(k=Object.keys(c),P=0,O=k.length;P<O;P+=1)Sc(c[k[P]],x,T)}function Qg(c,x){x=x||{};var T=new Ug(x);T.noRefs||Jg(c,T);var k=c;return T.replacer&&(k=T.replacer.call({"":k},"",k)),fn(T,0,k,!0,!0)?T.dump+`
`:""}var e_=Qg,t_={dump:e_};function Tc(c,x){return function(){throw new Error("Function yaml."+c+" is removed in js-yaml 4. Use yaml."+x+" instead, which is now safe by default.")}}var i_=Ti,r_=Qu,n_=rh,a_=lh,s_=ch,o_=mc,l_=Dh.load,c_=Dh.loadAll,u_=t_.dump,h_=Zi,p_={binary:fh,float:oh,map:ih,null:nh,pairs:gh,set:_h,timestamp:ph,bool:ah,int:sh,merge:dh,omap:mh,seq:th,str:eh},d_=Tc("safeLoad","load"),f_=Tc("safeLoadAll","loadAll"),m_=Tc("safeDump","dump"),Qh={Type:i_,Schema:r_,FAILSAFE_SCHEMA:n_,JSON_SCHEMA:a_,CORE_SCHEMA:s_,DEFAULT_SCHEMA:o_,load:l_,loadAll:c_,dump:u_,YAMLException:h_,types:p_,safeLoad:d_,safeLoadAll:f_,safeDump:m_};function g_(c={}){const{defaultCenter:x={lat:43.836699,lon:4.360054},defaultZoom:T=13,onSave:k=()=>{}}=c,P=Vue.ref({...x}),O=Vue.ref(T),B=Vue.ref(null);Vue.onBeforeUnmount(()=>{B.value&&clearTimeout(B.value)});function o(ve){if(!ve||ve.trim()==="")return null;try{const de=Qh.load(ve);if(de)return de.center&&(P.value={lat:de.center.lat,lon:de.center.lon}),de.zoom!==void 0&&(O.value=de.zoom),de}catch(de){return console.error("Error loading map data:",de),null}return null}function te(){const ve={background:{type:"osm"},center:{lat:P.value.lat,lon:P.value.lon},zoom:O.value},de=Qh.dump(ve,{indent:2,lineWidth:-1,noRefs:!0});return k(de),de}function H(ve=300){B.value&&clearTimeout(B.value),B.value=setTimeout(()=>{te()},ve)}return{center:P,zoom:O,loadMapData:o,saveMapData:te,debouncedSave:H}}const __={components:{MapPreview:Bf,MarkerList:Xf},props:{value:String,name:String,label:String,help:String,disabled:Boolean,defaultCenter:{type:Array,default:()=>[43.836699,4.360054]},defaultZoom:{type:Number,default:13},maxMarkers:{type:Number,default:50},mode:{type:String,default:"multi",validator:c=>["multi","single"].includes(c)},latitude:{type:[Number,String],default:null},longitude:{type:[Number,String],default:null},markerIconUrl:{type:String,default:null},markerIconSize:{type:Number,default:40}},setup(c,{emit:x}){const T=Vue.ref(!1),k=Vue.ref(null),P=Vue.ref(null),O=Vue.ref(!0),B=Vue.computed(()=>{var pt;if(c.mode==="single")return null;const Le=window.location.pathname.match(/\/panel\/pages\/(.+)/);if(Le)return Le[1].replace(/\+/g,"/");const qe=(pt=c.name)==null?void 0:pt.match(/pages\/([^/]+)/);return qe?qe[1].replace(/\+/g,"/"):(console.warn("Could not extract page ID, using default"),"map/carte")}),o=c.mode==="multi"?Kf(B.value):{markers:Vue.ref([]),loading:Vue.ref(!1),error:Vue.ref(null)},{center:te,zoom:H,loadMapData:ve,saveMapData:de,debouncedSave:ge}=g_({defaultCenter:{lat:c.defaultCenter[0],lon:c.defaultCenter[1]},defaultZoom:c.defaultZoom,onSave:Le=>x("input",Le)}),Ue=Vue.computed(()=>{if(c.mode==="single"){const Le=Te.value,qe=Be.value;return!isNaN(Le)&&!isNaN(qe)&&Le!==null&&qe!==null&&Le!==0&&qe!==0?[{id:"single-marker",position:{lat:Le,lon:qe},title:"Current position",iconUrl:c.markerIconUrl,iconSize:c.markerIconSize}]:[]}return o.markers.value}),rt=Vue.computed(()=>c.mode==="single"?!1:Ue.value.length<c.maxMarkers),Te=Vue.ref(null),Be=Vue.ref(null);function Ze(){const Le=document.querySelector(".k-form");if(!Le)return{lat:null,lon:null};const qe=Le.querySelector('input[name*="latitude"]'),pt=Le.querySelector('input[name*="longitude"]');return{lat:qe?parseFloat(qe.value):null,lon:pt?parseFloat(pt.value):null}}Vue.onMounted(async()=>{if(c.mode==="multi")try{await o.fetchMarkers()}catch(Le){console.error("Failed to load markers:",Le)}else if(c.mode==="single"){const Le=Ze();Te.value=Le.lat,Be.value=Le.lon,!isNaN(Le.lat)&&!isNaN(Le.lon)&&Le.lat!==0&&Le.lon!==0&&(te.value={lat:Le.lat,lon:Le.lon});const qe=document.querySelector(".k-form");if(qe){qe.addEventListener("input",Rt=>{if(Rt.target.name&&(Rt.target.name.includes("latitude")||Rt.target.name.includes("longitude"))){const Sr=Ze();Te.value=Sr.lat,Be.value=Sr.lon}});const pt=qe.querySelector('input[name*="latitude"]'),$t=qe.querySelector('input[name*="longitude"]');if(pt&&$t){const Rt=new MutationObserver(()=>{const Li=Ze();(Li.lat!==Te.value||Li.lon!==Be.value)&&(Te.value=Li.lat,Be.value=Li.lon)});Rt.observe(pt,{attributes:!0,attributeFil