earthsdk3-ol 3.11.0-beta.20 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var EarthSDK3_OL=(function(X,p,Mi){"use strict";var HA=Object.defineProperty;var XA=(X,p,Mi)=>p in X?HA(X,p,{enumerable:!0,configurable:!0,writable:!0,value:Mi}):X[p]=Mi;var O=(X,p,Mi)=>XA(X,typeof p!="symbol"?p+"":p,Mi);var qo=typeof document<"u"?document.currentScript:null;X.copyright=void 0;try{const n="earthsdk3-ol",e="3.11.0
|
|
1
|
+
var EarthSDK3_OL=(function(X,p,Mi){"use strict";var HA=Object.defineProperty;var XA=(X,p,Mi)=>p in X?HA(X,p,{enumerable:!0,configurable:!0,writable:!0,value:Mi}):X[p]=Mi;var O=(X,p,Mi)=>XA(X,typeof p!="symbol"?p+"":p,Mi);var qo=typeof document<"u"?document.currentScript:null;X.copyright=void 0;try{const n="earthsdk3-ol",e="3.11.0",t="2026-07-20T03:14:06.000Z",i="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="eb3a9d8d7d52fe4ea2e58f3b05725f3414c04d31",a=((Date.now()-1784517246e3)/36e5).toFixed(1),l=`%c🌏 ${n}%c ${e}.${o.slice(0,8)}.${t} (距今${a}个小时)
|
|
2
2
|
%c${s?s+`
|
|
3
3
|
`:""}当前网站正在使用${n},此软件版权归${i}所有
|
|
4
|
-
`;X.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
4
|
+
`;X.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","eb3a9d8d7d52fe4ea2e58f3b05725f3414c04d31")},get info(){return l},get date(){return"2026-07-20T03:14:06.000Z"},get author(){return"suplyang"},get version(){return"3.11.0"},get name(){return"earthsdk3-ol"},get commitId(){return"eb3a9d8d7d52fe4ea2e58f3b05725f3414c04d31"},print(c=!1){!c&&window._xe2_no_copy_print||console.info(this.info,`
|
|
5
5
|
font-size: 18px;
|
|
6
6
|
font-weight: 1000;
|
|
7
7
|
line-height: 1;
|
package/dist/earthsdk3-ol.js
CHANGED
|
@@ -5,7 +5,7 @@ import { extendClassProps as Ke, Destroyable as fe, Event as le, geoRhumbDistanc
|
|
|
5
5
|
import { Map as Cb, VectorTile as Sb, Feature as x_ } from "ol";
|
|
6
6
|
let Ku;
|
|
7
7
|
try {
|
|
8
|
-
const n = "earthsdk3-ol", e = "3.11.0
|
|
8
|
+
const n = "earthsdk3-ol", e = "3.11.0", t = "2026-07-20T03:14:06.000Z", i = "北京西部世界科技有限公司", s = "地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn", o = "eb3a9d8d7d52fe4ea2e58f3b05725f3414c04d31", a = ((Date.now() - 1784517246e3) / 36e5).toFixed(1), l = `%c🌏 ${n}%c ${e}.${o.slice(0, 8)}.${t} (距今${a}个小时)
|
|
9
9
|
%c${s ? s + `
|
|
10
10
|
` : ""}当前网站正在使用${n},此软件版权归${i}所有
|
|
11
11
|
`;
|
|
@@ -19,7 +19,7 @@ try {
|
|
|
19
19
|
},
|
|
20
20
|
// @ts-ignore
|
|
21
21
|
get gituri() {
|
|
22
|
-
return GITURI_ && GITURI_.replace("${commitId}", "
|
|
22
|
+
return GITURI_ && GITURI_.replace("${commitId}", "eb3a9d8d7d52fe4ea2e58f3b05725f3414c04d31");
|
|
23
23
|
},
|
|
24
24
|
// @ts-ignore
|
|
25
25
|
get info() {
|
|
@@ -27,7 +27,7 @@ try {
|
|
|
27
27
|
},
|
|
28
28
|
// @ts-ignore
|
|
29
29
|
get date() {
|
|
30
|
-
return "2026-07-
|
|
30
|
+
return "2026-07-20T03:14:06.000Z";
|
|
31
31
|
},
|
|
32
32
|
// @ts-ignore
|
|
33
33
|
get author() {
|
|
@@ -35,7 +35,7 @@ try {
|
|
|
35
35
|
},
|
|
36
36
|
// @ts-ignore
|
|
37
37
|
get version() {
|
|
38
|
-
return "3.11.0
|
|
38
|
+
return "3.11.0";
|
|
39
39
|
},
|
|
40
40
|
// @ts-ignore
|
|
41
41
|
get name() {
|
|
@@ -43,7 +43,7 @@ try {
|
|
|
43
43
|
},
|
|
44
44
|
// @ts-ignore
|
|
45
45
|
get commitId() {
|
|
46
|
-
return "
|
|
46
|
+
return "eb3a9d8d7d52fe4ea2e58f3b05725f3414c04d31";
|
|
47
47
|
},
|
|
48
48
|
print(c = !1) {
|
|
49
49
|
!c && globalThis._xe2_no_copy_print || console.info(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function($,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("earthsdk3"),require("ol")):typeof define=="function"&&define.amd?define(["exports","earthsdk3","ol"],p):($=typeof globalThis<"u"?globalThis:$||self,p($.EarthSDK3_OL={},$.EarthSDK3,$.ol))})(this,(function($,p,Mi){"use strict";var BA=Object.defineProperty;var HA=($,p,Mi)=>p in $?BA($,p,{enumerable:!0,configurable:!0,writable:!0,value:Mi}):$[p]=Mi;var O=($,p,Mi)=>HA($,typeof p!="symbol"?p+"":p,Mi);var qo=typeof document<"u"?document.currentScript:null;$.copyright=void 0;try{const n="earthsdk3-ol",e="3.11.0
|
|
1
|
+
(function($,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("earthsdk3"),require("ol")):typeof define=="function"&&define.amd?define(["exports","earthsdk3","ol"],p):($=typeof globalThis<"u"?globalThis:$||self,p($.EarthSDK3_OL={},$.EarthSDK3,$.ol))})(this,(function($,p,Mi){"use strict";var BA=Object.defineProperty;var HA=($,p,Mi)=>p in $?BA($,p,{enumerable:!0,configurable:!0,writable:!0,value:Mi}):$[p]=Mi;var O=($,p,Mi)=>HA($,typeof p!="symbol"?p+"":p,Mi);var qo=typeof document<"u"?document.currentScript:null;$.copyright=void 0;try{const n="earthsdk3-ol",e="3.11.0",t="2026-07-20T03:14:06.000Z",i="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="eb3a9d8d7d52fe4ea2e58f3b05725f3414c04d31",a=((Date.now()-1784517246e3)/36e5).toFixed(1),l=`%c🌏 ${n}%c ${e}.${o.slice(0,8)}.${t} (距今${a}个小时)
|
|
2
2
|
%c${s?s+`
|
|
3
3
|
`:""}当前网站正在使用${n},此软件版权归${i}所有
|
|
4
|
-
`;$.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
4
|
+
`;$.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","eb3a9d8d7d52fe4ea2e58f3b05725f3414c04d31")},get info(){return l},get date(){return"2026-07-20T03:14:06.000Z"},get author(){return"suplyang"},get version(){return"3.11.0"},get name(){return"earthsdk3-ol"},get commitId(){return"eb3a9d8d7d52fe4ea2e58f3b05725f3414c04d31"},print(c=!1){!c&&globalThis._xe2_no_copy_print||console.info(this.info,`
|
|
5
5
|
font-size: 18px;
|
|
6
6
|
font-weight: 1000;
|
|
7
7
|
line-height: 1;
|
|
@@ -155,13 +155,13 @@ ${t1}
|
|
|
155
155
|
}`;this.instanceClassStr=w};E(),this.dispose(this.innerHTMLChanged.disposableOn(E))}}update(t){this._updateEvent.emit(t)}get instanceClass(){return this._instanceClassReact.value}set instanceClass(t){this._instanceClassReact.value=t}get instanceClassChanged(){return this._instanceClassReact.changed}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get pickedEvent(){return this._pickedEvent}pickFromDiv(t,i){(this.allowPicking??!1)&&this.pickedEvent.emit(new p.ESJPickedResult({element:t,...i}))}get innerHtmlMounted(){return this._innerHtmlMounted}get olDivPoi(){return this._olDivPoi}set olDivPoi(t){this._olDivPoi=t}get objResetting(){return this._objResetting}get olViewerVisibleDistanceRangeControl(){return this._olViewVisibleDistanceRangeControl}get visibleAlpha(){return this._olViewVisibleDistanceRangeControl.visibleAlpha}get visibleAlphaChanged(){return this._olViewVisibleDistanceRangeControl.visibleAlphaChanged}}O(kt,"defaultOLInstanceClassStr",ep),O(kt,"olInstanceClassStrReadMe",e1),O(kt,"defaults",{position:[116.39,39.9,0],instanceClassStr:ep,instanceClassStrReadMe:e1,innerHTML:t1,innerHTMLReadMe:YR,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,opacity:1,position:p.reactArrayWithUndefined(void 0),originRatioAndOffset:p.reactArray([.5,1,0,0]),instanceClassStr:void 0,innerHTML:void 0,viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,shadowDom:!1,cssAllInitial:!1,zOrder:0})})(kt||(kt={})),p.extendClassProps(kt.prototype,kt.createDefaultProps);class ZR extends p.Destroyable{constructor(e,t,i){super(),this._container=e}}const Su=class Su extends p.Destroyable{constructor(t,i){super();O(this,"_pickedEvent",this.disposeVar(new p.Event));O(this,"_divEvent",this.disposeVar(new p.Event));O(this,"_divCreatedEvent",this.disposeVar(new p.Event));O(this,"_divToDestroyEvent",this.disposeVar(new p.Event));O(this,"_pc",this.disposeVar(new p.PointerClick));O(this,"_flyToEvent",this.disposeVar(new p.Event));O(this,"_customDivPoi");this._customDivPoi=this.disposeVar(new kt(t,i));const s=this,o=this._customDivPoi;this.dispose(this.flyToEvent.disposableOn(r=>{o.flyTo(r)})),this.dispose(p.bind([o,"show"],[this,"show"])),this.dispose(p.bind([o,"position"],[this,"position"])),this.dispose(p.bind([o,"originRatioAndOffset"],[this,"originRatioAndOffset"])),this.dispose(p.bind([o,"opacity"],[this,"opacity"])),this.dispose(p.bind([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(p.bind([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(p.bind([o,"shadowDom"],[this,"shadowDom"])),this.dispose(p.bind([o,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(p.bind([o,"allowPicking"],[this,"pickOnClick"])),this.d(p.bind([o,"zOrder"],[this,"zOrder"]));{class r extends ZR{constructor(l,c,h){super(l,c,h);const u=document.createElement("div");u.style.overflow="hidden",u.style.whiteSpace="nowrap",u.addEventListener("mouseover",()=>{s.divEvent.emit(!0)}),u.addEventListener("mouseout",()=>{s.divEvent.emit(!1)});{{const f=()=>{o.show=s.show??!0,u.style.pointerEvents="all",s.width===void 0?u.style.width="auto":u.style.width=`${s.width}px`,s.height===void 0?u.style.height="auto":u.style.height=`${s.height}px`,s.text!==void 0?u.innerHTML=`${s.text.replace(/\n/g,"<br/>")??"请输入文字"}`:u.innerHTML="请输入文字",u.style.fontSize=`${s.fontSize??14}px`,u.style.fontFamily=`${s.fontFamily??Su.defaults.fontFamily}`;const _=s.borderRadius??[6,6,6,6];u.style.borderRadius=`${_[0]}px ${_[1]}px ${_[2]}px ${_[3]}px`;const v=s.color??[1,1,1,1];u.style.color=`rgba(${v[0]*255},${v[1]*255},${v[2]*255},${v[3]})`;const E=s.backgroundColor??[0,0,0,.8];u.style.backgroundColor=`rgba(${E[0]*255},${E[1]*255},${E[2]*255},${E[3]})`;const w=s.padding??[5,5,5,5];u.style.padding=`${w[0]}px ${w[1]}px ${w[2]}px ${w[3]}px`,u.style.borderWidth=`${s.borderWidth??0}px`;const C=s.borderColor??[1,1,1,1];u.style.borderColor=`rgba(${C[0]*255},${C[1]*255},${C[2]*255},${C[3]})`,u.style.borderStyle=`${s.borderStyle??"solid"}`,u.style.textAlign=`${s.textAlign??"left"}`,u.style.transform=`scale(${s.scale[0]??1},${s.scale[1]??1}) rotate(${s.rotate??0}deg)`};f();const g=this.disposeVar(p.createNextAnimateFrameEvent(s.showChanged,s.widthChanged,s.heightChanged,s.textChanged,s.fontSizeChanged,s.borderRadiusChanged,s.colorChanged,s.backgroundColorChanged,s.paddingChanged,s.borderWidthChanged,s.borderColorChanged,s.borderStyleChanged,s.fontFamilyChanged,s.textAlignChanged,s.scaleChanged,s.rotateChanged));this.dispose(g.disposableOn(f))}{const f=()=>{s.textEditing?(u.contentEditable="true",u.focus(),document.execCommand("selectAll",!1,null)):(u.contentEditable="false",document.execCommand("unselect",!1,null))};f(),this.dispose(s.textEditingChanged.disposableOn(f))}{const f=()=>{s.textEditingInteraction||(s.positionEditing??!1?u.style.pointerEvents="none":u.style.pointerEvents="all")};f(),this.dispose(s.positionEditingChanged.disposableOn(f))}let d=null;this.dispose(()=>clearInterval(d));{const f=()=>{u.ondblclick=()=>{s.positionEditing&&(s.positionEditing=!1),s.textEditingInteraction&&(s.textEditing=!0)},u.onblur=()=>{s.text=u.innerText,s.textEditingInteraction&&(d&&clearTimeout(d),d=setTimeout(()=>{s.textEditing=!1},100))},u.addEventListener("keydown",function(g){s.textEditingInteraction&&(g.code==="Enter"&&!g.shiftKey&&u.blur(),g.code==="Escape"&&u.blur())})};f(),this.dispose(s.textEditingInteractionChanged.disposableOn(f))}}this._container.appendChild(u),this.dispose(()=>{this._container.removeChild(u)}),s._divCreatedEvent.emit(u),this.dispose(()=>s._divToDestroyEvent.emit(u))}}o.instanceClass=r}this.dispose(o.pickedEvent.don(r=>{(o.allowPicking??!1)&&s.pickedEvent.emit(r)}))}get pickedEvent(){return this._pickedEvent}get divEvent(){return this._divEvent}get divCreatedEvent(){return this._divCreatedEvent}get divToDestroyEvent(){return this._divToDestroyEvent}get pc(){return this._pc}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get customDivPoi(){return this._customDivPoi}};O(Su,"defaults",{width:80,height:28,text:"请输入文字",borderStyle:"solid",fontFamily:"",viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1],zOrder:0});let Ns=Su;(n=>{n.createDefaultProps=()=>({show:!0,position:p.reactArrayWithUndefined(void 0),text:void 0,width:void 0,height:void 0,fontFamily:void 0,positionEditing:!1,textEditing:!1,textEditingInteraction:!1,originRatioAndOffset:p.reactArray([.5,1,0,0]),opacity:1,fontSize:14,textAlign:"left",color:p.reactArray([1,1,1,1]),backgroundColor:p.reactArray([0,0,0,.8]),padding:p.reactArray([5,5,5,5]),borderRadius:p.reactArray([6,6,6,6]),borderWidth:0,borderColor:p.reactArray([1,1,1,1]),borderStyle:"solid",viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,shadowDom:!1,cssAllInitial:!1,scale:p.reactArray([1,1]),zOrder:0,rotate:0})})(Ns||(Ns={})),p.extendClassProps(Ns.prototype,Ns.createDefaultProps);class n1 extends p.Destroyable{constructor(t){super();O(this,"_enabled",this.disposeVar(p.react(!1)));O(this,"_cursorPosition",p.react(void 0));O(this,"quickPickPosition",!0);let i=new p.Destroyable;const s=()=>{i&&(i.destroy(),i=void 0)};this.dispose(s);const o=()=>{var d;if(s(),!this._enabled.value||!t)return;const r=Ki(t);if(!r)return;i=new p.Destroyable;const a=i.disposeVar(p.react(void 0)),l=i.disposeVar(p.createNextAnimateFrameEvent(a.changed)),c=(d=t.getTargetElement)==null?void 0:d.call(t);if(!c)return;const h=f=>{const g=p.getDomEventCurrentTargetPos(f);a.value=g};c.addEventListener("mousemove",h),i.dispose(()=>c.removeEventListener("mousemove",h));const u=i.disposeVar(p.createProcessingFromAsyncFunc(async f=>{const g=r.pickingManager;if(!g||!a.value)return;const _=a.value,v=this.quickPickPosition?await f.promise(p.createCancelablePromise(g.quickPickPosition(_))):await f.promise(p.createCancelablePromise(g.pickPosition(_)));this._cursorPosition.value=v}));i.dispose(l.disposableOn(()=>{u.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}get enabled(){return this._enabled.value}set enabled(t){this._enabled.value=t}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class i1 extends p.Destroyable{constructor(t){super();O(this,"_baseLayers",new Set);O(this,"_imageryGroup",new Ts({zIndex:-9999,visible:!0}));this._map=t,this._map.addLayer(this._imageryGroup),this.d(()=>this._map.removeLayer(this._imageryGroup))}get baseLayers(){return this._baseLayers}get map(){return this._map}add(t){if(this._baseLayers.has(t)){console.warn("imageriesManager add error: has already added!",t);return}this._imageryGroup.getLayers().push(t),this._baseLayers.add(t)}delete(t){if(!this._baseLayers.has(t)){console.warn("imageriesManager delete error: has not added!",t);return}this._imageryGroup.getLayers().remove(t),this._baseLayers.delete(t)}setZindex(t,i){if(!this._baseLayers.has(t)){console.warn("imageriesManager setZindex error: has not added!",t);return}t.setZIndex(i-9999)}}class s1 extends p.Destroyable{constructor(t){super();O(this,"_labelMap",{div:new globalThis.Map,canvas:new globalThis.Map});this._map=t;const i=t.getView(),s=[];s.push(i.on("change:center",()=>this._updateZOrder())),s.push(i.on("change:resolution",()=>this._updateZOrder())),s.push(i.on("change:rotation",()=>this._updateZOrder())),s.push(t.on("moveend",()=>this._updateZOrder())),this.dispose(()=>ui(s))}add(t){const i=t instanceof kt?"div":"canvas";if(this._labelMap[i].has(t)){console.warn(`Label already exists in ${i} map`,t);return}const s=new p.Destroyable;{const o=s.dv(p.createNextAnimateFrameEvent(t.zOrderChanged,t.positionChanged));s.dispose(o.don(()=>this._updateZOrder()))}this._labelMap[i].set(t,()=>s.destroy()),this._updateZOrder()}delete(t){const i=t instanceof kt?"div":"canvas";if(!this._labelMap[i].has(t)){console.warn(`Label not found in ${i} map`,t);return}const s=this._labelMap[i].get(t);s==null||s(),this._labelMap[i].delete(t),this._updateZOrder()}_updateZOrder(){for(const t in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,t)&&this._updateLabelZOrder(this._labelMap[t],t)}_updateLabelZOrder(t,i){var a;const s={};for(const l of t.keys()){const c=l.zOrder.toString();s[c]||(s[c]=new globalThis.Map);const h=l instanceof kt&&l.olDivPoi?l.olDivPoi.depth:l instanceof Zi&&l.canvasObj&&((a=l.canvasObj.olCanvasPoi)==null?void 0:a.depth)||0;s[c].set(l,h)}const o=Object.keys(s).sort((l,c)=>i==="div"?Number(c)-Number(l):Number(l)-Number(c));let r=t.size;o.forEach(l=>{new globalThis.Map([...s[l]].sort((h,u)=>u[1]-h[1])).forEach((h,u)=>{var d;u instanceof kt&&u.olDivPoi?u.olDivPoi.zOrder=r:u instanceof Zi&&((d=u.canvasObj)!=null&&d.olCanvasPoi)&&(u.canvasObj.olCanvasPoi.zOrder=r),r--})})}}function xh(n){return Array.isArray(n)?Math.min(...n):n}class o1 extends zd{constructor(e){super(e),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(e){const t=e.layerStatesArray[e.layerIndex],i=e.pixelRatio,s=e.viewState,o=s.resolution,r=this.getLayer().getSource(),a=e.viewHints;let l=e.extent;if(t.extent!==void 0&&(l=$n(l,fi(t.extent,s.projection))),!a[ot.ANIMATING]&&!a[ot.INTERACTING]&&!zi(l))if(r){!this.getLayer().rendered&&this.renderedSourceRevision_!==r.getRevision()&&(this.image=null),this.renderedSourceRevision_=r.getRevision();const c=s.projection,h=r.getImage(l,o,i,c);h&&(this.loadImage(h)?this.image=h:h.getState()===le.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),s=_t(t.pixelToCoordinateTransform,e.slice()),o=i.getExtent();if(o&&!Zs(o,s))return null;const r=this.image.getExtent(),a=this.image.getImage(),l=Oe(r),c=Math.floor(a.width*((s[0]-r[0])/l));if(c<0||c>=a.width)return null;const h=lt(r),u=Math.floor(a.height*((r[3]-s[1])/h));return u<0||u>=a.height?null:this.getImageData(a,c,u)}renderFrame(e,t){const i=this.image,s=i.getExtent(),o=i.getResolution(),[r,a]=Array.isArray(o)?o:[o,o],l=i.getPixelRatio(),c=e.layerStatesArray[e.layerIndex],h=e.pixelRatio,u=e.viewState,d=u.center,f=u.resolution,g=h*r/(f*l),_=h*a/(f*l);this.prepareContainer(e,t);const v=this.context.canvas.width,E=this.context.canvas.height,w=this.getRenderContext(e);let C=!1,P=!0;if(c.extent){const z=fi(c.extent,u.projection);P=pt(z,e.extent),C=P&&!Di(z,e.extent),C&&this.clipUnrotated(w,e,z)}const R=i.getImage(),A=Hn(this.tempTransform,v/2,E/2,g,_,0,l*(s[0]-d[0])/r,l*(d[1]-s[3])/a);this.renderedResolution=a*h/l;const I=R.width*A[0],M=R.height*A[3];if(this.getLayer().getSource().getInterpolate()||(w.imageSmoothingEnabled=!1),this.preRender(w,e),P&&I>=.5&&M>=.5){const z=A[4],k=A[5],q=c.opacity;q!==1&&(w.save(),w.globalAlpha=q),w.drawImage(R,0,0,+R.width,+R.height,z,k,I,M),q!==1&&w.restore()}return this.postRender(this.context,e),C&&w.restore(),w.imageSmoothingEnabled=!0,this.container}}class KR extends o1{constructor(e){super(e),this.vectorRenderer_=new N0(e),this.layerImageRatio_=e.getImageRatio(),this.coordinateToVectorPixelTransform_=Kt(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(e){if(!this.vectorRenderer_)return Promise.resolve([]);const t=_t(this.coordinateToVectorPixelTransform_,_t(this.renderedPixelToCoordinateTransform_,e.slice()));return this.vectorRenderer_.getFeatures(t)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(e){var h;const t=e.pixelRatio,i=e.viewState,s=i.resolution,o=e.viewHints,r=this.vectorRenderer_;let a=e.extent;this.layerImageRatio_!==1&&(a=a.slice(0),Ov(a,this.layerImageRatio_));const l=Oe(a)/s,c=lt(a)/s;if(!o[ot.ANIMATING]&&!o[ot.INTERACTING]&&!zi(a)){r.useContainer(null,null);const u=r.context,d=e.layerStatesArray[e.layerIndex],f=Object.assign({},d,{opacity:1}),g=Object.assign({},e,{extent:a,size:[l,c],viewState:Object.assign({},e.viewState,{rotation:0}),layerStatesArray:[f],layerIndex:0,declutter:null}),_=this.getLayer().getDeclutter();_&&(g.declutter={[_]:new Od(9)});const v=new sy(a,s,t,u.canvas,function(E){r.prepareFrame(g)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(g,null),r.renderDeclutter(g),r.renderDeferred(g),E())});v.addEventListener(we.CHANGE,()=>{if(v.getState()!==le.LOADED)return;this.image=v;const E=v.getPixelRatio(),w=xh(v.getResolution())*t/E;this.renderedResolution=w,this.coordinateToVectorPixelTransform_=Hn(this.coordinateToVectorPixelTransform_,l/2,c/2,1/w,-1/w,0,-i.center[0],-i.center[1])}),v.load()}return this.image&&(this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice()),!((h=this.getLayer().getSource())!=null&&h.loading)&&!!this.image}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(e,t,i,s,o){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(e,t,i,s,o):super.forEachFeatureAtCoordinate(e,t,i,s,o)}}class QR extends jc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.imageRatio,super(t),this.imageRatio_=e.imageRatio!==void 0?e.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new KR(this)}}class r1 extends p.Destroyable{constructor(t){super();O(this,"_map");this._map=t.viewer}async pickPosition(t){return new Promise(i=>{try{if(!this._map)return i(void 0);const s=this._map.getCoordinateFromPixel(t),[o,r]=Ft(s);i([o,r,0])}catch(s){return console.error(s),i(void 0)}})}async quickPickPosition(t){return await this.pickPosition(t)}async pick(t,i,s){return new Promise(o=>{try{if(!this._map)return o(void 0);const r=[];this._map.forEachFeatureAtPixel(t,(f,g)=>{console.log("forEachFeatureAtPixel",f,g),r.push([f,g])}),console.log("pickedObjects",r);const a=r.length>0?r[0]:void 0;if(!a)return o(void 0);const l=a[0].getId();if(!l)return o(void 0);let c=p.ESSceneObject.getSceneObjectById(l.toString());if(c&&c.parentID&&(c=p.ESSceneObject.getSceneObjectById(c.parentID)),!c)return o(void 0);console.log("sceneObject:",c);const h=new p.ESJPickedResult(a,c,void 0,void 0,s,t);return c&&Reflect.has(c,"allowPicking")&&Reflect.has(c,"pickedEvent")&&(c.allowPicking??!1)&&c.pickedEvent.emit(h),c&&Reflect.has(c,"allowPicking")&&!(c.allowPicking??!1)?o(new p.ESJPickedResult):o(h)}catch(r){return console.error(r),o(void 0)}})}_layerPickable(t){return!t||t instanceof Ts?!1:t instanceof Mn||t instanceof QR}_resolveSceneObject(t,i){var a,l;let s;const o=(a=t==null?void 0:t.get)==null?void 0:a.call(t,"ESSceneObjectID");if(typeof o=="string"&&(s=o),!s){const c=(l=i==null?void 0:i.get)==null?void 0:l.call(i,"ESSceneObjectID");typeof c=="string"&&(s=c)}let r=s?p.ESSceneObject.getSceneObject(s):void 0;return r&&r.parentID&&(r=p.ESSceneObject.getSceneObject(r.parentID)),r}_buildGeoJsonPickInfo(t,i,s){var h;const o=t.getGeometry(),r=((h=o==null?void 0:o.getType)==null?void 0:h.call(o))??"Point",a=t.getProperties?t.getProperties():{},{geometry:l,...c}=a||{};return r==="Point"?{type:"Point",coordinates:[i,s,0],properties:c}:{type:r,coordinates:void 0,properties:c}}}function Ki(n){return p.getExtProp(n,"_viewerExtensions")}function Ph(n,e){p.setExtProp(n,"_viewerExtensions",e)}class a1 extends p.Destroyable{constructor(t,i){super();O(this,"_imageriesManager");O(this,"_labelManager");O(this,"_pickingManager");O(this,"_poiContext");O(this,"_cursorPositionInfo");this._viewer=t,this._olViewer=i,this._imageriesManager=this.dv(new i1(t)),this._labelManager=this.dv(new s1(t)),this._poiContext=this.disposeVar(new J_(this._viewer)),this._cursorPositionInfo=this.dv(new n1(t)),this.ad(i.viewerChanged.don(()=>{this._pickingManager=this.dv(new r1(i))}))}get viewer(){return this._viewer}get olViewer(){return this._olViewer}get imageriesManager(){return this._imageriesManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}}class JR extends p.Destroyable{constructor(e,t){super(),this._olViewer=e,this._viewer=t;const i=this._viewer,s=i.getView();{let o=this._olViewer.disabledInputStack===0;const r=()=>{var l;const a=this._olViewer.disabledInputStack===0;a!==o&&(o=a,a?this._olViewer.restoreMapInteraction():(this._olViewer.changeToMap(),(l=s.cancelAnimations)==null||l.call(s),this._olViewer.suspendMapInteraction()))};r(),this.dispose(this._olViewer.disabledInputStackChanged.don(r))}{const o=()=>{this._olViewer.cameraChanged.emit()},r=s.on("change:center",()=>o()),a=s.on("change:resolution",()=>o()),l=s.on("change:rotation",()=>o());this.d(()=>{ui([r,a,l])})}{let o=performance.now(),r=0;const a=()=>{var u;const c=performance.now();r++;const h=c-o;h>1e3&&(((u=this._olViewer._fps)==null?void 0:u.value)!==void 0&&(this._olViewer._fps.value=r*1e3/h|0),o=c,r=0)},l=i.on("postrender",a);this.d(()=>ui(l))}}get olViewer(){return this._olViewer}get viewer(){return this._viewer}}const $r=class $r extends p.ESViewer{constructor(t){super(t);O(this,"_viewer",this.dv(p.react(void 0)));O(this,"orbitController",null);O(this,"_fpsMonitor",null);O(this,"wasdController",null);O(this,"_disabledInputStack",this.disposeVar(p.react(0)));O(this,"_interactionBackup",null);O(this,"_notSupportEditingCount",this.disposeVar(p.react(0)));O(this,"_editingSystem",this.ad(yv()));if(t.type!==$r.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(i=>{this.viewerChanged.emit(i)})),this.dv(new p.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new JR(this,this.viewer)})),this.dv(new p.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new jR(this.subContainer,this,i=>this._viewer.value=i)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Ki(this.viewer)}get disabledInputStack(){return this._disabledInputStack.value}set disabledInputStack(t){this._disabledInputStack.value=t}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}_suspendMapInteraction(){!this.viewer||this._interactionBackup||(this._interactionBackup=this.viewer.getInteractions().getArray().slice(),this.viewer.getInteractions().clear())}_restoreMapInteraction(){!this.viewer||!this._interactionBackup||(this._interactionBackup.forEach(t=>{var i;return(i=this.viewer)==null?void 0:i.getInteractions().push(t)}),this._interactionBackup=null)}restoreMapInteraction(){this._restoreMapInteraction()}suspendMapInteraction(){this._suspendMapInteraction()}_func(t=!1){return console.warn("ESOlViewer 暂未实现该方法!"),Promise.resolve(void 0)}setRotation(t){if(!this.viewer)return;this.viewer.getView().setRotation(t*Math.PI/180)}async pick(t,i,s){if(!this.extensions)return;const{pickingManager:o}=this.extensions;return await o.pick(t,void 0,i)}async pickPosition(t){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.pickPosition(t)}async quickPickPosition(t){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.quickPickPosition(t)}flyIn(t,i,s){if(!this.viewer)return;const o=mo(t[2]);this.viewer.getView().animate({center:Me([t[0],t[1]]),zoom:o,duration:(s??1)*1e3})}flyTo(t,i){if(!this.viewer)return;const s=mo(t.distance);this.viewer.getView().animate({center:Me([i[0],i[1]]),zoom:s,duration:(t.flyDuration??1)*1e3})}flyToBoundingSphere(t,i,s){if(!this.viewer)return;const o={_duration:(s??1)*1e3};console.log(t);const r=Me([t[0],t[1]]),a=Me([t[2],t[3]]);this.viewer.getView().fit(hd([r[0],r[1],a[0],a[1]]),{duration:o._duration,easing:Xs,padding:[10,10,10,10]})}async getTerrainHeight(t){return console.warn("openlayers不支持获取地形高度!"),0}getCurrentCameraInfo(){if(!this.viewer)return;const t=this.viewer.getView().getZoom();if(!t)return;const i=ka(t),s=this.viewer.getView().getCenter();if(!s)return;const o=Ft(s),r=this.viewer.getView().getRotation();return{position:[o[0],o[1],i],rotation:[0,r/(Math.PI/180),0]}}transformFlyParam(t,i){}calcFlyToParam(t){const i=this.getCurrentCameraInfo();if(!i)return;const{position:s,rotation:o}=i,r=p.geoRhumbDistance(s,t),a=t[0]-s[0],l=t[1]-s[1],h=Math.atan2(a,l)*180/Math.PI,u=t[2]-s[2],f=Math.atan2(u,r)*180/Math.PI,g=h+90;return{distance:r,heading:g,pitch:f,flyDuration:1,hDelta:-(o[0]-g),pDelta:o[1]-f}}getLengthInPixel(){if(this.viewer)return this.viewer.getView().getResolution()}changeToWalk(t){this.viewer&&(this.changeToMap(),this.container&&(this.wasdController=this.dv(new vy(this.container,this.viewer,[t[0],t[1]]))))}changeToMap(){var t;this.wasdController&&(this.wasdController.destroy(),this.wasdController=null),this.orbitController&&(this.orbitController.stop(),this.orbitController=null,(t=this.viewer)==null||t.getView().setRotation(0))}changeToRotateGlobe(t,i,s){this.changeToMap(),console.warn("Openlayers引擎暂不支持全球旋转,已切换为Map模式")}changeToLine(t,i,s,o,r,a){this._func()}changeToUserDefined(t){this.changeToMap(),console.warn("Openlayers引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(t,i=5e4,s=60,o=90,r=0){if(!this.viewer)return;const a=this.viewer.getView();this.changeToMap();const l={_distance:i,_orbitPeriod:s*1e3,heading:o},c=mo(l._distance);a.setZoom(c),this.orbitController=wy(this.viewer,{center:[t[0],t[1]],orbitPeriod:l._orbitPeriod,heading:l.heading})}changeToFollow(t,i,s,o){this._func()}getFPS(){return this.viewer&&!this._fpsMonitor&&(this._fpsMonitor=this.dv(new by(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const t=globalThis.g_XE3CopyRights??{};return t.openlayers=Fv,t}getHeightByLonLat(t,i,s){return console.warn("getHeightByLonLat is not supported in OpenLayers"),Promise.resolve(0)}getHeightsByLonLats(t,i){return console.warn("getHeightsByLonLats is not supported in OpenLayers"),Promise.resolve([])}async capture(t,i){if(this.viewer)return await _y(this.viewer,t,i)}lonLatAltToScreenPosition(t){var r;const i=[t[0],t[1]],s=Me(i),o=(r=this.viewer)==null?void 0:r.getPixelFromCoordinate(s);return o?Promise.resolve([o[0],o[1]]):Promise.resolve(void 0)}getBoundSphere(t){return this._func()}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(t){this._notSupportEditingCount.value=t}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(t,i,s){s=Object.assign({useKeyToSwitch:!0,callSource:"outer"},s);const o=t.components.main??t;o&&i!=null&&(o.editingID=`${s.callSource}_${p.createGuid()}`,this._editingSystem.restart(void 0,this,o,i,s.useKeyToSwitch))}stopEditing(){this._editingSystem.isRunning&&this._editingSystem.cancel()}moveObjects(t){this._func()}getViewExtent(){if(!this.viewer)return console.warn("ESOlViewer: OpenLayers viewer not initialized."),Promise.resolve(void 0);const i=this.viewer.getView().calculateExtent(this.viewer.getSize());if(console.log(i),!i)return Promise.resolve(void 0);const s=Ft([i[0],i[1]]),o=Ft([i[2],i[3]]),r=[s[0],s[1],o[0],o[1]];return console.log(r),Promise.resolve(r)}};O($r,"type",$r.register("ESOlViewer",$r));let Ci=$r;(n=>{n.createDefaultProps=()=>({...p.ESViewer.createDefaultProps()})})(Ci||(Ci={})),p.extendClassProps(Ci.prototype,Ci.createDefaultProps);class eT extends Da{constructor(e){e=e||{},super(e)}}class tp extends eT{constructor(e){super(e)}createRenderer(){return new o1(this)}getData(e){return super.getData(e)}}function np(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const tT=new Error("disposed"),nT=[256,256];class l1 extends Fa{constructor(e){const t=oe.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;const e=np(this.data_);return e?[e.width,e.height]:nT}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==oe.IDLE&&this.state!==oe.ERROR)return;this.state=oe.LOADING,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=oe.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=oe.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(tT),this.controller_=null),super.disposeInternal()}}let ip;const Pr=[];function c1(n,e,t,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(e,t),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(e,i)+1,Math.max(t,s)),n.restore()}function sp(n,e){return Math.abs(n[e*4]-210)>2||Math.abs(n[e*4+3]-.75*255)>2}function iT(){if(ip===void 0){const n=ht(6,6,Pr);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",c1(n,4,5,4,0),c1(n,4,5,0,5);const e=n.getImageData(0,0,3,3).data;ip=sp(e,0)||sp(e,4)||sp(e,8),ca(n),Pr.push(n.canvas)}return ip}function Sh(n,e,t,i){const s=Zo(t,e,n);let o=Em(e,i,t);const r=e.getMetersPerUnit();r!==void 0&&(o*=r);const a=n.getMetersPerUnit();a!==void 0&&(o/=a);const l=n.getExtent();if(!l||Zs(l,s)){const c=Em(n,o,s)/o;isFinite(c)&&c>0&&(o/=c)}return o}function sT(n,e,t,i){const s=xn(t);let o=Sh(n,e,s,i);return(!isFinite(o)||o<=0)&&Zg(t,function(r){return o=Sh(n,e,r,i),isFinite(o)&&o>0}),o}function h1(n,e,t,i,s,o,r,a,l,c,h,u,d,f){const g=ht(Math.round(t*n),Math.round(t*e),Pr);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(t,t);function _(R){return Math.round(R*t)/t}g.globalCompositeOperation="lighter";const v=gn();l.forEach(function(R,A,I){Xg(v,R.extent)});let E;const w=t/i,C=(u?1:1+Math.pow(2,-24))/w;if(!d||l.length!==1||c!==0){if(E=ht(Math.round(Oe(v)*w),Math.round(lt(v)*w),Pr),u||(E.imageSmoothingEnabled=!1),s&&f){const R=(s[0]-v[0])*w,A=-(s[3]-v[3])*w,I=Oe(s)*w,M=lt(s)*w;E.rect(R,A,I,M),E.clip()}l.forEach(function(R,A,I){if(R.image.width>0&&R.image.height>0){if(R.clipExtent){E.save();const Y=(R.clipExtent[0]-v[0])*w,m=-(R.clipExtent[3]-v[3])*w,b=Oe(R.clipExtent)*w,S=lt(R.clipExtent)*w;E.rect(u?Y:Math.round(Y),u?m:Math.round(m),u?b:Math.round(Y+b)-Math.round(Y),u?S:Math.round(m+S)-Math.round(m)),E.clip()}const M=(R.extent[0]-v[0])*w,z=-(R.extent[3]-v[3])*w,k=Oe(R.extent)*w,q=lt(R.extent)*w;E.drawImage(R.image,c,c,R.image.width-2*c,R.image.height-2*c,u?M:Math.round(M),u?z:Math.round(z),u?k:Math.round(M+k)-Math.round(M),u?q:Math.round(z+q)-Math.round(z)),R.clipExtent&&E.restore()}})}const P=rn(r);return a.getTriangles().forEach(function(R,A,I){const M=R.source,z=R.target;let k=M[0][0],q=M[0][1],Y=M[1][0],m=M[1][1],b=M[2][0],S=M[2][1];const L=_((z[0][0]-P[0])/o),N=_(-(z[0][1]-P[1])/o),j=_((z[1][0]-P[0])/o),U=_(-(z[1][1]-P[1])/o),B=_((z[2][0]-P[0])/o),Z=_(-(z[2][1]-P[1])/o),G=k,ae=q;k=0,q=0,Y-=G,m-=ae,b-=G,S-=ae;const ne=[[Y,m,0,0,j-L],[b,S,0,0,B-L],[0,0,Y,m,U-N],[0,0,b,S,Z-N]],V=Mv(ne);if(!V)return;if(g.save(),g.beginPath(),iT()||!u){g.moveTo(j,U);const se=4,he=L-j,ye=N-U;for(let pe=0;pe<se;pe++)g.lineTo(j+_((pe+1)*he/se),U+_(pe*ye/(se-1))),pe!=se-1&&g.lineTo(j+_((pe+1)*he/se),U+_((pe+1)*ye/(se-1)));g.lineTo(B,Z)}else g.moveTo(j,U),g.lineTo(L,N),g.lineTo(B,Z);g.clip(),g.transform(V[0],V[2],V[1],V[3],L,N),g.translate(v[0]-G,v[3]-ae);let re;if(E)re=E.canvas,g.scale(C,-C);else{const se=l[0],he=se.extent;re=se.image,g.scale(Oe(he)/re.width,-lt(he)/re.height)}g.drawImage(re,0,0),g.restore()}),E&&(ca(E),Pr.push(E.canvas)),h&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(R,A,I){const M=R.target,z=(M[0][0]-P[0])/o,k=-(M[0][1]-P[1])/o,q=(M[1][0]-P[0])/o,Y=-(M[1][1]-P[1])/o,m=(M[2][0]-P[0])/o,b=-(M[2][1]-P[1])/o;g.beginPath(),g.moveTo(q,Y),g.lineTo(z,k),g.lineTo(m,b),g.closePath(),g.stroke()}),g.restore()),g.canvas}const oT=10,u1=.25;class d1{constructor(e,t,i,s,o,r,a){this.sourceProj_=e,this.targetProj_=t;let l={};const c=a?Bu(C=>_t(a,Zo(C,this.targetProj_,this.sourceProj_))):Ni(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const P=C[0]+"/"+C[1];return l[P]||(l[P]=c(C)),l[P]},this.maxSourceExtent_=s,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&Oe(s)>=Oe(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Oe(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Oe(this.targetProj_.getExtent()):null;const h=rn(i),u=Kl(i),d=Yl(i),f=Xl(i),g=this.transformInv_(h),_=this.transformInv_(u),v=this.transformInv_(d),E=this.transformInv_(f),w=oT+(r?Math.max(0,Math.ceil(Math.log2(Du(i)/(r*r*256*256)))):0);if(this.addQuad_(h,u,d,f,g,_,v,E,w),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(P,R,A){C=Math.min(C,P.source[0][0],P.source[1][0],P.source[2][0])}),this.triangles_.forEach(P=>{if(Math.max(P.source[0][0],P.source[1][0],P.source[2][0])-C>this.sourceWorldWidth_/2){const R=[[P.source[0][0],P.source[0][1]],[P.source[1][0],P.source[1][1]],[P.source[2][0],P.source[2][1]]];R[0][0]-C>this.sourceWorldWidth_/2&&(R[0][0]-=this.sourceWorldWidth_),R[1][0]-C>this.sourceWorldWidth_/2&&(R[1][0]-=this.sourceWorldWidth_),R[2][0]-C>this.sourceWorldWidth_/2&&(R[2][0]-=this.sourceWorldWidth_);const A=Math.min(R[0][0],R[1][0],R[2][0]);Math.max(R[0][0],R[1][0],R[2][0])-A<this.sourceWorldWidth_/2&&(P.source=R)}})}l={}}addTriangle_(e,t,i,s,o,r){this.triangles_.push({source:[s,o,r],target:[e,t,i]})}addQuad_(e,t,i,s,o,r,a,l,c){const h=Hr([o,r,a,l]),u=this.sourceWorldWidth_?Oe(h)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const v=Hr([e,t,i,s]);g=Oe(v)/this.targetWorldWidth_>u1||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>u1||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!pt(h,this.maxSourceExtent_))return;let _=0;if(!g&&(!isFinite(o[0])||!isFinite(o[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)g=!0;else if(_=(!isFinite(o[0])||!isFinite(o[1])?8:0)+(!isFinite(r[0])||!isFinite(r[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(c>0){if(!g){const v=[(e[0]+i[0])/2,(e[1]+i[1])/2],E=this.transformInv_(v);let w;f?w=(fs(o[0],d)+fs(a[0],d))/2-fs(E[0],d):w=(o[0]+a[0])/2-E[0];const C=(o[1]+a[1])/2-E[1];g=w*w+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(e[0]-i[0])<=Math.abs(e[1]-i[1])){const v=[(t[0]+i[0])/2,(t[1]+i[1])/2],E=this.transformInv_(v),w=[(s[0]+e[0])/2,(s[1]+e[1])/2],C=this.transformInv_(w);this.addQuad_(e,t,v,w,o,r,E,C,c-1),this.addQuad_(w,v,i,s,C,E,a,l,c-1)}else{const v=[(e[0]+t[0])/2,(e[1]+t[1])/2],E=this.transformInv_(v),w=[(i[0]+s[0])/2,(i[1]+s[1])/2],C=this.transformInv_(w);this.addQuad_(e,v,w,s,o,E,C,l,c-1),this.addQuad_(v,t,i,w,E,r,a,C,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(e,i,s,o,a,l),(_&14)==0&&this.addTriangle_(e,i,t,o,a,r),_&&((_&13)==0&&this.addTriangle_(t,s,e,r,l,o),(_&7)==0&&this.addTriangle_(t,s,i,r,l,a))}calculateSourceExtent(){const e=gn();return this.triangles_.forEach(function(t,i,s){const o=t.source;Xr(e,o[0]),Xr(e,o[1]),Xr(e,o[2])}),e}getTriangles(){return this.triangles_}}const f1=.5;class p1 extends Fa{constructor(e,t,i,s,o,r,a,l,c,h,u,d){super(o,oe.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=s,this.wrappedTileCoord_=r||o,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const v=g?$n(f,g):f;if(Du(v)===0){this.state=oe.EMPTY;return}const E=e.getExtent();E&&(_?_=$n(_,E):_=E);const w=s.getResolution(this.wrappedTileCoord_[0]),C=sT(e,i,v,w);if(!isFinite(C)||C<=0){this.state=oe.EMPTY;return}const P=h!==void 0?h:f1;if(this.triangulation_=new d1(e,i,v,_,C*P,w),this.triangulation_.getTriangles().length===0){this.state=oe.EMPTY;return}this.sourceZ_=t.getZForResolution(C);let R=this.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(R[1]=ct(R[1],_[1],_[3]),R[3]=ct(R[3],_[1],_[3])):R=$n(R,_)),!Du(R))this.state=oe.EMPTY;else{let A=0,I=0;e.canWrapX()&&(A=Oe(E),I=Math.floor((R[0]-E[0])/A)),em(R.slice(),e,!0).forEach(z=>{const k=t.getTileRangeForExtentAndZ(z,this.sourceZ_);for(let q=k.minX;q<=k.maxX;q++)for(let Y=k.minY;Y<=k.maxY;Y++){const m=I*A;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,q,Y,a),offset:m})}++I}),this.sourceTiles_.length===0&&(this.state=oe.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{var s;const i=t.tile;if(i&&i.getState()==oe.LOADED){const o=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);o[0]+=t.offset,o[2]+=t.offset;const r=(s=this.clipExtent_)==null?void 0:s.slice();r&&(r[0]+=t.offset,r[2]+=t.offset),e.push({extent:o,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=oe.ERROR;else{const t=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(t),s=typeof i=="number"?i:i[0],o=typeof i=="number"?i:i[1],r=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=h1(s,o,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),r,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=oe.LOADED}this.changed()}load(){for(const e of this.sourceTiles_)e.tile=e.getTile();if(this.state==oe.IDLE){this.state=oe.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const i=t.getState();if(i==oe.IDLE||i==oe.LOADING){e++;const s=qe(t,we.CHANGE,o=>{const r=t.getState();(r==oe.LOADED||r==oe.ERROR||r==oe.EMPTY)&&(st(s),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},i,s){t.getState()==oe.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(st),this.sourcesListenerKeys_=null}release(){this.canvas_&&(ca(this.canvas_.getContext("2d")),Pr.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class g1{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const e=this.pop();e instanceof Zr&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const i=this.entries_[e];return $e(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(e){const t=this.entries_[e];return $e(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.key_;return e}getValues(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){var t;return(t=this.entries_[e])==null?void 0:t.value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){$e(!(e in this.entries_),"Tried to set a value for a key that is used already");const i={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[e]=i,++this.count_}setSize(e){this.highWaterMark=e}}function Rh(n,e,t,i){return i!==void 0?(i[0]=n,i[1]=e,i[2]=t,i):[n,e,t]}function rT(n,e,t){return n+"/"+e+"/"+t}function Th(n,e,t,i,s){return`${Re(n)},${e},${rT(t,i,s)}`}function m1(n){return aT(n[0],n[1],n[2])}function aT(n,e,t){return(e<<n)+t}function lT(n,e){const t=n[0],i=n[1],s=n[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const o=e.getFullTileRange(t);return o?o.containsXY(i,s):!0}function op(n,e,t){if(!(t in n))return n[t]=new Set([e]),!0;const i=n[t],s=i.has(e);return s||i.add(e),!s}function cT(n,e,t){const i=n[t];return i?i.delete(e):!1}function y1(n,e){const t=n.layerStatesArray[n.layerIndex];t.extent&&(e=$n(e,fi(t.extent,n.viewState.projection)));const i=t.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(e=$n(e,s))}return e}class _1 extends zd{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=gn(),this.tempTileRange_=new nf(0,0,0,0),this.tempTileCoord_=Rh(0,0,0);const i=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new g1(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new g1(512)),this.sourceTileCache_}getOrCreateTile(e,t,i,s){const o=this.tileCache_,a=this.getLayer().getSource(),l=Th(a,a.getKey(),e,t,i);let c;if(o.containsKey(l))c=o.get(l);else{const h=s.viewState.projection,u=a.getProjection();if(c=a.getTile(e,t,i,s.pixelRatio,h,!u||Wt(u,h)?void 0:this.getSourceTileCache()),!c)return null;o.set(l,c)}return c}getTile(e,t,i,s){const o=this.getOrCreateTile(e,t,i,s);return o||null}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),s=_t(t.pixelToCoordinateTransform,e.slice()),o=i.getExtent();if(o&&!Zs(o,s))return null;const r=t.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(r.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let h=l.getZForResolution(r.resolution);h>=l.getMinZoom();--h){const u=l.getTileCoordForCoordAndZ(s,h),d=this.getTile(h,u[1],u[2],t);if(!d||d.getState()!==oe.LOADED)continue;const f=l.getOrigin(h),g=$t(l.getTileSize(h)),_=l.getResolution(h);let v;if(d instanceof oy||d instanceof p1)v=d.getImage();else if(d instanceof l1){if(v=np(d.getData()),!v)continue}else continue;const E=Math.floor(c*((s[0]-f[0])/_-u[1]*g[0])),w=Math.floor(c*((f[1]-s[1])/_-u[2]*g[1])),C=Math.round(c*a.getGutterForProjection(r.projection));return this.getImageData(v,E+C,w+C)}return null}prepareFrame(e){var s;this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const t=this.getLayer().getSource();if(!t)return!1;const i=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),(s=this.sourceTileCache_)==null||s.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,i,s,o){const r=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(r.projection),h=Re(l);h in e.wantedTiles||(e.wantedTiles[h]={});const u=e.wantedTiles[h],d=a.getMapInternal(),f=Math.max(i-o,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),g=r.rotation,_=g?Kg(r.center,r.resolution,g,e.size):void 0;for(let v=i;v>=f;--v){const E=c.getTileRangeForExtentAndZ(t,v,this.tempTileRange_),w=c.getResolution(v);for(let C=E.minX;C<=E.maxX;++C)for(let P=E.minY;P<=E.maxY;++P){if(g&&!c.tileCoordIntersectsViewport([v,C,P],_))continue;const R=this.getTile(v,C,P,e);if(!R||!op(s,R,v))continue;const I=R.getKey();if(u[I]=!0,R.getState()===oe.IDLE&&!e.tileQueue.isKeyQueued(I)){const M=Rh(v,C,P,this.tempTileCoord_);e.tileQueue.enqueue([R,h,c.getTileCoordCenter(M),w])}}}}findStaleTile_(e,t){const i=this.tileCache_,s=e[0],o=e[1],r=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const c=Th(this.getLayer().getSource(),a[l],s,o,r);if(i.containsKey(c)){const h=i.peek(c);if(h.getState()===oe.LOADED)return h.endTransition(Re(this)),op(t,h,s),!0}}return!1}findAltTiles_(e,t,i,s){const o=e.getTileRangeForTileCoordAndZ(t,i,this.tempTileRange_);if(!o)return!1;let r=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let h=o.minX;h<=o.maxX;++h)for(let u=o.minY;u<=o.maxY;++u){const d=Th(l,c,i,h,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===oe.LOADED&&(op(s,g,i),f=!0)}f||(r=!1)}return r}renderFrame(e,t){this.renderComplete=!0;const i=e.layerStatesArray[e.layerIndex],s=e.viewState,o=s.projection,r=s.resolution,a=s.center,l=e.pixelRatio,c=this.getLayer(),h=c.getSource(),u=h.getTileGridForProjection(o),d=u.getZForResolution(r,h.zDirection),f=u.getResolution(d),g=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let _=e.extent;const v=h.getTilePixelRatio(l);this.prepareContainer(e,t);const E=this.context.canvas.width,w=this.context.canvas.height,C=i.extent&&fi(i.extent);C&&(_=$n(_,fi(i.extent)));const P=f*E/2/v,R=f*w/2/v,A=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],I={};this.renderedTiles.length=0;const M=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){const j=u.getZForResolution(s.nextResolution,h.zDirection),U=y1(e,e.nextExtent);this.enqueueTiles(e,U,j,I,M)}const z=y1(e,_);if(this.enqueueTiles(e,z,d,I,0),M>0&&setTimeout(()=>{this.enqueueTiles(e,z,d-1,I,M-1)},0),!(d in I))return this.container;const k=Re(this),q=e.time;for(const j of I[d]){const U=j.getState();if(U===oe.EMPTY)continue;const B=j.tileCoord;if(U===oe.LOADED&&j.getAlpha(k,q)===1){j.endTransition(k);continue}if(U!==oe.ERROR&&(this.renderComplete=!1),this.findStaleTile_(B,I)){cT(I,j,d),e.animate=!0;continue}if(this.findAltTiles_(u,B,d+1,I))continue;const ae=u.getMinZoom();for(let ne=d-1;ne>=ae&&!this.findAltTiles_(u,B,ne,I);--ne);}const Y=f/r*l/v,m=this.getRenderContext(e);Hn(this.tempTransform,E/2,w/2,Y,Y,0,-E/2,-w/2),i.extent&&this.clipUnrotated(m,e,C),h.getInterpolate()||(m.imageSmoothingEnabled=!1),this.preRender(m,e);const b=Object.keys(I).map(Number);b.sort(li);let S;const L=[],N=[];for(let j=b.length-1;j>=0;--j){const U=b[j],B=h.getTilePixelSize(U,l,o),G=u.getResolution(U)/f,ae=B[0]*G*Y,ne=B[1]*G*Y,V=u.getTileCoordForCoordAndZ(rn(A),U),re=u.getTileCoordExtent(V),se=_t(this.tempTransform,[v*(re[0]-A[0])/f,v*(A[3]-re[3])/f]),he=v*h.getGutterForProjection(o);for(const ye of I[U]){if(ye.getState()!==oe.LOADED)continue;const pe=ye.tileCoord,Fe=V[1]-pe[1],je=Math.round(se[0]-(Fe-1)*ae),ee=V[2]-pe[2],ft=Math.round(se[1]-(ee-1)*ne),rt=Math.round(se[0]-Fe*ae),_e=Math.round(se[1]-ee*ne),tn=je-rt,Ut=ft-_e,yt=b.length===1;let At=!1;S=[rt,_e,rt+tn,_e,rt+tn,_e+Ut,rt,_e+Ut];for(let et=0,jn=L.length;et<jn;++et)if(!yt&&U<N[et]){const nt=L[et];pt([rt,_e,rt+tn,_e+Ut],[nt[0],nt[3],nt[4],nt[7]])&&(At||(m.save(),At=!0),m.beginPath(),m.moveTo(S[0],S[1]),m.lineTo(S[2],S[3]),m.lineTo(S[4],S[5]),m.lineTo(S[6],S[7]),m.moveTo(nt[6],nt[7]),m.lineTo(nt[4],nt[5]),m.lineTo(nt[2],nt[3]),m.lineTo(nt[0],nt[1]),m.clip())}L.push(S),N.push(U),this.drawTile(ye,e,rt,_e,tn,Ut,he,yt),At&&m.restore(),this.renderedTiles.unshift(ye),this.updateUsedTiles(e.usedTiles,h,ye)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Li(this.renderedExtent_,A),this.renderedExtent_=A,this.renderedPixelRatio=l,this.postRender(this.context,e),i.extent&&m.restore(),m.imageSmoothingEnabled=!0,this.renderComplete){const j=(U,B)=>{var ne;const Z=Re(h),G=B.wantedTiles[Z],ae=G?Object.keys(G).length:0;this.updateCacheSize(ae),this.tileCache_.expireCache(),(ne=this.sourceTileCache_)==null||ne.expireCache()};e.postRenderFunctions.push(j)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,i,s,o,r,a,l){let c;if(e instanceof l1){if(c=np(e.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(e);if(!c)return;const h=this.getRenderContext(t),u=Re(this),d=t.layerStatesArray[t.layerIndex],f=d.opacity*(l?e.getAlpha(u,t.time):1),g=f!==h.globalAlpha;g&&(h.save(),h.globalAlpha=f),h.drawImage(c,a,a,c.width-2*a,c.height-2*a,i,s,o,r),g&&h.restore(),f!==d.opacity?t.animate=!0:l&&e.endTransition(u)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,i){const s=Re(t);s in e||(e[s]={}),e[s][i.getKey()]=!0}}const ks={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class hT extends Da{constructor(e){e=e||{};const t=Object.assign({},e),i=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(ks.PRELOAD)}setPreload(e){this.set(ks.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(ks.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(ks.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}class Oh extends hT{constructor(e){super(e)}createRenderer(){return new _1(this,{cacheSize:this.getCacheSize()})}}class uT extends wc{constructor(e,t,i,s,o,r,a){let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let c=t.getExtent();c&&t.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);const h=c?$n(i,c):i,u=xn(h),d=Sh(e,t,u,s),f=f1,g=new d1(e,t,h,l,d*f,s),_=g.calculateSourceExtent(),v=zi(_)?null:r(_,d,o),E=v?le.IDLE:le.EMPTY,w=v?v.getPixelRatio():1;super(i,s,w,E),this.targetProj_=t,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=v,this.sourcePixelRatio_=w,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==le.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const e=this.sourceImage_.getState();if(e==le.LOADED){const t=Oe(this.targetExtent_)/this.targetResolution_,i=lt(this.targetExtent_)/this.targetResolution_;this.canvas_=h1(t,i,this.sourcePixelRatio_,xh(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=e,this.changed()}load(){if(this.state==le.IDLE){this.state=le.LOADING,this.changed();const e=this.sourceImage_.getState();e==le.LOADED||e==le.ERROR?this.reproject_():(this.sourceListenerKey_=qe(this.sourceImage_,we.CHANGE,t=>{const i=this.sourceImage_.getState();(i==le.LOADED||i==le.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){st(this.sourceListenerKey_),this.sourceListenerKey_=null}}const Sr=4,rp={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class dT extends Bn{constructor(e,t){super(e),this.image=t}}class ap extends Ca{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:e.interpolate!==void 0?e.interpolate:!0}),this.on,this.once,this.un,this.loader=e.loader||null,this.resolutions_=e.resolutions!==void 0?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=e.loader?e.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(e){this.resolutions_=e}findNearestResolution(e){const t=this.getResolutions();if(t){const i=Hl(t,e,0);e=t[i]}return e}getImage(e,t,i,s){const o=this.getProjection();if(!o||!s||Wt(o,s))return o&&(s=o),this.getImageInternal(e,t,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Wt(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==t&&Li(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new uT(o,s,e,t,i,(r,a,l)=>this.getImageInternal(r,a,l,o),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,i,s){if(this.loader){const o=pT(e,t,i,1),r=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&Di(this.wantedExtent_,o)||Di(this.image.getExtent(),o))&&(this.wantedResolution_&&xh(this.wantedResolution_)===r||xh(this.image.getResolution())===r)))return this.image;this.wantedProjection_=s,this.wantedExtent_=o,this.wantedResolution_=r,this.image=new wc(o,r,i,this.loader),this.image.addEventListener(we.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){const t=e.target;let i;switch(t.getState()){case le.LOADING:this.loading=!0,i=rp.IMAGELOADSTART;break;case le.LOADED:this.loading=!1,i=rp.IMAGELOADEND;break;case le.ERROR:this.loading=!1,i=rp.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new dT(i,t))}}function fT(n,e){n.getImage().src=e}function pT(n,e,t,i){const s=e/t,o=xn(n),r=ps(Oe(n)/s,Sr),a=ps(lt(n)/s,Sr),l=ps((i-1)*r/2,Sr),c=r+2*l,h=ps((i-1)*a/2,Sr),u=a+2*h;return Zl(o,s,0,[c,u])}function gT(n){const e=n.load||Qm,t=n.imageExtent,i=n.crossOrigin??null;return()=>{const s=new Image;return s.crossOrigin=i,n.referrerPolicy!==void 0&&(s.referrerPolicy=n.referrerPolicy),e(s,n.url).then(o=>{const r=Oe(t)/o.width,a=lt(t)/o.height;return{image:o,extent:t,resolution:r!==a?[r,a]:a,pixelRatio:1}})}}class w1 extends ap{constructor(e){const t=e.crossOrigin!==void 0?e.crossOrigin:null,i=e.imageLoadFunction!==void 0?e.imageLoadFunction:fT;super({attributions:e.attributions,interpolate:e.interpolate,projection:Ne(e.projection)}),this.url_=e.url,this.imageExtent_=e.imageExtent,this.image=null,this.image=new wc(this.imageExtent_,void 0,1,gT({url:e.url,imageExtent:e.imageExtent,crossOrigin:t,referrerPolicy:e.referrerPolicy,load:(s,o)=>(this.image.setImage(s),i(this.image,o),Qm(s))})),this.image.addEventListener(we.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(e,t,i,s){return pt(e,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}const Rr=[0,0,0],js=5;class Us{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,$e(xv(this.resolutions_,(s,o)=>o-s),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let s=0,o=this.resolutions_.length-1;s<o;++s)if(!t)t=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,$e(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=rn(i)),$e(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,$e(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:$d,$e(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((s,o)=>{const r=new nf(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,o);r.minX=Math.max(a.minX,r.minX),r.maxX=Math.min(a.maxX,r.maxX),r.minY=Math.max(a.minY,r.minY),r.maxY=Math.min(a.maxY,r.maxY)}return r}):i&&this.calculateTileRanges_(i)}forEachTileCoord(e,t,i){const s=this.getTileRangeForExtentAndZ(e,t);for(let o=s.minX,r=s.maxX;o<=r;++o)for(let a=s.minY,l=s.maxY;a<=l;++a)i([t,o,a])}forEachTileCoordParentTileRange(e,t,i,s){let o,r,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(r=e[1],a=e[2]):l=this.getTileCoordExtent(e,s);c>=this.minZoom;){if(r!==void 0&&a!==void 0?(r=Math.floor(r/2),a=Math.floor(a/2),o=cr(r,r,a,a,i)):o=this.getTileRangeForExtentAndZ(l,c,i),t(c,o))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,i){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const o=e[1]*2,r=e[2]*2;return cr(o,o+1,r,r+1,t)}const s=this.getTileCoordExtent(e,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,i){if(t>this.maxZoom||t<this.minZoom)return null;const s=e[0],o=e[1],r=e[2];if(t===s)return cr(o,r,o,r,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-s),c=Math.floor(o*l),h=Math.floor(r*l);if(t<s)return cr(c,c,h,h,i);const u=Math.floor(l*(o+1))-1,d=Math.floor(l*(r+1))-1;return cr(c,u,h,d,i)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,i)}getTileRangeForExtentAndZ(e,t,i){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Rr);const s=Rr[1],o=Rr[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Rr);const r=Rr[1],a=Rr[2];return cr(s,r,o,a,i)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),i=this.getResolution(e[0]),s=$t(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*s[0]*i,t[1]-(e[2]+.5)*s[1]*i]}getTileCoordExtent(e,t){const i=this.getOrigin(e[0]),s=this.getResolution(e[0]),o=$t(this.getTileSize(e[0]),this.tmpSize_),r=i[0]+e[1]*o[0]*s,a=i[1]-(e[2]+1)*o[1]*s,l=r+o[0]*s,c=a+o[1]*s;return Fi(r,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,i){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,i)}getTileCoordForXYAndResolution_(e,t,i,s,o){const r=this.getZForResolution(i),a=i/this.getResolution(r),l=this.getOrigin(r),c=$t(this.getTileSize(r),this.tmpSize_);let h=a*(e-l[0])/i/c[0],u=a*(l[1]-t)/i/c[1];return s?(h=ps(h,js)-1,u=ps(u,js)-1):(h=Ql(h,js),u=Ql(u,js)),Rh(r,h,u,o)}getTileCoordForXYAndZ_(e,t,i,s,o){const r=this.getOrigin(i),a=this.getResolution(i),l=$t(this.getTileSize(i),this.tmpSize_);let c=(e-r[0])/a/l[0],h=(r[1]-t)/a/l[1];return s?(c=ps(c,js)-1,h=ps(h,js)-1):(c=Ql(c,js),h=Ql(h,js)),Rh(i,c,h,o)}getTileCoordForCoordAndZ(e,t,i){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,i)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){const i=Hl(this.resolutions_,e,t||0);return ct(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return jm(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,i=new Array(t);for(let s=this.minZoom;s<t;++s)i[s]=this.getTileRangeForExtentAndZ(e,s);this.fullTileRanges_=i}}class mT extends Us{constructor(e){super({extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes}),this.matrixIds_=e.matrixIds}getMatrixId(e){return this.matrixIds_[e]}getMatrixIds(){return this.matrixIds_}}function lp(n){let e=n.getDefaultTileGrid();return e||(e=wT(n),n.setDefaultTileGrid(e)),e}function yT(n,e,t){const i=e[0],s=n.getTileCoordCenter(e),o=Qa(t);if(!Zs(o,s)){const r=Oe(o),a=Math.ceil((o[0]-s[0])/r);return s[0]+=r*a,n.getTileCoordForCoordAndZ(s,i)}return e}function _T(n,e,t,i){i=i!==void 0?i:"top-left";const s=v1(n,e,t);return new Us({extent:n,origin:Rv(n,i),resolutions:s,tileSize:t})}function Tr(n){const e=n||{},t=e.extent||Ne("EPSG:3857").getExtent(),i={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:v1(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Us(i)}function v1(n,e,t,i){e=e!==void 0?e:ty,t=$t(t!==void 0?t:$d);const s=lt(n),o=Oe(n);i=i>0?i:Math.max(o/t[0],s/t[1]);const r=e+1,a=new Array(r);for(let l=0;l<r;++l)a[l]=i/Math.pow(2,l);return a}function wT(n,e,t,i){const s=Qa(n);return _T(s,e,t,i)}function Qa(n){n=Ne(n);let e=n.getExtent();if(!e){const t=180*nc.degrees/n.getMetersPerUnit();e=Fi(-t,-t,t,t)}return e}class b1 extends Ca{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const t=[256,256];this.tileGrid&&$t(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Re(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,i,s,o,r){return be()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:lp(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,i){const s=this.getTileGridForProjection(i),o=this.getTilePixelRatio(t),r=$t(s.getTileSize(e),this.tmpSize);return o==1?r:ME(r,o,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){const i=t!==void 0?t:this.getProjection(),s=t!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(e=yT(s,e,i)),lT(e,s)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class vT extends Bn{constructor(e,t){super(e),this.tile=t}}function E1(n){return function(e){const t=e.buffers,i=e.meta,s=e.imageOps,o=e.width,r=e.height,a=t.length,l=t[0].byteLength;if(s){const d=new Array(a);for(let g=0;g<a;++g)d[g]=new ImageData(new Uint8ClampedArray(t[g]),o,r);return n(d,i).data.buffer}const c=new Uint8ClampedArray(l),h=new Array(a),u=new Array(a);for(let d=0;d<a;++d)h[d]=new Uint8ClampedArray(t[d]),u[d]=[0,0,0,0];for(let d=0;d<l;d+=4){for(let g=0;g<a;++g){const _=h[g];u[g][0]=_[d],u[g][1]=_[d+1],u[g][2]=_[d+2],u[g][3]=_[d+3]}const f=n(u,i);c[d]=f[0],c[d+1]=f[1],c[d+2]=f[2],c[d+3]=f[3]}return c.buffer}}function bT(n,e){const i=Object.keys(n.lib||{}).map(function(o){return"const "+o+" = "+n.lib[o].toString()+";"}).concat(["const __minion__ = ("+E1.toString()+")(",n.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),s=new Worker(typeof Blob>"u"?"data:text/javascript;base64,"+Buffer.from(i.join(`
|
|
156
156
|
`),"binary").toString("base64"):URL.createObjectURL(new Blob(i,{type:"text/javascript"})));return s.addEventListener("message",e),s}function ET(n,e){const t=E1(n.operation);let i=!1;return{postMessage:function(s){setTimeout(function(){i||e({data:{buffer:t(s),meta:s.meta}})},0)},terminate:function(){i=!0}}}class CT extends Zr{constructor(e){super(),this.imageOps_=!!e.imageOps;let t;e.threads===0?t=0:this.imageOps_?t=1:t=e.threads||1;const i=new Array(t);if(t)for(let s=0;s<t;++s)i[s]=bT(e,this.onWorkerMessage_.bind(this,s));else i[0]=ET(e,this.onWorkerMessage_.bind(this,0));this.workers_=i,this.queue_=[],this.maxQueueLength_=e.queue||1/0,this.running_=0,this.dataLookup_={},this.job_=null}process(e,t,i){this.enqueue_({inputs:e,meta:t,callback:i}),this.dispatch_()}enqueue_(e){for(this.queue_.push(e);this.queue_.length>this.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||this.queue_.length===0)return;const e=this.queue_.shift();this.job_=e;const t=e.inputs[0].width,i=e.inputs[0].height,s=e.inputs.map(function(l){return l.data.buffer}),o=this.workers_.length;if(this.running_=o,o===1){this.workers_[0].postMessage({buffers:s,meta:e.meta,imageOps:this.imageOps_,width:t,height:i},s);return}const r=e.inputs[0].data.length,a=4*Math.ceil(r/4/o);for(let l=0;l<o;++l){const c=l*a,h=[];for(let u=0,d=s.length;u<d;++u)h.push(s[u].slice(c,c+a));this.workers_[l].postMessage({buffers:h,meta:e.meta,imageOps:this.imageOps_,width:t,height:i},h)}}onWorkerMessage_(e,t){this.disposed||(this.dataLookup_[e]=t.data,--this.running_,this.running_===0&&this.resolveJob_())}resolveJob_(){const e=this.job_,t=this.workers_.length;let i,s;if(t===1)i=new Uint8ClampedArray(this.dataLookup_[0].buffer),s=this.dataLookup_[0].meta;else{const o=e.inputs[0].data.length;i=new Uint8ClampedArray(o),s=new Array(t);const r=4*Math.ceil(o/4/t);for(let a=0;a<t;++a){const l=this.dataLookup_[a].buffer,c=a*r;i.set(new Uint8ClampedArray(l),c),s[a]=this.dataLookup_[a].meta}}this.job_=null,this.dataLookup_={},e.callback(null,new ImageData(i,e.inputs[0].width,e.inputs[0].height),s),this.dispatch_()}disposeInternal(){for(let e=0;e<this.workers_.length;++e)this.workers_[e].terminate();this.workers_.length=0}}const C1={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"};class x1 extends Bn{constructor(e,t,i){super(e),this.extent=t.extent,this.resolution=t.viewState.resolution/t.pixelRatio,this.data=i}}class cp extends ap{constructor(e){super({projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=e.operationType!==void 0?e.operationType:"pixel",this.threads_=e.threads!==void 0?e.threads:1,this.layers_=ST(e.sources);const t=this.changed.bind(this);for(let i=0,s=this.layers_.length;i<s;++i)this.layers_[i].addEventListener(we.CHANGE,t);this.useResolutions_=e.resolutions!==null,this.tileQueue_=new ry(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:Kt(),declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:PT(this.layers_),pixelRatio:1,pixelToCoordinateTransform:Kt(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:Re(this),renderTargets:{}},this.setAttributions(function(i){var o;const s=[];for(let r=0,a=e.sources.length;r<a;++r){const l=e.sources[r],c=l instanceof Ca?l:l.getSource();if(!c)continue;const h=(o=c.getAttributions())==null?void 0:o(i);typeof h=="string"?s.push(h):h!==void 0&&s.push(...h)}return s}),e.operation!==void 0&&this.setOperation(e.operation,e.lib)}setOperation(e,t){this.processor_&&this.processor_.dispose(),this.processor_=new CT({operation:e,imageOps:this.operationType_==="image",queue:1,lib:t,threads:this.threads_}),this.changed()}updateFrameState_(e,t,i){const s=Object.assign({},this.frameState_);s.viewState=Object.assign({},s.viewState);const o=xn(e);s.size[0]=Math.ceil(Oe(e)/t),s.size[1]=Math.ceil(lt(e)/t),s.extent=[o[0]-s.size[0]*t/2,o[1]-s.size[1]*t/2,o[0]+s.size[0]*t/2,o[1]+s.size[1]*t/2],s.time=Date.now();const r=s.viewState;return r.center=o,r.projection=i,r.resolution=t,s}allSourcesReady_(){let e=!0,t;for(let i=0,s=this.layers_.length;i<s;++i)if(t=this.layers_[i].getSource(),!t||t.getState()!=="ready"){e=!1;break}return e}getImage(e,t,i,s){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),t=this.findNearestResolution(t);const o=this.updateFrameState_(e,t,s);if(this.requestedFrameState_=o,this.renderedImageCanvas_){const r=this.renderedImageCanvas_.getResolution(),a=this.renderedImageCanvas_.getExtent();(t!==r||!Li(o.extent,a))&&(this.renderedImageCanvas_=null)}return(!this.renderedImageCanvas_||this.getRevision()!==this.renderedRevision_)&&this.processSources_(),o.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const e=this.requestedFrameState_,t=this.layers_.length,i=new Array(t);for(let o=0;o<t;++o){e.layerIndex=o,e.renderTargets={};const r=xT(this.layers_[o],e);if(r)i[o]=r;else return}const s={};this.dispatchEvent(new x1(C1.BEFOREOPERATIONS,e,s)),this.processor_.process(i,s,this.onWorkerComplete_.bind(this,e))}onWorkerComplete_(e,t,i,s){if(t||!i)return;const o=e.extent,r=e.viewState.resolution;if(r!==this.requestedFrameState_.viewState.resolution||!Li(o,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const l=Math.round(Oe(o)/r),c=Math.round(lt(o)/r);a=ht(l,c),this.renderedImageCanvas_=new sy(o,r,1,a.canvas)}a.putImageData(i,0,0),e.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new x1(C1.AFTEROPERATIONS,e,s))}getResolutions(e){if(!this.useResolutions_)return null;let t=super.getResolutions();if(!t)for(let i=0,s=this.layers_.length;i<s&&(t=this.layers_[i].getSource().getResolutions(e),!t);++i);return t}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}cp.prototype.dispose;let bo=null;function xT(n,e){const t=n.getRenderer();if(!t)throw new Error("Unsupported layer type: "+n);if(!t.prepareFrame(e))return null;const i=e.size[0],s=e.size[1];if(i===0||s===0)return null;const o=t.renderFrame(e,null);let r;if(o instanceof HTMLCanvasElement)r=o;else{if(o&&(r=o.firstElementChild),!(r instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+r);if(r.width===i&&r.height===s)return r.getContext("2d").getImageData(0,0,i,s)}if(!bo)bo=ht(i,s,void 0,{willReadFrequently:!0});else{const a=bo.canvas;a.width!==i||a.height!==s?bo=ht(i,s,void 0,{willReadFrequently:!0}):bo.clearRect(0,0,i,s)}return bo.drawImage(r,0,0,i,s),bo.getImageData(0,0,i,s)}function PT(n){return n.map(function(e){return e.getLayerState()})}function ST(n){const e=n.length,t=new Array(e);for(let i=0;i<e;++i)t[i]=RT(n[i]);return t}function RT(n){let e;return n instanceof Ca?n instanceof b1?e=new Oh({source:n}):n instanceof ap&&(e=new tp({source:n})):e=n,e}function Ih(n,e){const t=[];Object.keys(e).forEach(function(s){e[s]!==null&&e[s]!==void 0&&t.push(s+"="+encodeURIComponent(e[s]))});const i=t.join("&");return n=n.replace(/[?&]$/,""),n+=n.includes("?")?"&":"?",n+i}const TT=/\{z\}/g,OT=/\{x\}/g,IT=/\{y\}/g,AT=/\{-y\}/g;function MT(n,e,t,i,s){return n.replace(TT,e.toString()).replace(OT,t.toString()).replace(IT,i.toString()).replace(AT,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-i).toString()})}function P1(n){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(n);if(t){const i=t[1].charCodeAt(0),s=t[2].charCodeAt(0);let o;for(o=i;o<=s;++o)e.push(n.replace(t[0],String.fromCharCode(o)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(n),t){const i=parseInt(t[2],10);for(let s=parseInt(t[1],10);s<=i;s++)e.push(n.replace(t[0],s.toString()));return e}return e.push(n),e}function DT(n,e){return(function(t,i,s){if(!t)return;let o;const r=t[0];if(e){const a=e.getFullTileRange(r);a&&(o=a.getHeight()-1)}return MT(n,r,t[1],t[2],o)})}function S1(n,e){const t=n.length,i=new Array(t);for(let s=0;s<t;++s)i[s]=DT(n[s],e);return hp(i)}function hp(n){return n.length===1?n[0]:(function(e,t,i){if(!e)return;const s=m1(e),o=fs(s,n.length);return n[o](e,t,i)})}const up={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Ah extends b1{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Ah.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const t=e.target,i=Re(t),s=t.getState();let o;s==oe.LOADING?(this.tileLoadingKeys_[i]=!0,o=up.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],o=s==oe.ERROR?up.TILELOADERROR:s==oe.LOADED?up.TILELOADEND:void 0),o!=null&&this.dispatchEvent(new vT(o,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){const t=P1(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
|
|
157
157
|
`);this.generateTileUrlFunction_?this.setTileUrlFunction(S1(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,i){}}class Mh extends Ah{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:FT,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:oy,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!Wt(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||Wt(t,e)))return this.tileGrid;const i=Re(e);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=lp(e)),this.tileGridForProjection[i]}createTile_(e,t,i,s,o,r){const a=[e,t,i],l=this.getTileCoordForTileUrlFunction(a,o),c=l?this.tileUrlFunction(l,s,o):void 0,h=new this.tileClass(a,c!==void 0?oe.IDLE:oe.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=r,h.addEventListener(we.CHANGE,this.handleTileChange.bind(this)),h}getTile(e,t,i,s,o,r){const a=this.getProjection();if(!a||!o||Wt(a,o))return this.getTileInternal(e,t,i,s,a||o);const l=[e,t,i],c=this.getKey(),h=this.getTileGridForProjection(a),u=this.getTileGridForProjection(o),d=this.getTileCoordForTileUrlFunction(l,o),f=new p1(a,h,o,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(g,_,v,E)=>this.getTileInternal(g,_,v,E,a,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=c,f}getTileInternal(e,t,i,s,o,r){const a=this.getKey(),l=Th(this,a,e,t,i);if(r&&r.containsKey(l))return r.get(l);const c=this.createTile_(e,t,i,s,o,a);return r==null||r.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){const i=Ne(e);if(i){const s=Re(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=t)}}}function FT(n,e){if(ln){const t=n.getCrossOrigin();let i="same-origin",s="same-origin";t==="anonymous"||t===""?(i="cors",s="omit"):t==="use-credentials"&&(i="cors",s="include");const o={mode:i,credentials:s,referrerPolicy:n.getReferrerPolicy()};fetch(e,o).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.blob()}).then(r=>createImageBitmap(r)).then(r=>{var c;const a=n.getImage();a.width=r.width,a.height=r.height,a.getContext("2d").drawImage(r,0,0),(c=r.close)==null||c.call(r),a.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=e}const dp="1.3.0";function LT(n,e,t,i,s){s.WIDTH=t[0],s.HEIGHT=t[1];const o=i.getAxisOrientation(),r=lm(s.VERSION,"1.3")>=0;s[r?"CRS":"SRS"]=i.getCode();const a=r&&o.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return s.BBOX=a.join(","),Ih(n,s)}function zT(n,e,t,i,s,o,r){o=Object.assign({REQUEST:"GetMap"},o);const a=e/t,l=[nm(Oe(n)/a,Sr),nm(lt(n)/a,Sr)];if(t!=1)switch(r){case"geoserver":const h=90*t+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+h:o.FORMAT_OPTIONS="dpi:"+h;break;case"mapserver":o.MAP_RESOLUTION=90*t;break;case"carmentaserver":case"qgis":o.DPI=90*t;break;default:throw new Error("Unknown `serverType` configured")}return LT(s,n,l,i,o)}function R1(n,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:dp,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},n)}class NT extends Mh{constructor(e){e=e||{};const t=Object.assign({},e.params);super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0,this.params_=t,this.v13_=!0,this.serverType_=e.serverType,this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.tmpExtent_=gn(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(e,t,i,s){const o=Ne(i),r=this.getProjection()||o;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(r));const l=Zo(e,o,r),c=Sh(r,o,e,t),h=a.getZForResolution(c,this.zDirection),u=a.getResolution(h),d=a.getTileCoordForCoordAndZ(l,h);if(a.getResolutions().length<=d[0])return;let f=a.getTileCoordExtent(d,this.tmpExtent_);const g=this.gutter_;g!==0&&(f=hi(f,u*g,f));const _={QUERY_LAYERS:this.params_.LAYERS};Object.assign(_,R1(this.params_,"GetFeatureInfo"),s);const v=Math.floor((l[0]-f[0])/u),E=Math.floor((f[3]-l[1])/u);return _[this.v13_?"I":"X"]=v,_[this.v13_?"J":"Y"]=E,this.getRequestUrl_(d,f,1,r||o,_)}getLegendUrl(e,t){if(this.urls[0]===void 0)return;const i={SERVICE:"WMS",VERSION:dp,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(t===void 0||t.LAYER===void 0){const s=this.params_.LAYERS;if(!(!Array.isArray(s)||s.length===1))return;i.LAYER=s}if(e!==void 0){const s=this.getProjection()?this.getProjection().getMetersPerUnit():1,o=28e-5;i.SCALE=e*s/o}return Object.assign(i,t),Ih(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(e,t,i,s,o){const r=this.urls;if(!r)return;let a;if(r.length==1)a=r[0];else{const l=fs(m1(e),r.length);a=r[l]}return zT(t,(this.tileGrid||this.getTileGridForProjection(s)).getResolution(e[0]),i,s,a,o,this.serverType_)}getTilePixelRatio(e){return!this.hidpi_||this.serverType_===void 0?1:e}getKeyForParams_(){let e=0;const t=[];for(const i in this.params_)t[e++]=i+"-"+this.params_[i];return t.join("/")}setParams_(e){this.params_=e,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(e){this.setParams_(Object.assign({},e))}updateParams(e){this.setParams_(Object.assign(this.params_,e))}updateV13_(){const e=this.params_.VERSION||dp;this.v13_=lm(e,"1.3")>=0}tileUrlFunction(e,t,i){let s=this.getTileGrid();if(s||(s=this.getTileGridForProjection(i)),s.getResolutions().length<=e[0])return;t!=1&&(!this.hidpi_||this.serverType_===void 0)&&(t=1);const o=s.getResolution(e[0]);let r=s.getTileCoordExtent(e,this.tmpExtent_);const a=this.gutter_;a!==0&&(r=hi(r,o*a,r));const l=Object.assign({},R1(this.params_,"GetMap"));return this.getRequestUrl_(e,r,t,i,l)}}class kT extends Mh{constructor(e){const t=e.requestEncoding!==void 0?e.requestEncoding:"KVP",i=e.tileGrid;let s=e.urls;s===void 0&&e.url!==void 0&&(s=P1(e.url)),super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,urls:s,wrapX:e.wrapX!==void 0?e.wrapX:!1,transition:e.transition,zDirection:e.zDirection}),this.version_=e.version!==void 0?e.version:"1.0.0",this.format_=e.format!==void 0?e.format:"image/jpeg",this.dimensions_=e.dimensions!==void 0?e.dimensions:{},this.layer_=e.layer,this.matrixSet_=e.matrixSet,this.style_=e.style,this.requestEncoding_=t,this.setKey(this.getKeyForDimensions_()),s&&s.length>0&&(this.tileUrlFunction=hp(s.map(this.createFromWMTSTemplate.bind(this))))}setUrls(e){this.urls=e;const t=e.join(`
|
|
158
|
-
`);this.setTileUrlFunction(hp(e.map(this.createFromWMTSTemplate.bind(this))),t)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const e=this.urls?this.urls.slice(0):[];for(const t in this.dimensions_)e.push(t+"-"+this.dimensions_[t]);return e.join("/")}updateDimensions(e){Object.assign(this.dimensions_,e),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(e){const t=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};t=="KVP"&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),e=t=="KVP"?Ih(e,i):e.replace(/\{(\w+?)\}/g,function(r,a){return a.toLowerCase()in i?i[a.toLowerCase()]:r});const s=this.tileGrid,o=this.dimensions_;return(function(r,a,l){if(!r)return;const c={TileMatrix:s.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};Object.assign(c,o);let h=e;return t=="KVP"?h=Ih(h,c):h=h.replace(/\{(\w+?)\}/g,function(u,d){return encodeURIComponent(c[d])}),h})}}class Dh extends Mh{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:Tr({extent:Qa(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const jT={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},T1={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class UT extends _1{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Kt(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(e,t,i,s,o,r,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,i,s,o,r,a,l)}getTile(e,t,i,s){const o=this.getOrCreateTile(e,t,i,s);if(!o)return null;const r=s.viewState,a=r.resolution,l=s.viewHints,c=this.getLayer().getSource(),h=c.getTileGridForProjection(r.projection),u=!(l[ot.ANIMATING]||l[ot.INTERACTING]),d=h.getZForResolution(a,c.zDirection)===e;return u&&d?o.wantedResolution=a:o.wantedResolution||(o.wantedResolution=h.getResolution(e)),o}prepareFrame(e){const t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,i){const s=this.getLayer(),o=s.getRevision(),r=s.getRenderOrder()||null,a=e.wantedResolution,l=e.getReplayState(s);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==o&&l.renderedPixelRatio===t&&l.renderedRenderOrder==r)return;const c=s.getSource(),h=!!s.getDeclutter(),u=c.getTileGrid(),f=c.getTileGridForProjection(i).getTileCoordExtent(e.wrappedTileCoord),g=c.getSourceTiles(t,i,e),_=Re(s);delete e.hitDetectionImageData[_],e.executorGroups[_]=[],l.dirty=!1;for(let v=0,E=g.length;v<E;++v){const w=g[v];if(w.getState()!=oe.LOADED)continue;const C=c.getProjection(),P=w.tileCoord;let R=u.getTileCoordExtent(P);i&&C&&!Wt(i,C)&&(R=oa(R,C,i,32));const A=$n(f,R),I=hi(A,s.getRenderBuffer()*a,this.tempExtent),M=Li(R,A)?null:I,z=new S0(0,A,a,t),k=xc(a,t),q=function(L,N){let j;const U=L.getStyleFunction()||s.getStyleFunction();if(U&&(j=U(L,a)),j){const B=this.renderFeature(L,k,j,z,h,N);l.dirty=l.dirty||B}},Y=w.getFeatures();r&&r!==l.renderedRenderOrder&&Y.sort(r);for(let L=0,N=Y.length;L<N;++L){let j=Y[L];i&&w.projection&&!Wt(i,w.projection)&&(j=j.clone(),j.getGeometry().applyTransform(Ni(w.projection,i))),(!M||pt(M,j.getGeometry().getExtent()))&&q.call(this,j,L)}const m=z.finish(),b=s.getRenderMode()!=="vector"&&h&&g.length===1?null:A,S=new A0(b,a,t,c.getOverlaps(),m,s.getRenderBuffer(),!0);e.executorGroups[_].push(S)}l.renderedRevision=o,l.renderedPixelRatio=t,l.renderedRenderOrder=r,l.renderedResolution=a}forEachFeatureAtCoordinate(e,t,i,s,o){var C,P;const r=t.viewState.resolution,a=t.viewState.rotation;i=i??0;const l=this.getLayer(),h=l.getSource().getTileGridForProjection(t.viewState.projection),u=Hr([e]);hi(u,r*i,u);const d={},f=function(R,A,I){let M=R.getId();M===void 0&&(M=Re(R));const z=d[M];if(z){if(z!==!0&&I<z.distanceSq){if(I===0)return d[M]=!0,o.splice(o.lastIndexOf(z),1),s(R,l,A);z.geometry=A,z.distanceSq=I}}else{if(I===0)return d[M]=!0,s(R,l,A);o.push(d[M]={feature:R,layer:l,geometry:A,distanceSq:I,callback:s})}},g=this.renderedTiles,_=Re(l),v=l.getDeclutter(),E=v?(P=(C=t.declutter)==null?void 0:C[v])==null?void 0:P.all().map(R=>R.value):null;let w;e:for(let R=0,A=g.length;R<A;++R){const I=g[R],M=h.getTileCoordExtent(I.wrappedTileCoord);if(!pt(M,u))continue;const z=I.executorGroups[_];for(let k=0,q=z.length;k<q;++k)if(w=z[k].forEachFeatureAtCoordinate(e,r,a,i,f,E),w)break e}return w}getFeatures(e){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((t,i)=>{const s=this.getLayer(),o=s.getSource(),r=this.renderedProjection,a=r.getExtent(),l=this.renderedResolution,c=o.getTileGridForProjection(r),h=_t(this.renderedPixelToCoordinateTransform_,e.slice()),u=c.getTileCoordForCoordAndResolution(h,l).toString(),d=this.renderedTiles.find(C=>C.tileCoord.toString()===u&&C.getState()===oe.LOADED);if(!d||d.loadingSourceTiles>0){t([]);return}o.getWrapX()&&r.canWrapX()&&!Di(a,c.getTileCoordExtent(d.tileCoord))&&ku(h,r);const f=Re(s),g=c.getTileCoordExtent(d.wrappedTileCoord),_=rn(g),v=[(h[0]-_[0])/l,(_[1]-h[1])/l],E=d.getSourceTiles().reduce((C,P)=>C.concat(P.getFeatures()),[]);let w=d.hitDetectionImageData[f];if(!w){const C=$t(c.getTileSize(c.getZForResolution(l,o.zDirection))),P=this.renderedRotation_,R=[this.getRenderTransform(c.getTileCoordCenter(d.wrappedTileCoord),l,0,wn,C[0]*wn,C[1]*wn,0)];w=D0(C,R,E,s.getStyleFunction(),c.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,P),d.hitDetectionImageData[f]=w}t(F0(v,E,w))})}getFeaturesInExtent(e){const t=[],i=this.getTileCache();if(i.getCount()===0)return t;const o=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=o.getZForResolution(this.renderedResolution),a={};return i.forEach(l=>{if(l.tileCoord[0]!==r||l.getState()!==oe.LOADED)return;const c=l.getSourceTiles();for(let h=0,u=c.length;h<u;++h){const d=c[h],f=d.getKey();if(f in a)continue;a[f]=!0;const g=d.tileCoord;if(pt(e,o.getTileCoordExtent(g))){const _=d.getFeatures();if(_)for(let v=0,E=_.length;v<E;++v){const w=_[v],C=w.getGeometry();pt(e,C.getExtent())&&t.push(w)}}}}),t}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.renderedLayerRevision_!==void 0&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e,t){var d;const i=this.context,s=i.globalAlpha;i.globalAlpha=t.opacity;const o=e.viewHints,r=!(o[ot.ANIMATING]||o[ot.INTERACTING]),a=[this.context.canvas.width,this.context.canvas.height],l=this.getLayer().getDeclutter(),c=l?(d=e.declutter)==null?void 0:d[l]:void 0,h=Re(this.getLayer()),u=this.renderedTiles;for(let f=0,g=u.length;f<g;++f){const _=u[f],v=_.executorGroups[h];if(v)for(let E=v.length-1;E>=0;--E)v[E].execute(this.context,a,this.getTileRenderTransform(_,e),e.viewState.rotation,r,Mc,c)}i.globalAlpha=s}renderDeferredInternal(e){const t=this.renderedTiles,i=Re(this.getLayer()),s=t.reduce((l,c,h)=>(c.executorGroups[i].forEach(u=>l.push({executorGroup:u,index:h})),l),[]),o=s.map(({executorGroup:l})=>l.getDeferredZIndexContexts()),r={};for(let l=0,c=s.length;l<c;++l){const h=s[l].executorGroup.getDeferredZIndexContexts();for(const u in h)r[u]=!0}Object.keys(r).map(Number).sort(li).forEach(l=>{o.forEach((c,h)=>{c[l]&&(c[l].forEach(u=>{const{executorGroup:d,index:f}=s[h],g=d.getRenderedContext(),_=g.globalAlpha;g.globalAlpha=this.renderedOpacity_;const v=this.tileClipContexts_[f];v&&v.draw(g),u.draw(g),v&&g.restore(),g.globalAlpha=_,u.clear()}),c[l].length=0)})})}getTileRenderTransform(e,t){const i=t.pixelRatio,s=t.viewState,o=s.center,r=s.resolution,a=s.rotation,l=t.size,c=Math.round(l[0]*i),h=Math.round(l[1]*i),d=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),f=e.tileCoord,g=d.getTileCoordExtent(e.wrappedTileCoord),_=d.getTileCoordExtent(f,this.tempExtent)[0]-g[0];return cc(Ku(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(o,r,a,i,c,h,_))}postRender(e,t){var R;const i=t.viewHints,s=!(i[ot.ANIMATING]||i[ot.INTERACTING]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation,this.renderedOpacity_=t.layerStatesArray[t.layerIndex].opacity;const o=this.getLayer(),r=o.getRenderMode(),a=e.globalAlpha;e.globalAlpha=this.renderedOpacity_;const l=o.getDeclutter(),c=l?T1[r].filter(A=>!Mc.includes(A)):T1[r],h=t.viewState,u=h.rotation,d=o.getSource(),g=d.getTileGridForProjection(h.projection).getZForResolution(h.resolution,d.zDirection),_=this.renderedTiles,v=[],E=[],w=[],C=Re(o);let P=!0;for(let A=_.length-1;A>=0;--A){const I=_[A];P=P&&!I.getReplayState(o).dirty;const M=I.executorGroups[C].filter(S=>S.hasExecutors(c));if(M.length===0)continue;const z=this.getTileRenderTransform(I,t),k=I.tileCoord[0];let q=!1;const Y=M[0].getClipCoords(z);let m=e,b;if(Y){b=new Dd,m=b.getContext();for(let S=0,L=v.length;S<L;++S)if(g!==k&&k<E[S]){const N=v[S];pt([Y[0],Y[3],Y[4],Y[7]],[N[0],N[3],N[4],N[7]])&&(q||(m.save(),q=!0),m.beginPath(),m.moveTo(Y[0],Y[1]),m.lineTo(Y[2],Y[3]),m.lineTo(Y[4],Y[5]),m.lineTo(Y[6],Y[7]),m.moveTo(N[6],N[7]),m.lineTo(N[4],N[5]),m.lineTo(N[2],N[3]),m.lineTo(N[0],N[1]),m.clip())}v.push(Y),E.push(k)}for(let S=0,L=M.length;S<L;++S)M[S].execute(e,[e.canvas.width,e.canvas.height],z,u,s,c,(R=t.declutter)==null?void 0:R[l]);q&&(m===e?m.restore():w[A]=b)}e.globalAlpha=a,this.ready=P,this.tileClipContexts_=w,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,i,s,o,r){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,c=i.length;l<c;++l)a=Pc(s,e,i[l],t,this.boundHandleStyleImageChange_,void 0,o,r)||a;else a=Pc(s,e,i,t,this.boundHandleStyleImageChange_,void 0,o,r);return a}tileImageNeedsRender_(e){const t=this.getLayer();if(t.getRenderMode()==="vector")return!1;const i=e.getReplayState(t),s=t.getRevision(),o=e.wantedResolution;return i.renderedTileResolution!==o||i.renderedTileRevision!==s}renderTileImage_(e,t){const i=this.getLayer(),s=e.getReplayState(i),o=i.getRevision(),r=e.executorGroups[Re(i)];s.renderedTileRevision=o;const a=e.wrappedTileCoord,l=a[0],c=i.getSource();let h=t.pixelRatio;const d=t.viewState.projection,f=c.getTileGridForProjection(d),g=f.getResolution(e.tileCoord[0]),_=t.pixelRatio/e.wantedResolution*g,v=f.getResolution(l),E=e.getContext();h=Math.round(Math.max(h,_/h));const w=c.getTilePixelSize(l,h,d);E.canvas.width=w[0],E.canvas.height=w[1];const C=h/_;if(C!==1){const I=Sm(this.tmpTransform_);Ku(I,C,C),E.setTransform.apply(E,I)}const P=f.getTileCoordExtent(a,this.tempExtent),R=_/v,A=Sm(this.tmpTransform_);Ku(A,R,-R),yb(A,-P[0],-P[3]);for(let I=0,M=r.length;I<M;++I)r[I].execute(E,[E.canvas.width*C,E.canvas.height*C],A,0,!0,jT[i.getRenderMode()],null);s.renderedTileResolution=e.wantedResolution}}class Fh extends jc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const i=e.cacheSize===void 0?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=i;const s=e.renderMode||"hybrid";$e(s=="hybrid"||s=="vector","`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=s,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new UT(this,{cacheSize:this.cacheSize_})}getFeatures(e){return super.getFeatures(e)}getFeaturesInExtent(e){return this.getRenderer().getFeaturesInExtent(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(ks.PRELOAD)}getUseInterimTilesOnError(){return this.get(ks.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(ks.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(ks.USE_INTERIM_TILES_ON_ERROR,e)}}class fp extends Ah{constructor(e){const t=e.projection||"EPSG:3857",i=e.extent||Qa(t),s=e.tileGrid||Tr({extent:i,maxResolution:e.maxResolution,maxZoom:e.maxZoom!==void 0?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,projection:t,state:e.state,tileGrid:s,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:O1,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,zDirection:e.zDirection===void 0?1:e.zDirection}),this.format_=e.format?e.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=e.overlaps==null?!0:e.overlaps,this.tileClass=e.tileClass?e.tileClass:Cx,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(e,t,i){if(i.getState()===oe.IDLE){i.setState(oe.LOADING);const s=i.wrappedTileCoord,o=this.getTileGridForProjection(t);let r=o.getTileCoordExtent(s);const a=s[0],l=o.getResolution(a);hi(r,-l,r);const c=this.projection;t&&this.projection&&!Wt(t,c)&&(r=oa(r,t,c));const h=this.tileGrid,u=h.getExtent();u&&$n(r,u,r);let d=l;t&&c&&!Wt(t,c)&&(d=l/c.getMetersPerUnit()/t.getMetersPerUnit());const f=h.getZForResolution(d,this.zDirection);h.forEachTileCoord(r,f,g=>{const _=this.tileUrlFunction(g,e,t);this.sourceTiles_[_]||(this.sourceTiles_[_]=new this.tileClass(g,_?oe.IDLE:oe.EMPTY,_,this.format_,this.tileLoadFunction));const v=this.sourceTiles_[_];i.sourceTiles.push(v),this.tileKeysBySourceTileUrl_[_]||(this.tileKeysBySourceTileUrl_[_]=[]),this.tileKeysBySourceTileUrl_[_].push(i.getKey());const E=v.getState();if(E<oe.LOADED){const w=C=>{this.handleTileChange(C);const P=v.getState();if(P===oe.LOADED||P===oe.ERROR){const R=v.getKey();R in i.errorTileKeys?v.getState()===oe.LOADED&&delete i.errorTileKeys[R]:i.loadingSourceTiles--,P===oe.ERROR?i.errorTileKeys[R]=!0:v.removeEventListener(we.CHANGE,w),i.loadingSourceTiles===0&&i.setState(gs(i.errorTileKeys)?oe.LOADED:oe.ERROR)}};v.addEventListener(we.CHANGE,w),i.loadingSourceTiles++}E===oe.IDLE&&(v.extent=h.getTileCoordExtent(g),v.projection=this.projection,v.resolution=h.getResolution(g[0]),v.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(g=>g.getState()===oe.ERROR)?oe.ERROR:oe.LOADED)}return i.sourceTiles}removeSourceTiles(e){const t=e.getKey(),i=e.sourceTiles;for(let s=0,o=i.length;s<o;++s){const r=i[s].getTileUrl();if(!this.tileKeysBySourceTileUrl_[r])return;const a=this.tileKeysBySourceTileUrl_[r].indexOf(t);a!==-1&&(this.tileKeysBySourceTileUrl_[r].splice(a,1),this.tileKeysBySourceTileUrl_[r].length===0&&(delete this.tileKeysBySourceTileUrl_[r],delete this.sourceTiles_[r]))}}getTile(e,t,i,s,o){const r=[e,t,i];let a=this.getTileCoordForTileUrlFunction(r,o);const l=this.getTileGrid().getExtent(),c=this.projection,h=this.getTileGridForProjection(o);if(a&&l){const f=h.getTileCoordExtent(a);hi(f,-h.getResolution(e),f),pt(l,!o||!c||Wt(o,c)?f:oa(f,o,c))||(a=null)}let u=!0;if(a!==null){const f=this.tileGrid,g=h.getResolution(e);let _=g;o&&c&&!Wt(o,c)&&(_=g/c.getMetersPerUnit()/o.getMetersPerUnit());const v=f.getZForResolution(_,1),E=h.getTileCoordExtent(a);hi(E,-g,E),f.forEachTileCoord(!o||!c||Wt(o,c)?E:oa(E,o,c),v,w=>{u=u&&!this.tileUrlFunction(w,s,c)})}const d=new Ex(r,u?oe.EMPTY:oe.IDLE,a,this.getSourceTiles.bind(this,s,o),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(e){const t=e.getCode();let i=this.tileGrids_[t];if(!i){const s=this.projection;if(s!==null&&!Wt(s,e))return lp(e);const o=this.tileGrid,r=o.getResolutions().slice(),a=r.map(function(h,u){return o.getOrigin(u)}),l=r.map(function(h,u){return o.getTileSize(u)}),c=ty+1;for(let h=r.length;h<c;++h)r.push(r[h-1]/2),a.push(a[h-1]),l.push(l[h-1]);i=new Us({extent:o.getExtent(),origins:a,resolutions:r,tileSizes:l}),this.tileGrids_[t]=i}return i}getTilePixelRatio(e){return e}getTilePixelSize(e,t,i){const s=this.getTileGridForProjection(i),o=$t(s.getTileSize(e),this.tmpSize);return[Math.round(o[0]*t),Math.round(o[1]*t)]}setOverlaps(e){this.overlaps_=e,this.changed()}}function O1(n,e){n.setLoader(function(t,i,s){f0(e,n.getFormat(),t,i,s,n.onLoad.bind(n),n.onError.bind(n))})}const pp=65536*65536,I1=1/pp,GT=12,A1=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),gp=0,Lh=1,Ja=2,zh=5;class qT{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const s=this.readVarint(),o=s>>3,r=this.pos;this.type=s&7,e(o,t,this),this.pos===r&&this.skip(s)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*pp;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*pp;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,s;return s=t[this.pos++],i=s&127,s<128||(s=t[this.pos++],i|=(s&127)<<7,s<128)||(s=t[this.pos++],i|=(s&127)<<14,s<128)||(s=t[this.pos++],i|=(s&127)<<21,s<128)?i:(s=t[this.pos],i|=(s&15)<<28,WT(i,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=GT&&A1?A1.decode(this.buf.subarray(t,e)):nO(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===Ja?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===gp)for(;this.buf[this.pos++]>127;);else if(t===Ja)this.pos=this.readVarint()+this.pos;else if(t===zh)this.pos+=4;else if(t===Lh)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*I1),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*I1),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){VT(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=iO(this.buf,e,this.pos);const i=this.pos-t;i>=128&&M1(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const s=this.pos-i;s>=128&&M1(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeMessage(e,t,i){this.writeTag(e,Ja),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,HT,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,XT,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,KT,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,YT,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,ZT,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,QT,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,JT,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,eO,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,tO,t)}writeBytesField(e,t){this.writeTag(e,Ja),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,zh),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,zh),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Lh),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Lh),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,gp),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,gp),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Ja),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,zh),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Lh),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function WT(n,e,t){const i=t.buf;let s,o;if(o=i[t.pos++],s=(o&112)>>4,o<128||(o=i[t.pos++],s|=(o&127)<<3,o<128)||(o=i[t.pos++],s|=(o&127)<<10,o<128)||(o=i[t.pos++],s|=(o&127)<<17,o<128)||(o=i[t.pos++],s|=(o&127)<<24,o<128)||(o=i[t.pos++],s|=(o&1)<<31,o<128))return Or(n,s,e);throw new Error("Expected varint not more than 10 bytes")}function Or(n,e,t){return t?e*4294967296+(n>>>0):(e>>>0)*4294967296+(n>>>0)}function VT(n,e){let t,i;if(n>=0?(t=n%4294967296|0,i=n/4294967296|0):(t=~(-n%4294967296),i=~(-n/4294967296),t^4294967295?t=t+1|0:(t=0,i=i+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),$T(t,i,e),BT(i,e)}function $T(n,e,t){t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos]=n&127}function BT(n,e){const t=(n&7)<<4;e.buf[e.pos++]|=t|((n>>>=3)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127)))))}function M1(n,e,t){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(i);for(let s=t.pos-1;s>=n;s--)t.buf[s+i]=t.buf[s]}function HT(n,e){for(let t=0;t<n.length;t++)e.writeVarint(n[t])}function XT(n,e){for(let t=0;t<n.length;t++)e.writeSVarint(n[t])}function YT(n,e){for(let t=0;t<n.length;t++)e.writeFloat(n[t])}function ZT(n,e){for(let t=0;t<n.length;t++)e.writeDouble(n[t])}function KT(n,e){for(let t=0;t<n.length;t++)e.writeBoolean(n[t])}function QT(n,e){for(let t=0;t<n.length;t++)e.writeFixed32(n[t])}function JT(n,e){for(let t=0;t<n.length;t++)e.writeSFixed32(n[t])}function eO(n,e){for(let t=0;t<n.length;t++)e.writeFixed64(n[t])}function tO(n,e){for(let t=0;t<n.length;t++)e.writeSFixed64(n[t])}function nO(n,e,t){let i="",s=e;for(;s<t;){const o=n[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=n[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=n[s+1],c=n[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=n[s+1],c=n[s+2],h=n[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,i+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),i+=String.fromCharCode(r),s+=a}return i}function iO(n,e,t){for(let i=0,s,o;i<e.length;i++){if(s=e.charCodeAt(i),s>55295&&s<57344)if(o)if(s<56320){n[t++]=239,n[t++]=191,n[t++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||i+1===e.length?(n[t++]=239,n[t++]=191,n[t++]=189):o=s;continue}else o&&(n[t++]=239,n[t++]=191,n[t++]=189,o=null);s<128?n[t++]=s:(s<2048?n[t++]=s>>6|192:(s<65536?n[t++]=s>>12|224:(n[t++]=s>>18|240,n[t++]=s>>12&63|128),n[t++]=s>>6&63|128),n[t++]=s&63|128)}return t}class D1{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Rn,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let i=t.dataProjection?Ne(t.dataProjection):this.readProjection(e);t.extent&&i&&i.getUnits()==="tile-pixels"&&(i=Ne(i),i.setWorldExtent(t.extent)),t={dataProjection:i,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return be()}readFeature(e,t){return be()}readFeatures(e,t){return be()}readGeometry(e,t){return be()}readProjection(e){return be()}writeFeature(e,t){return be()}writeFeatures(e,t){return be()}writeGeometry(e,t){return be()}}function Nh(n,e,t){const i=t?Ne(t.featureProjection):null,s=t?Ne(t.dataProjection):null;let o=n;if(i&&s&&!Wt(i,s)){e&&(o=n.clone());const r=e?i:s,a=e?s:i;r.getUnits()==="tile-pixels"?o.transform(r,a):o.applyTransform(Ni(r,a))}if(e&&t&&t.decimals!==void 0){const r=Math.pow(10,t.decimals),a=function(l){for(let c=0,h=l.length;c<h;++c)l[c]=Math.round(l[c]*r)/r;return l};o===n&&(o=n.clone()),o.applyTransform(a)}return o}const sO={Point:yn,LineString:Yn,Polygon:Xn,MultiPoint:Jo,MultiLineString:co,MultiPolygon:wa};function oO(n,e,t){return Array.isArray(e[0])?(Gm(n,0,e,t)||(n=n.slice(),cd(n,0,e,t)),n):(ld(n,0,e,t)||(n=n.slice(),fc(n,0,e,t)),n)}function F1(n,e){var o;const t=n.geometry;if(!t)return[];if(Array.isArray(t))return t.map(r=>F1({...n,geometry:r})).flat();const i=t.type==="MultiPolygon"?"Polygon":t.type;if(i==="GeometryCollection"||i==="Circle")throw new Error("Unsupported geometry type: "+i);const s=t.layout.length;return Nh(new Vt(i,i==="Polygon"?oO(t.flatCoordinates,t.ends,s):t.flatCoordinates,(o=t.ends)==null?void 0:o.flat(),s,n.properties||{},n.id).enableSimplifyTransformed(),!1,e)}function mp(n,e){if(!n)return null;if(Array.isArray(n)){const i=n.map(s=>mp(s,e));return new Sc(i)}const t=sO[n.type];return Nh(new t(n.flatCoordinates,n.layout||"XY",n.ends),!1,e)}class yp extends D1{constructor(e){super(),e=e||{},this.dataProjection=new na({code:"",units:"tile-pixels"}),this.featureClass=e.featureClass?e.featureClass:Vt,this.geometryName_=e.geometryName,this.layerName_=e.layerName?e.layerName:"layer",this.layers_=e.layers?e.layers:null,this.idProperty_=e.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(e,t,i,s){e.pos=t.geometry;const o=e.readVarint()+e.pos;let r=1,a=0,l=0,c=0,h=0,u=0;for(;e.pos<o;){if(!a){const d=e.readVarint();r=d&7,a=d>>3}if(a--,r===1||r===2)l+=e.readSVarint(),c+=e.readSVarint(),r===1&&h>u&&(s.push(h),u=h),i.push(l,c),h+=2;else if(r===7)h>u&&(i.push(i[u],i[u+1]),h+=2);else throw new Error("Invalid command found in the PBF")}h>u&&(s.push(h),u=h)}createFeature_(e,t,i){const s=t.type;if(s===0)return null;let o;const r=t.properties;let a;this.idProperty_?(a=r[this.idProperty_],delete r[this.idProperty_]):a=t.id,r[this.layerName_]=t.layer.name;const l=[],c=[];this.readRawGeometry_(e,t,l,c);const h=hO(s,c.length);if(this.featureClass===Vt)o=new this.featureClass(h,l,c,2,r,a),o.transform(i.dataProjection);else{let u;if(h=="Polygon"){const g=qm(l,c);u=g.length>1?new wa(l,"XY",g):new Xn(l,"XY",c)}else u=h==="Point"?new yn(l,"XY"):h==="LineString"?new Yn(l,"XY"):h==="MultiPoint"?new Jo(l,"XY"):h==="MultiLineString"?new co(l,"XY",c):null;const d=this.featureClass;o=new d,this.geometryName_&&o.setGeometryName(this.geometryName_);const f=Nh(u,!1,i);o.setGeometry(f),a!==void 0&&o.setId(a),o.setProperties(r,!0)}return o}getType(){return"arraybuffer"}readFeatures(e,t){const i=this.layers_;t=this.adaptOptions(t);const s=Ne(t.dataProjection);s.setWorldExtent(t.extent),t.dataProjection=s;const o=new qT(e),r=o.readFields(rO,{}),a=[];for(const l in r){if(i&&!i.includes(l))continue;const c=r[l],h=c?[0,0,c.extent,c.extent]:null;s.setExtent(h);for(let u=0,d=c.length;u<d;++u){const f=cO(o,c,u),g=this.createFeature_(o,f,t);g!==null&&a.push(g)}}return a}readProjection(e){return this.dataProjection}setLayers(e){this.layers_=e}}function rO(n,e,t){if(n===3){const i={keys:[],values:[],features:[]},s=t.readVarint()+t.pos;t.readFields(aO,i,s),i.length=i.features.length,i.length&&(e[i.name]=i)}}function aO(n,e,t){if(n===15)e.version=t.readVarint();else if(n===1)e.name=t.readString();else if(n===5)e.extent=t.readVarint();else if(n===2)e.features.push(t.pos);else if(n===3)e.keys.push(t.readString());else if(n===4){let i=null;const s=t.readVarint()+t.pos;for(;t.pos<s;)n=t.readVarint()>>3,i=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null;e.values.push(i)}}function lO(n,e,t){if(n==1)e.id=t.readVarint();else if(n==2){const i=t.readVarint()+t.pos;for(;t.pos<i;){const s=e.layer.keys[t.readVarint()],o=e.layer.values[t.readVarint()];e.properties[s]=o}}else n==3?e.type=t.readVarint():n==4&&(e.geometry=t.pos)}function cO(n,e,t){n.pos=e.features[t];const i=n.readVarint()+n.pos,s={layer:e,type:0,properties:{}};return n.readFields(lO,s,i),s}function hO(n,e){let t;return n===1?t=e===1?"Point":"MultiPoint":n===2?t=e===1?"LineString":"MultiLineString":n===3&&(t="Polygon"),t}var uO=8,dO={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},fO={"*":{type:"source"}},pO=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],gO={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},mO={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},yO={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},_O={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},wO={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},vO={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},bO={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},EO=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],CO={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},xO={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},PO={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},SO={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},RO={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},TO={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},OO={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},IO={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},AO={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},MO={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},DO={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},FO={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},LO={type:"array",value:"expression_name",minimum:1},zO={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},NO={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},kO={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},jO={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},UO=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],GO={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},qO={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},WO={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},VO={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},$O={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},BO={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},HO={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},XO={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},YO={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},ZO={"*":{type:"string"}},KO={type:"array",value:"interpolation_name",minimum:1},QO={type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}},JO={$version:uO,$root:dO,sources:fO,source:pO,source_vector:gO,source_raster:mO,source_raster_dem:yO,source_geojson:_O,source_video:wO,source_image:vO,layer:bO,layout:EO,layout_background:CO,layout_fill:xO,layout_circle:PO,layout_heatmap:SO,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:RO,layout_symbol:TO,layout_raster:OO,layout_hillshade:IO,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:AO,filter_operator:MO,geometry_type:DO,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:FO,expression:LO,light:zO,sky:NO,terrain:kO,projection:jO,paint:UO,paint_fill:GO,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:qO,paint_circle:WO,paint_heatmap:VO,paint_symbol:$O,paint_raster:BO,paint_hillshade:HO,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:XO,transition:YO,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:ZO,interpolation:KO,interpolation_name:QO};const e2=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function t2(n,e){const t={};for(const i in n)i!=="ref"&&(t[i]=n[i]);return e2.forEach(i=>{i in e&&(t[i]=e[i])}),t}function n2(n){n=n.slice();const e=Object.create(null);for(let t=0;t<n.length;t++)e[n[t].id]=n[t];for(let t=0;t<n.length;t++)"ref"in n[t]&&(n[t]=t2(n[t],e[n[t].ref]));return n}class xi extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class _p{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[i,s]of t)this.bindings[i]=s}concat(e){return new _p(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}}const kh={kind:"null"},ie={kind:"number"},Ce={kind:"string"},Ae={kind:"boolean"},Pi={kind:"color"},jh={kind:"projectionDefinition"},Eo={kind:"object"},Te={kind:"value"},i2={kind:"error"},Uh={kind:"collator"},Gh={kind:"formatted"},qh={kind:"padding"},el={kind:"colorArray"},Wh={kind:"numberArray"},tl={kind:"resolvedImage"},Vh={kind:"variableAnchorOffsetCollection"};function Jt(n,e){return{kind:"array",itemType:n,N:e}}function dt(n){if(n.kind==="array"){const e=dt(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}else return n.kind}const s2=[kh,ie,Ce,Ae,Pi,jh,Gh,Eo,Jt(Te),qh,Wh,el,tl,Vh];function nl(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!nl(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value"){for(const t of s2)if(!nl(t,e))return null}}return`Expected ${dt(n)} but found ${dt(e)} instead.`}function wp(n,e){return e.some(t=>t.kind===n.kind)}function Co(n,e){return e.some(t=>t==="null"?n===null:t==="array"?Array.isArray(n):t==="object"?n&&!Array.isArray(n)&&typeof n=="object":t===typeof n)}function Gs(n,e){return n.kind==="array"&&e.kind==="array"?n.itemType.kind===e.itemType.kind&&typeof n.N=="number":n.kind===e.kind}const L1=.96422,z1=1,N1=.82521,k1=4/29,Ir=6/29,j1=3*Ir*Ir,o2=Ir*Ir*Ir,r2=Math.PI/180,a2=180/Math.PI;function U1(n){return n=n%360,n<0&&(n+=360),n}function G1([n,e,t,i]){n=vp(n),e=vp(e),t=vp(t);let s,o;const r=bp((.2225045*n+.7168786*e+.0606169*t)/z1);n===e&&e===t?s=o=r:(s=bp((.4360747*n+.3850649*e+.1430804*t)/L1),o=bp((.0139322*n+.0971045*e+.7141733*t)/N1));const a=116*r-16;return[a<0?0:a,500*(s-r),200*(r-o),i]}function vp(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function bp(n){return n>o2?Math.pow(n,1/3):n/j1+k1}function q1([n,e,t,i]){let s=(n+16)/116,o=isNaN(e)?s:s+e/500,r=isNaN(t)?s:s-t/200;return s=z1*Cp(s),o=L1*Cp(o),r=N1*Cp(r),[Ep(3.1338561*o-1.6168667*s-.4906146*r),Ep(-.9787684*o+1.9161415*s+.033454*r),Ep(.0719453*o-.2289914*s+1.4052427*r),i]}function Ep(n){return n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055,n<0?0:n>1?1:n}function Cp(n){return n>Ir?n*n*n:j1*(n-k1)}function l2(n){const[e,t,i,s]=G1(n),o=Math.sqrt(t*t+i*i);return[Math.round(o*1e4)?U1(Math.atan2(i,t)*a2):NaN,o,e,s]}function c2([n,e,t,i]){return n=isNaN(n)?0:n*r2,q1([t,Math.cos(n)*e,Math.sin(n)*e,i])}function h2([n,e,t,i]){n=U1(n),e/=100,t/=100;function s(o){const r=(o+n/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(r-3,9-r,1))}return[s(0),s(8),s(4),i]}const u2=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function W1(n,e){return u2(n,e)?n[e]:void 0}function d2(n){if(n=n.toLowerCase().trim(),n==="transparent")return[0,0,0,0];const e=W1(f2,n);if(e){const[s,o,r]=e;return[s/255,o/255,r/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const o=n.length<6?1:2;let r=1;return[$h(n.slice(r,r+=o)),$h(n.slice(r,r+=o)),$h(n.slice(r,r+=o)),$h(n.slice(r,r+o)||"ff")]}if(n.startsWith("rgb")){const s=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=n.match(s);if(o){const[r,a,l,c,h,u,d,f,g,_,v,E]=o,w=[c||" ",d||" ",_].join("");if(w===" "||w===" /"||w===",,"||w===",,,"){const C=[l,u,g].join(""),P=C==="%%%"?100:C===""?255:0;if(P){const R=[Ar(+a/P,0,1),Ar(+h/P,0,1),Ar(+f/P,0,1),v?V1(+v,E):1];if($1(R))return R}}return}}const t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=n.match(t);if(i){const[s,o,r,a,l,c,h,u,d]=i,f=[r||" ",l||" ",h].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){const g=[+o,Ar(+a,0,100),Ar(+c,0,100),u?V1(+u,d):1];if($1(g))return h2(g)}}}function $h(n){return parseInt(n.padEnd(2,n),16)/255}function V1(n,e){return Ar(e?n/100:n,0,1)}function Ar(n,e,t){return Math.min(Math.max(e,n),t)}function $1(n){return!n.some(Number.isNaN)}const f2={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function xo(n,e,t){return n+t*(e-n)}function il(n,e,t){return n.map((i,s)=>xo(i,e[s],t))}class Ue{constructor(e,t,i,s=1,o=!0){this.r=e,this.g=t,this.b=i,this.a=s,o||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,t,i,s]))}static parse(e){if(e instanceof Ue)return e;if(typeof e!="string")return;const t=d2(e);if(t)return new Ue(...t,!1)}get rgb(){const{r:e,g:t,b:i,a:s}=this,o=s||1/0;return this.overwriteGetter("rgb",[e/o,t/o,i/o,s])}get hcl(){return this.overwriteGetter("hcl",l2(this.rgb))}get lab(){return this.overwriteGetter("lab",G1(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,s]=this.rgb;return`rgba(${[e,t,i].map(o=>Math.round(o*255)).join(",")},${s})`}static interpolate(e,t,i,s="rgb"){switch(s){case"rgb":{const[o,r,a,l]=il(e.rgb,t.rgb,i);return new Ue(o,r,a,l,!1)}case"hcl":{const[o,r,a,l]=e.hcl,[c,h,u,d]=t.hcl;let f,g;if(!isNaN(o)&&!isNaN(c)){let C=c-o;c>o&&C>180?C-=360:c<o&&o-c>180&&(C+=360),f=o+i*C}else isNaN(o)?isNaN(c)?f=NaN:(f=c,(a===1||a===0)&&(g=h)):(f=o,(u===1||u===0)&&(g=r));const[_,v,E,w]=c2([f,g??xo(r,h,i),xo(a,u,i),xo(l,d,i)]);return new Ue(_,v,E,w,!1)}case"lab":{const[o,r,a,l]=q1(il(e.lab,t.lab,i));return new Ue(o,r,a,l,!1)}}}}Ue.black=new Ue(0,0,0,1),Ue.white=new Ue(1,1,1,1),Ue.transparent=new Ue(0,0,0,0),Ue.red=new Ue(1,0,0,1);class xp{constructor(e,t,i){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const p2=["bottom","center","top"];class Pp{constructor(e,t,i,s,o,r){this.text=e,this.image=t,this.scale=i,this.fontStack=s,this.textColor=o,this.verticalAlign=r}}class Qi{constructor(e){this.sections=e}static fromString(e){return new Qi([new Pp(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Qi?e:Qi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ti{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ti)return e;if(typeof e=="number")return new ti([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new ti(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new ti(il(e.values,t.values,i))}}class ni{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ni)return e;if(typeof e=="number")return new ni([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new ni(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new ni(il(e.values,t.values,i))}}class bn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof bn)return e;if(typeof e=="string"){const i=Ue.parse(e);return i?new bn([i]):void 0}if(!Array.isArray(e))return;const t=[];for(const i of e){if(typeof i!="string")return;const s=Ue.parse(i);if(!s)return;t.push(s)}return new bn(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i,s="rgb"){const o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let r=0;r<e.values.length;r++)o.push(Ue.interpolate(e.values[r],t.values[r],i,s));return new bn(o)}}class mt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const g2=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Si{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Si)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const i=e[t],s=e[t+1];if(typeof i!="string"||!g2.has(i)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Si(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){const s=e.values,o=t.values;if(s.length!==o.length)throw new mt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const r=[];for(let a=0;a<s.length;a+=2){if(s[a]!==o[a])throw new mt(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${s[a]}, to[${a}]: ${o[a]}`);r.push(s[a]);const[l,c]=s[a+1],[h,u]=o[a+1];r.push([xo(l,h,i),xo(c,u,i)])}return new Si(r)}}class qs{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new qs({name:e,available:!1}):null}}class ii{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new ii(e,t,i)}static parse(e){if(e instanceof ii)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ii(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ii(e.from,e.to,e.transition);if(typeof e=="string")return new ii(e,e,1)}}function B1(n,e,t,i){return typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof i>"u"||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[n,e,t,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[n,e,t,i]:[n,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function sl(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof ii||n instanceof Ue||n instanceof xp||n instanceof Qi||n instanceof ti||n instanceof ni||n instanceof bn||n instanceof Si||n instanceof qs)return!0;if(Array.isArray(n)){for(const e of n)if(!sl(e))return!1;return!0}else if(typeof n=="object"){for(const e in n)if(!sl(n[e]))return!1;return!0}else return!1}function Tt(n){if(n===null)return kh;if(typeof n=="string")return Ce;if(typeof n=="boolean")return Ae;if(typeof n=="number")return ie;if(n instanceof Ue)return Pi;if(n instanceof ii)return jh;if(n instanceof xp)return Uh;if(n instanceof Qi)return Gh;if(n instanceof ti)return qh;if(n instanceof ni)return Wh;if(n instanceof bn)return el;if(n instanceof Si)return Vh;if(n instanceof qs)return tl;if(Array.isArray(n)){const e=n.length;let t;for(const i of n){const s=Tt(i);if(!t)t=s;else{if(t===s)continue;t=Te;break}}return Jt(t||Te,e)}else return Eo}function ol(n){const e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof Ue||n instanceof ii||n instanceof Qi||n instanceof ti||n instanceof ni||n instanceof bn||n instanceof Si||n instanceof qs?n.toString():JSON.stringify(n)}class Mr{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!sl(e[1]))return t.error("invalid value");const i=e[1];let s=Tt(i);const o=t.expectedType;return s.kind==="array"&&s.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(s=o),new Mr(s,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Bh={string:Ce,number:ie,boolean:Ae,object:Eo};class si{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=1,s;const o=e[0];if(o==="array"){let a;if(e.length>2){const c=e[1];if(typeof c!="string"||!(c in Bh)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Bh[c],i++}else a=Te;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],i++}s=Jt(a,l)}else{if(!Bh[o])throw new Error(`Types doesn't contain name = ${o}`);s=Bh[o]}const r=[];for(;i<e.length;i++){const a=t.parse(e[i],i,Te);if(!a)return null;r.push(a)}return new si(s,r)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(nl(this.type,Tt(i))){if(t===this.args.length-1)throw new mt(`Expected value to be of type ${dt(this.type)}, but found ${dt(Tt(i))} instead.`)}else return i}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const H1={"to-boolean":Ae,"to-color":Pi,"to-number":ie,"to-string":Ce};class Ws{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(!H1[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&e.length!==2)return t.error("Expected one argument.");const s=H1[i],o=[];for(let r=1;r<e.length;r++){const a=t.parse(e[r],r,Te);if(!a)return null;o.push(a)}return new Ws(s,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,i;for(const s of this.args){if(t=s.evaluate(e),i=null,t instanceof Ue)return t;if(typeof t=="string"){const o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?i=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:i=B1(t[0],t[1],t[2],t[3]),!i))return new Ue(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new mt(i||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const s=ti.parse(t);if(s)return s}throw new mt(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const i of this.args){t=i.evaluate(e);const s=ni.parse(t);if(s)return s}throw new mt(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const i of this.args){t=i.evaluate(e);const s=bn.parse(t);if(s)return s}throw new mt(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const s=Si.parse(t);if(s)return s}throw new mt(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new mt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Qi.fromString(ol(this.args[0].evaluate(e)));case"resolvedImage":return qs.fromString(ol(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return ol(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const m2=["Unknown","Point","LineString","Polygon"];class X1{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?m2[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=Ue.parse(e),this._parseColorCache.set(e,t)),t}}class Hh{constructor(e,t,i=[],s,o=new _p,r=[]){this.registry=e,this.path=i,this.key=i.map(a=>`[${a}]`).join(""),this.scope=o,this.errors=r,this.expectedType=s,this._isConstant=t}parse(e,t,i,s,o={}){return t?this.concat(t,i,s)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function i(s,o,r){return r==="assert"?new si(o,[s]):r==="coerce"?new Ws(o,[s]):s}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=e[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[s];if(o){let r=o.parse(e,this);if(!r)return null;if(this.expectedType){const a=this.expectedType,l=r.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")r=i(r,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))r=i(r,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(r instanceof Mr)&&r.type.kind!=="resolvedImage"&&this._isConstant(r)){const a=new X1;try{r=new Mr(r.type,r.evaluate(a))}catch(l){return this.error(l.message),null}}return r}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const s=typeof e=="number"?this.path.concat(e):this.path,o=i?this.scope.concat(i):this.scope;return new Hh(this.registry,this._isConstant,s,t||null,o,this.errors)}error(e,...t){const i=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new xi(i,e))}checkSubtype(e,t){const i=nl(e,t);return i&&this.error(i),i}}class Xh{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let o=1;o<e.length-1;o+=2){const r=e[o];if(typeof r!="string")return t.error(`Expected string, but found ${typeof r} instead.`,o);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);const a=t.parse(e[o+1],o+1);if(!a)return null;i.push([r,a])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return s?new Xh(i,s):null}outputDefined(){return this.result.outputDefined()}}class Yh{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new Yh(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Sp{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,ie),s=t.parse(e[2],2,Jt(t.expectedType||Te));if(!i||!s)return null;const o=s.type;return new Sp(o.itemType,i,s)}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new mt(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new mt(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new mt(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Rp{constructor(e,t){this.type=Ae,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Te),s=t.parse(e[2],2,Te);return!i||!s?null:wp(i.type,[Ae,Ce,ie,kh,Te])?new Rp(i,s):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${dt(i.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!Co(t,["boolean","string","number","null"]))throw new mt(`Expected first argument to be of type boolean, string, number or null, but found ${dt(Tt(t))} instead.`);if(!Co(i,["string","array"]))throw new mt(`Expected second argument to be of type array or string, but found ${dt(Tt(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Zh{constructor(e,t,i){this.type=ie,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Te),s=t.parse(e[2],2,Te);if(!i||!s)return null;if(!wp(i.type,[Ae,Ce,ie,kh,Te]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${dt(i.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ie);return o?new Zh(i,s,o):null}else return new Zh(i,s)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Co(t,["boolean","string","number","null"]))throw new mt(`Expected first argument to be of type boolean, string, number or null, but found ${dt(Tt(t))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),Co(i,["string"])){const o=i.indexOf(t,s);return o===-1?-1:[...i.slice(0,o)].length}else{if(Co(i,["array"]))return i.indexOf(t,s);throw new mt(`Expected second argument to be of type array or string, but found ${dt(Tt(i))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Tp{constructor(e,t,i,s,o,r){this.inputType=e,this.type=t,this.input=i,this.cases=s,this.outputs=o,this.otherwise=r}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let i,s;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);const o={},r=[];for(let c=2;c<e.length-1;c+=2){let h=e[c];const u=e[c+1];Array.isArray(h)||(h=[h]);const d=t.concat(c);if(h.length===0)return d.error("Expected at least one branch label.");for(const g of h){if(typeof g!="number"&&typeof g!="string")return d.error("Branch labels must be numbers or strings.");if(typeof g=="number"&&Math.abs(g)>Number.MAX_SAFE_INTEGER)return d.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof g=="number"&&Math.floor(g)!==g)return d.error("Numeric branch labels must be integer values.");if(!i)i=Tt(g);else if(d.checkSubtype(i,Tt(g)))return null;if(typeof o[String(g)]<"u")return d.error("Branch labels must be unique.");o[String(g)]=r.length}const f=t.parse(u,c,s);if(!f)return null;s=s||f.type,r.push(f)}const a=t.parse(e[1],1,Te);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,s);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(i,a.type)?null:new Tp(i,s,a,o,r,l)}evaluate(e){const t=this.input.evaluate(e);return(Tt(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Op{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);const s=[];for(let r=1;r<e.length-1;r+=2){const a=t.parse(e[r],r,Ae);if(!a)return null;const l=t.parse(e[r+1],r+1,i);if(!l)return null;s.push([a,l]),i=i||l.type}const o=t.parse(e[e.length-1],e.length-1,i);if(!o)return null;if(!i)throw new Error("Can't infer output type");return new Op(i,s,o)}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class Kh{constructor(e,t,i,s){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Te),s=t.parse(e[2],2,ie);if(!i||!s)return null;if(!wp(i.type,[Jt(Te),Ce,Te]))return t.error(`Expected first argument to be of type array or string, but found ${dt(i.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ie);return o?new Kh(i.type,i,s,o):null}else return new Kh(i.type,i,s)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),Co(t,["string"]))return[...t].slice(i,s).join("");if(Co(t,["array"]))return t.slice(i,s);throw new mt(`Expected first argument to be of type array or string, but found ${dt(Tt(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Y1(n,e){const t=n.length-1;let i=0,s=t,o=0,r,a;for(;i<=s;)if(o=Math.floor((i+s)/2),r=n[o],a=n[o+1],r<=e){if(o===t||e<a)return o;i=o+1}else if(r>e)s=o-1;else throw new mt("Input is not a number.");return 0}class Qh{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,o]of i)this.labels.push(s),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,ie);if(!i)return null;const s=[];let o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let r=1;r<e.length;r+=2){const a=r===1?-1/0:e[r],l=e[r+1],c=r,h=r+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(s.length&&s[s.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);const u=t.parse(l,h,o);if(!u)return null;o=o||u.type,s.push([a,u])}return new Qh(o,i,s)}evaluate(e){const t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return i[0].evaluate(e);const o=t.length;if(s>=t[o-1])return i[o-1].evaluate(e);const r=Y1(t,s);return i[r].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function y2(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ip,Z1;function _2(){if(Z1)return Ip;Z1=1,Ip=n;function n(e,t,i,s){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=s}return n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,s=0;s<8;s++){var o=this.sampleCurveX(i)-e;if(Math.abs(o)<t)return i;var r=this.sampleCurveDerivativeX(i);if(Math.abs(r)<1e-6)break;i=i-o/r}var a=0,l=1;for(i=e,s=0;s<20&&(o=this.sampleCurveX(i),!(Math.abs(o-e)<t));s++)e>o?a=i:l=i,i=(l-a)*.5+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Ip}var w2=_2(),v2=y2(w2);class Ri{constructor(e,t,i,s,o){this.type=e,this.operator=t,this.interpolation=i,this.input=s,this.labels=[],this.outputs=[];for(const[r,a]of o)this.labels.push(r),this.outputs.push(a)}static interpolationFactor(e,t,i,s){let o=0;if(e.name==="exponential")o=Ap(t,e.base,i,s);else if(e.name==="linear")o=Ap(t,1,i,s);else if(e.name==="cubic-bezier"){const r=e.controlPoints;o=new v2(r[0],r[1],r[2],r[3]).solve(Ap(t,1,i,s))}return o}static parse(e,t){let[i,s,o,...r]=e;if(!Array.isArray(s)||s.length===0)return t.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const c=s[1];if(typeof c!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:c}}else if(s[0]==="cubic-bezier"){const c=s.slice(1);if(c.length!==4||c.some(h=>typeof h!="number"||h<0||h>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:c}}else return t.error(`Unknown interpolation type ${String(s[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,ie),!o)return null;const a=[];let l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&t.expectedType!=el?l=Pi:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let c=0;c<r.length;c+=2){const h=r[c],u=r[c+1],d=c+3,f=c+4;if(typeof h!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(a.length&&a[a.length-1][0]>=h)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);const g=t.parse(u,f,l);if(!g)return null;l=l||g.type,a.push([h,g])}return!Gs(l,ie)&&!Gs(l,jh)&&!Gs(l,Pi)&&!Gs(l,qh)&&!Gs(l,Wh)&&!Gs(l,el)&&!Gs(l,Vh)&&!Gs(l,Jt(ie))?t.error(`Type ${dt(l)} is not interpolatable.`):new Ri(l,i,s,o,a)}evaluate(e){const t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return i[0].evaluate(e);const o=t.length;if(s>=t[o-1])return i[o-1].evaluate(e);const r=Y1(t,s),a=t[r],l=t[r+1],c=Ri.interpolationFactor(this.interpolation,s,a,l),h=i[r].evaluate(e),u=i[r+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return xo(h,u,c);case"color":return Ue.interpolate(h,u,c);case"padding":return ti.interpolate(h,u,c);case"colorArray":return bn.interpolate(h,u,c);case"numberArray":return ni.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Si.interpolate(h,u,c);case"array":return il(h,u,c);case"projectionDefinition":return ii.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ue.interpolate(h,u,c,"hcl");case"colorArray":return bn.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ue.interpolate(h,u,c,"lab");case"colorArray":return bn.interpolate(h,u,c,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Ap(n,e,t,i){const s=i-t,o=n-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}class rl{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null;const s=t.expectedType;s&&s.kind!=="value"&&(i=s);const o=[];for(const a of e.slice(1)){const l=t.parse(a,1+o.length,i,void 0,{typeAnnotation:"omit"});if(!l)return null;i=i||l.type,o.push(l)}if(!i)throw new Error("No output type");return s&&o.some(a=>nl(s,a.type))?new rl(Te,o):new rl(i,o)}evaluate(e){let t=null,i=0,s;for(const o of this.args)if(i++,t=o.evaluate(e),t&&t instanceof qs&&!t.available&&(s||(s=t.name),t=null,i===this.args.length&&(t=s)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function K1(n,e){return n==="=="||n==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function b2(n,e,t){return e===t}function E2(n,e,t){return e!==t}function C2(n,e,t){return e<t}function x2(n,e,t){return e>t}function P2(n,e,t){return e<=t}function S2(n,e,t){return e>=t}function Q1(n,e,t,i){return i.compare(e,t)===0}function R2(n,e,t,i){return!Q1(n,e,t,i)}function T2(n,e,t,i){return i.compare(e,t)<0}function O2(n,e,t,i){return i.compare(e,t)>0}function I2(n,e,t,i){return i.compare(e,t)<=0}function A2(n,e,t,i){return i.compare(e,t)>=0}function Dr(n,e,t){const i=n!=="=="&&n!=="!=";return class _v{constructor(o,r,a){this.type=Ae,this.lhs=o,this.rhs=r,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||r.type.kind==="value"}static parse(o,r){if(o.length!==3&&o.length!==4)return r.error("Expected two or three arguments.");const a=o[0];let l=r.parse(o[1],1,Te);if(!l)return null;if(!K1(a,l.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${dt(l.type)}'.`);let c=r.parse(o[2],2,Te);if(!c)return null;if(!K1(a,c.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${dt(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error(`Cannot compare types '${dt(l.type)}' and '${dt(c.type)}'.`);i&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new si(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new si(l.type,[c])));let h=null;if(o.length===4){if(l.type.kind!=="string"&&c.type.kind!=="string"&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error("Cannot use collator to compare non-string types.");if(h=r.parse(o[3],3,Uh),!h)return null}return new _v(l,c,h)}evaluate(o){const r=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(i&&this.hasUntypedArgument){const l=Tt(r),c=Tt(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new mt(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const l=Tt(r),c=Tt(a);if(l.kind!=="string"||c.kind!=="string")return e(o,r,a)}return this.collator?t(o,r,a,this.collator.evaluate(o)):e(o,r,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}const M2=Dr("==",b2,Q1),D2=Dr("!=",E2,R2),F2=Dr("<",C2,T2),L2=Dr(">",x2,O2),z2=Dr("<=",P2,I2),N2=Dr(">=",S2,A2);class Jh{constructor(e,t,i){this.type=Uh,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const i=e[1];if(typeof i!="object"||Array.isArray(i))return t.error("Collator options argument must be an object.");const s=t.parse(i["case-sensitive"]===void 0?!1:i["case-sensitive"],1,Ae);if(!s)return null;const o=t.parse(i["diacritic-sensitive"]===void 0?!1:i["diacritic-sensitive"],1,Ae);if(!o)return null;let r=null;return i.locale&&(r=t.parse(i.locale,1,Ce),!r)?null:new Jh(s,o,r)}evaluate(e){return new xp(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Mp{constructor(e,t,i,s,o,r){this.type=Ce,this.number=e,this.locale=t,this.currency=i,this.unit=s,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ie);if(!i)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let o=null;if(s.locale&&(o=t.parse(s.locale,1,Ce),!o))return null;let r=null;if(s.currency&&(r=t.parse(s.currency,1,Ce),!r))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,Ce),!a))return null;if(r&&a)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(s["min-fraction-digits"]&&(l=t.parse(s["min-fraction-digits"],1,ie),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=t.parse(s["max-fraction-digits"],1,ie),!c)?null:new Mp(i,o,r,a,l,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Dp{constructor(e){this.type=Gh,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&typeof i=="object")return t.error("First argument must be an image or text section.");const s=[];let o=!1;for(let r=1;r<=e.length-1;++r){const a=e[r];if(o&&typeof a=="object"&&!Array.isArray(a)){o=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,ie),!l))return null;let c=null;if(a["text-font"]&&(c=t.parse(a["text-font"],1,Jt(Ce)),!c))return null;let h=null;if(a["text-color"]&&(h=t.parse(a["text-color"],1,Pi),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!p2.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(u=t.parse(a["vertical-align"],1,Ce),!u)return null}const d=s[s.length-1];d.scale=l,d.font=c,d.textColor=h,d.verticalAlign=u}else{const l=t.parse(e[r],1,Te);if(!l)return null;const c=l.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,s.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Dp(s)}evaluate(e){const t=i=>{const s=i.content.evaluate(e);return Tt(s)===tl?new Pp("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new Pp(ol(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)};return new Qi(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Fp{constructor(e){this.type=tl,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Ce);return i?new Fp(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=qs.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class Lp{constructor(e){this.type=ie,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${dt(i.type)} instead.`):new Lp(i):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new mt(`Expected value to be of type string or array, but found ${dt(Tt(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Ti=8192;function k2(n,e){const t=j2(n[0]),i=G2(n[1]),s=Math.pow(2,e.z);return[Math.round(t*s*Ti),Math.round(i*s*Ti)]}function zp(n,e){const t=Math.pow(2,e.z),i=(n[0]/Ti+e.x)/t,s=(n[1]/Ti+e.y)/t;return[U2(i),q2(s)]}function j2(n){return(180+n)/360}function U2(n){return n*360-180}function G2(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function q2(n){return 360/Math.PI*Math.atan(Math.exp((180-n*360)*Math.PI/180))-90}function al(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function ll(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function W2(n,e,t){return e[1]>n[1]!=t[1]>n[1]&&n[0]<(t[0]-e[0])*(n[1]-e[1])/(t[1]-e[1])+e[0]}function V2(n,e,t){const i=n[0]-e[0],s=n[1]-e[1],o=n[0]-t[0],r=n[1]-t[1];return i*r-o*s===0&&i*o<=0&&s*r<=0}function eu(n,e,t,i){const s=[e[0]-n[0],e[1]-n[1]],o=[i[0]-t[0],i[1]-t[1]];return X2(o,s)===0?!1:!!(ew(n,e,t,i)&&ew(t,i,n,e))}function $2(n,e,t){for(const i of t)for(let s=0;s<i.length-1;++s)if(eu(n,e,i[s],i[s+1]))return!0;return!1}function Fr(n,e,t=!1){let i=!1;for(const s of e)for(let o=0;o<s.length-1;o++){if(V2(n,s[o],s[o+1]))return t;W2(n,s[o],s[o+1])&&(i=!i)}return i}function B2(n,e){for(const t of e)if(Fr(n,t))return!0;return!1}function J1(n,e){for(const t of n)if(!Fr(t,e))return!1;for(let t=0;t<n.length-1;++t)if($2(n[t],n[t+1],e))return!1;return!0}function H2(n,e){for(const t of e)if(J1(n,t))return!0;return!1}function X2(n,e){return n[0]*e[1]-n[1]*e[0]}function ew(n,e,t,i){const s=n[0]-t[0],o=n[1]-t[1],r=e[0]-t[0],a=e[1]-t[1],l=i[0]-t[0],c=i[1]-t[1],h=s*c-l*o,u=r*c-l*a;return h>0&&u<0||h<0&&u>0}function Np(n,e,t){const i=[];for(let s=0;s<n.length;s++){const o=[];for(let r=0;r<n[s].length;r++){const a=k2(n[s][r],t);al(e,a),o.push(a)}i.push(o)}return i}function tw(n,e,t){const i=[];for(let s=0;s<n.length;s++){const o=Np(n[s],e,t);i.push(o)}return i}function nw(n,e,t,i){if(n[0]<t[0]||n[0]>t[2]){const s=i*.5;let o=n[0]-t[0]>s?-i:t[0]-n[0]>s?i:0;o===0&&(o=n[0]-t[2]>s?-i:t[2]-n[0]>s?i:0),n[0]+=o}al(e,n)}function Y2(n){n[0]=n[1]=1/0,n[2]=n[3]=-1/0}function iw(n,e,t,i){const s=Math.pow(2,i.z)*Ti,o=[i.x*Ti,i.y*Ti],r=[];for(const a of n)for(const l of a){const c=[l.x+o[0],l.y+o[1]];nw(c,e,t,s),r.push(c)}return r}function sw(n,e,t,i){const s=Math.pow(2,i.z)*Ti,o=[i.x*Ti,i.y*Ti],r=[];for(const a of n){const l=[];for(const c of a){const h=[c.x+o[0],c.y+o[1]];al(e,h),l.push(h)}r.push(l)}if(e[2]-e[0]<=s/2){Y2(e);for(const a of r)for(const l of a)nw(l,e,t,s)}return r}function Z2(n,e){const t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],s=n.canonicalID();if(e.type==="Polygon"){const o=Np(e.coordinates,i,s),r=iw(n.geometry(),t,i,s);if(!ll(t,i))return!1;for(const a of r)if(!Fr(a,o))return!1}if(e.type==="MultiPolygon"){const o=tw(e.coordinates,i,s),r=iw(n.geometry(),t,i,s);if(!ll(t,i))return!1;for(const a of r)if(!B2(a,o))return!1}return!0}function K2(n,e){const t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],s=n.canonicalID();if(e.type==="Polygon"){const o=Np(e.coordinates,i,s),r=sw(n.geometry(),t,i,s);if(!ll(t,i))return!1;for(const a of r)if(!J1(a,o))return!1}if(e.type==="MultiPolygon"){const o=tw(e.coordinates,i,s),r=sw(n.geometry(),t,i,s);if(!ll(t,i))return!1;for(const a of r)if(!H2(a,o))return!1}return!0}class Po{constructor(e,t){this.type=Ae,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(sl(e[1])){const i=e[1];if(i.type==="FeatureCollection"){const s=[];for(const o of i.features){const{type:r,coordinates:a}=o.geometry;r==="Polygon"&&s.push(a),r==="MultiPolygon"&&s.push(...a)}if(s.length){const o={type:"MultiPolygon",coordinates:s};return new Po(i,o)}}else if(i.type==="Feature"){const s=i.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Po(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Po(i,i)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Z2(e,this.geometries);if(e.geometryType()==="LineString")return K2(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class ow{constructor(e=[],t=(i,s)=>i<s?-1:i>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,s=t[e];for(;e>0;){const o=e-1>>1,r=t[o];if(i(s,r)>=0)break;t[e]=r,e=o}t[e]=s}_down(e){const{data:t,compare:i}=this,s=this.length>>1,o=t[e];for(;e<s;){let r=(e<<1)+1;const a=r+1;if(a<this.length&&i(t[a],t[r])<0&&(r=a),i(t[r],o)>=0)break;t[e]=t[r],e=r}t[e]=o}}function Q2(n,e){if(n.length<=1)return[n];const i=[];let s,o;for(const r of n){const a=J2(r);a!==0&&(r.area=Math.abs(a),o===void 0&&(o=a<0),o===a<0?(s&&i.push(s),s=[r]):s.push(r))}return s&&i.push(s),i}function J2(n){let e=0;for(let t=0,i=n.length,s=i-1,o,r;t<i;s=t++)o=n[t],r=n[s],e+=(r.x-o.x)*(o.y+r.y);return e}const eI=6378.137,rw=1/298.257223563,aw=rw*(2-rw),lw=Math.PI/180;class kp{constructor(e){const t=lw*eI*1e3,i=Math.cos(e*lw),s=1/(1-aw*(1-i*i)),o=Math.sqrt(s);this.kx=t*o*i,this.ky=t*o*s*(1-aw)}distance(e,t){const i=this.wrap(e[0]-t[0])*this.kx,s=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+s*s)}pointOnLine(e,t){let i=1/0,s,o,r,a;for(let l=0;l<e.length-1;l++){let c=e[l][0],h=e[l][1],u=this.wrap(e[l+1][0]-c)*this.kx,d=(e[l+1][1]-h)*this.ky,f=0;(u!==0||d!==0)&&(f=(this.wrap(t[0]-c)*this.kx*u+(t[1]-h)*this.ky*d)/(u*u+d*d),f>1?(c=e[l+1][0],h=e[l+1][1]):f>0&&(c+=u/this.kx*f,h+=d/this.ky*f)),u=this.wrap(t[0]-c)*this.kx,d=(t[1]-h)*this.ky;const g=u*u+d*d;g<i&&(i=g,s=c,o=h,r=l,a=f)}return{point:[s,o],index:r,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}const jp=100,Up=50;function cw(n,e){return e[0]-n[0]}function tu(n){return n[1]-n[0]+1}function Ji(n,e){return n[1]>=n[0]&&n[1]<e}function Gp(n,e){if(n[0]>n[1])return[null,null];const t=tu(n);if(e){if(t===2)return[n,null];const s=Math.floor(t/2);return[[n[0],n[0]+s],[n[0]+s,n[1]]]}if(t===1)return[n,null];const i=Math.floor(t/2)-1;return[[n[0],n[0]+i],[n[0]+i+1,n[1]]]}function qp(n,e){if(!Ji(e,n.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)al(t,n[i]);return t}function Wp(n){const e=[1/0,1/0,-1/0,-1/0];for(const t of n)for(const i of t)al(e,i);return e}function hw(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function Vp(n,e,t){if(!hw(n)||!hw(e))return NaN;let i=0,s=0;return n[2]<e[0]&&(i=e[0]-n[2]),n[0]>e[2]&&(i=n[0]-e[2]),n[1]>e[3]&&(s=n[1]-e[3]),n[3]<e[1]&&(s=e[1]-n[3]),t.distance([0,0],[i,s])}function So(n,e,t){const i=t.pointOnLine(e,n);return t.distance(n,i.point)}function $p(n,e,t,i,s){const o=Math.min(So(n,[t,i],s),So(e,[t,i],s)),r=Math.min(So(t,[n,e],s),So(i,[n,e],s));return Math.min(o,r)}function tI(n,e,t,i,s){if(!(Ji(e,n.length)&&Ji(i,t.length)))return 1/0;let r=1/0;for(let a=e[0];a<e[1];++a){const l=n[a],c=n[a+1];for(let h=i[0];h<i[1];++h){const u=t[h],d=t[h+1];if(eu(l,c,u,d))return 0;r=Math.min(r,$p(l,c,u,d,s))}}return r}function nI(n,e,t,i,s){if(!(Ji(e,n.length)&&Ji(i,t.length)))return NaN;let r=1/0;for(let a=e[0];a<=e[1];++a)for(let l=i[0];l<=i[1];++l)if(r=Math.min(r,s.distance(n[a],t[l])),r===0)return r;return r}function iI(n,e,t){if(Fr(n,e,!0))return 0;let i=1/0;for(const s of e){const o=s[0],r=s[s.length-1];if(o!==r&&(i=Math.min(i,So(n,[r,o],t)),i===0))return i;const a=t.pointOnLine(s,n);if(i=Math.min(i,t.distance(n,a.point)),i===0)return i}return i}function sI(n,e,t,i){if(!Ji(e,n.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Fr(n[o],t,!0))return 0;let s=1/0;for(let o=e[0];o<e[1];++o){const r=n[o],a=n[o+1];for(const l of t)for(let c=0,h=l.length,u=h-1;c<h;u=c++){const d=l[u],f=l[c];if(eu(r,a,d,f))return 0;s=Math.min(s,$p(r,a,d,f,i))}}return s}function uw(n,e){for(const t of n)for(const i of t)if(Fr(i,e,!0))return!0;return!1}function oI(n,e,t,i=1/0){const s=Wp(n),o=Wp(e);if(i!==1/0&&Vp(s,o,t)>=i)return i;if(ll(s,o)){if(uw(n,e))return 0}else if(uw(e,n))return 0;let r=1/0;for(const a of n)for(let l=0,c=a.length,h=c-1;l<c;h=l++){const u=a[h],d=a[l];for(const f of e)for(let g=0,_=f.length,v=_-1;g<_;v=g++){const E=f[v],w=f[g];if(eu(u,d,E,w))return 0;r=Math.min(r,$p(u,d,E,w,t))}}return r}function dw(n,e,t,i,s,o){if(!o)return;const r=Vp(qp(i,o),s,t);r<e&&n.push([r,o,[0,0]])}function nu(n,e,t,i,s,o,r){if(!o||!r)return;const a=Vp(qp(i,o),qp(s,r),t);a<e&&n.push([a,o,r])}function iu(n,e,t,i,s=1/0){let o=Math.min(i.distance(n[0],t[0][0]),s);if(o===0)return o;const r=new ow([[0,[0,n.length-1],[0,0]]],cw),a=Wp(t);for(;r.length>0;){const l=r.pop();if(l[0]>=o)continue;const c=l[1],h=e?Up:jp;if(tu(c)<=h){if(!Ji(c,n.length))return NaN;if(e){const u=sI(n,c,t,i);if(isNaN(u)||u===0)return u;o=Math.min(o,u)}else for(let u=c[0];u<=c[1];++u){const d=iI(n[u],t,i);if(o=Math.min(o,d),o===0)return 0}}else{const u=Gp(c,e);dw(r,o,i,n,a,u[0]),dw(r,o,i,n,a,u[1])}}return o}function su(n,e,t,i,s,o=1/0){let r=Math.min(o,s.distance(n[0],t[0]));if(r===0)return r;const a=new ow([[0,[0,n.length-1],[0,t.length-1]]],cw);for(;a.length>0;){const l=a.pop();if(l[0]>=r)continue;const c=l[1],h=l[2],u=e?Up:jp,d=i?Up:jp;if(tu(c)<=u&&tu(h)<=d){if(!Ji(c,n.length)&&Ji(h,t.length))return NaN;let f;if(e&&i)f=tI(n,c,t,h,s),r=Math.min(r,f);else if(e&&!i){const g=n.slice(c[0],c[1]+1);for(let _=h[0];_<=h[1];++_)if(f=So(t[_],g,s),r=Math.min(r,f),r===0)return r}else if(!e&&i){const g=t.slice(h[0],h[1]+1);for(let _=c[0];_<=c[1];++_)if(f=So(n[_],g,s),r=Math.min(r,f),r===0)return r}else f=nI(n,c,t,h,s),r=Math.min(r,f)}else{const f=Gp(c,e),g=Gp(h,i);nu(a,r,s,n,t,f[0],g[0]),nu(a,r,s,n,t,f[0],g[1]),nu(a,r,s,n,t,f[1],g[0]),nu(a,r,s,n,t,f[1],g[1])}}return r}function rI(n,e){const t=n.geometry(),i=t.flat().map(r=>zp([r.x,r.y],n.canonical));if(t.length===0)return NaN;const s=new kp(i[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,su(i,!1,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,su(i,!1,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,iu(i,!1,r.coordinates,s,o));break}if(o===0)return o}return o}function aI(n,e){const t=n.geometry(),i=t.flat().map(r=>zp([r.x,r.y],n.canonical));if(t.length===0)return NaN;const s=new kp(i[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,su(i,!0,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,su(i,!0,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,iu(i,!0,r.coordinates,s,o));break}if(o===0)return o}return o}function lI(n,e){const t=n.geometry();if(t.length===0||t[0].length===0)return NaN;const i=Q2(t).map(r=>r.map(a=>a.map(l=>zp([l.x,l.y],n.canonical)))),s=new kp(i[0][0][0][1]);let o=1/0;for(const r of e)for(const a of i){switch(r.type){case"Point":o=Math.min(o,iu([r.coordinates],!1,a,s,o));break;case"LineString":o=Math.min(o,iu(r.coordinates,!0,a,s,o));break;case"Polygon":o=Math.min(o,oI(a,r.coordinates,s,o));break}if(o===0)return o}return o}function Bp(n){return n.type==="MultiPolygon"?n.coordinates.map(e=>({type:"Polygon",coordinates:e})):n.type==="MultiLineString"?n.coordinates.map(e=>({type:"LineString",coordinates:e})):n.type==="MultiPoint"?n.coordinates.map(e=>({type:"Point",coordinates:e})):[n]}class Ro{constructor(e,t){this.type=ie,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(sl(e[1])){const i=e[1];if(i.type==="FeatureCollection")return new Ro(i,i.features.map(s=>Bp(s.geometry)).flat());if(i.type==="Feature")return new Ro(i,Bp(i.geometry));if("type"in i&&"coordinates"in i)return new Ro(i,Bp(i))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return rI(e,this.geometries);if(e.geometryType()==="LineString")return aI(e,this.geometries);if(e.geometryType()==="Polygon")return lI(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class cl{constructor(e){this.type=Te,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=e[1];return i==null?t.error("Global state property must be defined."):typeof i!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new cl(i)}evaluate(e){var t;const i=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!i||Object.keys(i).length===0?null:W1(i,this.key)}eachChild(){}outputDefined(){return!1}}const ou={"==":M2,"!=":D2,">":L2,"<":F2,">=":N2,"<=":z2,array:si,at:Sp,boolean:si,case:Op,coalesce:rl,collator:Jh,format:Dp,image:Fp,in:Rp,"index-of":Zh,interpolate:Ri,"interpolate-hcl":Ri,"interpolate-lab":Ri,length:Lp,let:Xh,literal:Mr,match:Tp,number:si,"number-format":Mp,object:si,slice:Kh,step:Qh,string:si,"to-boolean":Ws,"to-color":Ws,"to-number":Ws,"to-string":Ws,var:Yh,within:Po,distance:Ro,"global-state":cl};class En{constructor(e,t,i,s){this.name=e,this.type=t,this._evaluate=i,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],s=En.definitions[i];if(!s)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(s)?s[0]:s.type,r=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,a=r.filter(([c])=>!Array.isArray(c)||c.length===e.length-1);let l=null;for(const[c,h]of a){l=new Hh(t.registry,ru,t.path,null,t.scope);const u=[];let d=!1;for(let f=1;f<e.length;f++){const g=e[f],_=Array.isArray(c)?c[f-1]:c.type,v=l.parse(g,1+u.length,_);if(!v){d=!0;break}u.push(v)}if(!d){if(Array.isArray(c)&&c.length!==u.length){l.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);continue}for(let f=0;f<u.length;f++){const g=Array.isArray(c)?c[f]:c.type,_=u[f];l.concat(f+1).checkSubtype(g,_.type)}if(l.errors.length===0)return new En(i,o,h,u)}}if(a.length===1)t.errors.push(...l.errors);else{const h=(a.length?a:r).map(([d])=>hI(d)).join(" | "),u=[];for(let d=1;d<e.length;d++){const f=t.parse(e[d],1+u.length);if(!f)return null;u.push(dt(f.type))}t.error(`Expected arguments of type ${h}, but found (${u.join(", ")}) instead.`)}return null}static register(e,t){En.definitions=t;for(const i in t)e[i]=En}}function fw(n,[e,t,i,s]){e=e.evaluate(n),t=t.evaluate(n),i=i.evaluate(n);const o=s?s.evaluate(n):1,r=B1(e,t,i,o);if(r)throw new mt(r);return new Ue(e/255,t/255,i/255,o,!1)}function pw(n,e){return n in e}function Hp(n,e){const t=e[n];return typeof t>"u"?null:t}function cI(n,e,t,i){for(;t<=i;){const s=t+i>>1;if(e[s]===n)return!0;e[s]>n?i=s-1:t=s+1}return!1}function To(n){return{type:n}}En.register(ou,{error:[i2,[Ce],(n,[e])=>{throw new mt(e.evaluate(n))}],typeof:[Ce,[Te],(n,[e])=>dt(Tt(e.evaluate(n)))],"to-rgba":[Jt(ie,4),[Pi],(n,[e])=>{const[t,i,s,o]=e.evaluate(n).rgb;return[t*255,i*255,s*255,o]}],rgb:[Pi,[ie,ie,ie],fw],rgba:[Pi,[ie,ie,ie,ie],fw],has:{type:Ae,overloads:[[[Ce],(n,[e])=>pw(e.evaluate(n),n.properties())],[[Ce,Eo],(n,[e,t])=>pw(e.evaluate(n),t.evaluate(n))]]},get:{type:Te,overloads:[[[Ce],(n,[e])=>Hp(e.evaluate(n),n.properties())],[[Ce,Eo],(n,[e,t])=>Hp(e.evaluate(n),t.evaluate(n))]]},"feature-state":[Te,[Ce],(n,[e])=>Hp(e.evaluate(n),n.featureState||{})],properties:[Eo,[],n=>n.properties()],"geometry-type":[Ce,[],n=>n.geometryType()],id:[Te,[],n=>n.id()],zoom:[ie,[],n=>n.globals.zoom],"heatmap-density":[ie,[],n=>n.globals.heatmapDensity||0],elevation:[ie,[],n=>n.globals.elevation||0],"line-progress":[ie,[],n=>n.globals.lineProgress||0],accumulated:[Te,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[ie,To(ie),(n,e)=>{let t=0;for(const i of e)t+=i.evaluate(n);return t}],"*":[ie,To(ie),(n,e)=>{let t=1;for(const i of e)t*=i.evaluate(n);return t}],"-":{type:ie,overloads:[[[ie,ie],(n,[e,t])=>e.evaluate(n)-t.evaluate(n)],[[ie],(n,[e])=>-e.evaluate(n)]]},"/":[ie,[ie,ie],(n,[e,t])=>e.evaluate(n)/t.evaluate(n)],"%":[ie,[ie,ie],(n,[e,t])=>e.evaluate(n)%t.evaluate(n)],ln2:[ie,[],()=>Math.LN2],pi:[ie,[],()=>Math.PI],e:[ie,[],()=>Math.E],"^":[ie,[ie,ie],(n,[e,t])=>Math.pow(e.evaluate(n),t.evaluate(n))],sqrt:[ie,[ie],(n,[e])=>Math.sqrt(e.evaluate(n))],log10:[ie,[ie],(n,[e])=>Math.log(e.evaluate(n))/Math.LN10],ln:[ie,[ie],(n,[e])=>Math.log(e.evaluate(n))],log2:[ie,[ie],(n,[e])=>Math.log(e.evaluate(n))/Math.LN2],sin:[ie,[ie],(n,[e])=>Math.sin(e.evaluate(n))],cos:[ie,[ie],(n,[e])=>Math.cos(e.evaluate(n))],tan:[ie,[ie],(n,[e])=>Math.tan(e.evaluate(n))],asin:[ie,[ie],(n,[e])=>Math.asin(e.evaluate(n))],acos:[ie,[ie],(n,[e])=>Math.acos(e.evaluate(n))],atan:[ie,[ie],(n,[e])=>Math.atan(e.evaluate(n))],min:[ie,To(ie),(n,e)=>Math.min(...e.map(t=>t.evaluate(n)))],max:[ie,To(ie),(n,e)=>Math.max(...e.map(t=>t.evaluate(n)))],abs:[ie,[ie],(n,[e])=>Math.abs(e.evaluate(n))],round:[ie,[ie],(n,[e])=>{const t=e.evaluate(n);return t<0?-Math.round(-t):Math.round(t)}],floor:[ie,[ie],(n,[e])=>Math.floor(e.evaluate(n))],ceil:[ie,[ie],(n,[e])=>Math.ceil(e.evaluate(n))],"filter-==":[Ae,[Ce,Te],(n,[e,t])=>n.properties()[e.value]===t.value],"filter-id-==":[Ae,[Te],(n,[e])=>n.id()===e.value],"filter-type-==":[Ae,[Ce],(n,[e])=>n.geometryType()===e.value],"filter-<":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i<s}],"filter-id-<":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t<i}],"filter->":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i>s}],"filter-id->":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t>i}],"filter-<=":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i<=s}],"filter-id-<=":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t<=i}],"filter->=":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i>=s}],"filter-id->=":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t>=i}],"filter-has":[Ae,[Te],(n,[e])=>e.value in n.properties()],"filter-has-id":[Ae,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[Ae,[Jt(Ce)],(n,[e])=>e.value.indexOf(n.geometryType())>=0],"filter-id-in":[Ae,[Jt(Te)],(n,[e])=>e.value.indexOf(n.id())>=0],"filter-in-small":[Ae,[Ce,Jt(Te)],(n,[e,t])=>t.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[Ae,[Ce,Jt(Te)],(n,[e,t])=>cI(n.properties()[e.value],t.value,0,t.value.length-1)],all:{type:Ae,overloads:[[[Ae,Ae],(n,[e,t])=>e.evaluate(n)&&t.evaluate(n)],[To(Ae),(n,e)=>{for(const t of e)if(!t.evaluate(n))return!1;return!0}]]},any:{type:Ae,overloads:[[[Ae,Ae],(n,[e,t])=>e.evaluate(n)||t.evaluate(n)],[To(Ae),(n,e)=>{for(const t of e)if(t.evaluate(n))return!0;return!1}]]},"!":[Ae,[Ae],(n,[e])=>!e.evaluate(n)],"is-supported-script":[Ae,[Ce],(n,[e])=>{const t=n.globals&&n.globals.isSupportedScript;return t?t(e.evaluate(n)):!0}],upcase:[Ce,[Ce],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[Ce,[Ce],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[Ce,To(Te),(n,e)=>e.map(t=>ol(t.evaluate(n))).join("")],split:[Jt(Ce),[Ce,Ce],(n,[e,t])=>e.evaluate(n).split(t.evaluate(n))],join:[Ce,[Jt(Ce),Ce],(n,[e,t])=>e.evaluate(n).join(t.evaluate(n))],"resolved-locale":[Ce,[Uh],(n,[e])=>e.evaluate(n).resolvedLocale()]});function hI(n){return Array.isArray(n)?`(${n.map(dt).join(", ")})`:`(${dt(n.type)}...)`}function ru(n){if(n instanceof Yh)return ru(n.boundExpression);if(n instanceof En&&n.name==="error")return!1;if(n instanceof Jh)return!1;if(n instanceof Po)return!1;if(n instanceof Ro)return!1;if(n instanceof cl)return!1;const e=n instanceof Ws||n instanceof si;let t=!0;return n.eachChild(i=>{e?t=t&&ru(i):t=t&&i instanceof Mr}),t?Xp(n)&&Zp(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Xp(n){if(n instanceof En){if(n.name==="get"&&n.args.length===1)return!1;if(n.name==="feature-state")return!1;if(n.name==="has"&&n.args.length===1)return!1;if(n.name==="properties"||n.name==="geometry-type"||n.name==="id")return!1;if(/^filter-/.test(n.name))return!1}if(n instanceof Po||n instanceof Ro)return!1;let e=!0;return n.eachChild(t=>{e&&!Xp(t)&&(e=!1)}),e}function Yp(n){if(n instanceof En&&n.name==="feature-state")return!1;let e=!0;return n.eachChild(t=>{e&&!Yp(t)&&(e=!1)}),e}function Zp(n,e){if(n instanceof En&&e.indexOf(n.name)>=0)return!1;let t=!0;return n.eachChild(i=>{t&&!Zp(i,e)&&(t=!1)}),t}function Kp(n){return{result:"success",value:n}}function Lr(n){return{result:"error",value:n}}function uI(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function dI(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function fI(n){return!!n.expression&&n.expression.interpolated}function au(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Tt(n)===Eo}class pI{constructor(e,t,i){this.expression=e,this._warningHistory={},this._evaluator=new X1,this._defaultValue=t?mI(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this._globalState=i}evaluateWithoutErrorHandling(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,s,o,r){this._globalState&&(e=zr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r||null;try{const a=this.expression.evaluate(this._evaluator);if(a==null||typeof a=="number"&&a!==a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new mt(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(a)} instead.`);return a}catch(a){return this._warningHistory[a.message]||(this._warningHistory[a.message]=!0,typeof console<"u"&&console.warn(a.message)),this._defaultValue}}}function lu(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in ou}function gw(n,e,t){const i=new Hh(ou,ru,[],e?gI(e):void 0),s=i.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Kp(new pI(s,e,t)):Lr(i.errors)}class mw{constructor(e,t,i){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Yp(t.expression),this.globalStateRefs=hu(t.expression),this._globalState=i}evaluateWithoutErrorHandling(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,s,o,r)}evaluate(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluate(e,t,i,s,o,r)}}class yw{constructor(e,t,i,s,o){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Yp(t.expression),this.globalStateRefs=hu(t.expression),this.interpolationType=s,this._globalState=o}evaluateWithoutErrorHandling(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,s,o,r)}evaluate(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluate(e,t,i,s,o,r)}interpolationFactor(e,t,i){return this.interpolationType?Ri.interpolationFactor(this.interpolationType,e,t,i):0}}function _w(n,e,t){const i=gw(n,e,t);if(i.result==="error")return i;const s=i.value.expression,o=Xp(s);if(!o&&!uI(e))return Lr([new xi("","data expressions not supported")]);const r=Zp(s,["zoom"]);if(!r&&!dI(e))return Lr([new xi("","zoom expressions not supported")]);const a=cu(s);if(!a&&!r)return Lr([new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof xi)return Lr([a]);if(a instanceof Ri&&!fI(e))return Lr([new xi("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Kp(o?new mw("constant",i.value,t):new mw("source",i.value,t));const l=a instanceof Ri?a.interpolation:void 0;return Kp(o?new yw("camera",i.value,a.labels,l,t):new yw("composite",i.value,a.labels,l,t))}function cu(n){let e=null;if(n instanceof Xh)e=cu(n.result);else if(n instanceof rl){for(const t of n.args)if(e=cu(t),e)break}else(n instanceof Qh||n instanceof Ri)&&n.input instanceof En&&n.input.name==="zoom"&&(e=n);return e instanceof xi||n.eachChild(t=>{const i=cu(t);i instanceof xi?e=i:!e&&i?e=new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new xi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function hu(n,e=new Set){return n instanceof cl&&e.add(n.key),n.eachChild(t=>{hu(t,e)}),e}function gI(n){const e={color:Pi,string:Ce,number:ie,enum:Ce,boolean:Ae,formatted:Gh,padding:qh,numberArray:Wh,colorArray:el,projectionDefinition:jh,resolvedImage:tl,variableAnchorOffsetCollection:Vh};return n.type==="array"?Jt(e[n.value]||Te,n.length):e[n.type]}function mI(n){if(n.type==="color"&&au(n.default))return new Ue(0,0,0,0);switch(n.type){case"color":return Ue.parse(n.default)||null;case"padding":return ti.parse(n.default)||null;case"numberArray":return ni.parse(n.default)||null;case"colorArray":return bn.parse(n.default)||null;case"variableAnchorOffsetCollection":return Si.parse(n.default)||null;case"projectionDefinition":return ii.parse(n.default)||null;default:return n.default===void 0?null:n.default}}function zr(n,e){const{zoom:t,heatmapDensity:i,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a}=n??{};return{zoom:t,heatmapDensity:i,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a,globalState:e}}function ww(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!ww(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const yI={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function _I(n,e){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};ww(n)||(n=uu(n));const t=gw(n,yI,e);if(t.result==="error")throw new Error(t.value.map(i=>`${i.key}: ${i.message}`).join(", "));{const i=vw(n);return{filter:(s,o,r)=>t.value.evaluate(s,o,{},r),needGeometry:i,getGlobalStateRefs:()=>hu(t.value.expression)}}}function wI(n,e){return n<e?-1:n>e?1:0}function vw(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let e=1;e<n.length;e++)if(vw(n[e]))return!0;return!1}function uu(n){if(!n)return!0;const e=n[0];return n.length<=1?e!=="any":e==="=="?Qp(n[1],n[2],"=="):e==="!="?du(Qp(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Qp(n[1],n[2],e):e==="any"?vI(n.slice(1)):e==="all"?["all"].concat(n.slice(1).map(uu)):e==="none"?["all"].concat(n.slice(1).map(uu).map(du)):e==="in"?bw(n[1],n.slice(2)):e==="!in"?du(bw(n[1],n.slice(2))):e==="has"?Ew(n[1]):e==="!has"?du(Ew(n[1])):!0}function Qp(n,e,t){switch(n){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,n,e]}}function vI(n){return["any"].concat(n.map(uu))}function bw(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",n,["literal",e.sort(wI)]]:["filter-in-small",n,["literal",e]]}}function Ew(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function du(n){return["!",n]}function hl(n){return typeof n=="object"?["literal",n]:n}function Cw(n,e){let t=n.stops;if(!t)return bI(n,e);const i=t&&typeof t[0][0]=="object",s=i||n.property!==void 0,o=i||!s;return t=t.map(r=>!s&&e.tokens&&typeof r[1]=="string"?[r[0],PI(r[1])]:[r[0],hl(r[1])]),i?EI(n,e,t):o?xI(n,e,t):eg(n,e,t)}function bI(n,e){const t=["get",n.property];if(n.default===void 0)return e.type==="string"?["string",t]:t;if(e.type==="enum")return["match",t,Object.keys(e.values),t,n.default];{const i=[e.type==="color"?"to-color":e.type,t,hl(n.default)];return e.type==="array"&&i.splice(1,0,e.value,e.length||null),i}}function Jp(n){switch(n.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function EI(n,e,t){const i={},s={},o=[];for(let a=0;a<t.length;a++){const l=t[a],c=l[0].zoom;i[c]===void 0&&(i[c]={zoom:c,type:n.type,property:n.property,default:n.default},s[c]=[],o.push(c)),s[c].push([l[0].value,l[1]])}if(ng({},e)==="exponential"){const a=[Jp(n),["linear"],["zoom"]];for(const l of o){const c=eg(i[l],e,s[l]);Nr(a,l,c,!1)}return a}else{const a=["step",["zoom"]];for(const l of o){const c=eg(i[l],e,s[l]);Nr(a,l,c,!0)}return tg(a),a}}function CI(n,e){if(n!==void 0)return n;if(e!==void 0)return e}function xw(n,e){const t=hl(CI(n.default,e.default));return t===void 0&&e.type==="resolvedImage"?"":t}function eg(n,e,t){const i=ng(n,e),s=["get",n.property];if(i==="categorical"&&typeof t[0][0]=="boolean"){const o=["case"];for(const r of t)o.push(["==",s,r[0]],r[1]);return o.push(xw(n,e)),o}else if(i==="categorical"){const o=["match",s];for(const r of t)Nr(o,r[0],r[1],!1);return o.push(xw(n,e)),o}else if(i==="interval"){const o=["step",["number",s]];for(const r of t)Nr(o,r[0],r[1],!0);return tg(o),n.default===void 0?o:["case",["==",["typeof",s],"number"],o,hl(n.default)]}else if(i==="exponential"){const o=n.base!==void 0?n.base:1,r=[Jp(n),o===1?["linear"]:["exponential",o],["number",s]];for(const a of t)Nr(r,a[0],a[1],!1);return n.default===void 0?r:["case",["==",["typeof",s],"number"],r,hl(n.default)]}else throw new Error(`Unknown property function type ${i}`)}function xI(n,e,t,i=["zoom"]){const s=ng(n,e);let o,r=!1;if(s==="interval")o=["step",i],r=!0;else if(s==="exponential"){const a=n.base!==void 0?n.base:1;o=[Jp(n),a===1?["linear"]:["exponential",a],i]}else throw new Error(`Unknown zoom function type "${s}"`);for(const a of t)Nr(o,a[0],a[1],r);return tg(o),o}function tg(n){n[0]==="step"&&n.length===3&&(n.push(0),n.push(n[3]))}function Nr(n,e,t,i){n.length>3&&e===n[n.length-2]||(i&&n.length===2||n.push(e),n.push(t))}function ng(n,e){return n.type?n.type:e.expression.interpolated?"exponential":"interval"}function PI(n){const e=["concat"],t=/{([^{}]+)}/g;let i=0;for(let s=t.exec(n);s!==null;s=t.exec(n)){const o=n.slice(i,t.lastIndex-s[0].length);i=t.lastIndex,o.length>0&&e.push(o),e.push(["get",s[1]])}if(e.length===1)return n;if(i<n.length)e.push(n.slice(i));else if(e.length===2)return["to-string",e[1]];return e}const Pw=JO;var Sw={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},ul=" ",Rw=/(italic|oblique)$/i,Tw={};function ig(n,e,t){var i=Tw[n];if(!i){Array.isArray(n)||(n=[n]);for(var s=400,o="normal",r=[],a,l,c=0,h=n.length;c<h;++c){var u=n[c],d=u.split(" "),f=d[d.length-1].toLowerCase();f=="normal"||f=="italic"||f=="oblique"?(o=l?o:f,l=!0,d.pop(),f=d[d.length-1].toLowerCase()):Rw.test(f)&&(f=f.replace(Rw,""),o=l?o:d[d.length-1].replace(f,""),l=!0);for(var g in Sw){var _=d.length>1?d[d.length-2].toLowerCase():"";if(f==g||f==g.replace("-","")||_+"-"+f==g){s=a?s:Sw[g],d.pop(),_&&g.startsWith(_)&&d.pop();break}}!a&&typeof f=="number"&&(s=f,a=!0);var v=d.join(ul).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");v.indexOf(ul)!==-1&&(v='"'+v+'"'),r.push(v)}i=Tw[n]=[o,s,r]}return i[0]+ul+i[1]+ul+e+"px"+(t?"/"+t:"")+ul+i[2]}function Ow(n,[e,t,i,s]){e=e.evaluate(n),t=t.evaluate(n),i=i.evaluate(n);const o=s?s.evaluate(n):1;return Ue.parse(`hsla(${e}, ${t}%, ${i}%, ${o})`)}function SI(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=n[3],o=Math.max(e,t,i),r=Math.min(e,t,i),a=(o+r)/2;let l,c;if(o===r)l=0,c=0;else{const h=o-r;switch(c=a>.5?h/(2-o-r):h/(o+r),o){case e:l=(t-i)/h+(t<i?6:0);break;case t:l=(i-e)/h+2;break;case i:l=(e-t)/h+4;break;default:l=0}l/=6}return[l*360,c*100,a*100,s]}function fu(n){if(Array.isArray(n)){if(n.length===0)return n;const e=n[0];if(e==="literal")return n;if(e==="image"&&n.length===3&&typeof n[2]=="object"&&n[2]!==null&&!Array.isArray(n[2]))return["image-config",fu(n[1]),["literal",n[2]]];const t=n.length;for(let i=1;i<t;++i){const s=n[i],o=fu(s);if(o!==s){const r=[e];for(let a=1;a<i;++a)r.push(n[a]);r.push(o);for(let a=i+1;a<t;++a)r.push(fu(n[a]));return r}}}return n}const Iw={},Oo={zoom:0,distanceFromCenter:0};En.register(ou,{...En.definitions,pitch:[{kind:"number"},[],n=>Oo.pitch||0],"distance-from-center":[{kind:"number"},[],n=>Oo.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(n,[e])=>SI(_c(e.evaluate(n)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],Ow],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],Ow],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(n,[e,t])=>e.evaluate(n)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(n,[e])=>{const t=Iw[e.evaluate(n)];return t===void 0?{}:t}]});const Aw="https://api.mapbox.com";function sg(n){const e="mapbox://";return n.indexOf(e)!==0?"":n.slice(e.length)}function RI(n,e,t){if(typeof n=="string")return[{id:"default",url:Mw(n,e,t)}];for(const i of n)i.url=Mw(i.url,e,t);return n}function Mw(n,e,t){const i=sg(n);if(!i)return decodeURI(new URL(n,t).href);const s="sprites/";if(i.indexOf(s)!==0)throw new Error(`unexpected sprites url: ${n}`);const o=i.slice(s.length);return`${Aw}/styles/v1/${o}/sprite?access_token=${e}`}function Dw(n,e){const t=sg(n);if(!t)return decodeURI(new URL(n,location.href).href);const i="styles/";if(t.indexOf(i)!==0)throw new Error(`unexpected style url: ${n}`);const s=t.slice(i.length);return`${Aw}/styles/v1/${s}?&access_token=${e}`}const TI=["a","b","c","d"];function pu(n,e,t,i){const s=new URL(n,i||location.href),o=sg(n);if(!o)return e?(s.searchParams.has(t)||s.searchParams.set(t,e),[decodeURI(s.href)]):[decodeURI(s.href)];if(o==="mapbox.satellite"){const r=globalThis.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${o}/{z}/{x}/{y}${r}.webp?access_token=${e}`]}return TI.map(r=>`https://${r}.tiles.mapbox.com/v4/${o}/{z}/{x}/{y}.vector.pbf?access_token=${e}`)}const og=Object.freeze({}),Fw={},Lw={};let OI=0;function rg(n){return n.id||(n.id=OI++),n.id}function II(n,e){return rg(n)+"."+Re(e)}function AI(n){let e=Fw[n.id];return e||(e={},Fw[rg(n)]=e),e}function MI(n){let e=Lw[n.id];return e||(e={},Lw[rg(n)]=e),e}function ag(n){return n*Math.PI/180}const lg=(function(){const n=[];for(let e=78271.51696402048;n.length<=24;e/=2)n.push(e);return n})();function gu(n,e){if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof OffscreenCanvas<"u")return new OffscreenCanvas(n,e);const t=document.createElement("canvas");return t.width=n,t.height=e,t}function DI(n,e){let t=0;const i=e.length;for(;t<i;++t)if(e[t]<n&&t+1<i){const o=e[t]/e[t+1];return t+Math.log(e[t]/n)/Math.log(o)}return i-1}function FI(n,e){const t=Math.floor(n),i=Math.pow(2,n-t);return e[t]/i}const kr={};function jr(n,e,t={},i){if(e in kr)return i&&(i.url=kr[e][0].url),kr[e][1];const s=t.transformRequest&&t.transformRequest(e,n)||e,o=function(l){return delete kr[e],Promise.reject(new Error("Error fetching source "+e))},r=function(l){return delete kr[e],l.ok?l.json():Promise.reject(new Error("Error fetching source "+e))},a=$o(()=>s).then(l=>l instanceof Response?(i&&(i.url=l.url),r(l)):(l instanceof Request||(l=new Request(l)),l.headers.get("Accept")||l.headers.set("Accept","application/json"),i&&(i.url=l.url),fetch(l).then(r).catch(o))).catch(o);return kr[e]=[s,a],a}function LI(n,e){if(typeof n=="string")if(n.trim().startsWith("{"))try{const t=JSON.parse(n);return Promise.resolve(t)}catch(t){return Promise.reject(t)}else return n=Dw(n,e.accessToken),jr("Style",n,e);else return Promise.resolve(n)}const zw={};function zI(n,e,t={}){const i=[e,JSON.stringify(n)].toString();let s=zw[i];if(!s||t.transformRequest){let o;t.transformRequest&&(o=(a,l)=>{const c=t.transformRequest&&t.transformRequest(l,"Tiles")||l;if(a instanceof Mi.VectorTile)a.setLoader((h,u,d)=>{const f=function(g){g.arrayBuffer().then(_=>{const E=a.getFormat().readFeatures(_,{extent:h,featureProjection:d});a.setFeatures(E)})};$o(()=>c).then(g=>{if(g instanceof Response)return f(g);fetch(g).then(f).catch(_=>a.setState(oe.ERROR))}).catch(g=>a.setState(oe.ERROR))});else{const h=a.getImage();$o(()=>c).then(u=>{if(typeof u=="string"){h.src=u;return}const d=f=>f.blob().then(g=>{const _=URL.createObjectURL(g);h.addEventListener("load",()=>URL.revokeObjectURL(_)),h.addEventListener("error",()=>URL.revokeObjectURL(_)),h.src=_});if(u instanceof Response)return d(u);fetch(u).then(d).catch(f=>a.setState(oe.ERROR))}).catch(u=>a.setState(oe.ERROR))}});const r=n.url;if(r&&!n.tiles){const a=pu(r,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(r.startsWith("mapbox://"))s=Promise.resolve({tileJson:Object.assign({},n,{url:void 0,tiles:a}),tileLoadFunction:o});else{const l={};s=jr("Source",a[0],t,l).then(function(c){return c.tiles=c.tiles.map(function(h){return c.scheme==="tms"&&(h=h.replace("{y}","{-y}")),pu(h,t.accessToken,t.accessTokenParam||"access_token",l.url)[0]}),Promise.resolve({tileJson:c,tileLoadFunction:o})})}}else n.tiles?(n=Object.assign({},n,{tiles:n.tiles.map(function(a){return n.scheme==="tms"&&(a=a.replace("{y}","{-y}")),pu(a,t.accessToken,t.accessTokenParam||"access_token",e||location.href)[0]})}),s=Promise.resolve({tileJson:Object.assign({},n),tileLoadFunction:o})):s=Promise.reject(new Error("source has no `tiles` nor `url`"));zw[i]=s}return s}function Nw(n,e,t,i){const s=[2*t*e.pixelRatio+e.width,2*t*e.pixelRatio+e.height],o=gu(s[0],s[1]),r=o.getContext("2d");r.drawImage(n,e.x,e.y,e.width,e.height,t*e.pixelRatio,t*e.pixelRatio,e.width,e.height);const a=r.getImageData(0,0,s[0],s[1]);r.globalCompositeOperation="destination-over",r.fillStyle=`rgba(${i.r*255},${i.g*255},${i.b*255},${i.a})`;const l=a.data;for(let c=0,h=a.width;c<h;++c)for(let u=0,d=a.height;u<d;++u){const f=(u*h+c)*4;l[f+3]>0&&r.arc(c,u,t*e.pixelRatio,0,2*Math.PI)}return r.fill(),o}function NI(n,e,t){const i=Math.max(0,Math.min(1,(t-n)/(e-n)));return i*i*(3-2*i)}function kw(n,e,t){const i=gu(e.width,e.height),s=i.getContext("2d");s.drawImage(n,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const o=s.getImageData(0,0,e.width,e.height),r=o.data;for(let a=0,l=o.width;a<l;++a)for(let c=0,h=o.height;c<h;++c){const u=(c*l+a)*4,d=r[u+3]/255,f=.75,g=.1,_=NI(f-g,f+g,d);_>0?(r[u+0]=Math.round(255*t.r*_),r[u+1]=Math.round(255*t.g*_),r[u+2]=Math.round(255*t.b*_),r[u+3]=Math.round(255*_)):r[u+3]=0}return s.putImageData(o,0,0),i}const kI=Array(256).join(" ");function cg(n,e){if(e>=.05){let t="";const i=n.split(`
|
|
158
|
+
`);this.setTileUrlFunction(hp(e.map(this.createFromWMTSTemplate.bind(this))),t)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const e=this.urls?this.urls.slice(0):[];for(const t in this.dimensions_)e.push(t+"-"+this.dimensions_[t]);return e.join("/")}updateDimensions(e){Object.assign(this.dimensions_,e),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(e){const t=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};t=="KVP"&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),e=t=="KVP"?Ih(e,i):e.replace(/\{(\w+?)\}/g,function(r,a){return a.toLowerCase()in i?i[a.toLowerCase()]:r});const s=this.tileGrid,o=this.dimensions_;return(function(r,a,l){if(!r)return;const c={TileMatrix:s.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};Object.assign(c,o);let h=e;return t=="KVP"?h=Ih(h,c):h=h.replace(/\{(\w+?)\}/g,function(u,d){return encodeURIComponent(c[d])}),h})}}class Dh extends Mh{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:Tr({extent:Qa(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const jT={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},T1={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class UT extends _1{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Kt(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(e,t,i,s,o,r,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,i,s,o,r,a,l)}getTile(e,t,i,s){const o=this.getOrCreateTile(e,t,i,s);if(!o)return null;const r=s.viewState,a=r.resolution,l=s.viewHints,c=this.getLayer().getSource(),h=c.getTileGridForProjection(r.projection),u=!(l[ot.ANIMATING]||l[ot.INTERACTING]),d=h.getZForResolution(a,c.zDirection)===e;return u&&d?o.wantedResolution=a:o.wantedResolution||(o.wantedResolution=h.getResolution(e)),o}prepareFrame(e){const t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,i){const s=this.getLayer(),o=s.getRevision(),r=s.getRenderOrder()||null,a=e.wantedResolution,l=e.getReplayState(s);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==o&&l.renderedPixelRatio===t&&l.renderedRenderOrder==r)return;const c=s.getSource(),h=!!s.getDeclutter(),u=c.getTileGrid(),f=c.getTileGridForProjection(i).getTileCoordExtent(e.wrappedTileCoord),g=c.getSourceTiles(t,i,e),_=Re(s);delete e.hitDetectionImageData[_],e.executorGroups[_]=[],l.dirty=!1;for(let v=0,E=g.length;v<E;++v){const w=g[v];if(w.getState()!=oe.LOADED)continue;const C=c.getProjection(),P=w.tileCoord;let R=u.getTileCoordExtent(P);i&&C&&!Wt(i,C)&&(R=oa(R,C,i,32));const A=$n(f,R),I=hi(A,s.getRenderBuffer()*a,this.tempExtent),M=Li(R,A)?null:I,z=new S0(0,A,a,t),k=xc(a,t),q=function(L,N){let j;const U=L.getStyleFunction()||s.getStyleFunction();if(U&&(j=U(L,a)),j){const B=this.renderFeature(L,k,j,z,h,N);l.dirty=l.dirty||B}},Y=w.getFeatures();r&&r!==l.renderedRenderOrder&&Y.sort(r);for(let L=0,N=Y.length;L<N;++L){let j=Y[L];i&&w.projection&&!Wt(i,w.projection)&&(j=j.clone(),j.getGeometry().applyTransform(Ni(w.projection,i))),(!M||pt(M,j.getGeometry().getExtent()))&&q.call(this,j,L)}const m=z.finish(),b=s.getRenderMode()!=="vector"&&h&&g.length===1?null:A,S=new A0(b,a,t,c.getOverlaps(),m,s.getRenderBuffer(),!0);e.executorGroups[_].push(S)}l.renderedRevision=o,l.renderedPixelRatio=t,l.renderedRenderOrder=r,l.renderedResolution=a}forEachFeatureAtCoordinate(e,t,i,s,o){var C,P;const r=t.viewState.resolution,a=t.viewState.rotation;i=i??0;const l=this.getLayer(),h=l.getSource().getTileGridForProjection(t.viewState.projection),u=Hr([e]);hi(u,r*i,u);const d={},f=function(R,A,I){let M=R.getId();M===void 0&&(M=Re(R));const z=d[M];if(z){if(z!==!0&&I<z.distanceSq){if(I===0)return d[M]=!0,o.splice(o.lastIndexOf(z),1),s(R,l,A);z.geometry=A,z.distanceSq=I}}else{if(I===0)return d[M]=!0,s(R,l,A);o.push(d[M]={feature:R,layer:l,geometry:A,distanceSq:I,callback:s})}},g=this.renderedTiles,_=Re(l),v=l.getDeclutter(),E=v?(P=(C=t.declutter)==null?void 0:C[v])==null?void 0:P.all().map(R=>R.value):null;let w;e:for(let R=0,A=g.length;R<A;++R){const I=g[R],M=h.getTileCoordExtent(I.wrappedTileCoord);if(!pt(M,u))continue;const z=I.executorGroups[_];for(let k=0,q=z.length;k<q;++k)if(w=z[k].forEachFeatureAtCoordinate(e,r,a,i,f,E),w)break e}return w}getFeatures(e){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((t,i)=>{const s=this.getLayer(),o=s.getSource(),r=this.renderedProjection,a=r.getExtent(),l=this.renderedResolution,c=o.getTileGridForProjection(r),h=_t(this.renderedPixelToCoordinateTransform_,e.slice()),u=c.getTileCoordForCoordAndResolution(h,l).toString(),d=this.renderedTiles.find(C=>C.tileCoord.toString()===u&&C.getState()===oe.LOADED);if(!d||d.loadingSourceTiles>0){t([]);return}o.getWrapX()&&r.canWrapX()&&!Di(a,c.getTileCoordExtent(d.tileCoord))&&ku(h,r);const f=Re(s),g=c.getTileCoordExtent(d.wrappedTileCoord),_=rn(g),v=[(h[0]-_[0])/l,(_[1]-h[1])/l],E=d.getSourceTiles().reduce((C,P)=>C.concat(P.getFeatures()),[]);let w=d.hitDetectionImageData[f];if(!w){const C=$t(c.getTileSize(c.getZForResolution(l,o.zDirection))),P=this.renderedRotation_,R=[this.getRenderTransform(c.getTileCoordCenter(d.wrappedTileCoord),l,0,wn,C[0]*wn,C[1]*wn,0)];w=D0(C,R,E,s.getStyleFunction(),c.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,P),d.hitDetectionImageData[f]=w}t(F0(v,E,w))})}getFeaturesInExtent(e){const t=[],i=this.getTileCache();if(i.getCount()===0)return t;const o=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=o.getZForResolution(this.renderedResolution),a={};return i.forEach(l=>{if(l.tileCoord[0]!==r||l.getState()!==oe.LOADED)return;const c=l.getSourceTiles();for(let h=0,u=c.length;h<u;++h){const d=c[h],f=d.getKey();if(f in a)continue;a[f]=!0;const g=d.tileCoord;if(pt(e,o.getTileCoordExtent(g))){const _=d.getFeatures();if(_)for(let v=0,E=_.length;v<E;++v){const w=_[v],C=w.getGeometry();pt(e,C.getExtent())&&t.push(w)}}}}),t}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.renderedLayerRevision_!==void 0&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e,t){var d;const i=this.context,s=i.globalAlpha;i.globalAlpha=t.opacity;const o=e.viewHints,r=!(o[ot.ANIMATING]||o[ot.INTERACTING]),a=[this.context.canvas.width,this.context.canvas.height],l=this.getLayer().getDeclutter(),c=l?(d=e.declutter)==null?void 0:d[l]:void 0,h=Re(this.getLayer()),u=this.renderedTiles;for(let f=0,g=u.length;f<g;++f){const _=u[f],v=_.executorGroups[h];if(v)for(let E=v.length-1;E>=0;--E)v[E].execute(this.context,a,this.getTileRenderTransform(_,e),e.viewState.rotation,r,Mc,c)}i.globalAlpha=s}renderDeferredInternal(e){const t=this.renderedTiles,i=Re(this.getLayer()),s=t.reduce((l,c,h)=>(c.executorGroups[i].forEach(u=>l.push({executorGroup:u,index:h})),l),[]),o=s.map(({executorGroup:l})=>l.getDeferredZIndexContexts()),r={};for(let l=0,c=s.length;l<c;++l){const h=s[l].executorGroup.getDeferredZIndexContexts();for(const u in h)r[u]=!0}Object.keys(r).map(Number).sort(li).forEach(l=>{o.forEach((c,h)=>{c[l]&&(c[l].forEach(u=>{const{executorGroup:d,index:f}=s[h],g=d.getRenderedContext(),_=g.globalAlpha;g.globalAlpha=this.renderedOpacity_;const v=this.tileClipContexts_[f];v&&v.draw(g),u.draw(g),v&&g.restore(),g.globalAlpha=_,u.clear()}),c[l].length=0)})})}getTileRenderTransform(e,t){const i=t.pixelRatio,s=t.viewState,o=s.center,r=s.resolution,a=s.rotation,l=t.size,c=Math.round(l[0]*i),h=Math.round(l[1]*i),d=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),f=e.tileCoord,g=d.getTileCoordExtent(e.wrappedTileCoord),_=d.getTileCoordExtent(f,this.tempExtent)[0]-g[0];return cc(Ku(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(o,r,a,i,c,h,_))}postRender(e,t){var R;const i=t.viewHints,s=!(i[ot.ANIMATING]||i[ot.INTERACTING]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation,this.renderedOpacity_=t.layerStatesArray[t.layerIndex].opacity;const o=this.getLayer(),r=o.getRenderMode(),a=e.globalAlpha;e.globalAlpha=this.renderedOpacity_;const l=o.getDeclutter(),c=l?T1[r].filter(A=>!Mc.includes(A)):T1[r],h=t.viewState,u=h.rotation,d=o.getSource(),g=d.getTileGridForProjection(h.projection).getZForResolution(h.resolution,d.zDirection),_=this.renderedTiles,v=[],E=[],w=[],C=Re(o);let P=!0;for(let A=_.length-1;A>=0;--A){const I=_[A];P=P&&!I.getReplayState(o).dirty;const M=I.executorGroups[C].filter(S=>S.hasExecutors(c));if(M.length===0)continue;const z=this.getTileRenderTransform(I,t),k=I.tileCoord[0];let q=!1;const Y=M[0].getClipCoords(z);let m=e,b;if(Y){b=new Dd,m=b.getContext();for(let S=0,L=v.length;S<L;++S)if(g!==k&&k<E[S]){const N=v[S];pt([Y[0],Y[3],Y[4],Y[7]],[N[0],N[3],N[4],N[7]])&&(q||(m.save(),q=!0),m.beginPath(),m.moveTo(Y[0],Y[1]),m.lineTo(Y[2],Y[3]),m.lineTo(Y[4],Y[5]),m.lineTo(Y[6],Y[7]),m.moveTo(N[6],N[7]),m.lineTo(N[4],N[5]),m.lineTo(N[2],N[3]),m.lineTo(N[0],N[1]),m.clip())}v.push(Y),E.push(k)}for(let S=0,L=M.length;S<L;++S)M[S].execute(e,[e.canvas.width,e.canvas.height],z,u,s,c,(R=t.declutter)==null?void 0:R[l]);q&&(m===e?m.restore():w[A]=b)}e.globalAlpha=a,this.ready=P,this.tileClipContexts_=w,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,i,s,o,r){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,c=i.length;l<c;++l)a=Pc(s,e,i[l],t,this.boundHandleStyleImageChange_,void 0,o,r)||a;else a=Pc(s,e,i,t,this.boundHandleStyleImageChange_,void 0,o,r);return a}tileImageNeedsRender_(e){const t=this.getLayer();if(t.getRenderMode()==="vector")return!1;const i=e.getReplayState(t),s=t.getRevision(),o=e.wantedResolution;return i.renderedTileResolution!==o||i.renderedTileRevision!==s}renderTileImage_(e,t){const i=this.getLayer(),s=e.getReplayState(i),o=i.getRevision(),r=e.executorGroups[Re(i)];s.renderedTileRevision=o;const a=e.wrappedTileCoord,l=a[0],c=i.getSource();let h=t.pixelRatio;const d=t.viewState.projection,f=c.getTileGridForProjection(d),g=f.getResolution(e.tileCoord[0]),_=t.pixelRatio/e.wantedResolution*g,v=f.getResolution(l),E=e.getContext();h=Math.round(Math.max(h,_/h));const w=c.getTilePixelSize(l,h,d);E.canvas.width=w[0],E.canvas.height=w[1];const C=h/_;if(C!==1){const I=Sm(this.tmpTransform_);Ku(I,C,C),E.setTransform.apply(E,I)}const P=f.getTileCoordExtent(a,this.tempExtent),R=_/v,A=Sm(this.tmpTransform_);Ku(A,R,-R),yb(A,-P[0],-P[3]);for(let I=0,M=r.length;I<M;++I)r[I].execute(E,[E.canvas.width*C,E.canvas.height*C],A,0,!0,jT[i.getRenderMode()],null);s.renderedTileResolution=e.wantedResolution}}class Fh extends jc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const i=e.cacheSize===void 0?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=i;const s=e.renderMode||"hybrid";$e(s=="hybrid"||s=="vector","`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=s,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new UT(this,{cacheSize:this.cacheSize_})}getFeatures(e){return super.getFeatures(e)}getFeaturesInExtent(e){return this.getRenderer().getFeaturesInExtent(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(ks.PRELOAD)}getUseInterimTilesOnError(){return this.get(ks.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(ks.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(ks.USE_INTERIM_TILES_ON_ERROR,e)}}class fp extends Ah{constructor(e){const t=e.projection||"EPSG:3857",i=e.extent||Qa(t),s=e.tileGrid||Tr({extent:i,maxResolution:e.maxResolution,maxZoom:e.maxZoom!==void 0?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,projection:t,state:e.state,tileGrid:s,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:O1,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,zDirection:e.zDirection===void 0?1:e.zDirection}),this.format_=e.format?e.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=e.overlaps==null?!0:e.overlaps,this.tileClass=e.tileClass?e.tileClass:Cx,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(e,t,i){if(i.getState()===oe.IDLE){i.setState(oe.LOADING);const s=i.wrappedTileCoord,o=this.getTileGridForProjection(t);let r=o.getTileCoordExtent(s);const a=s[0],l=o.getResolution(a);hi(r,-l,r);const c=this.projection;t&&this.projection&&!Wt(t,c)&&(r=oa(r,t,c));const h=this.tileGrid,u=h.getExtent();u&&$n(r,u,r);let d=l;t&&c&&!Wt(t,c)&&(d=l/c.getMetersPerUnit()/t.getMetersPerUnit());const f=h.getZForResolution(d,this.zDirection);h.forEachTileCoord(r,f,g=>{const _=this.tileUrlFunction(g,e,t);this.sourceTiles_[_]||(this.sourceTiles_[_]=new this.tileClass(g,_?oe.IDLE:oe.EMPTY,_,this.format_,this.tileLoadFunction));const v=this.sourceTiles_[_];i.sourceTiles.push(v),this.tileKeysBySourceTileUrl_[_]||(this.tileKeysBySourceTileUrl_[_]=[]),this.tileKeysBySourceTileUrl_[_].push(i.getKey());const E=v.getState();if(E<oe.LOADED){const w=C=>{this.handleTileChange(C);const P=v.getState();if(P===oe.LOADED||P===oe.ERROR){const R=v.getKey();R in i.errorTileKeys?v.getState()===oe.LOADED&&delete i.errorTileKeys[R]:i.loadingSourceTiles--,P===oe.ERROR?i.errorTileKeys[R]=!0:v.removeEventListener(we.CHANGE,w),i.loadingSourceTiles===0&&i.setState(gs(i.errorTileKeys)?oe.LOADED:oe.ERROR)}};v.addEventListener(we.CHANGE,w),i.loadingSourceTiles++}E===oe.IDLE&&(v.extent=h.getTileCoordExtent(g),v.projection=this.projection,v.resolution=h.getResolution(g[0]),v.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(g=>g.getState()===oe.ERROR)?oe.ERROR:oe.LOADED)}return i.sourceTiles}removeSourceTiles(e){const t=e.getKey(),i=e.sourceTiles;for(let s=0,o=i.length;s<o;++s){const r=i[s].getTileUrl();if(!this.tileKeysBySourceTileUrl_[r])return;const a=this.tileKeysBySourceTileUrl_[r].indexOf(t);a!==-1&&(this.tileKeysBySourceTileUrl_[r].splice(a,1),this.tileKeysBySourceTileUrl_[r].length===0&&(delete this.tileKeysBySourceTileUrl_[r],delete this.sourceTiles_[r]))}}getTile(e,t,i,s,o){const r=[e,t,i];let a=this.getTileCoordForTileUrlFunction(r,o);const l=this.getTileGrid().getExtent(),c=this.projection,h=this.getTileGridForProjection(o);if(a&&l){const f=h.getTileCoordExtent(a);hi(f,-h.getResolution(e),f),pt(l,!o||!c||Wt(o,c)?f:oa(f,o,c))||(a=null)}let u=!0;if(a!==null){const f=this.tileGrid,g=h.getResolution(e);let _=g;o&&c&&!Wt(o,c)&&(_=g/c.getMetersPerUnit()/o.getMetersPerUnit());const v=f.getZForResolution(_,1),E=h.getTileCoordExtent(a);hi(E,-g,E),f.forEachTileCoord(!o||!c||Wt(o,c)?E:oa(E,o,c),v,w=>{u=u&&!this.tileUrlFunction(w,s,c)})}const d=new Ex(r,u?oe.EMPTY:oe.IDLE,a,this.getSourceTiles.bind(this,s,o),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(e){const t=e.getCode();let i=this.tileGrids_[t];if(!i){const s=this.projection;if(s!==null&&!Wt(s,e))return lp(e);const o=this.tileGrid,r=o.getResolutions().slice(),a=r.map(function(h,u){return o.getOrigin(u)}),l=r.map(function(h,u){return o.getTileSize(u)}),c=ty+1;for(let h=r.length;h<c;++h)r.push(r[h-1]/2),a.push(a[h-1]),l.push(l[h-1]);i=new Us({extent:o.getExtent(),origins:a,resolutions:r,tileSizes:l}),this.tileGrids_[t]=i}return i}getTilePixelRatio(e){return e}getTilePixelSize(e,t,i){const s=this.getTileGridForProjection(i),o=$t(s.getTileSize(e),this.tmpSize);return[Math.round(o[0]*t),Math.round(o[1]*t)]}setOverlaps(e){this.overlaps_=e,this.changed()}}function O1(n,e){n.setLoader(function(t,i,s){f0(e,n.getFormat(),t,i,s,n.onLoad.bind(n),n.onError.bind(n))})}const pp=65536*65536,I1=1/pp,GT=12,A1=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),gp=0,Lh=1,Ja=2,zh=5;class qT{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const s=this.readVarint(),o=s>>3,r=this.pos;this.type=s&7,e(o,t,this),this.pos===r&&this.skip(s)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*pp;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*pp;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,s;return s=t[this.pos++],i=s&127,s<128||(s=t[this.pos++],i|=(s&127)<<7,s<128)||(s=t[this.pos++],i|=(s&127)<<14,s<128)||(s=t[this.pos++],i|=(s&127)<<21,s<128)?i:(s=t[this.pos],i|=(s&15)<<28,WT(i,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=GT&&A1?A1.decode(this.buf.subarray(t,e)):n2(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===Ja?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===gp)for(;this.buf[this.pos++]>127;);else if(t===Ja)this.pos=this.readVarint()+this.pos;else if(t===zh)this.pos+=4;else if(t===Lh)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*I1),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*I1),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){VT(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=i2(this.buf,e,this.pos);const i=this.pos-t;i>=128&&M1(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const s=this.pos-i;s>=128&&M1(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeMessage(e,t,i){this.writeTag(e,Ja),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,HT,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,XT,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,KT,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,YT,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,ZT,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,QT,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,JT,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,e2,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,t2,t)}writeBytesField(e,t){this.writeTag(e,Ja),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,zh),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,zh),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Lh),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Lh),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,gp),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,gp),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Ja),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,zh),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Lh),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function WT(n,e,t){const i=t.buf;let s,o;if(o=i[t.pos++],s=(o&112)>>4,o<128||(o=i[t.pos++],s|=(o&127)<<3,o<128)||(o=i[t.pos++],s|=(o&127)<<10,o<128)||(o=i[t.pos++],s|=(o&127)<<17,o<128)||(o=i[t.pos++],s|=(o&127)<<24,o<128)||(o=i[t.pos++],s|=(o&1)<<31,o<128))return Or(n,s,e);throw new Error("Expected varint not more than 10 bytes")}function Or(n,e,t){return t?e*4294967296+(n>>>0):(e>>>0)*4294967296+(n>>>0)}function VT(n,e){let t,i;if(n>=0?(t=n%4294967296|0,i=n/4294967296|0):(t=~(-n%4294967296),i=~(-n/4294967296),t^4294967295?t=t+1|0:(t=0,i=i+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),$T(t,i,e),BT(i,e)}function $T(n,e,t){t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos]=n&127}function BT(n,e){const t=(n&7)<<4;e.buf[e.pos++]|=t|((n>>>=3)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127)))))}function M1(n,e,t){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(i);for(let s=t.pos-1;s>=n;s--)t.buf[s+i]=t.buf[s]}function HT(n,e){for(let t=0;t<n.length;t++)e.writeVarint(n[t])}function XT(n,e){for(let t=0;t<n.length;t++)e.writeSVarint(n[t])}function YT(n,e){for(let t=0;t<n.length;t++)e.writeFloat(n[t])}function ZT(n,e){for(let t=0;t<n.length;t++)e.writeDouble(n[t])}function KT(n,e){for(let t=0;t<n.length;t++)e.writeBoolean(n[t])}function QT(n,e){for(let t=0;t<n.length;t++)e.writeFixed32(n[t])}function JT(n,e){for(let t=0;t<n.length;t++)e.writeSFixed32(n[t])}function e2(n,e){for(let t=0;t<n.length;t++)e.writeFixed64(n[t])}function t2(n,e){for(let t=0;t<n.length;t++)e.writeSFixed64(n[t])}function n2(n,e,t){let i="",s=e;for(;s<t;){const o=n[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=n[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=n[s+1],c=n[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=n[s+1],c=n[s+2],h=n[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,i+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),i+=String.fromCharCode(r),s+=a}return i}function i2(n,e,t){for(let i=0,s,o;i<e.length;i++){if(s=e.charCodeAt(i),s>55295&&s<57344)if(o)if(s<56320){n[t++]=239,n[t++]=191,n[t++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||i+1===e.length?(n[t++]=239,n[t++]=191,n[t++]=189):o=s;continue}else o&&(n[t++]=239,n[t++]=191,n[t++]=189,o=null);s<128?n[t++]=s:(s<2048?n[t++]=s>>6|192:(s<65536?n[t++]=s>>12|224:(n[t++]=s>>18|240,n[t++]=s>>12&63|128),n[t++]=s>>6&63|128),n[t++]=s&63|128)}return t}class D1{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Rn,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let i=t.dataProjection?Ne(t.dataProjection):this.readProjection(e);t.extent&&i&&i.getUnits()==="tile-pixels"&&(i=Ne(i),i.setWorldExtent(t.extent)),t={dataProjection:i,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return be()}readFeature(e,t){return be()}readFeatures(e,t){return be()}readGeometry(e,t){return be()}readProjection(e){return be()}writeFeature(e,t){return be()}writeFeatures(e,t){return be()}writeGeometry(e,t){return be()}}function Nh(n,e,t){const i=t?Ne(t.featureProjection):null,s=t?Ne(t.dataProjection):null;let o=n;if(i&&s&&!Wt(i,s)){e&&(o=n.clone());const r=e?i:s,a=e?s:i;r.getUnits()==="tile-pixels"?o.transform(r,a):o.applyTransform(Ni(r,a))}if(e&&t&&t.decimals!==void 0){const r=Math.pow(10,t.decimals),a=function(l){for(let c=0,h=l.length;c<h;++c)l[c]=Math.round(l[c]*r)/r;return l};o===n&&(o=n.clone()),o.applyTransform(a)}return o}const s2={Point:yn,LineString:Yn,Polygon:Xn,MultiPoint:Jo,MultiLineString:co,MultiPolygon:wa};function o2(n,e,t){return Array.isArray(e[0])?(Gm(n,0,e,t)||(n=n.slice(),cd(n,0,e,t)),n):(ld(n,0,e,t)||(n=n.slice(),fc(n,0,e,t)),n)}function F1(n,e){var o;const t=n.geometry;if(!t)return[];if(Array.isArray(t))return t.map(r=>F1({...n,geometry:r})).flat();const i=t.type==="MultiPolygon"?"Polygon":t.type;if(i==="GeometryCollection"||i==="Circle")throw new Error("Unsupported geometry type: "+i);const s=t.layout.length;return Nh(new Vt(i,i==="Polygon"?o2(t.flatCoordinates,t.ends,s):t.flatCoordinates,(o=t.ends)==null?void 0:o.flat(),s,n.properties||{},n.id).enableSimplifyTransformed(),!1,e)}function mp(n,e){if(!n)return null;if(Array.isArray(n)){const i=n.map(s=>mp(s,e));return new Sc(i)}const t=s2[n.type];return Nh(new t(n.flatCoordinates,n.layout||"XY",n.ends),!1,e)}class yp extends D1{constructor(e){super(),e=e||{},this.dataProjection=new na({code:"",units:"tile-pixels"}),this.featureClass=e.featureClass?e.featureClass:Vt,this.geometryName_=e.geometryName,this.layerName_=e.layerName?e.layerName:"layer",this.layers_=e.layers?e.layers:null,this.idProperty_=e.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(e,t,i,s){e.pos=t.geometry;const o=e.readVarint()+e.pos;let r=1,a=0,l=0,c=0,h=0,u=0;for(;e.pos<o;){if(!a){const d=e.readVarint();r=d&7,a=d>>3}if(a--,r===1||r===2)l+=e.readSVarint(),c+=e.readSVarint(),r===1&&h>u&&(s.push(h),u=h),i.push(l,c),h+=2;else if(r===7)h>u&&(i.push(i[u],i[u+1]),h+=2);else throw new Error("Invalid command found in the PBF")}h>u&&(s.push(h),u=h)}createFeature_(e,t,i){const s=t.type;if(s===0)return null;let o;const r=t.properties;let a;this.idProperty_?(a=r[this.idProperty_],delete r[this.idProperty_]):a=t.id,r[this.layerName_]=t.layer.name;const l=[],c=[];this.readRawGeometry_(e,t,l,c);const h=h2(s,c.length);if(this.featureClass===Vt)o=new this.featureClass(h,l,c,2,r,a),o.transform(i.dataProjection);else{let u;if(h=="Polygon"){const g=qm(l,c);u=g.length>1?new wa(l,"XY",g):new Xn(l,"XY",c)}else u=h==="Point"?new yn(l,"XY"):h==="LineString"?new Yn(l,"XY"):h==="MultiPoint"?new Jo(l,"XY"):h==="MultiLineString"?new co(l,"XY",c):null;const d=this.featureClass;o=new d,this.geometryName_&&o.setGeometryName(this.geometryName_);const f=Nh(u,!1,i);o.setGeometry(f),a!==void 0&&o.setId(a),o.setProperties(r,!0)}return o}getType(){return"arraybuffer"}readFeatures(e,t){const i=this.layers_;t=this.adaptOptions(t);const s=Ne(t.dataProjection);s.setWorldExtent(t.extent),t.dataProjection=s;const o=new qT(e),r=o.readFields(r2,{}),a=[];for(const l in r){if(i&&!i.includes(l))continue;const c=r[l],h=c?[0,0,c.extent,c.extent]:null;s.setExtent(h);for(let u=0,d=c.length;u<d;++u){const f=c2(o,c,u),g=this.createFeature_(o,f,t);g!==null&&a.push(g)}}return a}readProjection(e){return this.dataProjection}setLayers(e){this.layers_=e}}function r2(n,e,t){if(n===3){const i={keys:[],values:[],features:[]},s=t.readVarint()+t.pos;t.readFields(a2,i,s),i.length=i.features.length,i.length&&(e[i.name]=i)}}function a2(n,e,t){if(n===15)e.version=t.readVarint();else if(n===1)e.name=t.readString();else if(n===5)e.extent=t.readVarint();else if(n===2)e.features.push(t.pos);else if(n===3)e.keys.push(t.readString());else if(n===4){let i=null;const s=t.readVarint()+t.pos;for(;t.pos<s;)n=t.readVarint()>>3,i=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null;e.values.push(i)}}function l2(n,e,t){if(n==1)e.id=t.readVarint();else if(n==2){const i=t.readVarint()+t.pos;for(;t.pos<i;){const s=e.layer.keys[t.readVarint()],o=e.layer.values[t.readVarint()];e.properties[s]=o}}else n==3?e.type=t.readVarint():n==4&&(e.geometry=t.pos)}function c2(n,e,t){n.pos=e.features[t];const i=n.readVarint()+n.pos,s={layer:e,type:0,properties:{}};return n.readFields(l2,s,i),s}function h2(n,e){let t;return n===1?t=e===1?"Point":"MultiPoint":n===2?t=e===1?"LineString":"MultiLineString":n===3&&(t="Polygon"),t}var u2=8,d2={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},f2={"*":{type:"source"}},p2=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],g2={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},m2={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},y2={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},_2={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},w2={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},v2={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},b2={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},E2=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],C2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},x2={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},P2={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},S2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},R2={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},T2={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},O2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},I2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},A2={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},M2={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},D2={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},F2={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},L2={type:"array",value:"expression_name",minimum:1},z2={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},N2={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},k2={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},j2={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},U2=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],G2={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},q2={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},W2={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},V2={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},$2={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},B2={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},H2={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},X2={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Y2={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},Z2={"*":{type:"string"}},K2={type:"array",value:"interpolation_name",minimum:1},Q2={type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}},J2={$version:u2,$root:d2,sources:f2,source:p2,source_vector:g2,source_raster:m2,source_raster_dem:y2,source_geojson:_2,source_video:w2,source_image:v2,layer:b2,layout:E2,layout_background:C2,layout_fill:x2,layout_circle:P2,layout_heatmap:S2,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:R2,layout_symbol:T2,layout_raster:O2,layout_hillshade:I2,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:A2,filter_operator:M2,geometry_type:D2,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:F2,expression:L2,light:z2,sky:N2,terrain:k2,projection:j2,paint:U2,paint_fill:G2,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:q2,paint_circle:W2,paint_heatmap:V2,paint_symbol:$2,paint_raster:B2,paint_hillshade:H2,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:X2,transition:Y2,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:Z2,interpolation:K2,interpolation_name:Q2};const eO=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function tO(n,e){const t={};for(const i in n)i!=="ref"&&(t[i]=n[i]);return eO.forEach(i=>{i in e&&(t[i]=e[i])}),t}function nO(n){n=n.slice();const e=Object.create(null);for(let t=0;t<n.length;t++)e[n[t].id]=n[t];for(let t=0;t<n.length;t++)"ref"in n[t]&&(n[t]=tO(n[t],e[n[t].ref]));return n}class xi extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class _p{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[i,s]of t)this.bindings[i]=s}concat(e){return new _p(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}}const kh={kind:"null"},ie={kind:"number"},Ce={kind:"string"},Ae={kind:"boolean"},Pi={kind:"color"},jh={kind:"projectionDefinition"},Eo={kind:"object"},Te={kind:"value"},iO={kind:"error"},Uh={kind:"collator"},Gh={kind:"formatted"},qh={kind:"padding"},el={kind:"colorArray"},Wh={kind:"numberArray"},tl={kind:"resolvedImage"},Vh={kind:"variableAnchorOffsetCollection"};function Jt(n,e){return{kind:"array",itemType:n,N:e}}function dt(n){if(n.kind==="array"){const e=dt(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}else return n.kind}const sO=[kh,ie,Ce,Ae,Pi,jh,Gh,Eo,Jt(Te),qh,Wh,el,tl,Vh];function nl(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!nl(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value"){for(const t of sO)if(!nl(t,e))return null}}return`Expected ${dt(n)} but found ${dt(e)} instead.`}function wp(n,e){return e.some(t=>t.kind===n.kind)}function Co(n,e){return e.some(t=>t==="null"?n===null:t==="array"?Array.isArray(n):t==="object"?n&&!Array.isArray(n)&&typeof n=="object":t===typeof n)}function Gs(n,e){return n.kind==="array"&&e.kind==="array"?n.itemType.kind===e.itemType.kind&&typeof n.N=="number":n.kind===e.kind}const L1=.96422,z1=1,N1=.82521,k1=4/29,Ir=6/29,j1=3*Ir*Ir,oO=Ir*Ir*Ir,rO=Math.PI/180,aO=180/Math.PI;function U1(n){return n=n%360,n<0&&(n+=360),n}function G1([n,e,t,i]){n=vp(n),e=vp(e),t=vp(t);let s,o;const r=bp((.2225045*n+.7168786*e+.0606169*t)/z1);n===e&&e===t?s=o=r:(s=bp((.4360747*n+.3850649*e+.1430804*t)/L1),o=bp((.0139322*n+.0971045*e+.7141733*t)/N1));const a=116*r-16;return[a<0?0:a,500*(s-r),200*(r-o),i]}function vp(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function bp(n){return n>oO?Math.pow(n,1/3):n/j1+k1}function q1([n,e,t,i]){let s=(n+16)/116,o=isNaN(e)?s:s+e/500,r=isNaN(t)?s:s-t/200;return s=z1*Cp(s),o=L1*Cp(o),r=N1*Cp(r),[Ep(3.1338561*o-1.6168667*s-.4906146*r),Ep(-.9787684*o+1.9161415*s+.033454*r),Ep(.0719453*o-.2289914*s+1.4052427*r),i]}function Ep(n){return n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055,n<0?0:n>1?1:n}function Cp(n){return n>Ir?n*n*n:j1*(n-k1)}function lO(n){const[e,t,i,s]=G1(n),o=Math.sqrt(t*t+i*i);return[Math.round(o*1e4)?U1(Math.atan2(i,t)*aO):NaN,o,e,s]}function cO([n,e,t,i]){return n=isNaN(n)?0:n*rO,q1([t,Math.cos(n)*e,Math.sin(n)*e,i])}function hO([n,e,t,i]){n=U1(n),e/=100,t/=100;function s(o){const r=(o+n/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(r-3,9-r,1))}return[s(0),s(8),s(4),i]}const uO=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function W1(n,e){return uO(n,e)?n[e]:void 0}function dO(n){if(n=n.toLowerCase().trim(),n==="transparent")return[0,0,0,0];const e=W1(fO,n);if(e){const[s,o,r]=e;return[s/255,o/255,r/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const o=n.length<6?1:2;let r=1;return[$h(n.slice(r,r+=o)),$h(n.slice(r,r+=o)),$h(n.slice(r,r+=o)),$h(n.slice(r,r+o)||"ff")]}if(n.startsWith("rgb")){const s=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=n.match(s);if(o){const[r,a,l,c,h,u,d,f,g,_,v,E]=o,w=[c||" ",d||" ",_].join("");if(w===" "||w===" /"||w===",,"||w===",,,"){const C=[l,u,g].join(""),P=C==="%%%"?100:C===""?255:0;if(P){const R=[Ar(+a/P,0,1),Ar(+h/P,0,1),Ar(+f/P,0,1),v?V1(+v,E):1];if($1(R))return R}}return}}const t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=n.match(t);if(i){const[s,o,r,a,l,c,h,u,d]=i,f=[r||" ",l||" ",h].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){const g=[+o,Ar(+a,0,100),Ar(+c,0,100),u?V1(+u,d):1];if($1(g))return hO(g)}}}function $h(n){return parseInt(n.padEnd(2,n),16)/255}function V1(n,e){return Ar(e?n/100:n,0,1)}function Ar(n,e,t){return Math.min(Math.max(e,n),t)}function $1(n){return!n.some(Number.isNaN)}const fO={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function xo(n,e,t){return n+t*(e-n)}function il(n,e,t){return n.map((i,s)=>xo(i,e[s],t))}class Ue{constructor(e,t,i,s=1,o=!0){this.r=e,this.g=t,this.b=i,this.a=s,o||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,t,i,s]))}static parse(e){if(e instanceof Ue)return e;if(typeof e!="string")return;const t=dO(e);if(t)return new Ue(...t,!1)}get rgb(){const{r:e,g:t,b:i,a:s}=this,o=s||1/0;return this.overwriteGetter("rgb",[e/o,t/o,i/o,s])}get hcl(){return this.overwriteGetter("hcl",lO(this.rgb))}get lab(){return this.overwriteGetter("lab",G1(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,s]=this.rgb;return`rgba(${[e,t,i].map(o=>Math.round(o*255)).join(",")},${s})`}static interpolate(e,t,i,s="rgb"){switch(s){case"rgb":{const[o,r,a,l]=il(e.rgb,t.rgb,i);return new Ue(o,r,a,l,!1)}case"hcl":{const[o,r,a,l]=e.hcl,[c,h,u,d]=t.hcl;let f,g;if(!isNaN(o)&&!isNaN(c)){let C=c-o;c>o&&C>180?C-=360:c<o&&o-c>180&&(C+=360),f=o+i*C}else isNaN(o)?isNaN(c)?f=NaN:(f=c,(a===1||a===0)&&(g=h)):(f=o,(u===1||u===0)&&(g=r));const[_,v,E,w]=cO([f,g??xo(r,h,i),xo(a,u,i),xo(l,d,i)]);return new Ue(_,v,E,w,!1)}case"lab":{const[o,r,a,l]=q1(il(e.lab,t.lab,i));return new Ue(o,r,a,l,!1)}}}}Ue.black=new Ue(0,0,0,1),Ue.white=new Ue(1,1,1,1),Ue.transparent=new Ue(0,0,0,0),Ue.red=new Ue(1,0,0,1);class xp{constructor(e,t,i){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const pO=["bottom","center","top"];class Pp{constructor(e,t,i,s,o,r){this.text=e,this.image=t,this.scale=i,this.fontStack=s,this.textColor=o,this.verticalAlign=r}}class Qi{constructor(e){this.sections=e}static fromString(e){return new Qi([new Pp(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Qi?e:Qi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ti{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ti)return e;if(typeof e=="number")return new ti([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new ti(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new ti(il(e.values,t.values,i))}}class ni{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ni)return e;if(typeof e=="number")return new ni([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new ni(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new ni(il(e.values,t.values,i))}}class bn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof bn)return e;if(typeof e=="string"){const i=Ue.parse(e);return i?new bn([i]):void 0}if(!Array.isArray(e))return;const t=[];for(const i of e){if(typeof i!="string")return;const s=Ue.parse(i);if(!s)return;t.push(s)}return new bn(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i,s="rgb"){const o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let r=0;r<e.values.length;r++)o.push(Ue.interpolate(e.values[r],t.values[r],i,s));return new bn(o)}}class mt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const gO=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Si{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Si)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const i=e[t],s=e[t+1];if(typeof i!="string"||!gO.has(i)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Si(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){const s=e.values,o=t.values;if(s.length!==o.length)throw new mt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const r=[];for(let a=0;a<s.length;a+=2){if(s[a]!==o[a])throw new mt(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${s[a]}, to[${a}]: ${o[a]}`);r.push(s[a]);const[l,c]=s[a+1],[h,u]=o[a+1];r.push([xo(l,h,i),xo(c,u,i)])}return new Si(r)}}class qs{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new qs({name:e,available:!1}):null}}class ii{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new ii(e,t,i)}static parse(e){if(e instanceof ii)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ii(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ii(e.from,e.to,e.transition);if(typeof e=="string")return new ii(e,e,1)}}function B1(n,e,t,i){return typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof i>"u"||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[n,e,t,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[n,e,t,i]:[n,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function sl(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof ii||n instanceof Ue||n instanceof xp||n instanceof Qi||n instanceof ti||n instanceof ni||n instanceof bn||n instanceof Si||n instanceof qs)return!0;if(Array.isArray(n)){for(const e of n)if(!sl(e))return!1;return!0}else if(typeof n=="object"){for(const e in n)if(!sl(n[e]))return!1;return!0}else return!1}function Tt(n){if(n===null)return kh;if(typeof n=="string")return Ce;if(typeof n=="boolean")return Ae;if(typeof n=="number")return ie;if(n instanceof Ue)return Pi;if(n instanceof ii)return jh;if(n instanceof xp)return Uh;if(n instanceof Qi)return Gh;if(n instanceof ti)return qh;if(n instanceof ni)return Wh;if(n instanceof bn)return el;if(n instanceof Si)return Vh;if(n instanceof qs)return tl;if(Array.isArray(n)){const e=n.length;let t;for(const i of n){const s=Tt(i);if(!t)t=s;else{if(t===s)continue;t=Te;break}}return Jt(t||Te,e)}else return Eo}function ol(n){const e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof Ue||n instanceof ii||n instanceof Qi||n instanceof ti||n instanceof ni||n instanceof bn||n instanceof Si||n instanceof qs?n.toString():JSON.stringify(n)}class Mr{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!sl(e[1]))return t.error("invalid value");const i=e[1];let s=Tt(i);const o=t.expectedType;return s.kind==="array"&&s.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(s=o),new Mr(s,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Bh={string:Ce,number:ie,boolean:Ae,object:Eo};class si{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=1,s;const o=e[0];if(o==="array"){let a;if(e.length>2){const c=e[1];if(typeof c!="string"||!(c in Bh)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Bh[c],i++}else a=Te;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],i++}s=Jt(a,l)}else{if(!Bh[o])throw new Error(`Types doesn't contain name = ${o}`);s=Bh[o]}const r=[];for(;i<e.length;i++){const a=t.parse(e[i],i,Te);if(!a)return null;r.push(a)}return new si(s,r)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(nl(this.type,Tt(i))){if(t===this.args.length-1)throw new mt(`Expected value to be of type ${dt(this.type)}, but found ${dt(Tt(i))} instead.`)}else return i}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const H1={"to-boolean":Ae,"to-color":Pi,"to-number":ie,"to-string":Ce};class Ws{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(!H1[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&e.length!==2)return t.error("Expected one argument.");const s=H1[i],o=[];for(let r=1;r<e.length;r++){const a=t.parse(e[r],r,Te);if(!a)return null;o.push(a)}return new Ws(s,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,i;for(const s of this.args){if(t=s.evaluate(e),i=null,t instanceof Ue)return t;if(typeof t=="string"){const o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?i=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:i=B1(t[0],t[1],t[2],t[3]),!i))return new Ue(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new mt(i||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const s=ti.parse(t);if(s)return s}throw new mt(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const i of this.args){t=i.evaluate(e);const s=ni.parse(t);if(s)return s}throw new mt(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const i of this.args){t=i.evaluate(e);const s=bn.parse(t);if(s)return s}throw new mt(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const s=Si.parse(t);if(s)return s}throw new mt(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new mt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Qi.fromString(ol(this.args[0].evaluate(e)));case"resolvedImage":return qs.fromString(ol(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return ol(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const mO=["Unknown","Point","LineString","Polygon"];class X1{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?mO[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=Ue.parse(e),this._parseColorCache.set(e,t)),t}}class Hh{constructor(e,t,i=[],s,o=new _p,r=[]){this.registry=e,this.path=i,this.key=i.map(a=>`[${a}]`).join(""),this.scope=o,this.errors=r,this.expectedType=s,this._isConstant=t}parse(e,t,i,s,o={}){return t?this.concat(t,i,s)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function i(s,o,r){return r==="assert"?new si(o,[s]):r==="coerce"?new Ws(o,[s]):s}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=e[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[s];if(o){let r=o.parse(e,this);if(!r)return null;if(this.expectedType){const a=this.expectedType,l=r.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")r=i(r,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))r=i(r,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(r instanceof Mr)&&r.type.kind!=="resolvedImage"&&this._isConstant(r)){const a=new X1;try{r=new Mr(r.type,r.evaluate(a))}catch(l){return this.error(l.message),null}}return r}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const s=typeof e=="number"?this.path.concat(e):this.path,o=i?this.scope.concat(i):this.scope;return new Hh(this.registry,this._isConstant,s,t||null,o,this.errors)}error(e,...t){const i=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new xi(i,e))}checkSubtype(e,t){const i=nl(e,t);return i&&this.error(i),i}}class Xh{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let o=1;o<e.length-1;o+=2){const r=e[o];if(typeof r!="string")return t.error(`Expected string, but found ${typeof r} instead.`,o);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);const a=t.parse(e[o+1],o+1);if(!a)return null;i.push([r,a])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return s?new Xh(i,s):null}outputDefined(){return this.result.outputDefined()}}class Yh{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new Yh(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Sp{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,ie),s=t.parse(e[2],2,Jt(t.expectedType||Te));if(!i||!s)return null;const o=s.type;return new Sp(o.itemType,i,s)}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new mt(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new mt(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new mt(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Rp{constructor(e,t){this.type=Ae,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Te),s=t.parse(e[2],2,Te);return!i||!s?null:wp(i.type,[Ae,Ce,ie,kh,Te])?new Rp(i,s):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${dt(i.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!Co(t,["boolean","string","number","null"]))throw new mt(`Expected first argument to be of type boolean, string, number or null, but found ${dt(Tt(t))} instead.`);if(!Co(i,["string","array"]))throw new mt(`Expected second argument to be of type array or string, but found ${dt(Tt(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Zh{constructor(e,t,i){this.type=ie,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Te),s=t.parse(e[2],2,Te);if(!i||!s)return null;if(!wp(i.type,[Ae,Ce,ie,kh,Te]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${dt(i.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ie);return o?new Zh(i,s,o):null}else return new Zh(i,s)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Co(t,["boolean","string","number","null"]))throw new mt(`Expected first argument to be of type boolean, string, number or null, but found ${dt(Tt(t))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),Co(i,["string"])){const o=i.indexOf(t,s);return o===-1?-1:[...i.slice(0,o)].length}else{if(Co(i,["array"]))return i.indexOf(t,s);throw new mt(`Expected second argument to be of type array or string, but found ${dt(Tt(i))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Tp{constructor(e,t,i,s,o,r){this.inputType=e,this.type=t,this.input=i,this.cases=s,this.outputs=o,this.otherwise=r}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let i,s;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);const o={},r=[];for(let c=2;c<e.length-1;c+=2){let h=e[c];const u=e[c+1];Array.isArray(h)||(h=[h]);const d=t.concat(c);if(h.length===0)return d.error("Expected at least one branch label.");for(const g of h){if(typeof g!="number"&&typeof g!="string")return d.error("Branch labels must be numbers or strings.");if(typeof g=="number"&&Math.abs(g)>Number.MAX_SAFE_INTEGER)return d.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof g=="number"&&Math.floor(g)!==g)return d.error("Numeric branch labels must be integer values.");if(!i)i=Tt(g);else if(d.checkSubtype(i,Tt(g)))return null;if(typeof o[String(g)]<"u")return d.error("Branch labels must be unique.");o[String(g)]=r.length}const f=t.parse(u,c,s);if(!f)return null;s=s||f.type,r.push(f)}const a=t.parse(e[1],1,Te);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,s);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(i,a.type)?null:new Tp(i,s,a,o,r,l)}evaluate(e){const t=this.input.evaluate(e);return(Tt(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Op{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);const s=[];for(let r=1;r<e.length-1;r+=2){const a=t.parse(e[r],r,Ae);if(!a)return null;const l=t.parse(e[r+1],r+1,i);if(!l)return null;s.push([a,l]),i=i||l.type}const o=t.parse(e[e.length-1],e.length-1,i);if(!o)return null;if(!i)throw new Error("Can't infer output type");return new Op(i,s,o)}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class Kh{constructor(e,t,i,s){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Te),s=t.parse(e[2],2,ie);if(!i||!s)return null;if(!wp(i.type,[Jt(Te),Ce,Te]))return t.error(`Expected first argument to be of type array or string, but found ${dt(i.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ie);return o?new Kh(i.type,i,s,o):null}else return new Kh(i.type,i,s)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),Co(t,["string"]))return[...t].slice(i,s).join("");if(Co(t,["array"]))return t.slice(i,s);throw new mt(`Expected first argument to be of type array or string, but found ${dt(Tt(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Y1(n,e){const t=n.length-1;let i=0,s=t,o=0,r,a;for(;i<=s;)if(o=Math.floor((i+s)/2),r=n[o],a=n[o+1],r<=e){if(o===t||e<a)return o;i=o+1}else if(r>e)s=o-1;else throw new mt("Input is not a number.");return 0}class Qh{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,o]of i)this.labels.push(s),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,ie);if(!i)return null;const s=[];let o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let r=1;r<e.length;r+=2){const a=r===1?-1/0:e[r],l=e[r+1],c=r,h=r+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(s.length&&s[s.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);const u=t.parse(l,h,o);if(!u)return null;o=o||u.type,s.push([a,u])}return new Qh(o,i,s)}evaluate(e){const t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return i[0].evaluate(e);const o=t.length;if(s>=t[o-1])return i[o-1].evaluate(e);const r=Y1(t,s);return i[r].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function yO(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ip,Z1;function _O(){if(Z1)return Ip;Z1=1,Ip=n;function n(e,t,i,s){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=s}return n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,s=0;s<8;s++){var o=this.sampleCurveX(i)-e;if(Math.abs(o)<t)return i;var r=this.sampleCurveDerivativeX(i);if(Math.abs(r)<1e-6)break;i=i-o/r}var a=0,l=1;for(i=e,s=0;s<20&&(o=this.sampleCurveX(i),!(Math.abs(o-e)<t));s++)e>o?a=i:l=i,i=(l-a)*.5+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Ip}var wO=_O(),vO=yO(wO);class Ri{constructor(e,t,i,s,o){this.type=e,this.operator=t,this.interpolation=i,this.input=s,this.labels=[],this.outputs=[];for(const[r,a]of o)this.labels.push(r),this.outputs.push(a)}static interpolationFactor(e,t,i,s){let o=0;if(e.name==="exponential")o=Ap(t,e.base,i,s);else if(e.name==="linear")o=Ap(t,1,i,s);else if(e.name==="cubic-bezier"){const r=e.controlPoints;o=new vO(r[0],r[1],r[2],r[3]).solve(Ap(t,1,i,s))}return o}static parse(e,t){let[i,s,o,...r]=e;if(!Array.isArray(s)||s.length===0)return t.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const c=s[1];if(typeof c!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:c}}else if(s[0]==="cubic-bezier"){const c=s.slice(1);if(c.length!==4||c.some(h=>typeof h!="number"||h<0||h>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:c}}else return t.error(`Unknown interpolation type ${String(s[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,ie),!o)return null;const a=[];let l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&t.expectedType!=el?l=Pi:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let c=0;c<r.length;c+=2){const h=r[c],u=r[c+1],d=c+3,f=c+4;if(typeof h!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(a.length&&a[a.length-1][0]>=h)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);const g=t.parse(u,f,l);if(!g)return null;l=l||g.type,a.push([h,g])}return!Gs(l,ie)&&!Gs(l,jh)&&!Gs(l,Pi)&&!Gs(l,qh)&&!Gs(l,Wh)&&!Gs(l,el)&&!Gs(l,Vh)&&!Gs(l,Jt(ie))?t.error(`Type ${dt(l)} is not interpolatable.`):new Ri(l,i,s,o,a)}evaluate(e){const t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return i[0].evaluate(e);const o=t.length;if(s>=t[o-1])return i[o-1].evaluate(e);const r=Y1(t,s),a=t[r],l=t[r+1],c=Ri.interpolationFactor(this.interpolation,s,a,l),h=i[r].evaluate(e),u=i[r+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return xo(h,u,c);case"color":return Ue.interpolate(h,u,c);case"padding":return ti.interpolate(h,u,c);case"colorArray":return bn.interpolate(h,u,c);case"numberArray":return ni.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Si.interpolate(h,u,c);case"array":return il(h,u,c);case"projectionDefinition":return ii.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ue.interpolate(h,u,c,"hcl");case"colorArray":return bn.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ue.interpolate(h,u,c,"lab");case"colorArray":return bn.interpolate(h,u,c,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Ap(n,e,t,i){const s=i-t,o=n-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}class rl{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null;const s=t.expectedType;s&&s.kind!=="value"&&(i=s);const o=[];for(const a of e.slice(1)){const l=t.parse(a,1+o.length,i,void 0,{typeAnnotation:"omit"});if(!l)return null;i=i||l.type,o.push(l)}if(!i)throw new Error("No output type");return s&&o.some(a=>nl(s,a.type))?new rl(Te,o):new rl(i,o)}evaluate(e){let t=null,i=0,s;for(const o of this.args)if(i++,t=o.evaluate(e),t&&t instanceof qs&&!t.available&&(s||(s=t.name),t=null,i===this.args.length&&(t=s)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function K1(n,e){return n==="=="||n==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function bO(n,e,t){return e===t}function EO(n,e,t){return e!==t}function CO(n,e,t){return e<t}function xO(n,e,t){return e>t}function PO(n,e,t){return e<=t}function SO(n,e,t){return e>=t}function Q1(n,e,t,i){return i.compare(e,t)===0}function RO(n,e,t,i){return!Q1(n,e,t,i)}function TO(n,e,t,i){return i.compare(e,t)<0}function OO(n,e,t,i){return i.compare(e,t)>0}function IO(n,e,t,i){return i.compare(e,t)<=0}function AO(n,e,t,i){return i.compare(e,t)>=0}function Dr(n,e,t){const i=n!=="=="&&n!=="!=";return class _v{constructor(o,r,a){this.type=Ae,this.lhs=o,this.rhs=r,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||r.type.kind==="value"}static parse(o,r){if(o.length!==3&&o.length!==4)return r.error("Expected two or three arguments.");const a=o[0];let l=r.parse(o[1],1,Te);if(!l)return null;if(!K1(a,l.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${dt(l.type)}'.`);let c=r.parse(o[2],2,Te);if(!c)return null;if(!K1(a,c.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${dt(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error(`Cannot compare types '${dt(l.type)}' and '${dt(c.type)}'.`);i&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new si(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new si(l.type,[c])));let h=null;if(o.length===4){if(l.type.kind!=="string"&&c.type.kind!=="string"&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error("Cannot use collator to compare non-string types.");if(h=r.parse(o[3],3,Uh),!h)return null}return new _v(l,c,h)}evaluate(o){const r=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(i&&this.hasUntypedArgument){const l=Tt(r),c=Tt(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new mt(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const l=Tt(r),c=Tt(a);if(l.kind!=="string"||c.kind!=="string")return e(o,r,a)}return this.collator?t(o,r,a,this.collator.evaluate(o)):e(o,r,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}const MO=Dr("==",bO,Q1),DO=Dr("!=",EO,RO),FO=Dr("<",CO,TO),LO=Dr(">",xO,OO),zO=Dr("<=",PO,IO),NO=Dr(">=",SO,AO);class Jh{constructor(e,t,i){this.type=Uh,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const i=e[1];if(typeof i!="object"||Array.isArray(i))return t.error("Collator options argument must be an object.");const s=t.parse(i["case-sensitive"]===void 0?!1:i["case-sensitive"],1,Ae);if(!s)return null;const o=t.parse(i["diacritic-sensitive"]===void 0?!1:i["diacritic-sensitive"],1,Ae);if(!o)return null;let r=null;return i.locale&&(r=t.parse(i.locale,1,Ce),!r)?null:new Jh(s,o,r)}evaluate(e){return new xp(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Mp{constructor(e,t,i,s,o,r){this.type=Ce,this.number=e,this.locale=t,this.currency=i,this.unit=s,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ie);if(!i)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let o=null;if(s.locale&&(o=t.parse(s.locale,1,Ce),!o))return null;let r=null;if(s.currency&&(r=t.parse(s.currency,1,Ce),!r))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,Ce),!a))return null;if(r&&a)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(s["min-fraction-digits"]&&(l=t.parse(s["min-fraction-digits"],1,ie),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=t.parse(s["max-fraction-digits"],1,ie),!c)?null:new Mp(i,o,r,a,l,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Dp{constructor(e){this.type=Gh,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&typeof i=="object")return t.error("First argument must be an image or text section.");const s=[];let o=!1;for(let r=1;r<=e.length-1;++r){const a=e[r];if(o&&typeof a=="object"&&!Array.isArray(a)){o=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,ie),!l))return null;let c=null;if(a["text-font"]&&(c=t.parse(a["text-font"],1,Jt(Ce)),!c))return null;let h=null;if(a["text-color"]&&(h=t.parse(a["text-color"],1,Pi),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!pO.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(u=t.parse(a["vertical-align"],1,Ce),!u)return null}const d=s[s.length-1];d.scale=l,d.font=c,d.textColor=h,d.verticalAlign=u}else{const l=t.parse(e[r],1,Te);if(!l)return null;const c=l.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,s.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Dp(s)}evaluate(e){const t=i=>{const s=i.content.evaluate(e);return Tt(s)===tl?new Pp("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new Pp(ol(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)};return new Qi(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Fp{constructor(e){this.type=tl,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Ce);return i?new Fp(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=qs.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class Lp{constructor(e){this.type=ie,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${dt(i.type)} instead.`):new Lp(i):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new mt(`Expected value to be of type string or array, but found ${dt(Tt(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Ti=8192;function kO(n,e){const t=jO(n[0]),i=GO(n[1]),s=Math.pow(2,e.z);return[Math.round(t*s*Ti),Math.round(i*s*Ti)]}function zp(n,e){const t=Math.pow(2,e.z),i=(n[0]/Ti+e.x)/t,s=(n[1]/Ti+e.y)/t;return[UO(i),qO(s)]}function jO(n){return(180+n)/360}function UO(n){return n*360-180}function GO(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function qO(n){return 360/Math.PI*Math.atan(Math.exp((180-n*360)*Math.PI/180))-90}function al(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function ll(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function WO(n,e,t){return e[1]>n[1]!=t[1]>n[1]&&n[0]<(t[0]-e[0])*(n[1]-e[1])/(t[1]-e[1])+e[0]}function VO(n,e,t){const i=n[0]-e[0],s=n[1]-e[1],o=n[0]-t[0],r=n[1]-t[1];return i*r-o*s===0&&i*o<=0&&s*r<=0}function eu(n,e,t,i){const s=[e[0]-n[0],e[1]-n[1]],o=[i[0]-t[0],i[1]-t[1]];return XO(o,s)===0?!1:!!(ew(n,e,t,i)&&ew(t,i,n,e))}function $O(n,e,t){for(const i of t)for(let s=0;s<i.length-1;++s)if(eu(n,e,i[s],i[s+1]))return!0;return!1}function Fr(n,e,t=!1){let i=!1;for(const s of e)for(let o=0;o<s.length-1;o++){if(VO(n,s[o],s[o+1]))return t;WO(n,s[o],s[o+1])&&(i=!i)}return i}function BO(n,e){for(const t of e)if(Fr(n,t))return!0;return!1}function J1(n,e){for(const t of n)if(!Fr(t,e))return!1;for(let t=0;t<n.length-1;++t)if($O(n[t],n[t+1],e))return!1;return!0}function HO(n,e){for(const t of e)if(J1(n,t))return!0;return!1}function XO(n,e){return n[0]*e[1]-n[1]*e[0]}function ew(n,e,t,i){const s=n[0]-t[0],o=n[1]-t[1],r=e[0]-t[0],a=e[1]-t[1],l=i[0]-t[0],c=i[1]-t[1],h=s*c-l*o,u=r*c-l*a;return h>0&&u<0||h<0&&u>0}function Np(n,e,t){const i=[];for(let s=0;s<n.length;s++){const o=[];for(let r=0;r<n[s].length;r++){const a=kO(n[s][r],t);al(e,a),o.push(a)}i.push(o)}return i}function tw(n,e,t){const i=[];for(let s=0;s<n.length;s++){const o=Np(n[s],e,t);i.push(o)}return i}function nw(n,e,t,i){if(n[0]<t[0]||n[0]>t[2]){const s=i*.5;let o=n[0]-t[0]>s?-i:t[0]-n[0]>s?i:0;o===0&&(o=n[0]-t[2]>s?-i:t[2]-n[0]>s?i:0),n[0]+=o}al(e,n)}function YO(n){n[0]=n[1]=1/0,n[2]=n[3]=-1/0}function iw(n,e,t,i){const s=Math.pow(2,i.z)*Ti,o=[i.x*Ti,i.y*Ti],r=[];for(const a of n)for(const l of a){const c=[l.x+o[0],l.y+o[1]];nw(c,e,t,s),r.push(c)}return r}function sw(n,e,t,i){const s=Math.pow(2,i.z)*Ti,o=[i.x*Ti,i.y*Ti],r=[];for(const a of n){const l=[];for(const c of a){const h=[c.x+o[0],c.y+o[1]];al(e,h),l.push(h)}r.push(l)}if(e[2]-e[0]<=s/2){YO(e);for(const a of r)for(const l of a)nw(l,e,t,s)}return r}function ZO(n,e){const t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],s=n.canonicalID();if(e.type==="Polygon"){const o=Np(e.coordinates,i,s),r=iw(n.geometry(),t,i,s);if(!ll(t,i))return!1;for(const a of r)if(!Fr(a,o))return!1}if(e.type==="MultiPolygon"){const o=tw(e.coordinates,i,s),r=iw(n.geometry(),t,i,s);if(!ll(t,i))return!1;for(const a of r)if(!BO(a,o))return!1}return!0}function KO(n,e){const t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],s=n.canonicalID();if(e.type==="Polygon"){const o=Np(e.coordinates,i,s),r=sw(n.geometry(),t,i,s);if(!ll(t,i))return!1;for(const a of r)if(!J1(a,o))return!1}if(e.type==="MultiPolygon"){const o=tw(e.coordinates,i,s),r=sw(n.geometry(),t,i,s);if(!ll(t,i))return!1;for(const a of r)if(!HO(a,o))return!1}return!0}class Po{constructor(e,t){this.type=Ae,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(sl(e[1])){const i=e[1];if(i.type==="FeatureCollection"){const s=[];for(const o of i.features){const{type:r,coordinates:a}=o.geometry;r==="Polygon"&&s.push(a),r==="MultiPolygon"&&s.push(...a)}if(s.length){const o={type:"MultiPolygon",coordinates:s};return new Po(i,o)}}else if(i.type==="Feature"){const s=i.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Po(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Po(i,i)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return ZO(e,this.geometries);if(e.geometryType()==="LineString")return KO(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class ow{constructor(e=[],t=(i,s)=>i<s?-1:i>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,s=t[e];for(;e>0;){const o=e-1>>1,r=t[o];if(i(s,r)>=0)break;t[e]=r,e=o}t[e]=s}_down(e){const{data:t,compare:i}=this,s=this.length>>1,o=t[e];for(;e<s;){let r=(e<<1)+1;const a=r+1;if(a<this.length&&i(t[a],t[r])<0&&(r=a),i(t[r],o)>=0)break;t[e]=t[r],e=r}t[e]=o}}function QO(n,e){if(n.length<=1)return[n];const i=[];let s,o;for(const r of n){const a=JO(r);a!==0&&(r.area=Math.abs(a),o===void 0&&(o=a<0),o===a<0?(s&&i.push(s),s=[r]):s.push(r))}return s&&i.push(s),i}function JO(n){let e=0;for(let t=0,i=n.length,s=i-1,o,r;t<i;s=t++)o=n[t],r=n[s],e+=(r.x-o.x)*(o.y+r.y);return e}const eI=6378.137,rw=1/298.257223563,aw=rw*(2-rw),lw=Math.PI/180;class kp{constructor(e){const t=lw*eI*1e3,i=Math.cos(e*lw),s=1/(1-aw*(1-i*i)),o=Math.sqrt(s);this.kx=t*o*i,this.ky=t*o*s*(1-aw)}distance(e,t){const i=this.wrap(e[0]-t[0])*this.kx,s=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+s*s)}pointOnLine(e,t){let i=1/0,s,o,r,a;for(let l=0;l<e.length-1;l++){let c=e[l][0],h=e[l][1],u=this.wrap(e[l+1][0]-c)*this.kx,d=(e[l+1][1]-h)*this.ky,f=0;(u!==0||d!==0)&&(f=(this.wrap(t[0]-c)*this.kx*u+(t[1]-h)*this.ky*d)/(u*u+d*d),f>1?(c=e[l+1][0],h=e[l+1][1]):f>0&&(c+=u/this.kx*f,h+=d/this.ky*f)),u=this.wrap(t[0]-c)*this.kx,d=(t[1]-h)*this.ky;const g=u*u+d*d;g<i&&(i=g,s=c,o=h,r=l,a=f)}return{point:[s,o],index:r,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}const jp=100,Up=50;function cw(n,e){return e[0]-n[0]}function tu(n){return n[1]-n[0]+1}function Ji(n,e){return n[1]>=n[0]&&n[1]<e}function Gp(n,e){if(n[0]>n[1])return[null,null];const t=tu(n);if(e){if(t===2)return[n,null];const s=Math.floor(t/2);return[[n[0],n[0]+s],[n[0]+s,n[1]]]}if(t===1)return[n,null];const i=Math.floor(t/2)-1;return[[n[0],n[0]+i],[n[0]+i+1,n[1]]]}function qp(n,e){if(!Ji(e,n.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)al(t,n[i]);return t}function Wp(n){const e=[1/0,1/0,-1/0,-1/0];for(const t of n)for(const i of t)al(e,i);return e}function hw(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function Vp(n,e,t){if(!hw(n)||!hw(e))return NaN;let i=0,s=0;return n[2]<e[0]&&(i=e[0]-n[2]),n[0]>e[2]&&(i=n[0]-e[2]),n[1]>e[3]&&(s=n[1]-e[3]),n[3]<e[1]&&(s=e[1]-n[3]),t.distance([0,0],[i,s])}function So(n,e,t){const i=t.pointOnLine(e,n);return t.distance(n,i.point)}function $p(n,e,t,i,s){const o=Math.min(So(n,[t,i],s),So(e,[t,i],s)),r=Math.min(So(t,[n,e],s),So(i,[n,e],s));return Math.min(o,r)}function tI(n,e,t,i,s){if(!(Ji(e,n.length)&&Ji(i,t.length)))return 1/0;let r=1/0;for(let a=e[0];a<e[1];++a){const l=n[a],c=n[a+1];for(let h=i[0];h<i[1];++h){const u=t[h],d=t[h+1];if(eu(l,c,u,d))return 0;r=Math.min(r,$p(l,c,u,d,s))}}return r}function nI(n,e,t,i,s){if(!(Ji(e,n.length)&&Ji(i,t.length)))return NaN;let r=1/0;for(let a=e[0];a<=e[1];++a)for(let l=i[0];l<=i[1];++l)if(r=Math.min(r,s.distance(n[a],t[l])),r===0)return r;return r}function iI(n,e,t){if(Fr(n,e,!0))return 0;let i=1/0;for(const s of e){const o=s[0],r=s[s.length-1];if(o!==r&&(i=Math.min(i,So(n,[r,o],t)),i===0))return i;const a=t.pointOnLine(s,n);if(i=Math.min(i,t.distance(n,a.point)),i===0)return i}return i}function sI(n,e,t,i){if(!Ji(e,n.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Fr(n[o],t,!0))return 0;let s=1/0;for(let o=e[0];o<e[1];++o){const r=n[o],a=n[o+1];for(const l of t)for(let c=0,h=l.length,u=h-1;c<h;u=c++){const d=l[u],f=l[c];if(eu(r,a,d,f))return 0;s=Math.min(s,$p(r,a,d,f,i))}}return s}function uw(n,e){for(const t of n)for(const i of t)if(Fr(i,e,!0))return!0;return!1}function oI(n,e,t,i=1/0){const s=Wp(n),o=Wp(e);if(i!==1/0&&Vp(s,o,t)>=i)return i;if(ll(s,o)){if(uw(n,e))return 0}else if(uw(e,n))return 0;let r=1/0;for(const a of n)for(let l=0,c=a.length,h=c-1;l<c;h=l++){const u=a[h],d=a[l];for(const f of e)for(let g=0,_=f.length,v=_-1;g<_;v=g++){const E=f[v],w=f[g];if(eu(u,d,E,w))return 0;r=Math.min(r,$p(u,d,E,w,t))}}return r}function dw(n,e,t,i,s,o){if(!o)return;const r=Vp(qp(i,o),s,t);r<e&&n.push([r,o,[0,0]])}function nu(n,e,t,i,s,o,r){if(!o||!r)return;const a=Vp(qp(i,o),qp(s,r),t);a<e&&n.push([a,o,r])}function iu(n,e,t,i,s=1/0){let o=Math.min(i.distance(n[0],t[0][0]),s);if(o===0)return o;const r=new ow([[0,[0,n.length-1],[0,0]]],cw),a=Wp(t);for(;r.length>0;){const l=r.pop();if(l[0]>=o)continue;const c=l[1],h=e?Up:jp;if(tu(c)<=h){if(!Ji(c,n.length))return NaN;if(e){const u=sI(n,c,t,i);if(isNaN(u)||u===0)return u;o=Math.min(o,u)}else for(let u=c[0];u<=c[1];++u){const d=iI(n[u],t,i);if(o=Math.min(o,d),o===0)return 0}}else{const u=Gp(c,e);dw(r,o,i,n,a,u[0]),dw(r,o,i,n,a,u[1])}}return o}function su(n,e,t,i,s,o=1/0){let r=Math.min(o,s.distance(n[0],t[0]));if(r===0)return r;const a=new ow([[0,[0,n.length-1],[0,t.length-1]]],cw);for(;a.length>0;){const l=a.pop();if(l[0]>=r)continue;const c=l[1],h=l[2],u=e?Up:jp,d=i?Up:jp;if(tu(c)<=u&&tu(h)<=d){if(!Ji(c,n.length)&&Ji(h,t.length))return NaN;let f;if(e&&i)f=tI(n,c,t,h,s),r=Math.min(r,f);else if(e&&!i){const g=n.slice(c[0],c[1]+1);for(let _=h[0];_<=h[1];++_)if(f=So(t[_],g,s),r=Math.min(r,f),r===0)return r}else if(!e&&i){const g=t.slice(h[0],h[1]+1);for(let _=c[0];_<=c[1];++_)if(f=So(n[_],g,s),r=Math.min(r,f),r===0)return r}else f=nI(n,c,t,h,s),r=Math.min(r,f)}else{const f=Gp(c,e),g=Gp(h,i);nu(a,r,s,n,t,f[0],g[0]),nu(a,r,s,n,t,f[0],g[1]),nu(a,r,s,n,t,f[1],g[0]),nu(a,r,s,n,t,f[1],g[1])}}return r}function rI(n,e){const t=n.geometry(),i=t.flat().map(r=>zp([r.x,r.y],n.canonical));if(t.length===0)return NaN;const s=new kp(i[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,su(i,!1,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,su(i,!1,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,iu(i,!1,r.coordinates,s,o));break}if(o===0)return o}return o}function aI(n,e){const t=n.geometry(),i=t.flat().map(r=>zp([r.x,r.y],n.canonical));if(t.length===0)return NaN;const s=new kp(i[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,su(i,!0,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,su(i,!0,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,iu(i,!0,r.coordinates,s,o));break}if(o===0)return o}return o}function lI(n,e){const t=n.geometry();if(t.length===0||t[0].length===0)return NaN;const i=QO(t).map(r=>r.map(a=>a.map(l=>zp([l.x,l.y],n.canonical)))),s=new kp(i[0][0][0][1]);let o=1/0;for(const r of e)for(const a of i){switch(r.type){case"Point":o=Math.min(o,iu([r.coordinates],!1,a,s,o));break;case"LineString":o=Math.min(o,iu(r.coordinates,!0,a,s,o));break;case"Polygon":o=Math.min(o,oI(a,r.coordinates,s,o));break}if(o===0)return o}return o}function Bp(n){return n.type==="MultiPolygon"?n.coordinates.map(e=>({type:"Polygon",coordinates:e})):n.type==="MultiLineString"?n.coordinates.map(e=>({type:"LineString",coordinates:e})):n.type==="MultiPoint"?n.coordinates.map(e=>({type:"Point",coordinates:e})):[n]}class Ro{constructor(e,t){this.type=ie,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(sl(e[1])){const i=e[1];if(i.type==="FeatureCollection")return new Ro(i,i.features.map(s=>Bp(s.geometry)).flat());if(i.type==="Feature")return new Ro(i,Bp(i.geometry));if("type"in i&&"coordinates"in i)return new Ro(i,Bp(i))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return rI(e,this.geometries);if(e.geometryType()==="LineString")return aI(e,this.geometries);if(e.geometryType()==="Polygon")return lI(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class cl{constructor(e){this.type=Te,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=e[1];return i==null?t.error("Global state property must be defined."):typeof i!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new cl(i)}evaluate(e){var t;const i=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!i||Object.keys(i).length===0?null:W1(i,this.key)}eachChild(){}outputDefined(){return!1}}const ou={"==":MO,"!=":DO,">":LO,"<":FO,">=":NO,"<=":zO,array:si,at:Sp,boolean:si,case:Op,coalesce:rl,collator:Jh,format:Dp,image:Fp,in:Rp,"index-of":Zh,interpolate:Ri,"interpolate-hcl":Ri,"interpolate-lab":Ri,length:Lp,let:Xh,literal:Mr,match:Tp,number:si,"number-format":Mp,object:si,slice:Kh,step:Qh,string:si,"to-boolean":Ws,"to-color":Ws,"to-number":Ws,"to-string":Ws,var:Yh,within:Po,distance:Ro,"global-state":cl};class En{constructor(e,t,i,s){this.name=e,this.type=t,this._evaluate=i,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],s=En.definitions[i];if(!s)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(s)?s[0]:s.type,r=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,a=r.filter(([c])=>!Array.isArray(c)||c.length===e.length-1);let l=null;for(const[c,h]of a){l=new Hh(t.registry,ru,t.path,null,t.scope);const u=[];let d=!1;for(let f=1;f<e.length;f++){const g=e[f],_=Array.isArray(c)?c[f-1]:c.type,v=l.parse(g,1+u.length,_);if(!v){d=!0;break}u.push(v)}if(!d){if(Array.isArray(c)&&c.length!==u.length){l.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);continue}for(let f=0;f<u.length;f++){const g=Array.isArray(c)?c[f]:c.type,_=u[f];l.concat(f+1).checkSubtype(g,_.type)}if(l.errors.length===0)return new En(i,o,h,u)}}if(a.length===1)t.errors.push(...l.errors);else{const h=(a.length?a:r).map(([d])=>hI(d)).join(" | "),u=[];for(let d=1;d<e.length;d++){const f=t.parse(e[d],1+u.length);if(!f)return null;u.push(dt(f.type))}t.error(`Expected arguments of type ${h}, but found (${u.join(", ")}) instead.`)}return null}static register(e,t){En.definitions=t;for(const i in t)e[i]=En}}function fw(n,[e,t,i,s]){e=e.evaluate(n),t=t.evaluate(n),i=i.evaluate(n);const o=s?s.evaluate(n):1,r=B1(e,t,i,o);if(r)throw new mt(r);return new Ue(e/255,t/255,i/255,o,!1)}function pw(n,e){return n in e}function Hp(n,e){const t=e[n];return typeof t>"u"?null:t}function cI(n,e,t,i){for(;t<=i;){const s=t+i>>1;if(e[s]===n)return!0;e[s]>n?i=s-1:t=s+1}return!1}function To(n){return{type:n}}En.register(ou,{error:[iO,[Ce],(n,[e])=>{throw new mt(e.evaluate(n))}],typeof:[Ce,[Te],(n,[e])=>dt(Tt(e.evaluate(n)))],"to-rgba":[Jt(ie,4),[Pi],(n,[e])=>{const[t,i,s,o]=e.evaluate(n).rgb;return[t*255,i*255,s*255,o]}],rgb:[Pi,[ie,ie,ie],fw],rgba:[Pi,[ie,ie,ie,ie],fw],has:{type:Ae,overloads:[[[Ce],(n,[e])=>pw(e.evaluate(n),n.properties())],[[Ce,Eo],(n,[e,t])=>pw(e.evaluate(n),t.evaluate(n))]]},get:{type:Te,overloads:[[[Ce],(n,[e])=>Hp(e.evaluate(n),n.properties())],[[Ce,Eo],(n,[e,t])=>Hp(e.evaluate(n),t.evaluate(n))]]},"feature-state":[Te,[Ce],(n,[e])=>Hp(e.evaluate(n),n.featureState||{})],properties:[Eo,[],n=>n.properties()],"geometry-type":[Ce,[],n=>n.geometryType()],id:[Te,[],n=>n.id()],zoom:[ie,[],n=>n.globals.zoom],"heatmap-density":[ie,[],n=>n.globals.heatmapDensity||0],elevation:[ie,[],n=>n.globals.elevation||0],"line-progress":[ie,[],n=>n.globals.lineProgress||0],accumulated:[Te,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[ie,To(ie),(n,e)=>{let t=0;for(const i of e)t+=i.evaluate(n);return t}],"*":[ie,To(ie),(n,e)=>{let t=1;for(const i of e)t*=i.evaluate(n);return t}],"-":{type:ie,overloads:[[[ie,ie],(n,[e,t])=>e.evaluate(n)-t.evaluate(n)],[[ie],(n,[e])=>-e.evaluate(n)]]},"/":[ie,[ie,ie],(n,[e,t])=>e.evaluate(n)/t.evaluate(n)],"%":[ie,[ie,ie],(n,[e,t])=>e.evaluate(n)%t.evaluate(n)],ln2:[ie,[],()=>Math.LN2],pi:[ie,[],()=>Math.PI],e:[ie,[],()=>Math.E],"^":[ie,[ie,ie],(n,[e,t])=>Math.pow(e.evaluate(n),t.evaluate(n))],sqrt:[ie,[ie],(n,[e])=>Math.sqrt(e.evaluate(n))],log10:[ie,[ie],(n,[e])=>Math.log(e.evaluate(n))/Math.LN10],ln:[ie,[ie],(n,[e])=>Math.log(e.evaluate(n))],log2:[ie,[ie],(n,[e])=>Math.log(e.evaluate(n))/Math.LN2],sin:[ie,[ie],(n,[e])=>Math.sin(e.evaluate(n))],cos:[ie,[ie],(n,[e])=>Math.cos(e.evaluate(n))],tan:[ie,[ie],(n,[e])=>Math.tan(e.evaluate(n))],asin:[ie,[ie],(n,[e])=>Math.asin(e.evaluate(n))],acos:[ie,[ie],(n,[e])=>Math.acos(e.evaluate(n))],atan:[ie,[ie],(n,[e])=>Math.atan(e.evaluate(n))],min:[ie,To(ie),(n,e)=>Math.min(...e.map(t=>t.evaluate(n)))],max:[ie,To(ie),(n,e)=>Math.max(...e.map(t=>t.evaluate(n)))],abs:[ie,[ie],(n,[e])=>Math.abs(e.evaluate(n))],round:[ie,[ie],(n,[e])=>{const t=e.evaluate(n);return t<0?-Math.round(-t):Math.round(t)}],floor:[ie,[ie],(n,[e])=>Math.floor(e.evaluate(n))],ceil:[ie,[ie],(n,[e])=>Math.ceil(e.evaluate(n))],"filter-==":[Ae,[Ce,Te],(n,[e,t])=>n.properties()[e.value]===t.value],"filter-id-==":[Ae,[Te],(n,[e])=>n.id()===e.value],"filter-type-==":[Ae,[Ce],(n,[e])=>n.geometryType()===e.value],"filter-<":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i<s}],"filter-id-<":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t<i}],"filter->":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i>s}],"filter-id->":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t>i}],"filter-<=":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i<=s}],"filter-id-<=":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t<=i}],"filter->=":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i>=s}],"filter-id->=":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t>=i}],"filter-has":[Ae,[Te],(n,[e])=>e.value in n.properties()],"filter-has-id":[Ae,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[Ae,[Jt(Ce)],(n,[e])=>e.value.indexOf(n.geometryType())>=0],"filter-id-in":[Ae,[Jt(Te)],(n,[e])=>e.value.indexOf(n.id())>=0],"filter-in-small":[Ae,[Ce,Jt(Te)],(n,[e,t])=>t.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[Ae,[Ce,Jt(Te)],(n,[e,t])=>cI(n.properties()[e.value],t.value,0,t.value.length-1)],all:{type:Ae,overloads:[[[Ae,Ae],(n,[e,t])=>e.evaluate(n)&&t.evaluate(n)],[To(Ae),(n,e)=>{for(const t of e)if(!t.evaluate(n))return!1;return!0}]]},any:{type:Ae,overloads:[[[Ae,Ae],(n,[e,t])=>e.evaluate(n)||t.evaluate(n)],[To(Ae),(n,e)=>{for(const t of e)if(t.evaluate(n))return!0;return!1}]]},"!":[Ae,[Ae],(n,[e])=>!e.evaluate(n)],"is-supported-script":[Ae,[Ce],(n,[e])=>{const t=n.globals&&n.globals.isSupportedScript;return t?t(e.evaluate(n)):!0}],upcase:[Ce,[Ce],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[Ce,[Ce],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[Ce,To(Te),(n,e)=>e.map(t=>ol(t.evaluate(n))).join("")],split:[Jt(Ce),[Ce,Ce],(n,[e,t])=>e.evaluate(n).split(t.evaluate(n))],join:[Ce,[Jt(Ce),Ce],(n,[e,t])=>e.evaluate(n).join(t.evaluate(n))],"resolved-locale":[Ce,[Uh],(n,[e])=>e.evaluate(n).resolvedLocale()]});function hI(n){return Array.isArray(n)?`(${n.map(dt).join(", ")})`:`(${dt(n.type)}...)`}function ru(n){if(n instanceof Yh)return ru(n.boundExpression);if(n instanceof En&&n.name==="error")return!1;if(n instanceof Jh)return!1;if(n instanceof Po)return!1;if(n instanceof Ro)return!1;if(n instanceof cl)return!1;const e=n instanceof Ws||n instanceof si;let t=!0;return n.eachChild(i=>{e?t=t&&ru(i):t=t&&i instanceof Mr}),t?Xp(n)&&Zp(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Xp(n){if(n instanceof En){if(n.name==="get"&&n.args.length===1)return!1;if(n.name==="feature-state")return!1;if(n.name==="has"&&n.args.length===1)return!1;if(n.name==="properties"||n.name==="geometry-type"||n.name==="id")return!1;if(/^filter-/.test(n.name))return!1}if(n instanceof Po||n instanceof Ro)return!1;let e=!0;return n.eachChild(t=>{e&&!Xp(t)&&(e=!1)}),e}function Yp(n){if(n instanceof En&&n.name==="feature-state")return!1;let e=!0;return n.eachChild(t=>{e&&!Yp(t)&&(e=!1)}),e}function Zp(n,e){if(n instanceof En&&e.indexOf(n.name)>=0)return!1;let t=!0;return n.eachChild(i=>{t&&!Zp(i,e)&&(t=!1)}),t}function Kp(n){return{result:"success",value:n}}function Lr(n){return{result:"error",value:n}}function uI(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function dI(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function fI(n){return!!n.expression&&n.expression.interpolated}function au(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Tt(n)===Eo}class pI{constructor(e,t,i){this.expression=e,this._warningHistory={},this._evaluator=new X1,this._defaultValue=t?mI(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this._globalState=i}evaluateWithoutErrorHandling(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,s,o,r){this._globalState&&(e=zr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r||null;try{const a=this.expression.evaluate(this._evaluator);if(a==null||typeof a=="number"&&a!==a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new mt(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(a)} instead.`);return a}catch(a){return this._warningHistory[a.message]||(this._warningHistory[a.message]=!0,typeof console<"u"&&console.warn(a.message)),this._defaultValue}}}function lu(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in ou}function gw(n,e,t){const i=new Hh(ou,ru,[],e?gI(e):void 0),s=i.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Kp(new pI(s,e,t)):Lr(i.errors)}class mw{constructor(e,t,i){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Yp(t.expression),this.globalStateRefs=hu(t.expression),this._globalState=i}evaluateWithoutErrorHandling(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,s,o,r)}evaluate(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluate(e,t,i,s,o,r)}}class yw{constructor(e,t,i,s,o){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Yp(t.expression),this.globalStateRefs=hu(t.expression),this.interpolationType=s,this._globalState=o}evaluateWithoutErrorHandling(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,s,o,r)}evaluate(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluate(e,t,i,s,o,r)}interpolationFactor(e,t,i){return this.interpolationType?Ri.interpolationFactor(this.interpolationType,e,t,i):0}}function _w(n,e,t){const i=gw(n,e,t);if(i.result==="error")return i;const s=i.value.expression,o=Xp(s);if(!o&&!uI(e))return Lr([new xi("","data expressions not supported")]);const r=Zp(s,["zoom"]);if(!r&&!dI(e))return Lr([new xi("","zoom expressions not supported")]);const a=cu(s);if(!a&&!r)return Lr([new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof xi)return Lr([a]);if(a instanceof Ri&&!fI(e))return Lr([new xi("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Kp(o?new mw("constant",i.value,t):new mw("source",i.value,t));const l=a instanceof Ri?a.interpolation:void 0;return Kp(o?new yw("camera",i.value,a.labels,l,t):new yw("composite",i.value,a.labels,l,t))}function cu(n){let e=null;if(n instanceof Xh)e=cu(n.result);else if(n instanceof rl){for(const t of n.args)if(e=cu(t),e)break}else(n instanceof Qh||n instanceof Ri)&&n.input instanceof En&&n.input.name==="zoom"&&(e=n);return e instanceof xi||n.eachChild(t=>{const i=cu(t);i instanceof xi?e=i:!e&&i?e=new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new xi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function hu(n,e=new Set){return n instanceof cl&&e.add(n.key),n.eachChild(t=>{hu(t,e)}),e}function gI(n){const e={color:Pi,string:Ce,number:ie,enum:Ce,boolean:Ae,formatted:Gh,padding:qh,numberArray:Wh,colorArray:el,projectionDefinition:jh,resolvedImage:tl,variableAnchorOffsetCollection:Vh};return n.type==="array"?Jt(e[n.value]||Te,n.length):e[n.type]}function mI(n){if(n.type==="color"&&au(n.default))return new Ue(0,0,0,0);switch(n.type){case"color":return Ue.parse(n.default)||null;case"padding":return ti.parse(n.default)||null;case"numberArray":return ni.parse(n.default)||null;case"colorArray":return bn.parse(n.default)||null;case"variableAnchorOffsetCollection":return Si.parse(n.default)||null;case"projectionDefinition":return ii.parse(n.default)||null;default:return n.default===void 0?null:n.default}}function zr(n,e){const{zoom:t,heatmapDensity:i,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a}=n??{};return{zoom:t,heatmapDensity:i,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a,globalState:e}}function ww(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!ww(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const yI={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function _I(n,e){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};ww(n)||(n=uu(n));const t=gw(n,yI,e);if(t.result==="error")throw new Error(t.value.map(i=>`${i.key}: ${i.message}`).join(", "));{const i=vw(n);return{filter:(s,o,r)=>t.value.evaluate(s,o,{},r),needGeometry:i,getGlobalStateRefs:()=>hu(t.value.expression)}}}function wI(n,e){return n<e?-1:n>e?1:0}function vw(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let e=1;e<n.length;e++)if(vw(n[e]))return!0;return!1}function uu(n){if(!n)return!0;const e=n[0];return n.length<=1?e!=="any":e==="=="?Qp(n[1],n[2],"=="):e==="!="?du(Qp(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Qp(n[1],n[2],e):e==="any"?vI(n.slice(1)):e==="all"?["all"].concat(n.slice(1).map(uu)):e==="none"?["all"].concat(n.slice(1).map(uu).map(du)):e==="in"?bw(n[1],n.slice(2)):e==="!in"?du(bw(n[1],n.slice(2))):e==="has"?Ew(n[1]):e==="!has"?du(Ew(n[1])):!0}function Qp(n,e,t){switch(n){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,n,e]}}function vI(n){return["any"].concat(n.map(uu))}function bw(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",n,["literal",e.sort(wI)]]:["filter-in-small",n,["literal",e]]}}function Ew(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function du(n){return["!",n]}function hl(n){return typeof n=="object"?["literal",n]:n}function Cw(n,e){let t=n.stops;if(!t)return bI(n,e);const i=t&&typeof t[0][0]=="object",s=i||n.property!==void 0,o=i||!s;return t=t.map(r=>!s&&e.tokens&&typeof r[1]=="string"?[r[0],PI(r[1])]:[r[0],hl(r[1])]),i?EI(n,e,t):o?xI(n,e,t):eg(n,e,t)}function bI(n,e){const t=["get",n.property];if(n.default===void 0)return e.type==="string"?["string",t]:t;if(e.type==="enum")return["match",t,Object.keys(e.values),t,n.default];{const i=[e.type==="color"?"to-color":e.type,t,hl(n.default)];return e.type==="array"&&i.splice(1,0,e.value,e.length||null),i}}function Jp(n){switch(n.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function EI(n,e,t){const i={},s={},o=[];for(let a=0;a<t.length;a++){const l=t[a],c=l[0].zoom;i[c]===void 0&&(i[c]={zoom:c,type:n.type,property:n.property,default:n.default},s[c]=[],o.push(c)),s[c].push([l[0].value,l[1]])}if(ng({},e)==="exponential"){const a=[Jp(n),["linear"],["zoom"]];for(const l of o){const c=eg(i[l],e,s[l]);Nr(a,l,c,!1)}return a}else{const a=["step",["zoom"]];for(const l of o){const c=eg(i[l],e,s[l]);Nr(a,l,c,!0)}return tg(a),a}}function CI(n,e){if(n!==void 0)return n;if(e!==void 0)return e}function xw(n,e){const t=hl(CI(n.default,e.default));return t===void 0&&e.type==="resolvedImage"?"":t}function eg(n,e,t){const i=ng(n,e),s=["get",n.property];if(i==="categorical"&&typeof t[0][0]=="boolean"){const o=["case"];for(const r of t)o.push(["==",s,r[0]],r[1]);return o.push(xw(n,e)),o}else if(i==="categorical"){const o=["match",s];for(const r of t)Nr(o,r[0],r[1],!1);return o.push(xw(n,e)),o}else if(i==="interval"){const o=["step",["number",s]];for(const r of t)Nr(o,r[0],r[1],!0);return tg(o),n.default===void 0?o:["case",["==",["typeof",s],"number"],o,hl(n.default)]}else if(i==="exponential"){const o=n.base!==void 0?n.base:1,r=[Jp(n),o===1?["linear"]:["exponential",o],["number",s]];for(const a of t)Nr(r,a[0],a[1],!1);return n.default===void 0?r:["case",["==",["typeof",s],"number"],r,hl(n.default)]}else throw new Error(`Unknown property function type ${i}`)}function xI(n,e,t,i=["zoom"]){const s=ng(n,e);let o,r=!1;if(s==="interval")o=["step",i],r=!0;else if(s==="exponential"){const a=n.base!==void 0?n.base:1;o=[Jp(n),a===1?["linear"]:["exponential",a],i]}else throw new Error(`Unknown zoom function type "${s}"`);for(const a of t)Nr(o,a[0],a[1],r);return tg(o),o}function tg(n){n[0]==="step"&&n.length===3&&(n.push(0),n.push(n[3]))}function Nr(n,e,t,i){n.length>3&&e===n[n.length-2]||(i&&n.length===2||n.push(e),n.push(t))}function ng(n,e){return n.type?n.type:e.expression.interpolated?"exponential":"interval"}function PI(n){const e=["concat"],t=/{([^{}]+)}/g;let i=0;for(let s=t.exec(n);s!==null;s=t.exec(n)){const o=n.slice(i,t.lastIndex-s[0].length);i=t.lastIndex,o.length>0&&e.push(o),e.push(["get",s[1]])}if(e.length===1)return n;if(i<n.length)e.push(n.slice(i));else if(e.length===2)return["to-string",e[1]];return e}const Pw=J2;var Sw={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},ul=" ",Rw=/(italic|oblique)$/i,Tw={};function ig(n,e,t){var i=Tw[n];if(!i){Array.isArray(n)||(n=[n]);for(var s=400,o="normal",r=[],a,l,c=0,h=n.length;c<h;++c){var u=n[c],d=u.split(" "),f=d[d.length-1].toLowerCase();f=="normal"||f=="italic"||f=="oblique"?(o=l?o:f,l=!0,d.pop(),f=d[d.length-1].toLowerCase()):Rw.test(f)&&(f=f.replace(Rw,""),o=l?o:d[d.length-1].replace(f,""),l=!0);for(var g in Sw){var _=d.length>1?d[d.length-2].toLowerCase():"";if(f==g||f==g.replace("-","")||_+"-"+f==g){s=a?s:Sw[g],d.pop(),_&&g.startsWith(_)&&d.pop();break}}!a&&typeof f=="number"&&(s=f,a=!0);var v=d.join(ul).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");v.indexOf(ul)!==-1&&(v='"'+v+'"'),r.push(v)}i=Tw[n]=[o,s,r]}return i[0]+ul+i[1]+ul+e+"px"+(t?"/"+t:"")+ul+i[2]}function Ow(n,[e,t,i,s]){e=e.evaluate(n),t=t.evaluate(n),i=i.evaluate(n);const o=s?s.evaluate(n):1;return Ue.parse(`hsla(${e}, ${t}%, ${i}%, ${o})`)}function SI(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=n[3],o=Math.max(e,t,i),r=Math.min(e,t,i),a=(o+r)/2;let l,c;if(o===r)l=0,c=0;else{const h=o-r;switch(c=a>.5?h/(2-o-r):h/(o+r),o){case e:l=(t-i)/h+(t<i?6:0);break;case t:l=(i-e)/h+2;break;case i:l=(e-t)/h+4;break;default:l=0}l/=6}return[l*360,c*100,a*100,s]}function fu(n){if(Array.isArray(n)){if(n.length===0)return n;const e=n[0];if(e==="literal")return n;if(e==="image"&&n.length===3&&typeof n[2]=="object"&&n[2]!==null&&!Array.isArray(n[2]))return["image-config",fu(n[1]),["literal",n[2]]];const t=n.length;for(let i=1;i<t;++i){const s=n[i],o=fu(s);if(o!==s){const r=[e];for(let a=1;a<i;++a)r.push(n[a]);r.push(o);for(let a=i+1;a<t;++a)r.push(fu(n[a]));return r}}}return n}const Iw={},Oo={zoom:0,distanceFromCenter:0};En.register(ou,{...En.definitions,pitch:[{kind:"number"},[],n=>Oo.pitch||0],"distance-from-center":[{kind:"number"},[],n=>Oo.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(n,[e])=>SI(_c(e.evaluate(n)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],Ow],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],Ow],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(n,[e,t])=>e.evaluate(n)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(n,[e])=>{const t=Iw[e.evaluate(n)];return t===void 0?{}:t}]});const Aw="https://api.mapbox.com";function sg(n){const e="mapbox://";return n.indexOf(e)!==0?"":n.slice(e.length)}function RI(n,e,t){if(typeof n=="string")return[{id:"default",url:Mw(n,e,t)}];for(const i of n)i.url=Mw(i.url,e,t);return n}function Mw(n,e,t){const i=sg(n);if(!i)return decodeURI(new URL(n,t).href);const s="sprites/";if(i.indexOf(s)!==0)throw new Error(`unexpected sprites url: ${n}`);const o=i.slice(s.length);return`${Aw}/styles/v1/${o}/sprite?access_token=${e}`}function Dw(n,e){const t=sg(n);if(!t)return decodeURI(new URL(n,location.href).href);const i="styles/";if(t.indexOf(i)!==0)throw new Error(`unexpected style url: ${n}`);const s=t.slice(i.length);return`${Aw}/styles/v1/${s}?&access_token=${e}`}const TI=["a","b","c","d"];function pu(n,e,t,i){const s=new URL(n,i||location.href),o=sg(n);if(!o)return e?(s.searchParams.has(t)||s.searchParams.set(t,e),[decodeURI(s.href)]):[decodeURI(s.href)];if(o==="mapbox.satellite"){const r=globalThis.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${o}/{z}/{x}/{y}${r}.webp?access_token=${e}`]}return TI.map(r=>`https://${r}.tiles.mapbox.com/v4/${o}/{z}/{x}/{y}.vector.pbf?access_token=${e}`)}const og=Object.freeze({}),Fw={},Lw={};let OI=0;function rg(n){return n.id||(n.id=OI++),n.id}function II(n,e){return rg(n)+"."+Re(e)}function AI(n){let e=Fw[n.id];return e||(e={},Fw[rg(n)]=e),e}function MI(n){let e=Lw[n.id];return e||(e={},Lw[rg(n)]=e),e}function ag(n){return n*Math.PI/180}const lg=(function(){const n=[];for(let e=78271.51696402048;n.length<=24;e/=2)n.push(e);return n})();function gu(n,e){if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof OffscreenCanvas<"u")return new OffscreenCanvas(n,e);const t=document.createElement("canvas");return t.width=n,t.height=e,t}function DI(n,e){let t=0;const i=e.length;for(;t<i;++t)if(e[t]<n&&t+1<i){const o=e[t]/e[t+1];return t+Math.log(e[t]/n)/Math.log(o)}return i-1}function FI(n,e){const t=Math.floor(n),i=Math.pow(2,n-t);return e[t]/i}const kr={};function jr(n,e,t={},i){if(e in kr)return i&&(i.url=kr[e][0].url),kr[e][1];const s=t.transformRequest&&t.transformRequest(e,n)||e,o=function(l){return delete kr[e],Promise.reject(new Error("Error fetching source "+e))},r=function(l){return delete kr[e],l.ok?l.json():Promise.reject(new Error("Error fetching source "+e))},a=$o(()=>s).then(l=>l instanceof Response?(i&&(i.url=l.url),r(l)):(l instanceof Request||(l=new Request(l)),l.headers.get("Accept")||l.headers.set("Accept","application/json"),i&&(i.url=l.url),fetch(l).then(r).catch(o))).catch(o);return kr[e]=[s,a],a}function LI(n,e){if(typeof n=="string")if(n.trim().startsWith("{"))try{const t=JSON.parse(n);return Promise.resolve(t)}catch(t){return Promise.reject(t)}else return n=Dw(n,e.accessToken),jr("Style",n,e);else return Promise.resolve(n)}const zw={};function zI(n,e,t={}){const i=[e,JSON.stringify(n)].toString();let s=zw[i];if(!s||t.transformRequest){let o;t.transformRequest&&(o=(a,l)=>{const c=t.transformRequest&&t.transformRequest(l,"Tiles")||l;if(a instanceof Mi.VectorTile)a.setLoader((h,u,d)=>{const f=function(g){g.arrayBuffer().then(_=>{const E=a.getFormat().readFeatures(_,{extent:h,featureProjection:d});a.setFeatures(E)})};$o(()=>c).then(g=>{if(g instanceof Response)return f(g);fetch(g).then(f).catch(_=>a.setState(oe.ERROR))}).catch(g=>a.setState(oe.ERROR))});else{const h=a.getImage();$o(()=>c).then(u=>{if(typeof u=="string"){h.src=u;return}const d=f=>f.blob().then(g=>{const _=URL.createObjectURL(g);h.addEventListener("load",()=>URL.revokeObjectURL(_)),h.addEventListener("error",()=>URL.revokeObjectURL(_)),h.src=_});if(u instanceof Response)return d(u);fetch(u).then(d).catch(f=>a.setState(oe.ERROR))}).catch(u=>a.setState(oe.ERROR))}});const r=n.url;if(r&&!n.tiles){const a=pu(r,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(r.startsWith("mapbox://"))s=Promise.resolve({tileJson:Object.assign({},n,{url:void 0,tiles:a}),tileLoadFunction:o});else{const l={};s=jr("Source",a[0],t,l).then(function(c){return c.tiles=c.tiles.map(function(h){return c.scheme==="tms"&&(h=h.replace("{y}","{-y}")),pu(h,t.accessToken,t.accessTokenParam||"access_token",l.url)[0]}),Promise.resolve({tileJson:c,tileLoadFunction:o})})}}else n.tiles?(n=Object.assign({},n,{tiles:n.tiles.map(function(a){return n.scheme==="tms"&&(a=a.replace("{y}","{-y}")),pu(a,t.accessToken,t.accessTokenParam||"access_token",e||location.href)[0]})}),s=Promise.resolve({tileJson:Object.assign({},n),tileLoadFunction:o})):s=Promise.reject(new Error("source has no `tiles` nor `url`"));zw[i]=s}return s}function Nw(n,e,t,i){const s=[2*t*e.pixelRatio+e.width,2*t*e.pixelRatio+e.height],o=gu(s[0],s[1]),r=o.getContext("2d");r.drawImage(n,e.x,e.y,e.width,e.height,t*e.pixelRatio,t*e.pixelRatio,e.width,e.height);const a=r.getImageData(0,0,s[0],s[1]);r.globalCompositeOperation="destination-over",r.fillStyle=`rgba(${i.r*255},${i.g*255},${i.b*255},${i.a})`;const l=a.data;for(let c=0,h=a.width;c<h;++c)for(let u=0,d=a.height;u<d;++u){const f=(u*h+c)*4;l[f+3]>0&&r.arc(c,u,t*e.pixelRatio,0,2*Math.PI)}return r.fill(),o}function NI(n,e,t){const i=Math.max(0,Math.min(1,(t-n)/(e-n)));return i*i*(3-2*i)}function kw(n,e,t){const i=gu(e.width,e.height),s=i.getContext("2d");s.drawImage(n,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const o=s.getImageData(0,0,e.width,e.height),r=o.data;for(let a=0,l=o.width;a<l;++a)for(let c=0,h=o.height;c<h;++c){const u=(c*l+a)*4,d=r[u+3]/255,f=.75,g=.1,_=NI(f-g,f+g,d);_>0?(r[u+0]=Math.round(255*t.r*_),r[u+1]=Math.round(255*t.g*_),r[u+2]=Math.round(255*t.b*_),r[u+3]=Math.round(255*_)):r[u+3]=0}return s.putImageData(o,0,0),i}const kI=Array(256).join(" ");function cg(n,e){if(e>=.05){let t="";const i=n.split(`
|
|
159
159
|
`),s=kI.slice(0,Math.round(e/.1));for(let o=0,r=i.length;o<r;++o)o>0&&(t+=`
|
|
160
160
|
`),t+=i[o].split("").join(s);return t}return n}let hg;function jw(){return hg||(hg=gu(1,1).getContext("2d")),hg}function jI(n,e){if(/\d+ \d+/.test(n)){const[t,i]=n.split(" ").map(Number);return t<=e&&e<=i}return n==e}function Io(n,e){return jw().measureText(n).width+(n.length-1)*e}const mu={};lo.on("propertychange",()=>{for(const n in mu)delete mu[n]});function ug(n,e,t,i){if(n.indexOf(`
|
|
161
161
|
`)!==-1){const r=n.split(`
|
|
162
162
|
`),a=[];for(let l=0,c=r.length;l<c;++l)a.push(ug(r[l],e,t,i));return a.join(`
|
|
163
163
|
`)}const s=t+","+e+","+n+","+i;let o=mu[s];if(!o){const r=n.split(" ");if(r.length>1){const a=jw();a.font=e;const c=a.measureText("M").width*t;let h="";const u=[];for(let d=0,f=r.length;d<f;++d){const g=r[d],_=h+(h?" ":"")+g;Io(_,i)<=c?h=_:(h&&u.push(h),h=g)}h&&u.push(h);for(let d=0,f=u.length;d<f&&f>1;++d){const g=u[d];if(Io(g,i)<c*.35){const _=d>0?Io(u[d-1],i):1/0,v=d<f-1?Io(u[d+1],i):1/0;u.splice(d,1),f-=1,_<v?(u[d-1]+=" "+g,d-=1):u[d]=g+" "+u[d]}}for(let d=0,f=u.length-1;d<f;++d){const g=u[d],_=u[d+1];if(Io(g,i)>c*.7&&Io(_,i)<c*.6){const v=g.split(" "),E=v.pop();Io(E,i)<c*.2&&(u[d]=v.join(" "),u[d+1]=E+" "+_),f-=1}}o=u.join(`
|
|
164
|
-
`)}else o=n;o=cg(o,i),mu[s]=o}return o}const UI=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],Uw={};function GI(n,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(ln)return n;let t;for(let i=0,s=n.length;i<s;++i){const o=n[i];if(o in Uw)continue;Uw[o]=!0;const a=ig(o,16).split(" ");t||(t=[]),t.push([a.slice(3).join(" ").replace(/"/g,""),a[1],a[0]])}return t&&(async()=>{await document.fonts.ready;for(let i=0,s=t.length;i<s;++i){const o=t[i],r=o[0];if(UI.includes(r))continue;const a=o[1],l=o[2];if(!(await document.fonts.load(`${l} ${a} 16px "${r}"`)).some(h=>h.family.replace(/^['"]|['"]$/g,"").toLowerCase()===r.toLowerCase()&&jI(h.weight,a)&&h.style===l)){const h=e.replace("{font-family}",r.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",r.replace(/ /g,"+")).replace("{fontweight}",a).replace("{-fontstyle}",l.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",l);if(!document.querySelector('link[href="'+h+'"]')){const u=document.createElement("link");u.href=h,u.rel="stylesheet",document.head.appendChild(u)}}}})(),n}const qI={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},WI={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Gw=function(n,e){let t=_w(n,e);if(t.result==="error"){const i=fu(n);i!==n&&(t=_w(i,e))}if(t.result==="error"){const i=t.value[0];return console.error("Error parsing expression:",n,i.key,i.message),{evaluate:()=>e.default}}return t.value};let yu,dg;function ue(n,e,t,i,s,o){const r=n.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[r]||(s[r]={});const a=s[r];if(!a[t]){let l=(n[e]||og)[t];const c=Pw[`${e}_${n.type}`]&&Pw[`${e}_${n.type}`][t];l===void 0&&c&&(l=c.default);let h=lu(l);if(!h&&au(l)&&(l=Cw(l,c),h=!0),h){const u=Gw(l,c);a[t]=u.evaluate.bind(u)}else{const u=c?c.type:typeof l;(u==="color"||u==="colorArray")&&(l=Ue.parse(l));let d=!1;if(u==="array")for(let f=0;f<l.length;++f){const g=l[f];if(lu(g)||au(g)){d=!0;break}}if(d){const f=Object.assign({},c,{type:c.value}),g=[];for(let _=0;_<l.length;++_){let v=l[_];if(!lu(v)&&au(v)&&(v=Cw(v,f)),lu(v)){const E=Gw(v,f);g.push(E.evaluate.bind(E))}else g.push(function(){return v})}a[t]=function(_,v,E){const w=[];for(let C=0;C<g.length;++C)w[C]=g[C](_,v,E);return w}}else a[t]=function(){return l}}}return a[t](Oo,i,o)}function qw(n,e,t,i){return ue(n,"layout",`${t}-allow-overlap`,e,i)?ue(n,"layout",`${t}-ignore-placement`,e,i)?"none":"obstacle":"declutter"}function VI(n,e,t,i){if(i||console.warn("No filterCache provided to evaluateFilter()"),!(n in i))try{i[n]=_I(e).filter}catch(s){console.warn("Filter will evaluate to false: "+s.message),i[n]=function(){return!1}}return i[n](Oo,t)}function Ao(n,e){if(n){if(n.a===0||e===0)return;const t=n.a;return e=e===void 0?1:e,t===0?"transparent":"rgba("+Math.round(n.r*255/t)+","+Math.round(n.g*255/t)+","+Math.round(n.b*255/t)+","+t*e+")"}return n}const $I=/\{[^{}}]*\}/g;function fg(n,e){return n.replace($I,function(t){return e[t.slice(1,-1)]||""})}function Ww(n,e){let t=n.split(":")[0];return t===n&&(t="default"),e[t]}const BI={};function HI(n,e,t,i=lg,s=void 0,o=void 0,r=void 0,a=void 0){if(typeof e=="string"&&(e=JSON.parse(e)),e.schema)for(const C in e.schema){const P=e.schema[C];"default"in P&&(Iw[C]=P.default)}if(e.version!=8)throw new Error("glStyle version 8 required.");BI[II(e,n)]=Array.from(arguments);const l={};(typeof o=="string"||o instanceof Request||o instanceof Response||o instanceof Promise)&&(o={default:o});for(const C in o){const P=o[C];$o(()=>P).then(async R=>{let A;if(typeof Image<"u"){const I=new Image;if(typeof R=="string")I.crossOrigin="anonymous",I.src=R;else{let M;R instanceof Request?M=await fetch(R):R instanceof Response&&(M=R);const z=await M.blob();A=URL.createObjectURL(z),I.src=A}I.addEventListener("load",function M(){I.removeEventListener("load",M),l[C]={image:I,size:[I.width,I.height]},n.changed(),A&&URL.revokeObjectURL(A)}),I.addEventListener("error",function M(){URL.revokeObjectURL(A),I.removeEventListener("error",M)})}else if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope){const I=self;I.postMessage({action:"loadImage",src:R}),I.addEventListener("message",function(z){z.data.action==="imageLoaded"&&z.data.src===R&&(l[C]={image:z.data.image,size:[z.data.image.width,z.data.image.height]})})}})}const c=n2(e.layers),h={},u=[],d={},f={},g=AI(e),_=MI(e);let v;for(let C=0,P=c.length;C<P;++C){const R=c[C],A=R.id;if(typeof t=="string"&&R.source==t||Array.isArray(t)&&t.indexOf(A)!==-1){const I=R["source-layer"];if(v){if(R.source!==v)throw new Error(`Layer "${A}" does not use source "${v}`)}else{v=R.source;const z=e.sources[v];if(!z)throw new Error(`Source "${v}" is not defined`);const k=z.type;if(k!=="vector"&&k!=="geojson")throw new Error(`Source "${v}" is not of type "vector" or "geojson", but "${k}"`)}let M=h[I];M||(M=[],h[I]=M),M.push({layer:R,index:C}),u.push(A)}}const E=[],w=function(C,P,R){var L,N,j;const A=((j=(N=(L=n.getSource)==null?void 0:L.call(n))==null?void 0:N.format_)==null?void 0:j.layerName_)??"mvt:layer",I=C.getProperties(),M=h[I[A]];if(!M)return;let z=i.indexOf(P);z==-1&&(z=DI(P,i)),Oo.zoom=z,Oo.distanceFromCenter=0;const k=C.getGeometry(),q=qI[k.getType()],Y=n.get("map");if(Y&&Y instanceof my&&q===1){const U=Y.getSize();if(U){const B=Y.getView().getCenter(),Z=xn(k.getExtent());Oo.distanceFromCenter=kv(B,Z)/P/U[1]}}const m={id:C.getId(),properties:I,type:q},b=n.get("mapbox-featurestate")[C.getId()];let S=-1;for(let U=0,B=M.length;U<B;++U){const Z=M[U],G=Z.layer,ae=G.id;if(R!==void 0&&R!==ae)continue;const ne=G.layout||og,V=G.paint||og;if(ue(G,"layout","visibility",m,g,b)==="none"||"minzoom"in G&&z<G.minzoom||"maxzoom"in G&&z>=G.maxzoom)continue;const se=G.filter;if(!se||VI(ae,se,m,_)){let he,ye,pe,Fe,je,ee;const ft=Z.index;if(q==3&&(G.type=="fill"||G.type=="fill-extrusion")){if(ye=ue(G,"paint",G.type+"-opacity",m,g,b),G.type+"-pattern"in V){const Ve=ue(G,"paint",G.type+"-pattern",m,g,b);if(Ve){const Ge=typeof Ve=="string"?fg(Ve,I):Ve.toString(),Le=Ww(Ge,l);if(s&&s[Ge]&&Le){++S,ee=E[S],(!ee||!ee.getFill()||ee.getStroke()||ee.getText())&&(ee=new Xe({fill:new wt}),E[S]=ee),pe=ee.getFill(),ee.setZIndex(ft);const de=Ge+"."+ye;let Qe=f[de];if(!Qe){const Pe=s[Ge],Se=gu(Pe.width,Pe.height),He=Se.getContext("2d");He.globalAlpha=ye,He.drawImage(Le.image,Pe.x,Pe.y,Pe.width,Pe.height,0,0,Pe.width,Pe.height),Qe=He.createPattern(Se,"repeat"),f[de]=Qe}pe.setColor(Qe)}}}else if(he=Ao(ue(G,"paint",G.type+"-color",m,g,b),ye),G.type+"-outline-color"in V&&(je=Ao(ue(G,"paint",G.type+"-outline-color",m,g,b),ye)),je||(je=he),he||je){if(++S,ee=E[S],(!ee||he&&!ee.getFill()||!he&&ee.getFill()||je&&!ee.getStroke()||!je&&ee.getStroke()||ee.getText())&&(ee=new Xe({fill:he?new wt:void 0,stroke:je?new St:void 0}),E[S]=ee),he&&(pe=ee.getFill(),pe.setColor(he)),G.type==="fill-extrusion"){const Ve=ue(G,"paint","fill-extrusion-height",m,g,b);if(Ve>0){const Ge=Math.max(.1,.9-Math.min(Ve,225)/280);if(je&&je!=="transparent"){const Le=Ue.parse(je);je=`rgba(${Math.round(Le.r*255*Ge)},${Math.round(Le.g*255*Ge)},${Math.round(Le.b*255*Ge)},${Le.a})`}}}je&&(Fe=ee.getStroke(),Fe.setColor(je),Fe.setWidth(.5)),ee.setZIndex(ft)}}if(q!=1&&G.type=="line"){"line-pattern"in V?he=void 0:he=Ao(ue(G,"paint","line-color",m,g,b),ue(G,"paint","line-opacity",m,g,b));const Ve=ue(G,"paint","line-width",m,g,b);he&&Ve>0&&(++S,ee=E[S],(!ee||!ee.getStroke()||ee.getFill()||ee.getText())&&(ee=new Xe({stroke:new St}),E[S]=ee),Fe=ee.getStroke(),Fe.setLineCap(ue(G,"layout","line-cap",m,g,b)),Fe.setLineJoin(ue(G,"layout","line-join",m,g,b)),Fe.setMiterLimit(ue(G,"layout","line-miter-limit",m,g,b)),Fe.setColor(he),Fe.setWidth(Ve),Fe.setLineDash(V["line-dasharray"]?ue(G,"paint","line-dasharray",m,g,b).map(function(Ge){return Ge*Ve}):null),Fe.setOffset(ue(G,"paint","line-offset",m,g,b)),ee.setZIndex(ft))}let rt=!1,_e=null,tn=0,Ut,yt,At;if((q==1||q==2)&&"icon-image"in ne){const Ve=ue(G,"layout","icon-image",m,g,b);if(Ve){Ut=typeof Ve=="string"?fg(Ve,I):Ve.toString();let Ge;const Le=a?a(n,Ut):void 0,de=Ww(Ut,l);if(s&&s[Ut]&&de||Le){const Qe=ue(G,"layout","icon-rotation-alignment",m,g,b);if(q==2){const Pe=C.getGeometry();if(Pe.getFlatMidpoint||Pe.getFlatMidpoints){const Se=Pe.getExtent();if(Math.sqrt(Math.max(Math.pow((Se[2]-Se[0])/P,2),Math.pow((Se[3]-Se[1])/P,2)))>150){const Et=Pe.getType()==="MultiLineString"?Pe.getFlatMidpoints():Pe.getFlatMidpoint();if(dg||(yu=[NaN,NaN],dg=new Vt("Point",yu,[],2,{},void 0)),Ge=dg,yu[0]=Et[0],yu[1]=Et[1],ue(G,"layout","symbol-placement",m,g,b)==="line"&&Qe==="map"){const Gt=Pe.getStride(),at=Pe.getFlatCoordinates();for(let Mt=0,it=at.length-Gt;Mt<it;Mt+=Gt){const qt=at[Mt],Lt=at[Mt+1],Pt=at[Mt+Gt],tt=at[Mt+Gt+1],Ot=Math.min(qt,Pt),Ii=Math.max(qt,Pt),qn=Et[0],pn=Et[1],as=(tt-Lt)*(qn-qt)-(Pt-qt)*(pn-Lt);if(Math.abs(as)<.001&&qn<=Ii&&qn>=Ot){tn=Math.atan2(Lt-tt,Pt-qt);break}}}}}}if(q!==2||Ge){const Pe=ue(G,"layout","icon-size",m,g,b),Se=V["icon-color"]!==void 0?ue(G,"paint","icon-color",m,g,b):null;if(!Se||Se.a!==0){const He=ue(G,"paint","icon-halo-color",m,g,b),Et=ue(G,"paint","icon-halo-width",m,g,b);let nn=`${Ut}.${Pe}.${Et}.${He}`;if(Se!==null&&(nn+=`.${Se}`),yt=d[nn],!yt){const Gt=qw(G,m,"icon",g);let at;"icon-offset"in ne&&(at=ue(G,"layout","icon-offset",m,g,b).slice(0),at[0]*=Pe,at[1]*=-Pe);let Mt=Se?[Se.r*255,Se.g*255,Se.b*255,Se.a]:void 0;if(Le){const it={color:Mt,rotateWithView:Qe==="map",displacement:at,declutterMode:Gt,scale:Pe};typeof Le=="string"?it.src=Le:(it.img=Le,it.imgSize=[Le.width,Le.height]),yt=new Es(it)}else{const it=s[Ut];let qt,Lt,Pt;if(Et)it.sdf?(qt=Nw(kw(de.image,it,Se||[0,0,0,1]),{x:0,y:0,width:it.width,height:it.height,pixelRatio:it.pixelRatio},Et,He),Mt=void 0):qt=Nw(de.image,it,Et,He);else{if(it.sdf&&!de.unSDFed){const tt=kw(de.image,{x:0,y:0,width:de.size[0],height:de.size[1]},{r:1,g:1,b:1});de.image=tt,de.unSDFed=!0}qt=de.image,Lt=[it.width,it.height],Pt=[it.x,it.y]}yt=new Es({color:Mt,img:qt,imgSize:de.size,size:Lt,offset:Pt,rotateWithView:Qe==="map",scale:Pe/it.pixelRatio,displacement:at,declutterMode:Gt})}d[nn]=yt}}yt&&(++S,ee=E[S],(!ee||!ee.getImage()||ee.getFill()||ee.getStroke())&&(ee=new Xe,E[S]=ee),ee.setGeometry(Ge),yt.setRotation(tn+ag(ue(G,"layout","icon-rotate",m,g,b))),yt.setOpacity(ue(G,"paint","icon-opacity",m,g,b)),yt.setAnchor(WI[ue(G,"layout","icon-anchor",m,g,b)]),ee.setImage(yt),_e=ee.getText(),ee.setText(void 0),ee.setZIndex(ft),rt=!0,At=!1)}else At=!0}}}if(q==1&&G.type==="circle"){++S,ee=E[S],(!ee||!ee.getImage()||ee.getFill()||ee.getStroke())&&(ee=new Xe,E[S]=ee);const Ve="circle-radius"in V?ue(G,"paint","circle-radius",m,g,b):5,Ge=Ao(ue(G,"paint","circle-stroke-color",m,g,b),ue(G,"paint","circle-stroke-opacity",m,g,b)),Le=ue(G,"paint","circle-translate",m,g,b),de=Ao(ue(G,"paint","circle-color",m,g,b),ue(G,"paint","circle-opacity",m,g,b)),Qe=ue(G,"paint","circle-stroke-width",m,g,b),Pe=Ve+"."+Ge+"."+de+"."+Qe+"."+Le[0]+"."+Le[1];yt=d[Pe],yt||(yt=new An({radius:Ve,displacement:[Le[0],-Le[1]],stroke:Ge&&Qe>0?new St({width:Qe,color:Ge}):void 0,fill:de?new wt({color:de}):void 0,declutterMode:"none"}),d[Pe]=yt),ee.setImage(yt),_e=ee.getText(),ee.setText(void 0),ee.setGeometry(void 0),ee.setZIndex(ft),rt=!0}let et,jn,nt,Un,Gn,ai;if("text-field"in ne){Un=Math.round(ue(G,"layout","text-size",m,g,b));const Ve=ue(G,"layout","text-font",m,g,b);nt=ue(G,"layout","text-line-height",m,g,b),jn=ig(r?r(Ve,e.metadata?e.metadata["ol:webfonts"]:void 0):Ve,Un,nt),jn.includes("sans-serif")||(jn+=",sans-serif"),Gn=ue(G,"layout","text-letter-spacing",m,g,b),ai=ue(G,"layout","text-max-width",m,g,b);const Ge=ue(G,"layout","text-field",m,g,b);typeof Ge=="object"&&Ge.sections?Ge.sections.length===1?et=Ge.toString():et=Ge.sections.reduce((Le,de,Qe)=>{const Pe=de.fontStack?de.fontStack.split(","):Ve,Se=ig(r?r(Pe):Pe,Un*(de.scale||1),nt);let He=de.text;if(He===`
|
|
164
|
+
`)}else o=n;o=cg(o,i),mu[s]=o}return o}const UI=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],Uw={};function GI(n,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(ln)return n;let t;for(let i=0,s=n.length;i<s;++i){const o=n[i];if(o in Uw)continue;Uw[o]=!0;const a=ig(o,16).split(" ");t||(t=[]),t.push([a.slice(3).join(" ").replace(/"/g,""),a[1],a[0]])}return t&&(async()=>{await document.fonts.ready;for(let i=0,s=t.length;i<s;++i){const o=t[i],r=o[0];if(UI.includes(r))continue;const a=o[1],l=o[2];if(!(await document.fonts.load(`${l} ${a} 16px "${r}"`)).some(h=>h.family.replace(/^['"]|['"]$/g,"").toLowerCase()===r.toLowerCase()&&jI(h.weight,a)&&h.style===l)){const h=e.replace("{font-family}",r.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",r.replace(/ /g,"+")).replace("{fontweight}",a).replace("{-fontstyle}",l.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",l);if(!document.querySelector('link[href="'+h+'"]')){const u=document.createElement("link");u.href=h,u.rel="stylesheet",document.head.appendChild(u)}}}})(),n}const qI={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},WI={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Gw=function(n,e){let t=_w(n,e);if(t.result==="error"){const i=fu(n);i!==n&&(t=_w(i,e))}if(t.result==="error"){const i=t.value[0];return console.error("Error parsing expression:",n,i.key,i.message),{evaluate:()=>e.default}}return t.value};let yu,dg;function ue(n,e,t,i,s,o){const r=n.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[r]||(s[r]={});const a=s[r];if(!a[t]){let l=(n[e]||og)[t];const c=Pw[`${e}_${n.type}`]&&Pw[`${e}_${n.type}`][t];l===void 0&&c&&(l=c.default);let h=lu(l);if(!h&&au(l)&&(l=Cw(l,c),h=!0),h){const u=Gw(l,c);a[t]=u.evaluate.bind(u)}else{const u=c?c.type:typeof l;(u==="color"||u==="colorArray")&&(l=Ue.parse(l));let d=!1;if(u==="array")for(let f=0;f<l.length;++f){const g=l[f];if(lu(g)||au(g)){d=!0;break}}if(d){const f=Object.assign({},c,{type:c.value}),g=[];for(let _=0;_<l.length;++_){let v=l[_];if(!lu(v)&&au(v)&&(v=Cw(v,f)),lu(v)){const E=Gw(v,f);g.push(E.evaluate.bind(E))}else g.push(function(){return v})}a[t]=function(_,v,E){const w=[];for(let C=0;C<g.length;++C)w[C]=g[C](_,v,E);return w}}else a[t]=function(){return l}}}return a[t](Oo,i,o)}function qw(n,e,t,i){return ue(n,"layout",`${t}-allow-overlap`,e,i)?ue(n,"layout",`${t}-ignore-placement`,e,i)?"none":"obstacle":"declutter"}function VI(n,e,t,i){if(i||console.warn("No filterCache provided to evaluateFilter()"),!(n in i))try{i[n]=_I(e).filter}catch(s){console.warn("Filter will evaluate to false: "+s.message),i[n]=function(){return!1}}return i[n](Oo,t)}function Ao(n,e){if(n){if(n.a===0||e===0)return;const t=n.a;return e=e===void 0?1:e,t===0?"transparent":"rgba("+Math.round(n.r*255/t)+","+Math.round(n.g*255/t)+","+Math.round(n.b*255/t)+","+t*e+")"}return n}const $I=/\{[^{}}]*\}/g;function fg(n,e){return n.replace($I,function(t){return e[t.slice(1,-1)]||""})}function Ww(n,e){let t=n.split(":")[0];return t===n&&(t="default"),e[t]}const BI={};function HI(n,e,t,i=lg,s=void 0,o=void 0,r=void 0,a=void 0){if(typeof e=="string"&&(e=JSON.parse(e)),e.schema)for(const C in e.schema){const P=e.schema[C];"default"in P&&(Iw[C]=P.default)}if(e.version!=8)throw new Error("glStyle version 8 required.");BI[II(e,n)]=Array.from(arguments);const l={};(typeof o=="string"||o instanceof Request||o instanceof Response||o instanceof Promise)&&(o={default:o});for(const C in o){const P=o[C];$o(()=>P).then(async R=>{let A;if(typeof Image<"u"){const I=new Image;if(typeof R=="string")I.crossOrigin="anonymous",I.src=R;else{let M;R instanceof Request?M=await fetch(R):R instanceof Response&&(M=R);const z=await M.blob();A=URL.createObjectURL(z),I.src=A}I.addEventListener("load",function M(){I.removeEventListener("load",M),l[C]={image:I,size:[I.width,I.height]},n.changed(),A&&URL.revokeObjectURL(A)}),I.addEventListener("error",function M(){URL.revokeObjectURL(A),I.removeEventListener("error",M)})}else if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope){const I=self;I.postMessage({action:"loadImage",src:R}),I.addEventListener("message",function(z){z.data.action==="imageLoaded"&&z.data.src===R&&(l[C]={image:z.data.image,size:[z.data.image.width,z.data.image.height]})})}})}const c=nO(e.layers),h={},u=[],d={},f={},g=AI(e),_=MI(e);let v;for(let C=0,P=c.length;C<P;++C){const R=c[C],A=R.id;if(typeof t=="string"&&R.source==t||Array.isArray(t)&&t.indexOf(A)!==-1){const I=R["source-layer"];if(v){if(R.source!==v)throw new Error(`Layer "${A}" does not use source "${v}`)}else{v=R.source;const z=e.sources[v];if(!z)throw new Error(`Source "${v}" is not defined`);const k=z.type;if(k!=="vector"&&k!=="geojson")throw new Error(`Source "${v}" is not of type "vector" or "geojson", but "${k}"`)}let M=h[I];M||(M=[],h[I]=M),M.push({layer:R,index:C}),u.push(A)}}const E=[],w=function(C,P,R){var L,N,j;const A=((j=(N=(L=n.getSource)==null?void 0:L.call(n))==null?void 0:N.format_)==null?void 0:j.layerName_)??"mvt:layer",I=C.getProperties(),M=h[I[A]];if(!M)return;let z=i.indexOf(P);z==-1&&(z=DI(P,i)),Oo.zoom=z,Oo.distanceFromCenter=0;const k=C.getGeometry(),q=qI[k.getType()],Y=n.get("map");if(Y&&Y instanceof my&&q===1){const U=Y.getSize();if(U){const B=Y.getView().getCenter(),Z=xn(k.getExtent());Oo.distanceFromCenter=kv(B,Z)/P/U[1]}}const m={id:C.getId(),properties:I,type:q},b=n.get("mapbox-featurestate")[C.getId()];let S=-1;for(let U=0,B=M.length;U<B;++U){const Z=M[U],G=Z.layer,ae=G.id;if(R!==void 0&&R!==ae)continue;const ne=G.layout||og,V=G.paint||og;if(ue(G,"layout","visibility",m,g,b)==="none"||"minzoom"in G&&z<G.minzoom||"maxzoom"in G&&z>=G.maxzoom)continue;const se=G.filter;if(!se||VI(ae,se,m,_)){let he,ye,pe,Fe,je,ee;const ft=Z.index;if(q==3&&(G.type=="fill"||G.type=="fill-extrusion")){if(ye=ue(G,"paint",G.type+"-opacity",m,g,b),G.type+"-pattern"in V){const Ve=ue(G,"paint",G.type+"-pattern",m,g,b);if(Ve){const Ge=typeof Ve=="string"?fg(Ve,I):Ve.toString(),Le=Ww(Ge,l);if(s&&s[Ge]&&Le){++S,ee=E[S],(!ee||!ee.getFill()||ee.getStroke()||ee.getText())&&(ee=new Xe({fill:new wt}),E[S]=ee),pe=ee.getFill(),ee.setZIndex(ft);const de=Ge+"."+ye;let Qe=f[de];if(!Qe){const Pe=s[Ge],Se=gu(Pe.width,Pe.height),He=Se.getContext("2d");He.globalAlpha=ye,He.drawImage(Le.image,Pe.x,Pe.y,Pe.width,Pe.height,0,0,Pe.width,Pe.height),Qe=He.createPattern(Se,"repeat"),f[de]=Qe}pe.setColor(Qe)}}}else if(he=Ao(ue(G,"paint",G.type+"-color",m,g,b),ye),G.type+"-outline-color"in V&&(je=Ao(ue(G,"paint",G.type+"-outline-color",m,g,b),ye)),je||(je=he),he||je){if(++S,ee=E[S],(!ee||he&&!ee.getFill()||!he&&ee.getFill()||je&&!ee.getStroke()||!je&&ee.getStroke()||ee.getText())&&(ee=new Xe({fill:he?new wt:void 0,stroke:je?new St:void 0}),E[S]=ee),he&&(pe=ee.getFill(),pe.setColor(he)),G.type==="fill-extrusion"){const Ve=ue(G,"paint","fill-extrusion-height",m,g,b);if(Ve>0){const Ge=Math.max(.1,.9-Math.min(Ve,225)/280);if(je&&je!=="transparent"){const Le=Ue.parse(je);je=`rgba(${Math.round(Le.r*255*Ge)},${Math.round(Le.g*255*Ge)},${Math.round(Le.b*255*Ge)},${Le.a})`}}}je&&(Fe=ee.getStroke(),Fe.setColor(je),Fe.setWidth(.5)),ee.setZIndex(ft)}}if(q!=1&&G.type=="line"){"line-pattern"in V?he=void 0:he=Ao(ue(G,"paint","line-color",m,g,b),ue(G,"paint","line-opacity",m,g,b));const Ve=ue(G,"paint","line-width",m,g,b);he&&Ve>0&&(++S,ee=E[S],(!ee||!ee.getStroke()||ee.getFill()||ee.getText())&&(ee=new Xe({stroke:new St}),E[S]=ee),Fe=ee.getStroke(),Fe.setLineCap(ue(G,"layout","line-cap",m,g,b)),Fe.setLineJoin(ue(G,"layout","line-join",m,g,b)),Fe.setMiterLimit(ue(G,"layout","line-miter-limit",m,g,b)),Fe.setColor(he),Fe.setWidth(Ve),Fe.setLineDash(V["line-dasharray"]?ue(G,"paint","line-dasharray",m,g,b).map(function(Ge){return Ge*Ve}):null),Fe.setOffset(ue(G,"paint","line-offset",m,g,b)),ee.setZIndex(ft))}let rt=!1,_e=null,tn=0,Ut,yt,At;if((q==1||q==2)&&"icon-image"in ne){const Ve=ue(G,"layout","icon-image",m,g,b);if(Ve){Ut=typeof Ve=="string"?fg(Ve,I):Ve.toString();let Ge;const Le=a?a(n,Ut):void 0,de=Ww(Ut,l);if(s&&s[Ut]&&de||Le){const Qe=ue(G,"layout","icon-rotation-alignment",m,g,b);if(q==2){const Pe=C.getGeometry();if(Pe.getFlatMidpoint||Pe.getFlatMidpoints){const Se=Pe.getExtent();if(Math.sqrt(Math.max(Math.pow((Se[2]-Se[0])/P,2),Math.pow((Se[3]-Se[1])/P,2)))>150){const Et=Pe.getType()==="MultiLineString"?Pe.getFlatMidpoints():Pe.getFlatMidpoint();if(dg||(yu=[NaN,NaN],dg=new Vt("Point",yu,[],2,{},void 0)),Ge=dg,yu[0]=Et[0],yu[1]=Et[1],ue(G,"layout","symbol-placement",m,g,b)==="line"&&Qe==="map"){const Gt=Pe.getStride(),at=Pe.getFlatCoordinates();for(let Mt=0,it=at.length-Gt;Mt<it;Mt+=Gt){const qt=at[Mt],Lt=at[Mt+1],Pt=at[Mt+Gt],tt=at[Mt+Gt+1],Ot=Math.min(qt,Pt),Ii=Math.max(qt,Pt),qn=Et[0],pn=Et[1],as=(tt-Lt)*(qn-qt)-(Pt-qt)*(pn-Lt);if(Math.abs(as)<.001&&qn<=Ii&&qn>=Ot){tn=Math.atan2(Lt-tt,Pt-qt);break}}}}}}if(q!==2||Ge){const Pe=ue(G,"layout","icon-size",m,g,b),Se=V["icon-color"]!==void 0?ue(G,"paint","icon-color",m,g,b):null;if(!Se||Se.a!==0){const He=ue(G,"paint","icon-halo-color",m,g,b),Et=ue(G,"paint","icon-halo-width",m,g,b);let nn=`${Ut}.${Pe}.${Et}.${He}`;if(Se!==null&&(nn+=`.${Se}`),yt=d[nn],!yt){const Gt=qw(G,m,"icon",g);let at;"icon-offset"in ne&&(at=ue(G,"layout","icon-offset",m,g,b).slice(0),at[0]*=Pe,at[1]*=-Pe);let Mt=Se?[Se.r*255,Se.g*255,Se.b*255,Se.a]:void 0;if(Le){const it={color:Mt,rotateWithView:Qe==="map",displacement:at,declutterMode:Gt,scale:Pe};typeof Le=="string"?it.src=Le:(it.img=Le,it.imgSize=[Le.width,Le.height]),yt=new Es(it)}else{const it=s[Ut];let qt,Lt,Pt;if(Et)it.sdf?(qt=Nw(kw(de.image,it,Se||[0,0,0,1]),{x:0,y:0,width:it.width,height:it.height,pixelRatio:it.pixelRatio},Et,He),Mt=void 0):qt=Nw(de.image,it,Et,He);else{if(it.sdf&&!de.unSDFed){const tt=kw(de.image,{x:0,y:0,width:de.size[0],height:de.size[1]},{r:1,g:1,b:1});de.image=tt,de.unSDFed=!0}qt=de.image,Lt=[it.width,it.height],Pt=[it.x,it.y]}yt=new Es({color:Mt,img:qt,imgSize:de.size,size:Lt,offset:Pt,rotateWithView:Qe==="map",scale:Pe/it.pixelRatio,displacement:at,declutterMode:Gt})}d[nn]=yt}}yt&&(++S,ee=E[S],(!ee||!ee.getImage()||ee.getFill()||ee.getStroke())&&(ee=new Xe,E[S]=ee),ee.setGeometry(Ge),yt.setRotation(tn+ag(ue(G,"layout","icon-rotate",m,g,b))),yt.setOpacity(ue(G,"paint","icon-opacity",m,g,b)),yt.setAnchor(WI[ue(G,"layout","icon-anchor",m,g,b)]),ee.setImage(yt),_e=ee.getText(),ee.setText(void 0),ee.setZIndex(ft),rt=!0,At=!1)}else At=!0}}}if(q==1&&G.type==="circle"){++S,ee=E[S],(!ee||!ee.getImage()||ee.getFill()||ee.getStroke())&&(ee=new Xe,E[S]=ee);const Ve="circle-radius"in V?ue(G,"paint","circle-radius",m,g,b):5,Ge=Ao(ue(G,"paint","circle-stroke-color",m,g,b),ue(G,"paint","circle-stroke-opacity",m,g,b)),Le=ue(G,"paint","circle-translate",m,g,b),de=Ao(ue(G,"paint","circle-color",m,g,b),ue(G,"paint","circle-opacity",m,g,b)),Qe=ue(G,"paint","circle-stroke-width",m,g,b),Pe=Ve+"."+Ge+"."+de+"."+Qe+"."+Le[0]+"."+Le[1];yt=d[Pe],yt||(yt=new An({radius:Ve,displacement:[Le[0],-Le[1]],stroke:Ge&&Qe>0?new St({width:Qe,color:Ge}):void 0,fill:de?new wt({color:de}):void 0,declutterMode:"none"}),d[Pe]=yt),ee.setImage(yt),_e=ee.getText(),ee.setText(void 0),ee.setGeometry(void 0),ee.setZIndex(ft),rt=!0}let et,jn,nt,Un,Gn,ai;if("text-field"in ne){Un=Math.round(ue(G,"layout","text-size",m,g,b));const Ve=ue(G,"layout","text-font",m,g,b);nt=ue(G,"layout","text-line-height",m,g,b),jn=ig(r?r(Ve,e.metadata?e.metadata["ol:webfonts"]:void 0):Ve,Un,nt),jn.includes("sans-serif")||(jn+=",sans-serif"),Gn=ue(G,"layout","text-letter-spacing",m,g,b),ai=ue(G,"layout","text-max-width",m,g,b);const Ge=ue(G,"layout","text-field",m,g,b);typeof Ge=="object"&&Ge.sections?Ge.sections.length===1?et=Ge.toString():et=Ge.sections.reduce((Le,de,Qe)=>{const Pe=de.fontStack?de.fontStack.split(","):Ve,Se=ig(r?r(Pe):Pe,Un*(de.scale||1),nt);let He=de.text;if(He===`
|
|
165
165
|
`)return Le.push(`
|
|
166
166
|
`,""),Le;if(q==2)return Le.push(cg(He,Gn),Se),Le;He=ug(He,Se,ai,Gn).split(`
|
|
167
167
|
`);for(let Et=0,nn=He.length;Et<nn;++Et)Et>0&&Le.push(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "earthsdk3-ol",
|
|
3
|
-
"version": "3.11.0
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"ol-mapbox-style": "^13.4.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"earthsdk3": "3.11.0
|
|
44
|
+
"earthsdk3": "3.11.0",
|
|
45
45
|
"ol": "^10.8.0"
|
|
46
46
|
},
|
|
47
47
|
"module": "./dist/earthsdk3-ol.js",
|