(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1189],{28116:ze=>{"use strict";ze.exports=function(ee){var R=[];return R.toString=function(){return this.map(function(z){var X="",Q=typeof z[5]<"u";return z[4]&&(X+="@supports (".concat(z[4],") {")),z[2]&&(X+="@media ".concat(z[2]," {")),Q&&(X+="@layer".concat(z[5].length>0?" ".concat(z[5]):""," {")),X+=ee(z),Q&&(X+="}"),z[2]&&(X+="}"),z[4]&&(X+="}"),X}).join("")},R.i=function(z,X,Q,B,be){typeof z=="string"&&(z=[[null,z,void 0]]);var Ee={};if(Q)for(var ne=0;ne<this.length;ne++){var de=this[ne][0];de!=null&&(Ee[de]=!0)}for(var Ie=0;Ie<z.length;Ie++){var se=[].concat(z[Ie]);Q&&Ee[se[0]]||(typeof be<"u"&&(typeof se[5]>"u"||(se[1]="@layer".concat(se[5].length>0?" ".concat(se[5]):""," {").concat(se[1],"}")),se[5]=be),X&&(se[2]&&(se[1]="@media ".concat(se[2]," {").concat(se[1],"}")),se[2]=X),B&&(se[4]?(se[1]="@supports (".concat(se[4],") {").concat(se[1],"}"),se[4]=B):se[4]="".concat(B)),R.push(se))}},R}},96532:ze=>{"use strict";ze.exports=function(ee,R){return R||(R={}),ee&&(ee=String(ee.__esModule?ee.default:ee),/^['"].*['"]$/.test(ee)&&(ee=ee.slice(1,-1)),R.hash&&(ee+=R.hash),/["'() \t\n]|(%20)/.test(ee)||R.needQuotes?'"'.concat(ee.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):ee)}},96293:ze=>{"use strict";ze.exports=function(ee){var R=ee[1],p=ee[3];if(!p)return R;if(typeof btoa=="function"){var z=btoa(unescape(encodeURIComponent(JSON.stringify(p)))),X="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(z),Q="/*# ".concat(X," */"),B=p.sources.map(function(be){return"/*# sourceURL=".concat(p.sourceRoot||"").concat(be," */")});return[R].concat(B).concat([Q]).join(`
`)}return[R].join(`
`)}},10:(ze,ee,R)=>{"use strict";R.d(ee,{q:()=>B});var p=R(52423),z=R(68404),X=R(72648);const Q=10,B=({colorPalette:de,min:Ie,max:se,display:A,hoverValue:ge,useStopsPercentage:he})=>{const[T,w]=(0,z.useState)([]),[N,G]=(0,z.useState)({isShown:!1,value:0}),[v,U]=(0,z.useState)(null),K=(0,X.l4)(),re=ne(K,T);(0,z.useEffect)(()=>{w(be({colorArray:de,stops:Q,useStopsPercentage:he}))},[de,he]);const ve=De=>{const Ce=De.nativeEvent.offsetX,Ge=De.currentTarget.offsetWidth,et=Math.floor(Ce*100/Ge+1),st=Math.floor((se-Ie)*et/100+Ie);G({isShown:!0,value:st}),U(et)},pe=()=>{G({isShown:!1,value:0})};return(0,z.useEffect)(()=>{U(ge==null?null:Ee((ge-Ie)/(se-Ie)))},[ge,Ie,se]),z.createElement("div",{className:re.scaleWrapper,onMouseMove:ve,onMouseLeave:pe},z.createElement("div",{className:re.scaleGradient},A&&(N.isShown||ge!==void 0)&&z.createElement("div",{className:re.followerContainer},z.createElement("div",{className:re.follower,style:{left:`${v}%`}}))),A&&z.createElement("div",{className:re.followerContainer},z.createElement("div",{className:re.legendValues},z.createElement("span",null,A(Ie)),z.createElement("span",null,A(se))),v!=null&&(N.isShown||ge!==void 0)&&z.createElement("span",{className:re.hoverValue,style:{left:`${v}%`}},A(ge??N.value))))},be=({colorArray:de,stops:Ie,useStopsPercentage:se=!0})=>{const A=de.length;if(se&&A<=20){const w=1/A*100;let N=0;const G=[];for(const v of de)N>0?G.push(`${v} ${N}%`):G.push(v),N+=w,G.push(`${v} ${N}%`);return G}const ge=de[A-1],he=Math.ceil(A/Ie),T=new Set;for(let w=0;w<A;w+=he)T.add(de[w]);return T.add(ge),[...T]};function Ee(de){return de>1?100:de<0?0:de*100}const ne=(de,Ie)=>({scaleWrapper:p.css`
    width: 100%;
    font-size: 11px;
    opacity: 1;
  `,scaleGradient:p.css`
    background: linear-gradient(90deg, ${Ie.join()});
    height: 10px;
    pointer-events: none;
  `,legendValues:p.css`
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  `,hoverValue:p.css`
    position: absolute;
    margin-top: -14px;
    padding: 3px 15px;
    background: ${de.colors.background.primary};
    transform: translateX(-50%);
  `,followerContainer:p.css`
    position: relative;
    pointer-events: none;
    white-space: nowrap;
  `,follower:p.css`
    position: absolute;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    transform: translateX(-50%) translateY(-50%);
    border: 2px solid ${de.colors.text.primary};
    margin-top: 5px;
  `})},72243:(ze,ee,R)=>{"use strict";R.d(ee,{f:()=>X});var p=R(68404),z=R(15670);const X=({onChange:Q,options:B,label:be})=>p.createElement(z.b,{icon:"plus",label:be,variant:"secondary",options:B,onChange:Q,isFullWidth:!0})},92465:(ze,ee,R)=>{"use strict";R.d(ee,{M:()=>be});var p=R(68404),z=R(89890),X=R(85854),Q=R(53217);const B=(Ee,ne,de)=>{if(!de)return;let Ie=Ee.find(se=>!ne.some(A=>se===A));if(Ie)return Ie},be=({value:Ee,context:ne,onChange:de,item:Ie})=>{const se=(0,p.useMemo)(()=>ne.data.map(w=>({value:w.refId,label:`Query: ${w.refId} (size: ${w.length})`,description:w.fields.map(N=>(0,z.C)(N)).join(", ")})),[ne.data]),[A,ge]=(0,p.useState)({refIds:[],value:void 0}),he=(0,p.useMemo)(()=>se.find(w=>w.value===Ee?.options)??B(se,A.refIds,A.value),[Ee,se,A]),T=(0,p.useCallback)(w=>{de(w?.value?{id:X.E4.byRefId,options:w.value}:void 0)},[de]);return(se!==A.refIds||he?.value!==A.value)&&ge({refIds:se,value:he?.value}),p.createElement(Q.Ph,{options:se,onChange:T,isClearable:!0,placeholder:"Change filter",value:he})}},86418:(ze,ee,R)=>{"use strict";R.r(ee),R.d(ee,{plugin:()=>pg});var p=R(68404),z=R(48513),X=R(35645),Q=R(91511),B=R(52423),be=R(78966),Ee=R(31992);const ne={ANIMATING:0,INTERACTING:1},de={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},Ie=42,se=256;var A=R(61331),ge=R(63219),he=R(88098),T=R(71842),w=R(64042);function N(s,e,t){return function(i,n,r,o,a){if(!i)return;if(!n&&!e)return i;const l=e?0:r[0]*n,h=e?0:r[1]*n,c=a?a[0]:0,u=a?a[1]:0;let d=s[0]+l/2+c,f=s[2]-l/2+c,g=s[1]+h/2+u,m=s[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=(0,w.uZ)(i[0],d,f),x=(0,w.uZ)(i[1],g,m);if(o&&t&&n){const E=30*n;_+=-E*Math.log(1+Math.max(0,d-i[0])/E)+E*Math.log(1+Math.max(0,i[0]-f)/E),x+=-E*Math.log(1+Math.max(0,g-i[1])/E)+E*Math.log(1+Math.max(0,i[1]-m)/E)}return[_,x]}}function G(s){return s}var v=R(68208),U=R(49370);function K(s,e,t,i){const n=(0,v.dz)(e)/t[0],r=(0,v.Cr)(e)/t[1];return i?Math.min(s,Math.max(n,r)):Math.min(s,Math.min(n,r))}function re(s,e,t){let i=Math.min(s,e);const n=50;return i*=Math.log(1+n*Math.max(0,s/e-1))/n+1,t&&(i=Math.max(i,t),i/=Math.log(1+n*Math.max(0,t/s-1))/n+1),(0,w.uZ)(i,t/2,e*2)}function ve(s,e,t,i){return e=e!==void 0?e:!0,function(n,r,o,a){if(n!==void 0){const l=s[0],h=s[s.length-1],c=t?K(l,t,o,i):l;if(a)return e?re(n,c,h):(0,w.uZ)(n,h,c);const u=Math.min(c,n),d=Math.floor((0,U.h7)(s,u,r));return s[d]>c&&d<s.length-1?s[d+1]:s[d]}else return}}function pe(s,e,t,i,n,r){return i=i!==void 0?i:!0,t=t!==void 0?t:0,function(o,a,l,h){if(o!==void 0){const c=n?K(e,n,l,r):e;if(h)return i?re(o,c,t):(0,w.uZ)(o,t,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(s)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),m=Math.floor(Math.log(e/g)/Math.log(s)+f),_=Math.max(d,m),x=e/Math.pow(s,_);return(0,w.uZ)(x,t,c)}else return}}function De(s,e,t,i,n){return t=t!==void 0?t:!0,function(r,o,a,l){if(r!==void 0){const h=i?K(s,i,a,n):s;return!t||!l?(0,w.uZ)(r,e,h):re(r,h,e)}else return}}function Ce(s){if(s!==void 0)return 0}function Ge(s){if(s!==void 0)return s}function et(s){const e=2*Math.PI/s;return function(t,i){if(i)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t}}function st(s){return s=s||(0,w.Yr)(5),function(e,t){if(t)return e;if(e!==void 0)return Math.abs(e)<=s?0:e}}function ut(s){return Math.pow(s,3)}function y(s){return 1-ut(1-s)}function I(s){return 3*s*s-2*s*s*s}function S(s){return s}function P(s){return s<.5?I(2*s):1-I(2*(s-.5))}var L=R(94207);const D=0;class k extends Ee.Z{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=(0,A.UQ)(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&(0,A.h_)(),e.center&&(e.center=(0,A.Vs)(e.center,this.projection_)),e.extent&&(e.extent=(0,A.dY)(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){const t=Object.assign({},e);for(const a in de)delete t[a];this.setProperties(t,!0);const i=le(e);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=i.minZoom;const n=ue(e),r=i.constraint,o=Ue(e);this.constraints_={center:n,resolution:r,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;const i=this.getCenter();if(i){const n=e||[0,0,0,0];t=t||[0,0,0,0];const r=this.getResolution(),o=r/2*(n[3]-t[3]+t[1]-n[1]),a=r/2*(n[0]-t[0]+t[2]-n[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(e){const t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const t=new Array(arguments.length);for(let i=0;i<t.length;++i){let n=arguments[i];n.center&&(n=Object.assign({},n),n.center=(0,A.Vs)(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=(0,A.Vs)(n.anchor,this.getProjection())),t[i]=n}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,i;t>1&&typeof arguments[t-1]=="function"&&(i=arguments[t-1],--t);let n=0;for(;n<t&&!this.isDef();++n){const c=arguments[n];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(n===t){i&&V(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;n<t;++n){const c=arguments[n],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||I,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=(0,w.$W)(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}Fe(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(ne.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ne.ANIMATING]>0}getInteracting(){return this.hints_[ne.INTERACTING]>0}cancelAnimations(){this.setHint(ne.ANIMATING,-this.hints_[ne.ANIMATING]);let e;for(let t=0,i=this.animations_.length;t<i;++t){const n=this.animations_[t];if(n[0].callback&&V(n[0].callback,!1),!e)for(let r=0,o=n.length;r<o;++r){const a=n[r];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const e=Date.now();let t=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let o=0,a=n.length;o<a;++o){const l=n[o];if(l.complete)continue;const h=e-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),x=f+u*(m-f);this.targetCenter_=[_,x]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?(0,w.$W)(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(ne.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=n[0].callback;o&&V(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let i;const n=this.getCenterInternal();return n!==void 0&&(i=[n[0]-t[0],n[1]-t[1]],(0,he.U1)(i,e-this.getRotation()),(0,he.IH)(i,t)),i}calculateCenterZoom(e,t){let i;const n=this.getCenterInternal(),r=this.getResolution();if(n!==void 0&&r!==void 0){const o=t[0]-e*(t[0]-n[0])/r,a=t[1]-e*(t[1]-n[1])/r;i=[o,a]}return i}getViewportSize_(e){const t=this.viewportSize_;if(e){const i=t[0],n=t[1];return[Math.abs(i*Math.cos(e))+Math.abs(n*Math.sin(e)),Math.abs(i*Math.sin(e))+Math.abs(n*Math.cos(e))]}else return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e&&(0,A.lO)(e,this.getProjection())}getCenterInternal(){return this.get(de.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){const t=this.calculateExtentInternal(e);return(0,A.Fj)(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();(0,T.h)(t,1);const i=this.getResolution();(0,T.h)(i!==void 0,2);const n=this.getRotation();return(0,T.h)(n!==void 0,3),(0,v.p8)(t,i,n,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(de.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal((0,A.dY)(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const i=(0,v.dz)(e)/t[0],n=(0,v.Cr)(e)/t[1];return Math.max(i,n)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(t/i)/Math.log(e);return function(r){return t/Math.pow(e,r*n)}}getRotation(){return this.get(de.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/t;return function(o){return Math.log(i/o)/t/r}}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const i=this.padding_;return i&&(t=[t[0]-i[1]-i[3],t[1]-i[0]-i[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();n=Re(n,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],t,i)}return{center:n.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getZoom(){let e;const t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,i,n;if(this.resolutions_){const r=(0,U.h7)(this.resolutions_,e,1);t=r,i=this.resolutions_[r],r==this.resolutions_.length-1?n=2:n=i/this.resolutions_[r+1]}else i=this.maxResolution_,n=this.zoomFactor_;return t+Math.log(i/e)/Math.log(n)}getResolutionForZoom(e){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const t=(0,w.uZ)(Math.floor(e),0,this.resolutions_.length-2),i=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(i,(0,w.uZ)(e-t,0,1))}else return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let i;if((0,T.h)(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function",24),Array.isArray(e)){(0,T.h)(!(0,v.xb)(e),25);const n=(0,A.dY)(e,this.getProjection());i=(0,L.oJ)(n)}else if(e.getType()==="Circle"){const n=(0,A.dY)(e.getExtent(),this.getProjection());i=(0,L.oJ)(n),i.rotate(this.getRotation(),(0,v.qg)(n))}else{const n=(0,A.Cs)();n?i=e.clone().transform(n,this.getProjection()):i=e}this.fitInternal(i,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),i=Math.cos(t),n=Math.sin(-t),r=e.getFlatCoordinates(),o=e.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;u<d;u+=o){const f=r[u]*i-r[u+1]*n,g=r[u]*n+r[u+1]*i;a=Math.min(a,f),l=Math.min(l,g),h=Math.max(h,f),c=Math.max(c,g)}return[a,l,h,c]}fitInternal(e,t){t=t||{};let i=t.size;i||(i=this.getViewportSizeMinusPadding_());const n=t.padding!==void 0?t.padding:[0,0,0,0],r=t.nearest!==void 0?t.nearest:!1;let o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;const a=this.rotatedExtentForGeometry(e);let l=this.getResolutionForExtentInternal(a,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),d=(0,v.qg)(a);d[0]+=(n[1]-n[3])/2*l,d[1]+=(n[0]-n[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,m=this.getConstrainedCenter([f,g],l),_=t.callback?t.callback:ge.Zn;t.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:t.duration,easing:t.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),V(_,!0))}centerOn(e,t,i){this.centerOnInternal((0,A.Vs)(e,this.getProjection()),t,i)}centerOnInternal(e,t,i){this.setCenterInternal(Re(e,t,i,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,i,n){let r;const o=this.padding_;if(o&&e){const a=this.getViewportSizeMinusPadding_(-i),l=Re(e,n,[a[0]/2+o[3],a[1]/2+o[0]],t,i);r=[e[0]-l[0],e[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){const t=(0,A.lO)(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){const t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&(0,A.Vs)(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*e,0,n,i);t&&(this.targetCenter_=this.calculateCenterZoom(r,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=(0,A.Vs)(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+e,i);t&&(this.targetCenter_=this.calculateCenterRotate(n,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&(0,A.Vs)(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){const i=this.getAnimating()||this.getInteracting()||t,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,n,r));this.get(de.ROTATION)!==n&&this.set(de.ROTATION,n),this.get(de.RESOLUTION)!==o&&(this.set(de.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(de.CENTER)||!(0,he.fS)(this.get(de.CENTER),a))&&this.set(de.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,i){e=e!==void 0?e:200;const n=t||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,n,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}i=i||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!(0,he.fS)(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:e,easing:y,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ne.INTERACTING,1)}endInteraction(e,t,i){i=i&&(0,A.Vs)(i,this.getProjection()),this.endInteractionInternal(e,t,i)}endInteractionInternal(e,t,i){this.setHint(ne.INTERACTING,-1),this.resolveConstraints(e,t,i)}getConstrainedCenter(e,t){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),i)}getConstrainedZoom(e,t){const i=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(i,t))}getConstrainedResolution(e,t){t=t||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,i)}}function V(s,e){setTimeout(function(){s(e)},0)}function ue(s){if(s.extent!==void 0){const t=s.smoothExtentConstraint!==void 0?s.smoothExtentConstraint:!0;return N(s.extent,s.constrainOnlyCenter,t)}const e=(0,A.UQ)(s.projection,"EPSG:3857");if(s.multiWorld!==!0&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,N(t,!1,!1)}return G}function le(s){let e,t,i,o=s.minZoom!==void 0?s.minZoom:D,a=s.maxZoom!==void 0?s.maxZoom:28;const l=s.zoomFactor!==void 0?s.zoomFactor:2,h=s.multiWorld!==void 0?s.multiWorld:!1,c=s.smoothResolutionConstraint!==void 0?s.smoothResolutionConstraint:!0,u=s.showFullExtent!==void 0?s.showFullExtent:!1,d=(0,A.UQ)(s.projection,"EPSG:3857"),f=d.getExtent();let g=s.constrainOnlyCenter,m=s.extent;if(!h&&!m&&d.isGlobal()&&(g=!1,m=f),s.resolutions!==void 0){const _=s.resolutions;t=_[o],i=_[a]!==void 0?_[a]:_[_.length-1],s.constrainResolution?e=ve(_,c,!g&&m,u):e=De(t,i,c,!g&&m,u)}else{const x=(f?Math.max((0,v.dz)(f),(0,v.Cr)(f)):360*A.Wm.degrees/d.getMetersPerUnit())/se/Math.pow(2,D),E=x/Math.pow(2,28-D);t=s.maxResolution,t!==void 0?o=0:t=x/Math.pow(l,o),i=s.minResolution,i===void 0&&(s.maxZoom!==void 0?s.maxResolution!==void 0?i=t/Math.pow(l,a):i=x/Math.pow(l,a):i=E),a=o+Math.floor(Math.log(t/i)/Math.log(l)),i=t/Math.pow(l,a-o),s.constrainResolution?e=pe(l,t,i,c,!g&&m,u):e=De(t,i,c,!g&&m,u)}return{constraint:e,maxResolution:t,minResolution:i,minZoom:o,zoomFactor:l}}function Ue(s){if(s.enableRotation!==void 0?s.enableRotation:!0){const t=s.constrainRotation;return t===void 0||t===!0?st():t===!1?Ge:typeof t=="number"?et(t):Ge}else return Ce}function Fe(s){return!(s.sourceCenter&&s.targetCenter&&!(0,he.fS)(s.sourceCenter,s.targetCenter)||s.sourceResolution!==s.targetResolution||s.sourceRotation!==s.targetRotation)}function Re(s,e,t,i,n){const r=Math.cos(-n);let o=Math.sin(-n),a=s[0]*r-s[1]*o,l=s[1]*r+s[0]*o;a+=(e[0]/2-t[0])*i,l+=(t[1]-e[1]/2)*i,o=-o;const h=a*r-l*o,c=l*r+a*o;return[h,c]}const Ve=k,Te={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var j=R(84078),He=R(58052);function $e(s,e,t,i){let n;return t&&t.length?n=t.shift():He.Id?n=new OffscreenCanvas(s||300,e||300):n=document.createElement("canvas"),s&&(n.width=s),e&&(n.height=e),n.getContext("2d",i)}function nn(s){const e=s.canvas;e.width=1,e.height=1,s.clearRect(0,0,1,1)}function Le(s){let e=s.offsetWidth;const t=getComputedStyle(s);return e+=parseInt(t.marginLeft,10)+parseInt(t.marginRight,10),e}function Me(s){let e=s.offsetHeight;const t=getComputedStyle(s);return e+=parseInt(t.marginTop,10)+parseInt(t.marginBottom,10),e}function eo(s,e){const t=e.parentNode;t&&t.replaceChild(s,e)}function Ds(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}function wl(s){for(;s.lastChild;)s.removeChild(s.lastChild)}function Tl(s,e){const t=s.childNodes;for(let i=0;;++i){const n=t[i],r=e[i];if(!n&&!r)break;if(n!==r){if(!n){s.appendChild(r);continue}if(!r){s.removeChild(n),--i;continue}s.insertBefore(r,n)}}}class Sl extends Ee.Z{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){Ds(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&Ds(this.element);for(let t=0,i=this.listenerKeys.length;t<i;++t)(0,j.bN)(this.listenerKeys[t]);this.listenerKeys.length=0,this.map_=e,e&&((this.target_?this.target_:e.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==ge.Zn&&this.listenerKeys.push((0,j.oL)(e,Te.POSTRENDER,this.render,this)),e.render())}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}const zn=Sl;var me=R(75964);const Gn="ol-hidden",Eg="ol-selectable",sn="ol-unselectable",Cg="ol-unsupported",Fs="ol-control",to="ol-collapsed",Rl=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),io=["style","variant","weight","size","lineHeight","family"],no=function(s){const e=s.match(Rl);if(!e)return null;const t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let i=0,n=io.length;i<n;++i){const r=e[i+1];r!==void 0&&(t[io[i]]=r)}return t.families=t.family.split(/,\s?/),t},Pe={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var Y=R(70050);class Il extends Ee.Z{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Pe.OPACITY]=e.opacity!==void 0?e.opacity:1,(0,T.h)(typeof t[Pe.OPACITY]=="number",64),t[Pe.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Pe.Z_INDEX]=e.zIndex,t[Pe.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Pe.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Pe.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Pe.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:e===void 0?!0:e},i=this.getZIndex();return t.opacity=(0,w.uZ)(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=i===void 0&&!t.managed?1/0:i,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return(0,Y.O3)()}getLayerStatesArray(e){return(0,Y.O3)()}getExtent(){return this.get(Pe.EXTENT)}getMaxResolution(){return this.get(Pe.MAX_RESOLUTION)}getMinResolution(){return this.get(Pe.MIN_RESOLUTION)}getMinZoom(){return this.get(Pe.MIN_ZOOM)}getMaxZoom(){return this.get(Pe.MAX_ZOOM)}getOpacity(){return this.get(Pe.OPACITY)}getSourceState(){return(0,Y.O3)()}getVisible(){return this.get(Pe.VISIBLE)}getZIndex(){return this.get(Pe.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Pe.EXTENT,e)}setMaxResolution(e){this.set(Pe.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Pe.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Pe.MAX_ZOOM,e)}setMinZoom(e){this.set(Pe.MIN_ZOOM,e)}setOpacity(e){(0,T.h)(typeof e=="number",64),this.set(Pe.OPACITY,e)}setVisible(e){this.set(Pe.VISIBLE,e)}setZIndex(e){this.set(Pe.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const so=Il,at={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class bl extends so{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Pe.SOURCE,this.handleSourcePropertyChange_);const i=e.source?e.source:null;this.setSource(i)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Pe.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed()}handleSourcePropertyChange_(){this.sourceChangeKey_&&((0,j.bN)(this.sourceChangeKey_),this.sourceChangeKey_=null);const e=this.getSource();e&&(this.sourceChangeKey_=(0,j.oL)(e,me.Z.CHANGE,this.handleSourceChange_,this)),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):new Promise(t=>t([]))}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}render(e,t){const i=this.getRenderer();if(i.prepareFrame(e))return this.rendered=!0,i.renderFrame(e,t)}unrender(){this.rendered=!1}setMapInternal(e){e||this.unrender(),this.set(Pe.MAP,e)}getMapInternal(){return this.get(Pe.MAP)}setMap(e){this.mapPrecomposeKey_&&((0,j.bN)(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&((0,j.bN)(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=(0,j.oL)(e,at.PRECOMPOSE,function(t){const n=t.frameState.layerStatesArray,r=this.getLayerState(!1);(0,T.h)(!n.some(function(o){return o.layer===r.layer}),67),n.push(r)},this),this.mapRenderKey_=(0,j.oL)(this,me.Z.CHANGE,e.render,e),this.changed())}setSource(e){this.set(Pe.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function Os(s,e){if(!s.visible)return!1;const t=e.resolution;if(t<s.minResolution||t>=s.maxResolution)return!1;const i=e.zoom;return i>s.minZoom&&i<=s.maxZoom}const Bn=bl;class Ll extends zn{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1);const t=e.className!==void 0?e.className:"ol-attribution",i=e.tipLabel!==void 0?e.tipLabel:"Attributions",n=e.expandClassName!==void 0?e.expandClassName:t+"-expand",r=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=n):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(me.Z.CLICK,this.handleClick_.bind(this),!1);const h=t+" "+sn+" "+Fs+(this.collapsed_&&this.collapsible_?" "+to:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){const t={},i=[];let n=!0;const r=e.layerStatesArray;for(let o=0,a=r.length;o<a;++o){const l=r[o];if(!Os(l,e.viewState))continue;const h=l.layer.getSource();if(!h)continue;const c=h.getAttributions();if(!c)continue;const u=c(e);if(u)if(n=n&&h.getAttributionsCollapsible()!==!1,Array.isArray(u))for(let d=0,f=u.length;d<f;++d)u[d]in t||(i.push(u[d]),t[u[d]]=!0);else u in t||(i.push(u),t[u]=!0)}return this.overrideCollapsible_||this.setCollapsible(n),i}updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=this.collectSourceAttributions_(e),i=t.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!(0,U.fS)(t,this.renderedAttributions_)){wl(this.ulElement_);for(let n=0,r=t.length;n<r;++n){const o=document.createElement("li");o.innerHTML=t[n],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(to),this.collapsed_?eo(this.collapseLabel_,this.label_):eo(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}}const ro=Ll,ks="units",Ml=[1,2,5],rn=25.4/.28;class Pl extends zn{constructor(e){e=e||{};const t=document.createElement("div");t.style.pointerEvents="none",super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un;const i=e.className!==void 0?e.className:e.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+sn,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=e.minWidth!==void 0?e.minWidth:64,this.maxWidth_=e.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(ks,this.handleUnitsChanged_),this.setUnits(e.units||"metric"),this.scaleBar_=e.bar||!1,this.scaleBarSteps_=e.steps||4,this.scaleBarText_=e.text||!1,this.dpi_=e.dpi||void 0}getUnits(){return this.get(ks)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(ks,e)}setDpi(e){this.dpi_=e}updateElement_(){const e=this.viewState_;if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=e.center,i=e.projection,n=this.getUnits(),r=n=="degrees"?"degrees":"m";let o=(0,A._Q)(i,e.resolution,t,r);const a=this.minWidth_*(this.dpi_||rn)/rn,l=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||rn)/rn:void 0;let h=a*o,c="";if(n=="degrees"){const C=A.Wm.degrees;h*=C,h<C/60?(c="\u2033",o*=3600):h<C?(c="\u2032",o*=60):c="\xB0"}else n=="imperial"?h<.9144?(c="in",o/=.0254):h<1609.344?(c="ft",o/=.3048):(c="mi",o/=1609.344):n=="nautical"?(o/=1852,c="NM"):n=="metric"?h<.001?(c="\u03BCm",o*=1e6):h<1?(c="mm",o*=1e3):h<1e3?c="m":(c="km",o/=1e3):n=="us"?h<.9144?(c="in",o*=39.37):h<1609.344?(c="ft",o/=.30480061):(c="mi",o/=1609.3472):(0,T.h)(!1,33);let u=3*Math.floor(Math.log(a*o)/Math.log(10)),d,f,g,m,_,x;for(;;){g=Math.floor(u/3);const C=Math.pow(10,g);if(d=Ml[(u%3+3)%3]*C,f=Math.round(d/o),isNaN(f)){this.element.style.display="none",this.renderedVisible_=!1;return}if(l!==void 0&&f>=l){d=m,f=_,g=x;break}else if(f>=a)break;m=d,_=f,x=g,++u}const E=this.scaleBar_?this.createScaleBar(f,d,c):d.toFixed(g<0?-g:0)+" "+c;this.renderedHTML_!=E&&(this.innerElement_.innerHTML=E,this.renderedHTML_=E),this.renderedWidth_!=f&&(this.innerElement_.style.width=f+"px",this.renderedWidth_=f),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(e,t,i){const n=this.getScaleForResolution(),r=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),o=this.scaleBarSteps_,a=e/o,l=[this.createMarker("absolute")];for(let c=0;c<o;++c){const u=c%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";l.push(`<div><div class="ol-scale-singlebar ${u}" style="width: ${a}px;"></div>`+this.createMarker("relative")+(c%2===0||o===2?this.createStepText(c,e,!1,t,i):"")+"</div>")}return l.push(this.createStepText(o,e,!0,t,i)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${e}px;">`+r+"</div>":"")+l.join("")}createMarker(e){return`<div class="ol-scale-step-marker" style="position: ${e}; top: ${e==="absolute"?3:-10}px;"></div>`}createStepText(e,t,i,n,r){const a=(e===0?0:Math.round(n/this.scaleBarSteps_*e*100)/100)+(e===0?"":" "+r),l=e===0?-3:t/this.scaleBarSteps_*-1,h=e===0?0:t/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${l}px;text-align: ${e===0?"left":"center"};min-width: ${h}px;left: ${i?t+"px":"unset"};">`+a+"</div>"}getScaleForResolution(){const e=(0,A._Q)(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),t=this.dpi_||rn,i=1e3/25.4;return e*i*t}render(e){const t=e.frameState;t?this.viewState_=t.viewState:this.viewState_=null,this.updateElement_()}}const Al=Pl;class Dl extends zn{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=e.className!==void 0?e.className:"ol-zoom",i=e.delta!==void 0?e.delta:1,n=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",r=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",h=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(me.Z.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(me.Z.CLICK,this.handleClick_.bind(this,-i),!1);const d=t+" "+sn+" "+Fs,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const i=this.getMap().getView();if(!i)return;const n=i.getZoom();if(n!==void 0){const r=i.getConstrainedZoom(n+e);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:y})):i.setZoom(r)}}}const oo=Dl,Ns={ACTIVE:"active"};class Fl extends Ee.Z{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Ns.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(Ns.ACTIVE,e)}setMap(e){this.map_=e}}function Ol(s,e,t){const i=s.getCenterInternal();if(i){const n=[i[0]+e[0],i[1]+e[1]];s.animateInternal({duration:t!==void 0?t:250,easing:S,center:s.getConstrainedCenter(n)})}}function zs(s,e,t,i){const n=s.getZoom();if(n===void 0)return;const r=s.getConstrainedZoom(n+e),o=s.getResolutionForZoom(r);s.getAnimating()&&s.cancelAnimations(),s.animate({resolution:o,anchor:t,duration:i!==void 0?i:250,easing:y})}const on=Fl,Se={SINGLECLICK:"singleclick",CLICK:me.Z.CLICK,DBLCLICK:me.Z.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};function Gs(s){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n<r&&(i=i&&e[n](t),!!i);++n);return i}}const kl=function(s){const e=s.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Nl=function(s){const e=s.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},zl=function(s){const e=s.map.getTargetElement(),t=s.map.getOwnerDocument().activeElement;return e.contains(t)},ao=function(s){return s.map.getTargetElement().hasAttribute("tabindex")?zl(s):!0},Zn=ge.uX,wg=function(s){return s.type==MapBrowserEventType.CLICK},lo=function(s){const e=s.originalEvent;return e.button==0&&!(He.G$&&He.tK&&e.ctrlKey)},Gl=ge.Dv,Tg=function(s){return s.type=="pointermove"},Bl=function(s){return s.type==Se.SINGLECLICK},Sg=function(s){return s.type==MapBrowserEventType.DBLCLICK},Bs=function(s){const e=s.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Rg=function(s){const e=s.originalEvent;return!e.altKey&&(MAC?e.metaKey:e.ctrlKey)&&!e.shiftKey},ho=function(s){const e=s.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},co=function(s){const e=s.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},Zs=function(s){const e=s.originalEvent;return(0,T.h)(e!==void 0,56),e.pointerType=="mouse"},Ig=function(s){const e=s.originalEvent;return assert(e!==void 0,56),e.pointerType==="touch"},bg=function(s){const e=s.originalEvent;return assert(e!==void 0,56),e.pointerType==="pen"},uo=function(s){const e=s.originalEvent;return(0,T.h)(e!==void 0,56),e.isPrimary&&e.button===0};class Zl extends on{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;const t=e.condition?e.condition:Zn;this.condition_=e.onFocusOnly?Gs(ao,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(e){if(!this.condition_(e)||e.type!==me.Z.WHEEL)return!0;const i=e.map,n=e.originalEvent;n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.coordinate);let r;if(e.type==me.Z.WHEEL&&(r=n.deltaY,He.V&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=He.MP),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=40)),r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let i=-(0,w.uZ)(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),zs(t,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}}const fo=Zl;var Ws=R(95484),Wn=R(55294),Wl=R(60325),Ul=R(45984),bi=R(72648);const Vl=({topRight1:s,topRight2:e,bottomLeft:t,blStyle:i})=>{const n=(s&&s.length>0)??!1,r=(0,bi.wW)(Xl(n));return p.createElement("div",{className:r.overlay},Boolean(s?.length)&&p.createElement("div",{className:r.TR1},s),Boolean(e?.length)&&p.createElement("div",{className:r.TR2},e),Boolean(t?.length)&&p.createElement("div",{className:r.BL,style:i},t))},Xl=s=>e=>({overlay:B.css`
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
  `,TR1:B.css`
    right: 0.5em;
    pointer-events: auto;
    position: absolute;
    top: 0.5em;
  `,TR2:B.css`
    position: absolute;
    top: ${s?"80":"8"}px;
    right: 8px;
    pointer-events: auto;
  `,BL:B.css`
    position: absolute;
    bottom: 8px;
    left: 8px;
    pointer-events: auto;
  `});var Yl=R(99510),jl=R(6665),Kl=R(85511),Hl=R(20888),$l=R(50796),dt=R(82897),an=R(14582),ql=R(89890),Jl=R(94893),Ql=R(2352),eh=R(71398),th=R(19942);const go=({feature:s})=>{let e,t=0;if(!s)return null;if(e=s.get("frame"),e)t=s.get("rowIndex");else{const{geometry:i,...n}=s.getProperties();e=new eh.i([n])}return p.createElement(th.H,{data:e,rowIndex:t})},ih=({layers:s,activeTabIndex:e})=>{const t=(0,bi.wW)(sh),[i,n]=(0,p.useState)(new Map),r=(o,a)=>{n(new Map(i.set(o,a)))};return p.createElement(Jl.I,null,s.map((o,a)=>a===e&&p.createElement("div",{key:o.layer.getName()},p.createElement("div",null,o.features.map((l,h)=>{const c=l.getId()??h;return o.features.length>1?p.createElement(Ql.U,{key:c,collapsible:!0,label:nh(l,h),isOpen:i.get(c),onToggle:()=>{r(c,!i.get(c))},className:t.collapsibleRow},p.createElement(go,{feature:l})):p.createElement(go,{key:c,feature:l})})))))},nh=(s,e)=>{const t=["Name","name","Title","ID","id"];let i=s.getProperties(),n="";const r=s.get("frame");if(r){const o=s.get("rowIndex");for(const a of r.fields)if(a.type===an.fS.string){const l=(0,ql.C)(a,r);n||(n=l),i[l]=a.values.get(o)}}for(let o of t){const a=i[o];if(a)return a}if(n)return`${n}: ${i[n]}`;for(let o of Object.keys(i)){const a=i[o];if((0,dt.isString)(a))return`${o}: ${a}`}return`Match: ${e+1}`},sh=s=>({collapsibleRow:B.css`
    margin-bottom: 0px;
  `});var rh=R(72142),oh=R(79841);const ah=({layers:s,setActiveTabIndex:e,activeTabIndex:t})=>p.createElement(rh.J,null,s&&s.map((i,n)=>p.createElement(oh.O,{key:n,label:i.layer.getName(),active:n===t,counter:i.features.length>1?i.features.length:null,onChangeTab:()=>{e(n)}}))),lh=({layers:s,onClose:e,isOpen:t})=>{const[i,n]=(0,p.useState)(0);return s?p.createElement(p.Fragment,null,t&&p.createElement($l.P,{style:{zIndex:1},onClick:e}),p.createElement(ah,{layers:s,setActiveTabIndex:n,activeTabIndex:i}),p.createElement(ih,{layers:s,activeTabIndex:i})):null},hh=({ttip:s,onClose:e,isOpen:t})=>{const i=(0,p.createRef)(),{overlayProps:n}=(0,jl.Ir)({onClose:e,isDismissable:!0,isOpen:t},i),{dialogProps:r}=(0,Yl.R)({},i);return p.createElement(p.Fragment,null,s&&s.layers&&p.createElement(Kl.h_,null,p.createElement(Hl.S,{position:{x:s.pageX,y:s.pageY},offset:{x:10,y:10},allowPointerEvents:!0},p.createElement("section",{ref:i,...n,...r},p.createElement(lh,{layers:s.layers,isOpen:t,onClose:e})))))};var ch=R(35008),ln=R.n(ch),uh=R(68183),mo=R(7804),pi=R(47694);class dh extends p.PureComponent{constructor(e){super(e),this.style=fh(pi.vc.theme2),this.updateViewState=()=>{const t=this.props.map.getView();this.setState({zoom:t.getZoom(),center:(0,A.vs)(t.getCenter(),t.getProjection(),"EPSG:4326")})},this.state={zoom:0,center:[0,0]}}componentDidMount(){this.props.map.on("moveend",this.updateViewState),this.updateViewState()}render(){const{zoom:e,center:t}=this.state;return p.createElement("div",{className:this.style.infoWrap,"aria-label":uh.wl.components.DebugOverlay.wrapper},p.createElement("table",null,p.createElement("tbody",null,p.createElement("tr",null,p.createElement("th",null,"Zoom:"),p.createElement("td",null,e?.toFixed(1))),p.createElement("tr",null,p.createElement("th",null,"Center:\xA0"),p.createElement("td",null,t[0].toFixed(5),", ",t[1].toFixed(5))))))}}const fh=(0,mo.B)(s=>({infoWrap:B.css`
    color: ${s.colors.text.primary};
    background: ${ln()(s.components.panel.background).setAlpha(.7).toString()};
    border-radius: 2px;
    padding: 8px;
  `}));var Un=R(2594),Vn=R(31403),Li=R(53217),Us=R(8180),xt=R(20112);const rt=[{value:"length",label:"Length",geometry:"LineString",units:[{label:"Metric (m/km)",value:"m",format:s=>(0,xt.Cf)("lengthm")(s)},{label:"Feet (ft)",value:"ft",format:s=>(0,xt.Cf)("lengthft")(s*3.28084)},{label:"Miles (mi)",value:"mi",format:s=>(0,xt.Cf)("lengthmi")(s/1609)},{label:"Nautical miles (nmi)",value:"nmi",format:s=>(0,xt.Cf)("nmi")(s/1852)}],getUnit:s=>{const e=rt[0].units;return s?.endsWith("2")&&(s=s.substring(0,s.length-1)),e.find(t=>t.value===s)??e[0]}},{value:"area",label:"Area",geometry:"Polygon",units:[{label:"Square Meters (m\xB2)",value:"m2",format:s=>(0,xt.Cf)("areaM2")(s)},{label:"Square Kilometers (km\xB2)",value:"km2",format:s=>(0,xt.q2)("km\xB2")(s*1e-6)},{label:"Square Feet (ft\xB2)",value:"ft2",format:s=>(0,xt.Cf)("areaF2")(s*10.76391)},{label:"Square Miles (mi\xB2)",value:"mi2",format:s=>(0,xt.Cf)("areaMI2")(s*3861e-10)},{label:"Acres",value:"acre2",format:s=>(0,xt.q2)("acre")(s*247105e-9)},{label:"Hectare",value:"hectare2",format:s=>(0,xt.q2)("ha")(s*1e-4)}],getUnit:s=>{const e=rt[1].units;return s?.endsWith("2")||(s+="2"),e.find(t=>t.value===s)??e[0]}}];var lt=R(54428),Jt=R(18788),gh=R(55977);const tt={ADD:"add",REMOVE:"remove"};var Bt=R(61992);const _o={LENGTH:"length"};class Xn extends Bt.ZP{constructor(e,t,i){super(e),this.element=t,this.index=i}}class mh extends Ee.Z{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e||[],this.unique_)for(let i=0,n=this.array_.length;i<n;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,i=e.length;t<i;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let i=0,n=t.length;i<n;++i)e(t[i],i,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(_o.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Xn(tt.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){this.unique_&&this.assertUnique_(e);const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let i=0,n=t.length;i<n;++i)if(t[i]===e)return this.removeAt(i)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Xn(tt.REMOVE,t,e)),t}setAt(e,t){const i=this.getLength();if(e>=i){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Xn(tt.REMOVE,n,e)),this.dispatchEvent(new Xn(tt.ADD,t,e))}updateLength_(){this.set(_o.LENGTH,this.array_.length)}assertUnique_(e,t){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===e&&i!==t)throw new gh.Z(58)}}const vt=mh;var ft=R(45954);class _h extends on{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==Se.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==Se.POINTERUP){const i=this.handleUpEvent(e);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(e.type==Se.POINTERDOWN){const i=this.handleDownEvent(e);this.handlingDownUpSequence=i,t=this.stopDown(i)}else e.type==Se.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}}function Vs(s){const e=s.length;let t=0,i=0;for(let n=0;n<e;n++)t+=s[n].clientX,i+=s[n].clientY;return[t/e,i/e]}const yi=_h;var po=R(43788),Qt=R(90177);class ph{constructor(e){this.rbush_=new po(e),this.items_={}}insert(e,t){const i={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(i),this.items_[(0,Y.sq)(t)]=i}load(e,t){const i=new Array(t.length);for(let n=0,r=t.length;n<r;n++){const o=e[n],a=t[n],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[n]=l,this.items_[(0,Y.sq)(a)]=l}this.rbush_.load(i)}remove(e){const t=(0,Y.sq)(e),i=this.items_[t];return delete this.items_[t],this.rbush_.remove(i)!==null}update(e,t){const i=this.items_[(0,Y.sq)(t)],n=[i.minX,i.minY,i.maxX,i.maxY];(0,v.fS)(n,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(n){return n.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let i;for(let n=0,r=e.length;n<r;n++)if(i=t(e[n]),i)return i;return i}isEmpty(){return(0,Qt.x)(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return(0,v.T9)(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}}const Xs=ph,qe={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"},Ye={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Lg(s,e,t){return t===void 0&&(t=[0,0]),t[0]=s[0]+2*e,t[1]=s[1]+2*e,t}function yo(s){return s[0]>0&&s[1]>0}function yh(s,e,t){return t===void 0&&(t=[0,0]),t[0]=s[0]*e+.5|0,t[1]=s[1]*e+.5|0,t}function gt(s,e){return Array.isArray(s)?s:(e===void 0?e=[s,s]:(e[0]=s,e[1]=s),e)}class Ys{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=gt(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new Ys({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return(0,Y.O3)()}getImage(e){return(0,Y.O3)()}getHitDetectionImage(){return(0,Y.O3)()}getPixelRatio(e){return 1}getImageState(){return(0,Y.O3)()}getImageSize(){return(0,Y.O3)()}getOrigin(){return(0,Y.O3)()}getSize(){return(0,Y.O3)()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=gt(e)}listenImageChange(e){(0,Y.O3)()}load(){(0,Y.O3)()}unlistenImageChange(e){(0,Y.O3)()}}const xo=Ys,vo=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Eo=/^([a-z]*)$|^hsla?\(.*\)$/i;function Mi(s){return typeof s=="string"?s:To(s)}function Co(s){const e=document.createElement("div");if(e.style.color=s,e.style.color!==""){document.body.appendChild(e);const t=getComputedStyle(e).color;return document.body.removeChild(e),t}else return""}const xh=function(){const e={};let t=0;return function(i){let n;if(e.hasOwnProperty(i))n=e[i];else{if(t>=1024){let r=0;for(const o in e)r++&3||(delete e[o],--t)}n=vh(i),e[i]=n,++t}return n}}();function Pi(s){return Array.isArray(s)?s:xh(s)}function vh(s){let e,t,i,n,r;if(Eo.exec(s)&&(s=Co(s)),vo.exec(s)){const o=s.length-1;let a;o<=4?a=1:a=2;const l=o===4||o===8;e=parseInt(s.substr(1+0*a,a),16),t=parseInt(s.substr(1+1*a,a),16),i=parseInt(s.substr(1+2*a,a),16),l?n=parseInt(s.substr(1+3*a,a),16):n=255,a==1&&(e=(e<<4)+e,t=(t<<4)+t,i=(i<<4)+i,l&&(n=(n<<4)+n)),r=[e,t,i,n/255]}else s.startsWith("rgba(")?(r=s.slice(5,-1).split(",").map(Number),wo(r)):s.startsWith("rgb(")?(r=s.slice(4,-1).split(",").map(Number),r.push(1),wo(r)):(0,T.h)(!1,14);return r}function wo(s){return s[0]=(0,w.uZ)(s[0]+.5|0,0,255),s[1]=(0,w.uZ)(s[1]+.5|0,0,255),s[2]=(0,w.uZ)(s[2]+.5|0,0,255),s[3]=(0,w.uZ)(s[3],0,1),s}function To(s){let e=s[0];e!=(e|0)&&(e=e+.5|0);let t=s[1];t!=(t|0)&&(t=t+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*100)/100;return"rgba("+e+","+t+","+i+","+n+")"}function Mg(s){return Eo.test(s)&&(s=Co(s)),vo.test(s)||s.startsWith("rgba(")||s.startsWith("rgb(")}function At(s){return Array.isArray(s)?To(s):s}const So="10px sans-serif",Zt="#000",Yn="round",hn=[],cn=0,Ai="round",un=10,dn="#000",fn="center",jn="middle",xi=[0,0,0,0],gn=1,Wt=new Ee.Z;let Di=null,js;const Ks={},Eh=function(){const e="32px ",t=["monospace","serif"],i=t.length,n="wmytzilWMYTZIL@#/&?$%10\uF013";let r,o;function a(h,c,u){let d=!0;for(let f=0;f<i;++f){const g=t[f];if(o=Kn(h+" "+c+" "+e+g,n),u!=g){const m=Kn(h+" "+c+" "+e+u+","+g,n);d=d&&m!=o}}return!!d}function l(){let h=!0;const c=Wt.getKeys();for(let u=0,d=c.length;u<d;++u){const f=c[u];Wt.get(f)<100&&(a.apply(this,f.split(`
`))?((0,Qt.Z)(Ks),Di=null,js=void 0,Wt.set(f,100)):(Wt.set(f,Wt.get(f)+1,!0),h=!1))}h&&(clearInterval(r),r=void 0)}return function(h){const c=no(h);if(!c)return;const u=c.families;for(let d=0,f=u.length;d<f;++d){const g=u[d],m=c.style+`
`+c.weight+`
`+g;Wt.get(m)===void 0&&(Wt.set(m,100,!0),a(c.style,c.weight,g)||(Wt.set(m,0,!0),r===void 0&&(r=setInterval(l,32))))}}}(),Ch=function(){let s;return function(e){let t=Ks[e];if(t==null){if(He.Id){const i=no(e),n=Ro(e,"\u017Dg");t=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else s||(s=document.createElement("div"),s.innerHTML="M",s.style.minHeight="0",s.style.maxHeight="none",s.style.height="auto",s.style.padding="0",s.style.border="none",s.style.position="absolute",s.style.display="block",s.style.left="-99999px"),s.style.font=e,document.body.appendChild(s),t=s.offsetHeight,document.body.removeChild(s);Ks[e]=t}return t}}();function Ro(s,e){return Di||(Di=$e(1,1)),s!=js&&(Di.font=s,js=Di.font),Di.measureText(e)}function Kn(s,e){return Ro(s,e).width}function Io(s,e,t){if(e in t)return t[e];const i=e.split(`
`).reduce((n,r)=>Math.max(n,Kn(s,r)),0);return t[e]=i,i}function wh(s,e){const t=[],i=[],n=[];let r=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if(u===`
`||h===c){r=Math.max(r,o),n.push(o),o=0,a+=l;continue}const d=e[h+1]||s.font,f=Kn(d,u);t.push(f),o+=f;const g=Ch(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:t,heights:i,lineWidths:n}}function Pg(s,e,t,i){e!==0&&(s.translate(t,i),s.rotate(e),s.translate(-t,-i))}function Th(s,e,t,i,n,r,o,a,l,h,c){s.save(),t!==1&&(s.globalAlpha*=t),e&&s.setTransform.apply(s,e),i.contextInstructions?(s.translate(l,h),s.scale(c[0],c[1]),Sh(i,s)):c[0]<0||c[1]<0?(s.translate(l,h),s.scale(c[0],c[1]),s.drawImage(i,n,r,o,a,0,0,o,a)):s.drawImage(i,n,r,o,a,l,h,o*c[0],a*c[1]),s.restore()}function Sh(s,e){const t=s.contextInstructions;for(let i=0,n=t.length;i<n;i+=2)Array.isArray(t[i+1])?e[t[i]].apply(e,t[i+1]):e[t[i]]=t[i+1]}class Hs extends xo{constructor(e){const t=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:1,rotateWithView:t,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius_=e.radius!==void 0?e.radius:e.radius1,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){const e=this.getScale(),t=new Hs({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_;if(!e)return null;const t=this.getDisplacement(),i=this.getScaleArray();return[e[0]/2-t[0]/i[0],e[1]/2+t[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.canvas_[e];if(!t){const i=this.renderOptions_,n=$e(i.size*e,i.size*e);this.draw_(i,n,e),t=n.canvas,this.canvas_[e]=t}return t}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return Ye.LOADED}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,i){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let n=this.radius_,r=this.radius2_===void 0?n:this.radius2_;if(n<r){const F=n;n=r,r=F}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),h=Math.sqrt(r*r-l*l),c=n-h,u=Math.sqrt(l*l+c*c),d=u/l;if(e==="miter"&&d<=i)return d*t;const f=t/2/d,g=t/2*(c/u),_=Math.sqrt((n+f)*(n+f)+g*g)-n;if(this.radius2_===void 0||e==="bevel")return _*2;const x=n*Math.sin(a),E=Math.sqrt(n*n-x*x),C=r-E,M=Math.sqrt(x*x+C*C)/x;if(M<=i){const F=M*t/2-r-n;return 2*Math.max(_,F)}return _*2}createRenderOptions(){let e=Ai,t=0,i=null,n=0,r,o=0;this.stroke_&&(r=this.stroke_.getColor(),r===null&&(r=dn),r=At(r),o=this.stroke_.getWidth(),o===void 0&&(o=gn),i=this.stroke_.getLineDash(),n=this.stroke_.getLineDashOffset(),e=this.stroke_.getLineJoin(),e===void 0&&(e=Ai),t=this.stroke_.getMiterLimit(),t===void 0&&(t=un));const a=this.calculateLineJoinSize_(e,o,t),l=Math.max(this.radius_,this.radius2_||0),h=Math.ceil(2*l+a);return{strokeStyle:r,strokeWidth:o,size:h,lineDash:i,lineDashOffset:n,lineJoin:e,miterLimit:t}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.canvas_={},this.size_=[e,e]}draw_(e,t,i){if(t.scale(i,i),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let n=this.fill_.getColor();n===null&&(n=Zt),t.fillStyle=At(n),t.fill()}this.stroke_&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){if(this.fill_){let t=this.fill_.getColor(),i=0;if(typeof t=="string"&&(t=Pi(t)),t===null?i=1:Array.isArray(t)&&(i=t.length===4?t[3]:1),i===0){const n=$e(e.size,e.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(e,n)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))}createPath_(e){let t=this.points_;const i=this.radius_;if(t===1/0)e.arc(0,0,i,0,2*Math.PI);else{const n=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(t*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){const l=r+a*o,h=a%2===0?i:n;e.lineTo(h*Math.cos(l),h*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Zt,t.fill(),this.stroke_&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}}const it=Hs;class $s extends it{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const e=this.getScale(),t=new $s({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}setRadius(e){this.radius_=e,this.render()}}const Dt=$s;class qs{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null}clone(){const e=this.getColor();return new qs({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){this.color_=e}}const ke=qs;class Js{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}clone(){const e=this.getColor();return new Js({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setWidth(e){this.width_=e}}const Oe=Js;class ei{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=Lo,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new ei({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=Lo,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function Rh(s){let e;if(typeof s=="function")e=s;else{let t;Array.isArray(s)?t=s:((0,T.h)(typeof s.getZIndex=="function",41),t=[s]),e=function(){return t}}return e}let Qs=null;function Ih(s,e){if(!Qs){const t=new ke({color:"rgba(255,255,255,0.4)"}),i=new Oe({color:"#3399CC",width:1.25});Qs=[new ei({image:new Dt({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return Qs}function bo(){const s={},e=[255,255,255,1],t=[0,153,255,1],i=3;return s.Polygon=[new ei({fill:new ke({color:[255,255,255,.5]})})],s.MultiPolygon=s.Polygon,s.LineString=[new ei({stroke:new Oe({color:e,width:i+2})}),new ei({stroke:new Oe({color:t,width:i})})],s.MultiLineString=s.LineString,s.Circle=s.Polygon.concat(s.LineString),s.Point=[new ei({image:new Dt({radius:i*2,fill:new ke({color:t}),stroke:new Oe({color:e,width:i/2})}),zIndex:1/0})],s.MultiPoint=s.Point,s.GeometryCollection=s.Polygon.concat(s.LineString,s.Point),s}function Lo(s){return s.getGeometry()}const we=ei;var er=R(81873);class bh{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(const t in this.cache_){const i=this.cache_[t];!(e++&3)&&!i.hasListener()&&(delete this.cache_[t],--this.cacheSize_)}}}get(e,t,i){const n=Mo(e,t,i);return n in this.cache_?this.cache_[n]:null}set(e,t,i,n){const r=Mo(e,t,i);this.cache_[r]=n,++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}}function Mo(s,e,t){const i=t?Mi(t):"null";return e+":"+s+":"+i}const Ag=null,Hn=new bh;class Dg extends null{constructor(e,t,i,n,r,o){super(e,t,i,ImageState.IDLE),this.src_=n,this.image_=new Image,r!==null&&(this.image_.crossOrigin=r),this.unlisten_=null,this.state=ImageState.IDLE,this.imageLoadFunction_=o}getImage(){return this.image_}handleImageError_(){this.state=ImageState.ERROR,this.unlistenImage_(),this.changed()}handleImageLoad_(){this.resolution===void 0&&(this.resolution=getHeight(this.extent)/this.image_.height),this.state=ImageState.LOADED,this.unlistenImage_(),this.changed()}load(){(this.state==ImageState.IDLE||this.state==ImageState.ERROR)&&(this.state=ImageState.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=tr(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}setImage(e){this.image_=e,this.resolution=getHeight(this.extent)/this.image_.height}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function tr(s,e,t){const i=s;let n=!0,r=!1,o=!1;const a=[(0,j.Vx)(i,me.Z.LOAD,function(){o=!0,r||e()})];return i.src&&He.Tp?(r=!0,i.decode().then(function(){n&&e()}).catch(function(l){n&&(o?e():t())})):a.push((0,j.Vx)(i,me.Z.ERROR,t)),function(){n=!1,a.forEach(j.bN)}}const Fg=null;let mn=null;class Lh extends er.Z{constructor(e,t,i,n,r,o){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=r,this.size_=i,this.src_=t,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Ye.LOADED){mn||(mn=$e(1,1)),mn.drawImage(this.image_,0,0);try{mn.getImageData(0,0,1,1),this.tainted_=!1}catch{mn=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(me.Z.CHANGE)}handleImageError_(){this.imageState_=Ye.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Ye.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],i=$e(e,t);i.fillRect(0,0,e,t),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Ye.IDLE){this.image_||this.initializeImage_(),this.imageState_=Ye.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=tr(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Ye.LOADED)return;const t=this.image_,i=document.createElement("canvas");i.width=Math.ceil(t.width*e),i.height=Math.ceil(t.height*e);const n=i.getContext("2d");n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Mi(this.color_),n.fillRect(0,0,i.width/e,i.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=i}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Mh(s,e,t,i,n,r){let o=Hn.get(e,i,r);return o||(o=new Lh(s,e,t,i,n,r),Hn.set(e,i,r,o)),o}const Og=null;class ir extends xo{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,i=e.rotation!==void 0?e.rotation:0,n=e.scale!==void 0?e.scale:1,r=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:i,scale:n,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:r,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null;const o=e.img!==void 0?e.img:null;this.imgSize_=e.imgSize;let a=e.src;(0,T.h)(!(a!==void 0&&o),4),(0,T.h)(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||(0,Y.sq)(o)),(0,T.h)(a!==void 0&&a.length>0,6);const l=e.src!==void 0?Ye.IDLE:Ye.LOADED;this.color_=e.color!==void 0?Pi(e.color):null,this.iconImage_=Mh(o,a,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null}clone(){const e=this.getScale();return new ir({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(e)?e.slice():e,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const n=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!n)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=n[0]),this.anchorYUnits_=="fraction"&&(e[1]*=n[1])}if(this.anchorOrigin_!="top-left"){if(!n)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+n[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+n[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),i=this.getScaleArray();return[e[0]-t[0]/i[0],e[1]+t[1]/i[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){const t=this.getSize(),i=this.iconImage_.getSize();if(!t||!i)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=i[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=i[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}listenImageChange(e){this.iconImage_.addEventListener(me.Z.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(me.Z.CHANGE,e)}}const $n=ir,Ph="#333";class nr{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=gt(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new ke({color:Ph}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding}clone(){const e=this.getScale();return new nr({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRotateWithView(e){this.rotateWithView_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=gt(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}}const Fi=nr;function Po(s){return new we({fill:_n(s,""),stroke:pn(s,""),text:Ah(s),image:Dh(s)})}function _n(s,e){const t=s[e+"fill-color"];if(t)return new ke({color:t})}function pn(s,e){const t=s[e+"stroke-width"],i=s[e+"stroke-color"];if(!(!t&&!i))return new Oe({width:t,color:i,lineCap:s[e+"stroke-line-cap"],lineJoin:s[e+"stroke-line-join"],lineDash:s[e+"stroke-line-dash"],lineDashOffset:s[e+"stroke-line-dash-offset"],miterLimit:s[e+"stroke-miter-limit"]})}function Ah(s){const e=s["text-value"];return e?new Fi({text:e,font:s["text-font"],maxAngle:s["text-max-angle"],offsetX:s["text-offset-x"],offsetY:s["text-offset-y"],overflow:s["text-overflow"],placement:s["text-placement"],scale:s["text-scale"],rotateWithView:s["text-rotate-with-view"],rotation:s["text-rotation"],textAlign:s["text-align"],justify:s["text-justify"],textBaseline:s["text-baseline"],padding:s["text-padding"],fill:_n(s,"text-"),backgroundFill:_n(s,"text-background-"),stroke:pn(s,"text-"),backgroundStroke:pn(s,"text-background-")}):void 0}function Dh(s){const e=s["icon-src"],t=s["icon-img"];if(e||t)return new $n({src:e,img:t,imgSize:s["icon-img-size"],anchor:s["icon-anchor"],anchorOrigin:s["icon-anchor-origin"],anchorXUnits:s["icon-anchor-x-units"],anchorYUnits:s["icon-anchor-y-units"],color:s["icon-color"],crossOrigin:s["icon-cross-origin"],offset:s["icon-offset"],displacement:s["icon-displacement"],opacity:s["icon-opacity"],scale:s["icon-scale"],rotation:s["icon-rotation"],rotateWithView:s["icon-rotate-with-view"],size:s["icon-size"],declutterMode:s["icon-declutter-mode"]});const i=s["shape-points"];if(i){const r="shape-";return new it({points:i,fill:_n(s,r),stroke:pn(s,r),radius:s["shape-radius"],radius1:s["shape-radius1"],radius2:s["shape-radius2"],angle:s["shape-angle"],displacement:s["shape-displacement"],rotation:s["shape-rotation"],rotateWithView:s["shape-rotate-with-view"],scale:s["shape-scale"],declutterMode:s["shape-declutter-mode"]})}const n=s["circle-radius"];if(n){const r="circle-";return new Dt({radius:n,fill:_n(s,r),stroke:pn(s,r),displacement:s["circle-displacement"],scale:s["circle-scale"],rotation:s["circle-rotation"],rotateWithView:s["circle-rotate-with-view"],declutterMode:s["circle-declutter-mode"]})}}const Ao={RENDER_ORDER:"renderOrder"};class Fh extends Bn{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter!==void 0?e.declutter:!1,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Ao.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e){e.declutterTree||(e.declutterTree=new po(9)),this.getRenderer().renderDeclutter(e)}setRenderOrder(e){this.set(Ao.RENDER_ORDER,e)}setStyle(e){let t;if(e===void 0)t=Ih;else if(e===null)t=null;else if(typeof e=="function")t=e;else if(e instanceof we)t=e;else if(Array.isArray(e)){const i=e.length,n=new Array(i);for(let r=0;r<i;++r){const o=e[r];o instanceof we?n[r]=o:n[r]=Po(o)}t=n}else t=Po(e);this.style_=t,this.styleFunction_=e===null?void 0:Rh(this.style_),this.changed()}}const sr=Fh,yn={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},qn=[yn.FILL],ti=[yn.STROKE],vi=[yn.BEGIN_PATH],Do=[yn.CLOSE_PATH],ce=yn;var Oh=R(50188);class kh{drawCustom(e,t,i,n){}drawGeometry(e){}setStyle(e){}drawCircle(e,t){}drawFeature(e,t){}drawGeometryCollection(e,t){}drawLineString(e,t){}drawMultiLineString(e,t){}drawMultiPoint(e,t){}drawMultiPolygon(e,t){}drawPoint(e,t){}drawPolygon(e,t){}drawText(e,t){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}}const Fo=kh;var ii=R(19847);class Nh extends Fo{constructor(e,t,i,n){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){const t=this.pixelRatio;return t==1?e:e.map(function(i){return i*t})}appendFlatPointCoordinates(e,t){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=e.length;a<l;a+=t)n[0]=e[a],n[1]=e[a+1],(0,v.b8)(i,n)&&(r[o++]=n[0],r[o++]=n[1]);return o}appendFlatLineCoordinates(e,t,i,n,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(t+=n);let c=e[t],u=e[t+1];const d=this.tmpCoordinate_;let f=!0,g,m,_;for(g=t+n;g<i;g+=n)d[0]=e[g],d[1]=e[g+1],_=(0,v.pX)(h,d),_!==m?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===Oh.Z.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],m=_;return(r&&f||g===t+n)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(e,t,i,n,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(e,t,l,n,!1,!1);r.push(h),t=l}return t}drawCustom(e,t,i,n){this.beginGeometry(e,t);const r=e.getType(),o=e.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(r){case"MultiPolygon":l=e.getOrientedFlatCoordinates(),u=[];const f=e.getEndss();d=0;for(let g=0,m=f.length;g<m;++g){const _=[];d=this.drawCustomCoordinates_(l,d,f[g],o,_),u.push(_)}this.instructions.push([ce.CUSTOM,a,u,e,i,ii.ug]),this.hitDetectionInstructions.push([ce.CUSTOM,a,u,e,n||i,ii.ug]);break;case"Polygon":case"MultiLineString":c=[],l=r=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,e.getEnds(),o,c),this.instructions.push([ce.CUSTOM,a,c,e,i,ii.o1]),this.hitDetectionInstructions.push([ce.CUSTOM,a,c,e,n||i,ii.o1]);break;case"LineString":case"Circle":l=e.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([ce.CUSTOM,a,h,e,i,ii.Ml]),this.hitDetectionInstructions.push([ce.CUSTOM,a,h,e,n||i,ii.Ml]);break;case"MultiPoint":l=e.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([ce.CUSTOM,a,h,e,i,ii.Ml]),this.hitDetectionInstructions.push([ce.CUSTOM,a,h,e,n||i,ii.Ml]));break;case"Point":l=e.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([ce.CUSTOM,a,h,e,i]),this.hitDetectionInstructions.push([ce.CUSTOM,a,h,e,n||i]);break;default:}this.endGeometry(t)}beginGeometry(e,t){this.beginGeometryInstruction1_=[ce.BEGIN_GEOMETRY,t,0,e],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[ce.BEGIN_GEOMETRY,t,0,e],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const i=e.length;let n,r,o=-1;for(t=0;t<i;++t)n=e[t],r=n[0],r==ce.END_GEOMETRY?o=t:r==ce.BEGIN_GEOMETRY&&(n[2]=t,(0,U.FZ)(this.hitDetectionInstructions,o,t),o=-1)}setFillStrokeStyle(e,t){const i=this.state;if(e){const n=e.getColor();i.fillStyle=At(n||Zt)}else i.fillStyle=void 0;if(t){const n=t.getColor();i.strokeStyle=At(n||dn);const r=t.getLineCap();i.lineCap=r!==void 0?r:Yn;const o=t.getLineDash();i.lineDash=o?o.slice():hn;const a=t.getLineDashOffset();i.lineDashOffset=a||cn;const l=t.getLineJoin();i.lineJoin=l!==void 0?l:Ai;const h=t.getWidth();i.lineWidth=h!==void 0?h:gn;const c=t.getMiterLimit();i.miterLimit=c!==void 0?c:un,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(e){const t=e.fillStyle,i=[ce.SET_FILL_STYLE,t];return typeof t!="string"&&i.push(!0),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[ce.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,this.applyPixelRatio(e.lineDash),e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const i=e.fillStyle;(typeof i!="string"||e.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(t.call(this,e)),e.currentFillStyle=i)}updateStrokeStyle(e,t){const i=e.strokeStyle,n=e.lineCap,r=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,h=e.miterLimit;(e.currentStrokeStyle!=i||e.currentLineCap!=n||r!=e.currentLineDash&&!(0,U.fS)(e.currentLineDash,r)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=h)&&(i!==void 0&&t.call(this,e),e.currentStrokeStyle=i,e.currentLineCap=n,e.currentLineDash=r,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=h)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[ce.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,v.d9)(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;(0,v.f3)(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const xn=Nh;class zh extends xn{constructor(e,t,i,n){super(e,t,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t){if(!this.image_)return;this.beginGeometry(e,t);const i=e.getFlatCoordinates(),n=e.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([ce.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([ce.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t){if(!this.image_)return;this.beginGeometry(e,t);const i=e.getFlatCoordinates(),n=e.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([ce.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([ce.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){const i=e.getAnchor(),n=e.getSize(),r=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=e.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=n[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const Gh=zh;class Bh extends xn{constructor(e,t,i,n){super(e,t,i,n)}drawFlatCoordinates_(e,t,i,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,i,n,!1,!1),a=[ce.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(e,t){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(n===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([ce.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,hn,cn],vi);const o=e.getFlatCoordinates(),a=e.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(ti),this.endGeometry(t)}drawMultiLineString(e,t){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(n===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([ce.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],vi);const o=e.getEnds(),a=e.getFlatCoordinates(),l=e.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinates_(a,h,o[c],l);this.hitDetectionInstructions.push(ti),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(ti),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(ti),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(vi)}}const Zh=Bh;var Wh=R(3371);class Uh extends xn{constructor(e,t,i,n){super(e,t,i,n)}drawFlatCoordinatess_(e,t,i,n){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(vi),this.hitDetectionInstructions.push(vi);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(e,t,c,n,!0,!a),f=[ce.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(Do),this.hitDetectionInstructions.push(Do)),t=c}return o&&(this.instructions.push(qn),this.hitDetectionInstructions.push(qn)),a&&(this.instructions.push(ti),this.hitDetectionInstructions.push(ti)),t}drawCircle(e,t){const i=this.state,n=i.fillStyle,r=i.strokeStyle;if(n===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([ce.SET_FILL_STYLE,Zt]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([ce.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getFlatCoordinates(),a=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[ce.CIRCLE,l];this.instructions.push(vi,h),this.hitDetectionInstructions.push(vi,h),i.fillStyle!==void 0&&(this.instructions.push(qn),this.hitDetectionInstructions.push(qn)),i.strokeStyle!==void 0&&(this.instructions.push(ti),this.hitDetectionInstructions.push(ti)),this.endGeometry(t)}drawPolygon(e,t){const i=this.state,n=i.fillStyle,r=i.strokeStyle;if(n===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([ce.SET_FILL_STYLE,Zt]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([ce.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getEnds(),a=e.getOrientedFlatCoordinates(),l=e.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(t)}drawMultiPolygon(e,t){const i=this.state,n=i.fillStyle,r=i.strokeStyle;if(n===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([ce.SET_FILL_STYLE,Zt]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([ce.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getEndss(),a=e.getOrientedFlatCoordinates(),l=e.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinatess_(a,h,o[c],l);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(e!==0){const t=this.coordinates;for(let i=0,n=t.length;i<n;++i)t[i]=(0,Wh.uZ)(t[i],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;e.fillStyle!==void 0&&this.updateFillStyle(e,this.createFill),e.strokeStyle!==void 0&&this.updateStrokeStyle(e,this.applyStroke)}}const Oo=Uh;function Vh(s,e,t,i,n){let r=t,o=t,a=0,l=0,h=t,c,u,d,f,g,m,_,x,E,C;for(u=t;u<i;u+=n){const b=e[u],M=e[u+1];g!==void 0&&(E=b-g,C=M-m,f=Math.sqrt(E*E+C*C),_!==void 0&&(l+=d,c=Math.acos((_*E+x*C)/(d*f)),c>s&&(l>a&&(a=l,r=h,o=u),l=0,h=u-n)),d=f,_=E,x=C),g=b,m=M}return l+=f,l>a?[h,u]:[r,o]}const vn={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Xh extends xn{constructor(e,t,i,n){super(e,t,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t){const i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(this.text_===""||!r||!i&&!n)return;const o=this.coordinates;let a=o.length;const l=e.getType();let h=null,c=e.getStride();if(r.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!(0,v.kK)(this.getBufferedMaxExtent(),e.getExtent()))return;let u;if(h=e.getFlatCoordinates(),l=="LineString")u=[h.length];else if(l=="MultiLineString")u=e.getEnds();else if(l=="Polygon")u=e.getEnds().slice(0,1);else if(l=="MultiPolygon"){const m=e.getEndss();u=[];for(let _=0,x=m.length;_<x;++_)u.push(m[_][0])}this.beginGeometry(e,t);const d=r.textAlign;let f=0,g;for(let m=0,_=u.length;m<_;++m){if(d==null){const E=Vh(r.maxAngle,h,f,u[m],c);f=E[0],g=E[1]}else g=u[m];for(let E=f;E<g;E+=c)o.push(h[E],h[E+1]);const x=o.length;f=u[m],this.drawChars_(a,x),a=x}this.endGeometry(t)}else{let u=r.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=e.getFlatCoordinates();break;case"LineString":h=e.getFlatMidpoint();break;case"Circle":h=e.getCenter();break;case"MultiLineString":h=e.getFlatMidpoints(),c=2;break;case"Polygon":h=e.getFlatInteriorPoint(),r.overflow||u.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const _=e.getFlatInteriorPoints();h=[];for(let x=0,E=_.length;x<E;x+=3)r.overflow||u.push(_[x+2]/this.resolution),h.push(_[x],_[x+1]);if(h.length===0)return;c=2;break;default:}const d=this.appendFlatPointCoordinates(h,c);if(d===a)return;if(u&&(d-a)/2!==h.length/c){let _=a/2;u=u.filter((x,E)=>{const C=o[(_+E)*2]===h[E*c]&&o[(_+E)*2+1]===h[E*c+1];return C||--_,C})}this.saveTextStates_(),(r.backgroundFill||r.backgroundStroke)&&(this.setFillStrokeStyle(r.backgroundFill,r.backgroundStroke),r.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),r.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(e,t);let f=r.padding;if(f!=xi&&(r.scale[0]<0||r.scale[1]<0)){let _=r.padding[0],x=r.padding[1],E=r.padding[2],C=r.padding[3];r.scale[0]<0&&(x=-x,C=-C),r.scale[1]<0&&(_=-_,E=-E),f=[_,x,E,C]}const g=this.pixelRatio;this.instructions.push([ce.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,f==xi?xi:f.map(function(_){return _*g}),!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const m=1/g;this.hitDetectionInstructions.push([ce.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[m,m],NaN,void 0,this.declutterImageWithText_,f,!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,i=this.textFillState_,n=this.strokeKey_;e&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:t.font,textAlign:t.textAlign||fn,justify:t.justify,textBaseline:t.textBaseline||jn,scale:t.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(e,t){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=vn[n.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([ce.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,l,c,r,d*l,u,o,1]),this.hitDetectionInstructions.push([ce.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,1,c,r,d,u,o,1/l])}setTextStyle(e,t){let i,n,r;if(!e)this.text_="";else{const o=e.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=At(o.getColor()||Zt)):(n=null,this.textFillState_=n);const a=e.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const g=a.getLineDash(),m=a.getLineDashOffset(),_=a.getWidth(),x=a.getMiterLimit();r.lineCap=a.getLineCap()||Yn,r.lineDash=g?g.slice():hn,r.lineDashOffset=m===void 0?cn:m,r.lineJoin=a.getLineJoin()||Ai,r.lineWidth=_===void 0?gn:_,r.miterLimit=x===void 0?un:x,r.strokeStyle=At(a.getColor()||dn)}i=this.textState_;const l=e.getFont()||So;Eh(l);const h=e.getScaleArray();i.overflow=e.getOverflow(),i.font=l,i.maxAngle=e.getMaxAngle(),i.placement=e.getPlacement(),i.textAlign=e.getTextAlign(),i.justify=e.getJustify(),i.textBaseline=e.getTextBaseline()||jn,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||xi,i.scale=h===void 0?[1,1]:h;const c=e.getOffsetX(),u=e.getOffsetY(),d=e.getRotateWithView(),f=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=f===void 0?0:f,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:(0,Y.sq)(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n?typeof n.fillStyle=="string"?n.fillStyle:"|"+(0,Y.sq)(n.fillStyle):""}this.declutterImageWithText_=t}}const Yh={Circle:Oo,Default:xn,Image:Gh,LineString:Zh,Polygon:Oo,Text:Xh};class jh{constructor(e,t,i,n){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const i=this.buildersByZIndex_[t];for(const n in i){const r=i[n].finish();e[t][n]=r}}return e}getBuilder(e,t){const i=e!==void 0?e.toString():"0";let n=this.buildersByZIndex_[i];n===void 0&&(n={},this.buildersByZIndex_[i]=n);let r=n[t];if(r===void 0){const o=Yh[t];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[t]=r}return r}}const ko=jh;var rr=R(63827);class Kh extends rr.Z{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.declutterExecutorGroup=null}getFeatures(e){return(0,Y.O3)()}getData(e){return null}prepareFrame(e){return(0,Y.O3)()}renderFrame(e,t){return(0,Y.O3)()}loadedTileCallback(e,t,i){e[t]||(e[t]={}),e[t][i.tileCoord.toString()]=i}createLoadedTileFinder(e,t,i){return function(n,r){const o=this.loadedTileCallback.bind(this,i,n);return e.forEachLoadedTile(t,n,r,o)}.bind(this)}forEachFeatureAtCoordinate(e,t,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){e.target.getState()===Ye.LOADED&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Ye.LOADED&&t!=Ye.ERROR&&e.addEventListener(me.Z.CHANGE,this.boundHandleImageChange_),t==Ye.IDLE&&(e.load(),t=e.getState()),t==Ye.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const No=Kh;class Hh extends Bt.ZP{constructor(e,t,i,n){super(e),this.inversePixelTransform=t,this.frameState=i,this.context=n}}const En=Hh;var H=R(36779);const zo=[];let Oi=null;function $h(){const s=document.createElement("canvas");s.width=1,s.height=1,Oi=s.getContext("2d")}class qh extends No{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=(0,H.Ue)(),this.pixelTransform=(0,H.Ue)(),this.inversePixelTransform=(0,H.Ue)(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,i){Oi||$h(),Oi.clearRect(0,0,1,1);let n;try{Oi.drawImage(e,t,i,1,1,0,0,1,1),n=Oi.getImageData(0,0,1,1).data}catch{return Oi=null,null}return n}getBackground(e){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(e.viewState.resolution)),i||void 0}useContainer(e,t,i){const n=this.getLayer().getClassName();let r,o;if(e&&e.className===n&&(!i||e&&e.style.backgroundColor&&(0,U.fS)(Pi(e.style.backgroundColor),Pi(i)))){const a=e.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===t?(this.container=e,this.context=o,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){r=document.createElement("div"),r.className=n;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=$e();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(e,t,i){const n=(0,v.rL)(i),r=(0,v.Xv)(i),o=(0,v.w$)(i),a=(0,v.hC)(i);(0,H.nn)(t.coordinateToPixelTransform,n),(0,H.nn)(t.coordinateToPixelTransform,r),(0,H.nn)(t.coordinateToPixelTransform,o),(0,H.nn)(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;(0,H.nn)(l,n),(0,H.nn)(l,r),(0,H.nn)(l,o),(0,H.nn)(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(n[0]),Math.round(n[1])),e.lineTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}dispatchRenderEvent_(e,t,i){const n=this.getLayer();if(n.hasListener(e)){const r=new En(e,this.inversePixelTransform,i,t);n.dispatchEvent(r)}}preRender(e,t){this.frameState=t,this.dispatchRenderEvent_(at.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(at.POSTRENDER,e,t)}getRenderTransform(e,t,i,n,r,o,a){const l=r/2,h=o/2,c=n/t,u=-c,d=-e[0]+a,f=-e[1];return(0,H.qC)(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const Go=qh;var ni=R(66241);function Jh(s,e,t,i,n,r,o,a,l,h,c,u){let d=s[e],f=s[e+1],g=0,m=0,_=0,x=0;function E(){g=d,m=f,e+=i,d=s[e],f=s[e+1],x+=_,_=Math.sqrt((d-g)*(d-g)+(f-m)*(f-m))}do E();while(e<t-i&&x+_<r);let C=_===0?0:(r-x)/_;const b=(0,w.t7)(g,d,C),M=(0,w.t7)(m,f,C),F=e-i,O=x,W=r+a*l(h,n,c);for(;e<t-i&&x+_<W;)E();C=_===0?0:(W-x)/_;const q=(0,w.t7)(g,d,C),ie=(0,w.t7)(m,f,C);let ye;if(u){const $=[b,M,q,ie];(0,ni.U1)($,0,4,2,u,$,$),ye=$[0]>$[2]}else ye=b>q;const xe=Math.PI,oe=[],Be=F+i===e;e=F,_=0,x=O,d=s[e],f=s[e+1];let _e;if(Be){E(),_e=Math.atan2(f-m,d-g),ye&&(_e+=_e>0?-xe:xe);const $=(q+b)/2,J=(ie+M)/2;return oe[0]=[$,J,(W-r)/2,_e,n],oe}n=n.replace(/\n/g," ");for(let $=0,J=n.length;$<J;){E();let te=Math.atan2(f-m,d-g);if(ye&&(te+=te>0?-xe:xe),_e!==void 0){let Ae=te-_e;if(Ae+=Ae>xe?-2*xe:Ae<-xe?2*xe:0,Math.abs(Ae)>o)return null}_e=te;const Ze=$;let We=0;for(;$<J;++$){const Ae=ye?J-$-1:$,Ne=a*l(h,n[Ae],c);if(e+i<t&&x+_<r+We+Ne/2)break;We+=Ne}if($===Ze)continue;const Ke=ye?n.substring(J-Ze,J-$):n.substring(Ze,$);C=_===0?0:(r+We/2-x)/_;const Z=(0,w.t7)(g,d,C),_t=(0,w.t7)(m,f,C);oe.push([Z,_t,We/2,te,Ke]),r+=We}return oe}var Qh=R(59846);const ki=(0,v.lJ)(),si=[],Ut=[],Vt=[],ri=[];function Bo(s){return s[3].declutterBox}const ec=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function Zo(s,e){return(e==="start"||e==="end")&&!ec.test(s)&&(e=e==="start"?"left":"right"),vn[e]}function tc(s,e,t){return t>0&&s.push(`
`,""),s.push(e,""),s}class ic{constructor(e,t,i,n){this.overlaps=i,this.pixelRatio=t,this.resolution=e,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=(0,H.Ue)(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(e,t,i,n){const r=e+t+i+n;if(this.labels_[r])return this.labels_[r];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[t],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=Array.isArray(e),d=l.justify?vn[l.justify]:Zo(Array.isArray(e)?e[0]:e,l.textAlign||fn),f=n&&o.lineWidth?o.lineWidth:0,g=u?e:e.split(`
`).reduce(tc,[]),{width:m,height:_,widths:x,heights:E,lineWidths:C}=wh(l,g),b=m+f,M=[],F=(b+2)*c[0],O=(_+f)*c[1],W={width:F<0?Math.floor(F):Math.ceil(F),height:O<0?Math.floor(O):Math.ceil(O),contextInstructions:M};(c[0]!=1||c[1]!=1)&&M.push("scale",c),n&&(M.push("strokeStyle",o.strokeStyle),M.push("lineWidth",f),M.push("lineCap",o.lineCap),M.push("lineJoin",o.lineJoin),M.push("miterLimit",o.miterLimit),M.push("setLineDash",[o.lineDash]),M.push("lineDashOffset",o.lineDashOffset)),i&&M.push("fillStyle",a.fillStyle),M.push("textBaseline","middle"),M.push("textAlign","center");const q=.5-d;let ie=d*b+q*f;const ye=[],xe=[];let oe=0,Be=0,_e=0,$=0,J;for(let te=0,Ze=g.length;te<Ze;te+=2){const We=g[te];if(We===`
`){Be+=oe,oe=0,ie=d*b+q*f,++$;continue}const Ke=g[te+1]||l.font;Ke!==J&&(n&&ye.push("font",Ke),i&&xe.push("font",Ke),J=Ke),oe=Math.max(oe,E[_e]);const Z=[We,ie+q*x[_e]+d*(x[_e]-C[$]),.5*(f+oe)+Be];ie+=x[_e],n&&ye.push("strokeText",Z),i&&xe.push("fillText",Z),++_e}return Array.prototype.push.apply(M,ye),Array.prototype.push.apply(M,xe),this.labels_[r]=W,W}replayTextBackground_(e,t,i,n,r,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,i),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,t),o&&(this.alignFill_=o[2],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,i,n,r,o,a,l,h,c,u,d,f,g,m,_){a*=d[0],l*=d[1];let x=i-a,E=n-l;const C=r+h>e?e-h:r,b=o+c>t?t-c:o,M=g[3]+C*d[0]+g[1],F=g[0]+b*d[1]+g[2],O=x-g[3],W=E-g[0];(m||u!==0)&&(si[0]=O,ri[0]=O,si[1]=W,Ut[1]=W,Ut[0]=O+M,Vt[0]=Ut[0],Vt[1]=W+F,ri[1]=Vt[1]);let q;return u!==0?(q=(0,H.qC)((0,H.Ue)(),i,n,1,1,u,-i,-n),(0,H.nn)(q,si),(0,H.nn)(q,Ut),(0,H.nn)(q,Vt),(0,H.nn)(q,ri),(0,v.T9)(Math.min(si[0],Ut[0],Vt[0],ri[0]),Math.min(si[1],Ut[1],Vt[1],ri[1]),Math.max(si[0],Ut[0],Vt[0],ri[0]),Math.max(si[1],Ut[1],Vt[1],ri[1]),ki)):(0,v.T9)(Math.min(O,O+M),Math.min(W,W+F),Math.max(O,O+M),Math.max(W,W+F),ki),f&&(x=Math.round(x),E=Math.round(E)),{drawImageX:x,drawImageY:E,drawImageW:C,drawImageH:b,originX:h,originY:c,declutterBox:{minX:ki[0],minY:ki[1],maxX:ki[2],maxY:ki[3],value:_},canvasTransform:q,scale:d}}replayImageOrLabel_(e,t,i,n,r,o,a){const l=!!(o||a),h=n.declutterBox,c=e.canvas,u=a?a[2]*n.scale[0]/2:0;return h.minX-u<=c.width/t&&h.maxX+u>=0&&h.minY-u<=c.height/t&&h.maxY+u>=0&&(l&&this.replayTextBackground_(e,si,Ut,Vt,ri,o,a),Th(e,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(e){if(this.alignFill_){const t=(0,H.nn)(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;e.save(),e.translate(t[0]%i,t[1]%i),e.rotate(this.viewRotation_)}e.fill(),this.alignFill_&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6])}drawLabelWithPointPlacement_(e,t,i,n){const r=this.textStates[t],o=this.createLabel(e,t,n,i),a=this.strokeStates[i],l=this.pixelRatio,h=Zo(Array.isArray(e)?e[0]:e,r.textAlign||fn),c=vn[r.textBaseline||jn],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(e,t,i,n,r,o,a,l){let h;this.pixelCoordinates_&&(0,U.fS)(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=(0,ni.vT)(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),(0,H.lk)(this.renderedTransform_,i));let c=0;const u=n.length;let d=0,f,g,m,_,x,E,C,b,M,F,O,W,q=0,ie=0,ye=null,xe=null;const oe=this.coordinateCache_,Be=this.viewRotation_,_e=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,$={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Be},J=this.instructions!=n||this.overlaps?0:200;let te,Ze,We,Ke;for(;c<u;){const Z=n[c];switch(Z[0]){case ce.BEGIN_GEOMETRY:te=Z[1],Ke=Z[3],te.getGeometry()?a!==void 0&&!(0,v.kK)(a,Ke.getExtent())?c=Z[2]+1:++c:c=Z[2];break;case ce.BEGIN_PATH:q>J&&(this.fill_(e),q=0),ie>J&&(e.stroke(),ie=0),!q&&!ie&&(e.beginPath(),_=NaN,x=NaN),++c;break;case ce.CIRCLE:d=Z[1];const Ae=h[d],Ne=h[d+1],fi=h[d+2],Gt=h[d+3],Qe=fi-Ae,Kt=Gt-Ne,$i=Math.sqrt(Qe*Qe+Kt*Kt);e.moveTo(Ae+$i,Ne),e.arc(Ae,Ne,$i,0,2*Math.PI,!0),++c;break;case ce.CLOSE_PATH:e.closePath(),++c;break;case ce.CUSTOM:d=Z[1],f=Z[2];const Ss=Z[3],qi=Z[4],Rs=Z.length==6?Z[5]:void 0;$.geometry=Ss,$.feature=te,c in oe||(oe[c]=[]);const gi=oe[c];Rs?Rs(h,d,f,2,gi):(gi[0]=h[d],gi[1]=h[d+1],gi.length=2),qi(gi,$),++c;break;case ce.DRAW_IMAGE:d=Z[1],f=Z[2],b=Z[3],g=Z[4],m=Z[5];let Fn=Z[6];const mi=Z[7],Is=Z[8],bs=Z[9],Ls=Z[10];let Ji=Z[11];const $r=Z[12];let ht=Z[13];const St=Z[14],Pt=Z[15];if(!b&&Z.length>=20){M=Z[19],F=Z[20],O=Z[21],W=Z[22];const pt=this.drawLabelWithPointPlacement_(M,F,O,W);b=pt.label,Z[3]=b;const tn=Z[23];g=(pt.anchorX-tn)*this.pixelRatio,Z[4]=g;const Rt=Z[24];m=(pt.anchorY-Rt)*this.pixelRatio,Z[5]=m,Fn=b.height,Z[6]=Fn,ht=b.width,Z[13]=ht}let Ht;Z.length>25&&(Ht=Z[25]);let Qi,Ii,_i;Z.length>17?(Qi=Z[16],Ii=Z[17],_i=Z[18]):(Qi=xi,Ii=!1,_i=!1),Ls&&_e?Ji+=Be:!Ls&&!_e&&(Ji-=Be);let en=0;for(;d<f;d+=2){if(Ht&&Ht[en++]<ht/this.pixelRatio)continue;const pt=this.calculateImageOrLabelDimensions_(b.width,b.height,h[d],h[d+1],ht,Fn,g,m,Is,bs,Ji,$r,r,Qi,Ii||_i,te),tn=[e,t,b,pt,mi,Ii?ye:null,_i?xe:null];if(l){if(St==="none")continue;if(St==="obstacle"){l.insert(pt.declutterBox);continue}else{let Rt,$t;if(Pt){const yt=f-d;if(!Pt[yt]){Pt[yt]=tn;continue}if(Rt=Pt[yt],delete Pt[yt],$t=Bo(Rt),l.collides($t))continue}if(l.collides(pt.declutterBox))continue;Rt&&(l.insert($t),this.replayImageOrLabel_.apply(this,Rt)),l.insert(pt.declutterBox)}}this.replayImageOrLabel_.apply(this,tn)}++c;break;case ce.DRAW_CHARS:const Ms=Z[1],ot=Z[2],qr=Z[3],yg=Z[4];W=Z[5];const xg=Z[6],yl=Z[7],xl=Z[8];O=Z[9];const Jr=Z[10];M=Z[11],F=Z[12];const vl=[Z[13],Z[13]],Qr=this.textStates[F],On=Qr.font,kn=[Qr.scale[0]*yl,Qr.scale[1]*yl];let Nn;On in this.widths_?Nn=this.widths_[On]:(Nn={},this.widths_[On]=Nn);const El=(0,Qh.W)(h,Ms,ot,2),Cl=Math.abs(kn[0])*Io(On,M,Nn);if(yg||Cl<=El){const pt=this.textStates[F].textAlign,tn=(El-Cl)*vn[pt],Rt=Jh(h,Ms,ot,2,M,tn,xg,Math.abs(kn[0]),Io,On,Nn,_e?0:this.viewRotation_);e:if(Rt){const $t=[];let yt,Ps,As,ct,It;if(O)for(yt=0,Ps=Rt.length;yt<Ps;++yt){It=Rt[yt],As=It[4],ct=this.createLabel(As,F,"",O),g=It[2]+(kn[0]<0?-Jr:Jr),m=qr*ct.height+(.5-qr)*2*Jr*kn[1]/kn[0]-xl;const qt=this.calculateImageOrLabelDimensions_(ct.width,ct.height,It[0],It[1],ct.width,ct.height,g,m,0,0,It[3],vl,!1,xi,!1,te);if(l&&l.collides(qt.declutterBox))break e;$t.push([e,t,ct,qt,1,null,null])}if(W)for(yt=0,Ps=Rt.length;yt<Ps;++yt){It=Rt[yt],As=It[4],ct=this.createLabel(As,F,W,""),g=It[2],m=qr*ct.height-xl;const qt=this.calculateImageOrLabelDimensions_(ct.width,ct.height,It[0],It[1],ct.width,ct.height,g,m,0,0,It[3],vl,!1,xi,!1,te);if(l&&l.collides(qt.declutterBox))break e;$t.push([e,t,ct,qt,1,null,null])}l&&l.load($t.map(Bo));for(let qt=0,vg=$t.length;qt<vg;++qt)this.replayImageOrLabel_.apply(this,$t[qt])}}++c;break;case ce.END_GEOMETRY:if(o!==void 0){te=Z[1];const pt=o(te,Ke);if(pt)return pt}++c;break;case ce.FILL:J?q++:this.fill_(e),++c;break;case ce.MOVE_TO_LINE_TO:for(d=Z[1],f=Z[2],Ze=h[d],We=h[d+1],E=Ze+.5|0,C=We+.5|0,(E!==_||C!==x)&&(e.moveTo(Ze,We),_=E,x=C),d+=2;d<f;d+=2)Ze=h[d],We=h[d+1],E=Ze+.5|0,C=We+.5|0,(d==f-2||E!==_||C!==x)&&(e.lineTo(Ze,We),_=E,x=C);++c;break;case ce.SET_FILL_STYLE:ye=Z,this.alignFill_=Z[2],q&&(this.fill_(e),q=0,ie&&(e.stroke(),ie=0)),e.fillStyle=Z[1],++c;break;case ce.SET_STROKE_STYLE:xe=Z,ie&&(e.stroke(),ie=0),this.setStrokeStyle_(e,Z),++c;break;case ce.STROKE:J?ie++:e.stroke(),++c;break;default:++c;break}}q&&this.fill_(e),ie&&e.stroke()}execute(e,t,i,n,r,o){this.viewRotation_=n,this.execute_(e,t,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(e,t,i,n,r){return this.viewRotation_=i,this.execute_(e,1,t,this.hitDetectionInstructions,!0,n,r)}}const nc=ic,or=["Polygon","Circle","LineString","Image","Text","Default"];class sc{constructor(e,t,i,n,r,o){this.maxExtent_=e,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=(0,H.Ue)(),this.createExecutors_(r)}clip(e,t){const i=this.getClipCoords(t);e.beginPath(),e.moveTo(i[0],i[1]),e.lineTo(i[2],i[3]),e.lineTo(i[4],i[5]),e.lineTo(i[6],i[7]),e.clip()}createExecutors_(e){for(const t in e){let i=this.executorsByZIndex_[t];i===void 0&&(i={},this.executorsByZIndex_[t]=i);const n=e[t];for(const r in n){const o=n[r];i[r]=new nc(this.resolution_,this.pixelRatio_,this.overlaps_,o)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const i=this.executorsByZIndex_[t];for(let n=0,r=e.length;n<r;++n)if(e[n]in i)return!0}return!1}forEachFeatureAtCoordinate(e,t,i,n,r,o){n=Math.round(n);const a=n*2+1,l=(0,H.qC)(this.hitDetectionTransform_,n+.5,n+.5,1/t,-1/t,-i,-e[0],-e[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=$e(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=(0,v.lJ)(),(0,v.Wj)(u,e),(0,v.f3)(u,t*(this.renderBuffer_+n),u));const d=rc(n);let f;function g(M,F){const O=c.getImageData(0,0,a,a).data;for(let W=0,q=d.length;W<q;W++)if(O[d[W]]>0){if(!o||f!=="Image"&&f!=="Text"||o.includes(M)){const ie=(d[W]-3)/4,ye=n-ie%a,xe=n-(ie/a|0),oe=r(M,F,ye*ye+xe*xe);if(oe)return oe}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(U.kK);let _,x,E,C,b;for(_=m.length-1;_>=0;--_){const M=m[_].toString();for(E=this.executorsByZIndex_[M],x=or.length-1;x>=0;--x)if(f=or[x],C=E[f],C!==void 0&&(b=C.executeHitDetection(c,l,i,g,u),b))return b}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const i=t[0],n=t[1],r=t[2],o=t[3],a=[i,n,i,o,r,o,r,n];return(0,ni.vT)(a,0,8,2,e,a),a}isEmpty(){return(0,Qt.x)(this.executorsByZIndex_)}execute(e,t,i,n,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(U.kK),this.maxExtent_&&(e.save(),this.clip(e,i)),o=o||or;let h,c,u,d,f,g;for(a&&l.reverse(),h=0,c=l.length;h<c;++h){const m=l[h].toString();for(f=this.executorsByZIndex_[m],u=0,d=o.length;u<d;++u){const _=o[u];g=f[_],g!==void 0&&g.execute(e,t,i,n,r,a)}}this.maxExtent_&&e.restore()}}const ar={};function rc(s){if(ar[s]!==void 0)return ar[s];const e=s*2+1,t=s*s,i=new Array(t+1);for(let r=0;r<=s;++r)for(let o=0;o<=s;++o){const a=r*r+o*o;if(a>t)break;let l=i[a];l||(l=[],i[a]=l),l.push(((s+r)*e+(s+o))*4+3),r>0&&l.push(((s-r)*e+(s+o))*4+3),o>0&&(l.push(((s+r)*e+(s-o))*4+3),r>0&&l.push(((s-r)*e+(s-o))*4+3))}const n=[];for(let r=0,o=i.length;r<o;++r)i[r]&&n.push(...i[r]);return ar[s]=n,n}const Wo=sc;var Cn=R(81077);class oc extends Fo{constructor(e,t,i,n,r,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=i,this.transform_=n,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=(0,H.Ue)()}drawImages_(e,t,i,n){if(!this.image_)return;const r=(0,ni.vT)(e,t,i,n,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,m=f+this.imageAnchorY_;(0,H.qC)(a,g,m,1,1,h,-g,-m),o.setTransform.apply(o,a),o.translate(g,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.setTransform(1,0,0,1,0,0)}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,i,n){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=(0,ni.vT)(e,t,i,n,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.textRotateWithView_&&(a+=this.viewRotation_);t<i;t+=n){const l=r[t]+this.textOffsetX_,h=r[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(e,t,i,n,r){const o=this.context_,a=(0,ni.vT)(e,t,i,n,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),i}drawRings_(e,t,i,n){for(let r=0,o=i.length;r<o;++r)t=this.moveToLineTo_(e,t,i[r],n,!0);return t}drawCircle(e){if((0,v.kK)(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=(0,Cn.Kr)(e,this.transform_,this.pixelCoordinates_),i=t[2]-t[0],n=t[3]-t[1],r=Math.sqrt(i*i+n*n),o=this.context_;o.beginPath(),o.arc(t[0],t[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){const i=t.getGeometryFunction()(e);!i||!(0,v.kK)(this.extent_,i.getExtent())||(this.setStyle(t),this.drawGeometry(i))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let i=0,n=t.length;i<n;++i)this.drawGeometry(t[i])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,v.kK)(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(i,0,i.length,e.getStride(),!1),t.stroke()}if(this.text_!==""){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if((0,v.kK)(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,n=e.getFlatCoordinates();let r=0;const o=e.getEnds(),a=e.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(n,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=e.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,v.kK)(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride()),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,v.kK)(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getOrientedFlatCoordinates();let n=0;const r=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];n=this.drawRings_(i,n,h,o)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){const t=this.context_,i=this.contextFillState_;i?i.fillStyle!=e.fillStyle&&(i.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=e.lineCap&&(i.lineCap=e.lineCap,t.lineCap=e.lineCap),(0,U.fS)(i.lineDash,e.lineDash)||t.setLineDash(i.lineDash=e.lineDash),i.lineDashOffset!=e.lineDashOffset&&(i.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),i.lineJoin!=e.lineJoin&&(i.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),i.lineWidth!=e.lineWidth&&(i.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),i.miterLimit!=e.miterLimit&&(i.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),i.strokeStyle!=e.strokeStyle&&(i.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,i=this.contextTextState_,n=e.textAlign?e.textAlign:fn;i?(i.font!=e.font&&(i.font=e.font,t.font=e.font),i.textAlign!=n&&(i.textAlign=n,t.textAlign=n),i.textBaseline!=e.textBaseline&&(i.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=n,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:n,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{const i=e.getColor();this.fillState_={fillStyle:At(i||Zt)}}if(!t)this.strokeState_=null;else{const i=t.getColor(),n=t.getLineCap(),r=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),h=t.getMiterLimit(),c=r||hn;this.strokeState_={lineCap:n!==void 0?n:Yn,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||cn)*this.pixelRatio_,lineJoin:a!==void 0?a:Ai,lineWidth:(l!==void 0?l:gn)*this.pixelRatio_,miterLimit:h!==void 0?h:un,strokeStyle:At(i||dn)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const i=e.getPixelRatio(this.pixelRatio_),n=e.getAnchor(),r=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=t[1]*i,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=t[0]*i}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const f=t.getColor();this.textFillState_={fillStyle:At(f||Zt)}}const i=e.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),x=i.getLineJoin(),E=i.getWidth(),C=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Yn,lineDash:m||hn,lineDashOffset:_||cn,lineJoin:x!==void 0?x:Ai,lineWidth:E!==void 0?E:gn,miterLimit:C!==void 0?C:un,strokeStyle:At(f||dn)}}const n=e.getFont(),r=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),h=e.getScaleArray(),c=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:n!==void 0?n:So,textAlign:u!==void 0?u:fn,textBaseline:d!==void 0?d:jn},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const ac=oc,Ft=.5;function lc(s,e,t,i,n,r,o){const a=s[0]*Ft,l=s[1]*Ft,h=$e(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,u=new ac(h,Ft,n,null,o),d=t.length,f=Math.floor((256*256*256-1)/d),g={};for(let _=1;_<=d;++_){const x=t[_-1],E=x.getStyleFunction()||i;if(!i)continue;let C=E(x,r);if(!C)continue;Array.isArray(C)||(C=[C]);const M="#"+("000000"+(_*f).toString(16)).slice(-6);for(let F=0,O=C.length;F<O;++F){const W=C[F],q=W.getGeometryFunction()(x);if(!q||!(0,v.kK)(n,q.getExtent()))continue;const ie=W.clone(),ye=ie.getFill();ye&&ye.setColor(M);const xe=ie.getStroke();xe&&(xe.setColor(M),xe.setLineDash(null)),ie.setText(void 0);const oe=W.getImage();if(oe&&oe.getOpacity()!==0){const $=oe.getImageSize();if(!$)continue;const J=$e($[0],$[1],void 0,{alpha:!1}),te=J.canvas;J.fillStyle=M,J.fillRect(0,0,te.width,te.height),ie.setImage(new $n({img:te,imgSize:$,anchor:oe.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:oe.getOrigin(),opacity:1,size:oe.getSize(),scale:oe.getScale(),rotation:oe.getRotation(),rotateWithView:oe.getRotateWithView()}))}const Be=ie.getZIndex()||0;let _e=g[Be];_e||(_e={},g[Be]=_e,_e.Polygon=[],_e.Circle=[],_e.LineString=[],_e.Point=[]),_e[q.getType().replace("Multi","")].push(q,ie)}}const m=Object.keys(g).map(Number).sort(U.kK);for(let _=0,x=m.length;_<x;++_){const E=g[m[_]];for(const C in E){const b=E[C];for(let M=0,F=b.length;M<F;M+=2){u.setStyle(b[M+1]);for(let O=0,W=e.length;O<W;++O)u.setTransform(e[O]),u.drawGeometry(b[M])}}}return h.getImageData(0,0,c.width,c.height)}function hc(s,e,t){const i=[];if(t){const n=Math.floor(Math.round(s[0])*Ft),r=Math.floor(Math.round(s[1])*Ft),o=((0,w.uZ)(n,0,t.width-1)+(0,w.uZ)(r,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],c=t.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/e.length);c&&c%u===0&&i.push(e[c/u-1])}return i}const cc=.5,Uo={Point:xc,LineString:_c,Polygon:Ec,MultiPoint:vc,MultiLineString:pc,MultiPolygon:yc,GeometryCollection:mc,Circle:fc};function uc(s,e){return parseInt((0,Y.sq)(s),10)-parseInt((0,Y.sq)(e),10)}function dc(s,e){const t=lr(s,e);return t*t}function lr(s,e){return cc*s/e}function fc(s,e,t,i,n){const r=t.getFill(),o=t.getStroke();if(r||o){const l=s.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(e,i)}const a=t.getText();if(a&&a.getText()){const l=(n||s).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function Vo(s,e,t,i,n,r,o){let a=!1;const l=t.getImage();if(l){const h=l.getImageState();h==Ye.LOADED||h==Ye.ERROR?l.unlistenImageChange(n):(h==Ye.IDLE&&l.load(),l.listenImageChange(n),a=!0)}return gc(s,e,t,i,r,o),a}function gc(s,e,t,i,n,r){const o=t.getGeometryFunction()(e);if(!o)return;const a=o.simplifyTransformed(i,n);if(t.getRenderer())Xo(s,a,t,e);else{const h=Uo[a.getType()];h(s,a,t,e,r)}}function Xo(s,e,t,i){if(e.getType()=="GeometryCollection"){const r=e.getGeometries();for(let o=0,a=r.length;o<a;++o)Xo(s,r[o],t,i);return}s.getBuilder(t.getZIndex(),"Default").drawCustom(e,i,t.getRenderer(),t.getHitDetectionRenderer())}function mc(s,e,t,i,n){const r=e.getGeometriesArray();let o,a;for(o=0,a=r.length;o<a;++o){const l=Uo[r[o].getType()];l(s,r[o],t,i,n)}}function _c(s,e,t,i,n){const r=t.getStroke();if(r){const a=s.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(e,i)}const o=t.getText();if(o&&o.getText()){const a=(n||s).getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i)}}function pc(s,e,t,i,n){const r=t.getStroke();if(r){const a=s.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(e,i)}const o=t.getText();if(o&&o.getText()){const a=(n||s).getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i)}}function yc(s,e,t,i,n){const r=t.getFill(),o=t.getStroke();if(o||r){const l=s.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(e,i)}const a=t.getText();if(a&&a.getText()){const l=(n||s).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function xc(s,e,t,i,n){const r=t.getImage(),o=t.getText();let a;if(r){if(r.getImageState()!=Ye.LOADED)return;let l=s;if(n){const c=r.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const u=s.getBuilder(t.getZIndex(),"Image");u.setImageStyle(r,a),u.drawPoint(e,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(t.getZIndex(),"Image");h.setImageStyle(r,a),h.drawPoint(e,i)}if(o&&o.getText()){let l=s;n&&(l=n);const h=l.getBuilder(t.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(e,i)}}function vc(s,e,t,i,n){const r=t.getImage(),o=t.getText();let a;if(r){if(r.getImageState()!=Ye.LOADED)return;let l=s;if(n){const c=r.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const u=s.getBuilder(t.getZIndex(),"Image");u.setImageStyle(r,a),u.drawMultiPoint(e,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(t.getZIndex(),"Image");h.setImageStyle(r,a),h.drawMultiPoint(e,i)}if(o&&o.getText()){let l=s;n&&(l=n);const h=l.getBuilder(t.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(e,i)}}function Ec(s,e,t,i,n){const r=t.getFill(),o=t.getStroke();if(r||o){const l=s.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(e,i)}const a=t.getText();if(a&&a.getText()){const l=(n||s).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}class Cc extends Go{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=(0,v.lJ)(),this.wrappedRenderedExtent_=(0,v.lJ)(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(e,t,i){const n=t.extent,r=t.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=t.pixelRatio,f=t.viewHints,g=!(f[ne.ANIMATING]||f[ne.INTERACTING]),m=this.compositionContext_,_=Math.round(t.size[0]*d),x=Math.round(t.size[1]*d),E=u.getWrapX()&&l.canWrapX(),C=E?(0,v.dz)(c):null,b=E?Math.ceil((n[2]-c[2])/C)+1:1;let M=E?Math.floor((n[0]-c[0])/C):0;do{const F=this.getRenderTransform(o,a,h,d,_,x,M*C);e.execute(m,1,F,h,g,void 0,i)}while(++M<b)}setupCompositionContext_(){if(this.opacity_!==1){const e=$e(this.context.canvas.width,this.context.canvas.height,zo);this.compositionContext_=e}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const e=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=e,nn(this.compositionContext_),zo.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(e){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,e,e.declutterTree),this.releaseCompositionContext_())}renderFrame(e,t){const i=e.pixelRatio,n=e.layerStatesArray[e.layerIndex];(0,H.n3)(this.pixelTransform,1/i,1/i),(0,H.nb)(this.inversePixelTransform,this.pixelTransform);const r=(0,H.BB)(this.pixelTransform);this.useContainer(t,r,this.getBackground(e));const o=this.context,a=o.canvas,l=this.replayGroup_,h=this.declutterExecutorGroup;if((!l||l.isEmpty())&&(!h||h.isEmpty()))return null;const c=Math.round(e.size[0]*i),u=Math.round(e.size[1]*i);a.width!=c||a.height!=u?(a.width=c,a.height=u,a.style.transform!==r&&(a.style.transform=r)):this.containerReused||o.clearRect(0,0,c,u),this.preRender(o,e);const d=e.viewState,f=d.projection;this.opacity_=n.opacity,this.setupCompositionContext_();let g=!1,m=!0;if(n.extent&&this.clipping){const _=(0,A.dY)(n.extent,f);m=(0,v.kK)(_,e.extent),g=m&&!(0,v.r4)(_,e.extent),g&&this.clipUnrotated(this.compositionContext_,e,_)}return m&&this.renderWorlds(l,e),g&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(o,e),this.renderedRotation_!==d.rotation&&(this.renderedRotation_=d.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(e){return new Promise(function(t){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];(0,H.nn)(this.pixelTransform,i);const n=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*Ft,d=i[1]*Ft;c.push(this.getRenderTransform(n,r,o,Ft,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!(0,v.r4)(g,l)){let m=l[0];const _=(0,v.dz)(g);let x=0,E;for(;m<g[0];)--x,E=_*x,c.push(this.getRenderTransform(n,r,o,Ft,u,d,E).slice()),m+=_;for(x=0,m=l[2];m>g[2];)++x,E=_*x,c.push(this.getRenderTransform(n,r,o,Ft,u,d,E).slice()),m-=_}this.hitDetectionImageData_=lc(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o)}t(hc(e,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))}forEachFeatureAtCoordinate(e,t,i,n,r){if(!this.replayGroup_)return;const o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),h={},c=function(f,g,m){const _=(0,Y.sq)(f),x=h[_];if(x){if(x!==!0&&m<x.distanceSq){if(m===0)return h[_]=!0,r.splice(r.lastIndexOf(x),1),n(f,l,g);x.geometry=g,x.distanceSq=m}}else{if(m===0)return h[_]=!0,n(f,l,g);r.push(h[_]={feature:f,layer:l,geometry:g,distanceSq:m,callback:n})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(f=>u=f.forEachFeatureAtCoordinate(e,o,a,i,c,f===this.declutterExecutorGroup&&t.declutterTree?t.declutterTree.all().map(g=>g.value):null)),u}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),i=t.getSource();if(!i)return!1;const n=e.viewHints[ne.ANIMATING],r=e.viewHints[ne.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&n||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,h=e.viewState,c=h.projection,u=h.resolution,d=e.pixelRatio,f=t.getRevision(),g=t.getRenderBuffer();let m=t.getRenderOrder();m===void 0&&(m=uc);const _=h.center.slice(),x=(0,v.f3)(l,g*u),E=x.slice(),C=[x.slice()],b=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!(0,v.r4)(b,e.extent)){const $=(0,v.dz)(b),J=Math.max((0,v.dz)(x)/2,$);x[0]=b[0]-J,x[2]=b[2]+J,(0,he.Cf)(_,c);const te=(0,v.Cf)(C[0],c);te[0]<b[0]&&te[2]<b[2]?C.push([te[0]+$,te[1],te[2]+$,te[3]]):te[0]>b[0]&&te[2]>b[2]&&C.push([te[0]-$,te[1],te[2]-$,te[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&(0,v.r4)(this.wrappedRenderedExtent_,x))return(0,U.fS)(this.renderedExtent_,E)||(this.hitDetectionImageData_=null,this.renderedExtent_=E),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const M=new ko(lr(u,d),x,u,d);let F;this.getLayer().getDeclutter()&&(F=new ko(lr(u,d),x,u,d));const O=(0,A.Cs)();let W;if(O){for(let $=0,J=C.length;$<J;++$){const te=C[$],Ze=(0,A.Fj)(te,c);i.loadFeatures(Ze,(0,A.on)(u,c),O)}W=(0,A.WO)(O,c)}else for(let $=0,J=C.length;$<J;++$)i.loadFeatures(C[$],u,c);const q=dc(u,d);let ie=!0;const ye=function($){let J;const te=$.getStyleFunction()||t.getStyleFunction();if(te&&(J=te($,u)),J){const Ze=this.renderFeature($,q,J,M,W,F);ie=ie&&!Ze}}.bind(this),xe=(0,A.Fj)(x,c),oe=i.getFeaturesInExtent(xe);m&&oe.sort(m);for(let $=0,J=oe.length;$<J;++$)ye(oe[$]);this.renderedFeatures_=oe,this.ready=ie;const Be=M.finish(),_e=new Wo(x,u,d,i.getOverlaps(),Be,t.getRenderBuffer());return F&&(this.declutterExecutorGroup=new Wo(x,u,d,i.getOverlaps(),F.finish(),t.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedExtent_=E,this.wrappedRenderedExtent_=x,this.renderedCenter_=_,this.renderedProjection_=c,this.replayGroup_=_e,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,i,n,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Vo(n,e,i[l],t,this.boundHandleStyleImageChange_,r,o)||a;else a=Vo(n,e,i,t,this.boundHandleStyleImageChange_,r,o);return a}}const wc=Cc;class Tc extends sr{constructor(e){super(e)}createRenderer(){return new wc(this)}}const je=Tc;var wn=R(40858);class Sc extends Ee.Z{constructor(e){super(),this.projection=(0,A.U2)(e.projection),this.attributions_=Yo(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible!==void 0?e.attributionsCollapsible:!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(i,n){t.viewResolver=i,t.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(){return(0,Y.O3)()}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=Yo(e),this.changed()}setState(e){this.state_=e,this.changed()}}function Yo(s){return s?Array.isArray(s)?function(e){return s}:typeof s=="function"?s:function(e){return[s]}:null}const jo=Sc;function Ko(s,e){return[[-1/0,-1/0,1/0,1/0]]}function Ng(s,e){return[s]}function zg(s){return function(e,t,i){const n=s.getZForResolution(fromUserResolution(t,i)),r=s.getTileRangeForExtentAndZ(fromUserExtent(e,i),n),o=[],a=[n,0,0];for(a[1]=r.minX;a[1]<=r.maxX;++a[1])for(a[2]=r.minY;a[2]<=r.maxY;++a[2])o.push(toUserExtent(s.getTileCoordExtent(a),i));return o}}let Ho=!1;function Rc(s,e,t,i,n,r,o){const a=new XMLHttpRequest;a.open("GET",typeof s=="function"?s(t,i,n):s,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Ho,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=e.getType();let c;h=="json"||h=="text"?c=a.responseText:h=="xml"?(c=a.responseXML,c||(c=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(c=a.response),c?r(e.readFeatures(c,{extent:t,featureProjection:n}),e.readProjection(c)):o()}else o()},a.onerror=o,a.send()}function $o(s,e){return function(t,i,n,r,o){const a=this;Rc(s,e,t,i,n,function(l,h){a.addFeatures(l),r!==void 0&&r(l)},o||ge.Zn)}}function Gg(s){Ho=s}class oi extends Bt.ZP{constructor(e,t,i){super(e),this.feature=t,this.features=i}}class Ic extends jo{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=ge.Zn,this.format_=e.format,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&((0,T.h)(this.format_,7),this.loader_=$o(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:Ko;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new Xs:null,this.loadedExtentsRtree_=new Xs,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,n;Array.isArray(e.features)?n=e.features:e.features&&(i=e.features,n=i.getArray()),!t&&i===void 0&&(i=new vt(n)),n!==void 0&&this.addFeaturesInternal(n),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=(0,Y.sq)(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const i=e.getGeometry();if(i){const n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new oi(qe.ADDFEATURE,e))}setupChangeEvents_(e,t){this.featureChangeKeys_[e]=[(0,j.oL)(t,me.Z.CHANGE,this.handleFeatureChange_,this),(0,j.oL)(t,wn.Z.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(e,t){let i=!0;const n=t.getId();return n!==void 0&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=t),i&&((0,T.h)(!(e in this.uidIndex_),30),this.uidIndex_[e]=t),i}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],i=[],n=[];for(let r=0,o=e.length;r<o;r++){const a=e[r],l=(0,Y.sq)(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=(0,Y.sq)(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();t.push(c),n.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,n),this.hasListener(qe.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new oi(qe.ADDFEATURE,i[r]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(qe.ADDFEATURE,function(i){t||(t=!0,e.push(i.feature),t=!1)}),this.addEventListener(qe.REMOVEFEATURE,function(i){t||(t=!0,e.remove(i.feature),t=!1)}),e.addEventListener(tt.ADD,function(i){t||(t=!0,this.addFeature(i.element),t=!1)}.bind(this)),e.addEventListener(tt.REMOVE,function(i){t||(t=!0,this.removeFeature(i.element),t=!1)}.bind(this)),this.featuresCollection_=e}clear(e){if(e){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(j.bN);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const i=function(n){this.removeFeatureInternal(n)}.bind(this);this.featuresRtree_.forEach(i);for(const n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new oi(qe.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const i=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(i,function(n){if(n.getGeometry().intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(i){if(i.getGeometry().intersectsExtent(e)){const r=t(i);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),(0,Qt.x)(this.nullGeometryFeatures_)||(0,U.l7)(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(i){t.push(i)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const n=(0,v.MV)(e,t);return[].concat(...n.map(r=>this.featuresRtree_.getInExtent(r)))}else return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const i=e[0],n=e[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||ge.uX,this.featuresRtree_.forEachInExtent(l,function(h){if(t(h)){const c=h.getGeometry(),u=a;if(a=c.closestPointXY(i,n,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=n-d,l[2]=i+d,l[3]=n+d}}}),r}getExtent(e){return this.featuresRtree_.getExtent(e)}getFeatureById(e){const t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,i=(0,Y.sq)(t),n=t.getGeometry();if(!n)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[i]=t);else{const o=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}const r=t.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[i]=t;this.changed(),this.dispatchEvent(new oi(qe.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:(0,Y.sq)(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&(0,Qt.x)(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,i){const n=this.loadedExtentsRtree_,r=this.strategy_(e,t,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];n.forEachInExtent(l,function(c){return(0,v.r4)(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new oi(qe.FEATURESLOADSTART)),this.loader_.call(this,l,t,i,function(c){--this.loadingExtentsCount_,this.dispatchEvent(new oi(qe.FEATURESLOADEND,void 0,c))}.bind(this),function(){--this.loadingExtentsCount_,this.dispatchEvent(new oi(qe.FEATURESLOADERROR))}.bind(this)),n.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_;let i;t.forEachInExtent(e,function(n){if((0,v.fS)(n.extent,e))return i=n,!0}),i&&t.remove(i)}removeFeature(e){if(!e)return;const t=(0,Y.sq)(e);t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=(0,Y.sq)(e),i=this.featureChangeKeys_[t];if(!i)return;i.forEach(j.bN),delete this.featureChangeKeys_[t];const n=e.getId();return n!==void 0&&delete this.idIndex_[n.toString()],delete this.uidIndex_[t],this.dispatchEvent(new oi(qe.REMOVEFEATURE,e)),e}removeFromIdIndex_(e){let t=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===e){delete this.idIndex_[i],t=!0;break}return t}setLoader(e){this.loader_=e}setUrl(e){(0,T.h)(this.format_,7),this.url_=e,this.setLoader($o(e,this.format_))}}const Et=Ic,qo=0,Tn=1,Jo=[0,0,0,0],Ni=[],hr={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class cr extends Bt.ZP{constructor(e,t,i){super(e),this.features=t,this.mapBrowserEvent=i}}class bc extends yi{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:uo,this.defaultDeleteCondition_=function(i){return kl(i)&&Bl(i)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Zn,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new Xs,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new je({source:new Et({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:Mc(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let t;if(e.features?t=e.features:e.source&&(this.source_=e.source,t=new vt(this.source_.getFeatures()),this.source_.addEventListener(qe.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(qe.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!t)throw new Error("The modify interaction requires features, a source or a layer");e.hitDetection&&(this.hitDetection_=e.hitDetection),this.features_=t,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(tt.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(tt.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=e.snapToPointer===void 0?!this.hitDetection_:e.snapToPointer}addFeature_(e){const t=e.getGeometry();if(t){const n=this.SEGMENT_WRITERS_[t.getType()];n&&n(e,t)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),e.addEventListener(me.Z.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new vt;const i=this.featuresBeingModified_.getArray();for(let n=0,r=t.length;n<r;++n){const o=t[n];for(let a=0,l=o.length;a<l;++a){const h=o[a].feature;h&&!i.includes(h)&&this.featuresBeingModified_.push(h)}}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new cr(hr.MODIFYSTART,this.featuresBeingModified_,e))}}removeFeature_(e){this.removeFeatureSegmentData_(e),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.removeEventListener(me.Z.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(e){const t=this.rBush_,i=[];t.forEach(function(n){e===n.feature&&i.push(n)});for(let n=i.length-1;n>=0;--n){const r=i[n];for(let o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===r&&this.dragSegments_.splice(o,1);t.remove(r)}}setActive(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(e)}setMap(e){this.overlay_.setMap(e),super.setMap(e)}getOverlay(){return this.overlay_}handleSourceAdd_(e){e.feature&&this.features_.push(e.feature)}handleSourceRemove_(e){e.feature&&this.features_.remove(e.feature)}handleFeatureAdd_(e){this.addFeature_(e.element)}handleFeatureChange_(e){if(!this.changingFeature_){const t=e.target;this.removeFeature_(t),this.addFeature_(t)}}handleFeatureRemove_(e){this.removeFeature_(e.element)}writePointGeometry_(e,t){const i=t.getCoordinates(),n={feature:e,geometry:t,segment:[i,i]};this.rBush_.insert(t.getExtent(),n)}writeMultiPointGeometry_(e,t){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n],a={feature:e,geometry:t,depth:[n],index:n,segment:[o,o]};this.rBush_.insert(t.getExtent(),a)}}writeLineStringGeometry_(e,t){const i=t.getCoordinates();for(let n=0,r=i.length-1;n<r;++n){const o=i.slice(n,n+2),a={feature:e,geometry:t,index:n,segment:o};this.rBush_.insert((0,v.hI)(o),a)}}writeMultiLineStringGeometry_(e,t){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:e,geometry:t,depth:[n],index:a,segment:h};this.rBush_.insert((0,v.hI)(h),c)}}}writePolygonGeometry_(e,t){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:e,geometry:t,depth:[n],index:a,segment:h};this.rBush_.insert((0,v.hI)(h),c)}}}writeMultiPolygonGeometry_(e,t){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a){const h=o[a];for(let c=0,u=h.length-1;c<u;++c){const d=h.slice(c,c+2),f={feature:e,geometry:t,depth:[a,n],index:c,segment:d};this.rBush_.insert((0,v.hI)(d),f)}}}}writeCircleGeometry_(e,t){const i=t.getCenter(),n={feature:e,geometry:t,index:qo,segment:[i,i]},r={feature:e,geometry:t,index:Tn,segment:[i,i]},o=[n,r];n.featureSegments=o,r.featureSegments=o,this.rBush_.insert((0,v.HK)(i),n);let a=t;const l=(0,A.Cs)();if(l&&this.getMap()){const h=this.getMap().getView().getProjection();a=a.clone().transform(l,h),a=(0,L.Bb)(a).transform(h,l)}this.rBush_.insert(a.getExtent(),r)}writeGeometryCollectionGeometry_(e,t){const i=t.getGeometriesArray();for(let n=0;n<i.length;++n){const r=i[n],o=this.SEGMENT_WRITERS_[r.getType()];o(e,r)}}createOrUpdateVertexFeature_(e,t,i){let n=this.vertexFeature_;return n?n.getGeometry().setCoordinates(e):(n=new ft.Z(new Jt.Z(e)),this.vertexFeature_=n,this.overlay_.getSource().addFeature(n)),n.set("features",t),n.set("geometries",i),n}handleEvent(e){if(!e.originalEvent)return!0;this.lastPointerEvent_=e;let t;return!e.map.getView().getInteracting()&&e.type==Se.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(e.type!=Se.SINGLECLICK||!this.ignoreNextSingleClick_?t=this.removePoint():t=!0),e.type==Se.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(e)&&!t}handleDragEvent(e){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(e,this.dragSegments_);const t=[e.coordinate[0]+this.delta_[0],e.coordinate[1]+this.delta_[1]],i=[],n=[];for(let r=0,o=this.dragSegments_.length;r<o;++r){const a=this.dragSegments_[r],l=a[0],h=l.feature;i.includes(h)||i.push(h);const c=l.geometry;n.includes(c)||n.push(c);const u=l.depth;let d;const f=l.segment,g=a[1];for(;t.length<c.getStride();)t.push(f[g][t.length]);switch(c.getType()){case"Point":d=t,f[0]=t,f[1]=t;break;case"MultiPoint":d=c.getCoordinates(),d[l.index]=t,f[0]=t,f[1]=t;break;case"LineString":d=c.getCoordinates(),d[l.index+g]=t,f[g]=t;break;case"MultiLineString":d=c.getCoordinates(),d[u[0]][l.index+g]=t,f[g]=t;break;case"Polygon":d=c.getCoordinates(),d[u[0]][l.index+g]=t,f[g]=t;break;case"MultiPolygon":d=c.getCoordinates(),d[u[1]][u[0]][l.index+g]=t,f[g]=t;break;case"Circle":if(f[0]=t,f[1]=t,l.index===qo)this.changingFeature_=!0,c.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;const m=e.map.getView().getProjection();let _=(0,he.TE)((0,A.Vs)(c.getCenter(),m),(0,A.Vs)(t,m));const x=(0,A.Cs)();if(x){const E=c.clone().transform(x,m);E.setRadius(_),_=E.transform(m,x).getRadius()}c.setRadius(_),this.changingFeature_=!1}break;default:}d&&this.setGeometryCoordinates_(c,d)}this.createOrUpdateVertexFeature_(t,i,n)}handleDownEvent(e){if(!this.condition_(e))return!1;const t=e.coordinate;this.handlePointerAtPixel_(e.pixel,e.map,t),this.dragSegments_.length=0,this.featuresBeingModified_=null;const i=this.vertexFeature_;if(i){const n=e.map.getView().getProjection(),r=[],o=i.getGeometry().getCoordinates(),a=(0,v.hI)([o]),l=this.rBush_.getInExtent(a),h={};l.sort(Lc);for(let c=0,u=l.length;c<u;++c){const d=l[c],f=d.segment;let g=(0,Y.sq)(d.geometry);const m=d.depth;if(m&&(g+="-"+m.join("-")),h[g]||(h[g]=new Array(2)),d.geometry.getType()==="Circle"&&d.index===Tn){const _=ea(t,d,n);(0,he.fS)(_,o)&&!h[g][0]&&(this.dragSegments_.push([d,0]),h[g][0]=d);continue}if((0,he.fS)(f[0],o)&&!h[g][0]){this.dragSegments_.push([d,0]),h[g][0]=d;continue}if((0,he.fS)(f[1],o)&&!h[g][1]){if(h[g][0]&&h[g][0].index===0){let _=d.geometry.getCoordinates();switch(d.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":_=_[m[1]];case"Polygon":if(d.index!==_[m[0]].length-2)continue;break;default:}}this.dragSegments_.push([d,1]),h[g][1]=d;continue}(0,Y.sq)(f)in this.vertexSegments_&&!h[g][0]&&!h[g][1]&&this.insertVertexCondition_(e)&&r.push(d)}r.length&&this.willModifyFeatures_(e,[r]);for(let c=r.length-1;c>=0;--c)this.insertVertex_(r[c],o)}return!!this.vertexFeature_}handleUpEvent(e){for(let t=this.dragSegments_.length-1;t>=0;--t){const i=this.dragSegments_[t][0],n=i.geometry;if(n.getType()==="Circle"){const r=n.getCenter(),o=i.featureSegments[0],a=i.featureSegments[1];o.segment[0]=r,o.segment[1]=r,a.segment[0]=r,a.segment[1]=r,this.rBush_.update((0,v.HK)(r),o);let l=n;const h=(0,A.Cs)();if(h){const c=e.map.getView().getProjection();l=l.clone().transform(h,c),l=(0,L.Bb)(l).transform(c,h)}this.rBush_.update(l.getExtent(),a)}else this.rBush_.update((0,v.hI)(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new cr(hr.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null),!1}handlePointerMove_(e){this.lastPixel_=e.pixel,this.handlePointerAtPixel_(e.pixel,e.map,e.coordinate)}handlePointerAtPixel_(e,t,i){const n=i||t.getCoordinateFromPixel(e),r=t.getView().getProjection(),o=function(h,c){return Qo(n,h,r)-Qo(n,c,r)};let a,l;if(this.hitDetection_){const h=typeof this.hitDetection_=="object"?c=>c===this.hitDetection_:void 0;t.forEachFeatureAtPixel(e,(c,u,d)=>{if(d=d||c.getGeometry(),d.getType()==="Point"&&this.features_.getArray().includes(c)){l=d;const f=d.getFlatCoordinates().slice(0,2);a=[{feature:c,geometry:d,segment:[f,f]}]}return!0},{layerFilter:h})}if(!a){const h=(0,A.dY)((0,v.HK)(n,Jo),r),c=t.getView().getResolution()*this.pixelTolerance_,u=(0,A.Fj)((0,v.f3)(h,c,Jo),r);a=this.rBush_.getInExtent(u)}if(a&&a.length>0){const h=a.sort(o)[0],c=h.segment;let u=ea(n,h,r);const d=t.getPixelFromCoordinate(u);let f=(0,he.TE)(e,d);if(l||f<=this.pixelTolerance_){const g={};if(g[(0,Y.sq)(c)]=!0,this.snapToPointer_||(this.delta_[0]=u[0]-n[0],this.delta_[1]=u[1]-n[1]),h.geometry.getType()==="Circle"&&h.index===Tn)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(u,[h.feature],[h.geometry]);else{const m=t.getPixelFromCoordinate(c[0]),_=t.getPixelFromCoordinate(c[1]),x=(0,he.bI)(d,m),E=(0,he.bI)(d,_);f=Math.sqrt(Math.min(x,E)),this.snappedToVertex_=f<=this.pixelTolerance_,this.snappedToVertex_&&(u=x>E?c[1]:c[0]),this.createOrUpdateVertexFeature_(u,[h.feature],[h.geometry]);const C={};C[(0,Y.sq)(h.geometry)]=!0;for(let b=1,M=a.length;b<M;++b){const F=a[b].segment;if((0,he.fS)(c[0],F[0])&&(0,he.fS)(c[1],F[1])||(0,he.fS)(c[0],F[1])&&(0,he.fS)(c[1],F[0])){const O=(0,Y.sq)(a[b].geometry);O in C||(C[O]=!0,g[(0,Y.sq)(F)]=!0)}else break}}this.vertexSegments_=g;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(e,t){const i=e.segment,n=e.feature,r=e.geometry,o=e.depth,a=e.index;let l;for(;t.length<r.getStride();)t.push(0);switch(r.getType()){case"MultiLineString":l=r.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"Polygon":l=r.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"MultiPolygon":l=r.getCoordinates(),l[o[1]][o[0]].splice(a+1,0,t);break;case"LineString":l=r.getCoordinates(),l.splice(a+1,0,t);break;default:return}this.setGeometryCoordinates_(r,l);const h=this.rBush_;h.remove(e),this.updateSegmentIndices_(r,a,o,1);const c={segment:[i[0],t],feature:n,geometry:r,depth:o,index:a};h.insert((0,v.hI)(c.segment),c),this.dragSegments_.push([c,1]);const u={segment:[t,i[1]],feature:n,geometry:r,depth:o,index:a+1};h.insert((0,v.hI)(u.segment),u),this.dragSegments_.push([u,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=Se.POINTERDRAG){const e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_);const t=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new cr(hr.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null,t}return!1}removeVertex_(){const e=this.dragSegments_,t={};let i=!1,n,r,o,a,l,h,c,u,d,f,g;for(l=e.length-1;l>=0;--l)o=e[l],f=o[0],g=(0,Y.sq)(f.feature),f.depth&&(g+="-"+f.depth.join("-")),g in t||(t[g]={}),o[1]===0?(t[g].right=f,t[g].index=f.index):o[1]==1&&(t[g].left=f,t[g].index=f.index+1);for(g in t){switch(d=t[g].right,c=t[g].left,h=t[g].index,u=h-1,c!==void 0?f=c:f=d,u<0&&(u=0),a=f.geometry,r=a.getCoordinates(),n=r,i=!1,a.getType()){case"MultiLineString":r[f.depth[0]].length>2&&(r[f.depth[0]].splice(h,1),i=!0);break;case"LineString":r.length>2&&(r.splice(h,1),i=!0);break;case"MultiPolygon":n=n[f.depth[1]];case"Polygon":n=n[f.depth[0]],n.length>4&&(h==n.length-1&&(h=0),n.splice(h,1),i=!0,h===0&&(n.pop(),n.push(n[0]),u=n.length-1));break;default:}if(i){this.setGeometryCoordinates_(a,r);const m=[];if(c!==void 0&&(this.rBush_.remove(c),m.push(c.segment[0])),d!==void 0&&(this.rBush_.remove(d),m.push(d.segment[1])),c!==void 0&&d!==void 0){const _={depth:f.depth,feature:f.feature,geometry:f.geometry,index:u,segment:m};this.rBush_.insert((0,v.hI)(_.segment),_)}this.updateSegmentIndices_(a,h,f.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.length=0}}return i}setGeometryCoordinates_(e,t){this.changingFeature_=!0,e.setCoordinates(t),this.changingFeature_=!1}updateSegmentIndices_(e,t,i,n){this.rBush_.forEachInExtent(e.getExtent(),function(r){r.geometry===e&&(i===void 0||r.depth===void 0||(0,U.fS)(r.depth,i))&&r.index>t&&(r.index+=n)})}}function Lc(s,e){return s.index-e.index}function Qo(s,e,t){const i=e.geometry;if(i.getType()==="Circle"){let r=i;if(e.index===Tn){const o=(0,A.Cs)();o&&(r=r.clone().transform(o,t));const a=(0,he.bI)(r.getCenter(),(0,A.Vs)(s,t)),l=Math.sqrt(a)-r.getRadius();return l*l}}const n=(0,A.Vs)(s,t);return Ni[0]=(0,A.Vs)(e.segment[0],t),Ni[1]=(0,A.Vs)(e.segment[1],t),(0,he.Bs)(n,Ni)}function ea(s,e,t){const i=e.geometry;if(i.getType()==="Circle"&&e.index===Tn){let r=i;const o=(0,A.Cs)();return o&&(r=r.clone().transform(o,t)),(0,A.lO)(r.getClosestPoint((0,A.Vs)(s,t)),t)}const n=(0,A.Vs)(s,t);return Ni[0]=(0,A.Vs)(e.segment[0],t),Ni[1]=(0,A.Vs)(e.segment[1],t),(0,A.lO)((0,he.oL)(n,Ni),t)}function Mc(){const s=bo();return function(e,t){return s.Point}}const Pc=bc;var Ac=R(25357);class Jn extends Cn.ZP{constructor(e,t,i){super(),i!==void 0&&t===void 0?this.setFlatCoordinates(i,e):(t=t||0,this.setCenterAndRadius(e,t,i))}clone(){const e=new Jn(this.flatCoordinates.slice(),void 0,this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,n){const r=this.flatCoordinates,o=e-r[0],a=t-r[1],l=o*o+a*a;if(l<n){if(l===0)for(let h=0;h<this.stride;++h)i[h]=r[h];else{const h=this.getRadius()/Math.sqrt(l);i[0]=r[0]+h*o,i[1]=r[1]+h*a;for(let c=2;c<this.stride;++c)i[c]=r[c]}return i.length=this.stride,l}else return n}containsXY(e,t){const i=this.flatCoordinates,n=e-i[0],r=t-i[1];return n*n+r*r<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(e){const t=this.flatCoordinates,i=t[this.stride]-t[0];return(0,v.T9)(t[0]-i,t[1]-i,t[0]+i,t[1]+i,e)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const e=this.flatCoordinates[this.stride]-this.flatCoordinates[0],t=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return e*e+t*t}getType(){return"Circle"}intersectsExtent(e){const t=this.getExtent();if((0,v.kK)(e,t)){const i=this.getCenter();return e[0]<=i[0]&&e[2]>=i[0]||e[1]<=i[1]&&e[3]>=i[1]?!0:(0,v.H6)(e,this.intersectsCoordinate.bind(this))}return!1}setCenter(e){const t=this.stride,i=this.flatCoordinates[t]-this.flatCoordinates[0],n=e.slice();n[t]=n[0]+i;for(let r=1;r<t;++r)n[t+r]=e[r];this.setFlatCoordinates(this.layout,n),this.changed()}setCenterAndRadius(e,t,i){this.setLayout(i,e,0),this.flatCoordinates||(this.flatCoordinates=[]);const n=this.flatCoordinates;let r=(0,Ac.IG)(n,0,e,this.stride);n[r++]=n[0]+t;for(let o=1,a=this.stride;o<a;++o)n[r++]=n[o];n.length=r,this.changed()}getCoordinates(){return null}setCoordinates(e,t){}setRadius(e){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+e,this.changed()}rotate(e,t){const i=this.getCenter(),n=this.getStride();this.setCenter((0,ni.U1)(i,0,i.length,n,e,t,i)),this.changed()}translate(e,t){const i=this.getCenter(),n=this.getStride();this.setCenter((0,ni.Iu)(i,0,i.length,n,e,t,i)),this.changed()}}Jn.prototype.transform;const ta=Jn;var Dc=R(36597);class Fc extends Bt.ZP{constructor(e,t,i){super(e),this.map=t,this.frameState=i!==void 0?i:null}}const zi=Fc;class Oc extends zi{constructor(e,t,i,n,r,o){super(e,t,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=n!==void 0?n:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const Xt=Oc;var Qn=R(72254),kc=R(80115),Gi=R(38407);const es={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class ts extends Bt.ZP{constructor(e,t){super(e),this.feature=t}}function Nc(s,e){const t=[];for(let i=0;i<e.length;++i){const r=e[i].getGeometry();ia(s,r,t)}return t}function is(s,e){return(0,w.bI)(s[0],s[1],e[0],e[1])}function Bi(s,e){const t=s.length;return e<0?s[e+t]:e>=t?s[e-t]:s[e]}function ns(s,e,t){let i,n;e<t?(i=e,n=t):(i=t,n=e);const r=Math.ceil(i),o=Math.floor(n);if(r>o){const l=Zi(s,i),h=Zi(s,n);return is(l,h)}let a=0;if(i<r){const l=Zi(s,i),h=Bi(s,r);a+=is(l,h)}if(o<n){const l=Bi(s,o),h=Zi(s,n);a+=is(l,h)}for(let l=r;l<o-1;++l){const h=Bi(s,l),c=Bi(s,l+1);a+=is(h,c)}return a}function ia(s,e,t){if(e instanceof lt.Z){ss(s,e.getCoordinates(),!1,t);return}if(e instanceof Qn.Z){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n)ss(s,i[n],!1,t);return}if(e instanceof L.ZP){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n)ss(s,i[n],!0,t);return}if(e instanceof Gi.Z){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a)ss(s,o[a],!0,t)}return}if(e instanceof Dc.Z){const i=e.getGeometries();for(let n=0;n<i.length;++n)ia(s,i[n],t);return}}const ur={index:-1,endIndex:NaN};function zc(s,e,t,i){const n=s[0],r=s[1];let o=1/0,a=-1,l=NaN;for(let u=0;u<e.targets.length;++u){const d=e.targets[u],f=d.coordinates;let g=1/0,m;for(let _=0;_<f.length-1;++_){const x=f[_],E=f[_+1],C=na(n,r,x,E);C.squaredDistance<g&&(g=C.squaredDistance,m=_+C.along)}g<o&&(o=g,d.ring&&e.targetIndex===u&&(d.endIndex>d.startIndex?m<d.startIndex&&(m+=f.length):d.endIndex<d.startIndex&&m>d.startIndex&&(m-=f.length)),l=m,a=u)}const h=e.targets[a];let c=h.ring;if(e.targetIndex===a&&c){const u=Zi(h.coordinates,l),d=t.getPixelFromCoordinate(u);(0,he.TE)(d,e.startPx)>i&&(c=!1)}if(c){const u=h.coordinates,d=u.length,f=h.startIndex,g=l;if(f<g){const m=ns(u,f,g);ns(u,f,g-d)<m&&(l-=d)}else{const m=ns(u,f,g);ns(u,f,g+d)<m&&(l+=d)}}return ur.index=a,ur.endIndex=l,ur}function ss(s,e,t,i){const n=s[0],r=s[1];for(let o=0,a=e.length-1;o<a;++o){const l=e[o],h=e[o+1],c=na(n,r,l,h);if(c.squaredDistance===0){const u=o+c.along;i.push({coordinates:e,ring:t,startIndex:u,endIndex:u});return}}}const dr={along:0,squaredDistance:0};function na(s,e,t,i){const n=t[0],r=t[1],o=i[0],a=i[1],l=o-n,h=a-r;let c=0,u=n,d=r;return(l!==0||h!==0)&&(c=(0,w.uZ)(((s-n)*l+(e-r)*h)/(l*l+h*h),0,1),u+=l*c,d+=h*c),dr.along=c,dr.squaredDistance=(0,w.FH)((0,w.bI)(s,e,u,d),10),dr}function Zi(s,e){const t=s.length;let i=Math.floor(e);const n=e-i;i>=t?i-=t:i<0&&(i+=t);let r=i+1;r>=t&&(r-=t);const o=s[i],a=o[0],l=o[1],h=s[r],c=h[0]-a,u=h[1]-l;return[a+c*n,l+u*n]}class Gc extends yi{constructor(e){const t=e;t.stopDown||(t.stopDown=ge.Dv),super(t),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=Zc(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:ge.uX,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let i=e.geometryFunction;if(!i){const n=this.mode_;if(n==="Circle")i=function(r,o,a){const l=o||new ta([NaN,NaN]),h=(0,A.Vs)(r[0],a),c=(0,he.bI)(h,(0,A.Vs)(r[r.length-1],a));l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_);const u=(0,A.Cs)();return u&&l.transform(a,u),l};else{let r;n==="Point"?r=Jt.Z:n==="LineString"?r=lt.Z:n==="Polygon"&&(r=L.ZP),i=function(o,a,l){return a?n==="Polygon"?o[0].length?a.setCoordinates([o[0].concat([o[0][0]])],this.geometryLayout_):a.setCoordinates([],this.geometryLayout_):a.setCoordinates(o,this.geometryLayout_):a=new r(o,this.geometryLayout_),a}}}this.geometryFunction_=i,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new je({source:new Et({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:Bc(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:Bs,this.freehandCondition_,e.freehand?this.freehandCondition_=Zn:this.freehandCondition_=e.freehandCondition?e.freehandCondition:ho,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(Ns.ACTIVE,this.updateState_)}setTrace(e){let t;e?e===!0?t=Zn:t=e:t=Gl,this.traceCondition_=t}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===me.Z.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let t=e.type===Se.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&e.type===Se.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,t=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===Se.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),i=!1):this.freehand_&&e.type===Se.POINTERDOWN?i=!1:t&&this.getPointerCount()<2?(i=e.type===Se.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===Se.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===Se.DBLCLICK&&(i=!1),super.handleEvent(e)&&i}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Xt(Se.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const t=this.getMap(),i=t.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),n=t.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),r=(0,v.hI)([i,n]),o=this.traceSource_.getFeaturesInExtent(r);if(o.length===0)return;const a=Nc(e.coordinate,o);a.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:a,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,t){const i=e.startIndex<=e.endIndex,n=e.startIndex<=t;i===n?i&&t>e.endIndex||!i&&t<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,t):(i&&t<e.endIndex||!i&&t>e.endIndex)&&this.removeTracedCoordinates_(t,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,t))}removeTracedCoordinates_(e,t){if(e===t)return;let i=0;if(e<t){const n=Math.ceil(e);let r=Math.floor(t);r===t&&(r-=1),i=r-n+1}else{const n=Math.floor(e);let r=Math.ceil(t);r===t&&(r+=1),i=n-r+1}i>0&&this.removeLastPoints_(i)}addTracedCoordinates_(e,t,i){if(t===i)return;const n=[];if(t<i){const r=Math.ceil(t);let o=Math.floor(i);o===i&&(o-=1);for(let a=r;a<=o;++a)n.push(Bi(e.coordinates,a))}else{const r=Math.floor(t);let o=Math.ceil(i);o===i&&(o+=1);for(let a=r;a>=o;--a)n.push(Bi(e.coordinates,a))}n.length&&this.appendCoordinates(n)}updateTrace_(e){const t=this.traceState_;if(!t.active||t.targetIndex===-1&&(0,he.TE)(t.startPx,e.pixel)<this.snapTolerance_)return;const i=zc(e.coordinate,t,this.getMap(),this.snapTolerance_);if(t.targetIndex!==i.index){if(t.targetIndex!==-1){const l=t.targets[t.targetIndex];this.removeTracedCoordinates_(l.startIndex,l.endIndex)}const a=t.targets[i.index];this.addTracedCoordinates_(a,a.startIndex,i.endIndex)}else{const a=t.targets[t.targetIndex];this.addOrRemoveTracedCoordinates_(a,i.endIndex)}t.targetIndex=i.index;const n=t.targets[t.targetIndex];n.endIndex=i.endIndex;const r=Zi(n.coordinates,n.endIndex),o=this.getMap().getPixelFromCoordinate(r);e.coordinate=r,e.pixel=[Math.round(o[0]),Math.round(o[1])]}handleUpEvent(e){let t=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const i=this.traceState_.active;if(this.toggleTraceState_(e),this.shouldHandle_){const n=!this.finishCoordinate_;n&&this.startDrawing_(e.coordinate),!n&&this.freehand_?this.finishDrawing():!this.freehand_&&(!n||this.mode_==="Point")&&(this.atFinish_(e.pixel,i)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),t=!1}else this.freehand_&&this.abortDrawing()}return!t&&this.stopClick_&&e.preventDefault(),t}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const t=this.downPx_,i=e.pixel,n=t[0]-i[0],r=t[1]-i[1],o=n*n+r*r;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,t){let i=!1;if(this.sketchFeature_){let n=!1,r=[this.finishCoordinate_];const o=this.mode_;if(o==="Point")i=!0;else if(o==="Circle")i=this.sketchCoords_.length===2;else if(o==="LineString")n=!t&&this.sketchCoords_.length>this.minPoints_;else if(o==="Polygon"){const a=this.sketchCoords_;n=a[0].length>this.minPoints_,r=[a[0][0],a[0][a[0].length-2]],t?r=[a[0][0]]:r=[a[0][0],a[0][a[0].length-2]]}if(n){const a=this.getMap();for(let l=0,h=r.length;l<h;l++){const c=r[l],u=a.getPixelFromCoordinate(c),d=e[0]-u[0],f=e[1]-u[1],g=this.freehand_?1:this.snapTolerance_;if(i=Math.sqrt(d*d+f*f)<=g,i){this.finishCoordinate_=c;break}}}}return i}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new ft.Z(new Jt.Z(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new ft.Z);const t=e.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(t.getLayout(),t.getFlatCoordinates()),i.changed()):(i=new lt.Z(t.getFlatCoordinates(),t.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(e){const t=this.getMap().getView().getProjection(),i=(0,Cn.tP)(this.geometryLayout_);for(;e.length<i;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new ft.Z(new lt.Z(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,t);this.sketchFeature_=new ft.Z,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new ts(es.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const t=this.getMap(),i=this.sketchFeature_.getGeometry(),n=t.getView().getProjection(),r=(0,Cn.tP)(this.geometryLayout_);let o,a;for(;e.length<r;)e.push(0);this.mode_==="Point"?a=this.sketchCoords_:this.mode_==="Polygon"?(o=this.sketchCoords_[0],a=o[o.length-1],this.atFinish_(t.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(o=this.sketchCoords_,a=o[o.length-1]),a[0]=e[0],a[1]=e[1],this.geometryFunction_(this.sketchCoords_,i,n),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),i.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(i):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const t=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();let n,r;const o=this.mode_;o==="LineString"||o==="Circle"?(this.finishCoordinate_=e.slice(),r=this.sketchCoords_,r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(e.slice()),this.geometryFunction_(r,t,i)):o==="Polygon"&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(e.slice()),n&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,t,i)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),n&&this.finishDrawing()}removeLastPoints_(e){if(!this.sketchFeature_)return;const t=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let r=0;r<e;++r){let o;if(n==="LineString"||n==="Circle"){if(o=this.sketchCoords_,o.splice(-2,1),o.length>=2){this.finishCoordinate_=o[o.length-2].slice();const a=this.finishCoordinate_.slice();o[o.length-1]=a,this.createOrUpdateSketchPoint_(a)}this.geometryFunction_(o,t,i),t.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(t)}else if(n==="Polygon"){o=this.sketchCoords_[0],o.splice(-2,1);const a=this.sketchLine_.getGeometry();if(o.length>=2){const l=o[o.length-2].slice();o[o.length-1]=l,this.createOrUpdateSketchPoint_(l)}a.setCoordinates(o),this.geometryFunction_(this.sketchCoords_,t,i)}if(o.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return;let t=this.sketchCoords_;const i=e.getGeometry(),n=this.getMap().getView().getProjection();this.mode_==="LineString"?(t.pop(),this.geometryFunction_(t,i,n)):this.mode_==="Polygon"&&(t[0].pop(),this.geometryFunction_(t,i,n),t=i.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new kc.Z([t])):this.type_==="MultiLineString"?e.setGeometry(new Qn.Z([t])):this.type_==="MultiPolygon"&&e.setGeometry(new Gi.Z([t])),this.dispatchEvent(new ts(es.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e)}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new ts(es.DRAWABORT,e))}appendCoordinates(e){const t=this.mode_,i=!this.sketchFeature_;i&&this.startDrawing_(e[0]);let n;if(t==="LineString"||t==="Circle")n=this.sketchCoords_;else if(t==="Polygon")n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;i&&n.shift(),n.pop();for(let o=0;o<e.length;o++)this.addToDrawing_(e[o]);const r=e[e.length-1];this.addToDrawing_(r),this.modifyDrawing_(r)}extend(e){const i=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=i.getCoordinates();const n=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=n.slice(),this.sketchCoords_.push(n.slice()),this.sketchPoint_=new ft.Z(new Jt.Z(n)),this.updateSketchFeatures_(),this.dispatchEvent(new ts(es.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const t=this.overlay_.getSource();t.clear(!0),t.addFeatures(e)}updateState_(){const e=this.getMap(),t=this.getActive();(!e||!t)&&this.abortDrawing(),this.overlay_.setMap(t?e:null)}}function Bc(){const s=bo();return function(e,t){return s[e.getGeometry().getType()]}}function Bg(s,e){return function(t,i,n){const r=fromUserCoordinate(t[0],n),o=fromUserCoordinate(t[t.length-1],n),a=Math.sqrt(squaredCoordinateDistance(r,o));i=i||fromCircle(new Circle(r),s);let l=e;if(!e&&e!==0){const c=o[0]-r[0],u=o[1]-r[1];l=Math.atan2(u,c)}makeRegular(i,r,a,l);const h=getUserProjection();return h&&i.transform(n,h),i}}function Zg(){return function(s,e,t){const i=boundingExtent([s[0],s[s.length-1]].map(function(o){return fromUserCoordinate(o,t)})),n=[[getBottomLeft(i),getBottomRight(i),getTopRight(i),getTopLeft(i),getBottomLeft(i)]];e?e.setCoordinates(n):e=new Polygon(n);const r=getUserProjection();return r&&e.transform(t,r),e}}function Zc(s){switch(s){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+s)}}const Wc=Gc;var sa=R(12527);class ra extends je{constructor(){super({source:new Et}),this.opts={action:"length",unit:"m"},this.segmentStyle=new we({text:new Fi({font:"12px Calibri,sans-serif",fill:new ke({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new ke({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textBaseline:"bottom",offsetY:-12}),image:new it({radius:6,points:3,angle:Math.PI,displacement:[0,8],fill:new ke({color:"rgba(0, 0, 0, 0.4)"})})}),this.segmentStyles=[this.segmentStyle],this.shapeStyle=[new we({fill:new ke({color:"rgba(255, 255, 255, 0.2)"}),image:new Dt({radius:5,stroke:new Oe({color:"rgba(0, 0, 0, 0.7)"}),fill:new ke({color:"rgba(255, 255, 255, 0.2)"})})}),new we({stroke:new Oe({color:[0,0,0,1],width:2,lineDash:[4,8],lineDashOffset:6})}),new we({stroke:new Oe({color:[255,255,255,1],width:2,lineDash:[4,8]})})],this.labelStyle=new we({text:new Fi({font:"14px Calibri,sans-serif",fill:new ke({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new ke({color:"rgba(0, 0, 0, 0.7)"}),padding:[3,3,3,3],textBaseline:"bottom",offsetY:-15}),image:new it({radius:8,points:3,angle:Math.PI,displacement:[0,10],fill:new ke({color:"rgba(0, 0, 0, 0.7)"})})}),this.tipStyle=new we({text:new Fi({font:"12px Calibri,sans-serif",fill:new ke({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new ke({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modifyStyle=new we({image:new Dt({radius:5,stroke:new Oe({color:"rgba(0, 0, 0, 0.7)"}),fill:new ke({color:"rgba(0, 0, 0, 0.4)"})}),text:new Fi({text:"Drag to modify",font:"12px Calibri,sans-serif",fill:new ke({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new ke({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modify=new Pc({source:this.getSource(),style:this.modifyStyle}),this.setStyle(e=>this.styleFunction(e,!1)),this.setVisible(!0)}setOptions(e){this.opts=e,this.getSource()?.refresh()}getMapMeasurement(e){let t=0,i=rt[0];return this.opts.action==="area"?(i=rt[1],t=(0,sa.bg)(e)):t=(0,sa.xA)(e),(0,xt.zc)(i.getUnit(this.opts.unit).format(t))}styleFunction(e,t,i,n){const r=[...this.shapeStyle],o=e.getGeometry();if(o){const a=o.getType();let l,h,c;if(!i||i===a)if(a==="Polygon"){const u=o;l=u.getInteriorPoint(),h=this.getMapMeasurement(o),c=new lt.Z(u.getCoordinates()[0])}else a==="LineString"&&(c=o,l=new Jt.Z(c.getLastCoordinate()),h=this.getMapMeasurement(o));if(t&&c){let u=0;c.forEachSegment((d,f)=>{const g=new lt.Z([d,f]),m=this.getMapMeasurement(g);this.segmentStyles.length-1<u&&this.segmentStyles.push(this.segmentStyle.clone());const _=new Jt.Z(g.getCoordinateAt(.5));this.segmentStyles[u].setGeometry(_),this.segmentStyles[u].getText().setText(m),r.push(this.segmentStyles[u]),u++})}h&&(this.labelStyle.setGeometry(l),this.labelStyle.getText().setText(h),r.push(this.labelStyle)),n&&a==="Point"&&!this.modify.getOverlay().getSource().getFeatures().length&&(this.tipPoint=o,this.tipStyle.getText().setText(n),r.push(this.tipStyle))}return r}addInteraction(e,t,i,n){const r=t,o=" Click to continue "+(r==="Polygon"?"polygon":"line")+` 
 (double-click to end) `,a=" Click to start ";let l=a;this.draw=new Wc({source:this.getSource(),type:r,style:h=>this.styleFunction(h,i,r,l)}),this.draw.on("drawstart",()=>{n&&this.getSource().clear(),this.modify.setActive(!1),l=o}),this.draw.on("drawend",()=>{this.modifyStyle.setGeometry(this.tipPoint),this.modify.setActive(!0),e.once("pointermove",()=>{this.modifyStyle.setGeometry("")}),l=a}),this.modify.setActive(!0),e.addInteraction(this.draw)}}const Uc=({map:s,menuActiveState:e})=>{const t=(0,p.useRef)(new ra),i=Vc(pi.vc.theme2),[n,r]=(0,p.useState)(!0),[o,a]=(0,p.useState)(!1),[l,h]=(0,p.useState)({action:rt[0].value,unit:rt[0].units[0].value}),c=(0,p.useMemo)(()=>{const g=rt.find(_=>_.value===l.action)??rt[0],m=g.getUnit(l.unit);return t.current.setOptions(l),{current:m,options:g.units}},[l]),u=!0,d=!1;function f(){if(a(!o),e(!o),o)s.removeInteraction(t.current.draw),t.current.setVisible(!1);else{n&&(r(!1),t.current.setZIndex(1),s.addLayer(t.current),s.addInteraction(t.current.modify)),t.current.setVisible(!0),s.removeInteraction(t.current.draw);const g=rt.find(m=>m.value===l.action)??rt[0];t.current.addInteraction(s,g.geometry,d,u)}}return p.createElement("div",{className:`${i.infoWrap} ${o?null:i.infoWrapClosed}`},o?p.createElement("div",null,p.createElement("div",{className:i.rowGroup},p.createElement(Un.S,{value:l.action,options:rt,size:"md",fullWidth:!1,onChange:g=>{s.removeInteraction(t.current.draw);const m=rt.find(x=>x.value===g)??rt[0],_=m.getUnit(l.unit);h({...l,action:m.value,unit:_.value}),t.current.addInteraction(s,m.geometry,d,u)}}),p.createElement(Vn.zx,{className:i.button,icon:"times",variant:"secondary",size:"sm",onClick:f})),p.createElement(Li.Ph,{className:i.unitSelect,value:c.current,options:c.options,isSearchable:!1,onChange:g=>{const m=rt.find(x=>x.value===l.action)??rt[0],_=m.getUnit(g.value)??m.units[0];h({...l,unit:_.value})}})):p.createElement(Us.h,{className:i.icon,name:"ruler-combined",tooltip:"show measure tools",tooltipPlacement:"left",onClick:f}))},Vc=(0,mo.B)(s=>({button:B.css`
    margin-left: auto;
  `,icon:B.css`
    background-color: ${s.colors.secondary.main};
    display: inline-block;
    height: 19.25px;
    margin: 1px;
    width: 19.25px;
  `,infoWrap:B.css`
    color: ${s.colors.text};
    background-color: ${s.colors.background.secondary};
    border-radius: 4px;
    padding: 2px;
  `,infoWrapClosed:B.css`
    height: 25.25px;
    width: 25.25px;
  `,rowGroup:B.css`
    display: flex;
    justify-content: flex-end;
  `,unitSelect:B.css`
    min-width: 200px;
  `}));var Wg=R(7537),Ug=R(67575);function Xc(s){return be.css`
    .ol-scale-line {
      background: ${s.colors.border.weak}; // rgba(0,60,136,0.3);
    }
    .ol-scale-line-inner {
      border: 1px solid ${s.colors.text.primary}; // #eee;
      border-top: 0px;
      color: ${s.colors.text.primary}; //  #eee;
    }
    .ol-control {
      background-color: ${s.colors.background.primary}; //rgba(255,255,255,0.4);
    }
    .ol-control:hover {
      background-color: ${s.colors.background.secondary}; // rgba(255,255,255,0.6);
    }
    .ol-control button {
      color: ${s.colors.secondary.text}; // white;
      background-color: ${s.colors.secondary.main}; // rgba(0,60,136,0.5);
    }
    .ol-control button:hover {
      color: ${s.colors.secondary.text};
      background-color: ${s.colors.secondary.shade}; // rgba(0,60,136,0.5);
    }
    .ol-control button:focus {
      color: ${s.colors.secondary.text};
      background-color: ${s.colors.secondary.main}; // rgba(0,60,136,0.5);
    }
    .ol-attribution ul {
      color: ${s.colors.text.primary}; //  #000;
      text-shadow: none;
    }
    .ol-attribution:not(.ol-collapsed) {
      background-color: ${s.colors.background.secondary}; // rgba(255,255,255,0.8);
    }
  `}var Sn=R(40538),Yt=R(43524);class Yc extends p.Component{constructor(e){super(e),this.state={subProps:e.initialSubProps}}componentDidMount(){this.sub=this.props.watch.subscribe({next:e=>{this.setState({subProps:e})},complete:()=>{},error:e=>{}})}componentWillUnmount(){this.sub&&this.sub.unsubscribe()}render(){const{subProps:e}=this.state;return p.createElement(this.props.child,{...e})}}var rs=R(3499),oa=R(53786),aa=R(425),jc=R(59309),Kc=R(10),Hc=R(16964),$c=R(97551);function qc(s){const{layerName:e,styleConfig:t,layer:i}=s,n=(0,bi.wW)(Jc),r=(0,rs.Z)(i?.__state?.mouseEvents??(0,oa.of)(void 0)),o=t?.dims?.color?.field,a=(0,p.useMemo)(()=>{if(!o||!r)return;const g=r.getProperties();if(!g.frame)return;const _=g.rowIndex;return o.values.get(_)},[r,o]);if(!t)return p.createElement(p.Fragment,null);const{color:l,opacity:h}=t?.base??{},c=t?.config.symbol?.fixed;if(l&&c&&!o)return p.createElement("div",{className:n.infoWrap},p.createElement("div",{className:n.layerName},e),p.createElement("div",{className:(0,B.cx)(n.layerBody,n.fixedColorContainer)},p.createElement(Hc.V,{src:`public/${c}`,className:n.legendSymbol,title:"Symbol",style:{fill:l,opacity:h}})));if(!o)return p.createElement(p.Fragment,null);const u=(0,aa.fD)(o);if(u.isContinuous&&u.getColors){const g=u.getColors(pi.vc.theme2),m=(0,jc.dz)(o),_=o.display?x=>(0,xt.zc)(o.display(x)):x=>`${x}`;return p.createElement("div",{className:n.infoWrap},p.createElement("div",{className:n.layerName},e),p.createElement("div",{className:(0,B.cx)(n.layerBody,n.colorScaleWrapper)},p.createElement(Kc.q,{hoverValue:a,colorPalette:g,min:m.min,max:m.max,display:_,useStopsPercentage:!1})))}const d=o?.config?.thresholds;if(!d||d.steps.length<2)return p.createElement("div",null);const f=(0,$c.Ur)(o.config,pi.vc.theme2);return p.createElement("div",{className:n.infoWrap},p.createElement("div",{className:n.layerName},e),p.createElement("div",{className:(0,B.cx)(n.layerBody,n.legend)},f.map((g,m)=>p.createElement("div",{key:`${m}/${g.label}`,className:n.legendItem},p.createElement("i",{style:{background:g.color}}),g.label))))}const Jc=s=>({infoWrap:B.css`
    display: flex;
    flex-direction: column;
    background: ${s.colors.background.secondary};
    border-radius: 1px;
    padding: ${s.spacing(1)};
    border-bottom: 2px solid ${s.colors.border.strong};
    min-width: 150px;
  `,layerName:B.css`
    font-size: ${s.typography.body.fontSize};
  `,layerBody:B.css`
    padding-left: 10px;
  `,legend:B.css`
    line-height: 18px;
    display: flex;
    flex-direction: column;
    font-size: ${s.typography.bodySmall.fontSize};
    padding: 5px 10px 0;

    i {
      width: 15px;
      height: 15px;
      float: left;
      margin-right: 8px;
      opacity: 0.7;
      border-radius: 50%;
    }
  `,legendItem:B.css`
    white-space: nowrap;
  `,fixedColorContainer:B.css`
    min-width: 80px;
    font-size: ${s.typography.bodySmall.fontSize};
    padding-top: 5px;
  `,legendSymbol:B.css`
    height: 18px;
    width: 18px;
    margin: auto;
  `,colorScaleWrapper:B.css`
    min-width: 200px;
    font-size: ${s.typography.bodySmall.fontSize};
    padding-top: 10px;
  `});var fr=R(16527),Je=R(25532),Wi=(s=>(s.Point="point",s.Line="line",s.Polygon="polygon",s.Any="*any*",s))(Wi||{});const Ot=5;var Ei=(s=>(s.Left="left",s.Center="center",s.Right="right",s))(Ei||{}),Ci=(s=>(s.Top="top",s.Middle="middle",s.Bottom="bottom",s))(Ci||{});const fe=Object.freeze({size:{fixed:Ot,min:2,max:15},color:{fixed:"dark-green"},opacity:.4,symbol:{mode:Je.ResourceDimensionMode.Fixed,fixed:"img/icons/marker/circle.svg"},textConfig:{fontSize:12,textAlign:"center",textBaseline:"middle",offsetX:0,offsetY:0},rotation:{fixed:0,mode:Je.ScalarDimensionMode.Mod,min:-360,max:360}});var bt=R(11543),mt=R(81764),Ct=R(24799),Qc=R(77117),eu=R(90208),gr=R(52081),mr=R(23712),la=R(74912),ai=R(54643),_r=R(92484),tu=R(40314),os=R(64140),iu=(s=>(s.circle="circle",s.square="square",s.triangle="triangle",s.star="star",s.cross="cross",s.x="x",s))(iu||{});const Ui={circle:"img/icons/marker/circle.svg",square:"img/icons/marker/square.svg",triangle:"img/icons/marker/triangle.svg",star:"img/icons/marker/star.svg",cross:"img/icons/marker/cross.svg",x:"img/icons/marker/x-mark.svg"};function Vi(s){const e=s.opacity==null?.8:s.opacity;if(e===1)return new ke({color:s.color});if(e>0){const t=ln()(s.color).setAlpha(e).toRgbString();return new ke({color:t})}}function nu(s){const e=s.opacity==null?.8:s.opacity;if(e===1)return new Oe({color:s.color,width:s.lineWidth??1});if(e>0){const t=ln()(s.color).setAlpha(e).toRgbString();return new Oe({color:t,width:s.lineWidth??1})}}const kt=s=>{if(!s.text)return;const e=X.v.theme2.typography.fontFamily,t={...fe.textConfig,...s.textConfig};return new Fi({text:s.text,fill:new ke({color:s.color??fe.color.fixed}),font:`normal ${t.fontSize}px ${e}`,...t})},su=s=>new we({text:kt(s)}),ha=s=>{const e=new Oe({color:s.color,width:s.lineWidth??1});return new we({image:new Dt({stroke:e,fill:Vi(s),radius:s.size??Ot}),text:kt(s),stroke:e})},as=s=>new we({fill:Vi(s),stroke:new Oe({color:s.color,width:s.lineWidth??1}),text:kt(s)}),pr=s=>new we({fill:Vi(s),stroke:nu(s),text:kt(s)}),ca=s=>{const e=s.size??Ot,t=new Oe({color:"#F00",width:1});return[new we({image:new it({stroke:t,points:4,radius:e,angle:Math.PI/4})}),new we({image:new it({stroke:t,points:4,radius:e,radius2:0,angle:0})})]},ru=[{id:"circle",name:"Circle",aliasIds:[Ui.circle],make:ha},{id:"square",name:"Square",aliasIds:[Ui.square],make:s=>{const e=s.size??Ot,t=s.rotation??0;return new we({image:new it({stroke:new Oe({color:s.color,width:s.lineWidth??1}),fill:Vi(s),points:4,radius:e,rotation:t*Math.PI/180+Math.PI/4}),text:kt(s)})}},{id:"triangle",name:"Triangle",aliasIds:[Ui.triangle],make:s=>{const e=s.size??Ot,t=s.rotation??0;return new we({image:new it({stroke:new Oe({color:s.color,width:s.lineWidth??1}),fill:Vi(s),points:3,radius:e,rotation:t*Math.PI/180,angle:0}),text:kt(s)})}},{id:"star",name:"Star",aliasIds:[Ui.star],make:s=>{const e=s.size??Ot,t=s.rotation??0;return new we({image:new it({stroke:new Oe({color:s.color,width:s.lineWidth??1}),fill:Vi(s),points:5,radius:e,radius2:e*.4,angle:0,rotation:t*Math.PI/180}),text:kt(s)})}},{id:"cross",name:"Cross",aliasIds:[Ui.cross],make:s=>{const e=s.size??Ot,t=s.rotation??0;return new we({image:new it({stroke:new Oe({color:s.color,width:s.lineWidth??1}),points:4,radius:e,radius2:0,angle:0,rotation:t*Math.PI/180}),text:kt(s)})}},{id:"x",name:"X",aliasIds:[Ui.x],make:s=>{const e=s.size??Ot,t=s.rotation??0;return new we({image:new it({stroke:new Oe({color:s.color,width:s.lineWidth??1}),points:4,radius:e,radius2:0,rotation:t*Math.PI/180+Math.PI/4}),text:kt(s)})}}];async function ou(s,e){return fetch(s,{method:"GET"}).then(t=>t.text()).then(t=>{t=tu.sanitize(t,{USE_PROFILES:{svg:!0,svgFilters:!0}});const r=new DOMParser().parseFromString(t,"image/svg+xml").getElementsByTagName("svg")[0];if(!r)return"";const o=e??100,a=r.getAttribute("width")??o,l=r.getAttribute("height")??o;r.setAttribute("fill","#fff"),r.setAttribute("width",`${a}px`),r.setAttribute("height",`${l}px`);const h=new XMLSerializer().serializeToString(r);return`data:image/svg+xml,${encodeURIComponent(h)}`}).catch(t=>(console.error(t),""))}const yr=new os.B(()=>ru);function au(s){const e=yr.getIfExists(s);if(e?.aliasIds?.length)return e.aliasIds[0]}async function lu(s,e){if(!s)return e?su:ha;let t=yr.getIfExists(s);if(t)return t.make;if(s.endsWith(".svg")){const i=await ou((0,Je.getPublicOrAbsoluteUrl)(s));return t={id:s,name:s,aliasIds:[],make:i?n=>{const r=n.size??Ot,o=n.rotation??0;return[new we({image:new $n({src:i,color:n.color,opacity:n.opacity??1,scale:(Ot+r)/100,rotation:o*Math.PI/180}),text:n?.text?kt(n):void 0}),new we({image:new it({fill:new ke({color:"rgba(0,0,0,0)"}),points:4,radius:n.size,rotation:o*Math.PI/180+Math.PI/4})})]}:ca},yr.register(t),t.make}return ca}function ua(s){const e=s?.text;return e?!!(e.mode===Je.TextDimensionMode.Fixed&&e.fixed?.length||e.mode===Je.TextDimensionMode.Field&&e.field?.length):!1}async function wi(s){s||(s=fe);const e=ua(s),t={},i=await lu(s.symbol?.fixed,e),n={config:s,hasText:e,fields:t,base:{color:X.v.theme2.visualization.getColorByName(s.color?.fixed??fe.color.fixed),opacity:s.opacity??fe.opacity,lineWidth:s.lineWidth??1,size:s.size?.fixed??fe.size.fixed,rotation:s.rotation?.fixed??fe.rotation.fixed},maker:i};return s.color?.field?.length&&(t.color=s.color.field),s.size?.field?.length&&(t.size=s.size.field),s.rotation?.field?.length&&(t.rotation=s.rotation.field),e&&(n.base.text=s.text?.fixed,n.base.textConfig=s.textConfig??fe.textConfig,s.text?.field?.length&&(t.text=s.text.field)),Object.keys(t).length||(n.fields=void 0),n}const Xi=({value:s,context:e,onChange:t,item:i})=>{const n=i.settings,r=C=>{t({...s,size:C})},o=C=>{t({...s,symbol:C})},a=C=>{t({...s,color:C})},l=C=>{t({...s,opacity:C})},h=C=>{t({...s,rotation:C})},c=C=>{t({...s,text:C})},u=C=>{t({...s,textConfig:{...s.textConfig,fontSize:C}})},d=C=>{t({...s,textConfig:{...s.textConfig,offsetX:C}})},f=C=>{t({...s,textConfig:{...s.textConfig,offsetY:C}})},g=C=>{t({...s,textConfig:{...s.textConfig,textAlign:C}})},m=C=>{t({...s,textConfig:{...s.textConfig,textBaseline:C}})},x=(0,rs.Z)(n?.layerInfo??(0,oa.of)())?.geometryType===Wi.Point,E=ua(s);return n?.simpleFixedValues?p.createElement(p.Fragment,null,x&&p.createElement(p.Fragment,null,p.createElement(bt.Z,null,p.createElement(mt._,{label:"Symbol"},p.createElement(ai.Lv,{value:s?.symbol??fe.symbol,context:e,onChange:o,item:{settings:{resourceType:"icon",folderName:_r.QS.Marker,placeholderText:E?"Select a symbol":"Select a symbol or add a text label",placeholderValue:fe.symbol.fixed,showSourceRadio:!1}}}))),p.createElement(Ct.g,{label:"Rotation angle"},p.createElement(ai.k9,{value:s?.rotation??fe.rotation,context:e,onChange:h,item:{settings:{min:fe.rotation.min,max:fe.rotation.max}}}))),p.createElement(bt.Z,null,p.createElement(mt._,{label:"Color",labelWidth:10},p.createElement(Qc.W,{width:4},p.createElement(eu.zH,{color:s?.color?.fixed??fe.color.fixed,onChange:C=>{a({fixed:C})}})))),p.createElement(bt.Z,null,p.createElement(mt._,{label:"Opacity",labelWidth:10,grow:!0},p.createElement(la.p,{value:s?.opacity??fe.opacity,context:e,onChange:l,item:{settings:{min:0,max:1,step:.1}}})))):p.createElement(p.Fragment,null,p.createElement(Ct.g,{label:"Size"},p.createElement(ai.cL,{value:s?.size??fe.size,context:e,onChange:r,item:{settings:{min:1,max:100}}})),p.createElement(Ct.g,{label:"Symbol"},p.createElement(ai.Lv,{value:s?.symbol??fe.symbol,context:e,onChange:o,item:{settings:{resourceType:"icon",folderName:_r.QS.Marker,placeholderText:E?"Select a symbol":"Select a symbol or add a text label",placeholderValue:fe.symbol.fixed,showSourceRadio:!1}}})),p.createElement(Ct.g,{label:"Color"},p.createElement(ai.Lm,{value:s?.color??fe.color,context:e,onChange:a,item:{}})),p.createElement(Ct.g,{label:"Fill opacity"},p.createElement(la.p,{value:s?.opacity??fe.opacity,context:e,onChange:l,item:{settings:{min:0,max:1,step:.1}}})),n?.displayRotation&&p.createElement(Ct.g,{label:"Rotation angle"},p.createElement(ai.k9,{value:s?.rotation??fe.rotation,context:e,onChange:h,item:{settings:{min:fe.rotation.min,max:fe.rotation.max}}})),p.createElement(Ct.g,{label:"Text label"},p.createElement(ai.$2,{value:s?.text??_r.qj,context:e,onChange:c,item:{}})),E&&p.createElement(p.Fragment,null,p.createElement(gr.Lh,null,p.createElement(Ct.g,{label:"Font size"},p.createElement(mr.w,{value:s?.textConfig?.fontSize??fe.textConfig.fontSize,context:e,onChange:u,item:{}})),p.createElement(Ct.g,{label:"X offset"},p.createElement(mr.w,{value:s?.textConfig?.offsetX??fe.textConfig.offsetX,context:e,onChange:d,item:{}})),p.createElement(Ct.g,{label:"Y offset"},p.createElement(mr.w,{value:s?.textConfig?.offsetY??fe.textConfig.offsetY,context:e,onChange:f,item:{}}))),p.createElement(Ct.g,{label:"Align"},p.createElement(Un.S,{value:s?.textConfig?.textAlign??fe.textConfig.textAlign,onChange:g,options:[{value:Ei.Left,label:(0,dt.capitalize)(Ei.Left)},{value:Ei.Center,label:(0,dt.capitalize)(Ei.Center)},{value:Ei.Right,label:(0,dt.capitalize)(Ei.Right)}]})),p.createElement(Ct.g,{label:"Baseline"},p.createElement(Un.S,{value:s?.textConfig?.textBaseline??fe.textConfig.textBaseline,onChange:m,options:[{value:Ci.Top,label:(0,dt.capitalize)(Ci.Top)},{value:Ci.Middle,label:(0,dt.capitalize)(Ci.Middle)},{value:Ci.Bottom,label:(0,dt.capitalize)(Ci.Bottom)}]}))))};class ls extends Et{constructor(e){super({}),this.location=e}update(e){this.clear(!0);const t=(0,Yt.g6)(e,this.location);if(!t.field){this.changed();return}for(let i=0;i<e.length;i++)this.addFeatureInternal(new ft.Z({frame:e,rowIndex:i,geometry:t.field.values.get(i)}));this.changed()}updateLineString(e){this.clear(!0);const t=(0,Yt.g6)(e,this.location);if(!t.field){this.changed();return}const i=t.field,n=new lt.Z(i.values.toArray().map(r=>r.getCoordinates()));this.addFeatureInternal(new ft.Z({frame:e,rowIndex:0,geometry:n})),this.changed()}}var xr=R(31928);class hu extends xr.Z{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){(0,Y.O3)()}calculateMatrices2D(e){const t=e.viewState,i=e.coordinateToPixelTransform,n=e.pixelToCoordinateTransform;(0,H.qC)(i,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),(0,H.nb)(n,i)}forEachFeatureAtCoordinate(e,t,i,n,r,o,a,l){let h;const c=t.viewState;function u(b,M,F,O){return r.call(o,M,b?F:null,O)}const d=c.projection,f=(0,he.Cf)(e.slice(),d),g=[[0,0]];if(d.canWrapX()&&n){const b=d.getExtent(),M=(0,v.dz)(b);g.push([-M,0],[M,0])}const m=t.layerStatesArray,_=m.length,x=[],E=[];for(let b=0;b<g.length;b++)for(let M=_-1;M>=0;--M){const F=m[M],O=F.layer;if(O.hasRenderer()&&Os(F,c)&&a.call(l,O)){const W=O.getRenderer(),q=O.getSource();if(W&&q){const ie=q.getWrapX()?f:e,ye=u.bind(null,F.managed);E[0]=ie[0]+g[b][0],E[1]=ie[1]+g[b][1],h=W.forEachFeatureAtCoordinate(E,t,i,ye,x)}if(h)return h}}if(x.length===0)return;const C=1/x.length;return x.forEach((b,M)=>b.distanceSq+=M*C),x.sort((b,M)=>b.distanceSq-M.distanceSq),x.some(b=>h=b.callback(b.feature,b.layer,b.geometry)),h}hasFeatureAtCoordinate(e,t,i,n,r,o){return this.forEachFeatureAtCoordinate(e,t,i,n,ge.uX,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(e){(0,Y.O3)()}scheduleExpireIconCache(e){Hn.canExpireCache()&&e.postRenderFunctions.push(cu)}}function cu(s,e){Hn.expire()}const uu=hu;class du extends uu{constructor(e){super(e),this.fontChangeListenerKey_=(0,j.oL)(Wt,wn.Z.PROPERTYCHANGE,e.redrawText.bind(e)),this.element_=document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=sn+" ol-layers";const i=e.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const i=this.getMap();if(i.hasListener(e)){const n=new En(e,void 0,t);i.dispatchEvent(n)}}disposeInternal(){(0,j.bN)(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(at.PRECOMPOSE,e);const t=e.layerStatesArray.sort(function(o,a){return o.zIndex-a.zIndex}),i=e.viewState;this.children_.length=0;const n=[];let r=null;for(let o=0,a=t.length;o<a;++o){const l=t[o];e.layerIndex=o;const h=l.layer,c=h.getSourceState();if(!Os(l,i)||c!="ready"&&c!="undefined"){h.unrender();continue}const u=h.render(e,r);u&&(u!==r&&(this.children_.push(u),r=u),"getDeclutter"in h&&n.push(h))}for(let o=n.length-1;o>=0;--o)n[o].renderDeclutter(e);Tl(this.element_,this.children_),this.dispatchRenderEvent(at.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}}const fu=du;class li extends Bt.ZP{constructor(e,t){super(e),this.layer=t}}const vr={LAYERS:"layers"};class Er extends so{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let i=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(vr.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new vt(i.slice(),{unique:!0}):(0,T.h)(typeof i.getArray=="function",43):i=new vt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(j.bN),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push((0,j.oL)(e,tt.ADD,this.handleLayersAdd_,this),(0,j.oL)(e,tt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(j.bN);(0,Qt.Z)(this.listenerKeys_);const t=e.getArray();for(let i=0,n=t.length;i<n;i++){const r=t[i];this.registerLayerListeners_(r),this.dispatchEvent(new li("addlayer",r))}this.changed()}registerLayerListeners_(e){const t=[(0,j.oL)(e,wn.Z.PROPERTYCHANGE,this.handleLayerChange_,this),(0,j.oL)(e,me.Z.CHANGE,this.handleLayerChange_,this)];e instanceof Er&&t.push((0,j.oL)(e,"addlayer",this.handleLayerGroupAdd_,this),(0,j.oL)(e,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[(0,Y.sq)(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new li("addlayer",e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new li("removelayer",e.layer))}handleLayersAdd_(e){const t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new li("addlayer",t)),this.changed()}handleLayersRemove_(e){const t=e.element,i=(0,Y.sq)(t);this.listenerKeys_[i].forEach(j.bN),delete this.listenerKeys_[i],this.dispatchEvent(new li("removelayer",t)),this.changed()}getLayers(){return this.get(vr.LAYERS)}setLayers(e){const t=this.getLayers();if(t){const i=t.getArray();for(let n=0,r=i.length;n<r;++n)this.dispatchEvent(new li("removelayer",i[n]))}this.set(vr.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){const t=e!==void 0?e:[],i=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});const n=this.getLayerState();let r=n.zIndex;!e&&n.zIndex===void 0&&(r=0);for(let o=i,a=t.length;o<a;o++){const l=t[o];l.opacity*=n.opacity,l.visible=l.visible&&n.visible,l.maxResolution=Math.min(l.maxResolution,n.maxResolution),l.minResolution=Math.max(l.minResolution,n.minResolution),l.minZoom=Math.max(l.minZoom,n.minZoom),l.maxZoom=Math.min(l.maxZoom,n.maxZoom),n.extent!==void 0&&(l.extent!==void 0?l.extent=(0,v.Ed)(l.extent,n.extent):l.extent=n.extent),l.zIndex===void 0&&(l.zIndex=r)}return t}getSourceState(){return"ready"}}const hi=Er,Cr={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class gu extends er.Z{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=(0,j.oL)(i,Cr.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=(0,j.oL)(i,Cr.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(me.Z.TOUCHMOVE,this.boundHandleTouchMove_,He.bM?{passive:!1}:!1)}emulateClick_(e){let t=new Xt(Se.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Xt(Se.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=void 0;const i=new Xt(Se.SINGLECLICK,this.map_,e);this.dispatchEvent(i)}.bind(this),250)}updateActivePointers_(e){const t=e,i=t.pointerId;if(t.type==Se.POINTERUP||t.type==Se.POINTERCANCEL){delete this.trackedTouches_[i];for(const n in this.trackedTouches_)if(this.trackedTouches_[n].target!==t.target){delete this.trackedTouches_[n];break}}else(t.type==Se.POINTERDOWN||t.type==Se.POINTERMOVE)&&(this.trackedTouches_[i]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new Xt(Se.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(j.bN),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);const t=new Xt(Se.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.down_={};for(const i in e){const n=e[i];this.down_[i]=typeof n=="function"?ge.Zn:n}if(this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push((0,j.oL)(i,Se.POINTERMOVE,this.handlePointerMove_,this),(0,j.oL)(i,Se.POINTERUP,this.handlePointerUp_,this),(0,j.oL)(this.element_,Se.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push((0,j.oL)(this.element_.getRootNode(),Se.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new Xt(Se.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Xt(Se.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&((0,j.bN)(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(me.Z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&((0,j.bN)(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(j.bN),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const mu=gu,nt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},hs=1/0;class _u{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,(0,Qt.Z)(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,i=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(e){(0,T.h)(!(this.keyFunction_(e)in this.queuedElements_),31);const t=this.priorityFunction_(e);return t!=hs?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,i=this.priorities_,n=t.length,r=t[e],o=i[e],a=e;for(;e<n>>1;){const l=this.getLeftChildIndex_(e),h=this.getRightChildIndex_(e),c=h<n&&i[h]<i[l]?h:l;t[e]=t[c],i[e]=i[c],e=c}t[e]=r,i[e]=o,this.siftDown_(a,e)}siftDown_(e,t){const i=this.elements_,n=this.priorities_,r=i[t],o=n[t];for(;t>e;){const a=this.getParentIndex_(t);if(n[a]>o)i[t]=i[a],n[t]=n[a],t=a;else break}i[t]=r,n[t]=o}reprioritize(){const e=this.priorityFunction_,t=this.elements_,i=this.priorities_;let n=0;const r=t.length;let o,a,l;for(a=0;a<r;++a)o=t[a],l=e(o),l==hs?delete this.queuedElements_[this.keyFunction_(o)]:(i[n]=l,t[n++]=o);t.length=n,i.length=n,this.heapify_()}}const pu=_u,ae={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class yu extends pu{constructor(e,t){super(function(i){return e.apply(null,i)},function(i){return i[0].getKey()}),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){const t=super.enqueue(e);return t&&e[0].addEventListener(me.Z.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){const t=e.target,i=t.getState();if(i===ae.LOADED||i===ae.ERROR||i===ae.EMPTY){i!==ae.ERROR&&t.removeEventListener(me.Z.CHANGE,this.boundHandleTileChange_);const n=t.getKey();n in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[n],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let i=0,n,r,o;for(;this.tilesLoading_<e&&i<t&&this.getCount()>0;)r=this.dequeue()[0],o=r.getKey(),n=r.getState(),n===ae.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++i,r.load())}}const xu=yu;function vu(s,e,t,i,n){if(!s||!(t in s.wantedTiles)||!s.wantedTiles[t][e.getKey()])return hs;const r=s.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}class Eu extends zn{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});const t=e.className!==void 0?e.className:"ol-rotate",i=e.label!==void 0?e.label:"\u21E7",n=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(me.Z.CLICK,this.handleClick_.bind(this),!1);const a=t+" "+sn+" "+Fs,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Gn)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const i=t.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:y}):t.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const i=t.viewState.rotation;if(i!=this.rotation_){const n="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Gn);!r&&i===0?this.element.classList.add(Gn):r&&i!==0&&this.element.classList.remove(Gn)}this.label_.style.transform=n}this.rotation_=i}}const Cu=Eu;function wu(s){s=s||{};const e=new vt;return(s.zoom!==void 0?s.zoom:!0)&&e.push(new oo(s.zoomOptions)),(s.rotate!==void 0?s.rotate:!0)&&e.push(new Cu(s.rotateOptions)),(s.attribution!==void 0?s.attribution:!0)&&e.push(new ro(s.attributionOptions)),e}class Tu extends on{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==Se.DBLCLICK){const i=e.originalEvent,n=e.map,r=e.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=n.getView();zs(a,o,r,this.duration_),i.preventDefault(),t=!0}return!t}}const Su=Tu;class Ru extends yi{constructor(e){super({stopDown:ge.Dv}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const t=e.condition?e.condition:Gs(Bs,uo);this.condition_=e.onFocusOnly?Gs(ao,t):t,this.noKinetic_=!1}handleDragEvent(e){this.panning_||(this.panning_=!0,this.getMap().getView().beginInteraction());const t=this.targetPointers,i=Vs(t);if(t.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(i[0],i[1]),this.lastCentroid){const n=[this.lastCentroid[0]-i[0],i[1]-this.lastCentroid[1]],o=e.map.getView();(0,he.bA)(n,o.getResolution()),(0,he.U1)(n,o.getRotation()),o.adjustCenterInternal(n)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=i,this.lastPointersCount_=t.length,e.originalEvent.preventDefault()}handleUpEvent(e){const t=e.map,i=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const n=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-n*Math.cos(r),a[1]-n*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:y})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}else return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){const i=e.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}else return!1}}const Iu=Ru;class bu extends yi{constructor(e){e=e||{},super({stopDown:ge.Dv}),this.condition_=e.condition?e.condition:Nl,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!Zs(e))return;const t=e.map,i=t.getView();if(i.getConstraints().rotation===Ce)return;const n=t.getSize(),r=e.pixel,o=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return Zs(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return Zs(e)&&lo(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}const Lu=bu;class Mu extends xr.Z{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(e[0],t[0])+i,n.top=Math.min(e[1],t[1])+i,n.width=Math.abs(t[0]-e[0])+i,n.height=Math.abs(t[1]-e[1])+i}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const e=this.startPixel_,t=this.endPixel_,n=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new L.ZP([n])}getGeometry(){return this.geometry_}}const Pu=Mu,cs={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class wr extends Bt.ZP{constructor(e,t,i){super(e),this.coordinate=t,this.mapBrowserEvent=i}}class Au extends yi{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.box_=new Pu(e.className||"ol-dragbox"),this.minArea_=e.minArea!==void 0?e.minArea:64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition?e.condition:lo,this.boxEndCondition_=e.boxEndCondition?e.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,i){const n=i[0]-t[0],r=i[1]-t[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new wr(cs.BOXDRAG,e.coordinate,e))}handleUpEvent(e){this.box_.setMap(null);const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new wr(t?cs.BOXEND:cs.BOXCANCEL,e.coordinate,e)),!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new wr(cs.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}}const Du=Au;class Fu extends Du{constructor(e){e=e||{};const t=e.condition?e.condition:ho;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){const i=this.getMap().getView();let n=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(n),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;n=n.clone(),n.scale(a*a)}i.fitInternal(n,{duration:this.duration_,easing:y})}}const Ou=Fu,Ti={LEFT:37,UP:38,RIGHT:39,DOWN:40};class ku extends on{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return Bs(t)&&co(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==me.Z.KEYDOWN){const i=e.originalEvent,n=i.keyCode;if(this.condition_(e)&&(n==Ti.DOWN||n==Ti.LEFT||n==Ti.RIGHT||n==Ti.UP)){const o=e.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;n==Ti.DOWN?h=-a:n==Ti.LEFT?l=-a:n==Ti.RIGHT?l=a:h=a;const c=[l,h];(0,he.U1)(c,o.getRotation()),Ol(o,c,this.duration_),i.preventDefault(),t=!0}}return!t}}const Nu=ku;class zu extends on{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:co,this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==me.Z.KEYDOWN||e.type==me.Z.KEYPRESS){const i=e.originalEvent,n=i.charCode;if(this.condition_(e)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){const r=e.map,o=n=="+".charCodeAt(0)?this.delta_:-this.delta_,a=r.getView();zs(a,o,void 0,this.duration_),i.preventDefault(),t=!0}}return!t}}const Gu=zu;class Bu{constructor(e,t,i){this.decay_=e,this.minVelocity_=t,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let i=t-3;for(;i>0&&this.points_[i+2]>e;)i-=3;const n=this.points_[t+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[t]-this.points_[i],o=this.points_[t+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const Zu=Bu;class Wu extends yi{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=ge.Dv),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(this.lastAngle_!==void 0){const c=r-this.lastAngle_;this.rotationDelta_+=c,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=c}this.lastAngle_=r;const o=e.map,a=o.getView();if(a.getConstraints().rotation===Ce)return;const l=o.getViewport().getBoundingClientRect(),h=Vs(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=o.getCoordinateFromPixelInternal(h),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}else return!1}}const Uu=Wu;class Vu extends yi{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=ge.Dv),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,o=i.clientY-n.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;const l=e.map,h=l.getView();t!=1&&(this.lastScaleDelta_=t);const c=l.getViewport().getBoundingClientRect(),u=Vs(this.targetPointers);u[0]-=c.left,u[1]-=c.top,this.anchor_=l.getCoordinateFromPixelInternal(u),l.render(),h.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const i=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,n),!1}else return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}else return!1}}const Xu=Vu;function da(s){s=s||{};const e=new vt,t=new Zu(-.005,.05,100);return(s.altShiftDragRotate!==void 0?s.altShiftDragRotate:!0)&&e.push(new Lu),(s.doubleClickZoom!==void 0?s.doubleClickZoom:!0)&&e.push(new Su({delta:s.zoomDelta,duration:s.zoomDuration})),(s.dragPan!==void 0?s.dragPan:!0)&&e.push(new Iu({onFocusOnly:s.onFocusOnly,kinetic:t})),(s.pinchRotate!==void 0?s.pinchRotate:!0)&&e.push(new Uu),(s.pinchZoom!==void 0?s.pinchZoom:!0)&&e.push(new Xu({duration:s.zoomDuration})),(s.keyboard!==void 0?s.keyboard:!0)&&(e.push(new Nu),e.push(new Gu({delta:s.zoomDelta,duration:s.zoomDuration}))),(s.mouseWheelZoom!==void 0?s.mouseWheelZoom:!0)&&e.push(new fo({onFocusOnly:s.onFocusOnly,duration:s.zoomDuration})),(s.shiftDragZoom!==void 0?s.shiftDragZoom:!0)&&e.push(new Ou({duration:s.zoomDuration})),e}function fa(s){if(s instanceof Bn){s.setMapInternal(null);return}s instanceof hi&&s.getLayers().forEach(fa)}function ga(s,e){if(s instanceof Bn){s.setMapInternal(e);return}if(s instanceof hi){const t=s.getLayers().getArray();for(let i=0,n=t.length;i<n;++i)ga(t[i],e)}}class Yu extends Ee.Z{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=ju(e);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:He.MP,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=(0,H.Ue)(),this.pixelToCoordinateTransform_=(0,H.Ue)(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.controls=t.controls||wu(),this.interactions=t.interactions||da({onFocusOnly:!0}),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new xu(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(nt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(nt.VIEW,this.handleViewChanged_),this.addChangeListener(nt.SIZE,this.handleSizeChanged_),this.addChangeListener(nt.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const i=this;e.view&&!(e.view instanceof Ve)&&e.view.then(function(n){i.setView(new Ve(n))}),this.controls.addEventListener(tt.ADD,function(n){n.element.setMap(this)}.bind(this)),this.controls.addEventListener(tt.REMOVE,function(n){n.element.setMap(null)}.bind(this)),this.interactions.addEventListener(tt.ADD,function(n){n.element.setMap(this)}.bind(this)),this.interactions.addEventListener(tt.REMOVE,function(n){n.element.setMap(null)}.bind(this)),this.overlays_.addEventListener(tt.ADD,function(n){this.addOverlayInternal_(n.element)}.bind(this)),this.overlays_.addEventListener(tt.REMOVE,function(n){const r=n.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],n.element.setMap(null)}.bind(this)),this.controls.forEach(function(n){n.setMap(this)}.bind(this)),this.interactions.forEach(function(n){n.setMap(this)}.bind(this)),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){ga(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(e);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:ge.uX,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,a,t,null,o,null)}getFeaturesAtPixel(e,t){const i=[];return this.forEachFeatureAtPixel(e,function(n){i.push(n)},t),i}getAllLayers(){const e=[];function t(i){i.forEach(function(n){n instanceof hi?t(n.getLayers()):e.push(n)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const n=t.layerFilter!==void 0?t.layerFilter:ge.uX,r=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,n,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const t=this.viewport_.getBoundingClientRect(),i="changedTouches"in e?e.changedTouches[0]:e;return[i.clientX-t.left,i.clientY-t.top]}getTarget(){return this.get(nt.TARGET)}getTargetElement(){const e=this.getTarget();return e!==void 0?typeof e=="string"?document.getElementById(e):e:null}getCoordinateFromPixel(e){return(0,A.lO)(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?(0,H.nn)(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(nt.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof vt){t.setLayers(e);return}const i=t.getLayers();i.clear(),i.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,i=e.length;t<i;++t){const n=e[t];if(!n.visible)continue;const r=n.layer.getRenderer();if(r&&!r.ready)return!0;const o=n.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){const t=(0,A.Vs)(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?(0,H.nn)(t.coordinateToPixelTransform,e.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(nt.SIZE)}getView(){return this.get(nt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,i,n){return vu(this.frameState_,e,t,i,n)}handleBrowserEvent(e,t){t=t||e.type;const i=new Xt(t,this,e);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,i=t.type;if(i===Cr.POINTERDOWN||i===me.Z.WHEEL||i===me.Z.KEYDOWN){const n=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():n,o=t.target;if(this.overlayContainerStopEvent_.contains(o)||!(r===n?n.documentElement:r).contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){const n=this.getInteractions().getArray().slice();for(let r=n.length-1;r>=0;r--){const o=n[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n;if(e){const o=e.viewHints;if(o[ne.ANIMATING]||o[ne.INTERACTING]){const a=Date.now()-e.time>8;n=a?0:8,r=a?0:2}}t.getTilesLoading()<n&&(t.reprioritize(),t.loadMoreTiles(n,r))}e&&this.renderer_&&!e.animate&&(this.renderComplete_===!0?(this.hasListener(at.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(at.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new zi(Te.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new zi(Te.LOADSTART,this,e))));const i=this.postRenderFunctions_;for(let n=0,r=i.length;n<r;++n)i[n](this,e);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,i=this.targetChangeHandlerKeys_.length;t<i;++t)(0,j.bN)(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(me.Z.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(me.Z.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,Ds(this.viewport_)}const e=this.getTargetElement();if(!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new fu(this)),this.mapBrowserEventHandler_=new mu(this,this.moveTolerance_);for(const n in Se)this.mapBrowserEventHandler_.addEventListener(Se[n],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(me.Z.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(me.Z.WHEEL,this.boundHandleBrowserEvent_,He.bM?{passive:!1}:!1);const t=this.getOwnerDocument().defaultView,i=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[(0,j.oL)(i,me.Z.KEYDOWN,this.handleBrowserEvent,this),(0,j.oL)(i,me.Z.KEYPRESS,this.handleBrowserEvent,this),(0,j.oL)(t,me.Z.RESIZE,this.updateSize,this)]}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&((0,j.bN)(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&((0,j.bN)(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=(0,j.oL)(e,wn.Z.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=(0,j.oL)(e,me.Z.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(j.bN),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new li("addlayer",e)),this.layerGroupPropertyListenerKeys_=[(0,j.oL)(e,wn.Z.PROPERTYCHANGE,this.render,this),(0,j.oL)(e,me.Z.CHANGE,this.render,this),(0,j.oL)(e,"addlayer",this.handleLayerAdd_,this),(0,j.oL)(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,i=e.length;t<i;++t){const n=e[t].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){fa(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(t!==void 0&&yo(t)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterTree:null,extent:(0,v.p8)(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:(0,Y.sq)(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=(0,v.p8)(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n&&(!this.previousExtent_||!(0,v.xb)(this.previousExtent_)&&!(0,v.fS)(r.extent,this.previousExtent_))&&(this.dispatchEvent(new zi(Te.MOVESTART,this,n)),this.previousExtent_=(0,v.YN)(this.previousExtent_)),this.previousExtent_&&!r.viewHints[ne.ANIMATING]&&!r.viewHints[ne.INTERACTING]&&!(0,v.fS)(r.extent,this.previousExtent_)&&(this.dispatchEvent(new zi(Te.MOVEEND,this,r)),(0,v.d9)(r.extent,this.previousExtent_))),this.dispatchEvent(new zi(Te.POSTRENDER,this,r)),this.renderComplete_=this.hasListener(Te.LOADSTART)||this.hasListener(Te.LOADEND)||this.hasListener(at.RENDERCOMPLETE)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new li("removelayer",t)),this.set(nt.LAYERGROUP,e)}setSize(e){this.set(nt.SIZE,e)}setTarget(e){this.set(nt.TARGET,e)}setView(e){if(!e||e instanceof Ve){this.set(nt.VIEW,e);return}this.set(nt.VIEW,new Ve);const t=this;e.then(function(i){t.setView(new Ve(i))})}updateSize(){const e=this.getTargetElement();let t;if(e){const i=getComputedStyle(e),n=e.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),r=e.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);!isNaN(n)&&!isNaN(r)&&(t=[n,r],!yo(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&console.warn("No map visible because the map container's width or height are 0."))}this.setSize(t),this.updateViewportSize_()}updateViewportSize_(){const e=this.getView();if(e){let t;const i=getComputedStyle(this.viewport_);i.width&&i.height&&(t=[parseInt(i.width,10),parseInt(i.height,10)]),e.setViewportSize(t)}}}function ju(s){let e=null;s.keyboardEventTarget!==void 0&&(e=typeof s.keyboardEventTarget=="string"?document.getElementById(s.keyboardEventTarget):s.keyboardEventTarget);const t={},i=s.layers&&typeof s.layers.getLayers=="function"?s.layers:new hi({layers:s.layers});t[nt.LAYERGROUP]=i,t[nt.TARGET]=s.target,t[nt.VIEW]=s.view instanceof Ve?s.view:new Ve;let n;s.controls!==void 0&&(Array.isArray(s.controls)?n=new vt(s.controls.slice()):((0,T.h)(typeof s.controls.getArray=="function",47),n=s.controls));let r;s.interactions!==void 0&&(Array.isArray(s.interactions)?r=new vt(s.interactions.slice()):((0,T.h)(typeof s.interactions.getArray=="function",48),r=s.interactions));let o;return s.overlays!==void 0?Array.isArray(s.overlays)?o=new vt(s.overlays.slice()):((0,T.h)(typeof s.overlays.getArray=="function",49),o=s.overlays):o=new vt,{controls:n,interactions:r,keyboardEventTarget:e,overlays:o,values:t}}const Ku=Yu;var Hu=R(83977);function Tr(s,e,t,i){const n={};return i&&Object.keys(i).length?(n.color=(0,Je.getColorDimension)(s,i.color??fe.color,t),n.size=(0,Je.getScaledDimension)(s,i.size??fe.size),n.rotation=(0,Je.getScalarDimension)(s,i.rotation??fe.rotation),i.text&&(i.text.field||i.text.fixed)&&(n.text=(0,Je.getTextDimension)(s,i.text))):e.fields&&(e.fields.color&&(n.color=(0,Je.getColorDimension)(s,e.config.color??fe.color,t)),e.fields.size&&(n.size=(0,Je.getScaledDimension)(s,e.config.size??fe.size)),e.fields.text&&(n.text=(0,Je.getTextDimension)(s,e.config.text)),e.fields.rotation&&(n.rotation=(0,Je.getScalarDimension)(s,e.config.rotation??fe.rotation))),n}let us;function ma(){return us||(us=[],$u()),us}async function $u(){const s=await(0,Hu.e)();for(let e of["maps","gazetteer"])s.listFiles(e).subscribe({next:t=>{t.forEach(i=>{if(i.name.endsWith(".geojson")){const n=`public/${e}/${i.name}`;us.push({value:n,label:n})}})}})}const qu=(s,e,t)=>{const[i]=s.initMapView(e.view,void 0);return s.map=new Ku({view:i,pixelRatio:1,layers:[],controls:[],target:t,interactions:da({mouseWheelZoom:!1})})},Ju=(s,e)=>{s.initControls(e.controls),s.forceUpdate()},_a=(s,e,t)=>{s.panelContext&&s.panelContext.onInstanceStateChange&&s.panelContext.onInstanceStateChange({map:s.map,layers:e,selected:t,actions:s.actions})},Sr=s=>{let e=s.layers.length;for(;e<100;){const t=`Layer ${e++}`;if(!s.byName.has(t))return t}return`Layer ${Date.now()}`},Rn={style:fe,showLegend:!0},Rr="markers",pa={type:Rr,name:"",config:Rn,location:{mode:Sn.q1.Auto},tooltip:!0},Qu={id:Rr,name:"Markers",description:"Use markers to render each data point",isBaseMap:!1,showLocation:!0,hideOpacity:!0,create:async(s,e,t,i)=>{const n={...Rn,...e?.config},r=await wi(n.style),o=await(0,Yt.cJ)(e.location),a=new ls(o),l=new je({source:a}),h=new fr.t(1);let c=null;return n.showLegend&&(c=p.createElement(Yc,{watch:h,initialSubProps:{},child:qc})),r.fields?l.setStyle(u=>{const d=u.get("rowIndex"),f=r.dims;if(!f||!(0,dt.isNumber)(d))return r.maker(r.base);const g={...r.base};return f.color&&(g.color=f.color.get(d)),f.size&&(g.size=f.size.get(d)),f.text&&(g.text=f.text.get(d)),f.rotation&&(g.rotation=f.rotation.get(d)),r.maker(g)}):l.setStyle(r.maker(r.base)),{init:()=>l,legend:c,update:u=>{if(!u.series?.length){a.clear();return}for(const d of u.series){r.dims=Tr(d,r,i),c&&h.next({styleConfig:r,size:r.dims?.size,layerName:e.name,layer:l}),a.update(d);break}},registerOptionsUI:u=>{u.addCustomEditor({id:"config.style",path:"config.style",name:"Styles",editor:Xi,settings:{displayRotation:!0},defaultValue:Rn.style}).addBooleanSwitch({path:"config.showLegend",name:"Show legend",description:"Show map legend",defaultValue:Rn.showLegend})}}},defaultOptions:Rn};var Si=R(24699);const ds={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class ed extends Bn{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getPreload(){return this.get(ds.PRELOAD)}setPreload(e){this.set(ds.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(ds.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(ds.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}const td=ed;class id extends er.Z{constructor(e,t,i){super(),i=i||{},this.tileCoord=e,this.state=t,this.interimTile=null,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(me.Z.CHANGE)}release(){this.state===ae.ERROR&&this.setState(ae.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let e=this.interimTile;do{if(e.getState()==ae.LOADED)return this.transition_=0,e;e=e.interimTile}while(e);return this}refreshInterimChain(){if(!this.interimTile)return;let e=this.interimTile,t=this;do{if(e.getState()==ae.LOADED){e.interimTile=null;break}else e.getState()==ae.LOADING?t=e:e.getState()==ae.IDLE?t.interimTile=e.interimTile:t=e;e=t.interimTile}while(e)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==ae.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}load(){(0,Y.O3)()}getAlpha(e,t){if(!this.transition_)return 1;let i=this.transitionStarts_[e];if(!i)i=t,this.transitionStarts_[e]=i;else if(i===-1)return 1;const n=t-i+1e3/60;return n>=this.transition_?1:ut(n/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}}const ya=id;class nd extends ya{constructor(e,t,i,n,r,o){super(e,t,o),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,n!==null&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(e){this.image_=e,this.state=ae.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=ae.ERROR,this.unlistenImage_(),this.image_=sd(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=ae.LOADED:this.state=ae.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==ae.ERROR&&(this.state=ae.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==ae.IDLE&&(this.state=ae.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=tr(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function sd(){const s=$e(1,1);return s.fillStyle="rgba(0,0,0,0)",s.fillRect(0,0,1,1),s.canvas}const xa=nd,rd=.5,od=10,va=.25;class ad{constructor(e,t,i,n,r,o){this.sourceProj_=e,this.targetProj_=t;let a={};const l=(0,A.Ck)(this.targetProj_,this.sourceProj_);this.transformInv_=function(E){const C=E[0]+"/"+E[1];return a[C]||(a[C]=l(E)),a[C]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&(0,v.dz)(n)==(0,v.dz)(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?(0,v.dz)(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?(0,v.dz)(this.targetProj_.getExtent()):null;const h=(0,v.rL)(i),c=(0,v.Xv)(i),u=(0,v.w$)(i),d=(0,v.hC)(i),f=this.transformInv_(h),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),x=od+(o?Math.max(0,Math.ceil(Math.log2((0,v.bg)(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,u,d,f,g,m,_,x),this.wrapsXInSource_){let E=1/0;this.triangles_.forEach(function(C,b,M){E=Math.min(E,C.source[0][0],C.source[1][0],C.source[2][0])}),this.triangles_.forEach(function(C){if(Math.max(C.source[0][0],C.source[1][0],C.source[2][0])-E>this.sourceWorldWidth_/2){const b=[[C.source[0][0],C.source[0][1]],[C.source[1][0],C.source[1][1]],[C.source[2][0],C.source[2][1]]];b[0][0]-E>this.sourceWorldWidth_/2&&(b[0][0]-=this.sourceWorldWidth_),b[1][0]-E>this.sourceWorldWidth_/2&&(b[1][0]-=this.sourceWorldWidth_),b[2][0]-E>this.sourceWorldWidth_/2&&(b[2][0]-=this.sourceWorldWidth_);const M=Math.min(b[0][0],b[1][0],b[2][0]);Math.max(b[0][0],b[1][0],b[2][0])-M<this.sourceWorldWidth_/2&&(C.source=b)}}.bind(this))}a={}}addTriangle_(e,t,i,n,r,o){this.triangles_.push({source:[n,r,o],target:[e,t,i]})}addQuad_(e,t,i,n,r,o,a,l,h){const c=(0,v.hI)([r,o,a,l]),u=this.sourceWorldWidth_?(0,v.dz)(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=(0,v.hI)([e,t,i,n]);g=(0,v.dz)(_)/this.targetWorldWidth_>va||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>va||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!(0,v.kK)(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],x=this.transformInv_(_);let E;f?E=((0,w.$W)(r[0],d)+(0,w.$W)(a[0],d))/2-(0,w.$W)(x[0],d):E=(r[0]+a[0])/2-x[0];const C=(r[1]+a[1])/2-x[1];g=E*E+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(e[0]-i[0])<=Math.abs(e[1]-i[1])){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],x=this.transformInv_(_),E=[(n[0]+e[0])/2,(n[1]+e[1])/2],C=this.transformInv_(E);this.addQuad_(e,t,_,E,r,o,x,C,h-1),this.addQuad_(E,_,i,n,C,x,a,l,h-1)}else{const _=[(e[0]+t[0])/2,(e[1]+t[1])/2],x=this.transformInv_(_),E=[(i[0]+n[0])/2,(i[1]+n[1])/2],C=this.transformInv_(E);this.addQuad_(e,_,E,n,r,x,C,l,h-1),this.addQuad_(_,t,i,E,x,o,a,C,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,i,n,r,a,l),m&14||this.addTriangle_(e,i,t,r,a,o),m&&(m&13||this.addTriangle_(t,n,e,o,l,r),m&7||this.addTriangle_(t,n,i,o,l,a))}calculateSourceExtent(){const e=(0,v.lJ)();return this.triangles_.forEach(function(t,i,n){const r=t.source;(0,v.Wj)(e,r[0]),(0,v.Wj)(e,r[1]),(0,v.Wj)(e,r[2])}),e}getTriangles(){return this.triangles_}}const ld=ad;let Ir;const Ea=[];function Ca(s,e,t,i,n){s.beginPath(),s.moveTo(0,0),s.lineTo(e,t),s.lineTo(i,n),s.closePath(),s.save(),s.clip(),s.fillRect(0,0,Math.max(e,i)+1,Math.max(t,n)),s.restore()}function br(s,e){return Math.abs(s[e*4]-210)>2||Math.abs(s[e*4+3]-.75*255)>2}function hd(){if(Ir===void 0){const s=document.createElement("canvas").getContext("2d");s.globalCompositeOperation="lighter",s.fillStyle="rgba(210, 0, 0, 0.75)",Ca(s,4,5,4,0),Ca(s,4,5,0,5);const e=s.getImageData(0,0,3,3).data;Ir=br(e,0)||br(e,4)||br(e,8)}return Ir}function wa(s,e,t,i){const n=(0,A.vs)(t,e,s);let r=(0,A._Q)(e,i,t);const o=e.getMetersPerUnit();o!==void 0&&(r*=o);const a=s.getMetersPerUnit();a!==void 0&&(r/=a);const l=s.getExtent();if(!l||(0,v.b8)(l,n)){const h=(0,A._Q)(s,r,n)/r;isFinite(h)&&h>0&&(r/=h)}return r}function cd(s,e,t,i){const n=(0,v.qg)(t);let r=wa(s,e,n,i);return(!isFinite(r)||r<=0)&&(0,v.H6)(t,function(o){return r=wa(s,e,o,i),isFinite(r)&&r>0}),r}function ud(s,e,t,i,n,r,o,a,l,h,c,u){const d=$e(Math.round(t*s),Math.round(t*e),Ea);if(u||(d.imageSmoothingEnabled=!1),l.length===0)return d.canvas;d.scale(t,t);function f(b){return Math.round(b*t)/t}d.globalCompositeOperation="lighter";const g=(0,v.lJ)();l.forEach(function(b,M,F){(0,v.l7)(g,b.extent)});const m=(0,v.dz)(g),_=(0,v.Cr)(g),x=$e(Math.round(t*m/i),Math.round(t*_/i));u||(x.imageSmoothingEnabled=!1);const E=t/i;l.forEach(function(b,M,F){const O=b.extent[0]-g[0],W=-(b.extent[3]-g[3]),q=(0,v.dz)(b.extent),ie=(0,v.Cr)(b.extent);b.image.width>0&&b.image.height>0&&x.drawImage(b.image,h,h,b.image.width-2*h,b.image.height-2*h,O*E,W*E,q*E,ie*E)});const C=(0,v.rL)(o);return a.getTriangles().forEach(function(b,M,F){const O=b.source,W=b.target;let q=O[0][0],ie=O[0][1],ye=O[1][0],xe=O[1][1],oe=O[2][0],Be=O[2][1];const _e=f((W[0][0]-C[0])/r),$=f(-(W[0][1]-C[1])/r),J=f((W[1][0]-C[0])/r),te=f(-(W[1][1]-C[1])/r),Ze=f((W[2][0]-C[0])/r),We=f(-(W[2][1]-C[1])/r),Ke=q,Z=ie;q=0,ie=0,ye-=Ke,xe-=Z,oe-=Ke,Be-=Z;const _t=[[ye,xe,0,0,J-_e],[oe,Be,0,0,Ze-_e],[0,0,ye,xe,te-$],[0,0,oe,Be,We-$]],Ae=(0,w.SV)(_t);if(Ae){if(d.save(),d.beginPath(),hd()||!u){d.moveTo(J,te);const Ne=4,fi=_e-J,Gt=$-te;for(let Qe=0;Qe<Ne;Qe++)d.lineTo(J+f((Qe+1)*fi/Ne),te+f(Qe*Gt/(Ne-1))),Qe!=Ne-1&&d.lineTo(J+f((Qe+1)*fi/Ne),te+f((Qe+1)*Gt/(Ne-1)));d.lineTo(Ze,We)}else d.moveTo(J,te),d.lineTo(_e,$),d.lineTo(Ze,We);d.clip(),d.transform(Ae[0],Ae[2],Ae[1],Ae[3],_e,$),d.translate(g[0]-Ke,g[3]-Z),d.scale(i/t,-i/t),d.drawImage(x.canvas,0,0),d.restore()}}),c&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach(function(b,M,F){const O=b.target,W=(O[0][0]-C[0])/r,q=-(O[0][1]-C[1])/r,ie=(O[1][0]-C[0])/r,ye=-(O[1][1]-C[1])/r,xe=(O[2][0]-C[0])/r,oe=-(O[2][1]-C[1])/r;d.beginPath(),d.moveTo(ie,ye),d.lineTo(W,q),d.lineTo(xe,oe),d.closePath(),d.stroke()}),d.restore()),d.canvas}class dd extends ya{constructor(e,t,i,n,r,o,a,l,h,c,u,d){super(r,ae.IDLE,{interpolate:!!d}),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=n,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const f=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=g?(0,v.Ed)(f,g):f;if((0,v.bg)(_)===0){this.state=ae.EMPTY;return}const x=e.getExtent();x&&(m?m=(0,v.Ed)(m,x):m=x);const E=n.getResolution(this.wrappedTileCoord_[0]),C=cd(e,i,_,E);if(!isFinite(C)||C<=0){this.state=ae.EMPTY;return}const b=c!==void 0?c:rd;if(this.triangulation_=new ld(e,i,_,m,C*b,E),this.triangulation_.getTriangles().length===0){this.state=ae.EMPTY;return}this.sourceZ_=t.getZForResolution(C);let M=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(M[1]=(0,w.uZ)(M[1],m[1],m[3]),M[3]=(0,w.uZ)(M[3],m[1],m[3])):M=(0,v.Ed)(M,m)),!(0,v.bg)(M))this.state=ae.EMPTY;else{const F=t.getTileRangeForExtentAndZ(M,this.sourceZ_);for(let O=F.minX;O<=F.maxX;O++)for(let W=F.minY;W<=F.maxY;W++){const q=h(this.sourceZ_,O,W,a);q&&this.sourceTiles_.push(q)}this.sourceTiles_.length===0&&(this.state=ae.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(function(t,i,n){t&&t.getState()==ae.LOADED&&e.push({extent:this.sourceTileGrid_.getTileCoordExtent(t.tileCoord),image:t.getImage()})}.bind(this)),this.sourceTiles_.length=0,e.length===0)this.state=ae.ERROR;else{const t=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(t),n=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=ud(n,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=ae.LOADED}this.changed()}load(){if(this.state==ae.IDLE){this.state=ae.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(t,i,n){const r=t.getState();if(r==ae.IDLE||r==ae.LOADING){e++;const o=(0,j.oL)(t,me.Z.CHANGE,function(a){const l=t.getState();(l==ae.LOADED||l==ae.ERROR||l==ae.EMPTY)&&((0,j.bN)(o),e--,e===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(o)}}.bind(this)),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t,i,n){t.getState()==ae.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(j.bN),this.sourcesListenerKeys_=null}release(){this.canvas_&&(nn(this.canvas_.getContext("2d")),Ea.push(this.canvas_),this.canvas_=null),super.release()}}const Lr=dd;class Ta{constructor(e,t,i,n){this.minX=e,this.maxX=t,this.minY=i,this.maxY=n}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function Yi(s,e,t,i,n){return n!==void 0?(n.minX=s,n.maxX=e,n.minY=t,n.maxY=i,n):new Ta(s,e,t,i)}const Sa=Ta;class fd extends Go{constructor(e){super(e),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=(0,v.lJ)(),this.tmpTileRange_=new Sa(0,0,0,0)}isDrawableTile(e){const t=this.getLayer(),i=e.getState(),n=t.getUseInterimTilesOnError();return i==ae.LOADED||i==ae.EMPTY||i==ae.ERROR&&!n}getTile(e,t,i,n){const r=n.pixelRatio,o=n.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(e,t,i,r,o);return h.getState()==ae.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),n=(0,H.nn)(t.pixelToCoordinateTransform,e.slice()),r=i.getExtent();if(r&&!(0,v.b8)(r,n))return null;const o=t.pixelRatio,a=t.viewState.projection,l=t.viewState,h=i.getRenderSource(),c=h.getTileGridForProjection(l.projection),u=h.getTilePixelRatio(t.pixelRatio);for(let d=c.getZForResolution(l.resolution);d>=c.getMinZoom();--d){const f=c.getTileCoordForCoordAndZ(n,d),g=h.getTile(d,f[1],f[2],o,a);if(!(g instanceof xa||g instanceof Lr)||g instanceof Lr&&g.getState()===ae.EMPTY)return null;if(g.getState()!==ae.LOADED)continue;const m=c.getOrigin(d),_=gt(c.getTileSize(d)),x=c.getResolution(d),E=Math.floor(u*((n[0]-m[0])/x-f[1]*_[0])),C=Math.floor(u*((m[1]-n[1])/x-f[2]*_[1])),b=Math.round(u*h.getGutterForProjection(l.projection));return this.getImageData(g.getImage(),E+b,C+b)}return null}loadedTileCallback(e,t,i){return this.isDrawableTile(i)?super.loadedTileCallback(e,t,i):!1}prepareFrame(e){return!!this.getLayer().getSource()}renderFrame(e,t){const i=e.layerStatesArray[e.layerIndex],n=e.viewState,r=n.projection,o=n.resolution,a=n.center,l=n.rotation,h=e.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),f=u.getTileGridForProjection(r),g=f.getZForResolution(o,u.zDirection),m=f.getResolution(g);let _=e.extent;const x=e.viewState.resolution,E=u.getTilePixelRatio(h),C=Math.round((0,v.dz)(_)/x*h),b=Math.round((0,v.Cr)(_)/x*h),M=i.extent&&(0,A.dY)(i.extent,r);M&&(_=(0,v.Ed)(_,(0,A.dY)(i.extent,r)));const F=m*C/2/E,O=m*b/2/E,W=[a[0]-F,a[1]-O,a[0]+F,a[1]+O],q=f.getTileRangeForExtentAndZ(_,g),ie={};ie[g]={};const ye=this.createLoadedTileFinder(u,r,ie),xe=this.tmpExtent,oe=this.tmpTileRange_;this.newTiles_=!1;const Be=l?(0,v.dY)(n.center,x,l,e.size):void 0;for(let _t=q.minX;_t<=q.maxX;++_t)for(let Ae=q.minY;Ae<=q.maxY;++Ae){if(l&&!f.tileCoordIntersectsViewport([g,_t,Ae],Be))continue;const Ne=this.getTile(g,_t,Ae,e);if(this.isDrawableTile(Ne)){const Qe=(0,Y.sq)(this);if(Ne.getState()==ae.LOADED){ie[g][Ne.tileCoord.toString()]=Ne;let Kt=Ne.inTransition(Qe);Kt&&i.opacity!==1&&(Ne.endTransition(Qe),Kt=!1),!this.newTiles_&&(Kt||!this.renderedTiles.includes(Ne))&&(this.newTiles_=!0)}if(Ne.getAlpha(Qe,e.time)===1)continue}const fi=f.getTileCoordChildTileRange(Ne.tileCoord,oe,xe);let Gt=!1;fi&&(Gt=ye(g+1,fi)),Gt||f.forEachTileCoordParentTileRange(Ne.tileCoord,ye,oe,xe)}const _e=m/o*h/E;(0,H.qC)(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/h,1/h,l,-C/2,-b/2);const $=(0,H.BB)(this.pixelTransform);this.useContainer(t,$,this.getBackground(e));const J=this.context,te=J.canvas;(0,H.nb)(this.inversePixelTransform,this.pixelTransform),(0,H.qC)(this.tempTransform,C/2,b/2,_e,_e,0,-C/2,-b/2),te.width!=C||te.height!=b?(te.width=C,te.height=b):this.containerReused||J.clearRect(0,0,C,b),M&&this.clipUnrotated(J,e,M),u.getInterpolate()||(J.imageSmoothingEnabled=!1),this.preRender(J,e),this.renderedTiles.length=0;let Ze=Object.keys(ie).map(Number);Ze.sort(U.kK);let We,Ke,Z;i.opacity===1&&(!this.containerReused||u.getOpaque(e.viewState.projection))?Ze=Ze.reverse():(We=[],Ke=[]);for(let _t=Ze.length-1;_t>=0;--_t){const Ae=Ze[_t],Ne=u.getTilePixelSize(Ae,h,r),Gt=f.getResolution(Ae)/m,Qe=Ne[0]*Gt*_e,Kt=Ne[1]*Gt*_e,$i=f.getTileCoordForCoordAndZ((0,v.rL)(W),Ae),Ss=f.getTileCoordExtent($i),qi=(0,H.nn)(this.tempTransform,[E*(Ss[0]-W[0])/m,E*(W[3]-Ss[3])/m]),Rs=E*u.getGutterForProjection(r),gi=ie[Ae];for(const Fn in gi){const mi=gi[Fn],Is=mi.tileCoord,bs=$i[1]-Is[1],Ls=Math.round(qi[0]-(bs-1)*Qe),Ji=$i[2]-Is[2],$r=Math.round(qi[1]-(Ji-1)*Kt),ht=Math.round(qi[0]-bs*Qe),St=Math.round(qi[1]-Ji*Kt),Pt=Ls-ht,Ht=$r-St,Qi=g===Ae,Ii=Qi&&mi.getAlpha((0,Y.sq)(this),e.time)!==1;let _i=!1;if(!Ii)if(We){Z=[ht,St,ht+Pt,St,ht+Pt,St+Ht,ht,St+Ht];for(let en=0,Ms=We.length;en<Ms;++en)if(g!==Ae&&Ae<Ke[en]){const ot=We[en];(0,v.kK)([ht,St,ht+Pt,St+Ht],[ot[0],ot[3],ot[4],ot[7]])&&(_i||(J.save(),_i=!0),J.beginPath(),J.moveTo(Z[0],Z[1]),J.lineTo(Z[2],Z[3]),J.lineTo(Z[4],Z[5]),J.lineTo(Z[6],Z[7]),J.moveTo(ot[6],ot[7]),J.lineTo(ot[4],ot[5]),J.lineTo(ot[2],ot[3]),J.lineTo(ot[0],ot[1]),J.clip())}We.push(Z),Ke.push(Ae)}else J.clearRect(ht,St,Pt,Ht);this.drawTileImage(mi,e,ht,St,Pt,Ht,Rs,Qi),We&&!Ii?(_i&&J.restore(),this.renderedTiles.unshift(mi)):this.renderedTiles.push(mi),this.updateUsedTiles(e.usedTiles,u,mi)}}return this.renderedRevision=d,this.renderedResolution=m,this.extentChanged=!this.renderedExtent_||!(0,v.fS)(this.renderedExtent_,W),this.renderedExtent_=W,this.renderedPixelRatio=h,this.renderedProjection=r,this.manageTilePyramid(e,u,f,h,r,_,g,c.getPreload()),this.scheduleExpireCache(e,u),this.postRender(J,e),i.extent&&J.restore(),J.imageSmoothingEnabled=!0,$!==te.style.transform&&(te.style.transform=$),this.container}drawTileImage(e,t,i,n,r,o,a,l){const h=this.getTileImage(e);if(!h)return;const c=(0,Y.sq)(this),u=t.layerStatesArray[t.layerIndex],d=u.opacity*(l?e.getAlpha(c,t.time):1),f=d!==this.context.globalAlpha;f&&(this.context.save(),this.context.globalAlpha=d),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,n,r,o),f&&this.context.restore(),d!==u.opacity?t.animate=!0:l&&e.endTransition(c)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}scheduleExpireCache(e,t){if(t.canExpireCache()){const i=function(n,r,o){const a=(0,Y.sq)(n);a in o.usedTiles&&n.expireCache(o.viewState.projection,o.usedTiles[a])}.bind(null,t);e.postRenderFunctions.push(i)}}updateUsedTiles(e,t,i){const n=(0,Y.sq)(t);n in e||(e[n]={}),e[n][i.getKey()]=!0}manageTilePyramid(e,t,i,n,r,o,a,l,h){const c=(0,Y.sq)(t);c in e.wantedTiles||(e.wantedTiles[c]={});const u=e.wantedTiles[c],d=e.tileQueue,f=i.getMinZoom(),g=e.viewState.rotation,m=g?(0,v.dY)(e.viewState.center,e.viewState.resolution,g,e.size):void 0;let _=0,x,E,C,b,M,F;for(F=f;F<=a;++F)for(E=i.getTileRangeForExtentAndZ(o,F,E),C=i.getResolution(F),b=E.minX;b<=E.maxX;++b)for(M=E.minY;M<=E.maxY;++M)g&&!i.tileCoordIntersectsViewport([F,b,M],m)||(a-F<=l?(++_,x=t.getTile(F,b,M,n,r),x.getState()==ae.IDLE&&(u[x.getKey()]=!0,d.isKeyQueued(x.getKey())||d.enqueue([x,c,i.getTileCoordCenter(x.tileCoord),C])),h!==void 0&&h(x)):t.useTile(F,b,M,r));t.updateCacheSize(_,r)}}const gd=fd;class md extends td{constructor(e){super(e)}createRenderer(){return new gd(this)}}const Mr=md;class _d{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const i=this.entries_[e];return(0,T.h)(i!==void 0,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(e){const t=this.entries_[e];return(0,T.h)(t!==void 0,15),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.key_;return e}getValues(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){if(this.containsKey(e))return this.entries_[e].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){(0,T.h)(!(e in this.entries_),16);const i={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[e]=i,++this.count_}setSize(e){this.highWaterMark=e}}const pd=_d;function Ra(s,e,t,i){return i!==void 0?(i[0]=s,i[1]=e,i[2]=t,i):[s,e,t]}function In(s,e,t){return s+"/"+e+"/"+t}function Ia(s){return In(s[0],s[1],s[2])}function Vg(s){const[e,t,i]=s.substring(s.lastIndexOf("/")+1,s.length).split(",").map(Number);return In(e,t,i)}function yd(s){return s.split("/").map(Number)}function xd(s){return(s[1]<<s[0])+s[2]}function vd(s,e){const t=s[0],i=s[1],n=s[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const r=e.getFullTileRange(t);return r?r.containsXY(i,n):!0}class Ed extends pd{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(e){for(;this.canExpireCache()&&!(this.peekLast().getKey()in e);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const e=this.peekFirstKey(),i=yd(e)[0];this.forEach(function(n){n.tileCoord[0]!==i&&(this.remove(Ia(n.tileCoord)),n.release())}.bind(this))}}const ba=Ed,Pr={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var Cd=R(31478);const wd=[0,0,0],ci=5;class Td{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,(0,T.h)((0,U.pT)(this.resolutions_,function(n,r){return r-n},!0),17);let t;if(!e.origins){for(let n=0,r=this.resolutions_.length-1;n<r;++n)if(!t)t=this.resolutions_[n]/this.resolutions_[n+1];else if(this.resolutions_[n]/this.resolutions_[n+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,(0,T.h)(this.origins_.length==this.resolutions_.length,20));const i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=(0,v.rL)(i)),(0,T.h)(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,(0,T.h)(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:se,(0,T.h)(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map(function(n,r){const o=new Sa(Math.min(0,n[0]),Math.max(n[0]-1,-1),Math.min(0,n[1]),Math.max(n[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o},this):i&&this.calculateTileRanges_(i)}forEachTileCoord(e,t,i){const n=this.getTileRangeForExtentAndZ(e,t);for(let r=n.minX,o=n.maxX;r<=o;++r)for(let a=n.minY,l=n.maxY;a<=l;++a)i([t,r,a])}forEachTileCoordParentTileRange(e,t,i,n){let r,o,a,l=null,h=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,n);h>=this.minZoom;){if(this.zoomFactor_===2?(o=Math.floor(o/2),a=Math.floor(a/2),r=Yi(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),t(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,i){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const r=e[1]*2,o=e[2]*2;return Yi(r,r+1,o,o+1,t)}const n=this.getTileCoordExtent(e,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,i){if(t>this.maxZoom||t<this.minZoom)return null;const n=e[0],r=e[1],o=e[2];if(t===n)return Yi(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-n),h=Math.floor(r*l),c=Math.floor(o*l);if(t<n)return Yi(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return Yi(h,u,c,d,i)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,i)}getTileRangeExtent(e,t,i){const n=this.getOrigin(e),r=this.getResolution(e),o=gt(this.getTileSize(e),this.tmpSize_),a=n[0]+t.minX*o[0]*r,l=n[0]+(t.maxX+1)*o[0]*r,h=n[1]+t.minY*o[1]*r,c=n[1]+(t.maxY+1)*o[1]*r;return(0,v.T9)(a,h,l,c,i)}getTileRangeForExtentAndZ(e,t,i){const n=wd;this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,n);const r=n[1],o=n[2];return this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,n),Yi(r,n[1],o,n[2],i)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),i=this.getResolution(e[0]),n=gt(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*n[0]*i,t[1]-(e[2]+.5)*n[1]*i]}getTileCoordExtent(e,t){const i=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=gt(this.getTileSize(e[0]),this.tmpSize_),o=i[0]+e[1]*r[0]*n,a=i[1]-(e[2]+1)*r[1]*n,l=o+r[0]*n,h=a+r[1]*n;return(0,v.T9)(o,a,l,h,t)}getTileCoordForCoordAndResolution(e,t,i){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,i)}getTileCoordForXYAndResolution_(e,t,i,n,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=gt(this.getTileSize(o),this.tmpSize_);let c=a*(e-l[0])/i/h[0],u=a*(l[1]-t)/i/h[1];return n?(c=(0,w.mD)(c,ci)-1,u=(0,w.mD)(u,ci)-1):(c=(0,w.GW)(c,ci),u=(0,w.GW)(u,ci)),Ra(o,c,u,r)}getTileCoordForXYAndZ_(e,t,i,n,r){const o=this.getOrigin(i),a=this.getResolution(i),l=gt(this.getTileSize(i),this.tmpSize_);let h=(e-o[0])/a/l[0],c=(o[1]-t)/a/l[1];return n?(h=(0,w.mD)(h,ci)-1,c=(0,w.mD)(c,ci)-1):(h=(0,w.GW)(h,ci),c=(0,w.GW)(c,ci)),Ra(i,h,c,r)}getTileCoordForCoordAndZ(e,t,i){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,i)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){const i=(0,U.h7)(this.resolutions_,e,t||0);return(0,w.uZ)(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return(0,Cd.mV)(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,i=new Array(t);for(let n=this.minZoom;n<t;++n)i[n]=this.getTileRangeForExtentAndZ(e,n);this.fullTileRanges_=i}}const La=Td;function Ma(s){let e=s.getDefaultTileGrid();return e||(e=bd(s),s.setDefaultTileGrid(e)),e}function Sd(s,e,t){const i=e[0],n=s.getTileCoordCenter(e),r=Ar(t);if((0,v.b8)(r,n))return e;{const o=(0,v.dz)(r),a=Math.ceil((r[0]-n[0])/o);return n[0]+=o*a,s.getTileCoordForCoordAndZ(n,i)}}function Rd(s,e,t,i){i=i!==void 0?i:"top-left";const n=Pa(s,e,t);return new La({extent:s,origin:(0,v.g0)(s,i),resolutions:n,tileSize:t})}function Id(s){const e=s||{},t=e.extent||(0,A.U2)("EPSG:3857").getExtent(),i={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Pa(t,e.maxZoom,e.tileSize,e.maxResolution)};return new La(i)}function Pa(s,e,t,i){e=e!==void 0?e:Ie,t=gt(t!==void 0?t:se);const n=(0,v.Cr)(s),r=(0,v.dz)(s);i=i>0?i:Math.max(r/t[0],n/t[1]);const o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function bd(s,e,t,i){const n=Ar(s);return Rd(n,e,t,i)}function Ar(s){s=(0,A.U2)(s);let e=s.getExtent();if(!e){const t=180*A.Wm.degrees/s.getMetersPerUnit();e=(0,v.T9)(-t,-t,t,t)}return e}class Ld extends jo{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.opaque_=e.opaque!==void 0?e.opaque:!1,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const t=[256,256];this.tileGrid&&gt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tileCache=new ba(e.cacheSize||0),this.tmpSize=[0,0],this.key_=e.key||"",this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(e,t){const i=this.getTileCacheForProjection(e);i&&i.expireCache(t)}forEachLoadedTile(e,t,i,n){const r=this.getTileCacheForProjection(e);if(!r)return!1;let o=!0,a,l,h;for(let c=i.minX;c<=i.maxX;++c)for(let u=i.minY;u<=i.maxY;++u)l=In(t,c,u),h=!1,r.containsKey(l)&&(a=r.get(l),h=a.getState()===ae.LOADED,h&&(h=n(a)!==!1)),h||(o=!1);return o}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getOpaque(e){return this.opaque_}getResolutions(){return this.tileGrid?this.tileGrid.getResolutions():null}getTile(e,t,i,n,r){return(0,Y.O3)()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Ma(e)}getTileCacheForProjection(e){const t=this.getProjection();return(0,T.h)(t===null||(0,A.OP)(t,e),68),this.tileCache}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(t),o=gt(n.getTileSize(e),this.tmpSize);return r==1?o:yh(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){t=t!==void 0?t:this.getProjection();const i=this.getTileGridForProjection(t);return this.getWrapX()&&t.isGlobal()&&(e=Sd(i,e,t)),vd(e,i)?e:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(e,t){const i=this.getTileCacheForProjection(t);e>i.highWaterMark&&(i.highWaterMark=e)}useTile(e,t,i,n){}}class Md extends Bt.ZP{constructor(e,t){super(e),this.tile=t}}const Pd=Ld;function Ad(s,e){const t=/\{z\}/g,i=/\{x\}/g,n=/\{y\}/g,r=/\{-y\}/g;return function(o,a,l){if(o)return s.replace(t,o[0].toString()).replace(i,o[1].toString()).replace(n,o[2].toString()).replace(r,function(){const h=o[0],c=e.getFullTileRange(h);return(0,T.h)(c,55),(c.getHeight()-o[2]-1).toString()})}}function Dd(s,e){const t=s.length,i=new Array(t);for(let n=0;n<t;++n)i[n]=Ad(s[n],e);return Fd(i)}function Fd(s){return s.length===1?s[0]:function(e,t,i){if(e){const n=xd(e),r=(0,w.$W)(n,s.length);return s[r](e,t,i)}else return}}function Xg(s,e,t){}function Od(s){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(s);if(t){const i=t[1].charCodeAt(0),n=t[2].charCodeAt(0);let r;for(r=i;r<=n;++r)e.push(s.replace(t[0],String.fromCharCode(r)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(s),t){const i=parseInt(t[2],10);for(let n=parseInt(t[1],10);n<=i;n++)e.push(s.replace(t[0],n.toString()));return e}return e.push(s),e}class Dr extends Pd{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,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===Dr.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const t=e.target,i=(0,Y.sq)(t),n=t.getState();let r;n==ae.LOADING?(this.tileLoadingKeys_[i]=!0,r=Pr.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==ae.ERROR?Pr.TILELOADERROR:n==ae.LOADED?Pr.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new Md(r,t))}setTileLoadFunction(e){this.tileCache.clear(),this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,this.tileCache.pruneExceptNewestZ(),typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){const t=Od(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
`);this.generateTileUrlFunction_?this.setTileUrlFunction(Dd(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,i){}useTile(e,t,i){const n=In(e,t,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}const kd=Dr;class Nd extends kd{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:zd,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.tileClass=e.tileClass!==void 0?e.tileClass:xa,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const e in this.tileCacheForProjection)if(this.tileCacheForProjection[e].canExpireCache())return!0;return!1}expireCache(e,t){const i=this.getTileCacheForProjection(e);this.tileCache.expireCache(this.tileCache==i?t:{});for(const n in this.tileCacheForProjection){const r=this.tileCacheForProjection[n];r.expireCache(r==i?t:{})}}getGutterForProjection(e){return this.getProjection()&&e&&!(0,A.OP)(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getOpaque(e){return this.getProjection()&&e&&!(0,A.OP)(this.getProjection(),e)?!1:super.getOpaque(e)}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||(0,A.OP)(t,e)))return this.tileGrid;{const i=(0,Y.sq)(e);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Ma(e)),this.tileGridForProjection[i]}}getTileCacheForProjection(e){const t=this.getProjection();if(!t||(0,A.OP)(t,e))return this.tileCache;{const i=(0,Y.sq)(e);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new ba(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}}createTile_(e,t,i,n,r,o){const a=[e,t,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,n,r):void 0,c=new this.tileClass(a,h!==void 0?ae.IDLE:ae.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(me.Z.CHANGE,this.handleTileChange.bind(this)),c}getTile(e,t,i,n,r){const o=this.getProjection();if(!o||!r||(0,A.OP)(o,r))return this.getTileInternal(e,t,i,n,o||r);{const a=this.getTileCacheForProjection(r),l=[e,t,i];let h;const c=Ia(l);a.containsKey(c)&&(h=a.get(c));const u=this.getKey();if(h&&h.key==u)return h;{const d=this.getTileGridForProjection(o),f=this.getTileGridForProjection(r),g=this.getTileCoordForTileUrlFunction(l,r),m=new Lr(o,d,r,f,l,g,this.getTilePixelRatio(n),this.getGutter(),function(_,x,E,C){return this.getTileInternal(_,x,E,C,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return m.key=u,h?(m.interimTile=h,m.refreshInterimChain(),a.replace(c,m)):a.set(c,m),m}}}getTileInternal(e,t,i,n,r){let o=null;const a=In(e,t,i),l=this.getKey();if(!this.tileCache.containsKey(a))o=this.createTile_(e,t,i,n,r,l),this.tileCache.set(a,o);else if(o=this.tileCache.get(a),o.key!=l){const h=o;o=this.createTile_(e,t,i,n,r,l),h.getState()==ae.IDLE?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(a,o)}return o}setRenderReprojectionEdges(e){if(this.renderReprojectionEdges_!=e){this.renderReprojectionEdges_=e;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(e,t){const i=(0,A.U2)(e);if(i){const n=(0,Y.sq)(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=t)}}clear(){super.clear();for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear()}}function zd(s,e){s.getImage().src=e}const Gd=Nd;class Bd extends Gd{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:Id({extent:Ar(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,opaque:e.opaque,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const Fr=Bd;var Zd=(s=>(s.Auto="auto",s.Light="light",s.Dark="dark",s))(Zd||{});const fs={theme:"auto",showLabels:!0},Aa={id:"carto",name:"CARTO basemap",description:"Add layer CARTO Raster basemaps",isBaseMap:!0,defaultOptions:fs,create:async(s,e,t,i)=>({init:()=>{const n={...fs,...e.config};let r=n.theme;return(!r||r==="auto")&&(r=i.isDark?"dark":"light"),n.showLabels?r+="_all":r+="_nolabels",new Mr({source:new Fr({attributions:'<a href="https://carto.com/attribution/">\xA9 CARTO</a>',url:`https://{1-4}.basemaps.cartocdn.com/${r}/{z}/{x}/{y}.png`})})},registerOptionsUI:n=>{n.addRadio({path:"config.theme",name:"Theme",settings:{options:[{value:"auto",label:"Auto",description:"Match grafana theme"},{value:"light",label:"Light"},{value:"dark",label:"Dark"}]},defaultValue:fs.theme}).addBooleanSwitch({path:"config.showLabels",name:"Show labels",description:"",defaultValue:fs.showLabels})}})},Wd=[Aa],Da="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",ji={url:Da+"/tile/{z}/{y}/{x}",attribution:`Tiles \xA9 <a href="${Da}">ArcGIS</a>`},Fa={id:"xyz",name:"XYZ Tile layer",description:"Add map from a generic tile layer",isBaseMap:!0,create:async(s,e,t,i)=>({init:()=>{const n={...e.config};return n.url||(n.url=ji.url,n.attribution=n.attribution??ji.attribution),new Mr({source:new Fr({url:n.url,attributions:n.attribution}),minZoom:n.minZoom,maxZoom:n.maxZoom})},registerOptionsUI:n=>{n.addTextInput({path:"config.url",name:"URL template",description:"Must include {x}, {y} or {-y}, and {z} placeholders",settings:{placeholder:ji.url}}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:ji.attribution}})}})},Ud=[Fa],gs="custom",Or="streets",Oa=new os.B(()=>[{id:Or,name:"World Street Map",slug:"World_Street_Map"},{id:"world-imagery",name:"World Imagery",slug:"World_Imagery"},{id:"world-physical",name:"World Physical",slug:"World_Physical_Map"},{id:"topo",name:"Topographic",slug:"World_Topo_Map"},{id:"usa-topo",name:"USA Topographic",slug:"USA_Topo_Maps"},{id:"ocean",name:"World Ocean",slug:"Ocean/World_Ocean_Base"},{id:gs,name:"Custom MapServer",description:"Use a custom MapServer with pre-cached values",slug:""}]),Vd=[{id:"esri-xyz",name:"ArcGIS MapServer",description:"Add layer from an ESRI ArcGIS MapServer",isBaseMap:!0,create:async(s,e,t,i)=>{const n={...e.config},r=Oa.getIfExists(n.server??Or);if(r.id!==gs){const a="https://services.arcgisonline.com/ArcGIS/rest/services/";n.url=`${a}${r.slug}/MapServer/tile/{z}/{y}/{x}`,n.attribution=`Tiles \xA9 <a href="${a}${r.slug}/MapServer">ArcGIS</a>`}const o={...e,config:n};return Fa.create(s,o,t,i).then(a=>(a.registerOptionsUI=l=>{l.addSelect({path:"config.server",name:"Server instance",settings:{options:Oa.selectOptions().options}}).addTextInput({path:"config.url",name:"URL template",description:"Must include {x}, {y} or {-y}, and {z} placeholders",settings:{placeholder:ji.url},showIf:h=>h.config?.server===gs}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:ji.attribution},showIf:h=>h.config?.server===gs})},a))},defaultOptions:{server:Or}}],Xd='&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class Yd extends Fr{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[Xd];const i=e.crossOrigin!==void 0?e.crossOrigin:"anonymous",n=e.url!==void 0?e.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:t,attributionsCollapsible:!1,cacheSize:e.cacheSize,crossOrigin:i,interpolate:e.interpolate,maxZoom:e.maxZoom!==void 0?e.maxZoom:19,opaque:e.opaque!==void 0?e.opaque:!0,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:n,wrapX:e.wrapX,zDirection:e.zDirection})}}const jd=Yd,kr=[...[{id:"osm-standard",name:"Open Street Map",description:"Add map from a collaborative free geographic world database",isBaseMap:!0,create:async(s,e,t)=>({init:()=>new Mr({source:new jd})})}],...Wd,...Vd,...Ud];var ka=R(23908);const Hg=Object.freeze([0,0]),$g={layers:[]},Na={allLayers:!0,id:"zero",lat:0,lon:0,zoom:1};var Ki=(s=>(s.Details="details",s.None="none",s))(Ki||{}),Kd=(s=>(s.Coords="coords",s.Fit="fit",s.Zero="zero",s))(Kd||{}),Xe=(s=>(s.EQ="eq",s.NEQ="neq",s.LT="lt",s.LTE="lte",s.GT="gt",s.GTE="gte",s))(Xe||{});const za=(s,e)=>{const t=e.get(s.property);switch(s.operation){case Xe.EQ:return`${t}`==`${s.value}`;case Xe.NEQ:return t!==s.value;case Xe.GT:return t>s.value;case Xe.GTE:return t>=s.value;case Xe.LT:return t<s.value;case Xe.LTE:return t<=s.value;default:return!1}};var bn=R(45458);function Ga(s){const e=new Set,t=new Set;s.some((n,r)=>{for(const o of Object.keys(n.getProperties())){if(o==="geometry")continue;t.add(o);const a=n.getGeometry();a&&e.add(a.getType())}return r>10});let i=Wi.Any;if(e.size===1)switch(e.values().next().value){case"Point":case"MultiPoint":i=Wi.Point;break;case"Line":case"MultiLine":i=Wi.Line;break;case"Polygon":i=Wi.Polygon}return{geometryType:i,propertes:Array.from(t.keys()).map(n=>({label:n,value:n}))}}function Hd(s,e){const t=new Set;for(const n of s){const r=n.get(e);r!=null&&t.add(`${r}`)}const i=Array.from(t);return i.sort(),i}function Ba(s,e){if(s&&!e){const i={label:`${s}`,value:s};return{options:[i],current:i}}e||(e=[]);let t=e.find(i=>i.value===s);return s&&!t&&(t={label:`${s} (not found)`,value:s},e.push(t)),{options:e,current:t}}const Za=[{label:"==",value:Xe.EQ},{label:"!=",value:Xe.NEQ},{label:">",value:Xe.GT},{label:">=",value:Xe.GTE},{label:"<",value:Xe.LT},{label:"<=",value:Xe.LTE}],$d=({value:s,onChange:e,item:t,context:i})=>{const n=t.settings,{features:r,layerInfo:o}=n,a=(0,rs.Z)(o),l=(0,rs.Z)(r),h=(0,p.useMemo)(()=>{const M=s?.check?.property;return M&&l&&s.check?.operation===Xe.EQ?Hd(l,M).map(F=>{let O;return!isNaN(Number(F))?O={value:Number(F),label:F}:O={value:F,label:F},O}):[]},[l,s]),c=(0,bi.wW)(qd),u=10,d=(0,p.useCallback)(M=>{e({...s,check:{...s.check,property:M?.value}})},[e,s]),f=(0,p.useCallback)(M=>{e({...s,check:{...s.check,operation:M.value??Xe.EQ}})},[e,s]),g=(0,p.useCallback)(M=>{e({...s,check:{...s.check,value:M?.value}})},[e,s]),m=(0,p.useCallback)(M=>{e({...s,check:{...s.check,value:M}})},[e,s]),_=(0,p.useCallback)(M=>{e({...s,style:M})},[e,s]),x=(0,p.useCallback)(()=>{e(void 0)},[e]),E=s.check??Va.check,C=Ba(E.property,a?.propertes),b=Ba(E.value,h);return p.createElement("div",{className:c.rule},p.createElement(bt.Z,{className:c.row},p.createElement(mt._,{label:"Rule",labelWidth:u,grow:!0},p.createElement(Li.Ph,{placeholder:"Feature property",value:C.current,options:C.options,onChange:d,"aria-label":"Feature property",isClearable:!0,allowCustomValue:!0})),p.createElement(mt._,{className:c.inline},p.createElement(Li.Ph,{value:Za.find(M=>M.value===E.operation),options:Za,onChange:f,"aria-label":"Comparison operator",width:8})),p.createElement(mt._,{className:c.inline,grow:!0},p.createElement("div",{className:c.flexRow},(E.operation===Xe.EQ||E.operation===Xe.NEQ)&&p.createElement(Li.Ph,{placeholder:"value",value:b.current,options:b.options,onChange:g,"aria-label":"Comparison value",isClearable:!0,allowCustomValue:!0}),E.operation!==Xe.EQ&&p.createElement(bn.Y,{key:`${E.property}/${E.operation}`,value:isNaN(Number(E.value))?0:Number(E.value),placeholder:"numeric value",onChange:m}))),p.createElement(Vn.zx,{size:"md",icon:"trash-alt",onClick:()=>x(),variant:"secondary","aria-label":"Delete style rule",className:c.button})),p.createElement("div",null,p.createElement(Xi,{value:s.style??fe,context:i,onChange:_,item:{settings:{simpleFixedValues:!0,layerInfo:o}}})))},qd=s=>({rule:B.css`
    margin-bottom: ${s.spacing(1)};
  `,row:B.css`
    display: flex;
    margin-bottom: 4px;
  `,inline:B.css`
    margin-bottom: 0;
    margin-left: 4px;
  `,button:B.css`
    margin-left: 4px;
  `,flexRow:B.css`
    display: flex;
    flex-direction: row;
    align-items: flex-start;
  `}),Jd=({value:s,onChange:e,context:t,item:i})=>{const n=(0,bi.l4)(),r=i.settings,o=(0,p.useCallback)(()=>{const{palette:h}=n.visualization,c={fixed:h[Math.floor(Math.random()*h.length)]},u=[...s,{...Va,style:{...fe,color:c}}];e(u)},[e,s,n.visualization]),a=(0,p.useCallback)(h=>c=>{const u=[...s];c?u[h]=c:u.splice(h,1),e(u)},[e,s]),l=s&&s.map((h,c)=>{const u={settings:r};return p.createElement($d,{value:h,onChange:a(c),context:t,item:u,key:`${c}-${h.check?.property}`})});return p.createElement(p.Fragment,null,l,p.createElement(Vn.zx,{size:"sm",icon:"plus",onClick:o,variant:"secondary","aria-label":"Add geomap style rule"},"Add style rule"))};var Wa=R(43464),Ua=R(2101);const ms={src:"public/maps/countries.geojson",rules:[],style:fe},Va={style:fe,check:{property:"",operation:Xe.EQ,value:""}},Qd={id:"geojson",name:"GeoJSON",description:"Load static data from a geojson file",isBaseMap:!1,state:Si.BV.beta,create:async(s,e,t,i)=>{const n={...ms,...e.config},r=new Et({url:n.src,format:new ka.Z}),o=new fr.t,a=r.on("change",()=>{r.getState()=="ready"&&((0,rr.B)(a),o.next(r.getFeatures()))}),l=[];if(n.rules){for(const c of n.rules)if(c.style){const u=await wi(c.style);l.push({state:u,rule:c.check})}}{const c=await wi(n.style);l.push({state:c})}const h=new je({source:r,style:c=>{const u=c.getGeometry()?.getType()==="Point";for(const d of l)if(!(d.rule&&!za(d.rule,c))){if(d.state.fields){const f={...d.state.base},{text:g}=d.state.fields;return g&&(f.text=`${c.get(g)}`),u?d.state.maker(f):as(f)}return u?(d.point||(d.point=d.state.maker(d.state.base)),d.point):(d.poly||(d.poly=as(d.state.base)),d.poly)}}});return{init:()=>h,registerOptionsUI:c=>{const u=o.pipe((0,Wa.P)(),(0,Ua.U)(d=>Ga(d)));c.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:ma()??[],allowCustomValue:!0},defaultValue:ms.src}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:Xi,settings:{simpleFixedValues:!0,layerInfo:u},defaultValue:ms.style}).addCustomEditor({id:"config.rules",path:"config.rules",name:"Style rules",description:"Apply styles based on feature properties",editor:Jd,settings:{features:o,layerInfo:u},defaultValue:[]})}}},defaultOptions:ms},_s=34962,Nr=34963,ef=35040,tf=35044,ps=35048,nf=5121,sf=5123,rf=5125,Xa=5126,Ya=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function zr(s,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!He.ME},e);const t=Ya.length;for(let i=0;i<t;++i)try{const n=s.getContext(Ya[i],e);if(n)return n}catch{}return null}let Gr;function qg(){if(!Gr){const s=document.createElement("canvas"),e=zr(s);e&&(Gr=e.getSupportedExtensions())}return Gr}const of={STATIC_DRAW:tf,STREAM_DRAW:ef,DYNAMIC_DRAW:ps};class af{constructor(e,t){this.array=null,this.type=e,(0,T.h)(e===_s||e===Nr,62),this.usage=t!==void 0?t:of.STATIC_DRAW}ofSize(e){this.array=new(Br(this.type))(e)}fromArray(e){this.array=Br(this.type).from(e)}fromArrayBuffer(e){this.array=new(Br(this.type))(e)}getType(){return this.type}getArray(){return this.array}getUsage(){return this.usage}getSize(){return this.array?this.array.length:0}}function Br(s){switch(s){case _s:return Float32Array;case Nr:return Uint32Array;default:return Float32Array}}const Zr=af,ys={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"},lf=`
  precision mediump float;
  
  attribute vec2 a_position;
  varying vec2 v_texCoord;
  varying vec2 v_screenCoord;
  
  uniform vec2 u_screenSize;
   
  void main() {
    v_texCoord = a_position * 0.5 + 0.5;
    v_screenCoord = v_texCoord * u_screenSize;
    gl_Position = vec4(a_position, 0.0, 1.0);
  }
`,hf=`
  precision mediump float;
   
  uniform sampler2D u_image;
  uniform float u_opacity;
   
  varying vec2 v_texCoord;
   
  void main() {
    gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;
  }
`;class cf{constructor(e){this.gl_=e.webGlContext;const t=this.gl_;this.scaleRatio_=e.scaleRatio||1,this.renderTargetTexture_=t.createTexture(),this.renderTargetTextureSize_=null,this.frameBuffer_=t.createFramebuffer();const i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,e.vertexShader||lf),t.compileShader(i);const n=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(n,e.fragmentShader||hf),t.compileShader(n),this.renderTargetProgram_=t.createProgram(),t.attachShader(this.renderTargetProgram_,i),t.attachShader(this.renderTargetProgram_,n),t.linkProgram(this.renderTargetProgram_),this.renderTargetVerticesBuffer_=t.createBuffer();const r=[-1,-1,1,-1,-1,1,1,-1,1,1,-1,1];t.bindBuffer(t.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),t.bufferData(t.ARRAY_BUFFER,new Float32Array(r),t.STATIC_DRAW),this.renderTargetAttribLocation_=t.getAttribLocation(this.renderTargetProgram_,"a_position"),this.renderTargetUniformLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_screenSize"),this.renderTargetOpacityLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_opacity"),this.renderTargetTextureLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_image"),this.uniforms_=[],e.uniforms&&Object.keys(e.uniforms).forEach(function(o){this.uniforms_.push({value:e.uniforms[o],location:t.getUniformLocation(this.renderTargetProgram_,o)})}.bind(this))}getGL(){return this.gl_}init(e){const t=this.getGL(),i=[t.drawingBufferWidth*this.scaleRatio_,t.drawingBufferHeight*this.scaleRatio_];if(t.bindFramebuffer(t.FRAMEBUFFER,this.getFrameBuffer()),t.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const n=0,r=t.RGBA,o=0,a=t.RGBA,l=t.UNSIGNED_BYTE,h=null;t.bindTexture(t.TEXTURE_2D,this.renderTargetTexture_),t.texImage2D(t.TEXTURE_2D,n,r,i[0],i[1],o,a,l,h),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.renderTargetTexture_,0)}}apply(e,t,i,n){const r=this.getGL(),o=e.size;if(r.bindFramebuffer(r.FRAMEBUFFER,t?t.getFrameBuffer():null),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.renderTargetTexture_),!t){const l=(0,Y.sq)(r.canvas);if(!e.renderTargets[l]){const h=r.getContextAttributes();h&&h.preserveDrawingBuffer&&(r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT)),e.renderTargets[l]=!0}}r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.bindBuffer(r.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),r.useProgram(this.renderTargetProgram_),r.enableVertexAttribArray(this.renderTargetAttribLocation_),r.vertexAttribPointer(this.renderTargetAttribLocation_,2,r.FLOAT,!1,0,0),r.uniform2f(this.renderTargetUniformLocation_,o[0],o[1]),r.uniform1i(this.renderTargetTextureLocation_,0);const a=e.layerStatesArray[e.layerIndex].opacity;r.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(e),i&&i(r,e),r.drawArrays(r.TRIANGLES,0,6),n&&n(r,e)}getFrameBuffer(){return this.frameBuffer_}applyUniforms(e){const t=this.getGL();let i,n=1;this.uniforms_.forEach(function(r){if(i=typeof r.value=="function"?r.value(e):r.value,i instanceof HTMLCanvasElement||i instanceof ImageData)r.texture||(r.texture=t.createTexture()),t.activeTexture(t[`TEXTURE${n}`]),t.bindTexture(t.TEXTURE_2D,r.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),i instanceof ImageData?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,i.width,i.height,0,t.UNSIGNED_BYTE,new Uint8Array(i.data)):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i),t.uniform1i(r.location,n++);else if(Array.isArray(i))switch(i.length){case 2:t.uniform2f(r.location,i[0],i[1]);return;case 3:t.uniform3f(r.location,i[0],i[1],i[2]);return;case 4:t.uniform4f(r.location,i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&t.uniform1f(r.location,i)})}}const ja=cf;function uf(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Wr(s,e){return s[0]=e[0],s[1]=e[1],s[4]=e[2],s[5]=e[3],s[12]=e[4],s[13]=e[5],s}const Jg={FRAGMENT_SHADER:35632,VERTEX_SHADER:35633},ui={PROJECTION_MATRIX:"u_projectionMatrix",OFFSET_SCALE_MATRIX:"u_offsetScaleMatrix",OFFSET_ROTATION_MATRIX:"u_offsetRotateMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",SIZE_PX:"u_sizePx",PIXEL_RATIO:"u_pixelRatio"},Lt={UNSIGNED_BYTE:nf,UNSIGNED_SHORT:sf,UNSIGNED_INT:rf,FLOAT:Xa},xs={};function Ka(s){return"shared/"+s}let Ha=0;function df(){const s="unique/"+Ha;return Ha+=1,s}function ff(s){let e=xs[s];if(!e){const t=document.createElement("canvas");t.style.position="absolute",t.style.left="0",e={users:0,canvas:t},xs[s]=e}return e.users+=1,e.canvas}function gf(s){const e=xs[s];if(!e||(e.users-=1,e.users>0))return;const t=e.canvas,n=zr(t).getExtension("WEBGL_lose_context");n&&n.loseContext(),delete xs[s]}class mf extends xr.Z{constructor(e){super(),e=e||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=e.canvasCacheKey?Ka(e.canvasCacheKey):df(),this.canvas_=ff(this.canvasCacheKey_),this.gl_=zr(this.canvas_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.canvas_.addEventListener(ys.LOST,this.boundHandleWebGLContextLost_),this.canvas_.addEventListener(ys.RESTORED,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=(0,H.Ue)(),this.offsetScaleMatrix_=(0,H.Ue)(),this.tmpMat4_=uf(),this.uniformLocations_={},this.attribLocations_={},this.uniforms_=[],e.uniforms&&this.setUniforms(e.uniforms);const t=this.getGL();this.postProcessPasses_=e.postProcesses?e.postProcesses.map(function(i){return new ja({webGlContext:t,scaleRatio:i.scaleRatio,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,uniforms:i.uniforms})}):[new ja({webGlContext:t})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(e){this.uniforms_=[];for(const t in e)this.uniforms_.push({name:t,value:e[t]});this.uniformLocations_={}}canvasCacheKeyMatches(e){return this.canvasCacheKey_===Ka(e)}getExtension(e){if(e in this.extensionCache_)return this.extensionCache_[e];const t=this.gl_.getExtension(e);return this.extensionCache_[e]=t,t}bindBuffer(e){const t=this.getGL(),i=(0,Y.sq)(e);let n=this.bufferCache_[i];if(!n){const r=t.createBuffer();n={buffer:e,webGlBuffer:r},this.bufferCache_[i]=n}t.bindBuffer(e.getType(),n.webGlBuffer)}flushBufferData(e){const t=this.getGL();this.bindBuffer(e),t.bufferData(e.getType(),e.getArray(),e.getUsage())}deleteBuffer(e){const t=this.getGL(),i=(0,Y.sq)(e),n=this.bufferCache_[i];n&&!t.isContextLost()&&t.deleteBuffer(n.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){this.canvas_.removeEventListener(ys.LOST,this.boundHandleWebGLContextLost_),this.canvas_.removeEventListener(ys.RESTORED,this.boundHandleWebGLContextRestored_),gf(this.canvasCacheKey_),delete this.gl_,delete this.canvas_}prepareDraw(e,t){const i=this.getGL(),n=this.getCanvas(),r=e.size,o=e.pixelRatio;n.width=r[0]*o,n.height=r[1]*o,n.style.width=r[0]+"px",n.style.height=r[1]+"px";for(let a=this.postProcessPasses_.length-1;a>=0;a--)this.postProcessPasses_[a].init(e);i.bindTexture(i.TEXTURE_2D,null),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.enable(i.BLEND),i.blendFunc(i.ONE,t?i.ZERO:i.ONE_MINUS_SRC_ALPHA)}prepareDrawToRenderTarget(e,t,i){const n=this.getGL(),r=t.getSize();n.bindFramebuffer(n.FRAMEBUFFER,t.getFramebuffer()),n.viewport(0,0,r[0],r[1]),n.bindTexture(n.TEXTURE_2D,t.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,i?n.ZERO:n.ONE_MINUS_SRC_ALPHA)}drawElements(e,t){const i=this.getGL();this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,r=4,o=t-e,a=e*r;i.drawElements(i.TRIANGLES,o,n,a)}finalizeDraw(e,t,i){for(let n=0,r=this.postProcessPasses_.length;n<r;n++)n===r-1?this.postProcessPasses_[n].apply(e,null,t,i):this.postProcessPasses_[n].apply(e,this.postProcessPasses_[n+1])}getCanvas(){return this.canvas_}getGL(){return this.gl_}applyFrameState(e){const t=e.size,i=e.viewState.rotation,n=e.pixelRatio,r=(0,H.mc)(this.offsetScaleMatrix_);(0,H.bA)(r,2/t[0],2/t[1]);const o=(0,H.mc)(this.offsetRotateMatrix_);i!==0&&(0,H.U1)(o,-i),this.setUniformMatrixValue(ui.OFFSET_SCALE_MATRIX,Wr(this.tmpMat4_,r)),this.setUniformMatrixValue(ui.OFFSET_ROTATION_MATRIX,Wr(this.tmpMat4_,o)),this.setUniformFloatValue(ui.TIME,(Date.now()-this.startTime_)*.001),this.setUniformFloatValue(ui.ZOOM,e.viewState.zoom),this.setUniformFloatValue(ui.RESOLUTION,e.viewState.resolution),this.setUniformFloatValue(ui.PIXEL_RATIO,n),this.setUniformFloatVec2(ui.SIZE_PX,[t[0],t[1]])}applyUniforms(e){const t=this.getGL();let i,n=0;this.uniforms_.forEach(function(r){if(i=typeof r.value=="function"?r.value(e):r.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData)r.texture||(r.prevValue=void 0,r.texture=t.createTexture()),t.activeTexture(t[`TEXTURE${n}`]),t.bindTexture(t.TEXTURE_2D,r.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(!(i instanceof HTMLImageElement)||i.complete)&&r.prevValue!==i&&(r.prevValue=i,t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)),t.uniform1i(this.getUniformLocation(r.name),n++);else if(Array.isArray(i)&&i.length===6)this.setUniformMatrixValue(r.name,Wr(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:t.uniform2f(this.getUniformLocation(r.name),i[0],i[1]);return;case 3:t.uniform3f(this.getUniformLocation(r.name),i[0],i[1],i[2]);return;case 4:t.uniform4f(this.getUniformLocation(r.name),i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&t.uniform1f(this.getUniformLocation(r.name),i)}.bind(this))}useProgram(e,t){this.getGL().useProgram(e),this.currentProgram_=e,this.uniformLocations_={},this.attribLocations_={},this.applyFrameState(t),this.applyUniforms(t)}compileShader(e,t){const i=this.getGL(),n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}getProgram(e,t){const i=this.getGL(),n=this.compileShader(e,i.FRAGMENT_SHADER),r=this.compileShader(t,i.VERTEX_SHADER),o=i.createProgram();if(i.attachShader(o,n),i.attachShader(o,r),i.linkProgram(o),!i.getShaderParameter(n,i.COMPILE_STATUS)){const a=`Fragment shader compliation failed: ${i.getShaderInfoLog(n)}`;throw new Error(a)}if(i.deleteShader(n),!i.getShaderParameter(r,i.COMPILE_STATUS)){const a=`Vertex shader compilation failed: ${i.getShaderInfoLog(r)}`;throw new Error(a)}if(i.deleteShader(r),!i.getProgramParameter(o,i.LINK_STATUS)){const a=`GL program linking failed: ${i.getShaderInfoLog(r)}`;throw new Error(a)}return o}getUniformLocation(e){return this.uniformLocations_[e]===void 0&&(this.uniformLocations_[e]=this.getGL().getUniformLocation(this.currentProgram_,e)),this.uniformLocations_[e]}getAttributeLocation(e){return this.attribLocations_[e]===void 0&&(this.attribLocations_[e]=this.getGL().getAttribLocation(this.currentProgram_,e)),this.attribLocations_[e]}makeProjectionTransform(e,t){const i=e.size,n=e.viewState.rotation,r=e.viewState.resolution,o=e.viewState.center;return(0,H.mc)(t),(0,H.qC)(t,0,0,2/(r*i[0]),2/(r*i[1]),-n,-o[0],-o[1]),t}setUniformFloatValue(e,t){this.getGL().uniform1f(this.getUniformLocation(e),t)}setUniformFloatVec2(e,t){this.getGL().uniform2fv(this.getUniformLocation(e),t)}setUniformFloatVec4(e,t){this.getGL().uniform4fv(this.getUniformLocation(e),t)}setUniformMatrixValue(e,t){this.getGL().uniformMatrix4fv(this.getUniformLocation(e),!1,t)}enableAttributeArray_(e,t,i,n,r){const o=this.getAttributeLocation(e);o<0||(this.getGL().enableVertexAttribArray(o),this.getGL().vertexAttribPointer(o,t,i,!1,n,r))}enableAttributes(e){const t=_f(e);let i=0;for(let n=0;n<e.length;n++){const r=e[n];this.enableAttributeArray_(r.name,r.size,r.type||Xa,t,i),i+=r.size*$a(r.type)}}handleWebGLContextLost(){(0,Qt.Z)(this.bufferCache_),this.currentProgram_=null}handleWebGLContextRestored(){}createTexture(e,t,i){const n=this.getGL();i=i||n.createTexture();const r=0,o=n.RGBA,a=0,l=n.RGBA,h=n.UNSIGNED_BYTE;return n.bindTexture(n.TEXTURE_2D,i),t?n.texImage2D(n.TEXTURE_2D,r,o,l,h,t):n.texImage2D(n.TEXTURE_2D,r,o,e[0],e[1],a,l,h,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),i}}function _f(s){let e=0;for(let t=0;t<s.length;t++){const i=s[t];e+=i.size*$a(i.type)}return e}function $a(s){switch(s){case Lt.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Lt.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Lt.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Lt.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}const pf=mf;class Ur extends No{constructor(e,t){super(e),t=t||{},this.inversePixelTransform_=(0,H.Ue)(),this.pixelContext_=null,this.postProcesses_=t.postProcesses,this.uniforms_=t.uniforms,this.helper,e.addChangeListener(Pe.MAP,this.removeHelper.bind(this)),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(e,t){const i=this.getLayer();if(i.hasListener(at.PRECOMPOSE)){const n=new En(at.PRECOMPOSE,void 0,t,e);i.dispatchEvent(n)}}dispatchPostComposeEvent(e,t){const i=this.getLayer();if(i.hasListener(at.POSTCOMPOSE)){const n=new En(at.POSTCOMPOSE,void 0,t,e);i.dispatchEvent(n)}}reset(e){this.uniforms_=e.uniforms,this.helper&&this.helper.setUniforms(this.uniforms_)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(e){if(this.getLayer().getRenderSource()){let t=!0,i=-1,n;for(let o=0,a=e.layerStatesArray.length;o<a;o++){const l=e.layerStatesArray[o].layer,h=l.getRenderer();if(!(h instanceof Ur)){t=!0;continue}const c=l.getClassName();if((t||c!==n)&&(i+=1,t=!1),n=c,h===this)break}const r="map/"+e.mapId+"/group/"+i;(!this.helper||!this.helper.canvasCacheKeyMatches(r))&&(this.removeHelper(),this.helper=new pf({postProcesses:this.postProcesses_,uniforms:this.uniforms_,canvasCacheKey:r}),n&&(this.helper.getCanvas().className=n),this.afterHelperCreated())}return this.prepareFrameInternal(e)}afterHelperCreated(){}prepareFrameInternal(e){return!0}disposeInternal(){this.removeHelper(),super.disposeInternal()}dispatchRenderEvent_(e,t,i){const n=this.getLayer();if(n.hasListener(e)){(0,H.qC)(this.inversePixelTransform_,0,0,i.pixelRatio,-i.pixelRatio,0,0,-i.size[1]);const r=new En(e,this.inversePixelTransform_,i,t);n.dispatchEvent(r)}}preRender(e,t){this.dispatchRenderEvent_(at.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(at.POSTRENDER,e,t)}}const yf=Ur,Nt=new Uint8Array(4);class xf{constructor(e,t){this.helper_=e;const i=e.getGL();this.texture_=i.createTexture(),this.framebuffer_=i.createFramebuffer(),this.size_=t||[1,1],this.data_=new Uint8Array(0),this.dataCacheDirty_=!0,this.updateSize_()}setSize(e){(0,U.fS)(e,this.size_)||(this.size_[0]=e[0],this.size_[1]=e[1],this.updateSize_())}getSize(){return this.size_}clearCachedData(){this.dataCacheDirty_=!0}readAll(){if(this.dataCacheDirty_){const e=this.size_,t=this.helper_.getGL();t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer_),t.readPixels(0,0,e[0],e[1],t.RGBA,t.UNSIGNED_BYTE,this.data_),this.dataCacheDirty_=!1}return this.data_}readPixel(e,t){if(e<0||t<0||e>this.size_[0]||t>=this.size_[1])return Nt[0]=0,Nt[1]=0,Nt[2]=0,Nt[3]=0,Nt;this.readAll();const i=Math.floor(e)+(this.size_[1]-Math.floor(t)-1)*this.size_[0];return Nt[0]=this.data_[i*4],Nt[1]=this.data_[i*4+1],Nt[2]=this.data_[i*4+2],Nt[3]=this.data_[i*4+3],Nt}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}updateSize_(){const e=this.size_,t=this.helper_.getGL();this.texture_=this.helper_.createTexture(e,null,this.texture_),t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer_),t.viewport(0,0,e[0],e[1]),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(e[0]*e[1]*4)}}const vf=xf,Vr={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"};var Qg=R(37072);const Ef=null,Xr={vertexPosition:0,indexPosition:0};function vs(s,e,t,i,n){s[e+0]=t,s[e+1]=i,s[e+2]=n}function em(s,e,t,i,n,r){const l=3+n,h=s[e+0],c=s[e+1],u=Ef;u.length=n;for(let m=0;m<u.length;m++)u[m]=s[e+2+m];let d=r?r.vertexPosition:0,f=r?r.indexPosition:0;const g=d/l;return vs(t,d,h,c,0),u.length&&t.set(u,d+3),d+=l,vs(t,d,h,c,1),u.length&&t.set(u,d+3),d+=l,vs(t,d,h,c,2),u.length&&t.set(u,d+3),d+=l,vs(t,d,h,c,3),u.length&&t.set(u,d+3),d+=l,i[f++]=g,i[f++]=g+1,i[f++]=g+3,i[f++]=g+1,i[f++]=g+2,i[f++]=g+3,Xr.vertexPosition=d,Xr.indexPosition=f,Xr}function tm(s,e,t,i,n,r,o,a,l,h){const u=5+a.length,d=r.length/u,f=[s[e+0],s[e+1]],g=[s[t],s[t+1]],m=applyTransform(h,[...f]),_=applyTransform(h,[...g]);function x(O,W,q){return Math.round(W*1500)+Math.round(q*1500)*1e4+O*1e4*1e4}function E(O,W,q){const ie=Math.sqrt((W[0]-O[0])*(W[0]-O[0])+(W[1]-O[1])*(W[1]-O[1])),ye=[(W[0]-O[0])/ie,(W[1]-O[1])/ie],xe=[-ye[1],ye[0]],oe=Math.sqrt((q[0]-O[0])*(q[0]-O[0])+(q[1]-O[1])*(q[1]-O[1])),Be=[(q[0]-O[0])/oe,(q[1]-O[1])/oe],_e=ie===0||oe===0?0:Math.acos(clamp(Be[0]*ye[0]+Be[1]*ye[1],-1,1));return Be[0]*xe[0]+Be[1]*xe[1]>0?_e:Math.PI*2-_e}const C=i!==null,b=n!==null;let M=0,F=0;if(C){const O=[s[i],s[i+1]],W=applyTransform(h,[...O]);M=E(m,_,W)}if(b){const O=[s[n],s[n+1]],W=applyTransform(h,[...O]);F=E(_,m,W)}r.push(f[0],f[1],g[0],g[1],x(0,M,F)),r.push(...a),r.push(f[0],f[1],g[0],g[1],x(1,M,F)),r.push(...a),r.push(f[0],f[1],g[0],g[1],x(2,M,F)),r.push(...a),r.push(f[0],f[1],g[0],g[1],x(3,M,F)),r.push(...a),o.push(d,d+1,d+2,d+1,d+3,d+2)}function im(s,e,t,i,n){const o=2+n;let a=e;const l=s.slice(a,a+n);a+=n;const h=s[a++];let c=0;const u=new Array(h-1);for(let g=0;g<h;g++)c+=s[a++],g<h-1&&(u[g]=c);const d=s.slice(a,a+c*2),f=earcut(d,u,2);for(let g=0;g<f.length;g++)i.push(f[g]+t.length/o);for(let g=0;g<d.length;g+=2)t.push(d[g],d[g+1],...l);return a+c*2}function nm(){const e=document.createElement("canvas").getContext("2d").createImageData(1,1);return e.data[0]=255,e.data[1]=255,e.data[2]=255,e.data[3]=255,e}function Cf(s,e){e=e||[];const t=256,i=t-1;return e[0]=Math.floor(s/t/t/t)/i,e[1]=Math.floor(s/t/t)%t/i,e[2]=Math.floor(s/t)%t/i,e[3]=s%t/i,e}function wf(s){let e=0;const t=256,i=t-1;return e+=Math.round(s[0]*t*t*t*i),e+=Math.round(s[1]*t*t*i),e+=Math.round(s[2]*t*i),e+=Math.round(s[3]*i),e}var Tf=R(88244).Buffer;function Sf(){const s='const e="GENERATE_POLYGON_BUFFERS",t="GENERATE_POINT_BUFFERS",n="GENERATE_LINE_STRING_BUFFERS",r="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";r.includes("firefox");r.includes("safari")&&!r.includes("chrom")&&(r.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(r)),r.includes("webkit")&&r.includes("edge"),r.includes("macintosh"),"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&(self,WorkerGlobalScope),function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch(e){}}();const o={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:\'`renderMode` must be `"hybrid"` or `"vector"`\',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection"};class i extends Error{constructor(e){const t=o[e];super(t),this.code=e,this.name="AssertionError",this.message=t}}function s(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function a(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new i(t)}(0!==n,32);const o=t[0],s=t[1],a=t[2],u=t[3],x=t[4],f=t[5];return e[0]=u/n,e[1]=-s/n,e[2]=-a/n,e[3]=o/n,e[4]=(a*f-u*x)/n,e[5]=-(o*f-s*x)/n,e}new Array(6);var u={exports:{}};function x(e,t,n){n=n||2;var r,o,i,s,a,u,x,y=t&&t.length,d=y?t[0]*n:e.length,h=f(e,0,d,n,!0),v=[];if(!h||h.next===h.prev)return v;if(y&&(h=function(e,t,n,r){var o,i,s,a=[];for(o=0,i=t.length;o<i;o++)(s=f(e,t[o]*r,o<i-1?t[o+1]*r:e.length,r,!1))===s.next&&(s.steiner=!0),a.push(w(s));for(a.sort(p),o=0;o<a.length;o++)n=l(n=g(a[o],n),n.next);return n}(e,t,h,n)),e.length>80*n){r=i=e[0],o=s=e[1];for(var b=n;b<d;b+=n)(a=e[b])<r&&(r=a),(u=e[b+1])<o&&(o=u),a>i&&(i=a),u>s&&(s=u);x=0!==(x=Math.max(i-r,s-o))?1/x:0}return c(h,v,n,r,o,x),v}function f(e,t,n,r,o){var i,s;if(o===B(e,t,n,r)>0)for(i=t;i<n;i+=r)s=U(i,e[i],e[i+1],s);else for(i=n-r;i>=t;i-=r)s=U(i,e[i],e[i+1],s);return s&&M(s,s.next)&&(z(s),s=s.next),s}function l(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!M(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(z(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function c(e,t,n,r,o,i,s){if(e){!s&&i&&function(e,t,n,r){var o=e;do{null===o.z&&(o.z=m(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,r,o,i,s,a,u,x=1;do{for(n=e,e=null,i=null,s=0;n;){for(s++,r=n,a=0,t=0;t<x&&(a++,r=r.nextZ);t++);for(u=x;a>0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(o=n,n=n.nextZ,a--):(o=r,r=r.nextZ,u--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,x*=2}while(s>1)}(o)}(e,r,o,i);for(var a,u,x=e;e.prev!==e.next;)if(a=e.prev,u=e.next,i?d(e,r,o,i):y(e))t.push(a.i/n),t.push(e.i/n),t.push(u.i/n),z(e),e=u.next,x=u.next;else if((e=u)===x){s?1===s?c(e=h(l(e),t,n),t,n,r,o,i,2):2===s&&v(e,t,n,r,o,i):c(l(e),t,n,r,o,i,1);break}}}function y(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var o=e.next.next;o!==e.prev;){if(A(t.x,t.y,n.x,n.y,r.x,r.y,o.x,o.y)&&Z(o.prev,o,o.next)>=0)return!1;o=o.next}return!0}function d(e,t,n,r){var o=e.prev,i=e,s=e.next;if(Z(o,i,s)>=0)return!1;for(var a=o.x<i.x?o.x<s.x?o.x:s.x:i.x<s.x?i.x:s.x,u=o.y<i.y?o.y<s.y?o.y:s.y:i.y<s.y?i.y:s.y,x=o.x>i.x?o.x>s.x?o.x:s.x:i.x>s.x?i.x:s.x,f=o.y>i.y?o.y>s.y?o.y:s.y:i.y>s.y?i.y:s.y,l=m(a,u,t,n,r),c=m(x,f,t,n,r),y=e.prevZ,d=e.nextZ;y&&y.z>=l&&d&&d.z<=c;){if(y!==e.prev&&y!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,y.x,y.y)&&Z(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,d!==e.prev&&d!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,d.x,d.y)&&Z(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;y&&y.z>=l;){if(y!==e.prev&&y!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,y.x,y.y)&&Z(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;d&&d.z<=c;){if(d!==e.prev&&d!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,d.x,d.y)&&Z(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function h(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!M(o,i)&&F(o,r,r.next,i)&&k(o,i)&&k(i,o)&&(t.push(o.i/n),t.push(r.i/n),t.push(i.i/n),z(r),z(r.next),r=e=i),r=r.next}while(r!==e);return l(r)}function v(e,t,n,r,o,i){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&E(s,a)){var u=S(s,a);return s=l(s,s.next),u=l(u,u.next),c(s,t,n,r,o,i),void c(u,t,n,r,o,i)}a=a.next}s=s.next}while(s!==e)}function p(e,t){return e.x-t.x}function g(e,t){var n=function(e,t){var n,r=t,o=e.x,i=e.y,s=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var a=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=o&&a>s){if(s=a,a===o){if(i===r.y)return r;if(i===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(o===s)return n;var u,x=n,f=n.x,l=n.y,c=1/0;r=n;do{o>=r.x&&r.x>=f&&o!==r.x&&A(i<l?o:s,i,f,l,i<l?s:o,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(o-r.x),k(r,e)&&(u<c||u===c&&(r.x>n.x||r.x===n.x&&b(n,r)))&&(n=r,c=u)),r=r.next}while(r!==x);return n}(e,t);if(!n)return t;var r=S(n,e),o=l(n,n.next);return l(r,r.next),t===n?o:t}function b(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function m(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*o)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*o)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function w(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function A(e,t,n,r,o,i,s,a){return(o-s)*(t-a)-(e-s)*(i-a)>=0&&(e-s)*(r-a)-(n-s)*(t-a)>=0&&(n-s)*(i-a)-(o-s)*(r-a)>=0}function E(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&F(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(k(e,t)&&k(t,e)&&function(e,t){var n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||M(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function M(e,t){return e.x===t.x&&e.y===t.y}function F(e,t,n,r){var o=I(Z(e,t,n)),i=I(Z(e,t,r)),s=I(Z(n,r,e)),a=I(Z(n,r,t));return o!==i&&s!==a||(!(0!==o||!T(e,n,t))||(!(0!==i||!T(e,r,t))||(!(0!==s||!T(n,e,r))||!(0!==a||!T(n,t,r)))))}function T(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function k(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function S(e,t){var n=new R(e.i,e.x,e.y),r=new R(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function U(e,t,n,r){var o=new R(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function z(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function R(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function B(e,t,n,r){for(var o=0,i=t,s=n-r;i<n;i+=r)o+=(e[s]-e[i])*(e[i+1]+e[s+1]),s=i;return o}u.exports=x,u.exports.default=x,x.deviation=function(e,t,n,r){var o=t&&t.length,i=o?t[0]*n:e.length,s=Math.abs(B(e,0,i,n));if(o)for(var a=0,u=t.length;a<u;a++){var x=t[a]*n,f=a<u-1?t[a+1]*n:e.length;s-=Math.abs(B(e,x,f,n))}var l=0;for(a=0;a<r.length;a+=3){var c=r[a]*n,y=r[a+1]*n,d=r[a+2]*n;l+=Math.abs((e[c]-e[d])*(e[y+1]-e[c+1])-(e[c]-e[y])*(e[d+1]-e[c+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},x.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,o=0;o<e.length;o++){for(var i=0;i<e[o].length;i++)for(var s=0;s<t;s++)n.vertices.push(e[o][i][s]);o>0&&(r+=e[o-1].length,n.holes.push(r))}return n};const P=[],C={vertexPosition:0,indexPosition:0};function N(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function _(e,t,n,r,o,i){const s=3+o,a=e[t+0],u=e[t+1],x=P;x.length=o;for(let n=0;n<x.length;n++)x[n]=e[t+2+n];let f=i?i.vertexPosition:0,l=i?i.indexPosition:0;const c=f/s;return N(n,f,a,u,0),x.length&&n.set(x,f+3),f+=s,N(n,f,a,u,1),x.length&&n.set(x,f+3),f+=s,N(n,f,a,u,2),x.length&&n.set(x,f+3),f+=s,N(n,f,a,u,3),x.length&&n.set(x,f+3),f+=s,r[l++]=c,r[l++]=c+1,r[l++]=c+3,r[l++]=c+1,r[l++]=c+2,r[l++]=c+3,C.vertexPosition=f,C.indexPosition=l,C}function L(e,t,n,r,o,i,a,u,x,f){const l=5+u.length,c=i.length/l,y=[e[t+0],e[t+1]],d=[e[n],e[n+1]],h=s(f,[...y]),v=s(f,[...d]);function p(e,t,n){const r=1e4;return Math.round(1500*t)+Math.round(1500*n)*r+e*r*r}function g(e,t,n){const r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),o=[(t[0]-e[0])/r,(t[1]-e[1])/r],i=[-o[1],o[0]],s=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),a=[(n[0]-e[0])/s,(n[1]-e[1])/s],u=0===r||0===s?0:Math.acos((x=a[0]*o[0]+a[1]*o[1],f=-1,l=1,Math.min(Math.max(x,f),l)));var x,f,l;return a[0]*i[0]+a[1]*i[1]>0?u:2*Math.PI-u}const b=null!==o;let m=0,w=0;if(null!==r){m=g(h,v,s(f,[...[e[r],e[r+1]]]))}if(b){w=g(v,h,s(f,[...[e[o],e[o+1]]]))}i.push(y[0],y[1],d[0],d[1],p(0,m,w)),i.push(...u),i.push(y[0],y[1],d[0],d[1],p(1,m,w)),i.push(...u),i.push(y[0],y[1],d[0],d[1],p(2,m,w)),i.push(...u),i.push(y[0],y[1],d[0],d[1],p(3,m,w)),i.push(...u),a.push(c,c+1,c+2,c+1,c+3,c+2)}function G(e,t,n,r,o){const i=2+o;let s=t;const a=e.slice(s,s+o);s+=o;const x=e[s++];let f=0;const l=new Array(x-1);for(let t=0;t<x;t++)f+=e[s++],t<x-1&&(l[t]=f);const c=e.slice(s,s+2*f),y=u.exports(c,l,2);for(let e=0;e<y.length;e++)r.push(y[e]+n.length/i);for(let e=0;e<c.length;e+=2)n.push(c[e],c[e+1],...a);return s+2*f}const O=self;O.onmessage=r=>{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesCount,r=t+n,i=new Float32Array(o.renderInstructions),s=i.length/r,a=4*s*(n+e),u=new Uint32Array(6*s),x=new Float32Array(a);let f;for(let e=0;e<i.length;e+=r)f=_(i,e,x,u,n,f);const l=Object.assign({vertexBuffer:x.buffer,indexBuffer:u.buffer,renderInstructions:i.buffer},o);O.postMessage(l,[x.buffer,u.buffer,i.buffer]);break}case n:{const e=[],t=[],n=o.customAttributesCount,r=2,i=new Float32Array(o.renderInstructions);let s=0;const u=o.renderInstructionsTransform,x=[1,0,0,1,0,0];let f,l;for(a(x,u);s<i.length;){l=Array.from(i.slice(s,s+n)),s+=n,f=i[s++];for(let n=0;n<f-1;n++)L(i,s+n*r,s+(n+1)*r,n>0?s+(n-1)*r:null,n<f-2?s+(n+2)*r:null,e,t,l,0,x);s+=f*r}const c=Uint32Array.from(t),y=Float32Array.from(e),d=Object.assign({vertexBuffer:y.buffer,indexBuffer:c.buffer,renderInstructions:i.buffer},o);O.postMessage(d,[y.buffer,c.buffer,i.buffer]);break}case e:{const e=[],t=[],n=o.customAttributesCount,r=new Float32Array(o.renderInstructions);let i=0;for(;i<r.length;)i=G(r,i,e,t,n);const s=Uint32Array.from(t),a=Float32Array.from(e),u=Object.assign({vertexBuffer:a.buffer,indexBuffer:s.buffer,renderInstructions:r.buffer},o);O.postMessage(u,[a.buffer,s.buffer,r.buffer]);break}}};';return new Worker(typeof Blob>"u"?"data:application/javascript;base64,"+Tf.from(s,"binary").toString("base64"):URL.createObjectURL(new Blob([s],{type:"application/javascript"})))}class Rf extends yf{constructor(e,t){const i=t.uniforms||{},n=(0,H.Ue)();i[ui.PROJECTION_MATRIX]=n,super(e,{uniforms:i,postProcesses:t.postProcesses}),this.ready=!1,this.sourceRevision_=-1,this.verticesBuffer_=new Zr(_s,ps),this.hitVerticesBuffer_=new Zr(_s,ps),this.indicesBuffer_=new Zr(Nr,ps),this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.program_,this.hitDetectionEnabled_=!!(t.hitFragmentShader&&t.hitVertexShader),this.hitVertexShader_=t.hitVertexShader,this.hitFragmentShader_=t.hitFragmentShader,this.hitProgram_;const r=t.attributes?t.attributes.map(function(a){return{name:"a_"+a.name,size:1,type:Lt.FLOAT}}):[];this.attributes=[{name:"a_position",size:2,type:Lt.FLOAT},{name:"a_index",size:1,type:Lt.FLOAT}].concat(r),this.hitDetectionAttributes=[{name:"a_position",size:2,type:Lt.FLOAT},{name:"a_index",size:1,type:Lt.FLOAT},{name:"a_hitColor",size:4,type:Lt.FLOAT},{name:"a_featureUid",size:1,type:Lt.FLOAT}].concat(r),this.customAttributes=t.attributes?t.attributes:[],this.previousExtent_=(0,v.lJ)(),this.currentTransform_=n,this.renderTransform_=(0,H.Ue)(),this.invertRenderTransform_=(0,H.Ue)(),this.renderInstructions_=new Float32Array(0),this.hitRenderInstructions_=new Float32Array(0),this.hitRenderTarget_,this.generateBuffersRun_=0,this.worker_=Sf(),this.worker_.addEventListener("message",function(a){const l=a.data;if(l.type===Vr.GENERATE_POINT_BUFFERS){const h=l.projectionTransform;l.hitDetection?(this.hitVerticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.hitVerticesBuffer_)):(this.verticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_)),this.indicesBuffer_.fromArrayBuffer(l.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=h,(0,H.nb)(this.invertRenderTransform_,this.renderTransform_),l.hitDetection?this.hitRenderInstructions_=new Float32Array(a.data.renderInstructions):(this.renderInstructions_=new Float32Array(a.data.renderInstructions),l.generateBuffersRun===this.generateBuffersRun_&&(this.ready=!0)),this.getLayer().changed()}}.bind(this)),this.featureCache_={},this.featureCount_=0;const o=this.getLayer().getSource();this.sourceListenKeys_=[(0,j.oL)(o,qe.ADDFEATURE,this.handleSourceFeatureAdded_,this),(0,j.oL)(o,qe.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,j.oL)(o,qe.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,j.oL)(o,qe.CLEAR,this.handleSourceFeatureClear_,this)],o.forEachFeature(function(a){this.featureCache_[(0,Y.sq)(a)]={feature:a,properties:a.getProperties(),geometry:a.getGeometry()},this.featureCount_++}.bind(this))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitProgram_=this.helper.getProgram(this.hitFragmentShader_,this.hitVertexShader_),this.hitRenderTarget_=new vf(this.helper))}handleSourceFeatureAdded_(e){const t=e.feature;this.featureCache_[(0,Y.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(e){const t=e.feature;this.featureCache_[(0,Y.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()}}handleSourceFeatureDelete_(e){const t=e.feature;delete this.featureCache_[(0,Y.sq)(t)],this.featureCount_--}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(e){const t=this.helper.getGL();this.preRender(t,e);const i=e.viewState.projection,o=this.getLayer().getSource().getWrapX()&&i.canWrapX(),a=i.getExtent(),l=e.extent,h=o?(0,v.dz)(a):null,c=o?Math.ceil((l[2]-a[2])/h)+1:1,u=o?Math.floor((l[0]-a[0])/h):0;let d=u;const f=this.indicesBuffer_.getSize();do this.helper.makeProjectionTransform(e,this.currentTransform_),(0,H.Iu)(this.currentTransform_,d*h,0),(0,H.Jp)(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e),this.helper.drawElements(0,f);while(++d<c);this.helper.finalizeDraw(e,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const g=this.helper.getCanvas();return this.hitDetectionEnabled_&&(this.renderHitDetection(e,u,c,h),this.hitRenderTarget_.clearCachedData()),this.postRender(t,e),g}prepareFrameInternal(e){const t=this.getLayer(),i=t.getSource(),n=e.viewState,r=!e.viewHints[ne.ANIMATING]&&!e.viewHints[ne.INTERACTING],o=!(0,v.fS)(this.previousExtent_,e.extent),a=this.sourceRevision_<i.getRevision();if(a&&(this.sourceRevision_=i.getRevision()),r&&(o||a)){const l=n.projection,h=n.resolution,c=t instanceof sr?t.getRenderBuffer():0,u=(0,v.f3)(e.extent,c*h);i.loadFeatures(u,h,l),this.rebuildBuffers_(e),this.previousExtent_=e.extent.slice()}return this.helper.useProgram(this.program_,e),this.helper.prepareDraw(e),this.helper.bindBuffer(this.verticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.attributes),!0}rebuildBuffers_(e){const t=(0,H.Ue)();this.helper.makeProjectionTransform(e,t);const i=(2+this.customAttributes.length)*this.featureCount_;if((!this.renderInstructions_||this.renderInstructions_.length!==i)&&(this.renderInstructions_=new Float32Array(i)),this.hitDetectionEnabled_){const d=(7+this.customAttributes.length)*this.featureCount_;(!this.hitRenderInstructions_||this.hitRenderInstructions_.length!==d)&&(this.hitRenderInstructions_=new Float32Array(d))}let n,r;const o=[],a=[];let l=0,h=0,c;for(const d in this.featureCache_){if(n=this.featureCache_[d],r=n.geometry,!r||r.getType()!=="Point")continue;o[0]=r.getFlatCoordinates()[0],o[1]=r.getFlatCoordinates()[1],(0,H.nn)(t,o),c=Cf(h+6,a),this.renderInstructions_[l++]=o[0],this.renderInstructions_[l++]=o[1],this.hitDetectionEnabled_&&(this.hitRenderInstructions_[h++]=o[0],this.hitRenderInstructions_[h++]=o[1],this.hitRenderInstructions_[h++]=c[0],this.hitRenderInstructions_[h++]=c[1],this.hitRenderInstructions_[h++]=c[2],this.hitRenderInstructions_[h++]=c[3],this.hitRenderInstructions_[h++]=Number(d));let f;for(let g=0;g<this.customAttributes.length;g++)f=this.customAttributes[g].callback(n.feature,n.properties),this.renderInstructions_[l++]=f,this.hitDetectionEnabled_&&(this.hitRenderInstructions_[h++]=f)}const u={id:0,type:Vr.GENERATE_POINT_BUFFERS,renderInstructions:this.renderInstructions_.buffer,customAttributesCount:this.customAttributes.length};if(u.projectionTransform=t,u.generateBuffersRun=++this.generateBuffersRun_,this.ready=!1,this.worker_.postMessage(u,[this.renderInstructions_.buffer]),this.renderInstructions_=null,this.hitDetectionEnabled_){const d={id:0,type:Vr.GENERATE_POINT_BUFFERS,renderInstructions:this.hitRenderInstructions_.buffer,customAttributesCount:5+this.customAttributes.length};d.projectionTransform=t,d.hitDetection=!0,this.worker_.postMessage(d,[this.hitRenderInstructions_.buffer]),this.hitRenderInstructions_=null}}forEachFeatureAtCoordinate(e,t,i,n,r){if((0,T.h)(this.hitDetectionEnabled_,66),!this.hitRenderInstructions_)return;const o=(0,H.nn)(t.coordinateToPixelTransform,e.slice()),a=this.hitRenderTarget_.readPixel(o[0]/2,o[1]/2),l=[a[0]/255,a[1]/255,a[2]/255,a[3]/255],h=wf(l),c=this.hitRenderInstructions_[h],u=Math.floor(c).toString(),f=this.getLayer().getSource().getFeatureByUid(u);if(f)return n(f,this.getLayer(),null)}renderHitDetection(e,t,i,n){if(!this.hitVerticesBuffer_.getSize())return;let r=t;this.hitRenderTarget_.setSize([Math.floor(e.size[0]/2),Math.floor(e.size[1]/2)]),this.helper.useProgram(this.hitProgram_,e),this.helper.prepareDrawToRenderTarget(e,this.hitRenderTarget_,!0),this.helper.bindBuffer(this.hitVerticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.hitDetectionAttributes);do{this.helper.makeProjectionTransform(e,this.currentTransform_),(0,H.Iu)(this.currentTransform_,r*n,0),(0,H.Jp)(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e);const o=this.indicesBuffer_.getSize();this.helper.drawElements(0,o)}while(++r<i)}disposeInternal(){this.worker_.terminate(),this.layer_=null,this.sourceListenKeys_.forEach(function(e){(0,j.bN)(e)}),this.sourceListenKeys_=null,super.disposeInternal()}}const If=Rf,Mt={BLUR:"blur",GRADIENT:"gradient",RADIUS:"radius"},bf=["#00f","#0ff","#0f0","#ff0","#f00"];class Lf extends sr{constructor(e){e=e||{};const t=Object.assign({},e);delete t.gradient,delete t.radius,delete t.blur,delete t.weight,super(t),this.gradient_=null,this.addChangeListener(Mt.GRADIENT,this.handleGradientChanged_),this.setGradient(e.gradient?e.gradient:bf),this.setBlur(e.blur!==void 0?e.blur:15),this.setRadius(e.radius!==void 0?e.radius:8);const i=e.weight?e.weight:"weight";typeof i=="string"?this.weightFunction_=function(n){return n.get(i)}:this.weightFunction_=i,this.setRenderOrder(null)}getBlur(){return this.get(Mt.BLUR)}getGradient(){return this.get(Mt.GRADIENT)}getRadius(){return this.get(Mt.RADIUS)}handleGradientChanged_(){this.gradient_=Mf(this.getGradient())}setBlur(e){this.set(Mt.BLUR,e)}setGradient(e){this.set(Mt.GRADIENT,e)}setRadius(e){this.set(Mt.RADIUS,e)}createRenderer(){return new If(this,{className:this.getClassName(),attributes:[{name:"weight",callback:function(e){const t=this.weightFunction_(e);return t!==void 0?(0,w.uZ)(t,0,1):1}.bind(this)}],vertexShader:`
        precision mediump float;
        uniform mat4 u_projectionMatrix;
        uniform mat4 u_offsetScaleMatrix;
        uniform float u_size;
        attribute vec2 a_position;
        attribute float a_index;
        attribute float a_weight;

        varying vec2 v_texCoord;
        varying float v_weight;

        void main(void) {
          mat4 offsetMatrix = u_offsetScaleMatrix;
          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;
          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;
          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);
          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;
          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;
          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;
          v_texCoord = vec2(u, v);
          v_weight = a_weight;
        }`,fragmentShader:`
        precision mediump float;
        uniform float u_blurSlope;

        varying vec2 v_texCoord;
        varying float v_weight;

        void main(void) {
          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);
          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;
          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;
          float alpha = smoothstep(0.0, 1.0, value) * v_weight;
          gl_FragColor = vec4(alpha, alpha, alpha, alpha);
        }`,hitVertexShader:`
        precision mediump float;
        uniform mat4 u_projectionMatrix;
        uniform mat4 u_offsetScaleMatrix;
        uniform float u_size;
        attribute vec2 a_position;
        attribute float a_index;
        attribute float a_weight;
        attribute vec4 a_hitColor;

        varying vec2 v_texCoord;
        varying float v_weight;
        varying vec4 v_hitColor;

        void main(void) {
          mat4 offsetMatrix = u_offsetScaleMatrix;
          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;
          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;
          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);
          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;
          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;
          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;
          v_texCoord = vec2(u, v);
          v_hitColor = a_hitColor;
          v_weight = a_weight;
        }`,hitFragmentShader:`
        precision mediump float;
        uniform float u_blurSlope;

        varying vec2 v_texCoord;
        varying float v_weight;
        varying vec4 v_hitColor;

        void main(void) {
          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);
          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;
          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;
          float alpha = smoothstep(0.0, 1.0, value) * v_weight;
          if (alpha < 0.05) {
            discard;
          }

          gl_FragColor = v_hitColor;
        }`,uniforms:{u_size:function(){return(this.get(Mt.RADIUS)+this.get(Mt.BLUR))*2}.bind(this),u_blurSlope:function(){return this.get(Mt.RADIUS)/Math.max(1,this.get(Mt.BLUR))}.bind(this)},postProcesses:[{fragmentShader:`
            precision mediump float;

            uniform sampler2D u_image;
            uniform sampler2D u_gradientTexture;
            uniform float u_opacity;

            varying vec2 v_texCoord;

            void main() {
              vec4 color = texture2D(u_image, v_texCoord);
              gl_FragColor.a = color.a * u_opacity;
              gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;
              gl_FragColor.rgb *= gl_FragColor.a;
            }`,uniforms:{u_gradientTexture:function(){return this.gradient_}.bind(this),u_opacity:function(){return this.getOpacity()}.bind(this)}}]})}renderDeclutter(){}}function Mf(s){const i=$e(1,256),n=i.createLinearGradient(0,0,1,256),r=1/(s.length-1);for(let o=0,a=s.length;o<a;++o)n.addColorStop(o*r,s[o]);return i.fillStyle=n,i.fillRect(0,0,1,256),i.canvas}const Pf=Lf,Es={weight:{fixed:1,min:0,max:1},blur:15,radius:5},Af={id:"heatmap",name:"Heatmap",description:"Visualizes a heatmap of the data",isBaseMap:!1,showLocation:!0,create:async(s,e,t,i)=>{const n={...Es,...e.config},r=await(0,Yt.cJ)(e.location),o=new ls(r),a="_weight",l=new Pf({source:o,blur:n.blur,radius:n.radius,weight:h=>h.get(a)});return{init:()=>l,update:h=>{const c=h.series[0];if(!c)return;o.update(c);const u=(0,Je.getScaledDimension)(c,n.weight);o.forEachFeature(g=>{const m=g.get("rowIndex");m!=null&&g.set(a,u.get(m))});let d=["#00f","#0ff","#0f0","#ff0","#f00"];const f=u.field??c.fields.find(g=>g.type===an.fS.number);if(f){const g=(0,aa.fD)(f);g.isContinuous&&g.getColors&&(d=g.getColors(i))}l.setGradient(d)},registerOptionsUI:h=>{h.addCustomEditor({id:"config.weight",path:"config.weight",name:"Weight values",description:"Scale the distribution for each row",editor:ai.cL,settings:{min:0,max:1,hideRange:!0},defaultValue:{fixed:1,min:0,max:1}}).addSliderInput({path:"config.radius",description:"Configures the size of clusters",name:"Radius",defaultValue:Es.radius,settings:{min:1,max:50,step:1}}).addSliderInput({path:"config.blur",description:"Configures the amount of blur of clusters",name:"Blur",defaultValue:Es.blur,settings:{min:1,max:50,step:1}})}}},defaultOptions:Es},qa={icon:"https://openlayers.org/en/latest/examples/data/icon.png"},Df={id:"last-point-tracker",name:"Icon at last point",description:"Show an icon at the last point",isBaseMap:!1,showLocation:!0,state:Si.BV.alpha,create:async(s,e,t,i)=>{const n=new ft.Z({}),r={...qa,...e.config};n.setStyle(new we({image:new $n({src:r.icon})}));const o=new Et({features:[n]}),a=new je({source:o}),l=await(0,Yt.cJ)(e.location);return{init:()=>a,update:h=>{const c=h.series[0];if(c&&c.length){const u=(0,Yt.g6)(c,l);if(!u.field)return;n.setGeometry(u.field.values.get(c.length-1))}}}},defaultOptions:qa};var Ff=R(95027),Of=R(64724),wt=function(s,e){var t=s[0]-e[0],i=s[1]-e[1];return Math.sqrt(t*t+i*i)},di=function(s,e){return s[0]==e[0]&&s[1]==e[1]},sm=function(s){return kf(s.getGeometry())},kf=function(s){switch(s.getType()){case"Point":return s.getCoordinates();case"MultiPolygon":s=s.getPolygon(0);case"Polygon":return s.getInteriorPoint().getCoordinates();default:return s.getClosestPoint(ol_extent_getCenter(s.getExtent()))}},rm=function(s,e){var t=[],i=s.length-1,n=i,r,o,a,l,h,c,u,d,f,g,m,_,x,E=di(s[0],s[i]);E||(m=s[0],_=s[1],x=[m[0]+(_[1]-m[1])/wt(m,_)*e,m[1]-(_[0]-m[0])/wt(m,_)*e],t.push(x),s.push(s[i]),i++,n--);for(var C=0;C<n;C++)m=s[C],_=s[(C+1)%i],x=s[(C+2)%i],r=(_[1]-m[1])/(_[0]-m[0]),o=(x[1]-_[1])/(x[0]-_[0]),Math.abs(r-o)>1e-10&&(a=Math.sqrt((_[0]-m[0])*(_[0]-m[0])+(_[1]-m[1])*(_[1]-m[1])),l=Math.sqrt((x[0]-_[0])*(x[0]-_[0])+(x[1]-_[1])*(x[1]-_[1])),h=m[0]+e*(_[1]-m[1])/a,c=_[0]+e*(x[1]-_[1])/l,u=m[1]-e*(_[0]-m[0])/a,d=_[1]-e*(x[0]-_[0])/l,f=(o*c-r*h+u-d)/(o-r),g=(r*o*(c-h)+o*u-r*d)/(o-r),_[0]-m[0]==0&&(f=_[0]+e*(_[1]-m[1])/Math.abs(_[1]-m[1]),g=o*f-o*c+d),x[0]-_[0]==0&&(f=x[0]+e*(x[1]-_[1])/Math.abs(x[1]-_[1]),g=r*f-r*h+u),t.push([f,g]));return E?t.push(t[0]):(s.pop(),m=s[s.length-1],_=s[s.length-2],x=[m[0]-(_[1]-m[1])/wt(m,_)*e,m[1]+(_[0]-m[0])/wt(m,_)*e],t.push(x)),t},om=function(s,e){for(var t=0;t<e.length-1;t++){var i=e[t],n=e[t+1];if(di(s,i)||di(s,n))return{index:1,segment:[i,n]};var r=wt(i,n),o=[(n[0]-i[0])/r,(n[1]-i[1])/r],a=wt(i,s),l=[(s[0]-i[0])/a,(s[1]-i[1])/a];if(Math.abs(o[0]*l[1]-o[1]*l[0])<1e-10)return{index:1,segment:[i,n]}}return{index:-1}},am=function(s,e,t){for(var i,n,r=[],o=0;o<s.length-1;o++)!s[o].length||!s[o+1].length||(s[o][1]<=e&&s[o+1][1]>e||s[o][1]>=e&&s[o+1][1]<e)&&(n=(e-s[o][1])/(s[o+1][1]-s[o][1]),i=n*(s[o+1][0]-s[o][0])+s[o][0],r.push({contour:t,index:o,pt:[i,e],abs:n}));r.sort(function(h,c){return h.pt[0]-c.pt[0]});for(var a=[],l=0;l<r.length-1;l+=2)a.push([r[l],r[l+1]]);return a},lm=function(s,e){switch(s){case"LineString":return new ol_geom_LineString(e);case"LinearRing":return new ol_geom_LinearRing(e);case"MultiLineString":return new ol_geom_MultiLineString(e);case"MultiPoint":return new ol_geom_MultiPoint(e);case"MultiPolygon":return new ol_geom_MultiPolygon(e);case"Point":return new ol_geom_Point(e);case"Polygon":return new ol_geom_Polygon(e);default:return console.error("[createFromType] Unsupported type: "+s),null}},hm=function(s,e){var t=s[1][0]-s[0][0],i=s[1][1]-s[0][1],n=e[1][0]-e[0][0],r=e[1][1]-e[0][1],o=t*r-i*n;if(o!=0){var a=(t*s[0][1]-t*e[0][1]-i*s[0][0]+i*e[0][0])/o;return[e[0][0]+a*n,e[0][1]+a*r]}else return!1},Ja;(function(){function s(t,i){var n;for(let r=t.length-1;r>0;r--)(t[r][0]>i&&t[r-1][0]<i||t[r][0]<i&&t[r-1][0]>i)&&(n=[i,(i-t[r][0])/(t[r-1][0]-t[r][0])*(t[r-1][1]-t[r][1])+t[r][1]],t.splice(r,0,n))}function e(t,i){var n;for(let r=t.length-1;r>0;r--)(t[r][1]>i&&t[r-1][1]<i||t[r][1]<i&&t[r-1][1]>i)&&(n=[(i-t[r][1])/(t[r-1][1]-t[r][1])*(t[r-1][0]-t[r][0])+t[r][0],i],t.splice(r,0,n))}Ja=function(t,i){var n=i.getType()==="Polygon";if(!n&&i.getType()!=="MultiPolygon")return null;var r=i.getCoordinates();return n&&(r=[r]),r.forEach(function(o){o.forEach(function(a){s(a,t[0]),s(a,t[2]),e(a,t[1]),e(a,t[3])})}),r.forEach(function(o){o.forEach(function(a){a.forEach(function(l){l[0]<t[0]?l[0]=t[0]:l[0]>t[2]&&(l[0]=t[2]),l[1]<t[1]?l[1]=t[1]:l[1]>t[3]&&(l[1]=t[3])})})}),n?new L.ZP(r[0]):new Gi.Z(r)}})();var Cs=function(s,e,t,i){var n=[];i!==!1&&n.push(s);var r=wt(s,e);if(r){var o=Math.round(r/t);if(o>1)for(var a=(e[0]-s[0])/o,l=(e[1]-s[1])/o,h=1;h<o;h++)n.push([s[0]+a*h,s[1]+l*h])}return n.push(e),n};lt.Z.prototype.sampleAt=function(s){for(var e=this.getCoordinates(),t=[],i=1;i<e.length;i++)t=t.concat(Cs(e[i-1],e[i],s,i===1));return new lt.Z(t)},Qn.Z.prototype.sampleAt=function(s){var e=this.getCoordinates(),t=[];return e.forEach(function(i){for(var n=[],r=1;r<i.length;r++)n=n.concat(Cs(i[r-1],i[r],s,r===1));t.push(n)}),new Qn.Z(t)},L.ZP.prototype.sampleAt=function(s){var e=this.getCoordinates(),t=[];return e.forEach(function(i){for(var n=[],r=1;r<i.length;r++)n=n.concat(Cs(i[r-1],i[r],s,r===1));t.push(n)}),new L.ZP(t)},Gi.Z.prototype.sampleAt=function(s){var e=this.getCoordinates(),t=[];return e.forEach(function(i){var n=[];t.push(n),i.forEach(function(r){for(var o=[],a=1;a<r.length;a++)o=o.concat(Cs(r[a-1],r[a],s,a===1));n.push(o)})}),new Gi.Z(t)},ta.prototype.intersection=function(s,e){if(s.sampleAt){var t=(0,v.f3)(this.getCenter().concat(this.getCenter()),this.getRadius());s=Ja(t,s),s=s.simplify(e);var i=this.getCenter(),n=this.getRadius(),r=s.sampleAt(e).getCoordinates();switch(s.getType()){case"Polygon":r=[r];case"MultiPolygon":{var o=!1,a=[];return r.forEach(function(l){var h=[];a.push(h),l.forEach(function(c){var u=[];h.push(u),c.forEach(function(d){var f=wt(i,d);f>n?(o=!0,u.push([i[0]+n/f*(d[0]-i[0]),i[1]+n/f*(d[1]-i[1])])):u.push(d)})})}),o?s.getType()==="Polygon"?new L.ZP(a[0]):new Gi.Z(a):s}}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+s.getType());return s},lt.Z.prototype.splitAt=function(s,e){var t;if(!s)return[this];if(e||(e=1e-10),s.length&&s[0].length){var i=[this];for(t=0;t<s.length;t++){for(var n=[],r=0;r<i.length;r++){var o=i[r].splitAt(s[t],e);n=n.concat(o)}i=n}return i}if(di(s,this.getFirstCoordinate())||di(s,this.getLastCoordinate()))return[this];var a=this.getCoordinates(),l=[a[0]],h=[];for(t=0;t<a.length-1;t++)if(!di(a[t],a[t+1])){if(di(s,a[t+1]))l.push(a[t+1]),h.push(new lt.Z(l)),l=[];else if(!di(s,a[t])){var c,u,d=!1;a[t][0]==a[t+1][0]?(c=(a[t][1]-s[1])/(a[t][1]-a[t+1][1]),d=a[t][0]==s[0]&&0<c&&c<=1):a[t][1]==a[t+1][1]?(c=(a[t][0]-s[0])/(a[t][0]-a[t+1][0]),d=a[t][1]==s[1]&&0<c&&c<=1):(c=(a[t][0]-s[0])/(a[t][0]-a[t+1][0]),u=(a[t][1]-s[1])/(a[t][1]-a[t+1][1]),d=Math.abs(c-u)<=e&&0<c&&c<=1),d&&(l.push(s),h.push(new lt.Z(l)),l=[s])}l.push(a[t+1])}return l.length>1&&h.push(new lt.Z(l)),h.length?h:[this]};var Nf=class extends we{constructor(e){e=e||{},super({stroke:e.stroke,text:e.text,zIndex:e.zIndex,geometry:e.geometry}),this.setRenderer(this._render.bind(this)),this._visible=e.visible!==!1,typeof e.width=="function"?this._widthFn=e.width:this.setWidth(e.width),this.setWidth2(e.width2),typeof e.color=="function"?this._colorFn=e.color:this.setColor(e.color),this.setColor2(e.color2),this.setLineCap(e.lineCap),this.setArrow(e.arrow),this.setArrowSize(e.arrowSize),this.setArrowColor(e.arrowColor),this._offset=[0,0],this.setOffset(e.offset0,0),this.setOffset(e.offset1,1),this._noOverlap=e.noOverlap}setWidth(e){this._width=e||0}setWidth2(e){this._width2=e}getOffset(e){return this._offset[e]}setOffset(e,t){switch(e=Math.max(0,parseFloat(e)),t){case 0:{this._offset[0]=e;break}case 1:{this._offset[1]=e;break}}}setLineCap(e){this._lineCap=e==="round"?"round":"butt"}getWidth(e,t){if(this._widthFn)return this._widthFn(e,t);var i=typeof this._width2=="number"?this._width2:this._width;return this._width+(i-this._width)*t}setColor(e){try{this._color=Pi(e)}catch{this._color=[0,0,0,1]}}setColor2(e){try{this._color2=Pi(e)}catch{this._color2=null}}setArrowColor(e){try{this._acolor=Mi(e)}catch{this._acolor=null}}getColor(e,t){if(this._colorFn)return Mi(this._colorFn(e,t));var i=this._color,n=this._color2||this._color;return"rgba("+ +Math.round(i[0]+(n[0]-i[0])*t)+","+Math.round(i[1]+(n[1]-i[1])*t)+","+Math.round(i[2]+(n[2]-i[2])*t)+","+(i[3]+(n[3]-i[3])*t)+")"}getArrow(){return this._arrow}setArrow(e){this._arrow=parseInt(e),(this._arrow<-1||this._arrow>2)&&(this._arrow=0)}getArrowSize(){return this._arrowSize||[16,16]}setArrowSize(e){Array.isArray(e)?this._arrowSize=e:typeof e=="number"&&(this._arrowSize=[e,e])}drawArrow(e,t,i,n,r){var o=this.getArrowSize()[0]*r,a=wt(t,i),l=(t[0]-i[0])/a,h=(t[1]-i[1])/a;n=Math.max(this.getArrowSize()[1]/2,n/2)*r,e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(t[0]-o*l+n*h,t[1]-o*h-n*l),e.lineTo(t[0]-o*l-n*h,t[1]-o*h+n*l),e.lineTo(t[0],t[1]),e.fill()}_render(e,t){if(t.geometry.getType()==="LineString"){var i,n,r,o=t.context;if(!this._visible){var a=t.pixelRatio/t.resolution,l=Math.cos(t.rotation),h=Math.sin(t.rotation);n=t.geometry.getCoordinates();var c=e[0][0]-n[0][0]*a*l-n[0][1]*a*h,u=e[0][1]-n[0][0]*a*h+n[0][1]*a*l;for(e=[],i=0;r=n[i];i++)e[i]=[c+r[0]*a*l+r[1]*a*h,u+r[0]*a*h-r[1]*a*l,r[2]]}var d=this.getArrowSize()[0]*t.pixelRatio;o.save(),this.getOffset(0)&&this._splitAsize(e,this.getOffset(0)*t.pixelRatio),this.getOffset(1)&&this._splitAsize(e,this.getOffset(1)*t.pixelRatio,!0),e.length>1&&(this.getArrow()===-1||this.getArrow()===2)&&(r=this._splitAsize(e,d),this._acolor?o.fillStyle=this._acolor:o.fillStyle=this.getColor(t.feature,0),this.drawArrow(o,r[0],r[1],this.getWidth(t.feature,0),t.pixelRatio)),e.length>1&&this.getArrow()>0&&(r=this._splitAsize(e,d,!0),this._acolor?o.fillStyle=this._acolor:o.fillStyle=this.getColor(t.feature,1),this.drawArrow(o,r[0],r[1],this.getWidth(t.feature,1),t.pixelRatio));var f=this._splitInto(e,255,2),g=0,m=f.length;if(o.lineJoin="round",o.lineCap=this._lineCap||"butt",f.length>1)for(g=0;g<f.length;g++){var _=g/m;for(n=f[g],o.lineWidth=this.getWidth(t.feature,_)*t.pixelRatio,o.strokeStyle=this.getColor(t.feature,_),o.beginPath(),o.moveTo(n[0][0],n[0][1]),i=1;r=n[i];i++)o.lineTo(r[0],r[1]);o.stroke()}o.restore()}}_splitAsize(e,t,i){var n,r,o,a,l=0;for(i?o=e.pop():o=e.shift(),n=o;e.length;){if(i?r=e.pop():r=e.shift(),a=wt(n,r),l+a>t){n=[n[0]+(r[0]-n[0])*(t-l)/a,n[1]+(r[1]-n[1])*(t-l)/a],a=wt(n,o),i?(e.push(r),e.push(n),e.push([n[0]+(o[0]-n[0])/a,n[1]+(o[1]-n[1])/a])):(e.unshift(r),e.unshift(n),e.unshift([n[0]+(o[0]-n[0])/a,n[1]+(o[1]-n[1])/a]));break}l+=a,n=r}return[o,n]}_splitInto(e,t,i){var n,r,o=this._noOverlap?1:.9,a=[],l,h=0;for(n=1;r=e[n];n++)h+=wt(e[n-1],r);var c=Math.max(i||2,h/(t||255)),u=e[0];h=0;var d=[u];for(n=1,r=e[1];n<e.length;){var f=r[0]-u[0],g=r[1]-u[1];if(l=Math.sqrt(f*f+g*g),h+l>c){var m=(c-h)/l;d.push([u[0]+f*m,u[1]+g*m]),a.push(d),u=[u[0]+f*m*o,u[1]+g*m*o],d=[u],h=0}else h+=l,u=r,d.push(u),n++,r=e[n]}return a.push(d),a}};const zf=Nf,Ln={style:{...fe,opacity:1,lineWidth:2},arrow:0},Qa="route",cm={type:Qa,name:"",config:Ln,location:{mode:Sn.q1.Auto},tooltip:!1},Gf={id:Qa,name:"Route",description:"Render data points as a route",isBaseMap:!1,showLocation:!0,state:Si.BV.alpha,create:async(s,e,t,i)=>{const n={...Ln,...e?.config},r=await wi(n.style),o=await(0,Yt.cJ)(e.location),a=new ls(o),l=new je({source:a}),h=n.arrow==1||n.arrow==-1;if(!r.fields&&!h){const _=pr(r.base);r.config.size&&r.config.size.fixed&&_.getStroke().setWidth(r.config.size.fixed),l.setStyle(_)}else l.setStyle(_=>{const x=_.get("rowIndex"),E=r.dims;if(!E||!(0,dt.isNumber)(x))return pr(r.base);const C=[],b=_.getGeometry(),M=r.config.opacity??1;if(b instanceof Cn.ZP){const O=b.getCoordinates();if(O)for(let W=0;W<O.length-1;W++){const q=ln()(i.visualization.getColorByName((E.color&&E.color.get(W))??r.base.color)).setAlpha(M).toString(),ie=ln()(i.visualization.getColorByName((E.color&&E.color.get(W+1))??r.base.color)).setAlpha(M).toString(),ye=(E.size&&E.size.get(W))??r.base.size,xe=(E.size&&E.size.get(W+1))??r.base.size,oe=new zf({visible:!0,lineCap:n.arrow==0?"round":"square",color:q,color2:ie,width:(E.size&&E.size.get(W))??r.base.size,width2:(E.size&&E.size.get(W+1))??r.base.size});n.arrow&&(oe.setArrow(n.arrow),n.arrow>0?(oe.setArrowColor(ie),oe.setArrowSize((xe??0)*1.5)):(oe.setArrowColor(q),oe.setArrowSize((ye??0)*1.5)));const Be=new lt.Z([O[W],O[W+1]]);oe.setGeometry(Be),C.push(oe)}return C}const F={...r.base};return E.color&&(F.color=E.color.get(x)),pr(F)});const c=new ft.Z({}),u=(r.base.lineWidth||6)+2,d=new we({image:new Dt({radius:u,stroke:new Oe({color:(0,Of.alpha)(r.base.color,.4),width:u+2}),fill:new ke({color:r.base.color})})}),f=new je({source:new Et({features:[c]}),style:d}),g=new hi({layers:[l,f]}),m=new Ws.w0;return m.add(t.getStream(Wn.es).pipe((0,Ff.p)(8)).subscribe({next:_=>{const E=a.getFeatures()[0]?.get("frame"),C=_.payload?.point?.time;if(E&&C){const b=E.fields.find(M=>M.name===an.Ls);if(b){const M=b.values.toArray(),F=Bf(M,C);if(F!==null){const O=(0,Yt.g6)(E,o);O.field&&(c.setGeometry(O.field.values.get(F)),c.setStyle(d))}}}}})),m.add(t.subscribe(Wn.xH,_=>{c.setStyle(new we({}))})),{init:()=>g,dispose:()=>m.unsubscribe(),update:_=>{if(_.series?.length)for(const x of _.series){(r.fields||h)&&(r.dims=Tr(x,r,i)),a.updateLineString(x);break}},registerOptionsUI:_=>{_.addCustomEditor({id:"config.style",path:"config.style",name:"Style",editor:Xi,settings:{simpleFixedValues:!1},defaultValue:Ln.style}).addRadio({path:"config.arrow",name:"Arrow",settings:{options:[{label:"None",value:0},{label:"Forward",value:1},{label:"Reverse",value:-1}]},defaultValue:Ln.arrow})}}},defaultOptions:Ln};function Bf(s,e){if(s.length===0)return null;if(s.length===1)return 0;const t=s.length-1;if(e<s[0])return 0;if(e>s[t])return t;const i=Math.abs(Math.round(t*(e-s[0])/(s[t]-s[0])));if(e<s[i]){for(let n=i;n>0;n--)if(e>s[n])return n;return 0}else{for(let n=i;n<t;n++)if(e<s[n])return n;return t}}var zt=class extends Et{constructor(e){e=e||{},e.strategy=Ko,super(e),this.setLoader(this._loader),this.set("time",e.time||new Date),this.set("step",e.step||1)}static _sunEclipticPosition(e){var t=Math.PI/180,i=e-2451545,n=280.46+.9856474*i;n%=360;var r=357.528+.9856003*i;r%=360;var o=n+1.915*Math.sin(r*t)+.02*Math.sin(2*r*t),a=1.00014-.01671*Math.cos(r*t)-.0014*Math.cos(2*r*t);return{lambda:o,R:a}}static _eclipticObliquity(e){var t=e-2451545,i=t/36525,n=23.43929111-i*(46.836769/3600-i*(1831e-7/3600+i*(.0020034/3600-i*(576e-9/3600-i*434e-10/3600))));return n}static _sunEquatorialPosition(e,t){var i=180/Math.PI,n=Math.PI/180,r=Math.atan(Math.cos(t*n)*Math.tan(e*n))*i,o=Math.asin(Math.sin(t*n)*Math.sin(e*n))*i,a=Math.floor(e/90)*90,l=Math.floor(r/90)*90;return r=r+(a-l),{alpha:r,delta:o}}static getNightLat(e,t){var i=180/Math.PI,n=Math.PI/180,r=t?new Date(t):new Date,o=r/864e5+24405875e-1,a=(18.697374558+24.06570982441908*(o-2451545))%24,l=zt._sunEclipticPosition(o),h=zt._eclipticObliquity(o),c=zt._sunEquatorialPosition(l.lambda,h),u=a*15+e-c.alpha,d=Math.atan(-Math.cos(u*n)/Math.tan(c.delta*n))*i;return d}_loader(e,t,i){var n=this.getCoordinates(this.get("time")),r=new L.ZP([n]);r.transform("EPSG:4326",i),this.addFeature(new ft.Z(r))}setTime(e){this.set("time",e),this.refresh()}getSunPosition(e){var t=e?new Date(e):new Date,i=t/864e5+24405875e-1,n=(18.697374558+24.06570982441908*(i-2451545))%24,r=zt._sunEclipticPosition(i),o=zt._eclipticObliquity(i),a=zt._sunEquatorialPosition(r.lambda,o);return[a.alpha-n*15,a.delta]}getCoordinates(e,t){for(var i=180/Math.PI,n=Math.PI/180,r=e?new Date(e):new Date,o=r/864e5+24405875e-1,a=(18.697374558+24.06570982441908*(o-2451545))%24,l=[],h=zt._sunEclipticPosition(o),c=zt._eclipticObliquity(o),u=zt._sunEquatorialPosition(h.lambda,c),d=this.get("step")||1,f=-180;f<=180;f+=d){var g=f,m=a*15+g-u.alpha,_=Math.atan(-Math.cos(m*n)/Math.tan(u.delta*n))*i;l.push([g,_])}switch(t){case"line":break;case"day":u.delta*=-1;default:{_=u.delta<0?90:-90;for(var x=180;x>=-180;x-=d)l.push([x,_]);l.push(l[0]);break}}if(t==="daynight"){var E=[];l.forEach(function(C){E.push(C.slice())}),E[0][1]=-E[0][1],E[E.length-1][1]=-E[0][1],E[E.length-1][1]=-E[0][1],l=[l,E]}return l}};const el=zt;var Zf=(s=>(s.From="from",s.To="to",s))(Zf||{});const Ri={show:"to",sun:!1,nightColor:"#a7a6ba4D"},tl="dayNight",um={type:tl,name:"",config:Ri,tooltip:!0},Wf={id:tl,name:"Night / Day",description:"Show day and night regions",isBaseMap:!1,state:Si.BV.alpha,create:async(s,e,t,i)=>{const n={...Ri,...e?.config},r=new el({}),o=Object.getPrototypeOf(r),a=new el({}),l=Object.getPrototypeOf(a),h=new je({source:r,style:new we({fill:new ke({color:i.visualization.getColorByName(n.nightColor)})})}),c=new je({source:new Et({features:[]}),style:new we({stroke:new Oe({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),u=new ft.Z({geometry:new Jt.Z([])}),d=new je({source:new Et({features:[u]}),style:new we({image:new Dt({radius:13,fill:new ke({color:"rgb(253,184,19)"})})})}),f=new ft.Z({geometry:new Jt.Z([])}),g=new we({image:new Dt({radius:13,stroke:new Oe({color:"rgb(253,184,19)",width:1.5})})}),m=new we({image:new Dt({radius:15,stroke:new Oe({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),_=new je({source:new Et({features:[f]}),style:[m,g]}),x=new hi({layers:n.sun?[h,d,_,c]:[h,c]}),E=new Ws.w0;return{init:()=>x,dispose:()=>E.unsubscribe(),update:C=>{const b=new Date(C.timeRange.from.valueOf()),M=new Date(C.timeRange.to.valueOf());let F=new Date,O=[];n.show==="from"?F=b:F=M,r.setTime(F),n.sun&&(O=o.getSunPosition(F),u.getGeometry()?.setCoordinates((0,A.mi)(O)))},registerOptionsUI:C=>{e.config?.nightColor||(e.config={...Ri,...e.config}),C.addRadio({path:"config.show",name:"Show",settings:{options:[{label:"From",value:"from"},{label:"To",value:"to"}]},defaultValue:Ri.show}),C.addColorPicker({path:"config.nightColor",name:"Night region color",description:"Pick color of night region",defaultValue:Ri.nightColor,settings:[{enableNamedColors:!1}]}),C.addBooleanSwitch({path:"config.sun",name:"Display sun",description:"Show the sun",defaultValue:Ri.sun})}}},defaultOptions:Ri},Mn={src:"public/maps/countries.geojson",rules:[],style:fe,dataStyle:{}},dm={style:fe,check:{property:"",operation:Xe.EQ,value:""}},Uf={id:"dynamic-geojson",name:"Dynamic GeoJSON",description:"Style a geojson file based on query results",isBaseMap:!1,state:Si.BV.alpha,create:async(s,e,t,i)=>{const n={...Mn,...e.config},r=new Et({url:n.src,format:new ka.Z}),o=new fr.t,a=r.on("change",()=>{r.getState()=="ready"&&((0,rr.B)(a),o.next(r.getFeatures()))}),l=[];if(n.rules){for(const d of n.rules)if(d.style){const f=await wi(d.style);l.push({state:f,rule:d.check})}}{const d=await wi(n.style);l.push({state:d})}const h=await wi(n.style),c=new Map,u=new je({source:r,style:d=>{const f=c.get(d.getId()),g=h.dims;if(f&&g)return new we({fill:new ke({color:g.color?.get(f)}),stroke:new Oe({color:h.base.color,width:h.base.lineWidth??1})});const m=d.getGeometry()?.getType()==="Point";for(const _ of l)if(!(_.rule&&!za(_.rule,d))){if(_.state.fields){const x={..._.state.base},{text:E}=_.state.fields;return E&&(x.text=`${d.get(E)}`),m?_.state.maker(x):as(x)}return m?(_.point||(_.point=_.state.maker(_.state.base)),_.point):(_.poly||(_.poly=as(_.state.base)),_.poly)}}});return{init:()=>u,update:d=>{const f=d.series[0];if(f){const g=(0,Je.findField)(f,n.idField);g&&(c.clear(),g.values.toArray().forEach((m,_)=>c.set(m,_))),h.dims=Tr(f,h,i,n.dataStyle)}u.changed()},registerOptionsUI:d=>{const f=o.pipe((0,Wa.P)(),(0,Ua.U)(g=>Ga(g)));d.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:ma()??[],allowCustomValue:!0},defaultValue:Mn.src}).addFieldNamePicker({path:"config.idField",name:"ID Field"}).addCustomEditor({id:"config.dataStyle",path:"config.dataStyle",name:"Data style",editor:Xi,settings:{displayRotation:!1},defaultValue:Mn.dataStyle}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:Xi,settings:{simpleFixedValues:!0,layerInfo:f},defaultValue:Mn.style})}}},defaultOptions:Mn};var il=class extends it{constructor(e){e=e||{},e.displacement||(e.displacement=[e.offsetX||0,-e.offsetY||0]);var t=e.kind==="anchored"?8:0,i=Number(e.shadow)||0;e.stroke||(e.stroke=new Oe({width:0,color:"#000"}));var n=e.stroke.getWidth();if(n<0&&(n=0),e.kind=="folio"&&(n+=6),e.stroke.setWidth(n),super({radius:e.radius+n+t/2+i/2,points:0,displacement:[e.displacement[0]||0,(e.displacement[1]||0)+t],fill:it.prototype.render?new ke({color:[0,0,0,0]}):null}),this.sanchor_=t,this._shadow=i,!this.getHitDetectionImage){var r=super.getImage.call(this);if(!this.hitDetectionCanvas_){for(var o in this)if(this[o]&&this[o].getContext&&this[o]!==r){this.hitDetectionCanvas_=this[o];break}}this.hitDetectionCanvas_=document.createElement("canvas"),this.hitDetectionCanvas_.width=r.width,this.hitDetectionCanvas_.height=r.height;var a=this.hitDetectionCanvas_;this.getHitDetectionImage=function(){return a}}this._stroke=e.stroke,this._fill=e.fill,this._crop=e.crop,this._crossOrigin=e.crossOrigin,this._kind=e.kind||"default",this._radius=e.radius,this._src=e.src,this._offset=[e.offsetX?e.offsetX:0,e.offsetY?e.offsetY:0],this._onload=e.onload,typeof e.opacity=="number"&&this.setOpacity(e.opacity),typeof e.rotation=="number"&&this.setRotation(e.rotation),this.getImage()}setOffset(e){this._offset=[e[0]||0,e[1]||0],this.getImage()}clone(){var e=new il({stroke:this._stroke,fill:this._fill,shadow:this._shadow,crop:this._crop,crossOrigin:this._crossOrigin,kind:this._kind,radius:this._radius,src:this._src,offsetX:this._offset[0],offsetY:this._offset[1],opacity:this.getOpacity(),rotation:this.getRotation()});return e.getImage(),e}drawBack_(e,t,i,n){var r=this._shadow,o=e.canvas;e.beginPath(),e.fillStyle=t,e.clearRect(0,0,o.width,o.height);var a=o.width/n,l=o.height/n;switch(this._kind){case"square":{e.rect(0,0,a-r,l-r);break}case"circle":{e.arc(this._radius+i,this._radius+i,this._radius+i,0,2*Math.PI,!1);break}case"folio":{var h=6;i-=h,e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=1;var c=a-r-2*h,u=Math.atan(6/c);e.save(),e.rotate(-u),e.translate(-6,2),e.beginPath(),e.rect(h,h,c,c),e.stroke(),e.fill(),e.restore(),e.save(),e.translate(6,-1),e.rotate(u),e.beginPath(),e.rect(h,h,c,c),e.stroke(),e.fill(),e.restore(),e.beginPath(),e.rect(h,h,c,c),e.stroke();break}case"anchored":{e.roundRect(this.sanchor_/2,0,a-this.sanchor_-r,l-this.sanchor_-r,i),e.moveTo(a/2-this.sanchor_-r/2,l-this.sanchor_-r),e.lineTo(a/2+this.sanchor_-r/2,l-this.sanchor_-r),e.lineTo(a/2-r/2,l-r);break}default:{e.roundRect(0,0,a-r,l-r,i);break}}e.closePath()}getImage(e){e=e||1;var t=it.prototype.getImage.call(this,e);if(this._gethit)return t;var i,n=0;this._stroke&&(i=Mi(this._stroke.getColor()),n=this._stroke.getWidth()),this._gethit=!0;var r=this.getHitDetectionImage().getContext("2d");r.save(),r.setTransform(1,0,0,1,0,0),this.drawBack_(r,"#000",n,1),r.fill(),r.restore(),this._gethit=!1,r=t.getContext("2d"),r.save(),r.setTransform(e,0,0,e,0,0),this.drawBack_(r,i,n,e),this._shadow&&(r.shadowColor="rgba(0,0,0,0.5)",r.shadowBlur=e*this._shadow/2,r.shadowOffsetX=e*this._shadow/2,r.shadowOffsetY=e*this._shadow/2),r.fill(),r.restore();var o=this,a=this.img_=new Image;if(this._crossOrigin&&(a.crossOrigin=this._crossOrigin),a.src=this._src,a.width?o.drawImage_(t,a,e):a.onload=function(){o.drawImage_(t,a,e),o._onload&&o._onload()},!this.getDisplacement){var l=this.getAnchor();l[0]=(t.width/e-this._shadow)/2-this._offset[0],this.sanchor_?l[1]=t.height/e-this._shadow-this._offset[1]:l[1]=(t.height/e-this._shadow)/2-this._offset[1]}return t}getPhoto(){return this.img_}drawImage_(e,t,i){var n=e.getContext("2d"),r=0;this._stroke&&(r=this._stroke.getWidth());var o=2*this._radius;n.save(),it.prototype.render&&n.setTransform(i,0,0,i,0,0),this._kind=="circle"&&(n.beginPath(),n.arc(this._radius+r,this._radius+r,this._radius,0,2*Math.PI,!1),n.clip());var a,l,h,c,u,d,f,g,m;this._crop?(a=Math.min(t.width/o,t.height/o),g=m=a*o,d=(t.width-g)/2,f=(t.height-m)/2,l=h=0,c=u=o+1):(a=Math.min(o/t.width,o/t.height),d=f=0,g=t.width,m=t.height,c=a*g,u=a*m,l=(o-c)/2,h=(o-u)/2),l+=r+this.sanchor_/2,h+=r,n.drawImage(t,d,f,g,m,l,h,c,u),this._kind=="circle"&&r&&(n.beginPath(),n.strokeStyle=Mi(this._stroke.getColor()),n.lineWidth=r/4,n.arc(this._radius+r,this._radius+r,this._radius,0,2*Math.PI,!1),n.stroke()),n.restore()}};CanvasRenderingContext2D.prototype.roundRect=function(s,e,t,i,n){return n?(t<2*n&&(n=t/2),i<2*n&&(n=i/2),this.beginPath(),this.moveTo(s+n,e),this.arcTo(s+t,e,s+t,e+i,n),this.arcTo(s+t,e+i,s,e+i,n),this.arcTo(s,e+i,s,e,n),this.arcTo(s,e,s+t,e,n),this.closePath()):this.rect(s,e,t,i),this};const Yr=il,jt={kind:"square",border:2,shadow:!0,crop:!0,radius:20,color:"rgb(200, 200, 200)"},nl="photos",fm={type:nl,name:"",config:jt,location:{mode:Sn.q1.Auto},tooltip:!0},jr="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBjbGFzcz0iY3NzLWV5eDRkbyI+PHBhdGggZD0iTTExLjI5LDE1LjI5YTEuNTgsMS41OCwwLDAsMC0uMTIuMTUuNzYuNzYsMCwwLDAtLjA5LjE4LjY0LjY0LDAsMCwwLS4wNi4xOCwxLjM2LDEuMzYsMCwwLDAsMCwuMi44NC44NCwwLDAsMCwuMDguMzguOS45LDAsMCwwLC41NC41NC45NC45NCwwLDAsMCwuNzYsMCwuOS45LDAsMCwwLC41NC0uNTRBMSwxLDAsMCwwLDEzLDE2YTEsMSwwLDAsMC0uMjktLjcxQTEsMSwwLDAsMCwxMS4yOSwxNS4yOVpNMTIsMkExMCwxMCwwLDEsMCwyMiwxMiwxMCwxMCwwLDAsMCwxMiwyWm0wLDE4YTgsOCwwLDEsMSw4LThBOCw4LDAsMCwxLDEyLDIwWk0xMiw3QTMsMywwLDAsMCw5LjQsOC41YTEsMSwwLDEsMCwxLjczLDFBMSwxLDAsMCwxLDEyLDlhMSwxLDAsMCwxLDAsMiwxLDEsMCwwLDAtMSwxdjFhMSwxLDAsMCwwLDIsMHYtLjE4QTMsMywwLDAsMCwxMiw3WiI+PC9wYXRoPjwvc3ZnPgo=",Vf="data:image/svg+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";let Pn=[];const Xf={id:nl,name:"Photos",description:"Render photos at each data point",isBaseMap:!1,showLocation:!0,hideOpacity:!0,state:Si.BV.alpha,create:async(s,e,t,i)=>{const n={...jt,...e?.config},r=await(0,Yt.cJ)(e.location),o=new ls(r),a=new je({source:o});let l=[];return a.setStyle(h=>{let c=jr,u=1/0;l.length>0&&(u=h.get("rowIndex"),c=l[u]??jr);const d=new we({image:new Yr({src:c,radius:n.radius,crop:n.crop,kind:n.kind,shadow:!1,stroke:new Oe({width:0,color:"rgba(0,0,0,0)"}),onload:()=>{a.changed(),Pn&&!Pn.includes(u)&&Pn.push(u)}})}),f=new we({image:new Yr({src:Vf,radius:n.radius,crop:!1,kind:n.kind,shadow:n.shadow,stroke:new Oe({width:n.border??0,color:i.visualization.getColorByName(n.color)}),onload:()=>{a.changed()}})}),g=new we({image:new Yr({src:jr,radius:n.radius,crop:!1,kind:n.kind,shadow:!1,stroke:new Oe({width:0,color:"rgba(0,0,0,0)"}),onload:()=>{a.changed()}})});return Pn&&Pn.includes(u)?[f,d]:[f,g,d]}),{init:()=>a,update:h=>{if(!h.series?.length){o.clear();return}for(const c of h.series){if(o.update(c),n.src){const u=(0,Je.findField)(c,n.src);u&&(l=u?.values.toArray())}else for(let u=0;u<c.fields.length;u++){const d=c.fields[u];if(d.type===an.fS.string){l=d.values.toArray();break}}break}},registerOptionsUI:h=>{h.addFieldNamePicker({path:"config.src",name:"Image Source field",settings:{filter:c=>c.type===an.fS.string,noFieldsMessage:"No string fields found"}}).addRadio({path:"config.kind",name:"Kind",settings:{options:[{label:"Square",value:"square"},{label:"Circle",value:"circle"},{label:"Anchored",value:"anchored"},{label:"Folio",value:"folio"}]},defaultValue:jt.kind}).addBooleanSwitch({path:"config.crop",name:"Crop",settings:{},defaultValue:jt.crop}).addBooleanSwitch({path:"config.shadow",name:"Shadow",settings:{},defaultValue:jt.shadow}).addSliderInput({path:"config.border",name:"Border",settings:{min:0,max:10},defaultValue:jt.border}).addColorPicker({path:"config.color",name:"Border color",defaultValue:jt.color,settings:[{enableNamedColors:!1}]}).addSliderInput({path:"config.radius",name:"Radius",settings:{min:1,max:100},defaultValue:jt.radius})}}},defaultOptions:jt},sl=[Qu,Af,Df,Qd,Uf,Wf,Gf,Xf],Hi={type:"default",name:"",config:{}},rl={id:Hi.type,name:"Default base layer",isBaseMap:!0,create:(s,e,t,i)=>{const n=pi.vc?.geomapDefaultBaseLayerConfig?.type;if(n){const r=An.getIfExists(n);if(!r)throw new Error("Invalid basemap configuration on server");return r.create(s,pi.vc.geomapDefaultBaseLayerConfig,t,i)}return Aa.create(s,e,t,i)}},An=new os.B(()=>[rl,...kr,...sl]);function ol(s,e){const t={options:[],current:[]},i=[];for(const n of s){const r={label:n.name,value:n.id,description:n.description};if(n.state===Si.BV.alpha){if(!pi.Oh)continue;r.label=`${n.name} (Alpha)`,r.icon="bolt",i.push(r)}else t.options.push(r);n.id===e&&t.current.push(r)}for(const n of i)t.options.push(n);return t}function al(s,e){return ol(s?[rl,...kr]:[...sl,...kr],e)}var Yf=R(96209),ll=R(3249),jf=R(8928);const Kr=(s,e,t)=>{if(s.update){let i=t;if(e.filterData){const n=(0,ll.b9)(e.filterData);i={...i,series:i.series.filter(n)}}s.update(i)}};async function Kf(s,e,t){if(!s.map)return!1;const i=s.byName.get(e);if(!i)return!1;let n=-1;const r=s.map?.getLayers();for(let a=0;a<r?.getLength();a++)if(r.item(a)===i.layer){n=a;break}if(t.name!==e){if(!t.name)t.name=e;else if(s.byName.has(t.name))return!1;s.byName.delete(e),e=t.name,s.byName.set(e,i)}i.options.type,t.type;const o=s.layers.slice(0);try{const a=await ws(s,s.map,t,i.isBasemap);o[n]?.handler.dispose?.(),o[n]=a,r.setAt(n,a.layer),Kr(a.handler,t,s.props.data)}catch(a){return console.warn("ERROR",a),!1}return s.setState({legends:[]}),s.layers=o,s.doOptionsUpdate(n),!0}async function ws(s,e,t,i){i&&(!t?.type||X.v.geomapDisableCustomBaseLayer)&&(t=Hi),t?.type||(t={type:Rr,name:Sr(s),config:{}});const n=An.getIfExists(t.type);if(!n)return Promise.reject("unknown layer: "+t.type);t.config?.attribution&&(t.config.attribution=jf.QX.sanitizeTextPanelContent(t.config.attribution));const r=await n.create(e,t,s.props.eventBus,X.v.theme2),o=r.init();t.opacity!=null&&o.setOpacity(t.opacity),t.name||(t.name=Sr(s));const a=t.name,l={isBasemap:i,options:t,layer:o,handler:r,mouseEvents:new Yf.x,getName:()=>a,onChange:h=>{Kf(s,a,h)}};return s.byName.set(a,l),l.layer.__state=l,Kr(r,t,s.props.data),l}const hl=s=>s?.__state,Hf=s=>({selectLayer:t=>{const i=s.layers.findIndex(n=>n.options.name===t);s.panelContext&&s.panelContext.onInstanceStateChange&&s.panelContext.onInstanceStateChange({map:s.map,layers:s.layers,selected:i,actions:s.actions})},canRename:t=>!s.byName.has(t),deleteLayer:t=>{const i=[];for(const n of s.layers)n.options.name===t?s.map?.removeLayer(n.layer):i.push(n);s.layers=i,s.doOptionsUpdate(0)},addlayer:t=>{const i=An.getIfExists(t);i&&ws(s,s.map,{type:i.id,name:Sr(s),config:(0,dt.cloneDeep)(i.defaultOptions),location:i.showLocation?{mode:Sn.q1.Auto}:void 0,tooltip:!0,...!i.hideOpacity&&{opacity:fe.opacity}},!1).then(n=>{s.layers=s.layers.slice(0),s.layers.push(n),s.map?.addLayer(n.layer),s.doOptionsUpdate(s.layers.length-1)})},reorder:(t,i)=>{const n=Array.from(s.layers),[r]=n.splice(t,1);n.splice(i,0,r),s.layers=n,s.doOptionsUpdate(i);const o=s.map?.getLayers();o.clear(),s.layers.forEach(a=>o.push(a.layer))}});function $f(s=[],e=!1,t=!1,i){return s.filter(n=>n.layer instanceof je||n.layer instanceof hi).flatMap(n=>{const r=n.layer;if(r instanceof hi)return qf(r);if(r instanceof je){if(e)return[r.getSource().getExtent()];if(t&&i===n.options.name){const o=r.getSource().getFeatures(),l=o[o.length-1]?.getGeometry();return l?[l.getExtent()]:[]}else if(!t&&i===n.options.name)return[r.getSource().getExtent()];return[]}else return[]}).reduce(v.l7,(0,v.lJ)())}function qf(s){return s.getLayers().getArray().filter(e=>e instanceof je).map(e=>e instanceof je?e.getSource().getExtent()??[]:[])}const Jf=s=>{s.map?.on("singleclick",s.pointerClickListener),s.map?.on("pointermove",s.pointerMoveListener),s.map?.getViewport().addEventListener("mouseout",e=>{s.props.eventBus.publish(new Wn.xH)})},Qf=(s,e)=>{cl(s,e)&&(s.preventDefault(),s.stopPropagation(),e.mapDiv.style.cursor="auto",e.setState({ttipOpen:!0}))},cl=(s,e)=>{if(e.state.measureMenuActive)return!0;if(!e.map||e.state.ttipOpen)return!1;const t=s.originalEvent,i=e.map.getEventPixel(t),n=(0,A.bU)(e.map.getCoordinateFromPixel(i)),{hoverPayload:r}=e;r.pageX=t.pageX,r.pageY=t.pageY,r.point={lat:n[1],lon:n[0]},r.data=void 0,r.columnIndex=void 0,r.rowIndex=void 0,r.layers=void 0;const o=[],a=new Map;let l={};e.map.forEachFeatureAtPixel(i,(c,u,d)=>{const f=hl(u);if(!r.data){const g=c.getProperties(),m=g.frame;m&&(r.data=l.data=m,r.rowIndex=l.rowIndex=g.rowIndex),f?.mouseEvents&&f.mouseEvents.next(c)}if(f){let g=a.get(f);g||(g={layer:f,features:[]},a.set(f,g),o.push(g)),g.features.push(c)}},{layerFilter:c=>hl(c)?.options?.tooltip!==!1}),e.hoverPayload.layers=o.length?o:void 0,e.props.eventBus.publish(e.hoverEvent),e.setState({ttip:{...r}}),o.length||e.layers.forEach(c=>{c.mouseEvents.next(void 0)});const h=Boolean(o.length);return e.mapDiv.style.cursor=h?"pointer":"auto",h};var Tt=(s=>(s.Zero="zero",s.Coordinates="coords",s.Fit="fit",s))(Tt||{});const Dn=new os.B(()=>[{id:"fit",name:"Fit to data",zoom:15},{id:"zero",name:"(0\xB0, 0\xB0)",lat:0,lon:0},{id:"coords",name:"Coordinates"},{id:"north-america",name:"North America",lat:40,lon:-100,zoom:4},{id:"south-america",name:"South America",lat:-20,lon:-60,zoom:3},{id:"europe",name:"Europe",lat:46,lon:14,zoom:4},{id:"africa",name:"Africa",lat:0,lon:30,zoom:3},{id:"west-asia",name:"West Asia",lat:26,lon:53,zoom:4},{id:"s-asia",name:"South Asia",lat:19.5,lon:80,zoom:4},{id:"se-asia",name:"South-East Asia",lat:10,lon:106,zoom:4},{id:"e-asia",name:"East Asia",lat:33,lon:120,zoom:4},{id:"australia",name:"Australia",lat:-25,lon:135,zoom:4},{id:"oceania",name:"Oceania",lat:-10,lon:-140,zoom:3}]);let ul;class dl extends p.Component{constructor(e){super(e),this.panelContext=void 0,this.subs=new Ws.w0,this.globalCSS=Xc(X.v.theme2),this.hoverPayload={point:{},pageX:-1,pageY:-1},this.hoverEvent=new Wn.es(this.hoverPayload),this.layers=[],this.byName=new Map,this.actions=Hf(this),this.initMapRef=async t=>{if(!t)return;this.mapDiv=t,this.map&&this.map.dispose();const{options:i}=this.props,n=qu(this,i,t);this.byName.clear();const r=[];try{r.push(await ws(this,n,i.basemap??Hi,!0)),i.layers||(i.layers=[pa]);for(const o of i.layers)r.push(await ws(this,n,o,!1))}catch(o){console.error("error loading layers",o)}for(const o of r)n.addLayer(o.layer);this.layers=r,this.map=n,this.initViewExtent(n.getView(),i.view),this.mouseWheelZoom=new fo,this.map?.addInteraction(this.mouseWheelZoom),Ju(this,i),Jf(this),_a(this,r,r.length-1),this.setState({legends:this.getLegends()})},this.clearTooltip=()=>{this.state.ttip&&!this.state.ttipOpen&&this.tooltipPopupClosed()},this.tooltipPopupClosed=()=>{this.setState({ttipOpen:!1,ttip:void 0})},this.pointerClickListener=t=>{Qf(t,this)},this.pointerMoveListener=t=>{cl(t,this)},this.initMapView=(t,i)=>{let n=new Ve({center:[0,0],zoom:1,showFullExtent:!0});return t.shared&&(i?n=i:i=n),this.initViewExtent(n,t),[i,n]},this.state={ttipOpen:!1,legends:[]},this.subs.add(this.props.eventBus.subscribe(Ul.Yr,t=>{this.mapDiv&&this.props.id===t.payload&&this.initMapRef(this.mapDiv)}))}componentDidMount(){this.panelContext=this.context}componentWillUnmount(){this.subs.unsubscribe();for(const e of this.layers)e.handler.dispose?.();this.map?.dispose()}shouldComponentUpdate(e){return this.map&&((this.props.height!==e.height||this.props.width!==e.width)&&this.map.updateSize(),this.props.data!==e.data&&this.dataChanged(e.data),this.props.options!==e.options&&this.optionsChanged(e.options)),!0}componentDidUpdate(e){this.map&&(this.props.height!==e.height||this.props.width!==e.width)&&this.map.updateSize(),this.map&&this.props.data!==e.data&&this.dataChanged(this.props.data)}doOptionsUpdate(e){const{options:t,onOptionsChange:i}=this.props,n=this.layers;this.map?.getLayers().forEach(r=>{r instanceof ra&&(this.map?.removeLayer(r),this.map?.addLayer(r))}),i({...t,basemap:n[0].options,layers:n.slice(1).map(r=>r.options)}),_a(this,n,e),this.setState({legends:this.getLegends()})}optionsChanged(e){const t=this.props.options;if(e.view!==t.view){const[i,n]=this.initMapView(e.view,ul);ul=i,this.map&&n&&this.map.setView(n)}e.controls!==t.controls&&this.initControls(e.controls??{showZoom:!0,showAttribution:!0})}dataChanged(e){if(e===this.props.data)for(const i of this.layers)Kr(i.handler,i.options,this.props.data);const t=Dn.getIfExists(this.props.options.view.id);if(t&&t.id===Tt.Fit){const[,i]=this.initMapView(this.props.options.view);this.map&&i&&this.map.setView(i)}}initViewExtent(e,t){const i=Dn.getIfExists(t.id);if(i){let n;if(i.lat==null){if(i.id===Tt.Coordinates)n=[t.lon??0,t.lat??0];else if(i.id===Tt.Fit){const r=$f(this.layers,t.allLayers,t.lastOnly,t.layer);if(!(0,v.xb)(r)){const o=t.padding??5,a=e.getResolutionForExtent(r,this.map?.getSize()),l=t.zoom??t.maxZoom;e.fit(r,{maxZoom:l}),e.setResolution(a*(o/100+1));const h=e.getZoom();h&&l&&h>l&&e.setZoom(l)}}}else n=[i.lon??0,i.lat??0];n&&e.setCenter((0,A.mi)(n))}t.maxZoom&&e.setMaxZoom(t.maxZoom),t.minZoom&&e.setMaxZoom(t.minZoom),t.zoom&&i?.id!==Tt.Fit&&e.setZoom(t.zoom)}initControls(e){if(!this.map)return;this.map.getControls().clear(),e.showZoom&&this.map.addControl(new oo),e.showScale&&this.map.addControl(new Al({units:e.scaleUnits,minWidth:100})),this.mouseWheelZoom.setActive(Boolean(e.mouseWheelZoom)),e.showAttribution&&this.map.addControl(new ro({collapsed:!0,collapsible:!0}));let t=[];e.showMeasure&&(t=[p.createElement(Uc,{key:"measure",map:this.map,menuActiveState:n=>{this.setState({ttipOpen:n,measureMenuActive:n})}})]);let i=[];e.showDebug&&(i=[p.createElement(dh,{key:"debug",map:this.map})]),this.setState({topRight1:t,topRight2:i})}getLegends(){const e=[];for(const t of this.layers)t.handler.legend&&e.push(p.createElement("div",{key:t.options.name},t.handler.legend));return e}render(){let{ttip:e,ttipOpen:t,topRight1:i,legends:n,topRight2:r}=this.state;const{options:o}=this.props,a=o.controls.showScale;return!t&&o.tooltip?.mode===Ki.None&&(e=void 0),p.createElement(p.Fragment,null,p.createElement(be.Global,{styles:this.globalCSS}),p.createElement("div",{className:fl.wrap,onMouseLeave:this.clearTooltip},p.createElement("div",{className:fl.map,ref:this.initMapRef}),p.createElement(Vl,{bottomLeft:n,topRight1:i,topRight2:r,blStyle:{bottom:a?"35px":"8px"}})),p.createElement(hh,{ttip:e,isOpen:t,onClose:this.tooltipPopupClosed}))}}dl.contextType=Wl.bb;const fl={wrap:B.css`
    position: relative;
    width: 100%;
    height: 100%;
  `,map:B.css`
    position: absolute;
    z-index: 0;
    width: 100%;
    height: 100%;
  `};var eg=R(72243),Hr=R(19677),tg=R(39904),ig=R(93022);const ng="layer-drag-drop-list",gl=({layers:s,getLayerInfo:e,onDragEnd:t,onSelect:i,onDelete:n,onDuplicate:r,showActions:o,selection:a,excludeBaseLayer:l,onNameChange:h,verifyLayerNameUniqueness:c})=>{const u=(0,bi.wW)(sg),d=f=>f?`${u.row} ${u.sel}`:u.row;return p.createElement(Hr.Z5,{onDragEnd:t},p.createElement(Hr.bK,{droppableId:"droppable"},(f,g)=>p.createElement("div",{...f.droppableProps,ref:f.innerRef,"data-testid":ng},(()=>{const m=[],_=l?1:0,x=l?2:1;for(let E=s.length-1;E>=_;E--){const C=s[E],b=C.getName(),M=Boolean(a?.includes(b));m.push(p.createElement(Hr._l,{key:b,draggableId:b,index:m.length},(F,O)=>p.createElement("div",{className:d(M),ref:F.innerRef,...F.draggableProps,...F.dragHandleProps,onMouseDown:()=>i(C)},p.createElement(ig.X,{name:b,onChange:W=>h(C,W),verifyLayerNameUniqueness:c??void 0}),p.createElement("div",{className:u.textWrapper},"\xA0 ",e(C)),o(C)&&p.createElement(p.Fragment,null,r?p.createElement(Us.h,{name:"copy",title:"Duplicate",ariaLabel:"Duplicate button",className:u.actionIcon,onClick:()=>r(C)}):null,p.createElement(Us.h,{name:"trash-alt",title:"remove",ariaLabel:"Remove button",className:(0,B.cx)(u.actionIcon,u.dragIcon),onClick:()=>n(C)})),s.length>x&&p.createElement(tg.J,{"aria-label":"Drag and drop icon",title:"Drag and drop to reorder",name:"draggabledots",size:"lg",className:u.dragIcon}))))}return m})(),f.placeholder)))};gl.defaultProps={isGroup:()=>!1};const sg=s=>({wrapper:B.css`
    margin-bottom: ${s.spacing(2)};
  `,row:B.css`
    padding: ${s.spacing(.5,1)};
    border-radius: ${s.shape.borderRadius(1)};
    background: ${s.colors.background.secondary};
    min-height: ${s.spacing(4)};
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    cursor: pointer;

    border: 1px solid ${s.components.input.borderColor};
    &:hover {
      border: 1px solid ${s.components.input.borderHover};
    }
  `,sel:B.css`
    border: 1px solid ${s.colors.primary.border};
    &:hover {
      border: 1px solid ${s.colors.primary.border};
    }
  `,dragIcon:B.css`
    cursor: drag;
  `,actionIcon:B.css`
    color: ${s.colors.text.secondary};
    &:hover {
      color: ${s.colors.text};
    }
  `,typeWrapper:B.css`
    color: ${s.colors.primary.text};
    margin-right: 5px;
  `,textWrapper:B.css`
    display: flex;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    margin-right: ${s.spacing(1)};
  `}),rg=s=>{const{layers:e,selected:t,actions:i}=s.context.instanceState??{};if(!e||!i)return p.createElement("div",null,"No layers?");const n=c=>{if(!c.destination)return;const{layers:u,actions:d}=s.context.instanceState??{};if(!u||!d)return;const f=u.length-1,g=(c.source.index-f)*-1,m=(c.destination.index-f)*-1;d.reorder(g,m)},r=c=>{i.selectLayer(c.options.name)},o=c=>{i.deleteLayer(c.options.name)},a=c=>c.options.type,l=(c,u)=>{c.onChange({...c.options,name:u})},h=t?[e[t]?.getName()]:[];return p.createElement(p.Fragment,null,p.createElement(gr.W2,null,p.createElement(eg.f,{onChange:c=>i.addlayer(c.value),options:al(!1).options,label:"Add layer"})),p.createElement("br",null),p.createElement(gl,{layers:e,showActions:()=>e.length>2,getLayerInfo:a,onDragEnd:n,onSelect:r,onDelete:o,selection:h,excludeBaseLayer:!0,onNameChange:l,verifyLayerNameUniqueness:i.canRename}))},og=({labelWidth:s,value:e,onChange:t})=>{const i=r=>{t({...e,lat:r})},n=r=>{t({...e,lon:r})};return p.createElement(p.Fragment,null,p.createElement(bt.Z,null,p.createElement(mt._,{label:"Latitude",labelWidth:s,grow:!0},p.createElement(bn.Y,{value:e.lat,min:-90,max:90,step:.001,onChange:i}))),p.createElement(bt.Z,null,p.createElement(mt._,{label:"Longitude",labelWidth:s,grow:!0},p.createElement(bn.Y,{value:e.lon,min:-180,max:180,step:.001,onChange:n}))))};var ml=(s=>(s.all="all",s.layer="layer",s.last="last",s))(ml||{}),_l=(s=>(s.all="All layers",s.layer="Layer",s.last="Last value",s))(_l||{});const ag=Object.values(ml).map(s=>({label:_l[s],value:s})),lg=({labelWidth:s,value:e,onChange:t,context:i})=>{const n=(0,p.useMemo)(()=>i.options?.layers?i.options.layers.map(u=>({label:u.name,value:u.name,description:void 0})):[],[i.options?.layers]),r=(0,p.useCallback)(u=>{t({...e,layer:u.value})},[e,t]),o=p.createElement(bt.Z,null,p.createElement(mt._,{label:"Layer",labelWidth:s,grow:!0},p.createElement(Li.Ph,{options:n,onChange:r,placeholder:n[0]?.label}))),a=u=>{t({...e,padding:u})},l=p.createElement(bt.Z,null,p.createElement(mt._,{label:"Padding",labelWidth:s,grow:!0,tooltip:"sets padding in relative percent beyond data extent"},p.createElement(bn.Y,{value:e?.padding??5,min:0,step:1,onChange:a}))),h=e.allLayers?"all":!e.allLayers&&e.lastOnly?"last":"layer",c=u=>{u!=="all"&&!e.layer?t({...e,allLayers:u===String("all"),lastOnly:u===String("last"),layer:n[0].value}):t({...e,allLayers:u===String("all"),lastOnly:u===String("last")})};return p.createElement(p.Fragment,null,p.createElement(bt.Z,null,p.createElement(mt._,{label:"Data",labelWidth:s,grow:!0},p.createElement(Un.S,{value:h,options:ag,onChange:c}))),!e?.allLayers&&o,!e?.lastOnly&&l)},hg=({value:s,onChange:e,context:t})=>{const n=(0,p.useMemo)(()=>{const a=[];return s?.id?a.push(s.id):a.push(Dn.list()[0].id),Dn.selectOptions(a)},[s?.id]),r=(0,p.useCallback)(()=>{const a=t.instanceState?.map;if(a){const l=a.getView(),h=l.getCenter();if(h){const c=(0,A.bU)(h,l.getProjection());e({...s,id:Tt.Coordinates,lon:+c[0].toFixed(6),lat:+c[1].toFixed(6),zoom:+l.getZoom().toFixed(2)})}}},[s,e,t.instanceState]),o=(0,p.useCallback)(a=>{const l=Dn.getIfExists(a.value);l&&e({...s,id:l.id,lat:l.lat??s?.lat,lon:l.lon??s?.lon,zoom:l.zoom??s?.zoom})},[s,e]);return p.createElement(p.Fragment,null,p.createElement(bt.Z,null,p.createElement(mt._,{label:"View",labelWidth:10,grow:!0},p.createElement(Li.Ph,{options:n.options,value:n.current,onChange:o}))),s.id===Tt.Coordinates&&p.createElement(og,{labelWidth:10,value:s,onChange:e}),s.id===Tt.Fit&&p.createElement(lg,{labelWidth:10,value:s,onChange:e,context:t}),p.createElement(bt.Z,null,p.createElement(mt._,{label:s?.id===Tt.Fit?"Max Zoom":"Zoom",labelWidth:10,grow:!0},p.createElement(bn.Y,{value:s?.zoom??1,min:1,max:18,step:.01,onChange:a=>{e({...s,zoom:a})}}))),p.createElement(gr.wc,null,p.createElement(Vn.zx,{variant:"secondary",size:"sm",fullWidth:!0,onClick:r},p.createElement("span",null,"Use current map settings"))))};var cg=R(13505),ug=R(71575),dg=R(92465);function pl(s){return{category:s.category,path:"--",defaultValue:s.basemaps?Hi:pa,values:e=>({getContext:t=>({...t,options:s.state.options,instanceState:s.state}),getValue:t=>(0,dt.get)(s.state.options,t),onChange:(t,i)=>{const{state:n}=s,{options:r}=n;if(t==="type"&&i){const o=An.getIfExists(i);if(o){const a={...r,type:o.id,config:{...o.defaultOptions}};o.showLocation&&(a.location?.mode?delete a.location:a.location={mode:Sn.q1.Auto}),n.onChange(a);return}}n.onChange((0,cg.hs)(r,t,i))}}),build:(e,t)=>{if(!s.state)return;const{handler:i,options:n}=s.state,r=An.getIfExists(n?.type),o=al(s.basemaps,n?.type?n.type:Hi.type);if(e.addSelect({path:"type",name:"Layer type",settings:{options:o.options}}),i.update&&e.addCustomEditor({id:"filterData",path:"filterData",name:"Data",editor:dg.M,defaultValue:void 0}),!!r&&n.type!==Hi.type){if(r.showLocation){let a=t.data;if(n.filterData){const l=(0,ll.b9)(n.filterData);a=a.filter(l)}(0,ug.C)("Location","location.",e,n.location,a)}i.registerOptionsUI&&i.registerOptionsUI(e),(0,dt.isEqual)(s.category,["Base layer"])||(r.hideOpacity||e.addSliderInput({path:"opacity",name:"Opacity",defaultValue:1,settings:{min:0,max:1,step:.1}}),e.addBooleanSwitch({path:"tooltip",name:"Display tooltip",description:"Show the tooltip for layer",defaultValue:!0}))}}}}var fg=R(24177);const gg=(s,e,t,i)=>{if(e==="grafana-worldmap-panel"&&t.angular){const{fieldConfig:n,options:r}=mg({...t.angular,fieldConfig:i});return s.fieldConfig=n,r}return{}};function mg(s){const e={defaults:{},overrides:[]},t={view:{id:Tt.Zero},controls:{showZoom:!0,mouseWheelZoom:Boolean(s.mouseWheelZoom)},basemap:{type:"default",name:"Basemap"},layers:[],tooltip:{mode:Ki.Details}};let i=Ts(s.decimals);if(i&&(e.defaults.decimals=i),s.thresholds&&s.colors){const r=s.thresholds.split(",").map(a=>Number(a.trim())),o=[];for(const a of s.colors){const l=o.length-1;l>=0?o.push({value:r[l],color:a}):o.push({value:-1/0,color:a})}e.defaults.thresholds={mode:fg.H.Absolute,steps:o}}i=Ts(s.initialZoom),i&&(t.view.zoom=i);const n={"(0\xB0, 0\xB0)":Tt.Zero,"North America":"north-america",Europe:"europe","West Asia":"west-asia","SE Asia":"se-asia","Last GeoHash":Tt.Coordinates};return t.view.id=n[s.mapCenter],t.view.lat=Ts(s.mapCenterLatitude),t.view.lon=Ts(s.mapCenterLongitude),{fieldConfig:e,options:t}}function Ts(s){const e=+s;return isNaN(e)?void 0:e}const _g=s=>{const e=s?.pluginVersion??"";if((e.startsWith("8.1")||e.startsWith("8.2"))&&s.options?.layers?.length===1){const i=s.options.layers[0];if(i?.type==="markers"&&i.config){const n=i.config,r={style:(0,dt.cloneDeep)(fe),showLegend:Boolean(n.showLegend)};n.size&&(r.style.size=n.size),n.color&&(r.style.color=n.color),n.fillOpacity&&(r.style.opacity=n.fillOpacity);const o=au(n.shape);return o&&(r.style.symbol={fixed:o,mode:Je.ResourceDimensionMode.Fixed}),{...s.options,layers:[{...i,config:r}]}}}return s.options},pg=new z.c(dl).setNoPadding().setPanelChangeHandler(gg).setMigrationHandler(_g).useFieldConfig({useCustomConfig:s=>{Q.B(s)}}).setPanelOptions((s,e)=>{let t=["Map view"];s.addCustomEditor({category:t,id:"view",path:"view",name:"Initial view",description:"This location will show when the panel first loads.",editor:hg,defaultValue:Na}),s.addBooleanSwitch({category:t,path:"view.shared",description:"Use the same view across multiple panels.  Note: this may require a dashboard reload.",name:"Share view",defaultValue:Na.shared});const i=e.instanceState;if(i?.layers){const n=["Map layers"],r=["Basemap layer"];s.addCustomEditor({category:n,id:"layers",path:"",name:"",editor:rg});const o=i.layers[i.selected];i.selected&&o&&s.addNestedOptions(pl({state:o,category:n,basemaps:!1}));const a=i.layers[0];X.v.geomapDisableCustomBaseLayer?s.addCustomEditor({category:r,id:"layers",path:"",name:"",editor:()=>p.createElement("div",null,"The basemap layer is configured by the server admin.")}):a&&s.addNestedOptions(pl({state:a,category:r,basemaps:!0}))}t=["Map controls"],s.addBooleanSwitch({category:t,path:"controls.showZoom",description:"Show zoom control buttons in the upper left corner",name:"Show zoom control",defaultValue:!0}).addBooleanSwitch({category:t,path:"controls.mouseWheelZoom",description:"Enable zoom control via mouse wheel",name:"Mouse wheel zoom",defaultValue:!0}).addBooleanSwitch({category:t,path:"controls.showAttribution",name:"Show attribution",description:"Show the map source attribution info in the lower right",defaultValue:!0}).addBooleanSwitch({category:t,path:"controls.showScale",name:"Show scale",description:"Indicate map scale",defaultValue:!1}).addBooleanSwitch({category:t,path:"controls.showMeasure",name:"Show measure tools",description:"Show tools for making measurements on the map",defaultValue:!1}).addBooleanSwitch({category:t,path:"controls.showDebug",name:"Show debug",description:"Show map info",defaultValue:!1}).addRadio({category:t,path:"tooltip.mode",name:"Tooltip",defaultValue:Ki.Details,settings:{options:[{label:"None",value:Ki.None,description:"Show contents on click, not hover"},{label:"Details",value:Ki.Details,description:"Show popup on hover"}]}})})},24897:ze=>{"use strict";var ee=[];function R(X){for(var Q=-1,B=0;B<ee.length;B++)if(ee[B].identifier===X){Q=B;break}return Q}function p(X,Q){for(var B={},be=[],Ee=0;Ee<X.length;Ee++){var ne=X[Ee],de=Q.base?ne[0]+Q.base:ne[0],Ie=B[de]||0,se="".concat(de," ").concat(Ie);B[de]=Ie+1;var A=R(se),ge={css:ne[1],media:ne[2],sourceMap:ne[3],supports:ne[4],layer:ne[5]};if(A!==-1)ee[A].references++,ee[A].updater(ge);else{var he=z(ge,Q);Q.byIndex=Ee,ee.splice(Ee,0,{identifier:se,updater:he,references:1})}be.push(se)}return be}function z(X,Q){var B=Q.domAPI(Q);B.update(X);var be=function(ne){if(ne){if(ne.css===X.css&&ne.media===X.media&&ne.sourceMap===X.sourceMap&&ne.supports===X.supports&&ne.layer===X.layer)return;B.update(X=ne)}else B.remove()};return be}ze.exports=function(X,Q){Q=Q||{},X=X||[];var B=p(X,Q);return function(Ee){Ee=Ee||[];for(var ne=0;ne<B.length;ne++){var de=B[ne],Ie=R(de);ee[Ie].references--}for(var se=p(Ee,Q),A=0;A<B.length;A++){var ge=B[A],he=R(ge);ee[he].references===0&&(ee[he].updater(),ee.splice(he,1))}B=se}}},87414:ze=>{"use strict";var ee={};function R(z){if(typeof ee[z]>"u"){var X=document.querySelector(z);if(window.HTMLIFrameElement&&X instanceof window.HTMLIFrameElement)try{X=X.contentDocument.head}catch{X=null}ee[z]=X}return ee[z]}function p(z,X){var Q=R(z);if(!Q)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");Q.appendChild(X)}ze.exports=p},33254:ze=>{"use strict";function ee(R){var p=document.createElement("style");return R.setAttributes(p,R.attributes),R.insert(p,R.options),p}ze.exports=ee},24532:(ze,ee,R)=>{"use strict";function p(z){var X=R.nc;X&&z.setAttribute("nonce",X)}ze.exports=p},54533:ze=>{"use strict";function ee(z,X,Q){var B="";Q.supports&&(B+="@supports (".concat(Q.supports,") {")),Q.media&&(B+="@media ".concat(Q.media," {"));var be=typeof Q.layer<"u";be&&(B+="@layer".concat(Q.layer.length>0?" ".concat(Q.layer):""," {")),B+=Q.css,be&&(B+="}"),Q.media&&(B+="}"),Q.supports&&(B+="}");var Ee=Q.sourceMap;Ee&&typeof btoa<"u"&&(B+=`
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(Ee))))," */")),X.styleTagTransform(B,z,X.options)}function R(z){if(z.parentNode===null)return!1;z.parentNode.removeChild(z)}function p(z){var X=z.insertStyleElement(z);return{update:function(B){ee(X,z,B)},remove:function(){R(X)}}}ze.exports=p},24406:ze=>{"use strict";function ee(R,p){if(p.styleSheet)p.styleSheet.cssText=R;else{for(;p.firstChild;)p.removeChild(p.firstChild);p.appendChild(document.createTextNode(R))}}ze.exports=ee},37072:ze=>{"use strict";ze.exports=ee,ze.exports.default=ee;function ee(y,I,S){S=S||2;var P=I&&I.length,L=P?I[0]*S:y.length,D=R(y,0,L,S,!0),k=[];if(!D||D.next===D.prev)return k;var V,ue,le,Ue,Fe,Re,Ve;if(P&&(D=Ee(y,I,D,S)),y.length>80*S){V=le=y[0],ue=Ue=y[1];for(var Te=S;Te<L;Te+=S)Fe=y[Te],Re=y[Te+1],Fe<V&&(V=Fe),Re<ue&&(ue=Re),Fe>le&&(le=Fe),Re>Ue&&(Ue=Re);Ve=Math.max(le-V,Ue-ue),Ve=Ve!==0?32767/Ve:0}return z(D,k,S,V,ue,Ve,0),k}function R(y,I,S,P,L){var D,k;if(L===ut(y,I,S,P)>0)for(D=I;D<S;D+=P)k=Ge(D,y[D],y[D+1],k);else for(D=S-P;D>=I;D-=P)k=Ge(D,y[D],y[D+1],k);return k&&v(k,k.next)&&(et(k),k=k.next),k}function p(y,I){if(!y)return y;I||(I=y);var S=y,P;do if(P=!1,!S.steiner&&(v(S,S.next)||G(S.prev,S,S.next)===0)){if(et(S),S=I=S.prev,S===S.next)break;P=!0}else S=S.next;while(P||S!==I);return I}function z(y,I,S,P,L,D,k){if(y){!k&&D&&A(y,P,L,D);for(var V=y,ue,le;y.prev!==y.next;){if(ue=y.prev,le=y.next,D?Q(y,P,L,D):X(y)){I.push(ue.i/S|0),I.push(y.i/S|0),I.push(le.i/S|0),et(y),y=le.next,V=le.next;continue}if(y=le,y===V){k?k===1?(y=B(p(y),I,S),z(y,I,S,P,L,D,2)):k===2&&be(y,I,S,P,L,D):z(p(y),I,S,P,L,D,1);break}}}}function X(y){var I=y.prev,S=y,P=y.next;if(G(I,S,P)>=0)return!1;for(var L=I.x,D=S.x,k=P.x,V=I.y,ue=S.y,le=P.y,Ue=L<D?L<k?L:k:D<k?D:k,Fe=V<ue?V<le?V:le:ue<le?ue:le,Re=L>D?L>k?L:k:D>k?D:k,Ve=V>ue?V>le?V:le:ue>le?ue:le,Te=P.next;Te!==I;){if(Te.x>=Ue&&Te.x<=Re&&Te.y>=Fe&&Te.y<=Ve&&w(L,V,D,ue,k,le,Te.x,Te.y)&&G(Te.prev,Te,Te.next)>=0)return!1;Te=Te.next}return!0}function Q(y,I,S,P){var L=y.prev,D=y,k=y.next;if(G(L,D,k)>=0)return!1;for(var V=L.x,ue=D.x,le=k.x,Ue=L.y,Fe=D.y,Re=k.y,Ve=V<ue?V<le?V:le:ue<le?ue:le,Te=Ue<Fe?Ue<Re?Ue:Re:Fe<Re?Fe:Re,j=V>ue?V>le?V:le:ue>le?ue:le,He=Ue>Fe?Ue>Re?Ue:Re:Fe>Re?Fe:Re,$e=he(Ve,Te,I,S,P),nn=he(j,He,I,S,P),Le=y.prevZ,Me=y.nextZ;Le&&Le.z>=$e&&Me&&Me.z<=nn;){if(Le.x>=Ve&&Le.x<=j&&Le.y>=Te&&Le.y<=He&&Le!==L&&Le!==k&&w(V,Ue,ue,Fe,le,Re,Le.x,Le.y)&&G(Le.prev,Le,Le.next)>=0||(Le=Le.prevZ,Me.x>=Ve&&Me.x<=j&&Me.y>=Te&&Me.y<=He&&Me!==L&&Me!==k&&w(V,Ue,ue,Fe,le,Re,Me.x,Me.y)&&G(Me.prev,Me,Me.next)>=0))return!1;Me=Me.nextZ}for(;Le&&Le.z>=$e;){if(Le.x>=Ve&&Le.x<=j&&Le.y>=Te&&Le.y<=He&&Le!==L&&Le!==k&&w(V,Ue,ue,Fe,le,Re,Le.x,Le.y)&&G(Le.prev,Le,Le.next)>=0)return!1;Le=Le.prevZ}for(;Me&&Me.z<=nn;){if(Me.x>=Ve&&Me.x<=j&&Me.y>=Te&&Me.y<=He&&Me!==L&&Me!==k&&w(V,Ue,ue,Fe,le,Re,Me.x,Me.y)&&G(Me.prev,Me,Me.next)>=0)return!1;Me=Me.nextZ}return!0}function B(y,I,S){var P=y;do{var L=P.prev,D=P.next.next;!v(L,D)&&U(L,P,P.next,D)&&pe(L,D)&&pe(D,L)&&(I.push(L.i/S|0),I.push(P.i/S|0),I.push(D.i/S|0),et(P),et(P.next),P=y=D),P=P.next}while(P!==y);return p(P)}function be(y,I,S,P,L,D){var k=y;do{for(var V=k.next.next;V!==k.prev;){if(k.i!==V.i&&N(k,V)){var ue=Ce(k,V);k=p(k,k.next),ue=p(ue,ue.next),z(k,I,S,P,L,D,0),z(ue,I,S,P,L,D,0);return}V=V.next}k=k.next}while(k!==y)}function Ee(y,I,S,P){var L=[],D,k,V,ue,le;for(D=0,k=I.length;D<k;D++)V=I[D]*P,ue=D<k-1?I[D+1]*P:y.length,le=R(y,V,ue,P,!1),le===le.next&&(le.steiner=!0),L.push(T(le));for(L.sort(ne),D=0;D<L.length;D++)S=de(L[D],S);return S}function ne(y,I){return y.x-I.x}function de(y,I){var S=Ie(y,I);if(!S)return I;var P=Ce(S,y);return p(P,P.next),p(S,S.next)}function Ie(y,I){var S=I,P=y.x,L=y.y,D=-1/0,k;do{if(L<=S.y&&L>=S.next.y&&S.next.y!==S.y){var V=S.x+(L-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(V<=P&&V>D&&(D=V,k=S.x<S.next.x?S:S.next,V===P))return k}S=S.next}while(S!==I);if(!k)return null;var ue=k,le=k.x,Ue=k.y,Fe=1/0,Re;S=k;do P>=S.x&&S.x>=le&&P!==S.x&&w(L<Ue?P:D,L,le,Ue,L<Ue?D:P,L,S.x,S.y)&&(Re=Math.abs(L-S.y)/(P-S.x),pe(S,y)&&(Re<Fe||Re===Fe&&(S.x>k.x||S.x===k.x&&se(k,S)))&&(k=S,Fe=Re)),S=S.next;while(S!==ue);return k}function se(y,I){return G(y.prev,y,I.prev)<0&&G(I.next,y,y.next)<0}function A(y,I,S,P){var L=y;do L.z===0&&(L.z=he(L.x,L.y,I,S,P)),L.prevZ=L.prev,L.nextZ=L.next,L=L.next;while(L!==y);L.prevZ.nextZ=null,L.prevZ=null,ge(L)}function ge(y){var I,S,P,L,D,k,V,ue,le=1;do{for(S=y,y=null,D=null,k=0;S;){for(k++,P=S,V=0,I=0;I<le&&(V++,P=P.nextZ,!!P);I++);for(ue=le;V>0||ue>0&&P;)V!==0&&(ue===0||!P||S.z<=P.z)?(L=S,S=S.nextZ,V--):(L=P,P=P.nextZ,ue--),D?D.nextZ=L:y=L,L.prevZ=D,D=L;S=P}D.nextZ=null,le*=2}while(k>1);return y}function he(y,I,S,P,L){return y=(y-S)*L|0,I=(I-P)*L|0,y=(y|y<<8)&16711935,y=(y|y<<4)&252645135,y=(y|y<<2)&858993459,y=(y|y<<1)&1431655765,I=(I|I<<8)&16711935,I=(I|I<<4)&252645135,I=(I|I<<2)&858993459,I=(I|I<<1)&1431655765,y|I<<1}function T(y){var I=y,S=y;do(I.x<S.x||I.x===S.x&&I.y<S.y)&&(S=I),I=I.next;while(I!==y);return S}function w(y,I,S,P,L,D,k,V){return(L-k)*(I-V)>=(y-k)*(D-V)&&(y-k)*(P-V)>=(S-k)*(I-V)&&(S-k)*(D-V)>=(L-k)*(P-V)}function N(y,I){return y.next.i!==I.i&&y.prev.i!==I.i&&!ve(y,I)&&(pe(y,I)&&pe(I,y)&&De(y,I)&&(G(y.prev,y,I.prev)||G(y,I.prev,I))||v(y,I)&&G(y.prev,y,y.next)>0&&G(I.prev,I,I.next)>0)}function G(y,I,S){return(I.y-y.y)*(S.x-I.x)-(I.x-y.x)*(S.y-I.y)}function v(y,I){return y.x===I.x&&y.y===I.y}function U(y,I,S,P){var L=re(G(y,I,S)),D=re(G(y,I,P)),k=re(G(S,P,y)),V=re(G(S,P,I));return!!(L!==D&&k!==V||L===0&&K(y,S,I)||D===0&&K(y,P,I)||k===0&&K(S,y,P)||V===0&&K(S,I,P))}function K(y,I,S){return I.x<=Math.max(y.x,S.x)&&I.x>=Math.min(y.x,S.x)&&I.y<=Math.max(y.y,S.y)&&I.y>=Math.min(y.y,S.y)}function re(y){return y>0?1:y<0?-1:0}function ve(y,I){var S=y;do{if(S.i!==y.i&&S.next.i!==y.i&&S.i!==I.i&&S.next.i!==I.i&&U(S,S.next,y,I))return!0;S=S.next}while(S!==y);return!1}function pe(y,I){return G(y.prev,y,y.next)<0?G(y,I,y.next)>=0&&G(y,y.prev,I)>=0:G(y,I,y.prev)<0||G(y,y.next,I)<0}function De(y,I){var S=y,P=!1,L=(y.x+I.x)/2,D=(y.y+I.y)/2;do S.y>D!=S.next.y>D&&S.next.y!==S.y&&L<(S.next.x-S.x)*(D-S.y)/(S.next.y-S.y)+S.x&&(P=!P),S=S.next;while(S!==y);return P}function Ce(y,I){var S=new st(y.i,y.x,y.y),P=new st(I.i,I.x,I.y),L=y.next,D=I.prev;return y.next=I,I.prev=y,S.next=L,L.prev=S,P.next=S,S.prev=P,D.next=P,P.prev=D,P}function Ge(y,I,S,P){var L=new st(y,I,S);return P?(L.next=P.next,L.prev=P,P.next.prev=L,P.next=L):(L.prev=L,L.next=L),L}function et(y){y.next.prev=y.prev,y.prev.next=y.next,y.prevZ&&(y.prevZ.nextZ=y.nextZ),y.nextZ&&(y.nextZ.prevZ=y.prevZ)}function st(y,I,S){this.i=y,this.x=I,this.y=S,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}ee.deviation=function(y,I,S,P){var L=I&&I.length,D=L?I[0]*S:y.length,k=Math.abs(ut(y,0,D,S));if(L)for(var V=0,ue=I.length;V<ue;V++){var le=I[V]*S,Ue=V<ue-1?I[V+1]*S:y.length;k-=Math.abs(ut(y,le,Ue,S))}var Fe=0;for(V=0;V<P.length;V+=3){var Re=P[V]*S,Ve=P[V+1]*S,Te=P[V+2]*S;Fe+=Math.abs((y[Re]-y[Te])*(y[Ve+1]-y[Re+1])-(y[Re]-y[Ve])*(y[Te+1]-y[Re+1]))}return k===0&&Fe===0?0:Math.abs((Fe-k)/k)};function ut(y,I,S,P){for(var L=0,D=I,k=S-P;D<S;D+=P)L+=(y[k]-y[D])*(y[D+1]+y[k+1]),k=D;return L}ee.flatten=function(y){for(var I=y[0][0].length,S={vertices:[],holes:[],dimensions:I},P=0,L=0;L<y.length;L++){for(var D=0;D<y[L].length;D++)for(var k=0;k<I;k++)S.vertices.push(y[L][D][k]);L>0&&(P+=y[L-1].length,S.holes.push(P))}return S}},43788:function(ze){(function(ee,R){ze.exports=R()})(this,function(){"use strict";function ee(T,w,N,G,v){(function U(K,re,ve,pe,De){for(;pe>ve;){if(pe-ve>600){var Ce=pe-ve+1,Ge=re-ve+1,et=Math.log(Ce),st=.5*Math.exp(2*et/3),ut=.5*Math.sqrt(et*st*(Ce-st)/Ce)*(Ge-Ce/2<0?-1:1),y=Math.max(ve,Math.floor(re-Ge*st/Ce+ut)),I=Math.min(pe,Math.floor(re+(Ce-Ge)*st/Ce+ut));U(K,re,y,I,De)}var S=K[re],P=ve,L=pe;for(R(K,ve,re),De(K[pe],S)>0&&R(K,ve,pe);P<L;){for(R(K,P,L),P++,L--;De(K[P],S)<0;)P++;for(;De(K[L],S)>0;)L--}De(K[ve],S)===0?R(K,ve,L):R(K,++L,pe),L<=re&&(ve=L+1),re<=L&&(pe=L-1)}})(T,w,N||0,G||T.length-1,v||p)}function R(T,w,N){var G=T[w];T[w]=T[N],T[N]=G}function p(T,w){return T<w?-1:T>w?1:0}var z=function(T){T===void 0&&(T=9),this._maxEntries=Math.max(4,T),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function X(T,w,N){if(!N)return w.indexOf(T);for(var G=0;G<w.length;G++)if(N(T,w[G]))return G;return-1}function Q(T,w){B(T,0,T.children.length,w,T)}function B(T,w,N,G,v){v||(v=ge(null)),v.minX=1/0,v.minY=1/0,v.maxX=-1/0,v.maxY=-1/0;for(var U=w;U<N;U++){var K=T.children[U];be(v,T.leaf?G(K):K)}return v}function be(T,w){return T.minX=Math.min(T.minX,w.minX),T.minY=Math.min(T.minY,w.minY),T.maxX=Math.max(T.maxX,w.maxX),T.maxY=Math.max(T.maxY,w.maxY),T}function Ee(T,w){return T.minX-w.minX}function ne(T,w){return T.minY-w.minY}function de(T){return(T.maxX-T.minX)*(T.maxY-T.minY)}function Ie(T){return T.maxX-T.minX+(T.maxY-T.minY)}function se(T,w){return T.minX<=w.minX&&T.minY<=w.minY&&w.maxX<=T.maxX&&w.maxY<=T.maxY}function A(T,w){return w.minX<=T.maxX&&w.minY<=T.maxY&&w.maxX>=T.minX&&w.maxY>=T.minY}function ge(T){return{children:T,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function he(T,w,N,G,v){for(var U=[w,N];U.length;)if(!((N=U.pop())-(w=U.pop())<=G)){var K=w+Math.ceil((N-w)/G/2)*G;ee(T,K,w,N,v),U.push(w,K,K,N)}}return z.prototype.all=function(){return this._all(this.data,[])},z.prototype.search=function(T){var w=this.data,N=[];if(!A(T,w))return N;for(var G=this.toBBox,v=[];w;){for(var U=0;U<w.children.length;U++){var K=w.children[U],re=w.leaf?G(K):K;A(T,re)&&(w.leaf?N.push(K):se(T,re)?this._all(K,N):v.push(K))}w=v.pop()}return N},z.prototype.collides=function(T){var w=this.data;if(!A(T,w))return!1;for(var N=[];w;){for(var G=0;G<w.children.length;G++){var v=w.children[G],U=w.leaf?this.toBBox(v):v;if(A(T,U)){if(w.leaf||se(T,U))return!0;N.push(v)}}w=N.pop()}return!1},z.prototype.load=function(T){if(!T||!T.length)return this;if(T.length<this._minEntries){for(var w=0;w<T.length;w++)this.insert(T[w]);return this}var N=this._build(T.slice(),0,T.length-1,0);if(this.data.children.length)if(this.data.height===N.height)this._splitRoot(this.data,N);else{if(this.data.height<N.height){var G=this.data;this.data=N,N=G}this._insert(N,this.data.height-N.height-1,!0)}else this.data=N;return this},z.prototype.insert=function(T){return T&&this._insert(T,this.data.height-1),this},z.prototype.clear=function(){return this.data=ge([]),this},z.prototype.remove=function(T,w){if(!T)return this;for(var N,G,v,U=this.data,K=this.toBBox(T),re=[],ve=[];U||re.length;){if(U||(U=re.pop(),G=re[re.length-1],N=ve.pop(),v=!0),U.leaf){var pe=X(T,U.children,w);if(pe!==-1)return U.children.splice(pe,1),re.push(U),this._condense(re),this}v||U.leaf||!se(U,K)?G?(N++,U=G.children[N],v=!1):U=null:(re.push(U),ve.push(N),N=0,G=U,U=U.children[0])}return this},z.prototype.toBBox=function(T){return T},z.prototype.compareMinX=function(T,w){return T.minX-w.minX},z.prototype.compareMinY=function(T,w){return T.minY-w.minY},z.prototype.toJSON=function(){return this.data},z.prototype.fromJSON=function(T){return this.data=T,this},z.prototype._all=function(T,w){for(var N=[];T;)T.leaf?w.push.apply(w,T.children):N.push.apply(N,T.children),T=N.pop();return w},z.prototype._build=function(T,w,N,G){var v,U=N-w+1,K=this._maxEntries;if(U<=K)return Q(v=ge(T.slice(w,N+1)),this.toBBox),v;G||(G=Math.ceil(Math.log(U)/Math.log(K)),K=Math.ceil(U/Math.pow(K,G-1))),(v=ge([])).leaf=!1,v.height=G;var re=Math.ceil(U/K),ve=re*Math.ceil(Math.sqrt(K));he(T,w,N,ve,this.compareMinX);for(var pe=w;pe<=N;pe+=ve){var De=Math.min(pe+ve-1,N);he(T,pe,De,re,this.compareMinY);for(var Ce=pe;Ce<=De;Ce+=re){var Ge=Math.min(Ce+re-1,De);v.children.push(this._build(T,Ce,Ge,G-1))}}return Q(v,this.toBBox),v},z.prototype._chooseSubtree=function(T,w,N,G){for(;G.push(w),!w.leaf&&G.length-1!==N;){for(var v=1/0,U=1/0,K=void 0,re=0;re<w.children.length;re++){var ve=w.children[re],pe=de(ve),De=(Ce=T,Ge=ve,(Math.max(Ge.maxX,Ce.maxX)-Math.min(Ge.minX,Ce.minX))*(Math.max(Ge.maxY,Ce.maxY)-Math.min(Ge.minY,Ce.minY))-pe);De<U?(U=De,v=pe<v?pe:v,K=ve):De===U&&pe<v&&(v=pe,K=ve)}w=K||w.children[0]}var Ce,Ge;return w},z.prototype._insert=function(T,w,N){var G=N?T:this.toBBox(T),v=[],U=this._chooseSubtree(G,this.data,w,v);for(U.children.push(T),be(U,G);w>=0&&v[w].children.length>this._maxEntries;)this._split(v,w),w--;this._adjustParentBBoxes(G,v,w)},z.prototype._split=function(T,w){var N=T[w],G=N.children.length,v=this._minEntries;this._chooseSplitAxis(N,v,G);var U=this._chooseSplitIndex(N,v,G),K=ge(N.children.splice(U,N.children.length-U));K.height=N.height,K.leaf=N.leaf,Q(N,this.toBBox),Q(K,this.toBBox),w?T[w-1].children.push(K):this._splitRoot(N,K)},z.prototype._splitRoot=function(T,w){this.data=ge([T,w]),this.data.height=T.height+1,this.data.leaf=!1,Q(this.data,this.toBBox)},z.prototype._chooseSplitIndex=function(T,w,N){for(var G,v,U,K,re,ve,pe,De=1/0,Ce=1/0,Ge=w;Ge<=N-w;Ge++){var et=B(T,0,Ge,this.toBBox),st=B(T,Ge,N,this.toBBox),ut=(v=et,U=st,K=void 0,re=void 0,ve=void 0,pe=void 0,K=Math.max(v.minX,U.minX),re=Math.max(v.minY,U.minY),ve=Math.min(v.maxX,U.maxX),pe=Math.min(v.maxY,U.maxY),Math.max(0,ve-K)*Math.max(0,pe-re)),y=de(et)+de(st);ut<De?(De=ut,G=Ge,Ce=y<Ce?y:Ce):ut===De&&y<Ce&&(Ce=y,G=Ge)}return G||N-w},z.prototype._chooseSplitAxis=function(T,w,N){var G=T.leaf?this.compareMinX:Ee,v=T.leaf?this.compareMinY:ne;this._allDistMargin(T,w,N,G)<this._allDistMargin(T,w,N,v)&&T.children.sort(G)},z.prototype._allDistMargin=function(T,w,N,G){T.children.sort(G);for(var v=this.toBBox,U=B(T,0,w,v),K=B(T,N-w,N,v),re=Ie(U)+Ie(K),ve=w;ve<N-w;ve++){var pe=T.children[ve];be(U,T.leaf?v(pe):pe),re+=Ie(U)}for(var De=N-w-1;De>=w;De--){var Ce=T.children[De];be(K,T.leaf?v(Ce):Ce),re+=Ie(K)}return re},z.prototype._adjustParentBBoxes=function(T,w,N){for(var G=N;G>=0;G--)be(w[G],T)},z.prototype._condense=function(T){for(var w=T.length-1,N=void 0;w>=0;w--)T[w].children.length===0?w>0?(N=T[w-1].children).splice(N.indexOf(T[w]),1):this.clear():Q(T[w],this.toBBox)},z})}}]);

//# sourceMappingURL=1189.f9ce28215801598783ac.js.map