earthsdk3-ol 3.11.2-beta.2 → 3.11.2

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
- (function(W,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("earthsdk3"),require("ol")):typeof define=="function"&&define.amd?define(["exports","earthsdk3","ol"],p):(W=typeof globalThis<"u"?globalThis:W||self,p(W.EarthSDK3_OL={},W.EarthSDK3,W.ol))})(this,(function(W,p,zi){"use strict";var $A=Object.defineProperty;var HA=(W,p,zi)=>p in W?$A(W,p,{enumerable:!0,configurable:!0,writable:!0,value:zi}):W[p]=zi;var T=(W,p,zi)=>HA(W,typeof p!="symbol"?p+"":p,zi);var Vo=typeof document<"u"?document.currentScript:null;W.copyright=void 0;try{const i="earthsdk3-ol",e="3.11.2-beta.2",t="2026-11-03T06:26:48.000Z",n="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="624a8088466920043ff83b4a45db5cc4ce4bb382",a=((Date.now()-1793687208e3)/36e5).toFixed(1),l=`%c🌏 ${i}%c ${e}.${o.slice(0,8)}.${t} (距今${a}个小时)
1
+ (function(W,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("earthsdk3"),require("ol")):typeof define=="function"&&define.amd?define(["exports","earthsdk3","ol"],p):(W=typeof globalThis<"u"?globalThis:W||self,p(W.EarthSDK3_OL={},W.EarthSDK3,W.ol))})(this,(function(W,p,zi){"use strict";var $A=Object.defineProperty;var HA=(W,p,zi)=>p in W?$A(W,p,{enumerable:!0,configurable:!0,writable:!0,value:zi}):W[p]=zi;var T=(W,p,zi)=>HA(W,typeof p!="symbol"?p+"":p,zi);var Vo=typeof document<"u"?document.currentScript:null;W.copyright=void 0;try{const i="earthsdk3-ol",e="3.11.2",t="2026-11-19T02:49:00.000Z",n="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="85a271ae6f134f92b7b9b9dd7bec4bfd3ffbcfc0",a=((Date.now()-179505654e4)/36e5).toFixed(1),l=`%c🌏 ${i}%c ${e}.${o.slice(0,8)}.${t} (距今${a}个小时)
2
2
  %c${s?s+`
3
3
  `:""}当前网站正在使用${i},此软件版权归${n}所有
4
- `;W.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","624a8088466920043ff83b4a45db5cc4ce4bb382")},get info(){return l},get date(){return"2026-11-03T06:26:48.000Z"},get author(){return"suplyang"},get version(){return"3.11.2-beta.2"},get name(){return"earthsdk3-ol"},get commitId(){return"624a8088466920043ff83b4a45db5cc4ce4bb382"},print(c=!1){!c&&globalThis._xe2_no_copy_print||console.info(this.info,`
4
+ `;W.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","85a271ae6f134f92b7b9b9dd7bec4bfd3ffbcfc0")},get info(){return l},get date(){return"2026-11-19T02:49:00.000Z"},get author(){return"suplyang"},get version(){return"3.11.2"},get name(){return"earthsdk3-ol"},get commitId(){return"85a271ae6f134f92b7b9b9dd7bec4bfd3ffbcfc0"},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,17 +155,17 @@ ${i1}
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,n){(this.allowPicking??!1)&&this.pickedEvent.emit(new p.ESJPickedResult({element:t,...n}))}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}}T(jt,"defaultOLInstanceClassStr",Jf),T(jt,"olInstanceClassStrReadMe",n1),T(jt,"defaults",{position:[116.39,39.9,0],instanceClassStr:Jf,instanceClassStrReadMe:n1,innerHTML:i1,innerHTMLReadMe:KR,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(i=>{i.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})})(jt||(jt={})),p.extendClassProps(jt.prototype,jt.createDefaultProps);class QR extends p.Destroyable{constructor(e,t,n){super(),this._container=e}}const Pu=class Pu extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_divEvent",this.disposeVar(new p.Event));T(this,"_divCreatedEvent",this.disposeVar(new p.Event));T(this,"_divToDestroyEvent",this.disposeVar(new p.Event));T(this,"_pc",this.disposeVar(new p.PointerClick));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_customDivPoi");this._customDivPoi=this.disposeVar(new jt(t,n));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 QR{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??Pu.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}};T(Pu,"defaults",{width:80,height:28,text:"请输入文字",borderStyle:"solid",fontFamily:"",viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1],zOrder:0});let Us=Pu;(i=>{i.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})})(Us||(Us={})),p.extendClassProps(Us.prototype,Us.createDefaultProps);class s1 extends p.Destroyable{constructor(t){super();T(this,"_enabled",this.disposeVar(p.react(!1)));T(this,"_cursorPosition",p.react(void 0));T(this,"quickPickPosition",!0);let n=new p.Destroyable;const s=()=>{n&&(n.destroy(),n=void 0)};this.dispose(s);const o=()=>{var d;if(s(),!this._enabled.value||!t)return;const r=ts(t);if(!r)return;n=new p.Destroyable;const a=n.disposeVar(p.react(void 0)),l=n.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),n.dispose(()=>c.removeEventListener("mousemove",h));const u=n.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}));n.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 o1 extends p.Destroyable{constructor(t){super();T(this,"_baseLayers",new Set);T(this,"_imageryGroup",new As({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,n){if(!this._baseLayers.has(t)){console.warn("imageriesManager setZindex error: has not added!",t);return}t.setZIndex(n-9999)}}class r1 extends p.Destroyable{constructor(t){super();T(this,"_labelMap",{div:new globalThis.Map,canvas:new globalThis.Map});this._map=t;const n=t.getView(),s=[];s.push(n.on("change:center",()=>this._updateZOrder())),s.push(n.on("change:resolution",()=>this._updateZOrder())),s.push(n.on("change:rotation",()=>this._updateZOrder())),s.push(t.on("moveend",()=>this._updateZOrder())),this.dispose(()=>gi(s))}add(t){const n=t instanceof jt?"div":"canvas";if(this._labelMap[n].has(t)){console.warn(`Label already exists in ${n} 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[n].set(t,()=>s.destroy()),this._updateZOrder()}delete(t){const n=t instanceof jt?"div":"canvas";if(!this._labelMap[n].has(t)){console.warn(`Label not found in ${n} map`,t);return}const s=this._labelMap[n].get(t);s==null||s(),this._labelMap[n].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,n){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 jt&&l.olDivPoi?l.olDivPoi.depth:l instanceof es&&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)=>n==="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 jt&&u.olDivPoi?u.olDivPoi.zOrder=r:u instanceof es&&((d=u.canvasObj)!=null&&d.olCanvasPoi)&&(u.canvasObj.olCanvasPoi.zOrder=r),r--})})}}function Sh(i){return Array.isArray(i)?Math.min(...i):i}class a1 extends Ld{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],n=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=Xn(l,yi(t.extent,s.projection))),!a[ot.ANIMATING]&&!a[ot.INTERACTING]&&!Ui(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,n,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 n=this.getLayer(),s=wt(t.pixelToCoordinateTransform,e.slice()),o=n.getExtent();if(o&&!Js(o,s))return null;const r=this.image.getExtent(),a=this.image.getImage(),l=Te(r),c=Math.floor(a.width*((s[0]-r[0])/l));if(c<0||c>=a.width)return null;const h=ft(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 n=this.image,s=n.getExtent(),o=n.getResolution(),[r,a]=Array.isArray(o)?o:[o,o],l=n.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=yi(c.extent,u.projection);P=pt(z,e.extent),C=P&&!Ni(z,e.extent),C&&this.clipUnrotated(w,e,z)}const R=n.getImage(),O=Zn(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*O[0],M=R.height*O[3];if(this.getLayer().getSource().getInterpolate()||(w.imageSmoothingEnabled=!1),this.preRender(w,e),P&&I>=.5&&M>=.5){const z=O[4],k=O[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 JR extends a1{constructor(e){super(e),this.vectorRenderer_=new k0(e),this.layerImageRatio_=e.getImageRatio(),this.coordinateToVectorPixelTransform_=Qt(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(e){if(!this.vectorRenderer_)return Promise.resolve([]);const t=wt(this.coordinateToVectorPixelTransform_,wt(this.renderedPixelToCoordinateTransform_,e.slice()));return this.vectorRenderer_.getFeatures(t)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(e){var h;const t=e.pixelRatio,n=e.viewState,s=n.resolution,o=e.viewHints,r=this.vectorRenderer_;let a=e.extent;this.layerImageRatio_!==1&&(a=a.slice(0),Iv(a,this.layerImageRatio_));const l=Te(a)/s,c=ft(a)/s;if(!o[ot.ANIMATING]&&!o[ot.INTERACTING]&&!Ui(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 Td(9)});const v=new oy(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(_e.CHANGE,()=>{if(v.getState()!==le.LOADED)return;this.image=v;const E=v.getPixelRatio(),w=Sh(v.getResolution())*t/E;this.renderedResolution=w,this.coordinateToVectorPixelTransform_=Zn(this.coordinateToVectorPixelTransform_,l/2,c/2,1/w,-1/w,0,-n.center[0],-n.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,n,s,o){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(e,t,n,s,o):super.forEachFeatureAtCoordinate(e,t,n,s,o)}}class eT extends Uc{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 JR(this)}}class l1 extends p.Destroyable{constructor(t){super();T(this,"_map");this._map=t.viewer}async pickPosition(t){return new Promise(n=>{try{if(!this._map)return n(void 0);const s=this._map.getCoordinateFromPixel(t),[o,r]=Lt(s);n([o,r,0])}catch(s){return console.error(s),n(void 0)}})}async quickPickPosition(t){return await this.pickPosition(t)}async pick(t,n,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 As?!1:t instanceof zn||t instanceof eT}_resolveSceneObject(t,n){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=n==null?void 0:n.get)==null?void 0:l.call(n,"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,n,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:[n,s,0],properties:c}:{type:r,coordinates:void 0,properties:c}}}function ts(i){return p.getExtProp(i,"_viewerExtensions")}function Rh(i,e){p.setExtProp(i,"_viewerExtensions",e)}class c1 extends p.Destroyable{constructor(t,n){super();T(this,"_imageriesManager");T(this,"_labelManager");T(this,"_pickingManager");T(this,"_poiContext");T(this,"_cursorPositionInfo");this._viewer=t,this._olViewer=n,this._imageriesManager=this.dv(new o1(t)),this._labelManager=this.dv(new r1(t)),this._poiContext=this.disposeVar(new t1(this._viewer)),this._cursorPositionInfo=this.dv(new s1(t)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new l1(n))}))}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 tT extends p.Destroyable{constructor(e,t){super(),this._olViewer=e,this._viewer=t;const n=this._viewer,s=n.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(()=>{gi([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=n.on("postrender",a);this.d(()=>gi(l))}}get olViewer(){return this._olViewer}get viewer(){return this._viewer}}const Br=class Br extends p.ESViewer{constructor(t){super(t);T(this,"_viewer",this.dv(p.react(void 0)));T(this,"orbitController",null);T(this,"_fpsMonitor",null);T(this,"wasdController",null);T(this,"_disabledInputStack",this.disposeVar(p.react(0)));T(this,"_interactionBackup",null);T(this,"_notSupportEditingCount",this.disposeVar(p.react(0)));T(this,"_editingSystem",this.ad(yv()));if(t.type!==Br.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(n=>{this.viewerChanged.emit(n)})),this.dv(new p.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new tT(this,this.viewer)})),this.dv(new p.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new GR(this.subContainer,this,n=>this._viewer.value=n)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&ts(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 n;return(n=this.viewer)==null?void 0:n.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,n,s){if(!this.extensions)return;const{pickingManager:o}=this.extensions;return await o.pick(t,void 0,n)}async pickPosition(t){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.pickPosition(t)}async quickPickPosition(t){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.quickPickPosition(t)}flyIn(t,n,s){if(!this.viewer)return;const o=wo(t[2]);this.viewer.getView().animate({center:Ie([t[0],t[1]]),zoom:o,duration:(s??1)*1e3})}flyTo(t,n){if(!this.viewer)return;const s=wo(t.distance);this.viewer.getView().animate({center:Ie([n[0],n[1]]),zoom:s,duration:(t.flyDuration??1)*1e3})}flyToBoundingSphere(t,n,s){if(!this.viewer)return;const o={_duration:(s??1)*1e3};console.log(t);const r=Ie([t[0],t[1]]),a=Ie([t[2],t[3]]);this.viewer.getView().fit(cd([r[0],r[1],a[0],a[1]]),{duration:o._duration,easing:Ks,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 n=Na(t),s=this.viewer.getView().getCenter();if(!s)return;const o=Lt(s),r=this.viewer.getView().getRotation();return{position:[o[0],o[1],n],rotation:[0,r/(Math.PI/180),0]}}transformFlyParam(t,n){}calcFlyToParam(t){const n=this.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:o}=n,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 by(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,n,s){this.changeToMap(),console.warn("Openlayers引擎暂不支持全球旋转,已切换为Map模式")}changeToLine(t,n,s,o,r,a){this._func()}changeToUserDefined(t){this.changeToMap(),console.warn("Openlayers引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(t,n=5e4,s=60,o=90,r=0){if(!this.viewer)return;const a=this.viewer.getView();this.changeToMap();const l={_distance:n,_orbitPeriod:s*1e3,heading:o},c=wo(l._distance);a.setZoom(c),this.orbitController=vy(this.viewer,{center:[t[0],t[1]],orbitPeriod:l._orbitPeriod,heading:l.heading})}changeToFollow(t,n,s,o){this._func()}getFPS(){return this.viewer&&!this._fpsMonitor&&(this._fpsMonitor=this.dv(new Ey(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const t=globalThis.g_XE3CopyRights??{};return t.openlayers=Fv,t}getHeightByLonLat(t,n,s){return console.warn("getHeightByLonLat is not supported in OpenLayers"),Promise.resolve(0)}getHeightsByLonLats(t,n){return console.warn("getHeightsByLonLats is not supported in OpenLayers"),Promise.resolve([])}async capture(t,n){if(this.viewer)return await wy(this.viewer,t,n)}lonLatAltToScreenPosition(t){var r;const n=[t[0],t[1]],s=Ie(n),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,n,s){s=Object.assign({useKeyToSwitch:!0,callSource:"outer"},s);const o=t.components.main??t;o&&n!=null&&(o.editingID=`${s.callSource}_${p.createGuid()}`,this._editingSystem.restart(void 0,this,o,n,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 n=this.viewer.getView().calculateExtent(this.viewer.getSize());if(console.log(n),!n)return Promise.resolve(void 0);const s=Lt([n[0],n[1]]),o=Lt([n[2],n[3]]),r=[s[0],s[1],o[0],o[1]];return console.log(r),Promise.resolve(r)}};T(Br,"type",Br.register("ESOlViewer",Br));let Ri=Br;(i=>{i.createDefaultProps=()=>({...p.ESViewer.createDefaultProps()})})(Ri||(Ri={})),p.extendClassProps(Ri.prototype,Ri.createDefaultProps);class nT extends Ma{constructor(e){e=e||{},super(e)}}class ep extends nT{constructor(e){super(e)}createRenderer(){return new a1(this)}getData(e){return super.getData(e)}}function tp(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}const iT=new Error("disposed"),sT=[256,256];class h1 extends Da{constructor(e){const t=se.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=tp(this.data_);return e?[e.width,e.height]:sT}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==se.IDLE&&this.state!==se.ERROR)return;this.state=se.LOADING,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=se.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=se.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(iT),this.controller_=null),super.disposeInternal()}}let np;const Sr=[];function u1(i,e,t,n,s){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,s),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,s)),i.restore()}function ip(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function oT(){if(np===void 0){const i=ht(6,6,Sr);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",u1(i,4,5,4,0),u1(i,4,5,0,5);const e=i.getImageData(0,0,3,3).data;np=ip(e,0)||ip(e,4)||ip(e,8),la(i),Sr.push(i.canvas)}return np}function Th(i,e,t,n){const s=Ko(t,e,i);let o=Cm(e,n,t);const r=e.getMetersPerUnit();r!==void 0&&(o*=r);const a=i.getMetersPerUnit();a!==void 0&&(o/=a);const l=i.getExtent();if(!l||Js(l,s)){const c=Cm(i,o,s)/o;isFinite(c)&&c>0&&(o/=c)}return o}function rT(i,e,t,n){const s=Tn(t);let o=Th(i,e,s,n);return(!isFinite(o)||o<=0)&&Kg(t,function(r){return o=Th(i,e,r,n),isFinite(o)&&o>0}),o}function d1(i,e,t,n,s,o,r,a,l,c,h,u,d,f){const g=ht(Math.round(t*i),Math.round(t*e),Sr);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=yn();l.forEach(function(R,O,I){Yg(v,R.extent)});let E;const w=t/n,C=(u?1:1+Math.pow(2,-24))/w;(!d||l.length!==1||c!==0)&&(E=ht(Math.round(Te(v)*w),Math.round(ft(v)*w),Sr),u||(E.imageSmoothingEnabled=!1),l.forEach(function(R,O,I){if(R.image.width>0&&R.image.height>0){if(R.clipExtent){E.save();const H=(R.clipExtent[0]-v[0])*w,m=-(R.clipExtent[3]-v[3])*w,b=Te(R.clipExtent)*w,S=ft(R.clipExtent)*w;E.rect(u?H:Math.round(H),u?m:Math.round(m),u?b:Math.round(H+b)-Math.round(H),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=Te(R.extent)*w,q=ft(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=ln(r);return a.getTriangles().forEach(function(R,O,I){const M=R.source,z=R.target;let k=M[0][0],q=M[0][1],H=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),X=_(-(z[2][1]-P[1])/o),G=k,ae=q;k=0,q=0,H-=G,m-=ae,b-=G,S-=ae;const te=[[H,m,0,0,j-L],[b,S,0,0,B-L],[0,0,H,m,U-N],[0,0,b,S,X-N]],V=Mv(te);if(!V)return;if(g.save(),g.beginPath(),oT()||!u){g.moveTo(j,U);const ie=4,he=L-j,me=N-U;for(let Fe=0;Fe<ie;Fe++)g.lineTo(j+_((Fe+1)*he/ie),U+_(Fe*me/(ie-1))),Fe!=ie-1&&g.lineTo(j+_((Fe+1)*he/ie),U+_((Fe+1)*me/(ie-1)));g.lineTo(B,X)}else g.moveTo(j,U),g.lineTo(L,N),g.lineTo(B,X);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 ie=l[0],he=ie.extent;re=ie.image,g.scale(Te(he)/re.width,-ft(he)/re.height)}g.drawImage(re,0,0),g.restore()}),E&&(la(E),Sr.push(E.canvas)),h&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(R,O,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,H=-(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,H),g.lineTo(z,k),g.lineTo(m,b),g.closePath(),g.stroke()}),g.restore()),g.canvas}const aT=10,f1=.25;class p1{constructor(e,t,n,s,o,r,a){this.sourceProj_=e,this.targetProj_=t;let l={};const c=a?Bu(C=>wt(a,Ko(C,this.targetProj_,this.sourceProj_))):Gi(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()&&Te(s)>=Te(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Te(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Te(this.targetProj_.getExtent()):null;const h=ln(n),u=Ql(n),d=Zl(n),f=Yl(n),g=this.transformInv_(h),_=this.transformInv_(u),v=this.transformInv_(d),E=this.transformInv_(f),w=aT+(r?Math.max(0,Math.ceil(Math.log2(Mu(n)/(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,O){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 O=Math.min(R[0][0],R[1][0],R[2][0]);Math.max(R[0][0],R[1][0],R[2][0])-O<this.sourceWorldWidth_/2&&(P.source=R)}})}l={}}addTriangle_(e,t,n,s,o,r){this.triangles_.push({source:[s,o,r],target:[e,t,n]})}addQuad_(e,t,n,s,o,r,a,l,c){const h=$r([o,r,a,l]),u=this.sourceWorldWidth_?Te(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=$r([e,t,n,s]);g=Te(v)/this.targetWorldWidth_>f1||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>f1||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]+n[0])/2,(e[1]+n[1])/2],E=this.transformInv_(v);let w;f?w=(ms(o[0],d)+ms(a[0],d))/2-ms(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]-n[0])<=Math.abs(e[1]-n[1])){const v=[(t[0]+n[0])/2,(t[1]+n[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,n,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=[(n[0]+s[0])/2,(n[1]+s[1])/2],C=this.transformInv_(w);this.addQuad_(e,v,w,s,o,E,C,l,c-1),this.addQuad_(v,t,n,w,E,r,a,C,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(e,n,s,o,a,l),(_&14)==0&&this.addTriangle_(e,n,t,o,a,r),_&&((_&13)==0&&this.addTriangle_(t,s,e,r,l,o),(_&7)==0&&this.addTriangle_(t,s,n,r,l,a))}calculateSourceExtent(){const e=yn();return this.triangles_.forEach(function(t,n,s){const o=t.source;Hr(e,o[0]),Hr(e,o[1]),Hr(e,o[2])}),e}getTriangles(){return this.triangles_}}const g1=.5;class m1 extends Da{constructor(e,t,n,s,o,r,a,l,c,h,u,d){super(o,se.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?Xn(f,g):f;if(Mu(v)===0){this.state=se.EMPTY;return}const E=e.getExtent();E&&(_?_=Xn(_,E):_=E);const w=s.getResolution(this.wrappedTileCoord_[0]),C=rT(e,n,v,w);if(!isFinite(C)||C<=0){this.state=se.EMPTY;return}const P=h!==void 0?h:g1;if(this.triangulation_=new p1(e,n,v,_,C*P,w),this.triangulation_.getTriangles().length===0){this.state=se.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=Xn(R,_)),!Mu(R))this.state=se.EMPTY;else{let O=0,I=0;e.canWrapX()&&(O=Te(E),I=Math.floor((R[0]-E[0])/O)),tm(R.slice(),e,!0).forEach(z=>{const k=t.getTileRangeForExtentAndZ(z,this.sourceZ_);for(let q=k.minX;q<=k.maxX;q++)for(let H=k.minY;H<=k.maxY;H++){const m=I*O;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,q,H,a),offset:m})}++I}),this.sourceTiles_.length===0&&(this.state=se.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{var s;const n=t.tile;if(n&&n.getState()==se.LOADED){const o=this.sourceTileGrid_.getTileCoordExtent(n.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:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=se.ERROR;else{const t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),s=typeof n=="number"?n:n[0],o=typeof n=="number"?n:n[1],r=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=d1(s,o,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),r,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=se.LOADED}this.changed()}load(){for(const e of this.sourceTiles_)e.tile=e.getTile();if(this.state==se.IDLE){this.state=se.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const n=t.getState();if(n==se.IDLE||n==se.LOADING){e++;const s=Ue(t,_e.CHANGE,o=>{const r=t.getState();(r==se.LOADED||r==se.ERROR||r==se.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},n,s){t.getState()==se.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(st),this.sourcesListenerKeys_=null}release(){this.canvas_&&(la(this.canvas_.getContext("2d")),Sr.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class y1{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 Yr&&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 n=this.entries_[e];return Ve(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){const t=this.entries_[e];return Ve(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,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.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){Ve(!(e in this.entries_),"Tried to set a value for a key that is used already");const n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}}function Ih(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function lT(i,e,t){return i+"/"+e+"/"+t}function Oh(i,e,t,n,s){return`${Pe(i)},${e},${lT(t,n,s)}`}function _1(i){return cT(i[0],i[1],i[2])}function cT(i,e,t){return(e<<i)+t}function hT(i,e){const t=i[0],n=i[1],s=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const o=e.getFullTileRange(t);return o?o.containsXY(n,s):!0}function sp(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;const n=i[t],s=n.has(e);return s||n.add(e),!s}function uT(i,e,t){const n=i[t];return n?n.delete(e):!1}function w1(i,e){const t=i.layerStatesArray[i.layerIndex];t.extent&&(e=Xn(e,yi(t.extent,i.viewState.projection)));const n=t.layer.getRenderSource();if(!n.getWrapX()){const s=n.getTileGridForProjection(i.viewState.projection).getExtent();s&&(e=Xn(e,s))}return e}class v1 extends Ld{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=yn(),this.tempTileRange_=new tf(0,0,0,0),this.tempTileCoord_=Ih(0,0,0);const n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new y1(n),this.sourceTileCache_=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new y1(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,s){const o=this.tileCache_,a=this.getLayer().getSource(),l=Oh(a,a.getKey(),e,t,n);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,n,s.pixelRatio,h,!u||Wt(u,h)?void 0:this.getSourceTileCache()),!c)return null;o.set(l,c)}return c}getTile(e,t,n,s){const o=this.getOrCreateTile(e,t,n,s);return o||null}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),s=wt(t.pixelToCoordinateTransform,e.slice()),o=n.getExtent();if(o&&!Js(o,s))return null;const r=t.viewState,a=n.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()!==se.LOADED)continue;const f=l.getOrigin(h),g=$t(l.getTileSize(h)),_=l.getResolution(h);let v;if(d instanceof ry||d instanceof m1)v=d.getImage();else if(d instanceof h1){if(v=tp(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 n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),(s=this.sourceTileCache_)==null||s.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,s,o){const r=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(r.projection),h=Pe(l);h in e.wantedTiles||(e.wantedTiles[h]={});const u=e.wantedTiles[h],d=a.getMapInternal(),f=Math.max(n-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?Qg(r.center,r.resolution,g,e.size):void 0;for(let v=n;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||!sp(s,R,v))continue;const I=R.getKey();if(u[I]=!0,R.getState()===se.IDLE&&!e.tileQueue.isKeyQueued(I)){const M=Ih(v,C,P,this.tempTileCoord_);e.tileQueue.enqueue([R,h,c.getTileCoordCenter(M),w])}}}}findStaleTile_(e,t){const n=this.tileCache_,s=e[0],o=e[1],r=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const c=Oh(this.getLayer().getSource(),a[l],s,o,r);if(n.containsKey(c)){const h=n.peek(c);if(h.getState()===se.LOADED)return h.endTransition(Pe(this)),sp(t,h,s),!0}}return!1}findAltTiles_(e,t,n,s){const o=e.getTileRangeForTileCoordAndZ(t,n,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=Oh(l,c,n,h,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===se.LOADED&&(sp(s,g,n),f=!0)}f||(r=!1)}return r}renderFrame(e,t){this.renderComplete=!0;const n=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=n.extent&&yi(n.extent);C&&(_=Xn(_,yi(n.extent)));const P=f*E/2/v,R=f*w/2/v,O=[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=w1(e,e.nextExtent);this.enqueueTiles(e,U,j,I,M)}const z=w1(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=Pe(this),q=e.time;for(const j of I[d]){const U=j.getState();if(U===se.EMPTY)continue;const B=j.tileCoord;if(U===se.LOADED&&j.getAlpha(k,q)===1){j.endTransition(k);continue}if(U!==se.ERROR&&(this.renderComplete=!1),this.findStaleTile_(B,I)){uT(I,j,d),e.animate=!0;continue}if(this.findAltTiles_(u,B,d+1,I))continue;const ae=u.getMinZoom();for(let te=d-1;te>=ae&&!this.findAltTiles_(u,B,te,I);--te);}const H=f/r*l/v,m=this.getRenderContext(e);Zn(this.tempTransform,E/2,w/2,H,H,0,-E/2,-w/2),n.extent&&this.clipUnrotated(m,e,C),h.getInterpolate()||(m.imageSmoothingEnabled=!1),this.preRender(m,e);const b=Object.keys(I).map(Number);b.sort(di);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*H,te=B[1]*G*H,V=u.getTileCoordForCoordAndZ(ln(O),U),re=u.getTileCoordExtent(V),ie=wt(this.tempTransform,[v*(re[0]-O[0])/f,v*(O[3]-re[3])/f]),he=v*h.getGutterForProjection(o);for(const me of I[U]){if(me.getState()!==se.LOADED)continue;const Fe=me.tileCoord,ue=V[1]-Fe[1],ze=Math.round(ie[0]-(ue-1)*ae),J=V[2]-Fe[2],dt=Math.round(ie[1]-(J-1)*te),Qe=Math.round(ie[0]-ue*ae),ye=Math.round(ie[1]-J*te),sn=ze-Qe,Gt=dt-ye,_t=b.length===1;let Mt=!1;S=[Qe,ye,Qe+sn,ye,Qe+sn,ye+Gt,Qe,ye+Gt];for(let Je=0,qn=L.length;Je<qn;++Je)if(!_t&&U<N[Je]){const nt=L[Je];pt([Qe,ye,Qe+sn,ye+Gt],[nt[0],nt[3],nt[4],nt[7]])&&(Mt||(m.save(),Mt=!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(me,e,Qe,ye,sn,Gt,he,_t),Mt&&m.restore(),this.renderedTiles.unshift(me),this.updateUsedTiles(e.usedTiles,h,me)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!ji(this.renderedExtent_,O),this.renderedExtent_=O,this.renderedPixelRatio=l,this.postRender(this.context,e),n.extent&&m.restore(),m.imageSmoothingEnabled=!0,this.renderComplete){const j=(U,B)=>{var te;const X=Pe(h),G=B.wantedTiles[X],ae=G?Object.keys(G).length:0;this.updateCacheSize(ae),this.tileCache_.expireCache(),(te=this.sourceTileCache_)==null||te.expireCache()};e.postRenderFunctions.push(j)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,s,o,r,a,l){let c;if(e instanceof h1){if(c=tp(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=Pe(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,n,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,n){const s=Pe(t);s in e||(e[s]={}),e[s][n.getKey()]=!0}}const Gs={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class dT extends Ma{constructor(e){e=e||{};const t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,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(Gs.PRELOAD)}setPreload(e){this.set(Gs.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Gs.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Gs.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}class Ah extends dT{constructor(e){super(e)}createRenderer(){return new v1(this,{cacheSize:this.getCacheSize()})}}class fT extends vc{constructor(e,t,n,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?Xn(n,c):n,u=Tn(h),d=Th(e,t,u,s),f=g1,g=new p1(e,t,h,l,d*f,s),_=g.calculateSourceExtent(),v=Ui(_)?null:r(_,d,o),E=v?le.IDLE:le.EMPTY,w=v?v.getPixelRatio():1;super(n,s,w,E),this.targetProj_=t,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=n,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=Te(this.targetExtent_)/this.targetResolution_,n=ft(this.targetExtent_)/this.targetResolution_;this.canvas_=d1(t,n,this.sourcePixelRatio_,Sh(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_=Ue(this.sourceImage_,_e.CHANGE,t=>{const n=this.sourceImage_.getState();(n==le.LOADED||n==le.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){st(this.sourceListenerKey_),this.sourceListenerKey_=null}}const Rr=4,op={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class pT extends Yn{constructor(e,t){super(e),this.image=t}}class rp extends Ea{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 n=Xl(t,e,0);e=t[n]}return e}getImage(e,t,n,s){const o=this.getProjection();if(!o||!s||Wt(o,s))return o&&(s=o),this.getImageInternal(e,t,n,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Wt(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==t&&ji(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new fT(o,s,e,t,n,(r,a,l)=>this.getImageInternal(r,a,l,o),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,n,s){if(this.loader){const o=mT(e,t,n,1),r=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&Ni(this.wantedExtent_,o)||Ni(this.image.getExtent(),o))&&(this.wantedResolution_&&Sh(this.wantedResolution_)===r||Sh(this.image.getResolution())===r)))return this.image;this.wantedProjection_=s,this.wantedExtent_=o,this.wantedResolution_=r,this.image=new vc(o,r,n,this.loader),this.image.addEventListener(_e.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){const t=e.target;let n;switch(t.getState()){case le.LOADING:this.loading=!0,n=op.IMAGELOADSTART;break;case le.LOADED:this.loading=!1,n=op.IMAGELOADEND;break;case le.ERROR:this.loading=!1,n=op.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new pT(n,t))}}function gT(i,e){i.getImage().src=e}function mT(i,e,t,n){const s=e/t,o=Tn(i),r=ys(Te(i)/s,Rr),a=ys(ft(i)/s,Rr),l=ys((n-1)*r/2,Rr),c=r+2*l,h=ys((n-1)*a/2,Rr),u=a+2*h;return Kl(o,s,0,[c,u])}function yT(i){const e=i.load||Jm,t=i.imageExtent,n=i.crossOrigin??null;return()=>{const s=new Image;return s.crossOrigin=n,i.referrerPolicy!==void 0&&(s.referrerPolicy=i.referrerPolicy),e(s,i.url).then(o=>{const r=Te(t)/o.width,a=ft(t)/o.height;return{image:o,extent:t,resolution:r!==a?[r,a]:a,pixelRatio:1}})}}class b1 extends rp{constructor(e){const t=e.crossOrigin!==void 0?e.crossOrigin:null,n=e.imageLoadFunction!==void 0?e.imageLoadFunction:gT;super({attributions:e.attributions,interpolate:e.interpolate,projection:De(e.projection)}),this.url_=e.url,this.imageExtent_=e.imageExtent,this.image=null,this.image=new vc(this.imageExtent_,void 0,1,yT({url:e.url,imageExtent:e.imageExtent,crossOrigin:t,referrerPolicy:e.referrerPolicy,load:(s,o)=>(this.image.setImage(s),n(this.image,o),Jm(s))})),this.image.addEventListener(_e.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(e,t,n,s){return pt(e,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}const Tr=[0,0,0],qs=5;class Vs{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,Ve(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,Ve(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=e.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=ln(n)),Ve(!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,Ve(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:Wd,Ve(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n!==void 0?n: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 tf(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,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}):n&&this.calculateTileRanges_(n)}forEachTileCoord(e,t,n){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)n([t,o,a])}forEachTileCoordParentTileRange(e,t,n,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=hr(r,r,a,a,n)):o=this.getTileRangeForExtentAndZ(l,c,n),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,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const o=e[1]*2,r=e[2]*2;return hr(o,o+1,r,r+1,t)}const s=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;const s=e[0],o=e[1],r=e[2];if(t===s)return hr(o,r,o,r,n);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 hr(c,c,h,h,n);const u=Math.floor(l*(o+1))-1,d=Math.floor(l*(r+1))-1;return hr(c,u,h,d,n)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Tr);const s=Tr[1],o=Tr[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Tr);const r=Tr[1],a=Tr[2];return hr(s,r,o,a,n)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),n=this.getResolution(e[0]),s=$t(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*s[0]*n,t[1]-(e[2]+.5)*s[1]*n]}getTileCoordExtent(e,t){const n=this.getOrigin(e[0]),s=this.getResolution(e[0]),o=$t(this.getTileSize(e[0]),this.tmpSize_),r=n[0]+e[1]*o[0]*s,a=n[1]-(e[2]+1)*o[1]*s,l=r+o[0]*s,c=a+o[1]*s;return ki(r,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,s,o){const r=this.getZForResolution(n),a=n/this.getResolution(r),l=this.getOrigin(r),c=$t(this.getTileSize(r),this.tmpSize_);let h=a*(e-l[0])/n/c[0],u=a*(l[1]-t)/n/c[1];return s?(h=ys(h,qs)-1,u=ys(u,qs)-1):(h=Jl(h,qs),u=Jl(u,qs)),Ih(r,h,u,o)}getTileCoordForXYAndZ_(e,t,n,s,o){const r=this.getOrigin(n),a=this.getResolution(n),l=$t(this.getTileSize(n),this.tmpSize_);let c=(e-r[0])/a/l[0],h=(r[1]-t)/a/l[1];return s?(c=ys(c,qs)-1,h=ys(h,qs)-1):(c=Jl(c,qs),h=Jl(h,qs)),Ih(n,c,h,o)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}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 n=Xl(this.resolutions_,e,t||0);return ct(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return Um(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,n=new Array(t);for(let s=this.minZoom;s<t;++s)n[s]=this.getTileRangeForExtentAndZ(e,s);this.fullTileRanges_=n}}class _T extends Vs{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 ap(i){let e=i.getDefaultTileGrid();return e||(e=bT(i),i.setDefaultTileGrid(e)),e}function wT(i,e,t){const n=e[0],s=i.getTileCoordCenter(e),o=Ka(t);if(!Js(o,s)){const r=Te(o),a=Math.ceil((o[0]-s[0])/r);return s[0]+=r*a,i.getTileCoordForCoordAndZ(s,n)}return e}function vT(i,e,t,n){n=n!==void 0?n:"top-left";const s=E1(i,e,t);return new Vs({extent:i,origin:Rv(i,n),resolutions:s,tileSize:t})}function Ir(i){const e=i||{},t=e.extent||De("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:E1(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Vs(n)}function E1(i,e,t,n){e=e!==void 0?e:ny,t=$t(t!==void 0?t:Wd);const s=ft(i),o=Te(i);n=n>0?n: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]=n/Math.pow(2,l);return a}function bT(i,e,t,n){const s=Ka(i);return vT(s,e,t,n)}function Ka(i){i=De(i);let e=i.getExtent();if(!e){const t=180*ic.degrees/i.getMetersPerUnit();e=ki(-t,-t,t,t)}return e}class C1 extends Ea{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||Pe(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,n,s,o,r){return we()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:ap(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){const s=this.getTileGridForProjection(n),o=this.getTilePixelRatio(t),r=$t(s.getTileSize(e),this.tmpSize);return o==1?r:ME(r,o,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){const n=t!==void 0?t:this.getProjection(),s=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=wT(s,e,n)),hT(e,s)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class ET extends Yn{constructor(e,t){super(e),this.tile=t}}function x1(i){return function(e){const t=e.buffers,n=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 i(d,n).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=i(u,n);c[d]=f[0],c[d+1]=f[1],c[d+2]=f[2],c[d+3]=f[3]}return c.buffer}}function CT(i,e){const n=Object.keys(i.lib||{}).map(function(o){return"const "+o+" = "+i.lib[o].toString()+";"}).concat(["const __minion__ = ("+x1.toString()+")(",i.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(n.join(`
156
156
  `),"binary").toString("base64"):URL.createObjectURL(new Blob(n,{type:"text/javascript"})));return s.addEventListener("message",e),s}function xT(i,e){const t=x1(i.operation);let n=!1;return{postMessage:function(s){setTimeout(function(){n||e({data:{buffer:t(s),meta:s.meta}})},0)},terminate:function(){n=!0}}}class PT extends Yr{constructor(e){super(),this.imageOps_=!!e.imageOps;let t;e.threads===0?t=0:this.imageOps_?t=1:t=e.threads||1;const n=new Array(t);if(t)for(let s=0;s<t;++s)n[s]=CT(e,this.onWorkerMessage_.bind(this,s));else n[0]=xT(e,this.onWorkerMessage_.bind(this,0));this.workers_=n,this.queue_=[],this.maxQueueLength_=e.queue||1/0,this.running_=0,this.dataLookup_={},this.job_=null}process(e,t,n){this.enqueue_({inputs:e,meta:t,callback:n}),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,n=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:n},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:n},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 n,s;if(t===1)n=new Uint8ClampedArray(this.dataLookup_[0].buffer),s=this.dataLookup_[0].meta;else{const o=e.inputs[0].data.length;n=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;n.set(new Uint8ClampedArray(l),c),s[a]=this.dataLookup_[a].meta}}this.job_=null,this.dataLookup_={},e.callback(null,new ImageData(n,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 P1={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"};class S1 extends Yn{constructor(e,t,n){super(e),this.extent=t.extent,this.resolution=t.viewState.resolution/t.pixelRatio,this.data=n}}class lp extends rp{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_=TT(e.sources);const t=this.changed.bind(this);for(let n=0,s=this.layers_.length;n<s;++n)this.layers_[n].addEventListener(_e.CHANGE,t);this.useResolutions_=e.resolutions!==null,this.tileQueue_=new ay(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:Qt(),declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:RT(this.layers_),pixelRatio:1,pixelToCoordinateTransform:Qt(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:Pe(this),renderTargets:{}},this.setAttributions(function(n){var o;const s=[];for(let r=0,a=e.sources.length;r<a;++r){const l=e.sources[r],c=l instanceof Ea?l:l.getSource();if(!c)continue;const h=(o=c.getAttributions())==null?void 0:o(n);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 PT({operation:e,imageOps:this.operationType_==="image",queue:1,lib:t,threads:this.threads_}),this.changed()}updateFrameState_(e,t,n){const s=Object.assign({},this.frameState_);s.viewState=Object.assign({},s.viewState);const o=Tn(e);s.size[0]=Math.ceil(Te(e)/t),s.size[1]=Math.ceil(ft(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=n,r.resolution=t,s}allSourcesReady_(){let e=!0,t;for(let n=0,s=this.layers_.length;n<s;++n)if(t=this.layers_[n].getSource(),!t||t.getState()!=="ready"){e=!1;break}return e}getImage(e,t,n,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||!ji(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,n=new Array(t);for(let o=0;o<t;++o){e.layerIndex=o,e.renderTargets={};const r=ST(this.layers_[o],e);if(r)n[o]=r;else return}const s={};this.dispatchEvent(new S1(P1.BEFOREOPERATIONS,e,s)),this.processor_.process(n,s,this.onWorkerComplete_.bind(this,e))}onWorkerComplete_(e,t,n,s){if(t||!n)return;const o=e.extent,r=e.viewState.resolution;if(r!==this.requestedFrameState_.viewState.resolution||!ji(o,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const l=Math.round(Te(o)/r),c=Math.round(ft(o)/r);a=ht(l,c),this.renderedImageCanvas_=new oy(o,r,1,a.canvas)}a.putImageData(n,0,0),e.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new S1(P1.AFTEROPERATIONS,e,s))}getResolutions(e){if(!this.useResolutions_)return null;let t=super.getResolutions();if(!t)for(let n=0,s=this.layers_.length;n<s&&(t=this.layers_[n].getSource().getResolutions(e),!t);++n);return t}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}lp.prototype.dispose;let xo=null;function ST(i,e){const t=i.getRenderer();if(!t)throw new Error("Unsupported layer type: "+i);if(!t.prepareFrame(e))return null;const n=e.size[0],s=e.size[1];if(n===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===n&&r.height===s)return r.getContext("2d").getImageData(0,0,n,s)}if(!xo)xo=ht(n,s,void 0,{willReadFrequently:!0});else{const a=xo.canvas;a.width!==n||a.height!==s?xo=ht(n,s,void 0,{willReadFrequently:!0}):xo.clearRect(0,0,n,s)}return xo.drawImage(r,0,0,n,s),xo.getImageData(0,0,n,s)}function RT(i){return i.map(function(e){return e.getLayerState()})}function TT(i){const e=i.length,t=new Array(e);for(let n=0;n<e;++n)t[n]=IT(i[n]);return t}function IT(i){let e;return i instanceof Ea?i instanceof C1?e=new Ah({source:i}):i instanceof rp&&(e=new ep({source:i})):e=i,e}function Mh(i,e){const t=[];Object.keys(e).forEach(function(s){e[s]!==null&&e[s]!==void 0&&t.push(s+"="+encodeURIComponent(e[s]))});const n=t.join("&");return i=i.replace(/[?&]$/,""),i+=i.includes("?")?"&":"?",i+n}const OT=/\{z\}/g,AT=/\{x\}/g,MT=/\{y\}/g,DT=/\{-y\}/g;function FT(i,e,t,n,s){return i.replace(OT,e.toString()).replace(AT,t.toString()).replace(MT,n.toString()).replace(DT,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-n).toString()})}function R1(i){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(i);if(t){const n=t[1].charCodeAt(0),s=t[2].charCodeAt(0);let o;for(o=n;o<=s;++o)e.push(i.replace(t[0],String.fromCharCode(o)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){const n=parseInt(t[2],10);for(let s=parseInt(t[1],10);s<=n;s++)e.push(i.replace(t[0],s.toString()));return e}return e.push(i),e}function LT(i,e){return(function(t,n,s){if(!t)return;let o;const r=t[0];if(e){const a=e.getFullTileRange(r);a&&(o=a.getHeight()-1)}return FT(i,r,t[1],t[2],o)})}function T1(i,e){const t=i.length,n=new Array(t);for(let s=0;s<t;++s)n[s]=LT(i[s],e);return cp(n)}function cp(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;const s=_1(e),o=ms(s,i.length);return i[o](e,t,n)})}const hp={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Dh extends C1{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===Dh.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,n=Pe(t),s=t.getState();let o;s==se.LOADING?(this.tileLoadingKeys_[n]=!0,o=hp.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],o=s==se.ERROR?hp.TILELOADERROR:s==se.LOADED?hp.TILELOADEND:void 0),o!=null&&this.dispatchEvent(new ET(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=R1(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
157
157
  `);this.generateTileUrlFunction_?this.setTileUrlFunction(T1(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}}class Fh extends Dh{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:zT,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:ry,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 n=Pe(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=ap(e)),this.tileGridForProjection[n]}createTile_(e,t,n,s,o,r){const a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,o),c=l?this.tileUrlFunction(l,s,o):void 0,h=new this.tileClass(a,c!==void 0?se.IDLE:se.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=r,h.addEventListener(_e.CHANGE,this.handleTileChange.bind(this)),h}getTile(e,t,n,s,o,r){const a=this.getProjection();if(!a||!o||Wt(a,o))return this.getTileInternal(e,t,n,s,a||o);const l=[e,t,n],c=this.getKey(),h=this.getTileGridForProjection(a),u=this.getTileGridForProjection(o),d=this.getTileCoordForTileUrlFunction(l,o),f=new m1(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,n,s,o,r){const a=this.getKey(),l=Oh(this,a,e,t,n);if(r&&r.containsKey(l))return r.get(l);const c=this.createTile_(e,t,n,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 n=De(e);if(n){const s=Pe(n);s in this.tileGridForProjection||(this.tileGridForProjection[s]=t)}}}function zT(i,e){if(hn){const t=i.getCrossOrigin();let n="same-origin",s="same-origin";t==="anonymous"||t===""?(n="cors",s="omit"):t==="use-credentials"&&(n="cors",s="include");const o={mode:n,credentials:s,referrerPolicy:i.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=i.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(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}const up="1.3.0";function NT(i,e,t,n,s){s.WIDTH=t[0],s.HEIGHT=t[1];const o=n.getAxisOrientation(),r=cm(s.VERSION,"1.3")>=0;s[r?"CRS":"SRS"]=n.getCode();const a=r&&o.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return s.BBOX=a.join(","),Mh(i,s)}function kT(i,e,t,n,s,o,r){o=Object.assign({REQUEST:"GetMap"},o);const a=e/t,l=[im(Te(i)/a,Rr),im(ft(i)/a,Rr)];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 NT(s,i,l,n,o)}function I1(i,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:up,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},i)}class jT extends Fh{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_=yn(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(e,t,n,s){const o=De(n),r=this.getProjection()||o;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(r));const l=Ko(e,o,r),c=Th(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=pi(f,u*g,f));const _={QUERY_LAYERS:this.params_.LAYERS};Object.assign(_,I1(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 n={SERVICE:"WMS",VERSION:up,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;n.LAYER=s}if(e!==void 0){const s=this.getProjection()?this.getProjection().getMetersPerUnit():1,o=28e-5;n.SCALE=e*s/o}return Object.assign(n,t),Mh(this.urls[0],n)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(e,t,n,s,o){const r=this.urls;if(!r)return;let a;if(r.length==1)a=r[0];else{const l=ms(_1(e),r.length);a=r[l]}return kT(t,(this.tileGrid||this.getTileGridForProjection(s)).getResolution(e[0]),n,s,a,o,this.serverType_)}getTilePixelRatio(e){return!this.hidpi_||this.serverType_===void 0?1:e}getKeyForParams_(){let e=0;const t=[];for(const n in this.params_)t[e++]=n+"-"+this.params_[n];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||up;this.v13_=cm(e,"1.3")>=0}tileUrlFunction(e,t,n){let s=this.getTileGrid();if(s||(s=this.getTileGridForProjection(n)),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=pi(r,o*a,r));const l=Object.assign({},I1(this.params_,"GetMap"));return this.getRequestUrl_(e,r,t,n,l)}}class UT extends Fh{constructor(e){const t=e.requestEncoding!==void 0?e.requestEncoding:"KVP",n=e.tileGrid;let s=e.urls;s===void 0&&e.url!==void 0&&(s=R1(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:n,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=cp(s.map(this.createFromWMTSTemplate.bind(this))))}setUrls(e){this.urls=e;const t=e.join(`
158
- `);this.setTileUrlFunction(cp(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_,n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};t=="KVP"&&Object.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),e=t=="KVP"?Mh(e,n):e.replace(/\{(\w+?)\}/g,function(r,a){return a.toLowerCase()in n?n[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=Mh(h,c):h=h.replace(/\{(\w+?)\}/g,function(u,d){return encodeURIComponent(c[d])}),h})}}class Lh extends Fh{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:Ir({extent:Ka(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:n,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 GT={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},O1={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class qT extends v1{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Qt(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(e,t,n,s,o,r,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,n,s,o,r,a,l)}getTile(e,t,n,s){const o=this.getOrCreateTile(e,t,n,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,n){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(n).getTileCoordExtent(e.wrappedTileCoord),g=c.getSourceTiles(t,n,e),_=Pe(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()!=se.LOADED)continue;const C=c.getProjection(),P=w.tileCoord;let R=u.getTileCoordExtent(P);n&&C&&!Wt(n,C)&&(R=sa(R,C,n,32));const O=Xn(f,R),I=pi(O,s.getRenderBuffer()*a,this.tempExtent),M=ji(R,O)?null:I,z=new R0(0,O,a,t),k=Pc(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}},H=w.getFeatures();r&&r!==l.renderedRenderOrder&&H.sort(r);for(let L=0,N=H.length;L<N;++L){let j=H[L];n&&w.projection&&!Wt(n,w.projection)&&(j=j.clone(),j.getGeometry().applyTransform(Gi(w.projection,n))),(!M||pt(M,j.getGeometry().getExtent()))&&q.call(this,j,L)}const m=z.finish(),b=s.getRenderMode()!=="vector"&&h&&g.length===1?null:O,S=new M0(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,n,s,o){var C,P;const r=t.viewState.resolution,a=t.viewState.rotation;n=n??0;const l=this.getLayer(),h=l.getSource().getTileGridForProjection(t.viewState.projection),u=$r([e]);pi(u,r*n,u);const d={},f=function(R,O,I){let M=R.getId();M===void 0&&(M=Pe(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,O);z.geometry=O,z.distanceSq=I}}else{if(I===0)return d[M]=!0,s(R,l,O);o.push(d[M]={feature:R,layer:l,geometry:O,distanceSq:I,callback:s})}},g=this.renderedTiles,_=Pe(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,O=g.length;R<O;++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,n,f,E),w)break e}return w}getFeatures(e){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((t,n)=>{const s=this.getLayer(),o=s.getSource(),r=this.renderedProjection,a=r.getExtent(),l=this.renderedResolution,c=o.getTileGridForProjection(r),h=wt(this.renderedPixelToCoordinateTransform_,e.slice()),u=c.getTileCoordForCoordAndResolution(h,l).toString(),d=this.renderedTiles.find(C=>C.tileCoord.toString()===u&&C.getState()===se.LOADED);if(!d||d.loadingSourceTiles>0){t([]);return}o.getWrapX()&&r.canWrapX()&&!Ni(a,c.getTileCoordExtent(d.tileCoord))&&Nu(h,r);const f=Pe(s),g=c.getTileCoordExtent(d.wrappedTileCoord),_=ln(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,bn,C[0]*bn,C[1]*bn,0)];w=F0(C,R,E,s.getStyleFunction(),c.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,P),d.hitDetectionImageData[f]=w}t(L0(v,E,w))})}getFeaturesInExtent(e){const t=[],n=this.getTileCache();if(n.getCount()===0)return t;const o=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=o.getZForResolution(this.renderedResolution),a={};return n.forEach(l=>{if(l.tileCoord[0]!==r||l.getState()!==se.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 n=this.context,s=n.globalAlpha;n.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=Pe(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,Dc,c)}n.globalAlpha=s}renderDeferredInternal(e){const t=this.renderedTiles,n=Pe(this.getLayer()),s=t.reduce((l,c,h)=>(c.executorGroups[n].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(di).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 n=t.pixelRatio,s=t.viewState,o=s.center,r=s.resolution,a=s.rotation,l=t.size,c=Math.round(l[0]*n),h=Math.round(l[1]*n),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 hc(Zu(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(o,r,a,n,c,h,_))}postRender(e,t){var R;const n=t.viewHints,s=!(n[ot.ANIMATING]||n[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?O1[r].filter(O=>!Dc.includes(O)):O1[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=Pe(o);let P=!0;for(let O=_.length-1;O>=0;--O){const I=_[O];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 H=M[0].getClipCoords(z);let m=e,b;if(H){b=new Md,m=b.getContext();for(let S=0,L=v.length;S<L;++S)if(g!==k&&k<E[S]){const N=v[S];pt([H[0],H[3],H[4],H[7]],[N[0],N[3],N[4],N[7]])&&(q||(m.save(),q=!0),m.beginPath(),m.moveTo(H[0],H[1]),m.lineTo(H[2],H[3]),m.lineTo(H[4],H[5]),m.lineTo(H[6],H[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(H),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[O]=b)}e.globalAlpha=a,this.ready=P,this.tileClipContexts_=w,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,n,s,o,r){if(!n)return!1;let a=!1;if(Array.isArray(n))for(let l=0,c=n.length;l<c;++l)a=Sc(s,e,n[l],t,this.boundHandleStyleImageChange_,void 0,o,r)||a;else a=Sc(s,e,n,t,this.boundHandleStyleImageChange_,void 0,o,r);return a}tileImageNeedsRender_(e){const t=this.getLayer();if(t.getRenderMode()==="vector")return!1;const n=e.getReplayState(t),s=t.getRevision(),o=e.wantedResolution;return n.renderedTileResolution!==o||n.renderedTileRevision!==s}renderTileImage_(e,t){const n=this.getLayer(),s=e.getReplayState(n),o=n.getRevision(),r=e.executorGroups[Pe(n)];s.renderedTileRevision=o;const a=e.wrappedTileCoord,l=a[0],c=n.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=Rm(this.tmpTransform_);Zu(I,C,C),E.setTransform.apply(E,I)}const P=f.getTileCoordExtent(a,this.tempExtent),R=_/v,O=Rm(this.tmpTransform_);Zu(O,R,-R),yb(O,-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],O,0,!0,GT[n.getRenderMode()],null);s.renderedTileResolution=e.wantedResolution}}class zh extends Uc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const n=e.cacheSize===void 0?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n;const s=e.renderMode||"hybrid";Ve(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 qT(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(Gs.PRELOAD)}getUseInterimTilesOnError(){return this.get(Gs.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(Gs.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(Gs.USE_INTERIM_TILES_ON_ERROR,e)}}class dp extends Dh{constructor(e){const t=e.projection||"EPSG:3857",n=e.extent||Ka(t),s=e.tileGrid||Ir({extent:n,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:A1,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,n){if(n.getState()===se.IDLE){n.setState(se.LOADING);const s=n.wrappedTileCoord,o=this.getTileGridForProjection(t);let r=o.getTileCoordExtent(s);const a=s[0],l=o.getResolution(a);pi(r,-l,r);const c=this.projection;t&&this.projection&&!Wt(t,c)&&(r=sa(r,t,c));const h=this.tileGrid,u=h.getExtent();u&&Xn(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,_?se.IDLE:se.EMPTY,_,this.format_,this.tileLoadFunction));const v=this.sourceTiles_[_];n.sourceTiles.push(v),this.tileKeysBySourceTileUrl_[_]||(this.tileKeysBySourceTileUrl_[_]=[]),this.tileKeysBySourceTileUrl_[_].push(n.getKey());const E=v.getState();if(E<se.LOADED){const w=C=>{this.handleTileChange(C);const P=v.getState();if(P===se.LOADED||P===se.ERROR){const R=v.getKey();R in n.errorTileKeys?v.getState()===se.LOADED&&delete n.errorTileKeys[R]:n.loadingSourceTiles--,P===se.ERROR?n.errorTileKeys[R]=!0:v.removeEventListener(_e.CHANGE,w),n.loadingSourceTiles===0&&n.setState(_s(n.errorTileKeys)?se.LOADED:se.ERROR)}};v.addEventListener(_e.CHANGE,w),n.loadingSourceTiles++}E===se.IDLE&&(v.extent=h.getTileCoordExtent(g),v.projection=this.projection,v.resolution=h.getResolution(g[0]),v.load())}),n.loadingSourceTiles||n.setState(n.sourceTiles.some(g=>g.getState()===se.ERROR)?se.ERROR:se.LOADED)}return n.sourceTiles}removeSourceTiles(e){const t=e.getKey(),n=e.sourceTiles;for(let s=0,o=n.length;s<o;++s){const r=n[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,n,s,o){const r=[e,t,n];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);pi(f,-h.getResolution(e),f),pt(l,!o||!c||Wt(o,c)?f:sa(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);pi(E,-g,E),f.forEachTileCoord(!o||!c||Wt(o,c)?E:sa(E,o,c),v,w=>{u=u&&!this.tileUrlFunction(w,s,c)})}const d=new Ex(r,u?se.EMPTY:se.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 n=this.tileGrids_[t];if(!n){const s=this.projection;if(s!==null&&!Wt(s,e))return ap(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=ny+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]);n=new Vs({extent:o.getExtent(),origins:a,resolutions:r,tileSizes:l}),this.tileGrids_[t]=n}return n}getTilePixelRatio(e){return e}getTilePixelSize(e,t,n){const s=this.getTileGridForProjection(n),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 A1(i,e){i.setLoader(function(t,n,s){p0(e,i.getFormat(),t,n,s,i.onLoad.bind(i),i.onError.bind(i))})}const fp=65536*65536,M1=1/fp,VT=12,D1=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),pp=0,Nh=1,Qa=2,kh=5;class WT{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,n=this.length){for(;this.pos<n;){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)*fp;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*fp;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 n,s;return s=t[this.pos++],n=s&127,s<128||(s=t[this.pos++],n|=(s&127)<<7,s<128)||(s=t[this.pos++],n|=(s&127)<<14,s<128)||(s=t[this.pos++],n|=(s&127)<<21,s<128)?n:(s=t[this.pos],n|=(s&15)<<28,BT(n,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>=VT&&D1?D1.decode(this.buf.subarray(t,e)):sI(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 n=this.readPackedEnd();for(;this.pos<n;)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===Qa?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===pp)for(;this.buf[this.pos++]>127;);else if(t===Qa)this.pos=this.readVarint()+this.pos;else if(t===kh)this.pos+=4;else if(t===Nh)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 n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.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*M1),!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*M1),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){$T(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=oI(this.buf,e,this.pos);const n=this.pos-t;n>=128&&F1(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}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 n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;const n=this.pos;e(t,this);const s=this.pos-n;s>=128&&F1(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s}writeMessage(e,t,n){this.writeTag(e,Qa),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,YT,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,ZT,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,JT,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,KT,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,QT,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,eI,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,tI,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,nI,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,iI,t)}writeBytesField(e,t){this.writeTag(e,Qa),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,kh),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,kh),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Nh),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Nh),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,pp),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,pp),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Qa),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,kh),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Nh),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function BT(i,e,t){const n=t.buf;let s,o;if(o=n[t.pos++],s=(o&112)>>4,o<128||(o=n[t.pos++],s|=(o&127)<<3,o<128)||(o=n[t.pos++],s|=(o&127)<<10,o<128)||(o=n[t.pos++],s|=(o&127)<<17,o<128)||(o=n[t.pos++],s|=(o&127)<<24,o<128)||(o=n[t.pos++],s|=(o&1)<<31,o<128))return Or(i,s,e);throw new Error("Expected varint not more than 10 bytes")}function Or(i,e,t){return t?e*4294967296+(i>>>0):(e>>>0)*4294967296+(i>>>0)}function $T(i,e){let t,n;if(i>=0?(t=i%4294967296|0,n=i/4294967296|0):(t=~(-i%4294967296),n=~(-i/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),HT(t,n,e),XT(n,e)}function HT(i,e,t){t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos]=i&127}function XT(i,e){const t=(i&7)<<4;e.buf[e.pos++]|=t|((i>>>=3)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127)))))}function F1(i,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(let s=t.pos-1;s>=i;s--)t.buf[s+n]=t.buf[s]}function YT(i,e){for(let t=0;t<i.length;t++)e.writeVarint(i[t])}function ZT(i,e){for(let t=0;t<i.length;t++)e.writeSVarint(i[t])}function KT(i,e){for(let t=0;t<i.length;t++)e.writeFloat(i[t])}function QT(i,e){for(let t=0;t<i.length;t++)e.writeDouble(i[t])}function JT(i,e){for(let t=0;t<i.length;t++)e.writeBoolean(i[t])}function eI(i,e){for(let t=0;t<i.length;t++)e.writeFixed32(i[t])}function tI(i,e){for(let t=0;t<i.length;t++)e.writeSFixed32(i[t])}function nI(i,e){for(let t=0;t<i.length;t++)e.writeFixed64(i[t])}function iI(i,e){for(let t=0;t<i.length;t++)e.writeSFixed64(i[t])}function sI(i,e,t){let n="",s=e;for(;s<t;){const o=i[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=i[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=i[s+1],c=i[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=i[s+1],c=i[s+2],h=i[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,n+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),n+=String.fromCharCode(r),s+=a}return n}function oI(i,e,t){for(let n=0,s,o;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){i[t++]=239,i[t++]=191,i[t++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===e.length?(i[t++]=239,i[t++]=191,i[t++]=189):o=s;continue}else o&&(i[t++]=239,i[t++]=191,i[t++]=189,o=null);s<128?i[t++]=s:(s<2048?i[t++]=s>>6|192:(s<65536?i[t++]=s>>12|224:(i[t++]=s>>18|240,i[t++]=s>>12&63|128),i[t++]=s>>6&63|128),i[t++]=s&63|128)}return t}class L1{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=An,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let n=t.dataProjection?De(t.dataProjection):this.readProjection(e);t.extent&&n&&n.getUnits()==="tile-pixels"&&(n=De(n),n.setWorldExtent(t.extent)),t={dataProjection:n,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return we()}readFeature(e,t){return we()}readFeatures(e,t){return we()}readGeometry(e,t){return we()}readProjection(e){return we()}writeFeature(e,t){return we()}writeFeatures(e,t){return we()}writeGeometry(e,t){return we()}}function jh(i,e,t){const n=t?De(t.featureProjection):null,s=t?De(t.dataProjection):null;let o=i;if(n&&s&&!Wt(n,s)){e&&(o=i.clone());const r=e?n:s,a=e?s:n;r.getUnits()==="tile-pixels"?o.transform(r,a):o.applyTransform(Gi(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===i&&(o=i.clone()),o.applyTransform(a)}return o}const rI={Point:wn,LineString:Qn,Polygon:Kn,MultiPoint:er,MultiLineString:fo,MultiPolygon:_a};function aI(i,e,t){return Array.isArray(e[0])?(qm(i,0,e,t)||(i=i.slice(),ld(i,0,e,t)),i):(ad(i,0,e,t)||(i=i.slice(),pc(i,0,e,t)),i)}function z1(i,e){var o;const t=i.geometry;if(!t)return[];if(Array.isArray(t))return t.map(r=>z1({...i,geometry:r})).flat();const n=t.type==="MultiPolygon"?"Polygon":t.type;if(n==="GeometryCollection"||n==="Circle")throw new Error("Unsupported geometry type: "+n);const s=t.layout.length;return jh(new Bt(n,n==="Polygon"?aI(t.flatCoordinates,t.ends,s):t.flatCoordinates,(o=t.ends)==null?void 0:o.flat(),s,i.properties||{},i.id).enableSimplifyTransformed(),!1,e)}function gp(i,e){if(!i)return null;if(Array.isArray(i)){const n=i.map(s=>gp(s,e));return new Rc(n)}const t=rI[i.type];return jh(new t(i.flatCoordinates,i.layout||"XY",i.ends),!1,e)}class mp extends L1{constructor(e){super(),e=e||{},this.dataProjection=new ta({code:"",units:"tile-pixels"}),this.featureClass=e.featureClass?e.featureClass:Bt,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,n,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),n.push(l,c),h+=2;else if(r===7)h>u&&(n.push(n[u],n[u+1]),h+=2);else throw new Error("Invalid command found in the PBF")}h>u&&(s.push(h),u=h)}createFeature_(e,t,n){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=dI(s,c.length);if(this.featureClass===Bt)o=new this.featureClass(h,l,c,2,r,a),o.transform(n.dataProjection);else{let u;if(h=="Polygon"){const g=Vm(l,c);u=g.length>1?new _a(l,"XY",g):new Kn(l,"XY",c)}else u=h==="Point"?new wn(l,"XY"):h==="LineString"?new Qn(l,"XY"):h==="MultiPoint"?new er(l,"XY"):h==="MultiLineString"?new fo(l,"XY",c):null;const d=this.featureClass;o=new d,this.geometryName_&&o.setGeometryName(this.geometryName_);const f=jh(u,!1,n);o.setGeometry(f),a!==void 0&&o.setId(a),o.setProperties(r,!0)}return o}getType(){return"arraybuffer"}readFeatures(e,t){const n=this.layers_;t=this.adaptOptions(t);const s=De(t.dataProjection);s.setWorldExtent(t.extent),t.dataProjection=s;const o=new WT(e),r=o.readFields(lI,{}),a=[];for(const l in r){if(n&&!n.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=uI(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 lI(i,e,t){if(i===3){const n={keys:[],values:[],features:[]},s=t.readVarint()+t.pos;t.readFields(cI,n,s),n.length=n.features.length,n.length&&(e[n.name]=n)}}function cI(i,e,t){if(i===15)e.version=t.readVarint();else if(i===1)e.name=t.readString();else if(i===5)e.extent=t.readVarint();else if(i===2)e.features.push(t.pos);else if(i===3)e.keys.push(t.readString());else if(i===4){let n=null;const s=t.readVarint()+t.pos;for(;t.pos<s;)i=t.readVarint()>>3,n=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null;e.values.push(n)}}function hI(i,e,t){if(i==1)e.id=t.readVarint();else if(i==2){const n=t.readVarint()+t.pos;for(;t.pos<n;){const s=e.layer.keys[t.readVarint()],o=e.layer.values[t.readVarint()];e.properties[s]=o}}else i==3?e.type=t.readVarint():i==4&&(e.geometry=t.pos)}function uI(i,e,t){i.pos=e.features[t];const n=i.readVarint()+i.pos,s={layer:e,type:0,properties:{}};return i.readFields(hI,s,n),s}function dI(i,e){let t;return i===1?t=e===1?"Point":"MultiPoint":i===2?t=e===1?"LineString":"MultiLineString":i===3&&(t="Polygon"),t}var fI=8,pI={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"}},gI={"*":{type:"source"}},mI=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],yI={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:"*"}},_I={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:"*"}},wI={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:"*"}},vI={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"}},bI={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"}}},EI={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"}}},CI={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"}},xI=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],PI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},SI={"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"}},RI={"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"}},TI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},II={"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"}},OI={"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"}},AI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},MI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},DI={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},FI={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},LI={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},zI={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},NI={type:"array",value:"expression_name",minimum:1},kI={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}},jI={"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}},UI={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},GI={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},qI=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],VI={"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"}},WI={"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"}},BI={"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"}},$I={"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"}},HI={"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"}},XI={"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"}},YI={"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"}},ZI={"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"}},KI={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},QI={"*":{type:"string"}},JI={type:"array",value:"interpolation_name",minimum:1},e2={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"}]}}}},t2={$version:fI,$root:pI,sources:gI,source:mI,source_vector:yI,source_raster:_I,source_raster_dem:wI,source_geojson:vI,source_video:bI,source_image:EI,layer:CI,layout:xI,layout_background:PI,layout_fill:SI,layout_circle:RI,layout_heatmap:TI,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:II,layout_symbol:OI,layout_raster:AI,layout_hillshade:MI,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:DI,filter_operator:FI,geometry_type:LI,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:zI,expression:NI,light:kI,sky:jI,terrain:UI,projection:GI,paint:qI,paint_fill:VI,"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:WI,paint_circle:BI,paint_heatmap:$I,paint_symbol:HI,paint_raster:XI,paint_hillshade:YI,"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:ZI,transition:KI,"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:QI,interpolation:JI,interpolation_name:e2};const n2=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function i2(i,e){const t={};for(const n in i)n!=="ref"&&(t[n]=i[n]);return n2.forEach(n=>{n in e&&(t[n]=e[n])}),t}function s2(i){i=i.slice();const e=Object.create(null);for(let t=0;t<i.length;t++)e[i[t].id]=i[t];for(let t=0;t<i.length;t++)"ref"in i[t]&&(i[t]=i2(i[t],e[i[t].ref]));return i}class Ti extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class yp{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[n,s]of t)this.bindings[n]=s}concat(e){return new yp(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 Uh={kind:"null"},ne={kind:"number"},be={kind:"string"},Re={kind:"boolean"},Ii={kind:"color"},Gh={kind:"projectionDefinition"},Po={kind:"object"},Se={kind:"value"},o2={kind:"error"},qh={kind:"collator"},Vh={kind:"formatted"},Wh={kind:"padding"},Ja={kind:"colorArray"},Bh={kind:"numberArray"},el={kind:"resolvedImage"},$h={kind:"variableAnchorOffsetCollection"};function en(i,e){return{kind:"array",itemType:i,N:e}}function ut(i){if(i.kind==="array"){const e=ut(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}else return i.kind}const r2=[Uh,ne,be,Re,Ii,Gh,Vh,Po,en(Se),Wh,Bh,Ja,el,$h];function tl(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tl(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const t of r2)if(!tl(t,e))return null}}return`Expected ${ut(i)} but found ${ut(e)} instead.`}function _p(i,e){return e.some(t=>t.kind===i.kind)}function So(i,e){return e.some(t=>t==="null"?i===null:t==="array"?Array.isArray(i):t==="object"?i&&!Array.isArray(i)&&typeof i=="object":t===typeof i)}function Ws(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const N1=.96422,k1=1,j1=.82521,U1=4/29,Ar=6/29,G1=3*Ar*Ar,a2=Ar*Ar*Ar,l2=Math.PI/180,c2=180/Math.PI;function q1(i){return i=i%360,i<0&&(i+=360),i}function V1([i,e,t,n]){i=wp(i),e=wp(e),t=wp(t);let s,o;const r=vp((.2225045*i+.7168786*e+.0606169*t)/k1);i===e&&e===t?s=o=r:(s=vp((.4360747*i+.3850649*e+.1430804*t)/N1),o=vp((.0139322*i+.0971045*e+.7141733*t)/j1));const a=116*r-16;return[a<0?0:a,500*(s-r),200*(r-o),n]}function wp(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function vp(i){return i>a2?Math.pow(i,1/3):i/G1+U1}function W1([i,e,t,n]){let s=(i+16)/116,o=isNaN(e)?s:s+e/500,r=isNaN(t)?s:s-t/200;return s=k1*Ep(s),o=N1*Ep(o),r=j1*Ep(r),[bp(3.1338561*o-1.6168667*s-.4906146*r),bp(-.9787684*o+1.9161415*s+.033454*r),bp(.0719453*o-.2289914*s+1.4052427*r),n]}function bp(i){return i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055,i<0?0:i>1?1:i}function Ep(i){return i>Ar?i*i*i:G1*(i-U1)}function h2(i){const[e,t,n,s]=V1(i),o=Math.sqrt(t*t+n*n);return[Math.round(o*1e4)?q1(Math.atan2(n,t)*c2):NaN,o,e,s]}function u2([i,e,t,n]){return i=isNaN(i)?0:i*l2,W1([t,Math.cos(i)*e,Math.sin(i)*e,n])}function d2([i,e,t,n]){i=q1(i),e/=100,t/=100;function s(o){const r=(o+i/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),n]}const f2=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function B1(i,e){return f2(i,e)?i[e]:void 0}function p2(i){if(i=i.toLowerCase().trim(),i==="transparent")return[0,0,0,0];const e=B1(g2,i);if(e){const[s,o,r]=e;return[s/255,o/255,r/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){const o=i.length<6?1:2;let r=1;return[Hh(i.slice(r,r+=o)),Hh(i.slice(r,r+=o)),Hh(i.slice(r,r+=o)),Hh(i.slice(r,r+o)||"ff")]}if(i.startsWith("rgb")){const s=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=i.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=[Mr(+a/P,0,1),Mr(+h/P,0,1),Mr(+f/P,0,1),v?$1(+v,E):1];if(H1(R))return R}}return}}const t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=i.match(t);if(n){const[s,o,r,a,l,c,h,u,d]=n,f=[r||" ",l||" ",h].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){const g=[+o,Mr(+a,0,100),Mr(+c,0,100),u?$1(+u,d):1];if(H1(g))return d2(g)}}}function Hh(i){return parseInt(i.padEnd(2,i),16)/255}function $1(i,e){return Mr(e?i/100:i,0,1)}function Mr(i,e,t){return Math.min(Math.max(e,i),t)}function H1(i){return!i.some(Number.isNaN)}const g2={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 Ro(i,e,t){return i+t*(e-i)}function nl(i,e,t){return i.map((n,s)=>Ro(n,e[s],t))}class ke{constructor(e,t,n,s=1,o=!0){this.r=e,this.g=t,this.b=n,this.a=s,o||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,t,n,s]))}static parse(e){if(e instanceof ke)return e;if(typeof e!="string")return;const t=p2(e);if(t)return new ke(...t,!1)}get rgb(){const{r:e,g:t,b:n,a:s}=this,o=s||1/0;return this.overwriteGetter("rgb",[e/o,t/o,n/o,s])}get hcl(){return this.overwriteGetter("hcl",h2(this.rgb))}get lab(){return this.overwriteGetter("lab",V1(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,n,s]=this.rgb;return`rgba(${[e,t,n].map(o=>Math.round(o*255)).join(",")},${s})`}static interpolate(e,t,n,s="rgb"){switch(s){case"rgb":{const[o,r,a,l]=nl(e.rgb,t.rgb,n);return new ke(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+n*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]=u2([f,g??Ro(r,h,n),Ro(a,u,n),Ro(l,d,n)]);return new ke(_,v,E,w,!1)}case"lab":{const[o,r,a,l]=W1(nl(e.lab,t.lab,n));return new ke(o,r,a,l,!1)}}}}ke.black=new ke(0,0,0,1),ke.white=new ke(1,1,1,1),ke.transparent=new ke(0,0,0,0),ke.red=new ke(1,0,0,1);class Cp{constructor(e,t,n){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=n,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 m2=["bottom","center","top"];class xp{constructor(e,t,n,s,o,r){this.text=e,this.image=t,this.scale=n,this.fontStack=s,this.textColor=o,this.verticalAlign=r}}class ns{constructor(e){this.sections=e}static fromString(e){return new ns([new xp(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 ns?e:ns.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class si{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof si)return e;if(typeof e=="number")return new si([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 si(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new si(nl(e.values,t.values,n))}}class oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof oi)return e;if(typeof e=="number")return new oi([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new oi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new oi(nl(e.values,t.values,n))}}class xn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof xn)return e;if(typeof e=="string"){const n=ke.parse(e);return n?new xn([n]):void 0}if(!Array.isArray(e))return;const t=[];for(const n of e){if(typeof n!="string")return;const s=ke.parse(n);if(!s)return;t.push(s)}return new xn(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,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(ke.interpolate(e.values[r],t.values[r],n,s));return new xn(o)}}class yt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const y2=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Oi)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const n=e[t],s=e[t+1];if(typeof n!="string"||!y2.has(n)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Oi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){const s=e.values,o=t.values;if(s.length!==o.length)throw new yt(`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 yt(`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([Ro(l,h,n),Ro(c,u,n)])}return new Oi(r)}}class Bs{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Bs({name:e,available:!1}):null}}class ri{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new ri(e,t,n)}static parse(e){if(e instanceof ri)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ri(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ri(e.from,e.to,e.transition);if(typeof e=="string")return new ri(e,e,1)}}function X1(i,e,t,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,t,n]:[i,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function il(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof ri||i instanceof ke||i instanceof Cp||i instanceof ns||i instanceof si||i instanceof oi||i instanceof xn||i instanceof Oi||i instanceof Bs)return!0;if(Array.isArray(i)){for(const e of i)if(!il(e))return!1;return!0}else if(typeof i=="object"){for(const e in i)if(!il(i[e]))return!1;return!0}else return!1}function It(i){if(i===null)return Uh;if(typeof i=="string")return be;if(typeof i=="boolean")return Re;if(typeof i=="number")return ne;if(i instanceof ke)return Ii;if(i instanceof ri)return Gh;if(i instanceof Cp)return qh;if(i instanceof ns)return Vh;if(i instanceof si)return Wh;if(i instanceof oi)return Bh;if(i instanceof xn)return Ja;if(i instanceof Oi)return $h;if(i instanceof Bs)return el;if(Array.isArray(i)){const e=i.length;let t;for(const n of i){const s=It(n);if(!t)t=s;else{if(t===s)continue;t=Se;break}}return en(t||Se,e)}else return Po}function sl(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof ke||i instanceof ri||i instanceof ns||i instanceof si||i instanceof oi||i instanceof xn||i instanceof Oi||i instanceof Bs?i.toString():JSON.stringify(i)}class Dr{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(!il(e[1]))return t.error("invalid value");const n=e[1];let s=It(n);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 Dr(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Xh={string:be,number:ne,boolean:Re,object:Po};class ai{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 n=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 Xh)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Xh[c],n++}else a=Se;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],n++}s=en(a,l)}else{if(!Xh[o])throw new Error(`Types doesn't contain name = ${o}`);s=Xh[o]}const r=[];for(;n<e.length;n++){const a=t.parse(e[n],n,Se);if(!a)return null;r.push(a)}return new ai(s,r)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(tl(this.type,It(n))){if(t===this.args.length-1)throw new yt(`Expected value to be of type ${ut(this.type)}, but found ${ut(It(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Y1={"to-boolean":Re,"to-color":Ii,"to-number":ne,"to-string":be};class $s{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 n=e[0];if(!Y1[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");const s=Y1[n],o=[];for(let r=1;r<e.length;r++){const a=t.parse(e[r],r,Se);if(!a)return null;o.push(a)}return new $s(s,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,n;for(const s of this.args){if(t=s.evaluate(e),n=null,t instanceof ke)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?n=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:n=X1(t[0],t[1],t[2],t[3]),!n))return new ke(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new yt(n||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const n of this.args){t=n.evaluate(e);const s=si.parse(t);if(s)return s}throw new yt(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=oi.parse(t);if(s)return s}throw new yt(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=xn.parse(t);if(s)return s}throw new yt(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const n of this.args){t=n.evaluate(e);const s=Oi.parse(t);if(s)return s}throw new yt(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const n of this.args){if(t=n.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new yt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return ns.fromString(sl(this.args[0].evaluate(e)));case"resolvedImage":return Bs.fromString(sl(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return sl(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const _2=["Unknown","Point","LineString","Polygon"];class Z1{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"?_2[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=ke.parse(e),this._parseColorCache.set(e,t)),t}}class Yh{constructor(e,t,n=[],s,o=new yp,r=[]){this.registry=e,this.path=n,this.key=n.map(a=>`[${a}]`).join(""),this.scope=o,this.errors=r,this.expectedType=s,this._isConstant=t}parse(e,t,n,s,o={}){return t?this.concat(t,n,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 n(s,o,r){return r==="assert"?new ai(o,[s]):r==="coerce"?new $s(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=n(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=n(r,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(r instanceof Dr)&&r.type.kind!=="resolvedImage"&&this._isConstant(r)){const a=new Z1;try{r=new Dr(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,n){const s=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new Yh(this.registry,this._isConstant,s,t||null,o,this.errors)}error(e,...t){const n=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new Ti(n,e))}checkSubtype(e,t){const n=tl(e,t);return n&&this.error(n),n}}class Zh{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 n=[];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;n.push([r,a])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return s?new Zh(n,s):null}outputDefined(){return this.result.outputDefined()}}class Kh{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 n=e[1];return t.scope.has(n)?new Kh(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Pp{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,ne),s=t.parse(e[2],2,en(t.expectedType||Se));if(!n||!s)return null;const o=s.type;return new Pp(o.itemType,n,s)}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new yt(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new yt(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new yt(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Sp{constructor(e,t){this.type=Re,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 n=t.parse(e[1],1,Se),s=t.parse(e[2],2,Se);return!n||!s?null:_p(n.type,[Re,be,ne,Uh,Se])?new Sp(n,s):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ut(n.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!So(t,["boolean","string","number","null"]))throw new yt(`Expected first argument to be of type boolean, string, number or null, but found ${ut(It(t))} instead.`);if(!So(n,["string","array"]))throw new yt(`Expected second argument to be of type array or string, but found ${ut(It(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Qh{constructor(e,t,n){this.type=ne,this.needle=e,this.haystack=t,this.fromIndex=n}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 n=t.parse(e[1],1,Se),s=t.parse(e[2],2,Se);if(!n||!s)return null;if(!_p(n.type,[Re,be,ne,Uh,Se]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ut(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ne);return o?new Qh(n,s,o):null}else return new Qh(n,s)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!So(t,["boolean","string","number","null"]))throw new yt(`Expected first argument to be of type boolean, string, number or null, but found ${ut(It(t))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),So(n,["string"])){const o=n.indexOf(t,s);return o===-1?-1:[...n.slice(0,o)].length}else{if(So(n,["array"]))return n.indexOf(t,s);throw new yt(`Expected second argument to be of type array or string, but found ${ut(It(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Rp{constructor(e,t,n,s,o,r){this.inputType=e,this.type=t,this.input=n,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 n,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(!n)n=It(g);else if(d.checkSubtype(n,It(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,Se);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(n,a.type)?null:new Rp(n,s,a,o,r,l)}evaluate(e){const t=this.input.evaluate(e);return(It(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 Tp{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}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 n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);const s=[];for(let r=1;r<e.length-1;r+=2){const a=t.parse(e[r],r,Re);if(!a)return null;const l=t.parse(e[r+1],r+1,n);if(!l)return null;s.push([a,l]),n=n||l.type}const o=t.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can't infer output type");return new Tp(n,s,o)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class Jh{constructor(e,t,n,s){this.type=e,this.input=t,this.beginIndex=n,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 n=t.parse(e[1],1,Se),s=t.parse(e[2],2,ne);if(!n||!s)return null;if(!_p(n.type,[en(Se),be,Se]))return t.error(`Expected first argument to be of type array or string, but found ${ut(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ne);return o?new Jh(n.type,n,s,o):null}else return new Jh(n.type,n,s)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),So(t,["string"]))return[...t].slice(n,s).join("");if(So(t,["array"]))return t.slice(n,s);throw new yt(`Expected first argument to be of type array or string, but found ${ut(It(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function K1(i,e){const t=i.length-1;let n=0,s=t,o=0,r,a;for(;n<=s;)if(o=Math.floor((n+s)/2),r=i[o],a=i[o+1],r<=e){if(o===t||e<a)return o;n=o+1}else if(r>e)s=o-1;else throw new yt("Input is not a number.");return 0}class eu{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,o]of n)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 n=t.parse(e[1],1,ne);if(!n)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 eu(o,n,s)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;if(s>=t[o-1])return n[o-1].evaluate(e);const r=K1(t,s);return n[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 w2(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ip,Q1;function v2(){if(Q1)return Ip;Q1=1,Ip=i;function i(e,t,n,s){this.cx=3*e,this.bx=3*(n-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=n,this.p2y=s}return i.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 n=e,s=0;s<8;s++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<t)return n;var r=this.sampleCurveDerivativeX(n);if(Math.abs(r)<1e-6)break;n=n-o/r}var a=0,l=1;for(n=e,s=0;s<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<t));s++)e>o?a=n:l=n,n=(l-a)*.5+a;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Ip}var b2=v2(),E2=w2(b2);class Ai{constructor(e,t,n,s,o){this.type=e,this.operator=t,this.interpolation=n,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,n,s){let o=0;if(e.name==="exponential")o=Op(t,e.base,n,s);else if(e.name==="linear")o=Op(t,1,n,s);else if(e.name==="cubic-bezier"){const r=e.controlPoints;o=new E2(r[0],r[1],r[2],r[3]).solve(Op(t,1,n,s))}return o}static parse(e,t){let[n,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,ne),!o)return null;const a=[];let l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&t.expectedType!=Ja?l=Ii: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!Ws(l,ne)&&!Ws(l,Gh)&&!Ws(l,Ii)&&!Ws(l,Wh)&&!Ws(l,Bh)&&!Ws(l,Ja)&&!Ws(l,$h)&&!Ws(l,en(ne))?t.error(`Type ${ut(l)} is not interpolatable.`):new Ai(l,n,s,o,a)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;if(s>=t[o-1])return n[o-1].evaluate(e);const r=K1(t,s),a=t[r],l=t[r+1],c=Ai.interpolationFactor(this.interpolation,s,a,l),h=n[r].evaluate(e),u=n[r+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ro(h,u,c);case"color":return ke.interpolate(h,u,c);case"padding":return si.interpolate(h,u,c);case"colorArray":return xn.interpolate(h,u,c);case"numberArray":return oi.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Oi.interpolate(h,u,c);case"array":return nl(h,u,c);case"projectionDefinition":return ri.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return ke.interpolate(h,u,c,"hcl");case"colorArray":return xn.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return ke.interpolate(h,u,c,"lab");case"colorArray":return xn.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 Op(i,e,t,n){const s=n-t,o=i-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}class ol{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 n=null;const s=t.expectedType;s&&s.kind!=="value"&&(n=s);const o=[];for(const a of e.slice(1)){const l=t.parse(a,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return s&&o.some(a=>tl(s,a.type))?new ol(Se,o):new ol(n,o)}evaluate(e){let t=null,n=0,s;for(const o of this.args)if(n++,t=o.evaluate(e),t&&t instanceof Bs&&!t.available&&(s||(s=t.name),t=null,n===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 J1(i,e){return i==="=="||i==="!="?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 C2(i,e,t){return e===t}function x2(i,e,t){return e!==t}function P2(i,e,t){return e<t}function S2(i,e,t){return e>t}function R2(i,e,t){return e<=t}function T2(i,e,t){return e>=t}function ew(i,e,t,n){return n.compare(e,t)===0}function I2(i,e,t,n){return!ew(i,e,t,n)}function O2(i,e,t,n){return n.compare(e,t)<0}function A2(i,e,t,n){return n.compare(e,t)>0}function M2(i,e,t,n){return n.compare(e,t)<=0}function D2(i,e,t,n){return n.compare(e,t)>=0}function Fr(i,e,t){const n=i!=="=="&&i!=="!=";return class _v{constructor(o,r,a){this.type=Re,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,Se);if(!l)return null;if(!J1(a,l.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${ut(l.type)}'.`);let c=r.parse(o[2],2,Se);if(!c)return null;if(!J1(a,c.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${ut(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error(`Cannot compare types '${ut(l.type)}' and '${ut(c.type)}'.`);n&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new ai(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new ai(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,qh),!h)return null}return new _v(l,c,h)}evaluate(o){const r=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const l=It(r),c=It(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new yt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const l=It(r),c=It(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 F2=Fr("==",C2,ew),L2=Fr("!=",x2,I2),z2=Fr("<",P2,O2),N2=Fr(">",S2,A2),k2=Fr("<=",R2,M2),j2=Fr(">=",T2,D2);class tu{constructor(e,t,n){this.type=qh,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object.");const s=t.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,Re);if(!s)return null;const o=t.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,Re);if(!o)return null;let r=null;return n.locale&&(r=t.parse(n.locale,1,be),!r)?null:new tu(s,o,r)}evaluate(e){return new Cp(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 Ap{constructor(e,t,n,s,o,r){this.type=be,this.number=e,this.locale=t,this.currency=n,this.unit=s,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const n=t.parse(e[1],1,ne);if(!n)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,be),!o))return null;let r=null;if(s.currency&&(r=t.parse(s.currency,1,be),!r))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,be),!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,ne),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=t.parse(s["max-fraction-digits"],1,ne),!c)?null:new Ap(n,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 Mp{constructor(e){this.type=Vh,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="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,ne),!l))return null;let c=null;if(a["text-font"]&&(c=t.parse(a["text-font"],1,en(be)),!c))return null;let h=null;if(a["text-color"]&&(h=t.parse(a["text-color"],1,Ii),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!m2.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,be),!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,Se);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 Mp(s)}evaluate(e){const t=n=>{const s=n.content.evaluate(e);return It(s)===el?new xp("",s,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new xp(sl(s),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new ns(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 Dp{constructor(e){this.type=el,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const n=t.parse(e[1],1,be);return n?new Dp(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=Bs.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class Fp{constructor(e){this.type=ne,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${ut(n.type)} instead.`):new Fp(n):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 yt(`Expected value to be of type string or array, but found ${ut(It(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Mi=8192;function U2(i,e){const t=G2(i[0]),n=V2(i[1]),s=Math.pow(2,e.z);return[Math.round(t*s*Mi),Math.round(n*s*Mi)]}function Lp(i,e){const t=Math.pow(2,e.z),n=(i[0]/Mi+e.x)/t,s=(i[1]/Mi+e.y)/t;return[q2(n),W2(s)]}function G2(i){return(180+i)/360}function q2(i){return i*360-180}function V2(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function W2(i){return 360/Math.PI*Math.atan(Math.exp((180-i*360)*Math.PI/180))-90}function rl(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function al(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function B2(i,e,t){return e[1]>i[1]!=t[1]>i[1]&&i[0]<(t[0]-e[0])*(i[1]-e[1])/(t[1]-e[1])+e[0]}function $2(i,e,t){const n=i[0]-e[0],s=i[1]-e[1],o=i[0]-t[0],r=i[1]-t[1];return n*r-o*s===0&&n*o<=0&&s*r<=0}function nu(i,e,t,n){const s=[e[0]-i[0],e[1]-i[1]],o=[n[0]-t[0],n[1]-t[1]];return Z2(o,s)===0?!1:!!(nw(i,e,t,n)&&nw(t,n,i,e))}function H2(i,e,t){for(const n of t)for(let s=0;s<n.length-1;++s)if(nu(i,e,n[s],n[s+1]))return!0;return!1}function Lr(i,e,t=!1){let n=!1;for(const s of e)for(let o=0;o<s.length-1;o++){if($2(i,s[o],s[o+1]))return t;B2(i,s[o],s[o+1])&&(n=!n)}return n}function X2(i,e){for(const t of e)if(Lr(i,t))return!0;return!1}function tw(i,e){for(const t of i)if(!Lr(t,e))return!1;for(let t=0;t<i.length-1;++t)if(H2(i[t],i[t+1],e))return!1;return!0}function Y2(i,e){for(const t of e)if(tw(i,t))return!0;return!1}function Z2(i,e){return i[0]*e[1]-i[1]*e[0]}function nw(i,e,t,n){const s=i[0]-t[0],o=i[1]-t[1],r=e[0]-t[0],a=e[1]-t[1],l=n[0]-t[0],c=n[1]-t[1],h=s*c-l*o,u=r*c-l*a;return h>0&&u<0||h<0&&u>0}function zp(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=[];for(let r=0;r<i[s].length;r++){const a=U2(i[s][r],t);rl(e,a),o.push(a)}n.push(o)}return n}function iw(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=zp(i[s],e,t);n.push(o)}return n}function sw(i,e,t,n){if(i[0]<t[0]||i[0]>t[2]){const s=n*.5;let o=i[0]-t[0]>s?-n:t[0]-i[0]>s?n:0;o===0&&(o=i[0]-t[2]>s?-n:t[2]-i[0]>s?n:0),i[0]+=o}rl(e,i)}function K2(i){i[0]=i[1]=1/0,i[2]=i[3]=-1/0}function ow(i,e,t,n){const s=Math.pow(2,n.z)*Mi,o=[n.x*Mi,n.y*Mi],r=[];for(const a of i)for(const l of a){const c=[l.x+o[0],l.y+o[1]];sw(c,e,t,s),r.push(c)}return r}function rw(i,e,t,n){const s=Math.pow(2,n.z)*Mi,o=[n.x*Mi,n.y*Mi],r=[];for(const a of i){const l=[];for(const c of a){const h=[c.x+o[0],c.y+o[1]];rl(e,h),l.push(h)}r.push(l)}if(e[2]-e[0]<=s/2){K2(e);for(const a of r)for(const l of a)sw(l,e,t,s)}return r}function Q2(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=zp(e.coordinates,n,s),r=ow(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!Lr(a,o))return!1}if(e.type==="MultiPolygon"){const o=iw(e.coordinates,n,s),r=ow(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!X2(a,o))return!1}return!0}function J2(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=zp(e.coordinates,n,s),r=rw(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!tw(a,o))return!1}if(e.type==="MultiPolygon"){const o=iw(e.coordinates,n,s),r=rw(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!Y2(a,o))return!1}return!0}class To{constructor(e,t){this.type=Re,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(il(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const s=[];for(const o of n.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 To(n,o)}}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new To(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new To(n,n)}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 Q2(e,this.geometries);if(e.geometryType()==="LineString")return J2(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class aw{constructor(e=[],t=(n,s)=>n<s?-1:n>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}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:n}=this,s=t[e];for(;e>0;){const o=e-1>>1,r=t[o];if(n(s,r)>=0)break;t[e]=r,e=o}t[e]=s}_down(e){const{data:t,compare:n}=this,s=this.length>>1,o=t[e];for(;e<s;){let r=(e<<1)+1;const a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],o)>=0)break;t[e]=t[r],e=r}t[e]=o}}function eO(i,e){if(i.length<=1)return[i];const n=[];let s,o;for(const r of i){const a=tO(r);a!==0&&(r.area=Math.abs(a),o===void 0&&(o=a<0),o===a<0?(s&&n.push(s),s=[r]):s.push(r))}return s&&n.push(s),n}function tO(i){let e=0;for(let t=0,n=i.length,s=n-1,o,r;t<n;s=t++)o=i[t],r=i[s],e+=(r.x-o.x)*(o.y+r.y);return e}const nO=6378.137,lw=1/298.257223563,cw=lw*(2-lw),hw=Math.PI/180;class Np{constructor(e){const t=hw*nO*1e3,n=Math.cos(e*hw),s=1/(1-cw*(1-n*n)),o=Math.sqrt(s);this.kx=t*o*n,this.ky=t*o*s*(1-cw)}distance(e,t){const n=this.wrap(e[0]-t[0])*this.kx,s=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+s*s)}pointOnLine(e,t){let n=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<n&&(n=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 kp=100,jp=50;function uw(i,e){return e[0]-i[0]}function iu(i){return i[1]-i[0]+1}function is(i,e){return i[1]>=i[0]&&i[1]<e}function Up(i,e){if(i[0]>i[1])return[null,null];const t=iu(i);if(e){if(t===2)return[i,null];const s=Math.floor(t/2);return[[i[0],i[0]+s],[i[0]+s,i[1]]]}if(t===1)return[i,null];const n=Math.floor(t/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}function Gp(i,e){if(!is(e,i.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)rl(t,i[n]);return t}function qp(i){const e=[1/0,1/0,-1/0,-1/0];for(const t of i)for(const n of t)rl(e,n);return e}function dw(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Vp(i,e,t){if(!dw(i)||!dw(e))return NaN;let n=0,s=0;return i[2]<e[0]&&(n=e[0]-i[2]),i[0]>e[2]&&(n=i[0]-e[2]),i[1]>e[3]&&(s=i[1]-e[3]),i[3]<e[1]&&(s=e[1]-i[3]),t.distance([0,0],[n,s])}function Io(i,e,t){const n=t.pointOnLine(e,i);return t.distance(i,n.point)}function Wp(i,e,t,n,s){const o=Math.min(Io(i,[t,n],s),Io(e,[t,n],s)),r=Math.min(Io(t,[i,e],s),Io(n,[i,e],s));return Math.min(o,r)}function iO(i,e,t,n,s){if(!(is(e,i.length)&&is(n,t.length)))return 1/0;let r=1/0;for(let a=e[0];a<e[1];++a){const l=i[a],c=i[a+1];for(let h=n[0];h<n[1];++h){const u=t[h],d=t[h+1];if(nu(l,c,u,d))return 0;r=Math.min(r,Wp(l,c,u,d,s))}}return r}function sO(i,e,t,n,s){if(!(is(e,i.length)&&is(n,t.length)))return NaN;let r=1/0;for(let a=e[0];a<=e[1];++a)for(let l=n[0];l<=n[1];++l)if(r=Math.min(r,s.distance(i[a],t[l])),r===0)return r;return r}function oO(i,e,t){if(Lr(i,e,!0))return 0;let n=1/0;for(const s of e){const o=s[0],r=s[s.length-1];if(o!==r&&(n=Math.min(n,Io(i,[r,o],t)),n===0))return n;const a=t.pointOnLine(s,i);if(n=Math.min(n,t.distance(i,a.point)),n===0)return n}return n}function rO(i,e,t,n){if(!is(e,i.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Lr(i[o],t,!0))return 0;let s=1/0;for(let o=e[0];o<e[1];++o){const r=i[o],a=i[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(nu(r,a,d,f))return 0;s=Math.min(s,Wp(r,a,d,f,n))}}return s}function fw(i,e){for(const t of i)for(const n of t)if(Lr(n,e,!0))return!0;return!1}function aO(i,e,t,n=1/0){const s=qp(i),o=qp(e);if(n!==1/0&&Vp(s,o,t)>=n)return n;if(al(s,o)){if(fw(i,e))return 0}else if(fw(e,i))return 0;let r=1/0;for(const a of i)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(nu(u,d,E,w))return 0;r=Math.min(r,Wp(u,d,E,w,t))}}return r}function pw(i,e,t,n,s,o){if(!o)return;const r=Vp(Gp(n,o),s,t);r<e&&i.push([r,o,[0,0]])}function su(i,e,t,n,s,o,r){if(!o||!r)return;const a=Vp(Gp(n,o),Gp(s,r),t);a<e&&i.push([a,o,r])}function ou(i,e,t,n,s=1/0){let o=Math.min(n.distance(i[0],t[0][0]),s);if(o===0)return o;const r=new aw([[0,[0,i.length-1],[0,0]]],uw),a=qp(t);for(;r.length>0;){const l=r.pop();if(l[0]>=o)continue;const c=l[1],h=e?jp:kp;if(iu(c)<=h){if(!is(c,i.length))return NaN;if(e){const u=rO(i,c,t,n);if(isNaN(u)||u===0)return u;o=Math.min(o,u)}else for(let u=c[0];u<=c[1];++u){const d=oO(i[u],t,n);if(o=Math.min(o,d),o===0)return 0}}else{const u=Up(c,e);pw(r,o,n,i,a,u[0]),pw(r,o,n,i,a,u[1])}}return o}function ru(i,e,t,n,s,o=1/0){let r=Math.min(o,s.distance(i[0],t[0]));if(r===0)return r;const a=new aw([[0,[0,i.length-1],[0,t.length-1]]],uw);for(;a.length>0;){const l=a.pop();if(l[0]>=r)continue;const c=l[1],h=l[2],u=e?jp:kp,d=n?jp:kp;if(iu(c)<=u&&iu(h)<=d){if(!is(c,i.length)&&is(h,t.length))return NaN;let f;if(e&&n)f=iO(i,c,t,h,s),r=Math.min(r,f);else if(e&&!n){const g=i.slice(c[0],c[1]+1);for(let _=h[0];_<=h[1];++_)if(f=Io(t[_],g,s),r=Math.min(r,f),r===0)return r}else if(!e&&n){const g=t.slice(h[0],h[1]+1);for(let _=c[0];_<=c[1];++_)if(f=Io(i[_],g,s),r=Math.min(r,f),r===0)return r}else f=sO(i,c,t,h,s),r=Math.min(r,f)}else{const f=Up(c,e),g=Up(h,n);su(a,r,s,i,t,f[0],g[0]),su(a,r,s,i,t,f[0],g[1]),su(a,r,s,i,t,f[1],g[0]),su(a,r,s,i,t,f[1],g[1])}}return r}function lO(i,e){const t=i.geometry(),n=t.flat().map(r=>Lp([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new Np(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ru(n,!1,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ru(n,!1,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,ou(n,!1,r.coordinates,s,o));break}if(o===0)return o}return o}function cO(i,e){const t=i.geometry(),n=t.flat().map(r=>Lp([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new Np(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ru(n,!0,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ru(n,!0,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,ou(n,!0,r.coordinates,s,o));break}if(o===0)return o}return o}function hO(i,e){const t=i.geometry();if(t.length===0||t[0].length===0)return NaN;const n=eO(t).map(r=>r.map(a=>a.map(l=>Lp([l.x,l.y],i.canonical)))),s=new Np(n[0][0][0][1]);let o=1/0;for(const r of e)for(const a of n){switch(r.type){case"Point":o=Math.min(o,ou([r.coordinates],!1,a,s,o));break;case"LineString":o=Math.min(o,ou(r.coordinates,!0,a,s,o));break;case"Polygon":o=Math.min(o,aO(a,r.coordinates,s,o));break}if(o===0)return o}return o}function Bp(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class Oo{constructor(e,t){this.type=ne,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(il(e[1])){const n=e[1];if(n.type==="FeatureCollection")return new Oo(n,n.features.map(s=>Bp(s.geometry)).flat());if(n.type==="Feature")return new Oo(n,Bp(n.geometry));if("type"in n&&"coordinates"in n)return new Oo(n,Bp(n))}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 lO(e,this.geometries);if(e.geometryType()==="LineString")return cO(e,this.geometries);if(e.geometryType()==="Polygon")return hO(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class ll{constructor(e){this.type=Se,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=e[1];return n==null?t.error("Global state property must be defined."):typeof n!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new ll(n)}evaluate(e){var t;const n=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!n||Object.keys(n).length===0?null:B1(n,this.key)}eachChild(){}outputDefined(){return!1}}const au={"==":F2,"!=":L2,">":N2,"<":z2,">=":j2,"<=":k2,array:ai,at:Pp,boolean:ai,case:Tp,coalesce:ol,collator:tu,format:Mp,image:Dp,in:Sp,"index-of":Qh,interpolate:Ai,"interpolate-hcl":Ai,"interpolate-lab":Ai,length:Fp,let:Zh,literal:Dr,match:Rp,number:ai,"number-format":Ap,object:ai,slice:Jh,step:eu,string:ai,"to-boolean":$s,"to-color":$s,"to-number":$s,"to-string":$s,var:Kh,within:To,distance:Oo,"global-state":ll};class Pn{constructor(e,t,n,s){this.name=e,this.type=t,this._evaluate=n,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 n=e[0],s=Pn.definitions[n];if(!s)return t.error(`Unknown expression "${n}". 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 Yh(t.registry,lu,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 Pn(n,o,h,u)}}if(a.length===1)t.errors.push(...l.errors);else{const h=(a.length?a:r).map(([d])=>dO(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(ut(f.type))}t.error(`Expected arguments of type ${h}, but found (${u.join(", ")}) instead.`)}return null}static register(e,t){Pn.definitions=t;for(const n in t)e[n]=Pn}}function gw(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const o=s?s.evaluate(i):1,r=X1(e,t,n,o);if(r)throw new yt(r);return new ke(e/255,t/255,n/255,o,!1)}function mw(i,e){return i in e}function $p(i,e){const t=e[i];return typeof t>"u"?null:t}function uO(i,e,t,n){for(;t<=n;){const s=t+n>>1;if(e[s]===i)return!0;e[s]>i?n=s-1:t=s+1}return!1}function Ao(i){return{type:i}}Pn.register(au,{error:[o2,[be],(i,[e])=>{throw new yt(e.evaluate(i))}],typeof:[be,[Se],(i,[e])=>ut(It(e.evaluate(i)))],"to-rgba":[en(ne,4),[Ii],(i,[e])=>{const[t,n,s,o]=e.evaluate(i).rgb;return[t*255,n*255,s*255,o]}],rgb:[Ii,[ne,ne,ne],gw],rgba:[Ii,[ne,ne,ne,ne],gw],has:{type:Re,overloads:[[[be],(i,[e])=>mw(e.evaluate(i),i.properties())],[[be,Po],(i,[e,t])=>mw(e.evaluate(i),t.evaluate(i))]]},get:{type:Se,overloads:[[[be],(i,[e])=>$p(e.evaluate(i),i.properties())],[[be,Po],(i,[e,t])=>$p(e.evaluate(i),t.evaluate(i))]]},"feature-state":[Se,[be],(i,[e])=>$p(e.evaluate(i),i.featureState||{})],properties:[Po,[],i=>i.properties()],"geometry-type":[be,[],i=>i.geometryType()],id:[Se,[],i=>i.id()],zoom:[ne,[],i=>i.globals.zoom],"heatmap-density":[ne,[],i=>i.globals.heatmapDensity||0],elevation:[ne,[],i=>i.globals.elevation||0],"line-progress":[ne,[],i=>i.globals.lineProgress||0],accumulated:[Se,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ne,Ao(ne),(i,e)=>{let t=0;for(const n of e)t+=n.evaluate(i);return t}],"*":[ne,Ao(ne),(i,e)=>{let t=1;for(const n of e)t*=n.evaluate(i);return t}],"-":{type:ne,overloads:[[[ne,ne],(i,[e,t])=>e.evaluate(i)-t.evaluate(i)],[[ne],(i,[e])=>-e.evaluate(i)]]},"/":[ne,[ne,ne],(i,[e,t])=>e.evaluate(i)/t.evaluate(i)],"%":[ne,[ne,ne],(i,[e,t])=>e.evaluate(i)%t.evaluate(i)],ln2:[ne,[],()=>Math.LN2],pi:[ne,[],()=>Math.PI],e:[ne,[],()=>Math.E],"^":[ne,[ne,ne],(i,[e,t])=>Math.pow(e.evaluate(i),t.evaluate(i))],sqrt:[ne,[ne],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ne,[ne],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ne,[ne],(i,[e])=>Math.log(e.evaluate(i))],log2:[ne,[ne],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ne,[ne],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ne,[ne],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ne,[ne],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ne,[ne],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ne,[ne],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ne,[ne],(i,[e])=>Math.atan(e.evaluate(i))],min:[ne,Ao(ne),(i,e)=>Math.min(...e.map(t=>t.evaluate(i)))],max:[ne,Ao(ne),(i,e)=>Math.max(...e.map(t=>t.evaluate(i)))],abs:[ne,[ne],(i,[e])=>Math.abs(e.evaluate(i))],round:[ne,[ne],(i,[e])=>{const t=e.evaluate(i);return t<0?-Math.round(-t):Math.round(t)}],floor:[ne,[ne],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ne,[ne],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Re,[be,Se],(i,[e,t])=>i.properties()[e.value]===t.value],"filter-id-==":[Re,[Se],(i,[e])=>i.id()===e.value],"filter-type-==":[Re,[be],(i,[e])=>i.geometryType()===e.value],"filter-<":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<s}],"filter-id-<":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>s}],"filter-id->":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[Re,[Se],(i,[e])=>e.value in i.properties()],"filter-has-id":[Re,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Re,[en(be)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Re,[en(Se)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Re,[be,en(Se)],(i,[e,t])=>t.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Re,[be,en(Se)],(i,[e,t])=>uO(i.properties()[e.value],t.value,0,t.value.length-1)],all:{type:Re,overloads:[[[Re,Re],(i,[e,t])=>e.evaluate(i)&&t.evaluate(i)],[Ao(Re),(i,e)=>{for(const t of e)if(!t.evaluate(i))return!1;return!0}]]},any:{type:Re,overloads:[[[Re,Re],(i,[e,t])=>e.evaluate(i)||t.evaluate(i)],[Ao(Re),(i,e)=>{for(const t of e)if(t.evaluate(i))return!0;return!1}]]},"!":[Re,[Re],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Re,[be],(i,[e])=>{const t=i.globals&&i.globals.isSupportedScript;return t?t(e.evaluate(i)):!0}],upcase:[be,[be],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[be,[be],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[be,Ao(Se),(i,e)=>e.map(t=>sl(t.evaluate(i))).join("")],split:[en(be),[be,be],(i,[e,t])=>e.evaluate(i).split(t.evaluate(i))],join:[be,[en(be),be],(i,[e,t])=>e.evaluate(i).join(t.evaluate(i))],"resolved-locale":[be,[qh],(i,[e])=>e.evaluate(i).resolvedLocale()]});function dO(i){return Array.isArray(i)?`(${i.map(ut).join(", ")})`:`(${ut(i.type)}...)`}function lu(i){if(i instanceof Kh)return lu(i.boundExpression);if(i instanceof Pn&&i.name==="error")return!1;if(i instanceof tu)return!1;if(i instanceof To)return!1;if(i instanceof Oo)return!1;if(i instanceof ll)return!1;const e=i instanceof $s||i instanceof ai;let t=!0;return i.eachChild(n=>{e?t=t&&lu(n):t=t&&n instanceof Dr}),t?Hp(i)&&Yp(i,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Hp(i){if(i instanceof Pn){if(i.name==="get"&&i.args.length===1)return!1;if(i.name==="feature-state")return!1;if(i.name==="has"&&i.args.length===1)return!1;if(i.name==="properties"||i.name==="geometry-type"||i.name==="id")return!1;if(/^filter-/.test(i.name))return!1}if(i instanceof To||i instanceof Oo)return!1;let e=!0;return i.eachChild(t=>{e&&!Hp(t)&&(e=!1)}),e}function Xp(i){if(i instanceof Pn&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(t=>{e&&!Xp(t)&&(e=!1)}),e}function Yp(i,e){if(i instanceof Pn&&e.indexOf(i.name)>=0)return!1;let t=!0;return i.eachChild(n=>{t&&!Yp(n,e)&&(t=!1)}),t}function Zp(i){return{result:"success",value:i}}function zr(i){return{result:"error",value:i}}function fO(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function pO(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function gO(i){return!!i.expression&&i.expression.interpolated}function cu(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&It(i)===Po}class mO{constructor(e,t,n){this.expression=e,this._warningHistory={},this._evaluator=new Z1,this._defaultValue=t?_O(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this._globalState=n}evaluateWithoutErrorHandling(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,s,o,r){this._globalState&&(e=Nr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||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 yt(`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 hu(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in au}function yw(i,e,t){const n=new Yh(au,lu,[],e?yO(e):void 0),s=n.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Zp(new mO(s,e,t)):zr(n.errors)}class _w{constructor(e,t,n){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Xp(t.expression),this.globalStateRefs=du(t.expression),this._globalState=n}evaluateWithoutErrorHandling(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,o,r)}evaluate(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluate(e,t,n,s,o,r)}}class ww{constructor(e,t,n,s,o){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Xp(t.expression),this.globalStateRefs=du(t.expression),this.interpolationType=s,this._globalState=o}evaluateWithoutErrorHandling(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,o,r)}evaluate(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluate(e,t,n,s,o,r)}interpolationFactor(e,t,n){return this.interpolationType?Ai.interpolationFactor(this.interpolationType,e,t,n):0}}function vw(i,e,t){const n=yw(i,e,t);if(n.result==="error")return n;const s=n.value.expression,o=Hp(s);if(!o&&!fO(e))return zr([new Ti("","data expressions not supported")]);const r=Yp(s,["zoom"]);if(!r&&!pO(e))return zr([new Ti("","zoom expressions not supported")]);const a=uu(s);if(!a&&!r)return zr([new Ti("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Ti)return zr([a]);if(a instanceof Ai&&!gO(e))return zr([new Ti("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Zp(o?new _w("constant",n.value,t):new _w("source",n.value,t));const l=a instanceof Ai?a.interpolation:void 0;return Zp(o?new ww("camera",n.value,a.labels,l,t):new ww("composite",n.value,a.labels,l,t))}function uu(i){let e=null;if(i instanceof Zh)e=uu(i.result);else if(i instanceof ol){for(const t of i.args)if(e=uu(t),e)break}else(i instanceof eu||i instanceof Ai)&&i.input instanceof Pn&&i.input.name==="zoom"&&(e=i);return e instanceof Ti||i.eachChild(t=>{const n=uu(t);n instanceof Ti?e=n:!e&&n?e=new Ti("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new Ti("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function du(i,e=new Set){return i instanceof ll&&e.add(i.key),i.eachChild(t=>{du(t,e)}),e}function yO(i){const e={color:Ii,string:be,number:ne,enum:be,boolean:Re,formatted:Vh,padding:Wh,numberArray:Bh,colorArray:Ja,projectionDefinition:Gh,resolvedImage:el,variableAnchorOffsetCollection:$h};return i.type==="array"?en(e[i.value]||Se,i.length):e[i.type]}function _O(i){if(i.type==="color"&&cu(i.default))return new ke(0,0,0,0);switch(i.type){case"color":return ke.parse(i.default)||null;case"padding":return si.parse(i.default)||null;case"numberArray":return oi.parse(i.default)||null;case"colorArray":return xn.parse(i.default)||null;case"variableAnchorOffsetCollection":return Oi.parse(i.default)||null;case"projectionDefinition":return ri.parse(i.default)||null;default:return i.default===void 0?null:i.default}}function Nr(i,e){const{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a}=i??{};return{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a,globalState:e}}function bw(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!bw(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const wO={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function vO(i,e){if(i==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};bw(i)||(i=fu(i));const t=yw(i,wO,e);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));{const n=Ew(i);return{filter:(s,o,r)=>t.value.evaluate(s,o,{},r),needGeometry:n,getGlobalStateRefs:()=>du(t.value.expression)}}}function bO(i,e){return i<e?-1:i>e?1:0}function Ew(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(Ew(i[e]))return!0;return!1}function fu(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Kp(i[1],i[2],"=="):e==="!="?pu(Kp(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Kp(i[1],i[2],e):e==="any"?EO(i.slice(1)):e==="all"?["all"].concat(i.slice(1).map(fu)):e==="none"?["all"].concat(i.slice(1).map(fu).map(pu)):e==="in"?Cw(i[1],i.slice(2)):e==="!in"?pu(Cw(i[1],i.slice(2))):e==="has"?xw(i[1]):e==="!has"?pu(xw(i[1])):!0}function Kp(i,e,t){switch(i){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,i,e]}}function EO(i){return["any"].concat(i.map(fu))}function Cw(i,e){if(e.length===0)return!1;switch(i){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",i,["literal",e.sort(bO)]]:["filter-in-small",i,["literal",e]]}}function xw(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function pu(i){return["!",i]}function cl(i){return typeof i=="object"?["literal",i]:i}function Pw(i,e){let t=i.stops;if(!t)return CO(i,e);const n=t&&typeof t[0][0]=="object",s=n||i.property!==void 0,o=n||!s;return t=t.map(r=>!s&&e.tokens&&typeof r[1]=="string"?[r[0],RO(r[1])]:[r[0],cl(r[1])]),n?xO(i,e,t):o?SO(i,e,t):Jp(i,e,t)}function CO(i,e){const t=["get",i.property];if(i.default===void 0)return e.type==="string"?["string",t]:t;if(e.type==="enum")return["match",t,Object.keys(e.values),t,i.default];{const n=[e.type==="color"?"to-color":e.type,t,cl(i.default)];return e.type==="array"&&n.splice(1,0,e.value,e.length||null),n}}function Qp(i){switch(i.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function xO(i,e,t){const n={},s={},o=[];for(let a=0;a<t.length;a++){const l=t[a],c=l[0].zoom;n[c]===void 0&&(n[c]={zoom:c,type:i.type,property:i.property,default:i.default},s[c]=[],o.push(c)),s[c].push([l[0].value,l[1]])}if(tg({},e)==="exponential"){const a=[Qp(i),["linear"],["zoom"]];for(const l of o){const c=Jp(n[l],e,s[l]);kr(a,l,c,!1)}return a}else{const a=["step",["zoom"]];for(const l of o){const c=Jp(n[l],e,s[l]);kr(a,l,c,!0)}return eg(a),a}}function PO(i,e){if(i!==void 0)return i;if(e!==void 0)return e}function Sw(i,e){const t=cl(PO(i.default,e.default));return t===void 0&&e.type==="resolvedImage"?"":t}function Jp(i,e,t){const n=tg(i,e),s=["get",i.property];if(n==="categorical"&&typeof t[0][0]=="boolean"){const o=["case"];for(const r of t)o.push(["==",s,r[0]],r[1]);return o.push(Sw(i,e)),o}else if(n==="categorical"){const o=["match",s];for(const r of t)kr(o,r[0],r[1],!1);return o.push(Sw(i,e)),o}else if(n==="interval"){const o=["step",["number",s]];for(const r of t)kr(o,r[0],r[1],!0);return eg(o),i.default===void 0?o:["case",["==",["typeof",s],"number"],o,cl(i.default)]}else if(n==="exponential"){const o=i.base!==void 0?i.base:1,r=[Qp(i),o===1?["linear"]:["exponential",o],["number",s]];for(const a of t)kr(r,a[0],a[1],!1);return i.default===void 0?r:["case",["==",["typeof",s],"number"],r,cl(i.default)]}else throw new Error(`Unknown property function type ${n}`)}function SO(i,e,t,n=["zoom"]){const s=tg(i,e);let o,r=!1;if(s==="interval")o=["step",n],r=!0;else if(s==="exponential"){const a=i.base!==void 0?i.base:1;o=[Qp(i),a===1?["linear"]:["exponential",a],n]}else throw new Error(`Unknown zoom function type "${s}"`);for(const a of t)kr(o,a[0],a[1],r);return eg(o),o}function eg(i){i[0]==="step"&&i.length===3&&(i.push(0),i.push(i[3]))}function kr(i,e,t,n){i.length>3&&e===i[i.length-2]||(n&&i.length===2||i.push(e),i.push(t))}function tg(i,e){return i.type?i.type:e.expression.interpolated?"exponential":"interval"}function RO(i){const e=["concat"],t=/{([^{}]+)}/g;let n=0;for(let s=t.exec(i);s!==null;s=t.exec(i)){const o=i.slice(n,t.lastIndex-s[0].length);n=t.lastIndex,o.length>0&&e.push(o),e.push(["get",s[1]])}if(e.length===1)return i;if(n<i.length)e.push(i.slice(n));else if(e.length===2)return["to-string",e[1]];return e}const Rw=t2;var Tw={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},hl=" ",Iw=/(italic|oblique)$/i,Ow={};function ng(i,e,t){var n=Ow[i];if(!n){Array.isArray(i)||(i=[i]);for(var s=400,o="normal",r=[],a,l,c=0,h=i.length;c<h;++c){var u=i[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()):Iw.test(f)&&(f=f.replace(Iw,""),o=l?o:d[d.length-1].replace(f,""),l=!0);for(var g in Tw){var _=d.length>1?d[d.length-2].toLowerCase():"";if(f==g||f==g.replace("-","")||_+"-"+f==g){s=a?s:Tw[g],d.pop(),_&&g.startsWith(_)&&d.pop();break}}!a&&typeof f=="number"&&(s=f,a=!0);var v=d.join(hl).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");v.indexOf(hl)!==-1&&(v='"'+v+'"'),r.push(v)}n=Ow[i]=[o,s,r]}return n[0]+hl+n[1]+hl+e+"px"+(t?"/"+t:"")+hl+n[2]}function Aw(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const o=s?s.evaluate(i):1;return ke.parse(`hsla(${e}, ${t}%, ${n}%, ${o})`)}function TO(i){const e=i[0]/255,t=i[1]/255,n=i[2]/255,s=i[3],o=Math.max(e,t,n),r=Math.min(e,t,n),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-n)/h+(t<n?6:0);break;case t:l=(n-e)/h+2;break;case n:l=(e-t)/h+4;break;default:l=0}l/=6}return[l*360,c*100,a*100,s]}function gu(i){if(Array.isArray(i)){if(i.length===0)return i;const e=i[0];if(e==="literal")return i;if(e==="image"&&i.length===3&&typeof i[2]=="object"&&i[2]!==null&&!Array.isArray(i[2]))return["image-config",gu(i[1]),["literal",i[2]]];const t=i.length;for(let n=1;n<t;++n){const s=i[n],o=gu(s);if(o!==s){const r=[e];for(let a=1;a<n;++a)r.push(i[a]);r.push(o);for(let a=n+1;a<t;++a)r.push(gu(i[a]));return r}}}return i}const Mw={},Mo={zoom:0,distanceFromCenter:0};Pn.register(au,{...Pn.definitions,pitch:[{kind:"number"},[],i=>Mo.pitch||0],"distance-from-center":[{kind:"number"},[],i=>Mo.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(i,[e])=>TO(wc(e.evaluate(i)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],Aw],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],Aw],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(i,[e,t])=>e.evaluate(i)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(i,[e])=>{const t=Mw[e.evaluate(i)];return t===void 0?{}:t}]});const Dw="https://api.mapbox.com";function ig(i){const e="mapbox://";return i.indexOf(e)!==0?"":i.slice(e.length)}function IO(i,e,t){if(typeof i=="string")return[{id:"default",url:Fw(i,e,t)}];for(const n of i)n.url=Fw(n.url,e,t);return i}function Fw(i,e,t){const n=ig(i);if(!n)return decodeURI(new URL(i,t).href);const s="sprites/";if(n.indexOf(s)!==0)throw new Error(`unexpected sprites url: ${i}`);const o=n.slice(s.length);return`${Dw}/styles/v1/${o}/sprite?access_token=${e}`}function Lw(i,e){const t=ig(i);if(!t)return decodeURI(new URL(i,location.href).href);const n="styles/";if(t.indexOf(n)!==0)throw new Error(`unexpected style url: ${i}`);const s=t.slice(n.length);return`${Dw}/styles/v1/${s}?&access_token=${e}`}const OO=["a","b","c","d"];function mu(i,e,t,n){const s=new URL(i,n||location.href),o=ig(i);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 OO.map(r=>`https://${r}.tiles.mapbox.com/v4/${o}/{z}/{x}/{y}.vector.pbf?access_token=${e}`)}const sg=Object.freeze({}),zw={},Nw={};let AO=0;function og(i){return i.id||(i.id=AO++),i.id}function MO(i,e){return og(i)+"."+Pe(e)}function DO(i){let e=zw[i.id];return e||(e={},zw[og(i)]=e),e}function FO(i){let e=Nw[i.id];return e||(e={},Nw[og(i)]=e),e}function rg(i){return i*Math.PI/180}const ag=(function(){const i=[];for(let e=78271.51696402048;i.length<=24;e/=2)i.push(e);return i})();function yu(i,e){if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof OffscreenCanvas<"u")return new OffscreenCanvas(i,e);const t=document.createElement("canvas");return t.width=i,t.height=e,t}function LO(i,e){let t=0;const n=e.length;for(;t<n;++t)if(e[t]<i&&t+1<n){const o=e[t]/e[t+1];return t+Math.log(e[t]/i)/Math.log(o)}return n-1}function zO(i,e){const t=Math.floor(i),n=Math.pow(2,i-t);return e[t]/n}const jr={};function Ur(i,e,t={},n){if(e in jr)return n&&(n.url=jr[e][0].url),jr[e][1];const s=t.transformRequest&&t.transformRequest(e,i)||e,o=function(l){return delete jr[e],Promise.reject(new Error("Error fetching source "+e))},r=function(l){return delete jr[e],l.ok?l.json():Promise.reject(new Error("Error fetching source "+e))},a=$o(()=>s).then(l=>l instanceof Response?(n&&(n.url=l.url),r(l)):(l instanceof Request||(l=new Request(l)),l.headers.get("Accept")||l.headers.set("Accept","application/json"),n&&(n.url=l.url),fetch(l).then(r).catch(o))).catch(o);return jr[e]=[s,a],a}function NO(i,e){if(typeof i=="string")if(i.trim().startsWith("{"))try{const t=JSON.parse(i);return Promise.resolve(t)}catch(t){return Promise.reject(t)}else return i=Lw(i,e.accessToken),Ur("Style",i,e);else return Promise.resolve(i)}const kw={};function kO(i,e,t={}){const n=[e,JSON.stringify(i)].toString();let s=kw[n];if(!s||t.transformRequest){let o;t.transformRequest&&(o=(a,l)=>{const c=t.transformRequest&&t.transformRequest(l,"Tiles")||l;if(a instanceof zi.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(se.ERROR))}).catch(g=>a.setState(se.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(se.ERROR))}).catch(u=>a.setState(se.ERROR))}});const r=i.url;if(r&&!i.tiles){const a=mu(r,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(r.startsWith("mapbox://"))s=Promise.resolve({tileJson:Object.assign({},i,{url:void 0,tiles:a}),tileLoadFunction:o});else{const l={};s=Ur("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}")),mu(h,t.accessToken,t.accessTokenParam||"access_token",l.url)[0]}),Promise.resolve({tileJson:c,tileLoadFunction:o})})}}else i.tiles?(i=Object.assign({},i,{tiles:i.tiles.map(function(a){return i.scheme==="tms"&&(a=a.replace("{y}","{-y}")),mu(a,t.accessToken,t.accessTokenParam||"access_token",e||location.href)[0]})}),s=Promise.resolve({tileJson:Object.assign({},i),tileLoadFunction:o})):s=Promise.reject(new Error("source has no `tiles` nor `url`"));kw[n]=s}return s}function jw(i,e,t,n){const s=[2*t*e.pixelRatio+e.width,2*t*e.pixelRatio+e.height],o=yu(s[0],s[1]),r=o.getContext("2d");r.drawImage(i,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(${n.r*255},${n.g*255},${n.b*255},${n.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 jO(i,e,t){const n=Math.max(0,Math.min(1,(t-i)/(e-i)));return n*n*(3-2*n)}function Uw(i,e,t){const n=yu(e.width,e.height),s=n.getContext("2d");s.drawImage(i,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,_=jO(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),n}const UO=Array(256).join(" ");function lg(i,e){if(e>=.05){let t="";const n=i.split(`
159
- `),s=UO.slice(0,Math.round(e/.1));for(let o=0,r=n.length;o<r;++o)o>0&&(t+=`
160
- `),t+=n[o].split("").join(s);return t}return i}let cg;function Gw(){return cg||(cg=yu(1,1).getContext("2d")),cg}function GO(i,e){if(/\d+ \d+/.test(i)){const[t,n]=i.split(" ").map(Number);return t<=e&&e<=n}return i==e}function Do(i,e){return Gw().measureText(i).width+(i.length-1)*e}const _u={};uo.on("propertychange",()=>{for(const i in _u)delete _u[i]});function hg(i,e,t,n){if(i.indexOf(`
158
+ `);this.setTileUrlFunction(cp(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_,n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};t=="KVP"&&Object.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),e=t=="KVP"?Mh(e,n):e.replace(/\{(\w+?)\}/g,function(r,a){return a.toLowerCase()in n?n[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=Mh(h,c):h=h.replace(/\{(\w+?)\}/g,function(u,d){return encodeURIComponent(c[d])}),h})}}class Lh extends Fh{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:Ir({extent:Ka(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:n,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 GT={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},O1={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class qT extends v1{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Qt(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(e,t,n,s,o,r,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,n,s,o,r,a,l)}getTile(e,t,n,s){const o=this.getOrCreateTile(e,t,n,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,n){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(n).getTileCoordExtent(e.wrappedTileCoord),g=c.getSourceTiles(t,n,e),_=Pe(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()!=se.LOADED)continue;const C=c.getProjection(),P=w.tileCoord;let R=u.getTileCoordExtent(P);n&&C&&!Wt(n,C)&&(R=sa(R,C,n,32));const O=Xn(f,R),I=pi(O,s.getRenderBuffer()*a,this.tempExtent),M=ji(R,O)?null:I,z=new R0(0,O,a,t),k=Pc(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}},H=w.getFeatures();r&&r!==l.renderedRenderOrder&&H.sort(r);for(let L=0,N=H.length;L<N;++L){let j=H[L];n&&w.projection&&!Wt(n,w.projection)&&(j=j.clone(),j.getGeometry().applyTransform(Gi(w.projection,n))),(!M||pt(M,j.getGeometry().getExtent()))&&q.call(this,j,L)}const m=z.finish(),b=s.getRenderMode()!=="vector"&&h&&g.length===1?null:O,S=new M0(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,n,s,o){var C,P;const r=t.viewState.resolution,a=t.viewState.rotation;n=n??0;const l=this.getLayer(),h=l.getSource().getTileGridForProjection(t.viewState.projection),u=$r([e]);pi(u,r*n,u);const d={},f=function(R,O,I){let M=R.getId();M===void 0&&(M=Pe(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,O);z.geometry=O,z.distanceSq=I}}else{if(I===0)return d[M]=!0,s(R,l,O);o.push(d[M]={feature:R,layer:l,geometry:O,distanceSq:I,callback:s})}},g=this.renderedTiles,_=Pe(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,O=g.length;R<O;++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,n,f,E),w)break e}return w}getFeatures(e){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((t,n)=>{const s=this.getLayer(),o=s.getSource(),r=this.renderedProjection,a=r.getExtent(),l=this.renderedResolution,c=o.getTileGridForProjection(r),h=wt(this.renderedPixelToCoordinateTransform_,e.slice()),u=c.getTileCoordForCoordAndResolution(h,l).toString(),d=this.renderedTiles.find(C=>C.tileCoord.toString()===u&&C.getState()===se.LOADED);if(!d||d.loadingSourceTiles>0){t([]);return}o.getWrapX()&&r.canWrapX()&&!Ni(a,c.getTileCoordExtent(d.tileCoord))&&Nu(h,r);const f=Pe(s),g=c.getTileCoordExtent(d.wrappedTileCoord),_=ln(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,bn,C[0]*bn,C[1]*bn,0)];w=F0(C,R,E,s.getStyleFunction(),c.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,P),d.hitDetectionImageData[f]=w}t(L0(v,E,w))})}getFeaturesInExtent(e){const t=[],n=this.getTileCache();if(n.getCount()===0)return t;const o=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=o.getZForResolution(this.renderedResolution),a={};return n.forEach(l=>{if(l.tileCoord[0]!==r||l.getState()!==se.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 n=this.context,s=n.globalAlpha;n.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=Pe(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,Dc,c)}n.globalAlpha=s}renderDeferredInternal(e){const t=this.renderedTiles,n=Pe(this.getLayer()),s=t.reduce((l,c,h)=>(c.executorGroups[n].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(di).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 n=t.pixelRatio,s=t.viewState,o=s.center,r=s.resolution,a=s.rotation,l=t.size,c=Math.round(l[0]*n),h=Math.round(l[1]*n),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 hc(Zu(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(o,r,a,n,c,h,_))}postRender(e,t){var R;const n=t.viewHints,s=!(n[ot.ANIMATING]||n[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?O1[r].filter(O=>!Dc.includes(O)):O1[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=Pe(o);let P=!0;for(let O=_.length-1;O>=0;--O){const I=_[O];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 H=M[0].getClipCoords(z);let m=e,b;if(H){b=new Md,m=b.getContext();for(let S=0,L=v.length;S<L;++S)if(g!==k&&k<E[S]){const N=v[S];pt([H[0],H[3],H[4],H[7]],[N[0],N[3],N[4],N[7]])&&(q||(m.save(),q=!0),m.beginPath(),m.moveTo(H[0],H[1]),m.lineTo(H[2],H[3]),m.lineTo(H[4],H[5]),m.lineTo(H[6],H[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(H),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[O]=b)}e.globalAlpha=a,this.ready=P,this.tileClipContexts_=w,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,n,s,o,r){if(!n)return!1;let a=!1;if(Array.isArray(n))for(let l=0,c=n.length;l<c;++l)a=Sc(s,e,n[l],t,this.boundHandleStyleImageChange_,void 0,o,r)||a;else a=Sc(s,e,n,t,this.boundHandleStyleImageChange_,void 0,o,r);return a}tileImageNeedsRender_(e){const t=this.getLayer();if(t.getRenderMode()==="vector")return!1;const n=e.getReplayState(t),s=t.getRevision(),o=e.wantedResolution;return n.renderedTileResolution!==o||n.renderedTileRevision!==s}renderTileImage_(e,t){const n=this.getLayer(),s=e.getReplayState(n),o=n.getRevision(),r=e.executorGroups[Pe(n)];s.renderedTileRevision=o;const a=e.wrappedTileCoord,l=a[0],c=n.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=Rm(this.tmpTransform_);Zu(I,C,C),E.setTransform.apply(E,I)}const P=f.getTileCoordExtent(a,this.tempExtent),R=_/v,O=Rm(this.tmpTransform_);Zu(O,R,-R),yb(O,-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],O,0,!0,GT[n.getRenderMode()],null);s.renderedTileResolution=e.wantedResolution}}class zh extends Uc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const n=e.cacheSize===void 0?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n;const s=e.renderMode||"hybrid";Ve(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 qT(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(Gs.PRELOAD)}getUseInterimTilesOnError(){return this.get(Gs.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(Gs.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(Gs.USE_INTERIM_TILES_ON_ERROR,e)}}class dp extends Dh{constructor(e){const t=e.projection||"EPSG:3857",n=e.extent||Ka(t),s=e.tileGrid||Ir({extent:n,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:A1,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,n){if(n.getState()===se.IDLE){n.setState(se.LOADING);const s=n.wrappedTileCoord,o=this.getTileGridForProjection(t);let r=o.getTileCoordExtent(s);const a=s[0],l=o.getResolution(a);pi(r,-l,r);const c=this.projection;t&&this.projection&&!Wt(t,c)&&(r=sa(r,t,c));const h=this.tileGrid,u=h.getExtent();u&&Xn(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,_?se.IDLE:se.EMPTY,_,this.format_,this.tileLoadFunction));const v=this.sourceTiles_[_];n.sourceTiles.push(v),this.tileKeysBySourceTileUrl_[_]||(this.tileKeysBySourceTileUrl_[_]=[]),this.tileKeysBySourceTileUrl_[_].push(n.getKey());const E=v.getState();if(E<se.LOADED){const w=C=>{this.handleTileChange(C);const P=v.getState();if(P===se.LOADED||P===se.ERROR){const R=v.getKey();R in n.errorTileKeys?v.getState()===se.LOADED&&delete n.errorTileKeys[R]:n.loadingSourceTiles--,P===se.ERROR?n.errorTileKeys[R]=!0:v.removeEventListener(_e.CHANGE,w),n.loadingSourceTiles===0&&n.setState(_s(n.errorTileKeys)?se.LOADED:se.ERROR)}};v.addEventListener(_e.CHANGE,w),n.loadingSourceTiles++}E===se.IDLE&&(v.extent=h.getTileCoordExtent(g),v.projection=this.projection,v.resolution=h.getResolution(g[0]),v.load())}),n.loadingSourceTiles||n.setState(n.sourceTiles.some(g=>g.getState()===se.ERROR)?se.ERROR:se.LOADED)}return n.sourceTiles}removeSourceTiles(e){const t=e.getKey(),n=e.sourceTiles;for(let s=0,o=n.length;s<o;++s){const r=n[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,n,s,o){const r=[e,t,n];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);pi(f,-h.getResolution(e),f),pt(l,!o||!c||Wt(o,c)?f:sa(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);pi(E,-g,E),f.forEachTileCoord(!o||!c||Wt(o,c)?E:sa(E,o,c),v,w=>{u=u&&!this.tileUrlFunction(w,s,c)})}const d=new Ex(r,u?se.EMPTY:se.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 n=this.tileGrids_[t];if(!n){const s=this.projection;if(s!==null&&!Wt(s,e))return ap(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=ny+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]);n=new Vs({extent:o.getExtent(),origins:a,resolutions:r,tileSizes:l}),this.tileGrids_[t]=n}return n}getTilePixelRatio(e){return e}getTilePixelSize(e,t,n){const s=this.getTileGridForProjection(n),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 A1(i,e){i.setLoader(function(t,n,s){p0(e,i.getFormat(),t,n,s,i.onLoad.bind(i),i.onError.bind(i))})}const fp=65536*65536,M1=1/fp,VT=12,D1=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),pp=0,Nh=1,Qa=2,kh=5;class WT{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,n=this.length){for(;this.pos<n;){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)*fp;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*fp;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 n,s;return s=t[this.pos++],n=s&127,s<128||(s=t[this.pos++],n|=(s&127)<<7,s<128)||(s=t[this.pos++],n|=(s&127)<<14,s<128)||(s=t[this.pos++],n|=(s&127)<<21,s<128)?n:(s=t[this.pos],n|=(s&15)<<28,BT(n,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>=VT&&D1?D1.decode(this.buf.subarray(t,e)):sI(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 n=this.readPackedEnd();for(;this.pos<n;)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===Qa?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===pp)for(;this.buf[this.pos++]>127;);else if(t===Qa)this.pos=this.readVarint()+this.pos;else if(t===kh)this.pos+=4;else if(t===Nh)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 n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.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*M1),!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*M1),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){$T(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=oI(this.buf,e,this.pos);const n=this.pos-t;n>=128&&F1(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}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 n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;const n=this.pos;e(t,this);const s=this.pos-n;s>=128&&F1(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s}writeMessage(e,t,n){this.writeTag(e,Qa),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,YT,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,ZT,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,JT,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,KT,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,QT,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,eI,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,tI,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,nI,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,iI,t)}writeBytesField(e,t){this.writeTag(e,Qa),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,kh),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,kh),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Nh),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Nh),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,pp),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,pp),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Qa),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,kh),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Nh),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function BT(i,e,t){const n=t.buf;let s,o;if(o=n[t.pos++],s=(o&112)>>4,o<128||(o=n[t.pos++],s|=(o&127)<<3,o<128)||(o=n[t.pos++],s|=(o&127)<<10,o<128)||(o=n[t.pos++],s|=(o&127)<<17,o<128)||(o=n[t.pos++],s|=(o&127)<<24,o<128)||(o=n[t.pos++],s|=(o&1)<<31,o<128))return Or(i,s,e);throw new Error("Expected varint not more than 10 bytes")}function Or(i,e,t){return t?e*4294967296+(i>>>0):(e>>>0)*4294967296+(i>>>0)}function $T(i,e){let t,n;if(i>=0?(t=i%4294967296|0,n=i/4294967296|0):(t=~(-i%4294967296),n=~(-i/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),HT(t,n,e),XT(n,e)}function HT(i,e,t){t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos]=i&127}function XT(i,e){const t=(i&7)<<4;e.buf[e.pos++]|=t|((i>>>=3)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127)))))}function F1(i,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(let s=t.pos-1;s>=i;s--)t.buf[s+n]=t.buf[s]}function YT(i,e){for(let t=0;t<i.length;t++)e.writeVarint(i[t])}function ZT(i,e){for(let t=0;t<i.length;t++)e.writeSVarint(i[t])}function KT(i,e){for(let t=0;t<i.length;t++)e.writeFloat(i[t])}function QT(i,e){for(let t=0;t<i.length;t++)e.writeDouble(i[t])}function JT(i,e){for(let t=0;t<i.length;t++)e.writeBoolean(i[t])}function eI(i,e){for(let t=0;t<i.length;t++)e.writeFixed32(i[t])}function tI(i,e){for(let t=0;t<i.length;t++)e.writeSFixed32(i[t])}function nI(i,e){for(let t=0;t<i.length;t++)e.writeFixed64(i[t])}function iI(i,e){for(let t=0;t<i.length;t++)e.writeSFixed64(i[t])}function sI(i,e,t){let n="",s=e;for(;s<t;){const o=i[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=i[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=i[s+1],c=i[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=i[s+1],c=i[s+2],h=i[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,n+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),n+=String.fromCharCode(r),s+=a}return n}function oI(i,e,t){for(let n=0,s,o;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){i[t++]=239,i[t++]=191,i[t++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===e.length?(i[t++]=239,i[t++]=191,i[t++]=189):o=s;continue}else o&&(i[t++]=239,i[t++]=191,i[t++]=189,o=null);s<128?i[t++]=s:(s<2048?i[t++]=s>>6|192:(s<65536?i[t++]=s>>12|224:(i[t++]=s>>18|240,i[t++]=s>>12&63|128),i[t++]=s>>6&63|128),i[t++]=s&63|128)}return t}class L1{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=An,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let n=t.dataProjection?De(t.dataProjection):this.readProjection(e);t.extent&&n&&n.getUnits()==="tile-pixels"&&(n=De(n),n.setWorldExtent(t.extent)),t={dataProjection:n,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return we()}readFeature(e,t){return we()}readFeatures(e,t){return we()}readGeometry(e,t){return we()}readProjection(e){return we()}writeFeature(e,t){return we()}writeFeatures(e,t){return we()}writeGeometry(e,t){return we()}}function jh(i,e,t){const n=t?De(t.featureProjection):null,s=t?De(t.dataProjection):null;let o=i;if(n&&s&&!Wt(n,s)){e&&(o=i.clone());const r=e?n:s,a=e?s:n;r.getUnits()==="tile-pixels"?o.transform(r,a):o.applyTransform(Gi(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===i&&(o=i.clone()),o.applyTransform(a)}return o}const rI={Point:wn,LineString:Qn,Polygon:Kn,MultiPoint:er,MultiLineString:fo,MultiPolygon:_a};function aI(i,e,t){return Array.isArray(e[0])?(qm(i,0,e,t)||(i=i.slice(),ld(i,0,e,t)),i):(ad(i,0,e,t)||(i=i.slice(),pc(i,0,e,t)),i)}function z1(i,e){var o;const t=i.geometry;if(!t)return[];if(Array.isArray(t))return t.map(r=>z1({...i,geometry:r})).flat();const n=t.type==="MultiPolygon"?"Polygon":t.type;if(n==="GeometryCollection"||n==="Circle")throw new Error("Unsupported geometry type: "+n);const s=t.layout.length;return jh(new Bt(n,n==="Polygon"?aI(t.flatCoordinates,t.ends,s):t.flatCoordinates,(o=t.ends)==null?void 0:o.flat(),s,i.properties||{},i.id).enableSimplifyTransformed(),!1,e)}function gp(i,e){if(!i)return null;if(Array.isArray(i)){const n=i.map(s=>gp(s,e));return new Rc(n)}const t=rI[i.type];return jh(new t(i.flatCoordinates,i.layout||"XY",i.ends),!1,e)}class mp extends L1{constructor(e){super(),e=e||{},this.dataProjection=new ta({code:"",units:"tile-pixels"}),this.featureClass=e.featureClass?e.featureClass:Bt,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,n,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),n.push(l,c),h+=2;else if(r===7)h>u&&(n.push(n[u],n[u+1]),h+=2);else throw new Error("Invalid command found in the PBF")}h>u&&(s.push(h),u=h)}createFeature_(e,t,n){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=dI(s,c.length);if(this.featureClass===Bt)o=new this.featureClass(h,l,c,2,r,a),o.transform(n.dataProjection);else{let u;if(h=="Polygon"){const g=Vm(l,c);u=g.length>1?new _a(l,"XY",g):new Kn(l,"XY",c)}else u=h==="Point"?new wn(l,"XY"):h==="LineString"?new Qn(l,"XY"):h==="MultiPoint"?new er(l,"XY"):h==="MultiLineString"?new fo(l,"XY",c):null;const d=this.featureClass;o=new d,this.geometryName_&&o.setGeometryName(this.geometryName_);const f=jh(u,!1,n);o.setGeometry(f),a!==void 0&&o.setId(a),o.setProperties(r,!0)}return o}getType(){return"arraybuffer"}readFeatures(e,t){const n=this.layers_;t=this.adaptOptions(t);const s=De(t.dataProjection);s.setWorldExtent(t.extent),t.dataProjection=s;const o=new WT(e),r=o.readFields(lI,{}),a=[];for(const l in r){if(n&&!n.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=uI(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 lI(i,e,t){if(i===3){const n={keys:[],values:[],features:[]},s=t.readVarint()+t.pos;t.readFields(cI,n,s),n.length=n.features.length,n.length&&(e[n.name]=n)}}function cI(i,e,t){if(i===15)e.version=t.readVarint();else if(i===1)e.name=t.readString();else if(i===5)e.extent=t.readVarint();else if(i===2)e.features.push(t.pos);else if(i===3)e.keys.push(t.readString());else if(i===4){let n=null;const s=t.readVarint()+t.pos;for(;t.pos<s;)i=t.readVarint()>>3,n=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null;e.values.push(n)}}function hI(i,e,t){if(i==1)e.id=t.readVarint();else if(i==2){const n=t.readVarint()+t.pos;for(;t.pos<n;){const s=e.layer.keys[t.readVarint()],o=e.layer.values[t.readVarint()];e.properties[s]=o}}else i==3?e.type=t.readVarint():i==4&&(e.geometry=t.pos)}function uI(i,e,t){i.pos=e.features[t];const n=i.readVarint()+i.pos,s={layer:e,type:0,properties:{}};return i.readFields(hI,s,n),s}function dI(i,e){let t;return i===1?t=e===1?"Point":"MultiPoint":i===2?t=e===1?"LineString":"MultiLineString":i===3&&(t="Polygon"),t}var fI=8,pI={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"}},gI={"*":{type:"source"}},mI=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],yI={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:"*"}},_I={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:"*"}},wI={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:"*"}},vI={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"}},bI={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"}}},EI={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"}}},CI={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"}},xI=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],PI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},SI={"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"}},RI={"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"}},TI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},II={"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"}},OI={"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"}},AI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},MI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},DI={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},FI={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},LI={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},zI={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},NI={type:"array",value:"expression_name",minimum:1},kI={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}},jI={"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}},UI={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},GI={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},qI=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],VI={"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"}},WI={"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"}},BI={"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"}},$I={"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"}},HI={"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"}},XI={"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"}},YI={"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"}},ZI={"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"}},KI={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},QI={"*":{type:"string"}},JI={type:"array",value:"interpolation_name",minimum:1},eO={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"}]}}}},tO={$version:fI,$root:pI,sources:gI,source:mI,source_vector:yI,source_raster:_I,source_raster_dem:wI,source_geojson:vI,source_video:bI,source_image:EI,layer:CI,layout:xI,layout_background:PI,layout_fill:SI,layout_circle:RI,layout_heatmap:TI,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:II,layout_symbol:OI,layout_raster:AI,layout_hillshade:MI,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:DI,filter_operator:FI,geometry_type:LI,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:zI,expression:NI,light:kI,sky:jI,terrain:UI,projection:GI,paint:qI,paint_fill:VI,"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:WI,paint_circle:BI,paint_heatmap:$I,paint_symbol:HI,paint_raster:XI,paint_hillshade:YI,"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:ZI,transition:KI,"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:QI,interpolation:JI,interpolation_name:eO};const nO=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function iO(i,e){const t={};for(const n in i)n!=="ref"&&(t[n]=i[n]);return nO.forEach(n=>{n in e&&(t[n]=e[n])}),t}function sO(i){i=i.slice();const e=Object.create(null);for(let t=0;t<i.length;t++)e[i[t].id]=i[t];for(let t=0;t<i.length;t++)"ref"in i[t]&&(i[t]=iO(i[t],e[i[t].ref]));return i}class Ti extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class yp{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[n,s]of t)this.bindings[n]=s}concat(e){return new yp(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 Uh={kind:"null"},ne={kind:"number"},be={kind:"string"},Re={kind:"boolean"},Ii={kind:"color"},Gh={kind:"projectionDefinition"},Po={kind:"object"},Se={kind:"value"},oO={kind:"error"},qh={kind:"collator"},Vh={kind:"formatted"},Wh={kind:"padding"},Ja={kind:"colorArray"},Bh={kind:"numberArray"},el={kind:"resolvedImage"},$h={kind:"variableAnchorOffsetCollection"};function en(i,e){return{kind:"array",itemType:i,N:e}}function ut(i){if(i.kind==="array"){const e=ut(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}else return i.kind}const rO=[Uh,ne,be,Re,Ii,Gh,Vh,Po,en(Se),Wh,Bh,Ja,el,$h];function tl(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tl(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const t of rO)if(!tl(t,e))return null}}return`Expected ${ut(i)} but found ${ut(e)} instead.`}function _p(i,e){return e.some(t=>t.kind===i.kind)}function So(i,e){return e.some(t=>t==="null"?i===null:t==="array"?Array.isArray(i):t==="object"?i&&!Array.isArray(i)&&typeof i=="object":t===typeof i)}function Ws(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const N1=.96422,k1=1,j1=.82521,U1=4/29,Ar=6/29,G1=3*Ar*Ar,aO=Ar*Ar*Ar,lO=Math.PI/180,cO=180/Math.PI;function q1(i){return i=i%360,i<0&&(i+=360),i}function V1([i,e,t,n]){i=wp(i),e=wp(e),t=wp(t);let s,o;const r=vp((.2225045*i+.7168786*e+.0606169*t)/k1);i===e&&e===t?s=o=r:(s=vp((.4360747*i+.3850649*e+.1430804*t)/N1),o=vp((.0139322*i+.0971045*e+.7141733*t)/j1));const a=116*r-16;return[a<0?0:a,500*(s-r),200*(r-o),n]}function wp(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function vp(i){return i>aO?Math.pow(i,1/3):i/G1+U1}function W1([i,e,t,n]){let s=(i+16)/116,o=isNaN(e)?s:s+e/500,r=isNaN(t)?s:s-t/200;return s=k1*Ep(s),o=N1*Ep(o),r=j1*Ep(r),[bp(3.1338561*o-1.6168667*s-.4906146*r),bp(-.9787684*o+1.9161415*s+.033454*r),bp(.0719453*o-.2289914*s+1.4052427*r),n]}function bp(i){return i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055,i<0?0:i>1?1:i}function Ep(i){return i>Ar?i*i*i:G1*(i-U1)}function hO(i){const[e,t,n,s]=V1(i),o=Math.sqrt(t*t+n*n);return[Math.round(o*1e4)?q1(Math.atan2(n,t)*cO):NaN,o,e,s]}function uO([i,e,t,n]){return i=isNaN(i)?0:i*lO,W1([t,Math.cos(i)*e,Math.sin(i)*e,n])}function dO([i,e,t,n]){i=q1(i),e/=100,t/=100;function s(o){const r=(o+i/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),n]}const fO=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function B1(i,e){return fO(i,e)?i[e]:void 0}function pO(i){if(i=i.toLowerCase().trim(),i==="transparent")return[0,0,0,0];const e=B1(gO,i);if(e){const[s,o,r]=e;return[s/255,o/255,r/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){const o=i.length<6?1:2;let r=1;return[Hh(i.slice(r,r+=o)),Hh(i.slice(r,r+=o)),Hh(i.slice(r,r+=o)),Hh(i.slice(r,r+o)||"ff")]}if(i.startsWith("rgb")){const s=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=i.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=[Mr(+a/P,0,1),Mr(+h/P,0,1),Mr(+f/P,0,1),v?$1(+v,E):1];if(H1(R))return R}}return}}const t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=i.match(t);if(n){const[s,o,r,a,l,c,h,u,d]=n,f=[r||" ",l||" ",h].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){const g=[+o,Mr(+a,0,100),Mr(+c,0,100),u?$1(+u,d):1];if(H1(g))return dO(g)}}}function Hh(i){return parseInt(i.padEnd(2,i),16)/255}function $1(i,e){return Mr(e?i/100:i,0,1)}function Mr(i,e,t){return Math.min(Math.max(e,i),t)}function H1(i){return!i.some(Number.isNaN)}const gO={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 Ro(i,e,t){return i+t*(e-i)}function nl(i,e,t){return i.map((n,s)=>Ro(n,e[s],t))}class ke{constructor(e,t,n,s=1,o=!0){this.r=e,this.g=t,this.b=n,this.a=s,o||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,t,n,s]))}static parse(e){if(e instanceof ke)return e;if(typeof e!="string")return;const t=pO(e);if(t)return new ke(...t,!1)}get rgb(){const{r:e,g:t,b:n,a:s}=this,o=s||1/0;return this.overwriteGetter("rgb",[e/o,t/o,n/o,s])}get hcl(){return this.overwriteGetter("hcl",hO(this.rgb))}get lab(){return this.overwriteGetter("lab",V1(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,n,s]=this.rgb;return`rgba(${[e,t,n].map(o=>Math.round(o*255)).join(",")},${s})`}static interpolate(e,t,n,s="rgb"){switch(s){case"rgb":{const[o,r,a,l]=nl(e.rgb,t.rgb,n);return new ke(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+n*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]=uO([f,g??Ro(r,h,n),Ro(a,u,n),Ro(l,d,n)]);return new ke(_,v,E,w,!1)}case"lab":{const[o,r,a,l]=W1(nl(e.lab,t.lab,n));return new ke(o,r,a,l,!1)}}}}ke.black=new ke(0,0,0,1),ke.white=new ke(1,1,1,1),ke.transparent=new ke(0,0,0,0),ke.red=new ke(1,0,0,1);class Cp{constructor(e,t,n){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=n,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 mO=["bottom","center","top"];class xp{constructor(e,t,n,s,o,r){this.text=e,this.image=t,this.scale=n,this.fontStack=s,this.textColor=o,this.verticalAlign=r}}class ns{constructor(e){this.sections=e}static fromString(e){return new ns([new xp(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 ns?e:ns.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class si{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof si)return e;if(typeof e=="number")return new si([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 si(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new si(nl(e.values,t.values,n))}}class oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof oi)return e;if(typeof e=="number")return new oi([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new oi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new oi(nl(e.values,t.values,n))}}class xn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof xn)return e;if(typeof e=="string"){const n=ke.parse(e);return n?new xn([n]):void 0}if(!Array.isArray(e))return;const t=[];for(const n of e){if(typeof n!="string")return;const s=ke.parse(n);if(!s)return;t.push(s)}return new xn(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,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(ke.interpolate(e.values[r],t.values[r],n,s));return new xn(o)}}class yt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const yO=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Oi)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const n=e[t],s=e[t+1];if(typeof n!="string"||!yO.has(n)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Oi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){const s=e.values,o=t.values;if(s.length!==o.length)throw new yt(`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 yt(`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([Ro(l,h,n),Ro(c,u,n)])}return new Oi(r)}}class Bs{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Bs({name:e,available:!1}):null}}class ri{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new ri(e,t,n)}static parse(e){if(e instanceof ri)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ri(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ri(e.from,e.to,e.transition);if(typeof e=="string")return new ri(e,e,1)}}function X1(i,e,t,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,t,n]:[i,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function il(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof ri||i instanceof ke||i instanceof Cp||i instanceof ns||i instanceof si||i instanceof oi||i instanceof xn||i instanceof Oi||i instanceof Bs)return!0;if(Array.isArray(i)){for(const e of i)if(!il(e))return!1;return!0}else if(typeof i=="object"){for(const e in i)if(!il(i[e]))return!1;return!0}else return!1}function It(i){if(i===null)return Uh;if(typeof i=="string")return be;if(typeof i=="boolean")return Re;if(typeof i=="number")return ne;if(i instanceof ke)return Ii;if(i instanceof ri)return Gh;if(i instanceof Cp)return qh;if(i instanceof ns)return Vh;if(i instanceof si)return Wh;if(i instanceof oi)return Bh;if(i instanceof xn)return Ja;if(i instanceof Oi)return $h;if(i instanceof Bs)return el;if(Array.isArray(i)){const e=i.length;let t;for(const n of i){const s=It(n);if(!t)t=s;else{if(t===s)continue;t=Se;break}}return en(t||Se,e)}else return Po}function sl(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof ke||i instanceof ri||i instanceof ns||i instanceof si||i instanceof oi||i instanceof xn||i instanceof Oi||i instanceof Bs?i.toString():JSON.stringify(i)}class Dr{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(!il(e[1]))return t.error("invalid value");const n=e[1];let s=It(n);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 Dr(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Xh={string:be,number:ne,boolean:Re,object:Po};class ai{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 n=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 Xh)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Xh[c],n++}else a=Se;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],n++}s=en(a,l)}else{if(!Xh[o])throw new Error(`Types doesn't contain name = ${o}`);s=Xh[o]}const r=[];for(;n<e.length;n++){const a=t.parse(e[n],n,Se);if(!a)return null;r.push(a)}return new ai(s,r)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(tl(this.type,It(n))){if(t===this.args.length-1)throw new yt(`Expected value to be of type ${ut(this.type)}, but found ${ut(It(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Y1={"to-boolean":Re,"to-color":Ii,"to-number":ne,"to-string":be};class $s{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 n=e[0];if(!Y1[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");const s=Y1[n],o=[];for(let r=1;r<e.length;r++){const a=t.parse(e[r],r,Se);if(!a)return null;o.push(a)}return new $s(s,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,n;for(const s of this.args){if(t=s.evaluate(e),n=null,t instanceof ke)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?n=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:n=X1(t[0],t[1],t[2],t[3]),!n))return new ke(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new yt(n||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const n of this.args){t=n.evaluate(e);const s=si.parse(t);if(s)return s}throw new yt(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=oi.parse(t);if(s)return s}throw new yt(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=xn.parse(t);if(s)return s}throw new yt(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const n of this.args){t=n.evaluate(e);const s=Oi.parse(t);if(s)return s}throw new yt(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const n of this.args){if(t=n.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new yt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return ns.fromString(sl(this.args[0].evaluate(e)));case"resolvedImage":return Bs.fromString(sl(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return sl(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const _O=["Unknown","Point","LineString","Polygon"];class Z1{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"?_O[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=ke.parse(e),this._parseColorCache.set(e,t)),t}}class Yh{constructor(e,t,n=[],s,o=new yp,r=[]){this.registry=e,this.path=n,this.key=n.map(a=>`[${a}]`).join(""),this.scope=o,this.errors=r,this.expectedType=s,this._isConstant=t}parse(e,t,n,s,o={}){return t?this.concat(t,n,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 n(s,o,r){return r==="assert"?new ai(o,[s]):r==="coerce"?new $s(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=n(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=n(r,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(r instanceof Dr)&&r.type.kind!=="resolvedImage"&&this._isConstant(r)){const a=new Z1;try{r=new Dr(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,n){const s=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new Yh(this.registry,this._isConstant,s,t||null,o,this.errors)}error(e,...t){const n=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new Ti(n,e))}checkSubtype(e,t){const n=tl(e,t);return n&&this.error(n),n}}class Zh{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 n=[];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;n.push([r,a])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return s?new Zh(n,s):null}outputDefined(){return this.result.outputDefined()}}class Kh{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 n=e[1];return t.scope.has(n)?new Kh(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Pp{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,ne),s=t.parse(e[2],2,en(t.expectedType||Se));if(!n||!s)return null;const o=s.type;return new Pp(o.itemType,n,s)}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new yt(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new yt(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new yt(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Sp{constructor(e,t){this.type=Re,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 n=t.parse(e[1],1,Se),s=t.parse(e[2],2,Se);return!n||!s?null:_p(n.type,[Re,be,ne,Uh,Se])?new Sp(n,s):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ut(n.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!So(t,["boolean","string","number","null"]))throw new yt(`Expected first argument to be of type boolean, string, number or null, but found ${ut(It(t))} instead.`);if(!So(n,["string","array"]))throw new yt(`Expected second argument to be of type array or string, but found ${ut(It(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Qh{constructor(e,t,n){this.type=ne,this.needle=e,this.haystack=t,this.fromIndex=n}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 n=t.parse(e[1],1,Se),s=t.parse(e[2],2,Se);if(!n||!s)return null;if(!_p(n.type,[Re,be,ne,Uh,Se]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ut(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ne);return o?new Qh(n,s,o):null}else return new Qh(n,s)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!So(t,["boolean","string","number","null"]))throw new yt(`Expected first argument to be of type boolean, string, number or null, but found ${ut(It(t))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),So(n,["string"])){const o=n.indexOf(t,s);return o===-1?-1:[...n.slice(0,o)].length}else{if(So(n,["array"]))return n.indexOf(t,s);throw new yt(`Expected second argument to be of type array or string, but found ${ut(It(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Rp{constructor(e,t,n,s,o,r){this.inputType=e,this.type=t,this.input=n,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 n,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(!n)n=It(g);else if(d.checkSubtype(n,It(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,Se);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(n,a.type)?null:new Rp(n,s,a,o,r,l)}evaluate(e){const t=this.input.evaluate(e);return(It(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 Tp{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}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 n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);const s=[];for(let r=1;r<e.length-1;r+=2){const a=t.parse(e[r],r,Re);if(!a)return null;const l=t.parse(e[r+1],r+1,n);if(!l)return null;s.push([a,l]),n=n||l.type}const o=t.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can't infer output type");return new Tp(n,s,o)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class Jh{constructor(e,t,n,s){this.type=e,this.input=t,this.beginIndex=n,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 n=t.parse(e[1],1,Se),s=t.parse(e[2],2,ne);if(!n||!s)return null;if(!_p(n.type,[en(Se),be,Se]))return t.error(`Expected first argument to be of type array or string, but found ${ut(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ne);return o?new Jh(n.type,n,s,o):null}else return new Jh(n.type,n,s)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),So(t,["string"]))return[...t].slice(n,s).join("");if(So(t,["array"]))return t.slice(n,s);throw new yt(`Expected first argument to be of type array or string, but found ${ut(It(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function K1(i,e){const t=i.length-1;let n=0,s=t,o=0,r,a;for(;n<=s;)if(o=Math.floor((n+s)/2),r=i[o],a=i[o+1],r<=e){if(o===t||e<a)return o;n=o+1}else if(r>e)s=o-1;else throw new yt("Input is not a number.");return 0}class eu{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,o]of n)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 n=t.parse(e[1],1,ne);if(!n)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 eu(o,n,s)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;if(s>=t[o-1])return n[o-1].evaluate(e);const r=K1(t,s);return n[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 wO(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ip,Q1;function vO(){if(Q1)return Ip;Q1=1,Ip=i;function i(e,t,n,s){this.cx=3*e,this.bx=3*(n-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=n,this.p2y=s}return i.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 n=e,s=0;s<8;s++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<t)return n;var r=this.sampleCurveDerivativeX(n);if(Math.abs(r)<1e-6)break;n=n-o/r}var a=0,l=1;for(n=e,s=0;s<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<t));s++)e>o?a=n:l=n,n=(l-a)*.5+a;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Ip}var bO=vO(),EO=wO(bO);class Ai{constructor(e,t,n,s,o){this.type=e,this.operator=t,this.interpolation=n,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,n,s){let o=0;if(e.name==="exponential")o=Op(t,e.base,n,s);else if(e.name==="linear")o=Op(t,1,n,s);else if(e.name==="cubic-bezier"){const r=e.controlPoints;o=new EO(r[0],r[1],r[2],r[3]).solve(Op(t,1,n,s))}return o}static parse(e,t){let[n,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,ne),!o)return null;const a=[];let l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&t.expectedType!=Ja?l=Ii: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!Ws(l,ne)&&!Ws(l,Gh)&&!Ws(l,Ii)&&!Ws(l,Wh)&&!Ws(l,Bh)&&!Ws(l,Ja)&&!Ws(l,$h)&&!Ws(l,en(ne))?t.error(`Type ${ut(l)} is not interpolatable.`):new Ai(l,n,s,o,a)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;if(s>=t[o-1])return n[o-1].evaluate(e);const r=K1(t,s),a=t[r],l=t[r+1],c=Ai.interpolationFactor(this.interpolation,s,a,l),h=n[r].evaluate(e),u=n[r+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ro(h,u,c);case"color":return ke.interpolate(h,u,c);case"padding":return si.interpolate(h,u,c);case"colorArray":return xn.interpolate(h,u,c);case"numberArray":return oi.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Oi.interpolate(h,u,c);case"array":return nl(h,u,c);case"projectionDefinition":return ri.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return ke.interpolate(h,u,c,"hcl");case"colorArray":return xn.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return ke.interpolate(h,u,c,"lab");case"colorArray":return xn.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 Op(i,e,t,n){const s=n-t,o=i-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}class ol{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 n=null;const s=t.expectedType;s&&s.kind!=="value"&&(n=s);const o=[];for(const a of e.slice(1)){const l=t.parse(a,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return s&&o.some(a=>tl(s,a.type))?new ol(Se,o):new ol(n,o)}evaluate(e){let t=null,n=0,s;for(const o of this.args)if(n++,t=o.evaluate(e),t&&t instanceof Bs&&!t.available&&(s||(s=t.name),t=null,n===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 J1(i,e){return i==="=="||i==="!="?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 CO(i,e,t){return e===t}function xO(i,e,t){return e!==t}function PO(i,e,t){return e<t}function SO(i,e,t){return e>t}function RO(i,e,t){return e<=t}function TO(i,e,t){return e>=t}function ew(i,e,t,n){return n.compare(e,t)===0}function IO(i,e,t,n){return!ew(i,e,t,n)}function OO(i,e,t,n){return n.compare(e,t)<0}function AO(i,e,t,n){return n.compare(e,t)>0}function MO(i,e,t,n){return n.compare(e,t)<=0}function DO(i,e,t,n){return n.compare(e,t)>=0}function Fr(i,e,t){const n=i!=="=="&&i!=="!=";return class _v{constructor(o,r,a){this.type=Re,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,Se);if(!l)return null;if(!J1(a,l.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${ut(l.type)}'.`);let c=r.parse(o[2],2,Se);if(!c)return null;if(!J1(a,c.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${ut(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error(`Cannot compare types '${ut(l.type)}' and '${ut(c.type)}'.`);n&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new ai(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new ai(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,qh),!h)return null}return new _v(l,c,h)}evaluate(o){const r=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const l=It(r),c=It(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new yt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const l=It(r),c=It(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 FO=Fr("==",CO,ew),LO=Fr("!=",xO,IO),zO=Fr("<",PO,OO),NO=Fr(">",SO,AO),kO=Fr("<=",RO,MO),jO=Fr(">=",TO,DO);class tu{constructor(e,t,n){this.type=qh,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object.");const s=t.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,Re);if(!s)return null;const o=t.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,Re);if(!o)return null;let r=null;return n.locale&&(r=t.parse(n.locale,1,be),!r)?null:new tu(s,o,r)}evaluate(e){return new Cp(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 Ap{constructor(e,t,n,s,o,r){this.type=be,this.number=e,this.locale=t,this.currency=n,this.unit=s,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const n=t.parse(e[1],1,ne);if(!n)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,be),!o))return null;let r=null;if(s.currency&&(r=t.parse(s.currency,1,be),!r))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,be),!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,ne),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=t.parse(s["max-fraction-digits"],1,ne),!c)?null:new Ap(n,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 Mp{constructor(e){this.type=Vh,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="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,ne),!l))return null;let c=null;if(a["text-font"]&&(c=t.parse(a["text-font"],1,en(be)),!c))return null;let h=null;if(a["text-color"]&&(h=t.parse(a["text-color"],1,Ii),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!mO.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,be),!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,Se);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 Mp(s)}evaluate(e){const t=n=>{const s=n.content.evaluate(e);return It(s)===el?new xp("",s,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new xp(sl(s),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new ns(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 Dp{constructor(e){this.type=el,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const n=t.parse(e[1],1,be);return n?new Dp(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=Bs.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class Fp{constructor(e){this.type=ne,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${ut(n.type)} instead.`):new Fp(n):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 yt(`Expected value to be of type string or array, but found ${ut(It(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Mi=8192;function UO(i,e){const t=GO(i[0]),n=VO(i[1]),s=Math.pow(2,e.z);return[Math.round(t*s*Mi),Math.round(n*s*Mi)]}function Lp(i,e){const t=Math.pow(2,e.z),n=(i[0]/Mi+e.x)/t,s=(i[1]/Mi+e.y)/t;return[qO(n),WO(s)]}function GO(i){return(180+i)/360}function qO(i){return i*360-180}function VO(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function WO(i){return 360/Math.PI*Math.atan(Math.exp((180-i*360)*Math.PI/180))-90}function rl(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function al(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function BO(i,e,t){return e[1]>i[1]!=t[1]>i[1]&&i[0]<(t[0]-e[0])*(i[1]-e[1])/(t[1]-e[1])+e[0]}function $O(i,e,t){const n=i[0]-e[0],s=i[1]-e[1],o=i[0]-t[0],r=i[1]-t[1];return n*r-o*s===0&&n*o<=0&&s*r<=0}function nu(i,e,t,n){const s=[e[0]-i[0],e[1]-i[1]],o=[n[0]-t[0],n[1]-t[1]];return ZO(o,s)===0?!1:!!(nw(i,e,t,n)&&nw(t,n,i,e))}function HO(i,e,t){for(const n of t)for(let s=0;s<n.length-1;++s)if(nu(i,e,n[s],n[s+1]))return!0;return!1}function Lr(i,e,t=!1){let n=!1;for(const s of e)for(let o=0;o<s.length-1;o++){if($O(i,s[o],s[o+1]))return t;BO(i,s[o],s[o+1])&&(n=!n)}return n}function XO(i,e){for(const t of e)if(Lr(i,t))return!0;return!1}function tw(i,e){for(const t of i)if(!Lr(t,e))return!1;for(let t=0;t<i.length-1;++t)if(HO(i[t],i[t+1],e))return!1;return!0}function YO(i,e){for(const t of e)if(tw(i,t))return!0;return!1}function ZO(i,e){return i[0]*e[1]-i[1]*e[0]}function nw(i,e,t,n){const s=i[0]-t[0],o=i[1]-t[1],r=e[0]-t[0],a=e[1]-t[1],l=n[0]-t[0],c=n[1]-t[1],h=s*c-l*o,u=r*c-l*a;return h>0&&u<0||h<0&&u>0}function zp(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=[];for(let r=0;r<i[s].length;r++){const a=UO(i[s][r],t);rl(e,a),o.push(a)}n.push(o)}return n}function iw(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=zp(i[s],e,t);n.push(o)}return n}function sw(i,e,t,n){if(i[0]<t[0]||i[0]>t[2]){const s=n*.5;let o=i[0]-t[0]>s?-n:t[0]-i[0]>s?n:0;o===0&&(o=i[0]-t[2]>s?-n:t[2]-i[0]>s?n:0),i[0]+=o}rl(e,i)}function KO(i){i[0]=i[1]=1/0,i[2]=i[3]=-1/0}function ow(i,e,t,n){const s=Math.pow(2,n.z)*Mi,o=[n.x*Mi,n.y*Mi],r=[];for(const a of i)for(const l of a){const c=[l.x+o[0],l.y+o[1]];sw(c,e,t,s),r.push(c)}return r}function rw(i,e,t,n){const s=Math.pow(2,n.z)*Mi,o=[n.x*Mi,n.y*Mi],r=[];for(const a of i){const l=[];for(const c of a){const h=[c.x+o[0],c.y+o[1]];rl(e,h),l.push(h)}r.push(l)}if(e[2]-e[0]<=s/2){KO(e);for(const a of r)for(const l of a)sw(l,e,t,s)}return r}function QO(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=zp(e.coordinates,n,s),r=ow(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!Lr(a,o))return!1}if(e.type==="MultiPolygon"){const o=iw(e.coordinates,n,s),r=ow(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!XO(a,o))return!1}return!0}function JO(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=zp(e.coordinates,n,s),r=rw(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!tw(a,o))return!1}if(e.type==="MultiPolygon"){const o=iw(e.coordinates,n,s),r=rw(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!YO(a,o))return!1}return!0}class To{constructor(e,t){this.type=Re,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(il(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const s=[];for(const o of n.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 To(n,o)}}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new To(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new To(n,n)}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 QO(e,this.geometries);if(e.geometryType()==="LineString")return JO(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class aw{constructor(e=[],t=(n,s)=>n<s?-1:n>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}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:n}=this,s=t[e];for(;e>0;){const o=e-1>>1,r=t[o];if(n(s,r)>=0)break;t[e]=r,e=o}t[e]=s}_down(e){const{data:t,compare:n}=this,s=this.length>>1,o=t[e];for(;e<s;){let r=(e<<1)+1;const a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],o)>=0)break;t[e]=t[r],e=r}t[e]=o}}function e2(i,e){if(i.length<=1)return[i];const n=[];let s,o;for(const r of i){const a=t2(r);a!==0&&(r.area=Math.abs(a),o===void 0&&(o=a<0),o===a<0?(s&&n.push(s),s=[r]):s.push(r))}return s&&n.push(s),n}function t2(i){let e=0;for(let t=0,n=i.length,s=n-1,o,r;t<n;s=t++)o=i[t],r=i[s],e+=(r.x-o.x)*(o.y+r.y);return e}const n2=6378.137,lw=1/298.257223563,cw=lw*(2-lw),hw=Math.PI/180;class Np{constructor(e){const t=hw*n2*1e3,n=Math.cos(e*hw),s=1/(1-cw*(1-n*n)),o=Math.sqrt(s);this.kx=t*o*n,this.ky=t*o*s*(1-cw)}distance(e,t){const n=this.wrap(e[0]-t[0])*this.kx,s=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+s*s)}pointOnLine(e,t){let n=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<n&&(n=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 kp=100,jp=50;function uw(i,e){return e[0]-i[0]}function iu(i){return i[1]-i[0]+1}function is(i,e){return i[1]>=i[0]&&i[1]<e}function Up(i,e){if(i[0]>i[1])return[null,null];const t=iu(i);if(e){if(t===2)return[i,null];const s=Math.floor(t/2);return[[i[0],i[0]+s],[i[0]+s,i[1]]]}if(t===1)return[i,null];const n=Math.floor(t/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}function Gp(i,e){if(!is(e,i.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)rl(t,i[n]);return t}function qp(i){const e=[1/0,1/0,-1/0,-1/0];for(const t of i)for(const n of t)rl(e,n);return e}function dw(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Vp(i,e,t){if(!dw(i)||!dw(e))return NaN;let n=0,s=0;return i[2]<e[0]&&(n=e[0]-i[2]),i[0]>e[2]&&(n=i[0]-e[2]),i[1]>e[3]&&(s=i[1]-e[3]),i[3]<e[1]&&(s=e[1]-i[3]),t.distance([0,0],[n,s])}function Io(i,e,t){const n=t.pointOnLine(e,i);return t.distance(i,n.point)}function Wp(i,e,t,n,s){const o=Math.min(Io(i,[t,n],s),Io(e,[t,n],s)),r=Math.min(Io(t,[i,e],s),Io(n,[i,e],s));return Math.min(o,r)}function i2(i,e,t,n,s){if(!(is(e,i.length)&&is(n,t.length)))return 1/0;let r=1/0;for(let a=e[0];a<e[1];++a){const l=i[a],c=i[a+1];for(let h=n[0];h<n[1];++h){const u=t[h],d=t[h+1];if(nu(l,c,u,d))return 0;r=Math.min(r,Wp(l,c,u,d,s))}}return r}function s2(i,e,t,n,s){if(!(is(e,i.length)&&is(n,t.length)))return NaN;let r=1/0;for(let a=e[0];a<=e[1];++a)for(let l=n[0];l<=n[1];++l)if(r=Math.min(r,s.distance(i[a],t[l])),r===0)return r;return r}function o2(i,e,t){if(Lr(i,e,!0))return 0;let n=1/0;for(const s of e){const o=s[0],r=s[s.length-1];if(o!==r&&(n=Math.min(n,Io(i,[r,o],t)),n===0))return n;const a=t.pointOnLine(s,i);if(n=Math.min(n,t.distance(i,a.point)),n===0)return n}return n}function r2(i,e,t,n){if(!is(e,i.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Lr(i[o],t,!0))return 0;let s=1/0;for(let o=e[0];o<e[1];++o){const r=i[o],a=i[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(nu(r,a,d,f))return 0;s=Math.min(s,Wp(r,a,d,f,n))}}return s}function fw(i,e){for(const t of i)for(const n of t)if(Lr(n,e,!0))return!0;return!1}function a2(i,e,t,n=1/0){const s=qp(i),o=qp(e);if(n!==1/0&&Vp(s,o,t)>=n)return n;if(al(s,o)){if(fw(i,e))return 0}else if(fw(e,i))return 0;let r=1/0;for(const a of i)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(nu(u,d,E,w))return 0;r=Math.min(r,Wp(u,d,E,w,t))}}return r}function pw(i,e,t,n,s,o){if(!o)return;const r=Vp(Gp(n,o),s,t);r<e&&i.push([r,o,[0,0]])}function su(i,e,t,n,s,o,r){if(!o||!r)return;const a=Vp(Gp(n,o),Gp(s,r),t);a<e&&i.push([a,o,r])}function ou(i,e,t,n,s=1/0){let o=Math.min(n.distance(i[0],t[0][0]),s);if(o===0)return o;const r=new aw([[0,[0,i.length-1],[0,0]]],uw),a=qp(t);for(;r.length>0;){const l=r.pop();if(l[0]>=o)continue;const c=l[1],h=e?jp:kp;if(iu(c)<=h){if(!is(c,i.length))return NaN;if(e){const u=r2(i,c,t,n);if(isNaN(u)||u===0)return u;o=Math.min(o,u)}else for(let u=c[0];u<=c[1];++u){const d=o2(i[u],t,n);if(o=Math.min(o,d),o===0)return 0}}else{const u=Up(c,e);pw(r,o,n,i,a,u[0]),pw(r,o,n,i,a,u[1])}}return o}function ru(i,e,t,n,s,o=1/0){let r=Math.min(o,s.distance(i[0],t[0]));if(r===0)return r;const a=new aw([[0,[0,i.length-1],[0,t.length-1]]],uw);for(;a.length>0;){const l=a.pop();if(l[0]>=r)continue;const c=l[1],h=l[2],u=e?jp:kp,d=n?jp:kp;if(iu(c)<=u&&iu(h)<=d){if(!is(c,i.length)&&is(h,t.length))return NaN;let f;if(e&&n)f=i2(i,c,t,h,s),r=Math.min(r,f);else if(e&&!n){const g=i.slice(c[0],c[1]+1);for(let _=h[0];_<=h[1];++_)if(f=Io(t[_],g,s),r=Math.min(r,f),r===0)return r}else if(!e&&n){const g=t.slice(h[0],h[1]+1);for(let _=c[0];_<=c[1];++_)if(f=Io(i[_],g,s),r=Math.min(r,f),r===0)return r}else f=s2(i,c,t,h,s),r=Math.min(r,f)}else{const f=Up(c,e),g=Up(h,n);su(a,r,s,i,t,f[0],g[0]),su(a,r,s,i,t,f[0],g[1]),su(a,r,s,i,t,f[1],g[0]),su(a,r,s,i,t,f[1],g[1])}}return r}function l2(i,e){const t=i.geometry(),n=t.flat().map(r=>Lp([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new Np(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ru(n,!1,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ru(n,!1,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,ou(n,!1,r.coordinates,s,o));break}if(o===0)return o}return o}function c2(i,e){const t=i.geometry(),n=t.flat().map(r=>Lp([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new Np(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ru(n,!0,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ru(n,!0,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,ou(n,!0,r.coordinates,s,o));break}if(o===0)return o}return o}function h2(i,e){const t=i.geometry();if(t.length===0||t[0].length===0)return NaN;const n=e2(t).map(r=>r.map(a=>a.map(l=>Lp([l.x,l.y],i.canonical)))),s=new Np(n[0][0][0][1]);let o=1/0;for(const r of e)for(const a of n){switch(r.type){case"Point":o=Math.min(o,ou([r.coordinates],!1,a,s,o));break;case"LineString":o=Math.min(o,ou(r.coordinates,!0,a,s,o));break;case"Polygon":o=Math.min(o,a2(a,r.coordinates,s,o));break}if(o===0)return o}return o}function Bp(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class Oo{constructor(e,t){this.type=ne,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(il(e[1])){const n=e[1];if(n.type==="FeatureCollection")return new Oo(n,n.features.map(s=>Bp(s.geometry)).flat());if(n.type==="Feature")return new Oo(n,Bp(n.geometry));if("type"in n&&"coordinates"in n)return new Oo(n,Bp(n))}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 l2(e,this.geometries);if(e.geometryType()==="LineString")return c2(e,this.geometries);if(e.geometryType()==="Polygon")return h2(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class ll{constructor(e){this.type=Se,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=e[1];return n==null?t.error("Global state property must be defined."):typeof n!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new ll(n)}evaluate(e){var t;const n=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!n||Object.keys(n).length===0?null:B1(n,this.key)}eachChild(){}outputDefined(){return!1}}const au={"==":FO,"!=":LO,">":NO,"<":zO,">=":jO,"<=":kO,array:ai,at:Pp,boolean:ai,case:Tp,coalesce:ol,collator:tu,format:Mp,image:Dp,in:Sp,"index-of":Qh,interpolate:Ai,"interpolate-hcl":Ai,"interpolate-lab":Ai,length:Fp,let:Zh,literal:Dr,match:Rp,number:ai,"number-format":Ap,object:ai,slice:Jh,step:eu,string:ai,"to-boolean":$s,"to-color":$s,"to-number":$s,"to-string":$s,var:Kh,within:To,distance:Oo,"global-state":ll};class Pn{constructor(e,t,n,s){this.name=e,this.type=t,this._evaluate=n,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 n=e[0],s=Pn.definitions[n];if(!s)return t.error(`Unknown expression "${n}". 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 Yh(t.registry,lu,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 Pn(n,o,h,u)}}if(a.length===1)t.errors.push(...l.errors);else{const h=(a.length?a:r).map(([d])=>d2(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(ut(f.type))}t.error(`Expected arguments of type ${h}, but found (${u.join(", ")}) instead.`)}return null}static register(e,t){Pn.definitions=t;for(const n in t)e[n]=Pn}}function gw(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const o=s?s.evaluate(i):1,r=X1(e,t,n,o);if(r)throw new yt(r);return new ke(e/255,t/255,n/255,o,!1)}function mw(i,e){return i in e}function $p(i,e){const t=e[i];return typeof t>"u"?null:t}function u2(i,e,t,n){for(;t<=n;){const s=t+n>>1;if(e[s]===i)return!0;e[s]>i?n=s-1:t=s+1}return!1}function Ao(i){return{type:i}}Pn.register(au,{error:[oO,[be],(i,[e])=>{throw new yt(e.evaluate(i))}],typeof:[be,[Se],(i,[e])=>ut(It(e.evaluate(i)))],"to-rgba":[en(ne,4),[Ii],(i,[e])=>{const[t,n,s,o]=e.evaluate(i).rgb;return[t*255,n*255,s*255,o]}],rgb:[Ii,[ne,ne,ne],gw],rgba:[Ii,[ne,ne,ne,ne],gw],has:{type:Re,overloads:[[[be],(i,[e])=>mw(e.evaluate(i),i.properties())],[[be,Po],(i,[e,t])=>mw(e.evaluate(i),t.evaluate(i))]]},get:{type:Se,overloads:[[[be],(i,[e])=>$p(e.evaluate(i),i.properties())],[[be,Po],(i,[e,t])=>$p(e.evaluate(i),t.evaluate(i))]]},"feature-state":[Se,[be],(i,[e])=>$p(e.evaluate(i),i.featureState||{})],properties:[Po,[],i=>i.properties()],"geometry-type":[be,[],i=>i.geometryType()],id:[Se,[],i=>i.id()],zoom:[ne,[],i=>i.globals.zoom],"heatmap-density":[ne,[],i=>i.globals.heatmapDensity||0],elevation:[ne,[],i=>i.globals.elevation||0],"line-progress":[ne,[],i=>i.globals.lineProgress||0],accumulated:[Se,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ne,Ao(ne),(i,e)=>{let t=0;for(const n of e)t+=n.evaluate(i);return t}],"*":[ne,Ao(ne),(i,e)=>{let t=1;for(const n of e)t*=n.evaluate(i);return t}],"-":{type:ne,overloads:[[[ne,ne],(i,[e,t])=>e.evaluate(i)-t.evaluate(i)],[[ne],(i,[e])=>-e.evaluate(i)]]},"/":[ne,[ne,ne],(i,[e,t])=>e.evaluate(i)/t.evaluate(i)],"%":[ne,[ne,ne],(i,[e,t])=>e.evaluate(i)%t.evaluate(i)],ln2:[ne,[],()=>Math.LN2],pi:[ne,[],()=>Math.PI],e:[ne,[],()=>Math.E],"^":[ne,[ne,ne],(i,[e,t])=>Math.pow(e.evaluate(i),t.evaluate(i))],sqrt:[ne,[ne],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ne,[ne],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ne,[ne],(i,[e])=>Math.log(e.evaluate(i))],log2:[ne,[ne],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ne,[ne],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ne,[ne],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ne,[ne],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ne,[ne],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ne,[ne],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ne,[ne],(i,[e])=>Math.atan(e.evaluate(i))],min:[ne,Ao(ne),(i,e)=>Math.min(...e.map(t=>t.evaluate(i)))],max:[ne,Ao(ne),(i,e)=>Math.max(...e.map(t=>t.evaluate(i)))],abs:[ne,[ne],(i,[e])=>Math.abs(e.evaluate(i))],round:[ne,[ne],(i,[e])=>{const t=e.evaluate(i);return t<0?-Math.round(-t):Math.round(t)}],floor:[ne,[ne],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ne,[ne],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Re,[be,Se],(i,[e,t])=>i.properties()[e.value]===t.value],"filter-id-==":[Re,[Se],(i,[e])=>i.id()===e.value],"filter-type-==":[Re,[be],(i,[e])=>i.geometryType()===e.value],"filter-<":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<s}],"filter-id-<":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>s}],"filter-id->":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[Re,[Se],(i,[e])=>e.value in i.properties()],"filter-has-id":[Re,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Re,[en(be)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Re,[en(Se)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Re,[be,en(Se)],(i,[e,t])=>t.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Re,[be,en(Se)],(i,[e,t])=>u2(i.properties()[e.value],t.value,0,t.value.length-1)],all:{type:Re,overloads:[[[Re,Re],(i,[e,t])=>e.evaluate(i)&&t.evaluate(i)],[Ao(Re),(i,e)=>{for(const t of e)if(!t.evaluate(i))return!1;return!0}]]},any:{type:Re,overloads:[[[Re,Re],(i,[e,t])=>e.evaluate(i)||t.evaluate(i)],[Ao(Re),(i,e)=>{for(const t of e)if(t.evaluate(i))return!0;return!1}]]},"!":[Re,[Re],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Re,[be],(i,[e])=>{const t=i.globals&&i.globals.isSupportedScript;return t?t(e.evaluate(i)):!0}],upcase:[be,[be],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[be,[be],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[be,Ao(Se),(i,e)=>e.map(t=>sl(t.evaluate(i))).join("")],split:[en(be),[be,be],(i,[e,t])=>e.evaluate(i).split(t.evaluate(i))],join:[be,[en(be),be],(i,[e,t])=>e.evaluate(i).join(t.evaluate(i))],"resolved-locale":[be,[qh],(i,[e])=>e.evaluate(i).resolvedLocale()]});function d2(i){return Array.isArray(i)?`(${i.map(ut).join(", ")})`:`(${ut(i.type)}...)`}function lu(i){if(i instanceof Kh)return lu(i.boundExpression);if(i instanceof Pn&&i.name==="error")return!1;if(i instanceof tu)return!1;if(i instanceof To)return!1;if(i instanceof Oo)return!1;if(i instanceof ll)return!1;const e=i instanceof $s||i instanceof ai;let t=!0;return i.eachChild(n=>{e?t=t&&lu(n):t=t&&n instanceof Dr}),t?Hp(i)&&Yp(i,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Hp(i){if(i instanceof Pn){if(i.name==="get"&&i.args.length===1)return!1;if(i.name==="feature-state")return!1;if(i.name==="has"&&i.args.length===1)return!1;if(i.name==="properties"||i.name==="geometry-type"||i.name==="id")return!1;if(/^filter-/.test(i.name))return!1}if(i instanceof To||i instanceof Oo)return!1;let e=!0;return i.eachChild(t=>{e&&!Hp(t)&&(e=!1)}),e}function Xp(i){if(i instanceof Pn&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(t=>{e&&!Xp(t)&&(e=!1)}),e}function Yp(i,e){if(i instanceof Pn&&e.indexOf(i.name)>=0)return!1;let t=!0;return i.eachChild(n=>{t&&!Yp(n,e)&&(t=!1)}),t}function Zp(i){return{result:"success",value:i}}function zr(i){return{result:"error",value:i}}function f2(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function p2(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function g2(i){return!!i.expression&&i.expression.interpolated}function cu(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&It(i)===Po}class m2{constructor(e,t,n){this.expression=e,this._warningHistory={},this._evaluator=new Z1,this._defaultValue=t?_2(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this._globalState=n}evaluateWithoutErrorHandling(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,s,o,r){this._globalState&&(e=Nr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||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 yt(`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 hu(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in au}function yw(i,e,t){const n=new Yh(au,lu,[],e?y2(e):void 0),s=n.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Zp(new m2(s,e,t)):zr(n.errors)}class _w{constructor(e,t,n){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Xp(t.expression),this.globalStateRefs=du(t.expression),this._globalState=n}evaluateWithoutErrorHandling(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,o,r)}evaluate(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluate(e,t,n,s,o,r)}}class ww{constructor(e,t,n,s,o){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Xp(t.expression),this.globalStateRefs=du(t.expression),this.interpolationType=s,this._globalState=o}evaluateWithoutErrorHandling(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,o,r)}evaluate(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluate(e,t,n,s,o,r)}interpolationFactor(e,t,n){return this.interpolationType?Ai.interpolationFactor(this.interpolationType,e,t,n):0}}function vw(i,e,t){const n=yw(i,e,t);if(n.result==="error")return n;const s=n.value.expression,o=Hp(s);if(!o&&!f2(e))return zr([new Ti("","data expressions not supported")]);const r=Yp(s,["zoom"]);if(!r&&!p2(e))return zr([new Ti("","zoom expressions not supported")]);const a=uu(s);if(!a&&!r)return zr([new Ti("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Ti)return zr([a]);if(a instanceof Ai&&!g2(e))return zr([new Ti("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Zp(o?new _w("constant",n.value,t):new _w("source",n.value,t));const l=a instanceof Ai?a.interpolation:void 0;return Zp(o?new ww("camera",n.value,a.labels,l,t):new ww("composite",n.value,a.labels,l,t))}function uu(i){let e=null;if(i instanceof Zh)e=uu(i.result);else if(i instanceof ol){for(const t of i.args)if(e=uu(t),e)break}else(i instanceof eu||i instanceof Ai)&&i.input instanceof Pn&&i.input.name==="zoom"&&(e=i);return e instanceof Ti||i.eachChild(t=>{const n=uu(t);n instanceof Ti?e=n:!e&&n?e=new Ti("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new Ti("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function du(i,e=new Set){return i instanceof ll&&e.add(i.key),i.eachChild(t=>{du(t,e)}),e}function y2(i){const e={color:Ii,string:be,number:ne,enum:be,boolean:Re,formatted:Vh,padding:Wh,numberArray:Bh,colorArray:Ja,projectionDefinition:Gh,resolvedImage:el,variableAnchorOffsetCollection:$h};return i.type==="array"?en(e[i.value]||Se,i.length):e[i.type]}function _2(i){if(i.type==="color"&&cu(i.default))return new ke(0,0,0,0);switch(i.type){case"color":return ke.parse(i.default)||null;case"padding":return si.parse(i.default)||null;case"numberArray":return oi.parse(i.default)||null;case"colorArray":return xn.parse(i.default)||null;case"variableAnchorOffsetCollection":return Oi.parse(i.default)||null;case"projectionDefinition":return ri.parse(i.default)||null;default:return i.default===void 0?null:i.default}}function Nr(i,e){const{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a}=i??{};return{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a,globalState:e}}function bw(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!bw(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const w2={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function v2(i,e){if(i==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};bw(i)||(i=fu(i));const t=yw(i,w2,e);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));{const n=Ew(i);return{filter:(s,o,r)=>t.value.evaluate(s,o,{},r),needGeometry:n,getGlobalStateRefs:()=>du(t.value.expression)}}}function b2(i,e){return i<e?-1:i>e?1:0}function Ew(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(Ew(i[e]))return!0;return!1}function fu(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Kp(i[1],i[2],"=="):e==="!="?pu(Kp(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Kp(i[1],i[2],e):e==="any"?E2(i.slice(1)):e==="all"?["all"].concat(i.slice(1).map(fu)):e==="none"?["all"].concat(i.slice(1).map(fu).map(pu)):e==="in"?Cw(i[1],i.slice(2)):e==="!in"?pu(Cw(i[1],i.slice(2))):e==="has"?xw(i[1]):e==="!has"?pu(xw(i[1])):!0}function Kp(i,e,t){switch(i){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,i,e]}}function E2(i){return["any"].concat(i.map(fu))}function Cw(i,e){if(e.length===0)return!1;switch(i){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",i,["literal",e.sort(b2)]]:["filter-in-small",i,["literal",e]]}}function xw(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function pu(i){return["!",i]}function cl(i){return typeof i=="object"?["literal",i]:i}function Pw(i,e){let t=i.stops;if(!t)return C2(i,e);const n=t&&typeof t[0][0]=="object",s=n||i.property!==void 0,o=n||!s;return t=t.map(r=>!s&&e.tokens&&typeof r[1]=="string"?[r[0],R2(r[1])]:[r[0],cl(r[1])]),n?x2(i,e,t):o?S2(i,e,t):Jp(i,e,t)}function C2(i,e){const t=["get",i.property];if(i.default===void 0)return e.type==="string"?["string",t]:t;if(e.type==="enum")return["match",t,Object.keys(e.values),t,i.default];{const n=[e.type==="color"?"to-color":e.type,t,cl(i.default)];return e.type==="array"&&n.splice(1,0,e.value,e.length||null),n}}function Qp(i){switch(i.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function x2(i,e,t){const n={},s={},o=[];for(let a=0;a<t.length;a++){const l=t[a],c=l[0].zoom;n[c]===void 0&&(n[c]={zoom:c,type:i.type,property:i.property,default:i.default},s[c]=[],o.push(c)),s[c].push([l[0].value,l[1]])}if(tg({},e)==="exponential"){const a=[Qp(i),["linear"],["zoom"]];for(const l of o){const c=Jp(n[l],e,s[l]);kr(a,l,c,!1)}return a}else{const a=["step",["zoom"]];for(const l of o){const c=Jp(n[l],e,s[l]);kr(a,l,c,!0)}return eg(a),a}}function P2(i,e){if(i!==void 0)return i;if(e!==void 0)return e}function Sw(i,e){const t=cl(P2(i.default,e.default));return t===void 0&&e.type==="resolvedImage"?"":t}function Jp(i,e,t){const n=tg(i,e),s=["get",i.property];if(n==="categorical"&&typeof t[0][0]=="boolean"){const o=["case"];for(const r of t)o.push(["==",s,r[0]],r[1]);return o.push(Sw(i,e)),o}else if(n==="categorical"){const o=["match",s];for(const r of t)kr(o,r[0],r[1],!1);return o.push(Sw(i,e)),o}else if(n==="interval"){const o=["step",["number",s]];for(const r of t)kr(o,r[0],r[1],!0);return eg(o),i.default===void 0?o:["case",["==",["typeof",s],"number"],o,cl(i.default)]}else if(n==="exponential"){const o=i.base!==void 0?i.base:1,r=[Qp(i),o===1?["linear"]:["exponential",o],["number",s]];for(const a of t)kr(r,a[0],a[1],!1);return i.default===void 0?r:["case",["==",["typeof",s],"number"],r,cl(i.default)]}else throw new Error(`Unknown property function type ${n}`)}function S2(i,e,t,n=["zoom"]){const s=tg(i,e);let o,r=!1;if(s==="interval")o=["step",n],r=!0;else if(s==="exponential"){const a=i.base!==void 0?i.base:1;o=[Qp(i),a===1?["linear"]:["exponential",a],n]}else throw new Error(`Unknown zoom function type "${s}"`);for(const a of t)kr(o,a[0],a[1],r);return eg(o),o}function eg(i){i[0]==="step"&&i.length===3&&(i.push(0),i.push(i[3]))}function kr(i,e,t,n){i.length>3&&e===i[i.length-2]||(n&&i.length===2||i.push(e),i.push(t))}function tg(i,e){return i.type?i.type:e.expression.interpolated?"exponential":"interval"}function R2(i){const e=["concat"],t=/{([^{}]+)}/g;let n=0;for(let s=t.exec(i);s!==null;s=t.exec(i)){const o=i.slice(n,t.lastIndex-s[0].length);n=t.lastIndex,o.length>0&&e.push(o),e.push(["get",s[1]])}if(e.length===1)return i;if(n<i.length)e.push(i.slice(n));else if(e.length===2)return["to-string",e[1]];return e}const Rw=tO;var Tw={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},hl=" ",Iw=/(italic|oblique)$/i,Ow={};function ng(i,e,t){var n=Ow[i];if(!n){Array.isArray(i)||(i=[i]);for(var s=400,o="normal",r=[],a,l,c=0,h=i.length;c<h;++c){var u=i[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()):Iw.test(f)&&(f=f.replace(Iw,""),o=l?o:d[d.length-1].replace(f,""),l=!0);for(var g in Tw){var _=d.length>1?d[d.length-2].toLowerCase():"";if(f==g||f==g.replace("-","")||_+"-"+f==g){s=a?s:Tw[g],d.pop(),_&&g.startsWith(_)&&d.pop();break}}!a&&typeof f=="number"&&(s=f,a=!0);var v=d.join(hl).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");v.indexOf(hl)!==-1&&(v='"'+v+'"'),r.push(v)}n=Ow[i]=[o,s,r]}return n[0]+hl+n[1]+hl+e+"px"+(t?"/"+t:"")+hl+n[2]}function Aw(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const o=s?s.evaluate(i):1;return ke.parse(`hsla(${e}, ${t}%, ${n}%, ${o})`)}function T2(i){const e=i[0]/255,t=i[1]/255,n=i[2]/255,s=i[3],o=Math.max(e,t,n),r=Math.min(e,t,n),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-n)/h+(t<n?6:0);break;case t:l=(n-e)/h+2;break;case n:l=(e-t)/h+4;break;default:l=0}l/=6}return[l*360,c*100,a*100,s]}function gu(i){if(Array.isArray(i)){if(i.length===0)return i;const e=i[0];if(e==="literal")return i;if(e==="image"&&i.length===3&&typeof i[2]=="object"&&i[2]!==null&&!Array.isArray(i[2]))return["image-config",gu(i[1]),["literal",i[2]]];const t=i.length;for(let n=1;n<t;++n){const s=i[n],o=gu(s);if(o!==s){const r=[e];for(let a=1;a<n;++a)r.push(i[a]);r.push(o);for(let a=n+1;a<t;++a)r.push(gu(i[a]));return r}}}return i}const Mw={},Mo={zoom:0,distanceFromCenter:0};Pn.register(au,{...Pn.definitions,pitch:[{kind:"number"},[],i=>Mo.pitch||0],"distance-from-center":[{kind:"number"},[],i=>Mo.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(i,[e])=>T2(wc(e.evaluate(i)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],Aw],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],Aw],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(i,[e,t])=>e.evaluate(i)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(i,[e])=>{const t=Mw[e.evaluate(i)];return t===void 0?{}:t}]});const Dw="https://api.mapbox.com";function ig(i){const e="mapbox://";return i.indexOf(e)!==0?"":i.slice(e.length)}function I2(i,e,t){if(typeof i=="string")return[{id:"default",url:Fw(i,e,t)}];for(const n of i)n.url=Fw(n.url,e,t);return i}function Fw(i,e,t){const n=ig(i);if(!n)return decodeURI(new URL(i,t).href);const s="sprites/";if(n.indexOf(s)!==0)throw new Error(`unexpected sprites url: ${i}`);const o=n.slice(s.length);return`${Dw}/styles/v1/${o}/sprite?access_token=${e}`}function Lw(i,e){const t=ig(i);if(!t)return decodeURI(new URL(i,location.href).href);const n="styles/";if(t.indexOf(n)!==0)throw new Error(`unexpected style url: ${i}`);const s=t.slice(n.length);return`${Dw}/styles/v1/${s}?&access_token=${e}`}const O2=["a","b","c","d"];function mu(i,e,t,n){const s=new URL(i,n||location.href),o=ig(i);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 O2.map(r=>`https://${r}.tiles.mapbox.com/v4/${o}/{z}/{x}/{y}.vector.pbf?access_token=${e}`)}const sg=Object.freeze({}),zw={},Nw={};let A2=0;function og(i){return i.id||(i.id=A2++),i.id}function M2(i,e){return og(i)+"."+Pe(e)}function D2(i){let e=zw[i.id];return e||(e={},zw[og(i)]=e),e}function F2(i){let e=Nw[i.id];return e||(e={},Nw[og(i)]=e),e}function rg(i){return i*Math.PI/180}const ag=(function(){const i=[];for(let e=78271.51696402048;i.length<=24;e/=2)i.push(e);return i})();function yu(i,e){if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof OffscreenCanvas<"u")return new OffscreenCanvas(i,e);const t=document.createElement("canvas");return t.width=i,t.height=e,t}function L2(i,e){let t=0;const n=e.length;for(;t<n;++t)if(e[t]<i&&t+1<n){const o=e[t]/e[t+1];return t+Math.log(e[t]/i)/Math.log(o)}return n-1}function z2(i,e){const t=Math.floor(i),n=Math.pow(2,i-t);return e[t]/n}const jr={};function Ur(i,e,t={},n){if(e in jr)return n&&(n.url=jr[e][0].url),jr[e][1];const s=t.transformRequest&&t.transformRequest(e,i)||e,o=function(l){return delete jr[e],Promise.reject(new Error("Error fetching source "+e))},r=function(l){return delete jr[e],l.ok?l.json():Promise.reject(new Error("Error fetching source "+e))},a=$o(()=>s).then(l=>l instanceof Response?(n&&(n.url=l.url),r(l)):(l instanceof Request||(l=new Request(l)),l.headers.get("Accept")||l.headers.set("Accept","application/json"),n&&(n.url=l.url),fetch(l).then(r).catch(o))).catch(o);return jr[e]=[s,a],a}function N2(i,e){if(typeof i=="string")if(i.trim().startsWith("{"))try{const t=JSON.parse(i);return Promise.resolve(t)}catch(t){return Promise.reject(t)}else return i=Lw(i,e.accessToken),Ur("Style",i,e);else return Promise.resolve(i)}const kw={};function k2(i,e,t={}){const n=[e,JSON.stringify(i)].toString();let s=kw[n];if(!s||t.transformRequest){let o;t.transformRequest&&(o=(a,l)=>{const c=t.transformRequest&&t.transformRequest(l,"Tiles")||l;if(a instanceof zi.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(se.ERROR))}).catch(g=>a.setState(se.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(se.ERROR))}).catch(u=>a.setState(se.ERROR))}});const r=i.url;if(r&&!i.tiles){const a=mu(r,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(r.startsWith("mapbox://"))s=Promise.resolve({tileJson:Object.assign({},i,{url:void 0,tiles:a}),tileLoadFunction:o});else{const l={};s=Ur("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}")),mu(h,t.accessToken,t.accessTokenParam||"access_token",l.url)[0]}),Promise.resolve({tileJson:c,tileLoadFunction:o})})}}else i.tiles?(i=Object.assign({},i,{tiles:i.tiles.map(function(a){return i.scheme==="tms"&&(a=a.replace("{y}","{-y}")),mu(a,t.accessToken,t.accessTokenParam||"access_token",e||location.href)[0]})}),s=Promise.resolve({tileJson:Object.assign({},i),tileLoadFunction:o})):s=Promise.reject(new Error("source has no `tiles` nor `url`"));kw[n]=s}return s}function jw(i,e,t,n){const s=[2*t*e.pixelRatio+e.width,2*t*e.pixelRatio+e.height],o=yu(s[0],s[1]),r=o.getContext("2d");r.drawImage(i,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(${n.r*255},${n.g*255},${n.b*255},${n.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 j2(i,e,t){const n=Math.max(0,Math.min(1,(t-i)/(e-i)));return n*n*(3-2*n)}function Uw(i,e,t){const n=yu(e.width,e.height),s=n.getContext("2d");s.drawImage(i,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,_=j2(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),n}const U2=Array(256).join(" ");function lg(i,e){if(e>=.05){let t="";const n=i.split(`
159
+ `),s=U2.slice(0,Math.round(e/.1));for(let o=0,r=n.length;o<r;++o)o>0&&(t+=`
160
+ `),t+=n[o].split("").join(s);return t}return i}let cg;function Gw(){return cg||(cg=yu(1,1).getContext("2d")),cg}function G2(i,e){if(/\d+ \d+/.test(i)){const[t,n]=i.split(" ").map(Number);return t<=e&&e<=n}return i==e}function Do(i,e){return Gw().measureText(i).width+(i.length-1)*e}const _u={};uo.on("propertychange",()=>{for(const i in _u)delete _u[i]});function hg(i,e,t,n){if(i.indexOf(`
161
161
  `)!==-1){const r=i.split(`
162
162
  `),a=[];for(let l=0,c=r.length;l<c;++l)a.push(hg(r[l],e,t,n));return a.join(`
163
163
  `)}const s=t+","+e+","+i+","+n;let o=_u[s];if(!o){const r=i.split(" ");if(r.length>1){const a=Gw();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;Do(_,n)<=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(Do(g,n)<c*.35){const _=d>0?Do(u[d-1],n):1/0,v=d<f-1?Do(u[d+1],n):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(Do(g,n)>c*.7&&Do(_,n)<c*.6){const v=g.split(" "),E=v.pop();Do(E,n)<c*.2&&(u[d]=v.join(" "),u[d+1]=E+" "+_),f-=1}}o=u.join(`
164
- `)}else o=i;o=lg(o,n),_u[s]=o}return o}const qO=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],qw={};function VO(i,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(hn)return i;let t;for(let n=0,s=i.length;n<s;++n){const o=i[n];if(o in qw)continue;qw[o]=!0;const a=ng(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 n=0,s=t.length;n<s;++n){const o=t[n],r=o[0];if(qO.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()&&GO(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)}}}})(),i}const WO={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},BO={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]},Vw=function(i,e){let t=vw(i,e);if(t.result==="error"){const n=gu(i);n!==i&&(t=vw(n,e))}if(t.result==="error"){const n=t.value[0];return console.error("Error parsing expression:",i,n.key,n.message),{evaluate:()=>e.default}}return t.value};let wu,ug;function de(i,e,t,n,s,o){const r=i.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[r]||(s[r]={});const a=s[r];if(!a[t]){let l=(i[e]||sg)[t];const c=Rw[`${e}_${i.type}`]&&Rw[`${e}_${i.type}`][t];l===void 0&&c&&(l=c.default);let h=hu(l);if(!h&&cu(l)&&(l=Pw(l,c),h=!0),h){const u=Vw(l,c);a[t]=u.evaluate.bind(u)}else{const u=c?c.type:typeof l;(u==="color"||u==="colorArray")&&(l=ke.parse(l));let d=!1;if(u==="array")for(let f=0;f<l.length;++f){const g=l[f];if(hu(g)||cu(g)){d=!0;break}}if(d){const f=Object.assign({},c,{type:c.value}),g=[];for(let _=0;_<l.length;++_){let v=l[_];if(!hu(v)&&cu(v)&&(v=Pw(v,f)),hu(v)){const E=Vw(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](Mo,n,o)}function Ww(i,e,t,n){return de(i,"layout",`${t}-allow-overlap`,e,n)?de(i,"layout",`${t}-ignore-placement`,e,n)?"none":"obstacle":"declutter"}function $O(i,e,t,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(i in n))try{n[i]=vO(e).filter}catch(s){console.warn("Filter will evaluate to false: "+s.message),n[i]=function(){return!1}}return n[i](Mo,t)}function Fo(i,e){if(i){if(i.a===0||e===0)return;const t=i.a;return e=e===void 0?1:e,t===0?"transparent":"rgba("+Math.round(i.r*255/t)+","+Math.round(i.g*255/t)+","+Math.round(i.b*255/t)+","+t*e+")"}return i}const HO=/\{[^{}}]*\}/g;function dg(i,e){return i.replace(HO,function(t){return e[t.slice(1,-1)]||""})}function Bw(i,e){let t=i.split(":")[0];return t===i&&(t="default"),e[t]}const XO={};function YO(i,e,t,n=ag,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&&(Mw[C]=P.default)}if(e.version!=8)throw new Error("glStyle version 8 required.");XO[MO(e,i)]=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 O;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();O=URL.createObjectURL(z),I.src=O}I.addEventListener("load",function M(){I.removeEventListener("load",M),l[C]={image:I,size:[I.width,I.height]},i.changed(),O&&URL.revokeObjectURL(O)}),I.addEventListener("error",function M(){URL.revokeObjectURL(O),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=s2(e.layers),h={},u=[],d={},f={},g=DO(e),_=FO(e);let v;for(let C=0,P=c.length;C<P;++C){const R=c[C],O=R.id;if(typeof t=="string"&&R.source==t||Array.isArray(t)&&t.indexOf(O)!==-1){const I=R["source-layer"];if(v){if(R.source!==v)throw new Error(`Layer "${O}" 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(O)}}const E=[],w=function(C,P,R){var L,N,j;const O=((j=(N=(L=i.getSource)==null?void 0:L.call(i))==null?void 0:N.format_)==null?void 0:j.layerName_)??"mvt:layer",I=C.getProperties(),M=h[I[O]];if(!M)return;let z=n.indexOf(P);z==-1&&(z=LO(P,n)),Mo.zoom=z,Mo.distanceFromCenter=0;const k=C.getGeometry(),q=WO[k.getType()],H=i.get("map");if(H&&H instanceof yy&&q===1){const U=H.getSize();if(U){const B=H.getView().getCenter(),X=Tn(k.getExtent());Mo.distanceFromCenter=kv(B,X)/P/U[1]}}const m={id:C.getId(),properties:I,type:q},b=i.get("mapbox-featurestate")[C.getId()];let S=-1;for(let U=0,B=M.length;U<B;++U){const X=M[U],G=X.layer,ae=G.id;if(R!==void 0&&R!==ae)continue;const te=G.layout||sg,V=G.paint||sg;if(de(G,"layout","visibility",m,g,b)==="none"||"minzoom"in G&&z<G.minzoom||"maxzoom"in G&&z>=G.maxzoom)continue;const ie=G.filter;if(!ie||$O(ae,ie,m,_)){let he,me,Fe,ue,ze,J;const dt=X.index;if(q==3&&(G.type=="fill"||G.type=="fill-extrusion")){if(me=de(G,"paint",G.type+"-opacity",m,g,b),G.type+"-pattern"in V){const qe=de(G,"paint",G.type+"-pattern",m,g,b);if(qe){const je=typeof qe=="string"?dg(qe,I):qe.toString(),Me=Bw(je,l);if(s&&s[je]&&Me){++S,J=E[S],(!J||!J.getFill()||J.getStroke()||J.getText())&&(J=new $e({fill:new vt}),E[S]=J),Fe=J.getFill(),J.setZIndex(dt);const fe=je+"."+me;let Ze=f[fe];if(!Ze){const Ce=s[je],xe=yu(Ce.width,Ce.height),Be=xe.getContext("2d");Be.globalAlpha=me,Be.drawImage(Me.image,Ce.x,Ce.y,Ce.width,Ce.height,0,0,Ce.width,Ce.height),Ze=Be.createPattern(xe,"repeat"),f[fe]=Ze}Fe.setColor(Ze)}}}else if(he=Fo(de(G,"paint",G.type+"-color",m,g,b),me),G.type+"-outline-color"in V&&(ze=Fo(de(G,"paint",G.type+"-outline-color",m,g,b),me)),ze||(ze=he),he||ze){if(++S,J=E[S],(!J||he&&!J.getFill()||!he&&J.getFill()||ze&&!J.getStroke()||!ze&&J.getStroke()||J.getText())&&(J=new $e({fill:he?new vt:void 0,stroke:ze?new St:void 0}),E[S]=J),he&&(Fe=J.getFill(),Fe.setColor(he)),G.type==="fill-extrusion"){const qe=de(G,"paint","fill-extrusion-height",m,g,b);if(qe>0){const je=Math.max(.1,.9-Math.min(qe,225)/280);if(ze&&ze!=="transparent"){const Me=ke.parse(ze);ze=`rgba(${Math.round(Me.r*255*je)},${Math.round(Me.g*255*je)},${Math.round(Me.b*255*je)},${Me.a})`}}}ze&&(ue=J.getStroke(),ue.setColor(ze),ue.setWidth(.5)),J.setZIndex(dt)}}if(q!=1&&G.type=="line"){"line-pattern"in V?he=void 0:he=Fo(de(G,"paint","line-color",m,g,b),de(G,"paint","line-opacity",m,g,b));const qe=de(G,"paint","line-width",m,g,b);he&&qe>0&&(++S,J=E[S],(!J||!J.getStroke()||J.getFill()||J.getText())&&(J=new $e({stroke:new St}),E[S]=J),ue=J.getStroke(),ue.setLineCap(de(G,"layout","line-cap",m,g,b)),ue.setLineJoin(de(G,"layout","line-join",m,g,b)),ue.setMiterLimit(de(G,"layout","line-miter-limit",m,g,b)),ue.setColor(he),ue.setWidth(qe),ue.setLineDash(V["line-dasharray"]?de(G,"paint","line-dasharray",m,g,b).map(function(je){return je*qe}):null),ue.setOffset(de(G,"paint","line-offset",m,g,b)),J.setZIndex(dt))}let Qe=!1,ye=null,sn=0,Gt,_t,Mt;if((q==1||q==2)&&"icon-image"in te){const qe=de(G,"layout","icon-image",m,g,b);if(qe){Gt=typeof qe=="string"?dg(qe,I):qe.toString();let je;const Me=a?a(i,Gt):void 0,fe=Bw(Gt,l);if(s&&s[Gt]&&fe||Me){const Ze=de(G,"layout","icon-rotation-alignment",m,g,b);if(q==2){const Ce=C.getGeometry();if(Ce.getFlatMidpoint||Ce.getFlatMidpoints){const xe=Ce.getExtent();if(Math.sqrt(Math.max(Math.pow((xe[2]-xe[0])/P,2),Math.pow((xe[3]-xe[1])/P,2)))>150){const Et=Ce.getType()==="MultiLineString"?Ce.getFlatMidpoints():Ce.getFlatMidpoint();if(ug||(wu=[NaN,NaN],ug=new Bt("Point",wu,[],2,{},void 0)),je=ug,wu[0]=Et[0],wu[1]=Et[1],de(G,"layout","symbol-placement",m,g,b)==="line"&&Ze==="map"){const qt=Ce.getStride(),lt=Ce.getFlatCoordinates();for(let Dt=0,it=lt.length-qt;Dt<it;Dt+=qt){const Vt=lt[Dt],zt=lt[Dt+1],Pt=lt[Dt+qt],et=lt[Dt+qt+1],Ot=Math.min(Vt,Pt),Fi=Math.max(Vt,Pt),Bn=Et[0],mn=Et[1],hs=(et-zt)*(Bn-Vt)-(Pt-Vt)*(mn-zt);if(Math.abs(hs)<.001&&Bn<=Fi&&Bn>=Ot){sn=Math.atan2(zt-et,Pt-Vt);break}}}}}}if(q!==2||je){const Ce=de(G,"layout","icon-size",m,g,b),xe=V["icon-color"]!==void 0?de(G,"paint","icon-color",m,g,b):null;if(!xe||xe.a!==0){const Be=de(G,"paint","icon-halo-color",m,g,b),Et=de(G,"paint","icon-halo-width",m,g,b);let on=`${Gt}.${Ce}.${Et}.${Be}`;if(xe!==null&&(on+=`.${xe}`),_t=d[on],!_t){const qt=Ww(G,m,"icon",g);let lt;"icon-offset"in te&&(lt=de(G,"layout","icon-offset",m,g,b).slice(0),lt[0]*=Ce,lt[1]*=-Ce);let Dt=xe?[xe.r*255,xe.g*255,xe.b*255,xe.a]:void 0;if(Me){const it={color:Dt,rotateWithView:Ze==="map",displacement:lt,declutterMode:qt,scale:Ce};typeof Me=="string"?it.src=Me:(it.img=Me,it.imgSize=[Me.width,Me.height]),_t=new Ps(it)}else{const it=s[Gt];let Vt,zt,Pt;if(Et)it.sdf?(Vt=jw(Uw(fe.image,it,xe||[0,0,0,1]),{x:0,y:0,width:it.width,height:it.height,pixelRatio:it.pixelRatio},Et,Be),Dt=void 0):Vt=jw(fe.image,it,Et,Be);else{if(it.sdf&&!fe.unSDFed){const et=Uw(fe.image,{x:0,y:0,width:fe.size[0],height:fe.size[1]},{r:1,g:1,b:1});fe.image=et,fe.unSDFed=!0}Vt=fe.image,zt=[it.width,it.height],Pt=[it.x,it.y]}_t=new Ps({color:Dt,img:Vt,imgSize:fe.size,size:zt,offset:Pt,rotateWithView:Ze==="map",scale:Ce/it.pixelRatio,displacement:lt,declutterMode:qt})}d[on]=_t}}_t&&(++S,J=E[S],(!J||!J.getImage()||J.getFill()||J.getStroke())&&(J=new $e,E[S]=J),J.setGeometry(je),_t.setRotation(sn+rg(de(G,"layout","icon-rotate",m,g,b))),_t.setOpacity(de(G,"paint","icon-opacity",m,g,b)),_t.setAnchor(BO[de(G,"layout","icon-anchor",m,g,b)]),J.setImage(_t),ye=J.getText(),J.setText(void 0),J.setZIndex(dt),Qe=!0,Mt=!1)}else Mt=!0}}}if(q==1&&G.type==="circle"){++S,J=E[S],(!J||!J.getImage()||J.getFill()||J.getStroke())&&(J=new $e,E[S]=J);const qe="circle-radius"in V?de(G,"paint","circle-radius",m,g,b):5,je=Fo(de(G,"paint","circle-stroke-color",m,g,b),de(G,"paint","circle-stroke-opacity",m,g,b)),Me=de(G,"paint","circle-translate",m,g,b),fe=Fo(de(G,"paint","circle-color",m,g,b),de(G,"paint","circle-opacity",m,g,b)),Ze=de(G,"paint","circle-stroke-width",m,g,b),Ce=qe+"."+je+"."+fe+"."+Ze+"."+Me[0]+"."+Me[1];_t=d[Ce],_t||(_t=new Ln({radius:qe,displacement:[Me[0],-Me[1]],stroke:je&&Ze>0?new St({width:Ze,color:je}):void 0,fill:fe?new vt({color:fe}):void 0,declutterMode:"none"}),d[Ce]=_t),J.setImage(_t),ye=J.getText(),J.setText(void 0),J.setGeometry(void 0),J.setZIndex(dt),Qe=!0}let Je,qn,nt,Vn,Wn,ui;if("text-field"in te){Vn=Math.round(de(G,"layout","text-size",m,g,b));const qe=de(G,"layout","text-font",m,g,b);nt=de(G,"layout","text-line-height",m,g,b),qn=ng(r?r(qe,e.metadata?e.metadata["ol:webfonts"]:void 0):qe,Vn,nt),qn.includes("sans-serif")||(qn+=",sans-serif"),Wn=de(G,"layout","text-letter-spacing",m,g,b),ui=de(G,"layout","text-max-width",m,g,b);const je=de(G,"layout","text-field",m,g,b);typeof je=="object"&&je.sections?je.sections.length===1?Je=je.toString():Je=je.sections.reduce((Me,fe,Ze)=>{const Ce=fe.fontStack?fe.fontStack.split(","):qe,xe=ng(r?r(Ce):Ce,Vn*(fe.scale||1),nt);let Be=fe.text;if(Be===`
164
+ `)}else o=i;o=lg(o,n),_u[s]=o}return o}const q2=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],qw={};function V2(i,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(hn)return i;let t;for(let n=0,s=i.length;n<s;++n){const o=i[n];if(o in qw)continue;qw[o]=!0;const a=ng(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 n=0,s=t.length;n<s;++n){const o=t[n],r=o[0];if(q2.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()&&G2(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)}}}})(),i}const W2={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},B2={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]},Vw=function(i,e){let t=vw(i,e);if(t.result==="error"){const n=gu(i);n!==i&&(t=vw(n,e))}if(t.result==="error"){const n=t.value[0];return console.error("Error parsing expression:",i,n.key,n.message),{evaluate:()=>e.default}}return t.value};let wu,ug;function de(i,e,t,n,s,o){const r=i.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[r]||(s[r]={});const a=s[r];if(!a[t]){let l=(i[e]||sg)[t];const c=Rw[`${e}_${i.type}`]&&Rw[`${e}_${i.type}`][t];l===void 0&&c&&(l=c.default);let h=hu(l);if(!h&&cu(l)&&(l=Pw(l,c),h=!0),h){const u=Vw(l,c);a[t]=u.evaluate.bind(u)}else{const u=c?c.type:typeof l;(u==="color"||u==="colorArray")&&(l=ke.parse(l));let d=!1;if(u==="array")for(let f=0;f<l.length;++f){const g=l[f];if(hu(g)||cu(g)){d=!0;break}}if(d){const f=Object.assign({},c,{type:c.value}),g=[];for(let _=0;_<l.length;++_){let v=l[_];if(!hu(v)&&cu(v)&&(v=Pw(v,f)),hu(v)){const E=Vw(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](Mo,n,o)}function Ww(i,e,t,n){return de(i,"layout",`${t}-allow-overlap`,e,n)?de(i,"layout",`${t}-ignore-placement`,e,n)?"none":"obstacle":"declutter"}function $2(i,e,t,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(i in n))try{n[i]=v2(e).filter}catch(s){console.warn("Filter will evaluate to false: "+s.message),n[i]=function(){return!1}}return n[i](Mo,t)}function Fo(i,e){if(i){if(i.a===0||e===0)return;const t=i.a;return e=e===void 0?1:e,t===0?"transparent":"rgba("+Math.round(i.r*255/t)+","+Math.round(i.g*255/t)+","+Math.round(i.b*255/t)+","+t*e+")"}return i}const H2=/\{[^{}}]*\}/g;function dg(i,e){return i.replace(H2,function(t){return e[t.slice(1,-1)]||""})}function Bw(i,e){let t=i.split(":")[0];return t===i&&(t="default"),e[t]}const X2={};function Y2(i,e,t,n=ag,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&&(Mw[C]=P.default)}if(e.version!=8)throw new Error("glStyle version 8 required.");X2[M2(e,i)]=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 O;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();O=URL.createObjectURL(z),I.src=O}I.addEventListener("load",function M(){I.removeEventListener("load",M),l[C]={image:I,size:[I.width,I.height]},i.changed(),O&&URL.revokeObjectURL(O)}),I.addEventListener("error",function M(){URL.revokeObjectURL(O),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=sO(e.layers),h={},u=[],d={},f={},g=D2(e),_=F2(e);let v;for(let C=0,P=c.length;C<P;++C){const R=c[C],O=R.id;if(typeof t=="string"&&R.source==t||Array.isArray(t)&&t.indexOf(O)!==-1){const I=R["source-layer"];if(v){if(R.source!==v)throw new Error(`Layer "${O}" 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(O)}}const E=[],w=function(C,P,R){var L,N,j;const O=((j=(N=(L=i.getSource)==null?void 0:L.call(i))==null?void 0:N.format_)==null?void 0:j.layerName_)??"mvt:layer",I=C.getProperties(),M=h[I[O]];if(!M)return;let z=n.indexOf(P);z==-1&&(z=L2(P,n)),Mo.zoom=z,Mo.distanceFromCenter=0;const k=C.getGeometry(),q=W2[k.getType()],H=i.get("map");if(H&&H instanceof yy&&q===1){const U=H.getSize();if(U){const B=H.getView().getCenter(),X=Tn(k.getExtent());Mo.distanceFromCenter=kv(B,X)/P/U[1]}}const m={id:C.getId(),properties:I,type:q},b=i.get("mapbox-featurestate")[C.getId()];let S=-1;for(let U=0,B=M.length;U<B;++U){const X=M[U],G=X.layer,ae=G.id;if(R!==void 0&&R!==ae)continue;const te=G.layout||sg,V=G.paint||sg;if(de(G,"layout","visibility",m,g,b)==="none"||"minzoom"in G&&z<G.minzoom||"maxzoom"in G&&z>=G.maxzoom)continue;const ie=G.filter;if(!ie||$2(ae,ie,m,_)){let he,me,Fe,ue,ze,J;const dt=X.index;if(q==3&&(G.type=="fill"||G.type=="fill-extrusion")){if(me=de(G,"paint",G.type+"-opacity",m,g,b),G.type+"-pattern"in V){const qe=de(G,"paint",G.type+"-pattern",m,g,b);if(qe){const je=typeof qe=="string"?dg(qe,I):qe.toString(),Me=Bw(je,l);if(s&&s[je]&&Me){++S,J=E[S],(!J||!J.getFill()||J.getStroke()||J.getText())&&(J=new $e({fill:new vt}),E[S]=J),Fe=J.getFill(),J.setZIndex(dt);const fe=je+"."+me;let Ze=f[fe];if(!Ze){const Ce=s[je],xe=yu(Ce.width,Ce.height),Be=xe.getContext("2d");Be.globalAlpha=me,Be.drawImage(Me.image,Ce.x,Ce.y,Ce.width,Ce.height,0,0,Ce.width,Ce.height),Ze=Be.createPattern(xe,"repeat"),f[fe]=Ze}Fe.setColor(Ze)}}}else if(he=Fo(de(G,"paint",G.type+"-color",m,g,b),me),G.type+"-outline-color"in V&&(ze=Fo(de(G,"paint",G.type+"-outline-color",m,g,b),me)),ze||(ze=he),he||ze){if(++S,J=E[S],(!J||he&&!J.getFill()||!he&&J.getFill()||ze&&!J.getStroke()||!ze&&J.getStroke()||J.getText())&&(J=new $e({fill:he?new vt:void 0,stroke:ze?new St:void 0}),E[S]=J),he&&(Fe=J.getFill(),Fe.setColor(he)),G.type==="fill-extrusion"){const qe=de(G,"paint","fill-extrusion-height",m,g,b);if(qe>0){const je=Math.max(.1,.9-Math.min(qe,225)/280);if(ze&&ze!=="transparent"){const Me=ke.parse(ze);ze=`rgba(${Math.round(Me.r*255*je)},${Math.round(Me.g*255*je)},${Math.round(Me.b*255*je)},${Me.a})`}}}ze&&(ue=J.getStroke(),ue.setColor(ze),ue.setWidth(.5)),J.setZIndex(dt)}}if(q!=1&&G.type=="line"){"line-pattern"in V?he=void 0:he=Fo(de(G,"paint","line-color",m,g,b),de(G,"paint","line-opacity",m,g,b));const qe=de(G,"paint","line-width",m,g,b);he&&qe>0&&(++S,J=E[S],(!J||!J.getStroke()||J.getFill()||J.getText())&&(J=new $e({stroke:new St}),E[S]=J),ue=J.getStroke(),ue.setLineCap(de(G,"layout","line-cap",m,g,b)),ue.setLineJoin(de(G,"layout","line-join",m,g,b)),ue.setMiterLimit(de(G,"layout","line-miter-limit",m,g,b)),ue.setColor(he),ue.setWidth(qe),ue.setLineDash(V["line-dasharray"]?de(G,"paint","line-dasharray",m,g,b).map(function(je){return je*qe}):null),ue.setOffset(de(G,"paint","line-offset",m,g,b)),J.setZIndex(dt))}let Qe=!1,ye=null,sn=0,Gt,_t,Mt;if((q==1||q==2)&&"icon-image"in te){const qe=de(G,"layout","icon-image",m,g,b);if(qe){Gt=typeof qe=="string"?dg(qe,I):qe.toString();let je;const Me=a?a(i,Gt):void 0,fe=Bw(Gt,l);if(s&&s[Gt]&&fe||Me){const Ze=de(G,"layout","icon-rotation-alignment",m,g,b);if(q==2){const Ce=C.getGeometry();if(Ce.getFlatMidpoint||Ce.getFlatMidpoints){const xe=Ce.getExtent();if(Math.sqrt(Math.max(Math.pow((xe[2]-xe[0])/P,2),Math.pow((xe[3]-xe[1])/P,2)))>150){const Et=Ce.getType()==="MultiLineString"?Ce.getFlatMidpoints():Ce.getFlatMidpoint();if(ug||(wu=[NaN,NaN],ug=new Bt("Point",wu,[],2,{},void 0)),je=ug,wu[0]=Et[0],wu[1]=Et[1],de(G,"layout","symbol-placement",m,g,b)==="line"&&Ze==="map"){const qt=Ce.getStride(),lt=Ce.getFlatCoordinates();for(let Dt=0,it=lt.length-qt;Dt<it;Dt+=qt){const Vt=lt[Dt],zt=lt[Dt+1],Pt=lt[Dt+qt],et=lt[Dt+qt+1],Ot=Math.min(Vt,Pt),Fi=Math.max(Vt,Pt),Bn=Et[0],mn=Et[1],hs=(et-zt)*(Bn-Vt)-(Pt-Vt)*(mn-zt);if(Math.abs(hs)<.001&&Bn<=Fi&&Bn>=Ot){sn=Math.atan2(zt-et,Pt-Vt);break}}}}}}if(q!==2||je){const Ce=de(G,"layout","icon-size",m,g,b),xe=V["icon-color"]!==void 0?de(G,"paint","icon-color",m,g,b):null;if(!xe||xe.a!==0){const Be=de(G,"paint","icon-halo-color",m,g,b),Et=de(G,"paint","icon-halo-width",m,g,b);let on=`${Gt}.${Ce}.${Et}.${Be}`;if(xe!==null&&(on+=`.${xe}`),_t=d[on],!_t){const qt=Ww(G,m,"icon",g);let lt;"icon-offset"in te&&(lt=de(G,"layout","icon-offset",m,g,b).slice(0),lt[0]*=Ce,lt[1]*=-Ce);let Dt=xe?[xe.r*255,xe.g*255,xe.b*255,xe.a]:void 0;if(Me){const it={color:Dt,rotateWithView:Ze==="map",displacement:lt,declutterMode:qt,scale:Ce};typeof Me=="string"?it.src=Me:(it.img=Me,it.imgSize=[Me.width,Me.height]),_t=new Ps(it)}else{const it=s[Gt];let Vt,zt,Pt;if(Et)it.sdf?(Vt=jw(Uw(fe.image,it,xe||[0,0,0,1]),{x:0,y:0,width:it.width,height:it.height,pixelRatio:it.pixelRatio},Et,Be),Dt=void 0):Vt=jw(fe.image,it,Et,Be);else{if(it.sdf&&!fe.unSDFed){const et=Uw(fe.image,{x:0,y:0,width:fe.size[0],height:fe.size[1]},{r:1,g:1,b:1});fe.image=et,fe.unSDFed=!0}Vt=fe.image,zt=[it.width,it.height],Pt=[it.x,it.y]}_t=new Ps({color:Dt,img:Vt,imgSize:fe.size,size:zt,offset:Pt,rotateWithView:Ze==="map",scale:Ce/it.pixelRatio,displacement:lt,declutterMode:qt})}d[on]=_t}}_t&&(++S,J=E[S],(!J||!J.getImage()||J.getFill()||J.getStroke())&&(J=new $e,E[S]=J),J.setGeometry(je),_t.setRotation(sn+rg(de(G,"layout","icon-rotate",m,g,b))),_t.setOpacity(de(G,"paint","icon-opacity",m,g,b)),_t.setAnchor(B2[de(G,"layout","icon-anchor",m,g,b)]),J.setImage(_t),ye=J.getText(),J.setText(void 0),J.setZIndex(dt),Qe=!0,Mt=!1)}else Mt=!0}}}if(q==1&&G.type==="circle"){++S,J=E[S],(!J||!J.getImage()||J.getFill()||J.getStroke())&&(J=new $e,E[S]=J);const qe="circle-radius"in V?de(G,"paint","circle-radius",m,g,b):5,je=Fo(de(G,"paint","circle-stroke-color",m,g,b),de(G,"paint","circle-stroke-opacity",m,g,b)),Me=de(G,"paint","circle-translate",m,g,b),fe=Fo(de(G,"paint","circle-color",m,g,b),de(G,"paint","circle-opacity",m,g,b)),Ze=de(G,"paint","circle-stroke-width",m,g,b),Ce=qe+"."+je+"."+fe+"."+Ze+"."+Me[0]+"."+Me[1];_t=d[Ce],_t||(_t=new Ln({radius:qe,displacement:[Me[0],-Me[1]],stroke:je&&Ze>0?new St({width:Ze,color:je}):void 0,fill:fe?new vt({color:fe}):void 0,declutterMode:"none"}),d[Ce]=_t),J.setImage(_t),ye=J.getText(),J.setText(void 0),J.setGeometry(void 0),J.setZIndex(dt),Qe=!0}let Je,qn,nt,Vn,Wn,ui;if("text-field"in te){Vn=Math.round(de(G,"layout","text-size",m,g,b));const qe=de(G,"layout","text-font",m,g,b);nt=de(G,"layout","text-line-height",m,g,b),qn=ng(r?r(qe,e.metadata?e.metadata["ol:webfonts"]:void 0):qe,Vn,nt),qn.includes("sans-serif")||(qn+=",sans-serif"),Wn=de(G,"layout","text-letter-spacing",m,g,b),ui=de(G,"layout","text-max-width",m,g,b);const je=de(G,"layout","text-field",m,g,b);typeof je=="object"&&je.sections?je.sections.length===1?Je=je.toString():Je=je.sections.reduce((Me,fe,Ze)=>{const Ce=fe.fontStack?fe.fontStack.split(","):qe,xe=ng(r?r(Ce):Ce,Vn*(fe.scale||1),nt);let Be=fe.text;if(Be===`
165
165
  `)return Me.push(`
166
166
  `,""),Me;if(q==2)return Me.push(lg(Be,Wn),xe),Me;Be=hg(Be,xe,ui,Wn).split(`
167
167
  `);for(let Et=0,on=Be.length;Et<on;++Et)Et>0&&Me.push(`
168
- `,""),Me.push(Be[Et],xe);return Me},[]):Je=dg(je,I).trim(),me=de(G,"paint","text-opacity",m,g,b)}if(Je&&me&&!Mt){Qe||(++S,J=E[S],(!J||!J.getText()||J.getFill()||J.getStroke())&&(J=new $e,E[S]=J),J.setImage(void 0),J.setGeometry(void 0));const qe=Ww(G,m,"text",g);J.getText()||J.setText(ye),ye=J.getText(),(!ye||"getDeclutterMode"in ye&&ye.getDeclutterMode()!==qe)&&(ye=new ir({padding:[2,2,2,2],declutterMode:qe}),J.setText(ye));const je=de(G,"layout","text-transform",m,g,b);je=="uppercase"?Je=Array.isArray(Je)?Je.map((et,Ot)=>Ot%2?et:et.toUpperCase()):Je.toUpperCase():je=="lowercase"&&(Je=Array.isArray(Je)?Je.map((et,Ot)=>Ot%2?et:et.toLowerCase()):Je.toLowerCase());const Me=Array.isArray(Je)?Je:q==2?lg(Je,Wn):hg(Je,qn,ui,Wn);if(ye.setText(Me),ye.setFont(qn),ye.setRotation(rg(de(G,"layout","text-rotate",m,g,b))),typeof ye.setKeepUpright=="function"){const et=de(G,"layout","text-keep-upright",m,g,b);ye.setKeepUpright(et)}const fe=de(G,"layout","text-anchor",m,g,b),Ze=Qe||q==1?"point":de(G,"layout","symbol-placement",m,g,b);let Ce;if(Ze==="line-center"?(ye.setPlacement("line"),Ce="center"):ye.setPlacement(Ze),Ze==="line"&&typeof ye.setRepeat=="function"){const et=de(G,"layout","symbol-spacing",m,g,b);ye.setRepeat(et*2)}ye.setOverflow(Ze==="point");let xe=de(G,"paint","text-halo-width",m,g,b);const Be=de(G,"layout","text-offset",m,g,b),Et=de(G,"paint","text-translate",m,g,b);let on=0,qt=0;if(Ze=="point"){Ce="center",fe.indexOf("left")!==-1?(Ce="left",qt=xe):fe.indexOf("right")!==-1&&(Ce="right",qt=-xe);const et=de(G,"layout","text-rotation-alignment",m,g,b);ye.setRotateWithView(et=="map")}else ye.setMaxAngle(rg(de(G,"layout","text-max-angle",m,g,b))*Je.length/Me.length),ye.setRotateWithView(!1);ye.setTextAlign(Ce);let lt="middle";fe.indexOf("bottom")==0?(lt="bottom",on=-xe-.5*(nt-1)*Vn):fe.indexOf("top")==0&&(lt="top",on=xe+.5*(nt-1)*Vn),ye.setTextBaseline(lt);const Dt=de(G,"layout","text-justify",m,g,b);ye.setJustify(Dt==="auto"?void 0:Dt),ye.setOffsetX(Be[0]*Vn+qt+Et[0]),ye.setOffsetY(Be[1]*Vn+on+Et[1]);const it=ye.getFill()||new vt;it.setColor(Fo(de(G,"paint","text-color",m,g,b),me)),ye.setFill(it);const Vt=Fo(de(G,"paint","text-halo-color",m,g,b),me);if(Vt&&xe>0){const et=ye.getStroke()||new St;et.setColor(Vt),xe*=2;const Ot=.5*Vn;et.setWidth(xe<=Ot?xe:Ot),ye.setStroke(et)}else ye.setStroke(void 0);const zt=de(G,"layout","text-padding",m,g,b),Pt=ye.getPadding();zt!==Pt[0]&&(Pt[0]=zt,Pt[1]=zt,Pt[2]=zt,Pt[3]=zt),J.setZIndex(dt)}}}if(S>-1)return E.length=S+1,E};return i.setStyle(w),i.set("mapbox-layers",u),i.set("mapbox-source",v),i.set("mapbox-featurestate",i.get("mapbox-featurestate")||{}),w}class ZO extends L1{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(vu(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(vu(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return we()}readFeaturesFromObject(e,t){return we()}readGeometry(e,t){return this.readGeometryFromObject(vu(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return we()}readProjection(e){return this.readProjectionFromObject(vu(e))}readProjectionFromObject(e){return we()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return we()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return we()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return we()}}function vu(i){if(typeof i=="string"){const e=JSON.parse(i);return e||null}return i!==null?i:null}class $w extends ZO{constructor(e){e=e||{},super(),this.dataProjection=De(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=De(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let n=null;e.type==="Feature"?n=e:n={type:"Feature",geometry:e,properties:null};const s=fg(n.geometry);if(this.featureClass===Bt)return z1({geometry:s,id:n.id,properties:n.properties},t);const o=new An;return this.geometryName_?o.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&o.setGeometryName(n.geometry_name),o.setGeometry(gp(s,t)),"id"in n&&o.setId(n.id),n.properties&&o.setProperties(n.properties,!0),o}readFeaturesFromObject(e,t){const n=e;let s=null;if(n.type==="FeatureCollection"){const o=e;s=[];const r=o.features;for(let a=0,l=r.length;a<l;++a){const c=this.readFeatureFromObject(r[a],t);c&&s.push(c)}}else s=[this.readFeatureFromObject(e,t)];return s.flat()}readGeometryFromObject(e,t){return KO(e,t)}readProjectionFromObject(e){const t=e.crs;let n;if(t)if(t.type=="name")n=De(t.properties.name);else if(t.type==="EPSG")n=De("EPSG:"+t.properties.code);else throw new Error("Unknown SRS type");else n=this.dataProjection;return n}writeFeatureObject(e,t){t=this.adaptOptions(t);const n={type:"Feature",geometry:null,properties:null},s=e.getId();if(s!==void 0&&(n.id=s),!e.hasProperties())return n;const o=e.getProperties(),r=e.getGeometry();return r&&(n.geometry=pg(r,t),delete o[e.getGeometryName()]),_s(o)||(n.properties=o),n}writeFeaturesObject(e,t){t=this.adaptOptions(t);const n=[];for(let s=0,o=e.length;s<o;++s)n.push(this.writeFeatureObject(e[s],t));return{type:"FeatureCollection",features:n}}writeGeometryObject(e,t){return pg(e,this.adaptOptions(t))}}function fg(i,e){if(!i)return null;let t;switch(i.type){case"Point":{t=JO(i);break}case"LineString":{t=eA(i);break}case"Polygon":{t=sA(i);break}case"MultiPoint":{t=nA(i);break}case"MultiLineString":{t=tA(i);break}case"MultiPolygon":{t=iA(i);break}case"GeometryCollection":{t=QO(i);break}default:throw new Error("Unsupported GeoJSON type: "+i.type)}return t}function KO(i,e){const t=fg(i);return gp(t,e)}function QO(i,e){return i.geometries.map(function(n){return fg(n)})}function JO(i){const e=i.coordinates;return{type:"Point",flatCoordinates:e,layout:oo(e.length)}}function eA(i){var n;const e=i.coordinates,t=e.flat();return{type:"LineString",flatCoordinates:t,ends:[t.length],layout:oo(((n=e[0])==null?void 0:n.length)||2)}}function tA(i){var o,r;const e=i.coordinates,t=((r=(o=e[0])==null?void 0:o[0])==null?void 0:r.length)||2,n=[],s=oa(n,0,e,t);return{type:"MultiLineString",flatCoordinates:n,ends:s,layout:oo(t)}}function nA(i){var t;const e=i.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:oo(((t=e[0])==null?void 0:t.length)||2)}}function iA(i){var o,r;const e=i.coordinates,t=[],n=((r=(o=e[0])==null?void 0:o[0])==null?void 0:r[0].length)||2,s=zm(t,0,e,n);return{type:"MultiPolygon",flatCoordinates:t,ends:s,layout:oo(n)}}function sA(i){var o,r;const e=i.coordinates,t=[],n=(r=(o=e[0])==null?void 0:o[0])==null?void 0:r.length,s=oa(t,0,e,n);return{type:"Polygon",flatCoordinates:t,ends:s,layout:oo(n)}}function pg(i,e){i=jh(i,!0,e);const t=i.getType();let n;switch(t){case"Point":{n=hA(i);break}case"LineString":{n=rA(i);break}case"Polygon":{n=uA(i,e);break}case"MultiPoint":{n=lA(i);break}case"MultiLineString":{n=aA(i);break}case"MultiPolygon":{n=cA(i,e);break}case"GeometryCollection":{n=oA(i,e);break}case"Circle":{n={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+t)}return n}function oA(i,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:i.getGeometriesArray().map(function(n){return pg(n,e)})}}function rA(i,e){return{type:"LineString",coordinates:i.getCoordinates()}}function aA(i,e){return{type:"MultiLineString",coordinates:i.getCoordinates()}}function lA(i,e){return{type:"MultiPoint",coordinates:i.getCoordinates()}}function cA(i,e){let t;return e&&(t=e.rightHanded),{type:"MultiPolygon",coordinates:i.getCoordinates(t)}}function hA(i,e){return{type:"Point",coordinates:i.getCoordinates()}}function uA(i,e){let t;return e&&(t=e.rightHanded),{type:"Polygon",coordinates:i.getCoordinates(t)}}function dA(i,e,t,n){const s=document.createElement("script"),o="olc_"+Pe(e);function r(){delete globalThis[o],s.parentNode.removeChild(s)}s.async=!0,s.src=i+(i.includes("?")?"&":"?")+"callback="+o;const a=setTimeout(function(){r(),t&&t()},1e4);globalThis[o]=function(l){clearTimeout(a),r(),e(l)},document.head.appendChild(s)}class fA extends Fh{constructor(e){if(super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:De("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.tileJSON_=null,this.tileSize_=e.tileSize,e.url)if(e.jsonp)dA(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else if(e.tileJSON)this.handleTileJSONResponse(e.tileJSON);else throw new Error("Either `url` or `tileJSON` options must be provided")}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let n;try{n=JSON.parse(t.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(n)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(e){const t=De("EPSG:4326"),n=this.getProjection();let s;if(e.bounds!==void 0){const c=ia(t,n);s=Jg(e.bounds,c)}const o=Ka(n),r=e.minzoom||0,a=e.maxzoom||22,l=Ir({extent:o,maxZoom:a,minZoom:r,tileSize:this.tileSize_});if(this.tileGrid=l,this.tileUrlFunction=T1(e.tiles,l),e.attribution&&!this.getAttributions()){const c=s!==void 0?s:o;this.setAttributions(function(h){return pt(c,h.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState("ready")}handleTileJSONError(){this.setState("error")}}ke.parse("#000000"),ke.parse("#FFFFFF"),ke.parse("#000000");function pA(i,e=512){return i.getExtent()?Ir({extent:i.getExtent(),tileSize:e,maxZoom:22}).getResolutions():ag}function gA(i,e){return e.accessToken||(e=Object.assign({},e),new URL(i).searchParams.forEach((n,s)=>{e.accessToken=n,e.accessTokenParam=s})),e}function mA(i,e,t="",n={},s=void 0){let o,r,a,l,c=!0;return typeof t!="string"&&!Array.isArray(t)?(a=t,l=a.source||a.layers,n=a):l=t,typeof n=="string"?(o=n,a={}):(o=n.styleUrl,a=n),a.updateSource===!1&&(c=!1),s||(s=a.resolutions),!o&&typeof e=="string"&&!e.trim().startsWith("{")&&(o=e),o&&(o=o.startsWith("data:")?location.href:Lw(o,a.accessToken),a=gA(o,a)),new Promise(function(h,u){NO(e,a).then(function(d){if(d.version!=8)return u(new Error("glStyle version 8 required."));if(!(i instanceof zn||i instanceof zh))return u(new Error("Can only apply to VectorLayer or VectorTileLayer"));const f=i instanceof zh?"vector":"geojson";if(l?Array.isArray(l)?r=d.layers.find(function(P){return P.id===l[0]}).source:r=l:(r=d.layers.find(function(P){return P.source&&d.sources[P.source].type===f}).source,l=r),!r)return u(new Error(`No ${f} source found in the glStyle.`));function g(){if(!c)return Promise.resolve();if(i instanceof zh)return wA(d.sources[r],o,a).then(function(I){const M=i.getSource();M?I!==M&&(M.setTileUrlFunction(I.getTileUrlFunction()),typeof M.setUrls=="function"&&typeof I.getUrls=="function"&&M.setUrls(I.getUrls()),M.format_||(M.format_=I.format_),M.getAttributions()||M.setAttributions(I.getAttributions()),M.getTileLoadFunction()===A1&&M.setTileLoadFunction(I.getTileLoadFunction()),Wt(M.getProjection(),I.getProjection())&&(M.tileGrid=I.getTileGrid())):i.setSource(I);const z=i.getSource().getTileGrid();!isFinite(i.getMaxResolution())&&!isFinite(i.getMinZoom())&&z.getMinZoom()>0&&i.setMaxResolution(zO(Math.max(0,z.getMinZoom()-1e-12),z.getResolutions()))});const P=d.sources[r];let R=i.getSource();(!R||R.get("mapbox-source")!==P)&&(R=bA(P,o,a));const O=i.getSource();return O?R!==O&&(O.getAttributions()||O.setAttributions(R.getAttributions()),O.format_||(O.format_=R.getFormat()),O.url_=R.getUrl()):i.setSource(R),Promise.resolve()}let _,v;const E={},w={};function C(){if(!v&&(!d.sprite||E)){if(a.projection&&!s){const I=De(a.projection).getUnits();I!=="m"&&(s=ag.map(M=>M/ic[I]))}let P;const R=i.getSource();R instanceof dp&&R.format_ instanceof mp&&(P=R.format_.layerName_),v=YO(i,d,l,s,E,w,(O,I=a.webfonts)=>VO(O,I),a.getImage,P),i.getStyle()?g().then(h).catch(u):u(new Error(`Nothing to show for source [${r}]`))}else v?(i.setStyle(v),g().then(h).catch(u)):u(new Error("Something went wrong trying to apply style."))}if(d.sprite){const P=IO(d.sprite,a.accessToken,o||location.href);_=hn?1:globalThis.devicePixelRatio>=1.5?.5:1;const R=_==.5?"@2x":"";Promise.all(P.map(function(O){const I=new URL(O.url);let M=I.origin+I.pathname+R+".json"+I.search;return new Promise(function(z,k){Ur("Sprite",M,a).then(z).catch(function(q){M=I.origin+I.pathname+".json"+I.search,Ur("Sprite",M,a).then(z).catch(k)})}).then(function(z){z===void 0&&u(new Error("No sprites found."));let k;if(k=I.origin+I.pathname+R+".png"+I.search,a.transformRequest){const q=a.transformRequest(k,"SpriteImage")||k;(q instanceof Request||q instanceof Promise)&&(k=q)}w[O.id]=k;for(const q in z){const H=O.id=="default"?q:`${O.id}:${q}`;E[H]=z[q]}}).catch(function(z){u(new Error(`Sprites cannot be loaded: ${M}: ${z.message}`))})})).then(C).catch(u)}else C()}).catch(u)})}function yA(i,e){const t=i.bounds;if(t){const n=Ie([t[0],t[1]],e),s=Ie([t[2],t[3]],e);return[n[0],n[1],s[0],s[1]]}return De(e).getExtent()}function _A(i,e,t){const n=new fA({tileJSON:e,tileSize:i.tileSize||e.tileSize||512}),s=n.getTileJSON(),o=n.getTileGrid(),r=De(t.projection||"EPSG:3857"),a=yA(s,r),l=r.getExtent(),c=s.minzoom||0,h=s.maxzoom||22,u={attributions:n.getAttributions(),projection:r,tileGrid:new Vs({origin:l?ln(l):o.getOrigin(0),extent:a||o.getExtent(),minZoom:c,resolutions:pA(r,e.tileSize).slice(0,h+1),tileSize:o.getTileSize(0)})};return Array.isArray(s.tiles)?u.urls=s.tiles:u.url=s.tiles,u}function wA(i,e,t){return new Promise(function(n,s){kO(i,e,t).then(function({tileJson:o,tileLoadFunction:r}){const a=_A(i,o,t);a.tileLoadFunction=r,a.format=new mp({layerName:"mvt:layer"});const l=new dp(a);l.set("mapbox-source",i),n(l)}).catch(s)})}function vA(i){return`{bbox-${(i?i.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function bA(i,e,t){const n=t.projection?new $w({dataProjection:t.projection}):new $w,s=i.data,o={};if(typeof s=="string"){const[a]=mu(s,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){const c=(u,d,f)=>{const g=vA(f);return a.replace(g,`${u.join(",")}`)},h=new vn({attributions:i.attribution,format:n,loader:(u,d,f,g,_)=>{const v=typeof c=="function"?c(u,d,f):c;Ur("GeoJSON",v,t).then(E=>{const w=h.getFormat().readFeatures(E,{featureProjection:f});h.addFeatures(w),g(w)}).catch(E=>{h.removeLoadedExtent(u),_()})},strategy:PE});return h.set("mapbox-source",i),h}const l=new vn({attributions:i.attribution,format:n,url:a,loader:(c,h,u,d,f)=>{Ur("GeoJSON",a,t).then(g=>{const _=l.getFormat().readFeatures(g,{featureProjection:u});l.addFeatures(_),d(_)}).catch(g=>{l.removeLoadedExtent(c),f()})}});return l}o.features=n.readFeatures(s,{featureProjection:"EPSG:3857"});const r=new vn(Object.assign({attributions:i.attribution,format:n},o));return r.set("mapbox-source",i),r}class gg extends p.Destroyable{constructor(t,n){super();T(this,"_imageriesManager");T(this,"_map");T(this,"_raster");T(this,"_layer",this.dv(p.react(void 0)));T(this,"_rShow",this.dv(p.react(!0)));T(this,"_rAlpha",this.dv(p.react(1)));T(this,"_rZIndex",this.dv(p.react(0)));T(this,"_rRectangle",this.dv(p.react(void 0)));T(this,"_rSplitDirection",this.dv(p.react("NONE")));T(this,"_rBrightness",this.dv(p.react(1)));T(this,"_rContrast",this.dv(p.react(1)));T(this,"_rHue",this.dv(p.react(0)));T(this,"_rSaturation",this.dv(p.react(1)));T(this,"_rGamma",this.dv(p.react(1)));T(this,"_raf");this.id=n;const s=t.viewer;if(!s)return;this._map=s;const o=ts(s);if(!o)return;const{imageriesManager:r}=o;this._imageriesManager=r,this.d(()=>this._destroyLayer())}get layer(){return this._layer.value}set layer(t){this._layer.value=t}get layerChanged(){return this._layer.changed}get show(){return this._rShow.value}get alpha(){return this._rAlpha.value}get zIndex(){return this._rZIndex.value}get rectangle(){return this._rRectangle.value}get splitDirection(){return this._rSplitDirection.value}get brightness(){return this._rBrightness.value}get contrast(){return this._rContrast.value}get hue(){return this._rHue.value}get saturation(){return this._rSaturation.value}get gamma(){return this._rGamma.value}get showChanged(){return this._rShow.changed}get alphaChanged(){return this._rAlpha.changed}get zIndexChanged(){return this._rZIndex.changed}get rectangleChanged(){return this._rRectangle.changed}get splitDirectionChanged(){return this._rSplitDirection.changed}get brightnessChanged(){return this._rBrightness.changed}get contrastChanged(){return this._rContrast.changed}get hueChanged(){return this._rHue.changed}get saturationChanged(){return this._rSaturation.changed}get gammaChanged(){return this._rGamma.changed}set show(t){var s;const n=t??!0;this._rShow.value=n,(s=this._layer.value)==null||s.setVisible(n)}set alpha(t){var s;const n=t??1;this._rAlpha.value=n,(s=this._layer.value)==null||s.setOpacity(n)}set zIndex(t){const n=t??0;this._rZIndex.value=n,this._layer.value&&this._imageriesManager&&this._imageriesManager.setZindex(this._layer.value,n)}set rectangle(t){this._rRectangle.value=t}set splitDirection(t){this._rSplitDirection.value=t??"NONE"}set brightness(t){this._rBrightness.value=t??1,this._applyColorAdjustments()}set contrast(t){this._rContrast.value=t??1,this._applyColorAdjustments()}set hue(t){this._rHue.value=t??0,this._applyColorAdjustments()}set saturation(t){this._rSaturation.value=t??1,this._applyColorAdjustments()}set gamma(t){this._rGamma.value=t??1,this._applyColorAdjustments()}_applyColorAdjustments(){this._raf||(this._raf=requestAnimationFrame(()=>{var s,o,r;this._raf=void 0;const t=this._layer.value,n=(s=t==null?void 0:t.getSource)==null?void 0:s.call(t);(r=(o=this._raster)==null?void 0:o.changed)==null||r.call(o),n!=null&&n.refresh?n.refresh():t!=null&&t.changed&&t.changed()}))}set imageryProvider(t){this._createFromProvider(t)}flyTo(t){}_destroyLayer(){var n,s,o;const t=(n=this._layer)==null?void 0:n.value;this._map&&t&&this._imageriesManager&&this._imageriesManager.delete(t),this._raf&&(cancelAnimationFrame(this._raf),this._raf=void 0),(o=(s=this._raster)==null?void 0:s.dispose)==null||o.call(s),this._raster=void 0,this._layer.value=void 0}_wrapWithRaster(t){const n=Math.min(4,Math.max(1,(typeof navigator<"u"&&navigator.hardwareConcurrency||4)-1)),s=new lp({sources:[t],operationType:"pixel",threads:n,operation:function(o,r){function a(_,v,E){return .2126*_+.7152*v+.0722*E}function l(_,v,E,w,C){const P=.299*_+.587*v+.114*E,R=.595716*_-.274453*v-.321263*E,O=.211456*_-.522591*v+.311135*E,I=R*w-O*C,M=R*C+O*w;let z=P+.9563*I+.621*M,k=P-.2721*I-.6474*M,q=P-1.107*I+1.7046*M;const H=m=>m<0?0:m>1?1:m;return[H(z),H(k),H(q)]}const c=o[0];let h=c[0]/255,u=c[1]/255,d=c[2]/255;const f=c[3]/255;if(r.hueCos!==1||r.hueSin!==0){const _=l(h,u,d,r.hueCos,r.hueSin);h=_[0],u=_[1],d=_[2]}if(r.saturation!==1){const _=a(h,u,d);h=_+(h-_)*r.saturation,u=_+(u-_)*r.saturation,d=_+(d-_)*r.saturation}r.brightness!==1&&(h*=r.brightness,u*=r.brightness,d*=r.brightness),r.contrast!==1&&(h=(h-.5)*r.contrast+.5,u=(u-.5)*r.contrast+.5,d=(d-.5)*r.contrast+.5),r.gammaInv!==1&&(h=Math.pow(Math.max(h,0),r.gammaInv),u=Math.pow(Math.max(u,0),r.gammaInv),d=Math.pow(Math.max(d,0),r.gammaInv));const g=_=>Math.max(0,Math.min(255,Math.round(_*255)));return c[0]=g(h),c[1]=g(u),c[2]=g(d),c[3]=g(f),c}});return s.on("beforeoperations",o=>{const r=this._rHue.value??0;o.data.brightness=this._rBrightness.value??1,o.data.contrast=this._rContrast.value??1,o.data.saturation=this._rSaturation.value??1,o.data.gammaInv=1/Math.max(1e-4,this._rGamma.value??1),o.data.hueCos=Math.cos(r),o.data.hueSin=Math.sin(r)}),this._raster=s,s}_makeLayerForSource(t){return t instanceof lp?new ep({source:t}):t instanceof b1?new ep({source:t}):new Ah({source:t})}_createFromProvider(t){var g,_,v,E;if(!this._map)return;this._destroyLayer();const s=De("EPSG:3857").getExtent(),o=Te(s)/256,r=t,a=r.crossOrigin??"anonymous",l=Math.max((r.maximumLevel??18)+1,19),c=Array.from({length:l},(w,C)=>o/Math.pow(2,C));Array.from({length:l},(w,C)=>C.toString());const h=(w,C)=>{if(!C)return{url:w};const P=Array.isArray(C)?C:C.split("");return P.length?w.includes("{s}")?{urls:P.map(R=>w.replace("{s}",R))}:{url:w}:{url:w}},u=w=>typeof w=="string"?w:w&&w.url||"",d=r.minimumLevel??0,f=r.maximumLevel??18;switch(t.type){case"UrlTemplateImageryProvider":{const w=t,C=u(w.url),P=h(C,w.subdomains),R=new Lh({...P.urls?{urls:P.urls}:{url:P.url},attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:f,transition:0}),O=this._wrapWithRaster(R);this._layer.value=this._makeLayerForSource(O);break}case"WebMapTileServiceImageryProvider":{const w=t,C=(w.matrixSet??w.tileMatrixSetID??"EPSG:3857").toUpperCase(),P=C==="EPSG:4326",R=(w.minimumLevel??d)|0,O=(w.maximumLevel??f)|0,I=w.tileMatrixLabels||w.TileMatrixLabels,M=P?Array.from({length:22},(B,X)=>`${C}:${X}`):Array.from({length:22},(B,X)=>String(X)),z=I&&I.length?I:M,k=z.length,q=Math.max(0,Math.min(R,k-1)),H=Math.max(q,Math.min(O,k-1)),m=Math.max(1,H-q+1),b=z.slice(q,q+m),S=256;let L,N,j;if(P){N=[-180,-90,180,90],L=ln(N);const B=360/(S*2);j=Array.from({length:m},(X,G)=>B/Math.pow(2,q+G))}else{N=s,L=ln(N);const B=Te(N)/S;j=Array.from({length:m},(X,G)=>B/Math.pow(2,q+G))}const U=new UT({url:u(w.url),layer:w.layer,matrixSet:C,format:w.format??"image/png",style:w.style??"default",tileGrid:w.tileGrid??new _T({origin:L,extent:N,resolutions:j,matrixIds:b,tileSize:S}),requestEncoding:w.requestEncoding||w.requestencoding||"KVP",...P?{projection:De("EPSG:4326")}:{},attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0,tileLoadFunction:(B,X)=>{const G=new Image;G.crossOrigin=a||"anonymous",G.onload=()=>{var je,Me;const ae=this._rBrightness.value??1,te=this._rContrast.value??1,V=this._rSaturation.value??1,re=this._rHue.value??0,ie=this._rGamma.value??1;if(re===0&&V===1&&ae===1&&te===1&&ie===1){const fe=(je=B.getImage)==null?void 0:je.call(B);if(fe){fe.src=X;return}}const he=G.naturalWidth||G.width,me=G.naturalHeight||G.height;if(!he||!me){B.getImage().src=X;return}const Fe=document.createElement("canvas");Fe.width=he,Fe.height=me;const ue=Fe.getContext("2d",{willReadFrequently:!0});ue.drawImage(G,0,0);const ze=ue.getImageData(0,0,he,me),J=ze.data,dt=Math.cos(re),Qe=Math.sin(re),ye=[[.299,.587,.114],[.595716,-.274453,-.321263],[.211456,-.522591,.311135]],sn=[[1,.9563,.621],[1,-.2721,-.6474],[1,-1.107,1.7046]],Gt=[[1,0,0],[0,dt,-Qe],[0,Qe,dt]],_t=(fe,Ze)=>{const Ce=Array.from({length:3},()=>[0,0,0]);for(let xe=0;xe<3;xe++)for(let Be=0;Be<3;Be++)Ce[xe][Be]=fe[xe][0]*Ze[0][Be]+fe[xe][1]*Ze[1][Be]+fe[xe][2]*Ze[2][Be];return Ce},Mt=_t(sn,_t(Gt,ye)),Je=.5-.5*te,qn=1/Math.max(1e-4,ie),nt=new Uint8ClampedArray(256);for(let fe=0;fe<256;fe++)nt[fe]=Math.max(0,Math.min(255,Math.round(Math.pow(fe/255,qn)*255)));const Vn=.2126,Wn=.7152,ui=.0722;for(let fe=0;fe<J.length;fe+=4){let Ze=J[fe]/255,Ce=J[fe+1]/255,xe=J[fe+2]/255;const Be=J[fe+3],Et=Mt[0][0]*Ze+Mt[0][1]*Ce+Mt[0][2]*xe,on=Mt[1][0]*Ze+Mt[1][1]*Ce+Mt[1][2]*xe,qt=Mt[2][0]*Ze+Mt[2][1]*Ce+Mt[2][2]*xe,lt=Vn*Et+Wn*on+ui*qt,Dt=lt+(Et-lt)*V,it=lt+(on-lt)*V,Vt=lt+(qt-lt)*V,zt=Dt*ae,Pt=it*ae,et=Vt*ae;let Ot=zt*te+Je,Fi=Pt*te+Je,Bn=et*te+Je;Ot=Ot<0?0:Ot>1?1:Ot,Fi=Fi<0?0:Fi>1?1:Fi,Bn=Bn<0?0:Bn>1?1:Bn,J[fe]=nt[Math.round(Ot*255)],J[fe+1]=nt[Math.round(Fi*255)],J[fe+2]=nt[Math.round(Bn*255)],J[fe+3]=Be}ue.putImageData(ze,0,0);const qe=(Me=B.setImage)==null?void 0:Me.bind(B);qe?qe(Fe):B.getImage().src=Fe.toDataURL("image/png")},G.onerror=()=>{B.getImage().src=X},G.src=X}});this._layer.value=new Ah({source:U});break}case"WebMapServiceImageryProvider":{const w=t,C={LAYERS:w.layers,TILED:!0,VERSION:((g=w.parameters)==null?void 0:g.VERSION)??((_=w.parameters)==null?void 0:_.version)??"1.3.0",...w.parameters},P=new jT({url:u(w.url),params:C,attributions:r.attributions,crossOrigin:a,transition:0}),R=this._wrapWithRaster(P);this._layer.value=this._makeLayerForSource(R);break}case"TileMapServiceImageryProvider":{const w=t,C=w.url?u(w.url):"",P=C.includes("{-y}"),R=/4326/.test(C)?"EPSG:4326":"EPSG:3857",O=De(R),I=P?Ir({extent:O.getExtent(),minZoom:d,maxZoom:f,tileSize:256}):void 0,M=w.url?u(w.url):"",z=new Lh({url:M,attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:f,tileGrid:new Vs({origin:ln(s),resolutions:c.slice(d,f+1)}),zDirection:-1,transition:0,...I?{tileGrid:I}:{}}),k=this._wrapWithRaster(z);this._layer.value=this._makeLayerForSource(k);break}case"OpenStreetMapImageryProvider":{const w=t,C=new Lh({url:w.url,attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0}),P=this._wrapWithRaster(C);this._layer.value=this._makeLayerForSource(P);break}case"SingleTileImageryProvider":{const w=t,C=typeof w.url=="string"?w.url:w.url.url,P=w.rectangle?sa(w.rectangle,"EPSG:4326","EPSG:3857"):s,R=new b1({url:C,imageExtent:P,attributions:r.attributions,crossOrigin:a,interpolate:!0}),O=this._wrapWithRaster(R);this._layer.value=this._makeLayerForSource(O);break}case"MVTImageryProvider":{(async()=>{var B,X,G,ae;const w=t;if(!w.url)return;let C,P=[],R,O,I=null,M,z;const k=async te=>{if(!te)return{};if(typeof te=="string"){const V=te.toLowerCase();if(V.endsWith(".json")||V.includes("tilejson")||V.includes(".json?"))try{const re=await fetch(te);if(re.ok){const ie=await re.json(),he=ie.minzoom,me=ie.maxzoom;if(ie.tiles&&ie.tiles.length>0)return{url:ie.tiles[0],minzoom:he,maxzoom:me};if(ie.url)return{url:ie.url,minzoom:he,maxzoom:me}}}catch{}return{url:te}}if(typeof te=="object"){const V=te,re=V.minzoom,ie=V.maxzoom;if(V.tiles&&V.tiles.length>0)return{url:V.tiles[0],minzoom:re,maxzoom:ie};if(V.url)return{url:V.url,minzoom:re,maxzoom:ie}}return{}},q=te=>{const V=te.toLowerCase();return V.includes("style.json")||V.endsWith(".json")&&!V.includes("{z}")&&!V.includes("{x}")&&!V.includes("{y}")};let H="customSource";if(typeof w.url=="string")if(q(w.url))try{const te=await fetch(w.url);if(!te.ok){console.warn(`[OlImagery] MVT: fetch style.json 失败: ${te.status}`);return}I=await te.json();const V=I.sources||{};for(const re in V)if(Object.prototype.hasOwnProperty.call(V,re)){const ie=V[re];if(ie.type==="vector"){if(H=re,ie.minzoom!==void 0&&(M=M===void 0?ie.minzoom:Math.min(M,ie.minzoom)),ie.maxzoom!==void 0&&(z=z===void 0?ie.maxzoom:Math.max(z,ie.maxzoom)),ie.tiles&&ie.tiles.length>0){C=ie.tiles[0];break}if(ie.url){const he=await k(ie.url);if(C=he.url,he.minzoom!==void 0&&(M=M===void 0?he.minzoom:Math.min(M,he.minzoom)),he.maxzoom!==void 0&&(z=z===void 0?he.maxzoom:Math.max(z,he.maxzoom)),C)break}}}if(!C){console.warn("[OlImagery] MVT: style.json 中未找到有效的 tile URL");return}P=(B=w.style)!=null&&B.length?w.style:I.layers||[],R=I.glyphs,O=I.sprite}catch(te){console.warn("[OlImagery] MVT: fetch style.json 出错:",te);return}else{const te=await k(w.url);C=te.url,M=te.minzoom,z=te.maxzoom,P=w.style||[],R=w.glyphs,O=w.sprite}else if(w.url&&typeof w.url=="object"){I=w.url;const te=I.sources||{};for(const V in te)if(Object.prototype.hasOwnProperty.call(te,V)){const re=te[V];if(re.type==="vector"){if(H=V,re.minzoom!==void 0&&(M=M===void 0?re.minzoom:Math.min(M,re.minzoom)),re.maxzoom!==void 0&&(z=z===void 0?re.maxzoom:Math.max(z,re.maxzoom)),re.tiles&&re.tiles.length>0){C=re.tiles[0];break}if(re.url){const ie=await k(re.url);if(C=ie.url,ie.minzoom!==void 0&&(M=M===void 0?ie.minzoom:Math.min(M,ie.minzoom)),ie.maxzoom!==void 0&&(z=z===void 0?ie.maxzoom:Math.max(z,ie.maxzoom)),C)break}}}if(!C){console.warn("[OlImagery] MVT: 未在 style JSON 中找到有效的 tile URL");return}P=(X=w.style)!=null&&X.length?w.style:I.layers||[],R=I.glyphs,O=I.sprite}else return;if(C&&w.accessToken&&C.includes("mapbox")&&!C.includes("access_token")){const te=C.includes("?")?"&":"?";C+=`${te}access_token=${w.accessToken}`}const m=Math.max(w.minimumLevel??0,M??0),b=Math.min(w.maximumLevel??18,z??18),S=w.tileSize||512,L=w.scheme||"xyz",N=((G=I==null?void 0:I.metadata)==null?void 0:G["mapbox:projection"])||((ae=I==null?void 0:I.metadata)==null?void 0:ae.projection)||"EPSG:3857",j=new dp({url:C,format:new mp,tileGrid:Ir({tileSize:S,minZoom:m,maxZoom:b}),...L==="tms"?{zDirection:-1}:{},attributions:I==null?void 0:I.attribution});N!=="EPSG:3857"&&(j.dataProjection=N),j.on("tileloaderror",te=>{console.error("[OlImagery] MVT: 瓦片加载失败",te)});const U=new zh({source:j,declutter:!0});if(P.length>0)try{const te="https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",V={version:8,name:"MVT Style",sources:{[H]:{type:"vector",tiles:[C],minzoom:m,maxzoom:b}},layers:P,glyphs:R||te,sprite:O},re={source:H,...typeof w.url=="string"&&w.url.toLowerCase().includes("style.json")?{styleUrl:w.url}:{}};await mA(U,V,re)}catch(te){console.warn("[OlImagery] MVT: ol-mapbox-style 应用样式失败,使用默认样式",te),U.setStyle(function(V){var me;const re=V.getGeometry(),ie=((me=re==null?void 0:re.getType)==null?void 0:me.call(re))||"",he=[];return ie==="LineString"||ie==="MultiLineString"?he.push(new $e({stroke:new St({color:"#ff0000",width:3})})):ie==="Polygon"||ie==="MultiPolygon"?he.push(new $e({fill:new vt({color:"rgba(100, 100, 100, 0.5)"}),stroke:new St({color:"#333333",width:1})})):(ie==="Point"||ie==="MultiPoint")&&he.push(new $e({image:new Ln({radius:5,fill:new vt({color:"#ff0000"})})})),he})}this._layer.value=U,this._layer.value.setOpacity(this._rAlpha.value),this._layer.value.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))})();break}default:{console.warn("[OlImagery] 未实现的 provider.type:",t.type,t);return}}(v=this._layer.value)==null||v.setOpacity(this._rAlpha.value),(E=this._layer.value)==null||E.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))}}const Su=class Su extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_clickEvent",this.disposeVar(new p.Event));T(this,"_hovered",this.disposeVar(p.react(!1)));T(this,"_feature");T(this,"_source");T(this,"_layer");T(this,"_initialized",!1);const s=new wn([]);this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid());const o=t.viewer;if(!o)return;this._source=new vn,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};this.d(p.createEventsCallFunc(this.showChanged,r,{immediate:!0})),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.position))return;const c=Ie([this.position[0][0],this.position[0][1]]);s.setCoordinates(c);const h=this.radius??5,u=this.strokeWidth??2,d=this.fillColor??[1,1,1,1],f=this.strokeColor??[0,153/255,1,1],g=new vt({color:`rgba(${d.slice(0,3).map(E=>Math.round(E*255)).join(",")},${d[3]})`}),_=new St({color:`rgba(${f.slice(0,3).map(E=>Math.round(E*255)).join(",")},${f[3]})`,width:u}),v=new $e({image:new Ln({radius:h,fill:g,stroke:_})});this._feature.setStyle(v),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{this.position&&Yi(t,this.position)})),this.dispose(this.positionChanged.disposableOn(()=>{!this._initialized&&this.position&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlPoint"}get defaultProps(){return Su.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(t){this._hovered.value=t}get feature(){return this._feature}_initializePoint(){const t=()=>{var f;if(!this.position)return;const s=Ie([this.position[0],this.position[1]]);if(!this._feature)return;this._feature.getGeometry().setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new vt({color:`rgba(${l.slice(0,3).map(g=>Math.round(g*255)).join(",")},${l[3]})`}),u=new St({color:`rgba(${c.slice(0,3).map(g=>Math.round(g*255)).join(",")},${c[3]})`,width:a}),d=new $e({image:new Ln({radius:r,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(f=this._source)==null||f.addFeature(this._feature)};t();const n=p.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(t))}};T(Su,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,153/255,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let li=Su;(i=>{i.createDefaultProps=()=>({show:void 0,position:p.reactArrayWithUndefined(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:p.reactArrayWithUndefined(void 0),outlineColor:p.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:p.reactArrayWithUndefined(void 0),strokeColor:p.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(li||(li={})),p.extendClassProps(li.prototype,li.createDefaultProps);const Ru=class Ru extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_layer");T(this,"_feature");T(this,"_source");T(this,"_lineString");const s=new Qn([]);this._lineString=s,this.d(()=>{var c;return(c=this._lineString)==null?void 0:c.dispose()}),this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid()),this.d(()=>{var c;return(c=this._feature)==null?void 0:c.dispose()}),this._source=new vn,this.d(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({zIndex:0,source:this._source}),this.d(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const o=t.viewer;if(!o)return;o.addLayer(this._layer),this.d(()=>o.removeLayer(this._layer));const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),this.d(p.createEventsCallFunc(this.zIndexChanged,()=>{var c;(c=this._layer)==null||c.setZIndex(this.zIndex)},{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<2))return;const c=this.positions.map(d=>Ie([d[0],d[1]]));this.loop&&c.length>=3&&c.push(c[0]),this._feature.getGeometry().setCoordinates(c);const u=(d,f)=>{const g=[],_=new St({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`,width:this.width??2,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0});if(g.push(new $e({stroke:_})),this.hasArrow&&c.length>=2){const[v,E]=c[c.length-2],[w,C]=c[c.length-1],P=EA(w-v,C-E);g.push(new $e({geometry:new wn([w,C]),image:new Ca({points:3,radius:8,rotation:P,rotateWithView:!0,fill:new vt({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`})})}))}return g};this._feature.setStyle(u),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.loopChanged,this.widthChanged,this.colorChanged,this.hasDashChanged,this.dashLengthChanged,this.hasArrowChanged,this.showChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=this.positions[Math.floor(this.positions.length/2)];Yi(t,h)}))}get typeName(){return"OlPolyline"}get defaultProps(){return Ru.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}};T(Ru,"defaults",{positions:[],width:2,loop:!1,color:[1,1,1,1],hasDash:!1,dashLength:16,hasArrow:!1});let Ut=Ru;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),loop:!1,width:2,color:p.reactArray([1,1,1,1]),hasDash:!1,dashLength:16,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,zIndex:0,dashPattern:255,gapColor:p.reactArray([0,0,0,0])})})(Ut||(Ut={})),p.extendClassProps(Ut.prototype,Ut.createDefaultProps);function EA(i,e){const t=Math.atan2(e,i);return(Math.PI/2-t+2*Math.PI)%(2*Math.PI)}class CA extends p.Destroyable{constructor(t,n){super();T(this,"_geoPoint");T(this,"_geoAxis");this._geoPoint=this.disposeVar(new li(n,t.id)),this._geoAxis=this.disposeVar(new Ut(n,t.id)),this._geoAxis.width=6,this._geoAxis.color=[1,1,0,.7]}get geoPoint(){return this._geoPoint}get geoAxis(){return this._geoAxis}}const as=class as extends p.Destroyable{constructor(t,n){super();T(this,"_captureEvent",this.disposeVar(new p.Event));T(this,"_id",this.disposeVar(p.react(p.createGuid())));if(this._olViewer=t,n&&(this.id=n),!t.viewer)return;this.disposeVar(new p.ObjResettingWithEvent(this.showChanged,()=>{if(this.show&&this.position)return new CA(this,t)})),this.default&&this.flyTo(void 0,!1);const o=this.disposeVar(p.createProcessingFromAsyncFunc(async a=>{const{position:l,rotation:c,viewDistance:h,duration:u=1e3}=this;if(l){const d=Yi(this._olViewer,l,h,c,u,()=>{this.enabled=!1});d&&await a.promise(d),this.enabled=!1}}));this.dispose(this.enabledChanged.disposableOn(()=>{o.isRunning&&o.cancel(),this.enabled&&o.restart()}));const r=this.disposeVar(p.createProcessingFromAsyncFunc(async(a,l,c)=>{var d,f;const h=(f=(d=this._olViewer).capture)==null?void 0:f.call(d,l,c);if(!h)return;const u=await a.promise(h);u&&(this.thumbnail=u)}));this.dispose(this.captureEvent.disposableOn((a,l)=>{r.restart(void 0,a??as.defaults.thumbnailWidth,l??as.defaults.thumbnailHeight)}))}get captureEvent(){return this._captureEvent}capture(t,n){this._captureEvent.emit(t,n)}get id(){return this._id.value}set id(t){this._id.value=t}get idChanged(){return this._id.changed}resetWithCurrentCamera(t){if(!this._olViewer.actived)return;const n=this._olViewer.getCurrentCameraInfo();n&&(t&as.ResetFlag.Position&&(this.position=n.position),t&as.ResetFlag.Rotation&&(this.rotation=n.rotation),t&as.ResetFlag.ViewDistance&&(this.viewDistance=0))}flyTo(t,n){if((n??!0)&&!this._olViewer.actived)return;const{position:s,rotation:o,viewDistance:r,duration:a}=this;s&&Yi(this._olViewer,s,r,o,t??a)}};T(as,"ResetFlag",{Position:1,Rotation:2,ViewDistance:4,Zoom:10}),T(as,"defaults",{thumbnailWidth:64,thumbnailHeight:64,enabled:!0,show:!1,position:[116.39,39.9,100],duration:1e3,default:!1,thumbnail:""});let Lo=as;(i=>{i.createDefaultProps=()=>({enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,show:!1,rotation:p.reactArray([0,0,0]),viewDistance:0,duration:void 0,default:!1,thumbnail:""})})(Lo||(Lo={})),p.extendClassProps(Lo.prototype,Lo.createDefaultProps);class ss extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_feature");T(this,"_layer");T(this,"_source");const s=new Kn([[]]);this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid());const o=t.viewer;if(!o)return;this._source=new vn,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()}),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const r=()=>{var c,h;(c=this._layer)==null||c.setVisible(this.show??!0),(h=this._layer)==null||h.setZIndex(this.zIndex)};this.d(p.createEventsCallFunc([this.showChanged,this.zIndexChanged],r,{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<3))return;const c=Xw(this.positions);if(c.length<4)return;this._feature.getGeometry().setCoordinates([c]);const h=this.filled?this.fillColor:[0,0,0,0],u=this.stroked?this.outlineColor:[0,0,0,0];this._feature.setStyle(new $e({fill:new vt({color:Hw(h)}),stroke:new St({color:Hw(u),width:this.outlineWidth??1.5,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.fillColorChanged,this.outlineColorChanged,this.outlineWidthChanged,this.hasDashChanged,this.dashLengthChanged,this.strokedChanged,this.filledChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=Xw(this.positions),[u,d]=xA(h),[f,g]=Lt([u,d]);Yi(t,[f,g,0])}))}get typeName(){return"OlPolygon"}get defaultProps(){return ss.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactJsonWithUndefined(void 0),fillColor:p.reactArray([1,1,1,.4]),outlineColor:p.reactArray([1,1,1,1]),outlineWidth:1.5,hasDash:!1,dashLength:16,zIndex:0,stroked:!0,filled:!0})})(ss||(ss={})),p.extendClassProps(ss.prototype,ss.createDefaultProps);function Hw(i){return`rgba(${i[0]*255}, ${i[1]*255}, ${i[2]*255}, ${i[3]})`}function Xw(i){const e=i.map(s=>Ie([s[0],s[1]])),t=e[0],n=e[e.length-1];return(!t||!n||t[0]!==n[0]||t[1]!==n[1])&&e.push(t),e}function xA(i){let e=0,t=0,n=0;for(let s=0,o=i.length-1;s<i.length;o=s++){const[r,a]=i[o],[l,c]=i[s],h=r*c-l*a;e+=h,t+=(r+l)*h,n+=(a+c)*h}return e*=.5,Math.abs(e)<1e-9?i[0]:(t/=6*e,n/=6*e,[t,n])}const Tu=class Tu extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_clickEvent",this.disposeVar(new p.Event));T(this,"_hovered",this.disposeVar(p.react(!1)));T(this,"_feature");T(this,"_source");T(this,"_layer");T(this,"_initialized",!1);const s=new er([]);this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid());const o=t.viewer;if(!o)return;this._source=new vn,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.points))return;const c=this.points.map(w=>Ie([w[0],w[1]]));if(!this._feature)return;const h=this._feature.getGeometry();h&&h.setCoordinates(c);const u=this.radius??5,d=this.strokeWidth??2,f=this.fillColor??[255,255,255,1],g=this.strokeColor??[0,153/255,1,1],_=new vt({color:`rgba(${f.map(w=>w*255).join(",")})`}),v=new St({color:`rgba(${g.map(w=>w*255).join(",")})`,width:d}),E=new $e({image:new Ln({radius:u,fill:_,stroke:v})});this._feature.setStyle(E),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.pointsChanged.don(()=>{!this._initialized&&this.points&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlMultiPoint"}get defaultProps(){return Tu.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(t){this._hovered.value=t}get feature(){return this._feature}_initializePoint(){const t=()=>{var f;if(!this.points)return;const s=this.points.map(g=>Ie([g[0],g[1]]));if(!this._feature)return;const o=this._feature.getGeometry();o&&o.setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new vt({color:`rgba(${l.map(g=>g*255).join(",")})`}),u=new St({color:`rgba(${c.map(g=>g*255).join(",")})`,width:a}),d=new $e({image:new Ln({radius:r,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(f=this._source)==null||f.addFeature(this._feature)};t();const n=p.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(t))}};T(Tu,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,153/255,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let Hs=Tu;(i=>{i.createDefaultProps=()=>({show:void 0,points:p.reactPositions(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:p.reactArrayWithUndefined(void 0),outlineColor:p.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:p.reactArrayWithUndefined(void 0),strokeColor:p.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(Hs||(Hs={})),p.extendClassProps(Hs.prototype,Hs.createDefaultProps);class ul extends p.EngineObject{constructor(e,t){if(super(e,t),!t.viewer){console.warn("map is undefined!");return}this.d(e.flyToEvent.don((s,o)=>this.flyTo(s,o))),this.d(e.flyInEvent.don((s,o)=>this.flyIn(s,o))),this.dispose(e.calcFlyInParamEvent.disposableOn(()=>{if(!t.actived)return;const s=t.getCurrentCameraInfo();if(!s)return;const{position:o,rotation:r}=s;e.flyInParam={position:o,rotation:r,flyDuration:1}})),this.dispose(e.calcFlyToParamEvent.disposableOn(()=>{e.useCalcFlyToParamInESObjectWithLocation||console.warn("calcFlyToParam无法调用,该对象缺少position属性!")}))}flyToWithPromise(e,t,n,s,o,r,a){const{sceneObject:l,olViewer:c}=this;c.flyTo({distance:n??0,heading:s?s[0]:0,pitch:s?s[1]:0,flyDuration:o??1,hDelta:r??0,pDelta:a??0},t)}flyTo(e,t){const{sceneObject:n,olViewer:s}=this;return s.actived?(n.flyToParam&&(n.useCalcFlyToParamInESObjectWithLocation||console.warn("flyToParam无法使用,该对象缺少position属性,若飞行失败,请清空flyToParam后重试!")),n.flyInParam?this.flyIn(e,t):!1):!1}flyIn(e,t){const{sceneObject:n,olViewer:s}=this;if(!s.actived)return!1;if(n.flyInParam){const{position:o,rotation:r,flyDuration:a}=n.flyInParam,l=e??a;return this.olViewer.flyIn(o,r,l),!0}return!1}get olViewer(){return this.viewer}}class dl extends ul{constructor(t,n){super(t,n);T(this,"_smoothMoving");this._smoothMoving=this.dv(new p.SmoothMoveController(n)),this.d(this._smoothMoving.currentPositionChanged.don(o=>{o&&(t.position=o)})),this.d(this._smoothMoving.currentRotationChanged.don(o=>{o&&this._smoothMoving.isRotating&&(t.rotation=o)})),this.d(this._smoothMoving.currentHeadingChanged.don(o=>{if(o!==void 0&&!this._smoothMoving.isRotating){const r=t.rotation;t.rotation=[o-90,r[1],r[2]]}})),this.d(t.smoothMoveEvent.don((o,r)=>this.smoothMove(o,r*1e3))),this.d(t.smoothMoveWithRotationEvent.don((o,r,a)=>this.smoothMoveWithRotation(o,r,a*1e3))),this.d(t.smoothMoveOnGroundEvent.don((o,r,a)=>this.smoothMoveOnGround(o,r,a*1e3))),this.d(t.smoothMoveWithRotationOnGroundEvent.don((o,r,a,l)=>this.smoothMoveWithRotationOnGround(o,r,a,l*1e3))),this.d(t.calcFlyToParamEvent.don(()=>{if(!t.useCalcFlyToParamInESObjectWithLocation||!t.position)return;const o=n.calcFlyToParam(t.position);if(!o){console.warn("olViewer.calcFlyToParam failed.");return}console.log("olViewer.calcFlyToParam success.",o),t.flyToParam=o})),this.d(t.automaticLandingEvent.don(async()=>{console.warn("ESOlViewer automaticLandingEvent is not supported.")}));const s=this.dv(p.createNextAnimateFrameEvent(t.minVisibleDistanceChanged,t.maxVisibleDistanceChanged));this.d(s.don(()=>this.visibleDistance(t,n))),this.d(n.cameraChanged.don(()=>this.visibleDistance(t,n)))}smoothMove(t,n){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(t,this.sceneObject.rotation,n)}smoothMoveWithRotation(t,n,s){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(t,n,s)}async smoothMoveOnGround(t,n,s){const o=await this.olViewer.getTerrainHeight([t,n])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([t,n,o],this.sceneObject.rotation,s)}async smoothMoveWithRotationOnGround(t,n,s,o){const r=await this.olViewer.getTerrainHeight([n,s])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([n,s,r],t,o)}visibleDistance(t,n){if(!t.show||!t.position)return;const s=p.getDistancesFromPositions([t.position,Py(n)],"NONE")[0];t.minVisibleDistance<t.maxVisibleDistance?s>t.minVisibleDistance&&s<t.maxVisibleDistance:t.maxVisibleDistance===0&&s>t.minVisibleDistance}flyTo(t,n){const{sceneObject:s,olViewer:o}=this;if(!o.actived||!o.viewer)return!1;if(s.flyToParam&&s.position){const{position:r,flyToParam:a}=s,{distance:l,heading:c,pitch:h,flyDuration:u,hDelta:d,pDelta:f}=a;return this.flyToWithPromise(n,r,l,[c,h,0],t??u,d,f),!0}else return nf(o.viewer,s.position,t),!0}flyIn(t,n){const{sceneObject:s,olViewer:o}=this;return!o.actived||!o.viewer?!1:!super.flyIn(t,n)&&s.position?(nf(o.viewer,s.position,t),!0):!1}}class mg extends dl{constructor(t,n){super(t,n);T(this,"_lastHoverResult",this.dv(p.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this.ad(p.createProcessingFromAsyncFunc(async(o,r)=>{const a=await o.promise(n.pick(r.screenPosition,"innerHoverEvent"));this.lastHoverResult=Object.assign({},a,r)}))}get lastHoverResult(){return this._lastHoverResult.value}set lastHoverResult(t){this._lastHoverResult.value=t}get lastHoverResultChanged(){return this._lastHoverResult.changed}}const PA=i=>{const e=[];if(i){const t=i.length;let n=0;for(let s=0;s<t;++s){const o=(s+1)%t,r=p.geoDistance(i[s],i[o]),a=Math.abs(i[s][2]-i[o][2]),l=Math.sqrt(r*r+a*a);n+=l,e.push(n)}}return e},SA=i=>{let e;return i?(i.length<3?e=0:e=p.geoArea(i),e):0},RA=i=>{let e;return i?(i.length<3?e=void 0:e=p.geoCenterOfMass(i),e):void 0},vl=class vl extends ul{constructor(e,t){if(super(e,t),!t.viewer){console.warn("viewer is undefined!");return}}flyIn(e,t){if(!super.flyIn(e,t)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=qc(s);return ka(this.olViewer.viewer,o,e),console.log("OlESGeoVector flyIn"),!0}return!0}flyTo(e,t){if(!super.flyTo(e,t)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=qc(s);return ka(this.olViewer.viewer,o,e),console.log("OlESGeoVector flyTo"),!0}return!0}};T(vl,"type",vl.register("ESOlViewer",p.ESGeoVector.type,vl));let Gr=vl;class zo extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));if(!t.viewer)return;const o=this.ad(new ss(t,n)),r=this.ad(new Ut(t,n));r.loop=!0,this.ad(p.bind([r,"depthTest"],[this,"depthTest"])),this.d(p.track([o,"allowPicking"],[this,"allowPicking"]));const a=()=>{r.show=!!(this.show&&this.outline),o.show=!!(this.show&&this.fill),r.positions=this.positions,o.positions=o.show?this.positions||[]:[],r.color=this.outlineColor,r.width=this.outlineWidth;const[c=1,h=1,u=1,d=.5]=this.color||[1,1,1,.5];o.fillColor=[c,h,u,d]};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.showChanged,this.outlineChanged,this.outlineColorChanged,this.outlineWidthChanged,this.fillChanged,this.colorChanged,this.positionsChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{o.show?o.flyTo(c):r.show&&r.flyTo(c)}))}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}T(zo,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,outline:!0,strokeGround:!1,outlineColor:p.reactArray([1,1,1,1]),outlineWidth:2,ground:!1,fill:!0,color:p.reactArray([1,1,1,.5]),positions:p.reactPositions(void 0),viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,depthTest:!1})})(zo||(zo={})),p.extendClassProps(zo.prototype,zo.createDefaultProps);const bl=class bl extends Gr{constructor(t,n){super(t,n);T(this,"_geoPolygon");if(!n.viewer){console.warn("viewer is undefined!");return}this._geoPolygon=this.ad(new ss(this.olViewer,t.id));const o=this.geoPolygon;o&&(this.d(p.track([o,"show"],[t,"show"])),this.d(p.track([o,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([o,"positions"],[t,"points"])),this.d(p.track([o,"stroked"],[t,"stroked"])),this.d(p.track([o,"outlineColor"],[t,"strokeColor"])),this.d(p.track([o,"outlineWidth"],[t,"strokeWidth"])),this.d(p.track([o,"filled"],[t,"filled"])),this.d(p.track([o,"fillColor"],[t,"fillColor"])))}get geoPolygon(){return this._geoPolygon}};T(bl,"type",bl.register("ESOlViewer",p.ESGeoPolygon.type,bl));let fl=bl;function pl(i){var t;const e=(t=Zf(i,"pickResult"))==null?void 0:t.pointerEvent;return(e==null?void 0:e.buttons)!=0?(e==null?void 0:e.button)??0:-1}function TA(i,e,t){const n=[];for(const s of t)switch(s){case"SquareMeter_SquareKilometer":i>=1e6?n.push(`面积:${(i/1e6).toFixed(2)} km²`):n.push(`面积:${i.toFixed(2)} m²`);break;case"MU_Hectare":const o=i*(1/666.7);if(o>=15){const r=o/15;n.push(`面积:${r.toFixed(2)} 公顷`)}else n.push(`面积:${o.toFixed(2)} 亩`);break;case"PerimeterMeter_PerimeterKilometer":e>=1e3?n.push(`周长:${(e/1e3).toFixed(2)} km`):n.push(`周长:${e.toFixed(2)} m`);break}return n}class qr extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.dv(new p.Event));T(this,"_flyToEvent",this.dv(new p.Event));T(this,"_area",this.dv(p.react(0)));T(this,"_centerOfMass",this.dv(p.reactArrayWithUndefined(void 0)));T(this,"_distances",this.dv(p.reactArray([])));T(this,"_geoPolyline");T(this,"_id",this.dv(p.react(p.createGuid())));n&&(this.id=n);{const s=()=>{this._distances.value=PA(this.positions),this._area.value=SA(this.positions),this._centerOfMass.value=RA(this.positions)};s();const o=this.dv(p.createNextAnimateFrameEvent(this.positionsChanged));this.dispose(o.disposableOn(s))}{const s=this._geoPolyline=this.dv(new Ut(t,n));s.loop=!0,s.arcType="GEODESIC",this.dispose(p.bind([s,"color"],[this,"color"])),this.dispose(p.bind([s,"dashLength"],[this,"dashLength"])),this.dispose(p.bind([s,"dashPattern"],[this,"dashPattern"])),this.dispose(p.bind([s,"gapColor"],[this,"gapColor"])),this.dispose(p.bind([s,"hasArrow"],[this,"hasArrow"])),this.dispose(p.bind([s,"hasDash"],[this,"hasDash"])),this.dispose(p.bind([s,"positions"],[this,"positions"])),this.dispose(p.bind([s,"show"],[this,"show"])),this.dispose(p.bind([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"width"],[this,"width"])),this.dispose(p.bind([s,"depthTest"],[this,"depthTest"]))}{const s=this.dv(new zo(t,n));s.outline=!1;const o=()=>{s.positions=this.positions};o(),this.dispose(this.positionsChanged.disposableOn(o));const r=()=>{const a=this.fillColor;s.color=[a[0],a[1],a[2],a[3]*.5]};r(),this.dispose(this.fillColorChanged.disposableOn(r)),this.dispose(p.track([s,"show"],[this,"show"])),this.dispose(p.track([s,"ground"],[this,"ground"])),this.dispose(p.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"depthTest"],[this,"depthTest"])),this.d(this.flyToEvent.don(a=>{s.flyTo(a)}))}{const s=this.dv(new jt(t,n)),o=this.dv(p.createNextAnimateFrameEvent(this.areaChanged,this.centerOfMassChanged,this.distancesChanged,this.unitsChanged)),r=()=>{if(this.distances.length===0){s.innerHTML="";return}const a=TA(this.area,this.distances[this.distances.length-1],this.units);s.innerHTML=xh([...a].join(`
168
+ `,""),Me.push(Be[Et],xe);return Me},[]):Je=dg(je,I).trim(),me=de(G,"paint","text-opacity",m,g,b)}if(Je&&me&&!Mt){Qe||(++S,J=E[S],(!J||!J.getText()||J.getFill()||J.getStroke())&&(J=new $e,E[S]=J),J.setImage(void 0),J.setGeometry(void 0));const qe=Ww(G,m,"text",g);J.getText()||J.setText(ye),ye=J.getText(),(!ye||"getDeclutterMode"in ye&&ye.getDeclutterMode()!==qe)&&(ye=new ir({padding:[2,2,2,2],declutterMode:qe}),J.setText(ye));const je=de(G,"layout","text-transform",m,g,b);je=="uppercase"?Je=Array.isArray(Je)?Je.map((et,Ot)=>Ot%2?et:et.toUpperCase()):Je.toUpperCase():je=="lowercase"&&(Je=Array.isArray(Je)?Je.map((et,Ot)=>Ot%2?et:et.toLowerCase()):Je.toLowerCase());const Me=Array.isArray(Je)?Je:q==2?lg(Je,Wn):hg(Je,qn,ui,Wn);if(ye.setText(Me),ye.setFont(qn),ye.setRotation(rg(de(G,"layout","text-rotate",m,g,b))),typeof ye.setKeepUpright=="function"){const et=de(G,"layout","text-keep-upright",m,g,b);ye.setKeepUpright(et)}const fe=de(G,"layout","text-anchor",m,g,b),Ze=Qe||q==1?"point":de(G,"layout","symbol-placement",m,g,b);let Ce;if(Ze==="line-center"?(ye.setPlacement("line"),Ce="center"):ye.setPlacement(Ze),Ze==="line"&&typeof ye.setRepeat=="function"){const et=de(G,"layout","symbol-spacing",m,g,b);ye.setRepeat(et*2)}ye.setOverflow(Ze==="point");let xe=de(G,"paint","text-halo-width",m,g,b);const Be=de(G,"layout","text-offset",m,g,b),Et=de(G,"paint","text-translate",m,g,b);let on=0,qt=0;if(Ze=="point"){Ce="center",fe.indexOf("left")!==-1?(Ce="left",qt=xe):fe.indexOf("right")!==-1&&(Ce="right",qt=-xe);const et=de(G,"layout","text-rotation-alignment",m,g,b);ye.setRotateWithView(et=="map")}else ye.setMaxAngle(rg(de(G,"layout","text-max-angle",m,g,b))*Je.length/Me.length),ye.setRotateWithView(!1);ye.setTextAlign(Ce);let lt="middle";fe.indexOf("bottom")==0?(lt="bottom",on=-xe-.5*(nt-1)*Vn):fe.indexOf("top")==0&&(lt="top",on=xe+.5*(nt-1)*Vn),ye.setTextBaseline(lt);const Dt=de(G,"layout","text-justify",m,g,b);ye.setJustify(Dt==="auto"?void 0:Dt),ye.setOffsetX(Be[0]*Vn+qt+Et[0]),ye.setOffsetY(Be[1]*Vn+on+Et[1]);const it=ye.getFill()||new vt;it.setColor(Fo(de(G,"paint","text-color",m,g,b),me)),ye.setFill(it);const Vt=Fo(de(G,"paint","text-halo-color",m,g,b),me);if(Vt&&xe>0){const et=ye.getStroke()||new St;et.setColor(Vt),xe*=2;const Ot=.5*Vn;et.setWidth(xe<=Ot?xe:Ot),ye.setStroke(et)}else ye.setStroke(void 0);const zt=de(G,"layout","text-padding",m,g,b),Pt=ye.getPadding();zt!==Pt[0]&&(Pt[0]=zt,Pt[1]=zt,Pt[2]=zt,Pt[3]=zt),J.setZIndex(dt)}}}if(S>-1)return E.length=S+1,E};return i.setStyle(w),i.set("mapbox-layers",u),i.set("mapbox-source",v),i.set("mapbox-featurestate",i.get("mapbox-featurestate")||{}),w}class Z2 extends L1{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(vu(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(vu(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return we()}readFeaturesFromObject(e,t){return we()}readGeometry(e,t){return this.readGeometryFromObject(vu(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return we()}readProjection(e){return this.readProjectionFromObject(vu(e))}readProjectionFromObject(e){return we()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return we()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return we()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return we()}}function vu(i){if(typeof i=="string"){const e=JSON.parse(i);return e||null}return i!==null?i:null}class $w extends Z2{constructor(e){e=e||{},super(),this.dataProjection=De(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=De(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let n=null;e.type==="Feature"?n=e:n={type:"Feature",geometry:e,properties:null};const s=fg(n.geometry);if(this.featureClass===Bt)return z1({geometry:s,id:n.id,properties:n.properties},t);const o=new An;return this.geometryName_?o.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&o.setGeometryName(n.geometry_name),o.setGeometry(gp(s,t)),"id"in n&&o.setId(n.id),n.properties&&o.setProperties(n.properties,!0),o}readFeaturesFromObject(e,t){const n=e;let s=null;if(n.type==="FeatureCollection"){const o=e;s=[];const r=o.features;for(let a=0,l=r.length;a<l;++a){const c=this.readFeatureFromObject(r[a],t);c&&s.push(c)}}else s=[this.readFeatureFromObject(e,t)];return s.flat()}readGeometryFromObject(e,t){return K2(e,t)}readProjectionFromObject(e){const t=e.crs;let n;if(t)if(t.type=="name")n=De(t.properties.name);else if(t.type==="EPSG")n=De("EPSG:"+t.properties.code);else throw new Error("Unknown SRS type");else n=this.dataProjection;return n}writeFeatureObject(e,t){t=this.adaptOptions(t);const n={type:"Feature",geometry:null,properties:null},s=e.getId();if(s!==void 0&&(n.id=s),!e.hasProperties())return n;const o=e.getProperties(),r=e.getGeometry();return r&&(n.geometry=pg(r,t),delete o[e.getGeometryName()]),_s(o)||(n.properties=o),n}writeFeaturesObject(e,t){t=this.adaptOptions(t);const n=[];for(let s=0,o=e.length;s<o;++s)n.push(this.writeFeatureObject(e[s],t));return{type:"FeatureCollection",features:n}}writeGeometryObject(e,t){return pg(e,this.adaptOptions(t))}}function fg(i,e){if(!i)return null;let t;switch(i.type){case"Point":{t=J2(i);break}case"LineString":{t=eA(i);break}case"Polygon":{t=sA(i);break}case"MultiPoint":{t=nA(i);break}case"MultiLineString":{t=tA(i);break}case"MultiPolygon":{t=iA(i);break}case"GeometryCollection":{t=Q2(i);break}default:throw new Error("Unsupported GeoJSON type: "+i.type)}return t}function K2(i,e){const t=fg(i);return gp(t,e)}function Q2(i,e){return i.geometries.map(function(n){return fg(n)})}function J2(i){const e=i.coordinates;return{type:"Point",flatCoordinates:e,layout:oo(e.length)}}function eA(i){var n;const e=i.coordinates,t=e.flat();return{type:"LineString",flatCoordinates:t,ends:[t.length],layout:oo(((n=e[0])==null?void 0:n.length)||2)}}function tA(i){var o,r;const e=i.coordinates,t=((r=(o=e[0])==null?void 0:o[0])==null?void 0:r.length)||2,n=[],s=oa(n,0,e,t);return{type:"MultiLineString",flatCoordinates:n,ends:s,layout:oo(t)}}function nA(i){var t;const e=i.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:oo(((t=e[0])==null?void 0:t.length)||2)}}function iA(i){var o,r;const e=i.coordinates,t=[],n=((r=(o=e[0])==null?void 0:o[0])==null?void 0:r[0].length)||2,s=zm(t,0,e,n);return{type:"MultiPolygon",flatCoordinates:t,ends:s,layout:oo(n)}}function sA(i){var o,r;const e=i.coordinates,t=[],n=(r=(o=e[0])==null?void 0:o[0])==null?void 0:r.length,s=oa(t,0,e,n);return{type:"Polygon",flatCoordinates:t,ends:s,layout:oo(n)}}function pg(i,e){i=jh(i,!0,e);const t=i.getType();let n;switch(t){case"Point":{n=hA(i);break}case"LineString":{n=rA(i);break}case"Polygon":{n=uA(i,e);break}case"MultiPoint":{n=lA(i);break}case"MultiLineString":{n=aA(i);break}case"MultiPolygon":{n=cA(i,e);break}case"GeometryCollection":{n=oA(i,e);break}case"Circle":{n={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+t)}return n}function oA(i,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:i.getGeometriesArray().map(function(n){return pg(n,e)})}}function rA(i,e){return{type:"LineString",coordinates:i.getCoordinates()}}function aA(i,e){return{type:"MultiLineString",coordinates:i.getCoordinates()}}function lA(i,e){return{type:"MultiPoint",coordinates:i.getCoordinates()}}function cA(i,e){let t;return e&&(t=e.rightHanded),{type:"MultiPolygon",coordinates:i.getCoordinates(t)}}function hA(i,e){return{type:"Point",coordinates:i.getCoordinates()}}function uA(i,e){let t;return e&&(t=e.rightHanded),{type:"Polygon",coordinates:i.getCoordinates(t)}}function dA(i,e,t,n){const s=document.createElement("script"),o="olc_"+Pe(e);function r(){delete globalThis[o],s.parentNode.removeChild(s)}s.async=!0,s.src=i+(i.includes("?")?"&":"?")+"callback="+o;const a=setTimeout(function(){r(),t&&t()},1e4);globalThis[o]=function(l){clearTimeout(a),r(),e(l)},document.head.appendChild(s)}class fA extends Fh{constructor(e){if(super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:De("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.tileJSON_=null,this.tileSize_=e.tileSize,e.url)if(e.jsonp)dA(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else if(e.tileJSON)this.handleTileJSONResponse(e.tileJSON);else throw new Error("Either `url` or `tileJSON` options must be provided")}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let n;try{n=JSON.parse(t.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(n)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(e){const t=De("EPSG:4326"),n=this.getProjection();let s;if(e.bounds!==void 0){const c=ia(t,n);s=Jg(e.bounds,c)}const o=Ka(n),r=e.minzoom||0,a=e.maxzoom||22,l=Ir({extent:o,maxZoom:a,minZoom:r,tileSize:this.tileSize_});if(this.tileGrid=l,this.tileUrlFunction=T1(e.tiles,l),e.attribution&&!this.getAttributions()){const c=s!==void 0?s:o;this.setAttributions(function(h){return pt(c,h.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState("ready")}handleTileJSONError(){this.setState("error")}}ke.parse("#000000"),ke.parse("#FFFFFF"),ke.parse("#000000");function pA(i,e=512){return i.getExtent()?Ir({extent:i.getExtent(),tileSize:e,maxZoom:22}).getResolutions():ag}function gA(i,e){return e.accessToken||(e=Object.assign({},e),new URL(i).searchParams.forEach((n,s)=>{e.accessToken=n,e.accessTokenParam=s})),e}function mA(i,e,t="",n={},s=void 0){let o,r,a,l,c=!0;return typeof t!="string"&&!Array.isArray(t)?(a=t,l=a.source||a.layers,n=a):l=t,typeof n=="string"?(o=n,a={}):(o=n.styleUrl,a=n),a.updateSource===!1&&(c=!1),s||(s=a.resolutions),!o&&typeof e=="string"&&!e.trim().startsWith("{")&&(o=e),o&&(o=o.startsWith("data:")?location.href:Lw(o,a.accessToken),a=gA(o,a)),new Promise(function(h,u){N2(e,a).then(function(d){if(d.version!=8)return u(new Error("glStyle version 8 required."));if(!(i instanceof zn||i instanceof zh))return u(new Error("Can only apply to VectorLayer or VectorTileLayer"));const f=i instanceof zh?"vector":"geojson";if(l?Array.isArray(l)?r=d.layers.find(function(P){return P.id===l[0]}).source:r=l:(r=d.layers.find(function(P){return P.source&&d.sources[P.source].type===f}).source,l=r),!r)return u(new Error(`No ${f} source found in the glStyle.`));function g(){if(!c)return Promise.resolve();if(i instanceof zh)return wA(d.sources[r],o,a).then(function(I){const M=i.getSource();M?I!==M&&(M.setTileUrlFunction(I.getTileUrlFunction()),typeof M.setUrls=="function"&&typeof I.getUrls=="function"&&M.setUrls(I.getUrls()),M.format_||(M.format_=I.format_),M.getAttributions()||M.setAttributions(I.getAttributions()),M.getTileLoadFunction()===A1&&M.setTileLoadFunction(I.getTileLoadFunction()),Wt(M.getProjection(),I.getProjection())&&(M.tileGrid=I.getTileGrid())):i.setSource(I);const z=i.getSource().getTileGrid();!isFinite(i.getMaxResolution())&&!isFinite(i.getMinZoom())&&z.getMinZoom()>0&&i.setMaxResolution(z2(Math.max(0,z.getMinZoom()-1e-12),z.getResolutions()))});const P=d.sources[r];let R=i.getSource();(!R||R.get("mapbox-source")!==P)&&(R=bA(P,o,a));const O=i.getSource();return O?R!==O&&(O.getAttributions()||O.setAttributions(R.getAttributions()),O.format_||(O.format_=R.getFormat()),O.url_=R.getUrl()):i.setSource(R),Promise.resolve()}let _,v;const E={},w={};function C(){if(!v&&(!d.sprite||E)){if(a.projection&&!s){const I=De(a.projection).getUnits();I!=="m"&&(s=ag.map(M=>M/ic[I]))}let P;const R=i.getSource();R instanceof dp&&R.format_ instanceof mp&&(P=R.format_.layerName_),v=Y2(i,d,l,s,E,w,(O,I=a.webfonts)=>V2(O,I),a.getImage,P),i.getStyle()?g().then(h).catch(u):u(new Error(`Nothing to show for source [${r}]`))}else v?(i.setStyle(v),g().then(h).catch(u)):u(new Error("Something went wrong trying to apply style."))}if(d.sprite){const P=I2(d.sprite,a.accessToken,o||location.href);_=hn?1:globalThis.devicePixelRatio>=1.5?.5:1;const R=_==.5?"@2x":"";Promise.all(P.map(function(O){const I=new URL(O.url);let M=I.origin+I.pathname+R+".json"+I.search;return new Promise(function(z,k){Ur("Sprite",M,a).then(z).catch(function(q){M=I.origin+I.pathname+".json"+I.search,Ur("Sprite",M,a).then(z).catch(k)})}).then(function(z){z===void 0&&u(new Error("No sprites found."));let k;if(k=I.origin+I.pathname+R+".png"+I.search,a.transformRequest){const q=a.transformRequest(k,"SpriteImage")||k;(q instanceof Request||q instanceof Promise)&&(k=q)}w[O.id]=k;for(const q in z){const H=O.id=="default"?q:`${O.id}:${q}`;E[H]=z[q]}}).catch(function(z){u(new Error(`Sprites cannot be loaded: ${M}: ${z.message}`))})})).then(C).catch(u)}else C()}).catch(u)})}function yA(i,e){const t=i.bounds;if(t){const n=Ie([t[0],t[1]],e),s=Ie([t[2],t[3]],e);return[n[0],n[1],s[0],s[1]]}return De(e).getExtent()}function _A(i,e,t){const n=new fA({tileJSON:e,tileSize:i.tileSize||e.tileSize||512}),s=n.getTileJSON(),o=n.getTileGrid(),r=De(t.projection||"EPSG:3857"),a=yA(s,r),l=r.getExtent(),c=s.minzoom||0,h=s.maxzoom||22,u={attributions:n.getAttributions(),projection:r,tileGrid:new Vs({origin:l?ln(l):o.getOrigin(0),extent:a||o.getExtent(),minZoom:c,resolutions:pA(r,e.tileSize).slice(0,h+1),tileSize:o.getTileSize(0)})};return Array.isArray(s.tiles)?u.urls=s.tiles:u.url=s.tiles,u}function wA(i,e,t){return new Promise(function(n,s){k2(i,e,t).then(function({tileJson:o,tileLoadFunction:r}){const a=_A(i,o,t);a.tileLoadFunction=r,a.format=new mp({layerName:"mvt:layer"});const l=new dp(a);l.set("mapbox-source",i),n(l)}).catch(s)})}function vA(i){return`{bbox-${(i?i.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function bA(i,e,t){const n=t.projection?new $w({dataProjection:t.projection}):new $w,s=i.data,o={};if(typeof s=="string"){const[a]=mu(s,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){const c=(u,d,f)=>{const g=vA(f);return a.replace(g,`${u.join(",")}`)},h=new vn({attributions:i.attribution,format:n,loader:(u,d,f,g,_)=>{const v=typeof c=="function"?c(u,d,f):c;Ur("GeoJSON",v,t).then(E=>{const w=h.getFormat().readFeatures(E,{featureProjection:f});h.addFeatures(w),g(w)}).catch(E=>{h.removeLoadedExtent(u),_()})},strategy:PE});return h.set("mapbox-source",i),h}const l=new vn({attributions:i.attribution,format:n,url:a,loader:(c,h,u,d,f)=>{Ur("GeoJSON",a,t).then(g=>{const _=l.getFormat().readFeatures(g,{featureProjection:u});l.addFeatures(_),d(_)}).catch(g=>{l.removeLoadedExtent(c),f()})}});return l}o.features=n.readFeatures(s,{featureProjection:"EPSG:3857"});const r=new vn(Object.assign({attributions:i.attribution,format:n},o));return r.set("mapbox-source",i),r}class gg extends p.Destroyable{constructor(t,n){super();T(this,"_imageriesManager");T(this,"_map");T(this,"_raster");T(this,"_layer",this.dv(p.react(void 0)));T(this,"_rShow",this.dv(p.react(!0)));T(this,"_rAlpha",this.dv(p.react(1)));T(this,"_rZIndex",this.dv(p.react(0)));T(this,"_rRectangle",this.dv(p.react(void 0)));T(this,"_rSplitDirection",this.dv(p.react("NONE")));T(this,"_rBrightness",this.dv(p.react(1)));T(this,"_rContrast",this.dv(p.react(1)));T(this,"_rHue",this.dv(p.react(0)));T(this,"_rSaturation",this.dv(p.react(1)));T(this,"_rGamma",this.dv(p.react(1)));T(this,"_raf");this.id=n;const s=t.viewer;if(!s)return;this._map=s;const o=ts(s);if(!o)return;const{imageriesManager:r}=o;this._imageriesManager=r,this.d(()=>this._destroyLayer())}get layer(){return this._layer.value}set layer(t){this._layer.value=t}get layerChanged(){return this._layer.changed}get show(){return this._rShow.value}get alpha(){return this._rAlpha.value}get zIndex(){return this._rZIndex.value}get rectangle(){return this._rRectangle.value}get splitDirection(){return this._rSplitDirection.value}get brightness(){return this._rBrightness.value}get contrast(){return this._rContrast.value}get hue(){return this._rHue.value}get saturation(){return this._rSaturation.value}get gamma(){return this._rGamma.value}get showChanged(){return this._rShow.changed}get alphaChanged(){return this._rAlpha.changed}get zIndexChanged(){return this._rZIndex.changed}get rectangleChanged(){return this._rRectangle.changed}get splitDirectionChanged(){return this._rSplitDirection.changed}get brightnessChanged(){return this._rBrightness.changed}get contrastChanged(){return this._rContrast.changed}get hueChanged(){return this._rHue.changed}get saturationChanged(){return this._rSaturation.changed}get gammaChanged(){return this._rGamma.changed}set show(t){var s;const n=t??!0;this._rShow.value=n,(s=this._layer.value)==null||s.setVisible(n)}set alpha(t){var s;const n=t??1;this._rAlpha.value=n,(s=this._layer.value)==null||s.setOpacity(n)}set zIndex(t){const n=t??0;this._rZIndex.value=n,this._layer.value&&this._imageriesManager&&this._imageriesManager.setZindex(this._layer.value,n)}set rectangle(t){this._rRectangle.value=t}set splitDirection(t){this._rSplitDirection.value=t??"NONE"}set brightness(t){this._rBrightness.value=t??1,this._applyColorAdjustments()}set contrast(t){this._rContrast.value=t??1,this._applyColorAdjustments()}set hue(t){this._rHue.value=t??0,this._applyColorAdjustments()}set saturation(t){this._rSaturation.value=t??1,this._applyColorAdjustments()}set gamma(t){this._rGamma.value=t??1,this._applyColorAdjustments()}_applyColorAdjustments(){this._raf||(this._raf=requestAnimationFrame(()=>{var s,o,r;this._raf=void 0;const t=this._layer.value,n=(s=t==null?void 0:t.getSource)==null?void 0:s.call(t);(r=(o=this._raster)==null?void 0:o.changed)==null||r.call(o),n!=null&&n.refresh?n.refresh():t!=null&&t.changed&&t.changed()}))}set imageryProvider(t){this._createFromProvider(t)}flyTo(t){}_destroyLayer(){var n,s,o;const t=(n=this._layer)==null?void 0:n.value;this._map&&t&&this._imageriesManager&&this._imageriesManager.delete(t),this._raf&&(cancelAnimationFrame(this._raf),this._raf=void 0),(o=(s=this._raster)==null?void 0:s.dispose)==null||o.call(s),this._raster=void 0,this._layer.value=void 0}_wrapWithRaster(t){const n=Math.min(4,Math.max(1,(typeof navigator<"u"&&navigator.hardwareConcurrency||4)-1)),s=new lp({sources:[t],operationType:"pixel",threads:n,operation:function(o,r){function a(_,v,E){return .2126*_+.7152*v+.0722*E}function l(_,v,E,w,C){const P=.299*_+.587*v+.114*E,R=.595716*_-.274453*v-.321263*E,O=.211456*_-.522591*v+.311135*E,I=R*w-O*C,M=R*C+O*w;let z=P+.9563*I+.621*M,k=P-.2721*I-.6474*M,q=P-1.107*I+1.7046*M;const H=m=>m<0?0:m>1?1:m;return[H(z),H(k),H(q)]}const c=o[0];let h=c[0]/255,u=c[1]/255,d=c[2]/255;const f=c[3]/255;if(r.hueCos!==1||r.hueSin!==0){const _=l(h,u,d,r.hueCos,r.hueSin);h=_[0],u=_[1],d=_[2]}if(r.saturation!==1){const _=a(h,u,d);h=_+(h-_)*r.saturation,u=_+(u-_)*r.saturation,d=_+(d-_)*r.saturation}r.brightness!==1&&(h*=r.brightness,u*=r.brightness,d*=r.brightness),r.contrast!==1&&(h=(h-.5)*r.contrast+.5,u=(u-.5)*r.contrast+.5,d=(d-.5)*r.contrast+.5),r.gammaInv!==1&&(h=Math.pow(Math.max(h,0),r.gammaInv),u=Math.pow(Math.max(u,0),r.gammaInv),d=Math.pow(Math.max(d,0),r.gammaInv));const g=_=>Math.max(0,Math.min(255,Math.round(_*255)));return c[0]=g(h),c[1]=g(u),c[2]=g(d),c[3]=g(f),c}});return s.on("beforeoperations",o=>{const r=this._rHue.value??0;o.data.brightness=this._rBrightness.value??1,o.data.contrast=this._rContrast.value??1,o.data.saturation=this._rSaturation.value??1,o.data.gammaInv=1/Math.max(1e-4,this._rGamma.value??1),o.data.hueCos=Math.cos(r),o.data.hueSin=Math.sin(r)}),this._raster=s,s}_makeLayerForSource(t){return t instanceof lp?new ep({source:t}):t instanceof b1?new ep({source:t}):new Ah({source:t})}_createFromProvider(t){var g,_,v,E;if(!this._map)return;this._destroyLayer();const s=De("EPSG:3857").getExtent(),o=Te(s)/256,r=t,a=r.crossOrigin??"anonymous",l=Math.max((r.maximumLevel??18)+1,19),c=Array.from({length:l},(w,C)=>o/Math.pow(2,C));Array.from({length:l},(w,C)=>C.toString());const h=(w,C)=>{if(!C)return{url:w};const P=Array.isArray(C)?C:C.split("");return P.length?w.includes("{s}")?{urls:P.map(R=>w.replace("{s}",R))}:{url:w}:{url:w}},u=w=>typeof w=="string"?w:w&&w.url||"",d=r.minimumLevel??0,f=r.maximumLevel??18;switch(t.type){case"UrlTemplateImageryProvider":{const w=t,C=u(w.url),P=h(C,w.subdomains),R=new Lh({...P.urls?{urls:P.urls}:{url:P.url},attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:f,transition:0}),O=this._wrapWithRaster(R);this._layer.value=this._makeLayerForSource(O);break}case"WebMapTileServiceImageryProvider":{const w=t,C=(w.matrixSet??w.tileMatrixSetID??"EPSG:3857").toUpperCase(),P=C==="EPSG:4326",R=(w.minimumLevel??d)|0,O=(w.maximumLevel??f)|0,I=w.tileMatrixLabels||w.TileMatrixLabels,M=P?Array.from({length:22},(B,X)=>`${C}:${X}`):Array.from({length:22},(B,X)=>String(X)),z=I&&I.length?I:M,k=z.length,q=Math.max(0,Math.min(R,k-1)),H=Math.max(q,Math.min(O,k-1)),m=Math.max(1,H-q+1),b=z.slice(q,q+m),S=256;let L,N,j;if(P){N=[-180,-90,180,90],L=ln(N);const B=360/(S*2);j=Array.from({length:m},(X,G)=>B/Math.pow(2,q+G))}else{N=s,L=ln(N);const B=Te(N)/S;j=Array.from({length:m},(X,G)=>B/Math.pow(2,q+G))}const U=new UT({url:u(w.url),layer:w.layer,matrixSet:C,format:w.format??"image/png",style:w.style??"default",tileGrid:w.tileGrid??new _T({origin:L,extent:N,resolutions:j,matrixIds:b,tileSize:S}),requestEncoding:w.requestEncoding||w.requestencoding||"KVP",...P?{projection:De("EPSG:4326")}:{},attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0,tileLoadFunction:(B,X)=>{const G=new Image;G.crossOrigin=a||"anonymous",G.onload=()=>{var je,Me;const ae=this._rBrightness.value??1,te=this._rContrast.value??1,V=this._rSaturation.value??1,re=this._rHue.value??0,ie=this._rGamma.value??1;if(re===0&&V===1&&ae===1&&te===1&&ie===1){const fe=(je=B.getImage)==null?void 0:je.call(B);if(fe){fe.src=X;return}}const he=G.naturalWidth||G.width,me=G.naturalHeight||G.height;if(!he||!me){B.getImage().src=X;return}const Fe=document.createElement("canvas");Fe.width=he,Fe.height=me;const ue=Fe.getContext("2d",{willReadFrequently:!0});ue.drawImage(G,0,0);const ze=ue.getImageData(0,0,he,me),J=ze.data,dt=Math.cos(re),Qe=Math.sin(re),ye=[[.299,.587,.114],[.595716,-.274453,-.321263],[.211456,-.522591,.311135]],sn=[[1,.9563,.621],[1,-.2721,-.6474],[1,-1.107,1.7046]],Gt=[[1,0,0],[0,dt,-Qe],[0,Qe,dt]],_t=(fe,Ze)=>{const Ce=Array.from({length:3},()=>[0,0,0]);for(let xe=0;xe<3;xe++)for(let Be=0;Be<3;Be++)Ce[xe][Be]=fe[xe][0]*Ze[0][Be]+fe[xe][1]*Ze[1][Be]+fe[xe][2]*Ze[2][Be];return Ce},Mt=_t(sn,_t(Gt,ye)),Je=.5-.5*te,qn=1/Math.max(1e-4,ie),nt=new Uint8ClampedArray(256);for(let fe=0;fe<256;fe++)nt[fe]=Math.max(0,Math.min(255,Math.round(Math.pow(fe/255,qn)*255)));const Vn=.2126,Wn=.7152,ui=.0722;for(let fe=0;fe<J.length;fe+=4){let Ze=J[fe]/255,Ce=J[fe+1]/255,xe=J[fe+2]/255;const Be=J[fe+3],Et=Mt[0][0]*Ze+Mt[0][1]*Ce+Mt[0][2]*xe,on=Mt[1][0]*Ze+Mt[1][1]*Ce+Mt[1][2]*xe,qt=Mt[2][0]*Ze+Mt[2][1]*Ce+Mt[2][2]*xe,lt=Vn*Et+Wn*on+ui*qt,Dt=lt+(Et-lt)*V,it=lt+(on-lt)*V,Vt=lt+(qt-lt)*V,zt=Dt*ae,Pt=it*ae,et=Vt*ae;let Ot=zt*te+Je,Fi=Pt*te+Je,Bn=et*te+Je;Ot=Ot<0?0:Ot>1?1:Ot,Fi=Fi<0?0:Fi>1?1:Fi,Bn=Bn<0?0:Bn>1?1:Bn,J[fe]=nt[Math.round(Ot*255)],J[fe+1]=nt[Math.round(Fi*255)],J[fe+2]=nt[Math.round(Bn*255)],J[fe+3]=Be}ue.putImageData(ze,0,0);const qe=(Me=B.setImage)==null?void 0:Me.bind(B);qe?qe(Fe):B.getImage().src=Fe.toDataURL("image/png")},G.onerror=()=>{B.getImage().src=X},G.src=X}});this._layer.value=new Ah({source:U});break}case"WebMapServiceImageryProvider":{const w=t,C={LAYERS:w.layers,TILED:!0,VERSION:((g=w.parameters)==null?void 0:g.VERSION)??((_=w.parameters)==null?void 0:_.version)??"1.3.0",...w.parameters},P=new jT({url:u(w.url),params:C,attributions:r.attributions,crossOrigin:a,transition:0}),R=this._wrapWithRaster(P);this._layer.value=this._makeLayerForSource(R);break}case"TileMapServiceImageryProvider":{const w=t,C=w.url?u(w.url):"",P=C.includes("{-y}"),R=/4326/.test(C)?"EPSG:4326":"EPSG:3857",O=De(R),I=P?Ir({extent:O.getExtent(),minZoom:d,maxZoom:f,tileSize:256}):void 0,M=w.url?u(w.url):"",z=new Lh({url:M,attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:f,tileGrid:new Vs({origin:ln(s),resolutions:c.slice(d,f+1)}),zDirection:-1,transition:0,...I?{tileGrid:I}:{}}),k=this._wrapWithRaster(z);this._layer.value=this._makeLayerForSource(k);break}case"OpenStreetMapImageryProvider":{const w=t,C=new Lh({url:w.url,attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0}),P=this._wrapWithRaster(C);this._layer.value=this._makeLayerForSource(P);break}case"SingleTileImageryProvider":{const w=t,C=typeof w.url=="string"?w.url:w.url.url,P=w.rectangle?sa(w.rectangle,"EPSG:4326","EPSG:3857"):s,R=new b1({url:C,imageExtent:P,attributions:r.attributions,crossOrigin:a,interpolate:!0}),O=this._wrapWithRaster(R);this._layer.value=this._makeLayerForSource(O);break}case"MVTImageryProvider":{(async()=>{var B,X,G,ae;const w=t;if(!w.url)return;let C,P=[],R,O,I=null,M,z;const k=async te=>{if(!te)return{};if(typeof te=="string"){const V=te.toLowerCase();if(V.endsWith(".json")||V.includes("tilejson")||V.includes(".json?"))try{const re=await fetch(te);if(re.ok){const ie=await re.json(),he=ie.minzoom,me=ie.maxzoom;if(ie.tiles&&ie.tiles.length>0)return{url:ie.tiles[0],minzoom:he,maxzoom:me};if(ie.url)return{url:ie.url,minzoom:he,maxzoom:me}}}catch{}return{url:te}}if(typeof te=="object"){const V=te,re=V.minzoom,ie=V.maxzoom;if(V.tiles&&V.tiles.length>0)return{url:V.tiles[0],minzoom:re,maxzoom:ie};if(V.url)return{url:V.url,minzoom:re,maxzoom:ie}}return{}},q=te=>{const V=te.toLowerCase();return V.includes("style.json")||V.endsWith(".json")&&!V.includes("{z}")&&!V.includes("{x}")&&!V.includes("{y}")};let H="customSource";if(typeof w.url=="string")if(q(w.url))try{const te=await fetch(w.url);if(!te.ok){console.warn(`[OlImagery] MVT: fetch style.json 失败: ${te.status}`);return}I=await te.json();const V=I.sources||{};for(const re in V)if(Object.prototype.hasOwnProperty.call(V,re)){const ie=V[re];if(ie.type==="vector"){if(H=re,ie.minzoom!==void 0&&(M=M===void 0?ie.minzoom:Math.min(M,ie.minzoom)),ie.maxzoom!==void 0&&(z=z===void 0?ie.maxzoom:Math.max(z,ie.maxzoom)),ie.tiles&&ie.tiles.length>0){C=ie.tiles[0];break}if(ie.url){const he=await k(ie.url);if(C=he.url,he.minzoom!==void 0&&(M=M===void 0?he.minzoom:Math.min(M,he.minzoom)),he.maxzoom!==void 0&&(z=z===void 0?he.maxzoom:Math.max(z,he.maxzoom)),C)break}}}if(!C){console.warn("[OlImagery] MVT: style.json 中未找到有效的 tile URL");return}P=(B=w.style)!=null&&B.length?w.style:I.layers||[],R=I.glyphs,O=I.sprite}catch(te){console.warn("[OlImagery] MVT: fetch style.json 出错:",te);return}else{const te=await k(w.url);C=te.url,M=te.minzoom,z=te.maxzoom,P=w.style||[],R=w.glyphs,O=w.sprite}else if(w.url&&typeof w.url=="object"){I=w.url;const te=I.sources||{};for(const V in te)if(Object.prototype.hasOwnProperty.call(te,V)){const re=te[V];if(re.type==="vector"){if(H=V,re.minzoom!==void 0&&(M=M===void 0?re.minzoom:Math.min(M,re.minzoom)),re.maxzoom!==void 0&&(z=z===void 0?re.maxzoom:Math.max(z,re.maxzoom)),re.tiles&&re.tiles.length>0){C=re.tiles[0];break}if(re.url){const ie=await k(re.url);if(C=ie.url,ie.minzoom!==void 0&&(M=M===void 0?ie.minzoom:Math.min(M,ie.minzoom)),ie.maxzoom!==void 0&&(z=z===void 0?ie.maxzoom:Math.max(z,ie.maxzoom)),C)break}}}if(!C){console.warn("[OlImagery] MVT: 未在 style JSON 中找到有效的 tile URL");return}P=(X=w.style)!=null&&X.length?w.style:I.layers||[],R=I.glyphs,O=I.sprite}else return;if(C&&w.accessToken&&C.includes("mapbox")&&!C.includes("access_token")){const te=C.includes("?")?"&":"?";C+=`${te}access_token=${w.accessToken}`}const m=Math.max(w.minimumLevel??0,M??0),b=Math.min(w.maximumLevel??18,z??18),S=w.tileSize||512,L=w.scheme||"xyz",N=((G=I==null?void 0:I.metadata)==null?void 0:G["mapbox:projection"])||((ae=I==null?void 0:I.metadata)==null?void 0:ae.projection)||"EPSG:3857",j=new dp({url:C,format:new mp,tileGrid:Ir({tileSize:S,minZoom:m,maxZoom:b}),...L==="tms"?{zDirection:-1}:{},attributions:I==null?void 0:I.attribution});N!=="EPSG:3857"&&(j.dataProjection=N),j.on("tileloaderror",te=>{console.error("[OlImagery] MVT: 瓦片加载失败",te)});const U=new zh({source:j,declutter:!0});if(P.length>0)try{const te="https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",V={version:8,name:"MVT Style",sources:{[H]:{type:"vector",tiles:[C],minzoom:m,maxzoom:b}},layers:P,glyphs:R||te,sprite:O},re={source:H,...typeof w.url=="string"&&w.url.toLowerCase().includes("style.json")?{styleUrl:w.url}:{}};await mA(U,V,re)}catch(te){console.warn("[OlImagery] MVT: ol-mapbox-style 应用样式失败,使用默认样式",te),U.setStyle(function(V){var me;const re=V.getGeometry(),ie=((me=re==null?void 0:re.getType)==null?void 0:me.call(re))||"",he=[];return ie==="LineString"||ie==="MultiLineString"?he.push(new $e({stroke:new St({color:"#ff0000",width:3})})):ie==="Polygon"||ie==="MultiPolygon"?he.push(new $e({fill:new vt({color:"rgba(100, 100, 100, 0.5)"}),stroke:new St({color:"#333333",width:1})})):(ie==="Point"||ie==="MultiPoint")&&he.push(new $e({image:new Ln({radius:5,fill:new vt({color:"#ff0000"})})})),he})}this._layer.value=U,this._layer.value.setOpacity(this._rAlpha.value),this._layer.value.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))})();break}default:{console.warn("[OlImagery] 未实现的 provider.type:",t.type,t);return}}(v=this._layer.value)==null||v.setOpacity(this._rAlpha.value),(E=this._layer.value)==null||E.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))}}const Su=class Su extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_clickEvent",this.disposeVar(new p.Event));T(this,"_hovered",this.disposeVar(p.react(!1)));T(this,"_feature");T(this,"_source");T(this,"_layer");T(this,"_initialized",!1);const s=new wn([]);this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid());const o=t.viewer;if(!o)return;this._source=new vn,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};this.d(p.createEventsCallFunc(this.showChanged,r,{immediate:!0})),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.position))return;const c=Ie([this.position[0][0],this.position[0][1]]);s.setCoordinates(c);const h=this.radius??5,u=this.strokeWidth??2,d=this.fillColor??[1,1,1,1],f=this.strokeColor??[0,153/255,1,1],g=new vt({color:`rgba(${d.slice(0,3).map(E=>Math.round(E*255)).join(",")},${d[3]})`}),_=new St({color:`rgba(${f.slice(0,3).map(E=>Math.round(E*255)).join(",")},${f[3]})`,width:u}),v=new $e({image:new Ln({radius:h,fill:g,stroke:_})});this._feature.setStyle(v),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{this.position&&Yi(t,this.position)})),this.dispose(this.positionChanged.disposableOn(()=>{!this._initialized&&this.position&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlPoint"}get defaultProps(){return Su.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(t){this._hovered.value=t}get feature(){return this._feature}_initializePoint(){const t=()=>{var f;if(!this.position)return;const s=Ie([this.position[0],this.position[1]]);if(!this._feature)return;this._feature.getGeometry().setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new vt({color:`rgba(${l.slice(0,3).map(g=>Math.round(g*255)).join(",")},${l[3]})`}),u=new St({color:`rgba(${c.slice(0,3).map(g=>Math.round(g*255)).join(",")},${c[3]})`,width:a}),d=new $e({image:new Ln({radius:r,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(f=this._source)==null||f.addFeature(this._feature)};t();const n=p.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(t))}};T(Su,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,153/255,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let li=Su;(i=>{i.createDefaultProps=()=>({show:void 0,position:p.reactArrayWithUndefined(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:p.reactArrayWithUndefined(void 0),outlineColor:p.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:p.reactArrayWithUndefined(void 0),strokeColor:p.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(li||(li={})),p.extendClassProps(li.prototype,li.createDefaultProps);const Ru=class Ru extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_layer");T(this,"_feature");T(this,"_source");T(this,"_lineString");const s=new Qn([]);this._lineString=s,this.d(()=>{var c;return(c=this._lineString)==null?void 0:c.dispose()}),this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid()),this.d(()=>{var c;return(c=this._feature)==null?void 0:c.dispose()}),this._source=new vn,this.d(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({zIndex:0,source:this._source}),this.d(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const o=t.viewer;if(!o)return;o.addLayer(this._layer),this.d(()=>o.removeLayer(this._layer));const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),this.d(p.createEventsCallFunc(this.zIndexChanged,()=>{var c;(c=this._layer)==null||c.setZIndex(this.zIndex)},{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<2))return;const c=this.positions.map(d=>Ie([d[0],d[1]]));this.loop&&c.length>=3&&c.push(c[0]),this._feature.getGeometry().setCoordinates(c);const u=(d,f)=>{const g=[],_=new St({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`,width:this.width??2,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0});if(g.push(new $e({stroke:_})),this.hasArrow&&c.length>=2){const[v,E]=c[c.length-2],[w,C]=c[c.length-1],P=EA(w-v,C-E);g.push(new $e({geometry:new wn([w,C]),image:new Ca({points:3,radius:8,rotation:P,rotateWithView:!0,fill:new vt({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`})})}))}return g};this._feature.setStyle(u),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.loopChanged,this.widthChanged,this.colorChanged,this.hasDashChanged,this.dashLengthChanged,this.hasArrowChanged,this.showChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=this.positions[Math.floor(this.positions.length/2)];Yi(t,h)}))}get typeName(){return"OlPolyline"}get defaultProps(){return Ru.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}};T(Ru,"defaults",{positions:[],width:2,loop:!1,color:[1,1,1,1],hasDash:!1,dashLength:16,hasArrow:!1});let Ut=Ru;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),loop:!1,width:2,color:p.reactArray([1,1,1,1]),hasDash:!1,dashLength:16,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,zIndex:0,dashPattern:255,gapColor:p.reactArray([0,0,0,0])})})(Ut||(Ut={})),p.extendClassProps(Ut.prototype,Ut.createDefaultProps);function EA(i,e){const t=Math.atan2(e,i);return(Math.PI/2-t+2*Math.PI)%(2*Math.PI)}class CA extends p.Destroyable{constructor(t,n){super();T(this,"_geoPoint");T(this,"_geoAxis");this._geoPoint=this.disposeVar(new li(n,t.id)),this._geoAxis=this.disposeVar(new Ut(n,t.id)),this._geoAxis.width=6,this._geoAxis.color=[1,1,0,.7]}get geoPoint(){return this._geoPoint}get geoAxis(){return this._geoAxis}}const as=class as extends p.Destroyable{constructor(t,n){super();T(this,"_captureEvent",this.disposeVar(new p.Event));T(this,"_id",this.disposeVar(p.react(p.createGuid())));if(this._olViewer=t,n&&(this.id=n),!t.viewer)return;this.disposeVar(new p.ObjResettingWithEvent(this.showChanged,()=>{if(this.show&&this.position)return new CA(this,t)})),this.default&&this.flyTo(void 0,!1);const o=this.disposeVar(p.createProcessingFromAsyncFunc(async a=>{const{position:l,rotation:c,viewDistance:h,duration:u=1e3}=this;if(l){const d=Yi(this._olViewer,l,h,c,u,()=>{this.enabled=!1});d&&await a.promise(d),this.enabled=!1}}));this.dispose(this.enabledChanged.disposableOn(()=>{o.isRunning&&o.cancel(),this.enabled&&o.restart()}));const r=this.disposeVar(p.createProcessingFromAsyncFunc(async(a,l,c)=>{var d,f;const h=(f=(d=this._olViewer).capture)==null?void 0:f.call(d,l,c);if(!h)return;const u=await a.promise(h);u&&(this.thumbnail=u)}));this.dispose(this.captureEvent.disposableOn((a,l)=>{r.restart(void 0,a??as.defaults.thumbnailWidth,l??as.defaults.thumbnailHeight)}))}get captureEvent(){return this._captureEvent}capture(t,n){this._captureEvent.emit(t,n)}get id(){return this._id.value}set id(t){this._id.value=t}get idChanged(){return this._id.changed}resetWithCurrentCamera(t){if(!this._olViewer.actived)return;const n=this._olViewer.getCurrentCameraInfo();n&&(t&as.ResetFlag.Position&&(this.position=n.position),t&as.ResetFlag.Rotation&&(this.rotation=n.rotation),t&as.ResetFlag.ViewDistance&&(this.viewDistance=0))}flyTo(t,n){if((n??!0)&&!this._olViewer.actived)return;const{position:s,rotation:o,viewDistance:r,duration:a}=this;s&&Yi(this._olViewer,s,r,o,t??a)}};T(as,"ResetFlag",{Position:1,Rotation:2,ViewDistance:4,Zoom:10}),T(as,"defaults",{thumbnailWidth:64,thumbnailHeight:64,enabled:!0,show:!1,position:[116.39,39.9,100],duration:1e3,default:!1,thumbnail:""});let Lo=as;(i=>{i.createDefaultProps=()=>({enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,show:!1,rotation:p.reactArray([0,0,0]),viewDistance:0,duration:void 0,default:!1,thumbnail:""})})(Lo||(Lo={})),p.extendClassProps(Lo.prototype,Lo.createDefaultProps);class ss extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_feature");T(this,"_layer");T(this,"_source");const s=new Kn([[]]);this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid());const o=t.viewer;if(!o)return;this._source=new vn,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()}),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const r=()=>{var c,h;(c=this._layer)==null||c.setVisible(this.show??!0),(h=this._layer)==null||h.setZIndex(this.zIndex)};this.d(p.createEventsCallFunc([this.showChanged,this.zIndexChanged],r,{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<3))return;const c=Xw(this.positions);if(c.length<4)return;this._feature.getGeometry().setCoordinates([c]);const h=this.filled?this.fillColor:[0,0,0,0],u=this.stroked?this.outlineColor:[0,0,0,0];this._feature.setStyle(new $e({fill:new vt({color:Hw(h)}),stroke:new St({color:Hw(u),width:this.outlineWidth??1.5,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.fillColorChanged,this.outlineColorChanged,this.outlineWidthChanged,this.hasDashChanged,this.dashLengthChanged,this.strokedChanged,this.filledChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=Xw(this.positions),[u,d]=xA(h),[f,g]=Lt([u,d]);Yi(t,[f,g,0])}))}get typeName(){return"OlPolygon"}get defaultProps(){return ss.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactJsonWithUndefined(void 0),fillColor:p.reactArray([1,1,1,.4]),outlineColor:p.reactArray([1,1,1,1]),outlineWidth:1.5,hasDash:!1,dashLength:16,zIndex:0,stroked:!0,filled:!0})})(ss||(ss={})),p.extendClassProps(ss.prototype,ss.createDefaultProps);function Hw(i){return`rgba(${i[0]*255}, ${i[1]*255}, ${i[2]*255}, ${i[3]})`}function Xw(i){const e=i.map(s=>Ie([s[0],s[1]])),t=e[0],n=e[e.length-1];return(!t||!n||t[0]!==n[0]||t[1]!==n[1])&&e.push(t),e}function xA(i){let e=0,t=0,n=0;for(let s=0,o=i.length-1;s<i.length;o=s++){const[r,a]=i[o],[l,c]=i[s],h=r*c-l*a;e+=h,t+=(r+l)*h,n+=(a+c)*h}return e*=.5,Math.abs(e)<1e-9?i[0]:(t/=6*e,n/=6*e,[t,n])}const Tu=class Tu extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_clickEvent",this.disposeVar(new p.Event));T(this,"_hovered",this.disposeVar(p.react(!1)));T(this,"_feature");T(this,"_source");T(this,"_layer");T(this,"_initialized",!1);const s=new er([]);this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid());const o=t.viewer;if(!o)return;this._source=new vn,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.points))return;const c=this.points.map(w=>Ie([w[0],w[1]]));if(!this._feature)return;const h=this._feature.getGeometry();h&&h.setCoordinates(c);const u=this.radius??5,d=this.strokeWidth??2,f=this.fillColor??[255,255,255,1],g=this.strokeColor??[0,153/255,1,1],_=new vt({color:`rgba(${f.map(w=>w*255).join(",")})`}),v=new St({color:`rgba(${g.map(w=>w*255).join(",")})`,width:d}),E=new $e({image:new Ln({radius:u,fill:_,stroke:v})});this._feature.setStyle(E),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.pointsChanged.don(()=>{!this._initialized&&this.points&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlMultiPoint"}get defaultProps(){return Tu.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(t){this._hovered.value=t}get feature(){return this._feature}_initializePoint(){const t=()=>{var f;if(!this.points)return;const s=this.points.map(g=>Ie([g[0],g[1]]));if(!this._feature)return;const o=this._feature.getGeometry();o&&o.setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new vt({color:`rgba(${l.map(g=>g*255).join(",")})`}),u=new St({color:`rgba(${c.map(g=>g*255).join(",")})`,width:a}),d=new $e({image:new Ln({radius:r,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(f=this._source)==null||f.addFeature(this._feature)};t();const n=p.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(t))}};T(Tu,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,153/255,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let Hs=Tu;(i=>{i.createDefaultProps=()=>({show:void 0,points:p.reactPositions(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:p.reactArrayWithUndefined(void 0),outlineColor:p.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:p.reactArrayWithUndefined(void 0),strokeColor:p.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(Hs||(Hs={})),p.extendClassProps(Hs.prototype,Hs.createDefaultProps);class ul extends p.EngineObject{constructor(e,t){if(super(e,t),!t.viewer){console.warn("map is undefined!");return}this.d(e.flyToEvent.don((s,o)=>this.flyTo(s,o))),this.d(e.flyInEvent.don((s,o)=>this.flyIn(s,o))),this.dispose(e.calcFlyInParamEvent.disposableOn(()=>{if(!t.actived)return;const s=t.getCurrentCameraInfo();if(!s)return;const{position:o,rotation:r}=s;e.flyInParam={position:o,rotation:r,flyDuration:1}})),this.dispose(e.calcFlyToParamEvent.disposableOn(()=>{e.useCalcFlyToParamInESObjectWithLocation||console.warn("calcFlyToParam无法调用,该对象缺少position属性!")}))}flyToWithPromise(e,t,n,s,o,r,a){const{sceneObject:l,olViewer:c}=this;c.flyTo({distance:n??0,heading:s?s[0]:0,pitch:s?s[1]:0,flyDuration:o??1,hDelta:r??0,pDelta:a??0},t)}flyTo(e,t){const{sceneObject:n,olViewer:s}=this;return s.actived?(n.flyToParam&&(n.useCalcFlyToParamInESObjectWithLocation||console.warn("flyToParam无法使用,该对象缺少position属性,若飞行失败,请清空flyToParam后重试!")),n.flyInParam?this.flyIn(e,t):!1):!1}flyIn(e,t){const{sceneObject:n,olViewer:s}=this;if(!s.actived)return!1;if(n.flyInParam){const{position:o,rotation:r,flyDuration:a}=n.flyInParam,l=e??a;return this.olViewer.flyIn(o,r,l),!0}return!1}get olViewer(){return this.viewer}}class dl extends ul{constructor(t,n){super(t,n);T(this,"_smoothMoving");this._smoothMoving=this.dv(new p.SmoothMoveController(n)),this.d(this._smoothMoving.currentPositionChanged.don(o=>{o&&(t.position=o)})),this.d(this._smoothMoving.currentRotationChanged.don(o=>{o&&this._smoothMoving.isRotating&&(t.rotation=o)})),this.d(this._smoothMoving.currentHeadingChanged.don(o=>{if(o!==void 0&&!this._smoothMoving.isRotating){const r=t.rotation;t.rotation=[o-90,r[1],r[2]]}})),this.d(t.smoothMoveEvent.don((o,r)=>this.smoothMove(o,r*1e3))),this.d(t.smoothMoveWithRotationEvent.don((o,r,a)=>this.smoothMoveWithRotation(o,r,a*1e3))),this.d(t.smoothMoveOnGroundEvent.don((o,r,a)=>this.smoothMoveOnGround(o,r,a*1e3))),this.d(t.smoothMoveWithRotationOnGroundEvent.don((o,r,a,l)=>this.smoothMoveWithRotationOnGround(o,r,a,l*1e3))),this.d(t.calcFlyToParamEvent.don(()=>{if(!t.useCalcFlyToParamInESObjectWithLocation||!t.position)return;const o=n.calcFlyToParam(t.position);if(!o){console.warn("olViewer.calcFlyToParam failed.");return}console.log("olViewer.calcFlyToParam success.",o),t.flyToParam=o})),this.d(t.automaticLandingEvent.don(async()=>{console.warn("ESOlViewer automaticLandingEvent is not supported.")}));const s=this.dv(p.createNextAnimateFrameEvent(t.minVisibleDistanceChanged,t.maxVisibleDistanceChanged));this.d(s.don(()=>this.visibleDistance(t,n))),this.d(n.cameraChanged.don(()=>this.visibleDistance(t,n)))}smoothMove(t,n){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(t,this.sceneObject.rotation,n)}smoothMoveWithRotation(t,n,s){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(t,n,s)}async smoothMoveOnGround(t,n,s){const o=await this.olViewer.getTerrainHeight([t,n])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([t,n,o],this.sceneObject.rotation,s)}async smoothMoveWithRotationOnGround(t,n,s,o){const r=await this.olViewer.getTerrainHeight([n,s])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([n,s,r],t,o)}visibleDistance(t,n){if(!t.show||!t.position)return;const s=p.getDistancesFromPositions([t.position,Py(n)],"NONE")[0];t.minVisibleDistance<t.maxVisibleDistance?s>t.minVisibleDistance&&s<t.maxVisibleDistance:t.maxVisibleDistance===0&&s>t.minVisibleDistance}flyTo(t,n){const{sceneObject:s,olViewer:o}=this;if(!o.actived||!o.viewer)return!1;if(s.flyToParam&&s.position){const{position:r,flyToParam:a}=s,{distance:l,heading:c,pitch:h,flyDuration:u,hDelta:d,pDelta:f}=a;return this.flyToWithPromise(n,r,l,[c,h,0],t??u,d,f),!0}else return nf(o.viewer,s.position,t),!0}flyIn(t,n){const{sceneObject:s,olViewer:o}=this;return!o.actived||!o.viewer?!1:!super.flyIn(t,n)&&s.position?(nf(o.viewer,s.position,t),!0):!1}}class mg extends dl{constructor(t,n){super(t,n);T(this,"_lastHoverResult",this.dv(p.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this.ad(p.createProcessingFromAsyncFunc(async(o,r)=>{const a=await o.promise(n.pick(r.screenPosition,"innerHoverEvent"));this.lastHoverResult=Object.assign({},a,r)}))}get lastHoverResult(){return this._lastHoverResult.value}set lastHoverResult(t){this._lastHoverResult.value=t}get lastHoverResultChanged(){return this._lastHoverResult.changed}}const PA=i=>{const e=[];if(i){const t=i.length;let n=0;for(let s=0;s<t;++s){const o=(s+1)%t,r=p.geoDistance(i[s],i[o]),a=Math.abs(i[s][2]-i[o][2]),l=Math.sqrt(r*r+a*a);n+=l,e.push(n)}}return e},SA=i=>{let e;return i?(i.length<3?e=0:e=p.geoArea(i),e):0},RA=i=>{let e;return i?(i.length<3?e=void 0:e=p.geoCenterOfMass(i),e):void 0},vl=class vl extends ul{constructor(e,t){if(super(e,t),!t.viewer){console.warn("viewer is undefined!");return}}flyIn(e,t){if(!super.flyIn(e,t)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=qc(s);return ka(this.olViewer.viewer,o,e),console.log("OlESGeoVector flyIn"),!0}return!0}flyTo(e,t){if(!super.flyTo(e,t)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=qc(s);return ka(this.olViewer.viewer,o,e),console.log("OlESGeoVector flyTo"),!0}return!0}};T(vl,"type",vl.register("ESOlViewer",p.ESGeoVector.type,vl));let Gr=vl;class zo extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));if(!t.viewer)return;const o=this.ad(new ss(t,n)),r=this.ad(new Ut(t,n));r.loop=!0,this.ad(p.bind([r,"depthTest"],[this,"depthTest"])),this.d(p.track([o,"allowPicking"],[this,"allowPicking"]));const a=()=>{r.show=!!(this.show&&this.outline),o.show=!!(this.show&&this.fill),r.positions=this.positions,o.positions=o.show?this.positions||[]:[],r.color=this.outlineColor,r.width=this.outlineWidth;const[c=1,h=1,u=1,d=.5]=this.color||[1,1,1,.5];o.fillColor=[c,h,u,d]};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.showChanged,this.outlineChanged,this.outlineColorChanged,this.outlineWidthChanged,this.fillChanged,this.colorChanged,this.positionsChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{o.show?o.flyTo(c):r.show&&r.flyTo(c)}))}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}T(zo,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,outline:!0,strokeGround:!1,outlineColor:p.reactArray([1,1,1,1]),outlineWidth:2,ground:!1,fill:!0,color:p.reactArray([1,1,1,.5]),positions:p.reactPositions(void 0),viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,depthTest:!1})})(zo||(zo={})),p.extendClassProps(zo.prototype,zo.createDefaultProps);const bl=class bl extends Gr{constructor(t,n){super(t,n);T(this,"_geoPolygon");if(!n.viewer){console.warn("viewer is undefined!");return}this._geoPolygon=this.ad(new ss(this.olViewer,t.id));const o=this.geoPolygon;o&&(this.d(p.track([o,"show"],[t,"show"])),this.d(p.track([o,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([o,"positions"],[t,"points"])),this.d(p.track([o,"stroked"],[t,"stroked"])),this.d(p.track([o,"outlineColor"],[t,"strokeColor"])),this.d(p.track([o,"outlineWidth"],[t,"strokeWidth"])),this.d(p.track([o,"filled"],[t,"filled"])),this.d(p.track([o,"fillColor"],[t,"fillColor"])))}get geoPolygon(){return this._geoPolygon}};T(bl,"type",bl.register("ESOlViewer",p.ESGeoPolygon.type,bl));let fl=bl;function pl(i){var t;const e=(t=Zf(i,"pickResult"))==null?void 0:t.pointerEvent;return(e==null?void 0:e.buttons)!=0?(e==null?void 0:e.button)??0:-1}function TA(i,e,t){const n=[];for(const s of t)switch(s){case"SquareMeter_SquareKilometer":i>=1e6?n.push(`面积:${(i/1e6).toFixed(2)} km²`):n.push(`面积:${i.toFixed(2)} m²`);break;case"MU_Hectare":const o=i*(1/666.7);if(o>=15){const r=o/15;n.push(`面积:${r.toFixed(2)} 公顷`)}else n.push(`面积:${o.toFixed(2)} 亩`);break;case"PerimeterMeter_PerimeterKilometer":e>=1e3?n.push(`周长:${(e/1e3).toFixed(2)} km`):n.push(`周长:${e.toFixed(2)} m`);break}return n}class qr extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.dv(new p.Event));T(this,"_flyToEvent",this.dv(new p.Event));T(this,"_area",this.dv(p.react(0)));T(this,"_centerOfMass",this.dv(p.reactArrayWithUndefined(void 0)));T(this,"_distances",this.dv(p.reactArray([])));T(this,"_geoPolyline");T(this,"_id",this.dv(p.react(p.createGuid())));n&&(this.id=n);{const s=()=>{this._distances.value=PA(this.positions),this._area.value=SA(this.positions),this._centerOfMass.value=RA(this.positions)};s();const o=this.dv(p.createNextAnimateFrameEvent(this.positionsChanged));this.dispose(o.disposableOn(s))}{const s=this._geoPolyline=this.dv(new Ut(t,n));s.loop=!0,s.arcType="GEODESIC",this.dispose(p.bind([s,"color"],[this,"color"])),this.dispose(p.bind([s,"dashLength"],[this,"dashLength"])),this.dispose(p.bind([s,"dashPattern"],[this,"dashPattern"])),this.dispose(p.bind([s,"gapColor"],[this,"gapColor"])),this.dispose(p.bind([s,"hasArrow"],[this,"hasArrow"])),this.dispose(p.bind([s,"hasDash"],[this,"hasDash"])),this.dispose(p.bind([s,"positions"],[this,"positions"])),this.dispose(p.bind([s,"show"],[this,"show"])),this.dispose(p.bind([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"width"],[this,"width"])),this.dispose(p.bind([s,"depthTest"],[this,"depthTest"]))}{const s=this.dv(new zo(t,n));s.outline=!1;const o=()=>{s.positions=this.positions};o(),this.dispose(this.positionsChanged.disposableOn(o));const r=()=>{const a=this.fillColor;s.color=[a[0],a[1],a[2],a[3]*.5]};r(),this.dispose(this.fillColorChanged.disposableOn(r)),this.dispose(p.track([s,"show"],[this,"show"])),this.dispose(p.track([s,"ground"],[this,"ground"])),this.dispose(p.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"depthTest"],[this,"depthTest"])),this.d(this.flyToEvent.don(a=>{s.flyTo(a)}))}{const s=this.dv(new jt(t,n)),o=this.dv(p.createNextAnimateFrameEvent(this.areaChanged,this.centerOfMassChanged,this.distancesChanged,this.unitsChanged)),r=()=>{if(this.distances.length===0){s.innerHTML="";return}const a=TA(this.area,this.distances[this.distances.length-1],this.units);s.innerHTML=xh([...a].join(`
169
169
  `))};r(),this.dispose(o.disposableOn(r)),this.dispose(p.track([s,"show"],[this,"show"])),this.dispose(p.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"shadowDom"],[this,"shadowDom"])),this.dispose(p.bind([s,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(p.track([s,"position"],[this,"centerOfMass"])),this.ad(s.pickedEvent.don(a=>{pl(a)===0&&this.pickedEvent.emit(a)}))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get area(){return this._area.value}get areaChanged(){return this._area.changed}get centerOfMass(){return this._centerOfMass.value}get centerOfMassChanged(){return this._centerOfMass.changed}get distances(){return this._distances.value}get distancesChanged(){return this._distances.changed}get geoPolyline(){return this._geoPolyline}get id(){return this._id.value}set id(t){this._id.value=t}get idChanged(){return this._id.changed}}T(qr,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),width:2,color:p.reactArray([1,1,1,.5]),fillColor:p.reactArray([1,1,1,.5]),hasDash:!1,gapColor:p.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:void 0,depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!0,ground:!0,units:p.reactArray(["SquareMeter_SquareKilometer","MU_Hectare","PerimeterMeter_PerimeterKilometer"])})})(qr||(qr={})),p.extendClassProps(qr.prototype,qr.createDefaultProps);const El=class El extends fl{constructor(t,n){super(t,n);T(this,"_olAreaMeasurement");if(this._olAreaMeasurement=this.disposeVar(new qr(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}t.strokeGround=!1,t.fillGround=!1;const o=this._olAreaMeasurement;this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.track([o,"units"],[t,"units"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.bind([o,"strokeGround"],[t,"strokeGround"])),this.d(p.bind([o,"ground"],[t,"fillGround"]));{const r=()=>{if(t.stroked)o.width=t.strokeWidth;else{o.width=0;return}o.color=t.strokeColor;const c=t.strokeStyle;if(c.material==="hasDash"&&c.materialParams)try{const u=c.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0;const h=t.strokeMaterial??"normal";h==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):h==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1)};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.strokeStyleChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}{const r=()=>{if(t.filled)o.fillColor=t.fillColor;else{o.fillColor=[1,1,1,0];return}};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.fillStyleChanged,t.filledChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{(t.allowPicking??!1)&&t.pickedEvent.emit(r)}))}get olAreaMeasurement(){return this._olAreaMeasurement}};T(El,"type",El.register("ESOlViewer",p.ESAreaMeasurement.type,El));let yg=El;const Uo=class Uo extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_heading",this.disposeVar(p.react(0)));T(this,"_textFunc",this.disposeVar(p.react(void 0)));const s=this;{const a=()=>{if(this.positions&&this.positions.length>=2){let c=0;this.arcType===void 0||this.arcType==="GEODESIC"?c=p.geoHeading(this.positions[0],this.positions[1]):this.arcType==="RHUMB"?c=p.geoRhumbHeading(this.positions[0],this.positions[1]):this.arcType==="NONE"?c=p.geoHeading(this.positions[0],this.positions[1]):console.warn(`未知的arcType: ${this.arcType},导致距离无法计算!`),this._heading.value=this.angleMode==="-180~180"?p.clampN180_180(c):p.clamp0_360(c)}};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.angleModeChanged));this.dispose(l.disposableOn(a))}const o=this.disposeVar(new Ut(t,n));o.loop=!1,this.dispose(p.track([o,"allowPicking"],[s,"allowPicking"])),this.dispose(p.bind([o,"arcType"],[s,"arcType"])),this.dispose(p.bind([o,"color"],[s,"color"])),this.dispose(p.bind([o,"dashLength"],[s,"dashLength"])),this.dispose(p.bind([o,"dashPattern"],[s,"dashPattern"])),this.dispose(p.bind([o,"gapColor"],[s,"gapColor"])),this.dispose(p.bind([o,"hasArrow"],[s,"hasArrow"])),this.dispose(p.bind([o,"hasDash"],[s,"hasDash"])),this.dispose(p.bind([o,"positions"],[s,"positions"])),this.dispose(p.bind([o,"show"],[s,"show"])),this.dispose(p.bind([o,"width"],[s,"width"])),this.dispose(p.bind([o,"depthTest"],[s,"depthTest"])),this.dispose(s.flyToEvent.disposableOn(a=>{t.actived&&o.flyTo(a)}));const r=this.disposeVar(new jt(t,n));this.dispose(p.bind([r,"shadowDom"],[s,"shadowDom"])),this.dispose(p.bind([r,"cssAllInitial"],[s,"cssAllInitial"])),this.dispose(p.bind([r,"show"],[s,"show"]));{const a=()=>{s.positions&&s.positions.length>=2?r.position=s.positions[1]:r.position=void 0};a(),this.dispose(s.positionsChanged.disposableOn(a))}{const a=()=>{const{heading:c}=s,h=(s.textFunc??Uo.defaultTextFunc_度格式)(c);r.innerHTML=xh(`方向: ${h}`,24)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(s.headingChanged,s.textFuncChanged));this.dispose(l.disposableOn(a))}this.ad(r.pickedEvent.don(a=>{pl(a)===0&&this.pickedEvent.emit(a)}))}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get heading(){return this._heading.value}get headingChanged(){return this._heading.changed}get textFunc(){return this._textFunc.value}set textFunc(t){this._textFunc.value=t}get textFuncChanged(){return this._textFunc.changed}};T(Uo,"defaultTextFunc_度格式",t=>`${t.toFixed(5)}°`),T(Uo,"defaultTextFunc_度分格式",t=>`${Ph(t,!0)}`),T(Uo,"defaultTextFunc_度分秒格式",t=>`${Ph(t,!1)}`),T(Uo,"defaults",{positions:[]});let No=Uo;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),width:4,color:p.reactArray([1,1,1,1]),hasDash:!1,gapColor:p.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!0,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,angleMode:"-180~180",strokeGround:!1})})(No||(No={})),p.extendClassProps(No.prototype,No.createDefaultProps);const Cl=class Cl extends Gr{constructor(t,n){super(t,n);T(this,"_olDirectionMeasurement");if(this._olDirectionMeasurement=this.disposeVar(new No(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._olDirectionMeasurement;o.angleMode="0~360",this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.bind([o,"strokeGround"],[t,"strokeGround"]));{const r=()=>{if(t.stroked)o.width=t.strokeWidth;else{o.width=0;return}o.width=t.strokeWidth,o.color=t.strokeColor;const c=t.strokeMaterial??"normal";c==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):c==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):c==="normal"?(o.hasDash=!1,o.hasArrow=!1):(o.hasDash=!1,o.hasArrow=!0);const h=t.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.strokeStyleChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{pl(r)===0&&(t.allowPicking??!1)&&t.pickedEvent.emit(r)}))}get olDirectionMeasurement(){return this._olDirectionMeasurement}};T(Cl,"type",Cl.register("ESOlViewer",p.ESDirectionMeasurement.type,Cl));let _g=Cl;function Yw(i,e,t,n){const s=new jt(t,n);return s.innerHTML=xh(i),s.position=e,s.show=!0,s}class Vr extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_distances",this.disposeVar(p.reactArray([])));const s=async()=>{this._distances.value=p.getDistancesFromPositions(this.positions??[],this.arcType)};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.strokeGroundChanged));this.dispose(o.disposableOn(s));const r=this.disposeVar(new Ut(t,n));r.loop=!1,this.dispose(p.track([r,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([r,"arcType"],[this,"arcType"])),this.dispose(p.bind([r,"color"],[this,"color"])),this.dispose(p.bind([r,"dashLength"],[this,"dashLength"])),this.dispose(p.bind([r,"dashPattern"],[this,"dashPattern"])),this.dispose(p.bind([r,"gapColor"],[this,"gapColor"])),this.dispose(p.bind([r,"hasArrow"],[this,"hasArrow"])),this.dispose(p.bind([r,"hasDash"],[this,"hasDash"])),this.dispose(p.bind([r,"positions"],[this,"positions"])),this.dispose(p.bind([r,"show"],[this,"show"])),this.dispose(p.bind([r,"width"],[this,"width"])),this.dispose(p.bind([r,"depthTest"],[this,"depthTest"])),this.dispose(this.flyToEvent.disposableOn(a=>{t.actived&&r.flyTo(a)}));{const a=[],l=()=>{for(let h of a)h.destroy();a.length=0};this.dispose(l);const c=()=>{if(l(),!this.positions)return;if(this.positions.length>0&&this.distances.length>0){const u=Yw("起点",this.positions[0],t,n);u.dispose(p.track([u,"show"],[this,"show"])),u.dispose(p.track([u,"shadowDom"],[this,"shadowDom"])),u.dispose(p.track([u,"cssAllInitial"],[this,"cssAllInitial"])),a.push(u)}const h=this.distances.length;for(let u=0;u<h;++u){const d=this.distances[u],f=this.positions[u+1],g=Yw(`长度: ${e1(d)}`,f,t,n);g.dispose(p.track([g,"show"],[this,"show"])),g.dispose(p.track([g,"shadowDom"],[this,"shadowDom"])),g.dispose(p.track([g,"cssAllInitial"],[this,"cssAllInitial"])),this.ad(g.pickedEvent.don(_=>{pl(_)===0&&this.pickedEvent.emit(_)})),a.push(g)}};c(),this.dispose(this.distancesChanged.disposableOn(()=>p.inOrderRunning(c)))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get distances(){return this._distances.value}get distancesChanged(){return this._distances.changed}}T(Vr,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),width:1,color:p.reactArray([1,1,1,1]),hasDash:!1,gapColor:p.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!1})})(Vr||(Vr={})),p.extendClassProps(Vr.prototype,Vr.createDefaultProps);const xl=class xl extends Gr{constructor(t,n){super(t,n);T(this,"_geoPolyline");if(this._geoPolyline=this.disposeVar(new Ut(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._geoPolyline;console.log(o.positions),console.log(t.points),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.track([o,"width"],[t,"strokeWidth"])),this.dispose(p.track([o,"color"],[t,"strokeColor"])),this.dispose(p.track([o,"show"],[t,"show"]));{const r=()=>{o.show=t.show&&t.stroked};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.showChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}}get geoPolyline(){return this._geoPolyline}};T(xl,"type",xl.register("ESOlViewer",p.ESGeoLineString.type,xl));let gl=xl;const Pl=class Pl extends gl{constructor(t,n){super(t,n);T(this,"_olDistanceMeasurement");if(console.log("OlESDistanceMeasurement constructor",n.viewer),this._olDistanceMeasurement=this.disposeVar(new Vr(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}const{olDistanceMeasurement:o}=this;this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.bind([o,"strokeGround"],[t,"strokeGround"]));{const r=()=>{if(t.stroked)o.width=t.strokeWidth;else{o.width=0;return}o.width=t.strokeWidth,o.color=t.strokeColor;const c=t.strokeMaterial??"normal";c==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):c==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1);const h=t.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.strokeStyleChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{pl(r)===0&&(t.allowPicking??!1)&&t.pickedEvent.emit(r)}))}get olDistanceMeasurement(){return this._olDistanceMeasurement}};T(Pl,"type",Pl.register("ESOlViewer",p.ESDistanceMeasurement.type,Pl));let wg=Pl;const Sl=class Sl extends dl{constructor(e,t){super(e,t);const n=t.viewer;if(!n)return;const s=new vn,o=new zi.Feature({geometry:new wn(Ie([e.position[0]??0,e.position[1]??0]))});s.addFeature(o),o.setId(e.id),this.d(e.positionChanged.don(f=>{const g=Ie([f[0],f[1]]),_=o.getGeometry();_==null||_.setCoordinates(g)}));const r=new zn({source:s});n.addLayer(r),this.d(()=>n.removeLayer(r));let a=64,l=64;{const f=new Image;f.onload=()=>{console.log("Image loaded",f.width),a=f.width,l=f.height},f.src=e.url,this.d(e.urlChanged.don(()=>{const g=p.ESSceneObject.context.getStrFromEnv(p.rpToap(e.url));f.src=g}))}function c(f,g,_){const v=p.ESSceneObject.context.getStrFromEnv(p.rpToap(f)),E=a*g[0],w=l*g[1],C=_*Math.PI/180;return new $e({image:new Ps({src:v,width:E,height:w,anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",rotation:C})})}let h=c(e.url,[1,1],e.rotation[0]??0);const u=()=>{const f=n.getView().getResolution();if(!f)return;const{size_m:[g,_],minmaxScale:[v,E]}=e;let w=g/f/a,C=_/f/l;w=Math.max(v,Math.min(E,w)),C=Math.max(v,Math.min(E,C)),h=c(e.url,[w,C],e.rotation[0]??0),o.setStyle(h),o.changed()};this.d(p.createEventsCallFunc([e.size_mChanged,e.urlChanged,e.minmaxScaleChanged,e.rotationChanged],u)),u();const d=n.getView().on("change:resolution",()=>{u()});this.d(()=>gi(d))}};T(Sl,"type",Sl.register("ESOlViewer",p.ESGeoIcon.type,Sl));let vg=Sl;const Rl=class Rl extends dl{constructor(t,n){super(t,n);T(this,"_geoPoint");if(this._geoPoint=this.disposeVar(new li(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._geoPoint;this.d(p.track([o,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([o,"position"],[t,"position"])),this.d(p.track([o,"show"],[t,"show"]));{const r=()=>{o.show=t.show&&t.pointed};r();const a=this.dv(p.createNextAnimateFrameEvent(t.showChanged,t.pointedChanged));this.d(a.don(r))}}get geoPoint(){return this._geoPoint}};T(Rl,"type",Rl.register("ESOlViewer",p.ESGeoPoint.type,Rl));let bg=Rl;const Tl=class Tl extends Gr{constructor(t,n){super(t,n);T(this,"_geoPoints");const s=this.dv(new Hs(n,t.id));if(this._geoPoints=s,!n.viewer){console.warn("viewer is undefined!");return}this.d(p.track([s,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([s,"points"],[t,"points"]));{const r=()=>{s.show=t.show&&t.pointed};this.d(p.createEventsCallFunc([t.showChanged,t.pointedChanged],r,{immediate:!0}))}}get geoPoints(){return this._geoPoints}};T(Tl,"type",Tl.register("ESOlViewer",p.ESGeoPoints.type,Tl));let Eg=Tl;const Il=class Il extends fl{constructor(t,n){super(t,n);T(this,"_fireLayer");T(this,"_fireFeatures",[]);T(this,"_animationId",null);T(this,"_renderEventsKey",null);T(this,"_flickerPhase",0);if(!n.viewer){console.warn("OlESGeoPolygonWithFire: viewer is undefined!");return}const o=this.geoPolygon;if(o){const r=()=>{o.show=!1};r(),this.d(t.showChanged.don(r)),this.d(t.fireShowChanged.don(r))}this.createFireLayer(n),this.disposeVar(p.createNextAnimateFrameEvent(t.pointsChanged,t.fireShowChanged,t.fireHeightChanged,t.showChanged))}createFireLayer(t){const n=this.sceneObject;if(!n.points||n.points.length<3)return;const s=t.viewer;if(!s)return;const o=new vn;this._fireLayer=new zn({source:o,zIndex:999}),s.addLayer(this._fireLayer),this.d(()=>{this._fireLayer&&s.removeLayer(this._fireLayer)}),this.createFireFeatures(n),this.startFlickerAnimation()}createFireFeatures(t){if(!this._fireLayer||!t.points)return;const n=t.points,s=t.fireHeight??5,o=Math.max(1,Math.min(10,s)),r=this.calculateCentroid(n),a=Ie([r[0],r[1]]),l=n.map(g=>Ie([g[0],g[1]])),c=l[0],h=l[l.length-1];(c[0]!==h[0]||c[1]!==h[1])&&l.push(c);const u=1+o*.08,d=[{color:[.8,.1,0,.15+o*.01],expand:u*1.3,stroke:!1},{color:[1,.25,0,.2+o*.02],expand:u*1.15,stroke:!1},{color:[1,.4,0,.3+o*.02],expand:u*1,stroke:!1},{color:[1,.6,0,.4+o*.03],expand:u*.85,stroke:!1},{color:[1,.85,.1,.5+o*.03],expand:u*.65,stroke:!1},{color:[1,1,.6,.4+o*.04],expand:u*.4,stroke:!1}],f=this._fireLayer.getSource();if(f){this._fireFeatures=[];for(const g of d){const _=l.map(C=>{const P=C[0]-a[0],R=C[1]-a[1];return[a[0]+P*g.expand,a[1]+R*g.expand]}),v=new Kn([_]),E=new zi.Feature({geometry:v}),w=new $e({fill:new vt({color:`rgba(${Math.round(g.color[0]*255)}, ${Math.round(g.color[1]*255)}, ${Math.round(g.color[2]*255)}, ${g.color[3]})`}),stroke:g.stroke?new St({color:`rgba(${Math.round(g.color[0]*255)}, ${Math.round(g.color[1]*255)}, ${Math.round(g.color[2]*255)}, ${g.color[3]*1.5})`,width:2}):void 0});E.setStyle(w),f.addFeature(E),this._fireFeatures.push(E)}}}startFlickerAnimation(){if(!this._fireLayer)return;this.stopFlickerAnimation();const n=this.sceneObject.fireHeight??5,s=Math.max(1,Math.min(10,n)),o=.05+s*.015;this._renderEventsKey=this._fireLayer.on("postrender",r=>{if(!r.frameState)return;this._flickerPhase+=o,this._flickerPhase>Math.PI*2&&(this._flickerPhase-=Math.PI*2);const l=this._fireFeatures,c=this._flickerPhase;for(let h=0;h<l.length;h++){const d=l[h].getStyle();if(!d)continue;const f=d.getFill();if(!f)continue;const g=[.15+s*.01,.2+s*.02,.3+s*.02,.4+s*.03,.5+s*.03,.4+s*.04],_=h*.7,v=Math.sin(c+_)*.5+.5,E=Math.sin(c*2.3+_*1.5)*.3+.7,w=g[h]*(.6+v*.4)*E,P=f.getColor().match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(P){const R=parseInt(P[1]),O=parseInt(P[2]),I=parseInt(P[3]);f.setColor(`rgba(${R}, ${O}, ${I}, ${w})`)}}})}stopFlickerAnimation(){this._renderEventsKey&&(gi(this._renderEventsKey),this._renderEventsKey=null),this._animationId!==null&&(cancelAnimationFrame(this._animationId),this._animationId=null)}destroyFireLayer(){if(this.stopFlickerAnimation(),this._fireLayer){const t=this.olViewer.viewer;t&&t.removeLayer(this._fireLayer),this._fireLayer.dispose(),this._fireLayer=void 0}this._fireFeatures=[]}calculateCentroid(t){let n=0,s=0,o=0;const r=t.length;for(let a=0,l=r-1;a<r;l=a++){const[c,h]=t[l],[u,d]=t[a],f=c*d-u*h;n+=f,s+=(c+u)*f,o+=(h+d)*f}return n*=.5,Math.abs(n)<1e-9?t[0]:(s/=6*n,o/=6*n,[s,o])}};T(Il,"type",Il.register("ESOlViewer",p.ESGeoPolygonWithFire.type,Il));let Cg=Il;class Zw extends p.Destroyable{constructor(t,n){super();T(this,"_olGeoCanvasImagePoi");T(this,"flyTo",(t,n)=>{if(this.olGeoCanvasImagePoi.position){Yi(this.olViewer,this.olGeoCanvasImagePoi.position,1e3,Cy,t);return}this.olGeoCanvasImagePoi.flyTo(t&&t*1e3)});this.sceneObject=t,this.olViewer=n,this._olGeoCanvasImagePoi=this.dv(new Si(n));const s=this._olGeoCanvasImagePoi;s.pickOnClick=!0,this.d(s.pickedEvent.don(o=>{(t.allowPicking??!1)&&t.pickedEvent.emit(o)}));{const o=h=>{let u=h;return h.includes("inner://")&&(u="${earthsdk3-assets-script-dir}/assets/img/points/"+h.split("inner://")[1]),p.ESSceneObject.context.getStrFromEnv(p.rpToap(u))},r=()=>{const h=o(typeof t.url=="string"?t.url:t.url.url);if(s.imageUri=h,t.sizeByContent){const d=new Image;d.src=h,d.onload=()=>{s.size=[d.width,d.height]}}else{const d=t.size;s.size=[...d]}},a=this.disposeVar(p.createNextAnimateFrameEvent(t.urlChanged,t.sizeByContentChanged,t.sizeChanged));this.d(a.don(()=>r())),r(),this.d(p.track([s,"zOrder"],[t,"zOrder"])),this.d(p.track([s,"show"],[t,"show"])),this.d(p.bind([s,"position"],[t,"position"])),this.ad(p.bind([s,"isHoverZoom"],[t,"isHoverZoom"]));{const h=()=>{s.scale=[t.scale[1],t.scale[2]]};h(),this.d(t.scaleChanged.don(h))}const l=()=>{const h=t.anchor,u=t.offset;h?s.originRatioAndOffset=[...h,-u[0],-u[1]]:s.originRatioAndOffset=[0,0,0,0]},c=this.ad(p.createNextAnimateFrameEvent(t.anchorChanged,t.offsetChanged));this.d(c.don(()=>l())),l(),this.d(s.clickEvent.don(h=>{const{offsetX:u,offsetY:d}=h,g={type:h.button===0?"leftClick":h.button===2?"rightClick":void 0,add:{mousePos:[u,d]}};t.widgetEvent.emit(g)})),this.d(s.hoveredChanged.don(h=>{if(h===void 0)return;const u={type:h?"mouseEnter":"mouseLeave"};t.widgetEvent.emit(u)}))}}get olGeoCanvasImagePoi(){return this._olGeoCanvasImagePoi}}const Ol=class Ol extends mg{constructor(t,n){super(t,n);T(this,"_resetting");if(!n.viewer){console.warn("viewer is undefined!");return}const o=this.dv(p.createNextAnimateFrameEvent(this.sceneObject.urlChanged,this.sceneObject.screenRenderChanged,this.sceneObject.sizeByContentChanged,this.sceneObject.sizeChanged));this._resetting=this.dv(new p.ObjResettingWithEvent(o,()=>new Zw(this.sceneObject,this.olViewer)))}get resetting(){return this._resetting}flyTo(t,n){const{sceneObject:s,olViewer:o,resetting:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,n):(r&&r.obj&&r.obj.flyTo(t,n),s.flyOverEvent.emit(n,"over",o),!0):!1}};T(Ol,"type",Ol.register("ESOlViewer",p.ESImageLabel.type,Ol));let xg=Ol;function Kw(i){switch(i){case"wms":return"WebMapServiceImageryProvider";case"tms":return"TileMapServiceImageryProvider";case"wmts":return"WebMapTileServiceImageryProvider";case"xyz":return"UrlTemplateImageryProvider";case"ion":return"IonImageryProvider";case"auto":default:return"auto"}}const Al=class Al extends ul{constructor(t,n){super(t,n);T(this,"_olImagery");if(!n.viewer){console.warn("viewer is undefined!");return}const o=this.dv(new gg(n,t.id));this._olImagery=o;const r=this.ad(p.reactJson(""));{const h=()=>{if(typeof t.url=="string")r.value=p.ESSceneObject.context.getStrFromEnv(t.url);else{const u=t.url;u.url=p.ESSceneObject.context.getStrFromEnv(u.url),r.value=u}};h(),this.ad(t.urlChanged.don(h))}const a=()=>{var v,E;if(!r.value)return;const h=(((v=t.options)==null?void 0:v.type)??"auto").toLowerCase(),u=t.options??{};let d={type:"UrlTemplateImageryProvider",url:r.value,rectangle:t.rectangle,maximumLevel:t.maximumLevel,minimumLevel:t.minimumLevel,...u},f=r.value,g=typeof f=="string"?f:f.url;const _=g.toLowerCase();if(Kw(h)==="auto")if(_.startsWith("ion://")){const C=+_.substring(6);d={...u,assetId:C,type:"IonImageryProvider"}}else if(_.includes("{x}")||_.includes("{y}")||_.includes("{z}"))d.type="UrlTemplateImageryProvider";else if(_.includes("wmts"))d.type="WebMapTileServiceImageryProvider";else if(_.includes("wms"))d.type="WebMapServiceImageryProvider";else{if(g.includes("/tilemapresource.xml")){const w=g.split("/tilemapresource.xml").join("");typeof f=="string"?f=w:f.url=w,d.url=f}d.type="TileMapServiceImageryProvider"}else{if(h==="tms"&&g.includes("/tilemapresource.xml")){const C=g.split("/tilemapresource.xml").join("");typeof f=="string"?f=C:f.url=C,d.url=f}else if(h==="ion"&&_.startsWith("ion://")){const P=+g.substring(6);d={...u,assetId:P,type:"IonImageryProvider"}}const w=Kw(h);w!=="auto"&&(d.type=w)}if(d.type==="WebMapTileServiceImageryProvider"){let w=typeof f=="string"?f:f.url;const C=w.indexOf("?");if(C>=0){const M=new URLSearchParams(w.substring(C+1)),z=M.get("format")||M.get("Format")||d.format;d.format=z||"image/png",w=w.substring(0,C)}else d.format=d.format??"image/png";const P=(E=/\/wmts\/rest\/([^/]+)\//i.exec(w))==null?void 0:E[1];P?d.layer=d.layer??d.layers??P:d.layer=d.layer??d.layers??"";const R=d.tileMatrixSetID||d.TileMatrixSet||"EPSG:4326";let O=d.tileMatrixLabels||d.TileMatrixLabels;(!O||!Array.isArray(O)||O.length===0)&&(O=Array.from({length:22},(M,z)=>`${R}:${z}`)),d.tileMatrixSetID=R,d.tileMatrixLabels=O,d.style=d.style??"default";const I=w.toLowerCase().indexOf("/wmts/");if(I>=0){const M=w.substring(0,I);d.url=`${M}/wmts`;const z=typeof f=="string"?f:f.url,k=/\/wmts\/rest\/([^/]+)\//i.exec(z);k&&k[1]&&(d.layer=k[1]),d._rawUrl=z}else{d.url=w;const M=typeof f=="string"?f:f.url,z=/\/wmts\/rest\/([^/]+)\//i.exec(M);z&&z[1]&&(d.layer=z[1]),d._rawUrl=M}d.requestEncoding="KVP",d.requestencoding="KVP",d.params=void 0}else if(d.type==="WebMapServiceImageryProvider"){const w=d.layer??d.layers??"",C=d.style??"",P=d.format??"image/png";d.params={...d.params??{},LAYERS:w,STYLES:C,FORMAT:P,TILED:!0,TRANSPARENT:!0}}else d.type==="TileMapServiceImageryProvider"?d.yReverse=d.yReverse??!0:d.type==="IonImageryProvider"&&console.warn("[OlESImageryLayer] 在 OL 侧使用 ion:// 可能无效,请在外部将 ion 转换为可用的 xyz/wmts/wms/tms 源 URL。");o.imageryProvider=d};a();const l=[r.changed,t.maximumLevelChanged,t.minimumLevelChanged,t.optionsChanged,t.rectangleChanged],c=this.dv(p.createNextAnimateFrameEvent(...l));this.d(c.don(a)),this.d(p.track([o,"show"],[t,"show"])),this.d(p.track([o,"splitDirection"],[t,"splitDirection"])),this.d(p.track([o,"brightness"],[t,"czmBrightness"])),this.d(p.track([o,"contrast"],[t,"czmContrast"])),this.d(p.track([o,"hue"],[t,"czmHue"])),this.d(p.track([o,"saturation"],[t,"czmSaturation"])),this.d(p.track([o,"gamma"],[t,"czmGamma"])),this.d(p.track([o,"rectangle"],[t,"rectangle"])),this.d(p.track([o,"zIndex"],[t,"zIndex"])),this.d(p.bind([o,"alpha"],[t,"opacity"])),this.d(p.bind([o,"alpha"],[t,"czmAlpha"]))}get olImagery(){return this._olImagery}flyTo(t,n){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,n):(r.flyTo(t&&t),s.flyOverEvent.emit(n,"over",o),!0):!1}flyIn(t,n){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyInParam?super.flyIn(t,n):(r.flyTo(t&&t),s.flyOverEvent.emit(n,"over",o),!0):!1}};T(Al,"type",Al.register("ESOlViewer",p.ESImageryLayer.type,Al));let Pg=Al;function Qw(i,e=!1){const t=Ph(i[0],e),n=Ph(i[1],e),s=e1(i[2]);return[t,n,s]}const Gn=class Gn extends dl{constructor(t,n){super(t,n);T(this,"_geoCustomDivPoi");T(this,"_textFunc",this.disposeVar(p.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this._geoCustomDivPoi=this.disposeVar(new jt(n,t.id));const o=this.geoCustomDivPoi;this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.bind([o,"position"],[t,"position"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"]));{this.dispose(o.pickedEvent.disposableOn(r=>{(t.allowPicking??p.ESLocationMeasurement.defaults.allowPicking)&&t.pickedEvent.emit(r)})),this.dispose(o.innerHtmlMounted.disposableOn(r=>{const a=r.firstElementChild;a&&(a.style.pointerEvents="auto",a.style.cursor="default",a.onclick=l=>o.pickFromDiv(a,{type:"viewerPicking",pointerEvent:l}))}));{const r=()=>{if(!t.position)return;const l=(this.textFunc??Gn.defaultTextFunc_度格式)(t.position);o.innerHTML=xh(l)};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.positionChanged,this.textFuncChanged));this.dispose(a.disposableOn(r))}{const r=()=>{n.lonLatFormat??(n.lonLatFormat="DECIMAL_DEGREE"),this.textFunc=n.lonLatFormat=="DECIMAL_DEGREE"?Gn.defaultTextFunc_度格式:n.lonLatFormat=="DEGREES_DECIMAL_MINUTES"?Gn.defaultTextFunc_度分格式:Gn.defaultTextFunc_度分秒格式};r(),this.d(n.lonLatFormatChanged.don(()=>{r()}))}}}get geoCustomDivPoi(){return this._geoCustomDivPoi}get textFunc(){return this._textFunc.value}set textFunc(t){this._textFunc.value=t}get textFuncChanged(){return this._textFunc.changed}flyTo(t,n){const{sceneObject:s,olViewer:o,geoCustomDivPoi:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,n):(r.flyTo(t),s.flyOverEvent.emit(n,"over",o),!0):!1}flyIn(t,n){const{sceneObject:s,olViewer:o,geoCustomDivPoi:r}=this;return o.actived?s.flyInParam?super.flyIn(t,n):(r.flyTo(t),s.flyOverEvent.emit(n,"over",o),!0):!1}};T(Gn,"type",Gn.register("ESOlViewer",p.ESLocationMeasurement.type,Gn)),T(Gn,"defaultTextFunc_度格式",t=>{if(!t)return"";const[n=0,s=0,o=0]=t;return`经度: ${n.toFixed(5)}°
170
170
  纬度: ${s.toFixed(5)}°`}),T(Gn,"defaultTextFunc_度分格式",t=>{if(!t)return"";const[n,s]=Qw(t,!0);return`经度: ${n}
171
171
  纬度: ${s}`}),T(Gn,"defaultTextFunc_度分秒格式",t=>{if(!t)return"";const[n,s]=Qw(t);return`经度: ${n}