D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
grafana
/
public
/
build
/
Filename :
2421.ba873d4f1218ff190246.js
back
Copy
(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2421],{39076:Lt=>{"use strict";Lt.exports=function(we,S){return S||(S={}),we&&(we=String(we.__esModule?we.default:we),/^['"].*['"]$/.test(we)&&(we=we.slice(1,-1)),S.hash&&(we+=S.hash),/["'() \t\n]|(%20)/.test(we)||S.needQuotes?'"'.concat(we.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):we)}},8747:(Lt,we,S)=>{"use strict";S.d(we,{q:()=>te});var _=S(42844),ie=S(27702),Xe=S(66310);const Ve=10,te=({colorPalette:Me,min:Oe,max:W,display:ue,hoverValue:De,useStopsPercentage:rt})=>{const[R,b]=(0,ie.useState)([]),[k,B]=(0,ie.useState)({isShown:!1,value:0}),[C,V]=(0,ie.useState)(null),j=(0,Xe.l4)(),ee=zt(j,R);(0,ie.useEffect)(()=>{b(Ye({colorArray:Me,stops:Ve,useStopsPercentage:rt}))},[Me,rt]);const ge=xe=>{const pe=xe.nativeEvent.offsetX,Pe=xe.currentTarget.offsetWidth,je=Math.floor(pe*100/Pe+1),Je=Math.floor((W-Oe)*je/100+Oe);B({isShown:!0,value:Je}),V(je)},ce=()=>{B({isShown:!1,value:0})};return(0,ie.useEffect)(()=>{V(De==null?null:Ft((De-Oe)/(W-Oe)))},[De,Oe,W]),ie.createElement("div",{className:ee.scaleWrapper,onMouseMove:ge,onMouseLeave:ce},ie.createElement("div",{className:ee.scaleGradient},ue&&(k.isShown||De!==void 0)&&ie.createElement("div",{className:ee.followerContainer},ie.createElement("div",{className:ee.follower,style:{left:`${C}%`}}))),ue&&ie.createElement("div",{className:ee.followerContainer},ie.createElement("div",{className:ee.legendValues},ie.createElement("span",null,ue(Oe)),ie.createElement("span",null,ue(W))),C!=null&&(k.isShown||De!==void 0)&&ie.createElement("span",{className:ee.hoverValue,style:{left:`${C}%`}},ue(De??k.value))))},Ye=({colorArray:Me,stops:Oe,useStopsPercentage:W=!0})=>{const ue=Me.length;if(W&&ue<=20){const b=1/ue*100;let k=0;const B=[];for(const C of Me)k>0?B.push(`${C} ${k}%`):B.push(C),k+=b,B.push(`${C} ${k}%`);return B}const De=Me[ue-1],rt=Math.ceil(ue/Oe),R=new Set;for(let b=0;b<ue;b+=rt)R.add(Me[b]);return R.add(De),[...R]};function Ft(Me){return Me>1?100:Me<0?0:Me*100}const zt=(Me,Oe)=>({scaleWrapper:(0,_.css)` width: 100%; font-size: 11px; opacity: 1; `,scaleGradient:(0,_.css)` background: linear-gradient(90deg, ${Oe.join()}); height: 10px; pointer-events: none; `,legendValues:(0,_.css)` display: flex; justify-content: space-between; pointer-events: none; `,hoverValue:(0,_.css)` position: absolute; margin-top: -14px; padding: 3px 15px; background: ${Me.colors.background.primary}; transform: translateX(-50%); `,followerContainer:(0,_.css)` position: relative; pointer-events: none; white-space: nowrap; `,follower:(0,_.css)` position: absolute; height: 14px; width: 14px; border-radius: 50%; transform: translateX(-50%) translateY(-50%); border: 2px solid ${Me.colors.text.primary}; margin-top: 5px; `})},92791:(Lt,we,S)=>{"use strict";S.d(we,{f:()=>Xe});var _=S(27702),ie=S(73990);const Xe=({onChange:Ve,options:te,label:Ye})=>_.createElement(ie.b,{icon:"plus",label:Ye,variant:"secondary",options:te,onChange:Ve,isFullWidth:!0})},65604:(Lt,we,S)=>{"use strict";S.d(we,{M:()=>Ve});var _=S(27702),ie=S(19221),Xe=S(85219);const Ve=({value:te,context:Ye,onChange:Ft})=>{const zt=(0,_.useCallback)(Me=>{Ft(Me?.length?{id:ie.E4.byRefId,options:Me}:void 0)},[Ft]);return _.createElement(Xe.O,{value:te?.options,onChange:zt,data:Ye.data,placeholder:"Change filter"})}},41670:(Lt,we,S)=>{"use strict";S.r(we),S.d(we,{plugin:()=>fu});var _=S(27702),ie=S(97585),Xe=S(34667),Ve=S(56617),te=S(42844),Ye=S(76808),Ft=S(53917),zt=S(77089),Me=S(21314),Oe=S(62989),W=S(29209),ue=S(30998);const De="units",rt=[1,2,5],R=25.4/.28;class b extends Me.Z{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+" "+Oe.XV,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(De,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(De)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(De,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(),s=n=="degrees"?"degrees":"m";let o=(0,W._Q)(i,e.resolution,t,s);const a=this.minWidth_*(this.dpi_||R)/R,l=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||R)/R:void 0;let h=a*o,c="";if(n=="degrees"){const w=W.Wm.degrees;h*=w,h<w/60?(c="\u2033",o*=3600):h<w?(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,ue.h)(!1,33);let d=3*Math.floor(Math.log(a*o)/Math.log(10)),u,g,f,m,p,v;for(;;){f=Math.floor(d/3);const w=Math.pow(10,f);if(u=rt[(d%3+3)%3]*w,g=Math.round(u/o),isNaN(g)){this.element.style.display="none",this.renderedVisible_=!1;return}if(l!==void 0&&g>=l){u=m,g=p,f=v;break}else if(g>=a)break;m=u,p=g,v=f,++d}const y=this.scaleBar_?this.createScaleBar(g,u,c):u.toFixed(f<0?-f:0)+" "+c;this.renderedHTML_!=y&&(this.innerElement_.innerHTML=y,this.renderedHTML_=y),this.renderedWidth_!=g&&(this.innerElement_.style.width=g+"px",this.renderedWidth_=g),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(e,t,i){const n=this.getScaleForResolution(),s=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 d=c%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";l.push(`<div><div class="ol-scale-singlebar ${d}" 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;">`+s+"</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,s){const a=(e===0?0:Math.round(n/this.scaleBarSteps_*e*100)/100)+(e===0?"":" "+s),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,W._Q)(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),t=this.dpi_||R,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 k=b;var B=S(54052),C=S(70328),V=S(27591),j=S(19973),ee=S(84714),ge=S(70823),ce=S(43620),xe=S(66310);const pe=({topRight1:r,topRight2:e,bottomLeft:t,blStyle:i})=>{const n=(r&&r.length>0)??!1,s=(0,xe.wW)(Pe(n));return _.createElement("div",{className:s.overlay},!!r?.length&&_.createElement("div",{className:s.TR1},r),!!e?.length&&_.createElement("div",{className:s.TR2},e),!!t?.length&&_.createElement("div",{className:s.BL,style:i},t))},Pe=r=>e=>({overlay:(0,te.css)` position: absolute; width: 100%; height: 100%; z-index: 500; pointer-events: none; `,TR1:(0,te.css)` right: 0.5em; pointer-events: auto; position: absolute; top: 0.5em; `,TR2:(0,te.css)` position: absolute; top: ${r?"80":"8"}px; right: 8px; pointer-events: auto; `,BL:(0,te.css)` position: absolute; bottom: 8px; left: 8px; pointer-events: auto; `});var je=S(45809),Je=S(6714),dt=S(52995),x=S(97695),I=S(35952),E=S(89949),M=S(29241),F=S(75578),D=S(4432),O=S(41640),Z=S(89628),oe=S(46580),ne=S(16546);const Fe=({feature:r})=>{let e,t=0;if(!r)return null;if(e=r.get("frame"),e)t=r.get("rowIndex");else{const{geometry:i,...n}=r.getProperties();e=new oe.i([n])}return _.createElement(ne.H,{data:e,rowIndex:t})},Re=({layers:r,activeTabIndex:e})=>{const t=(0,xe.wW)(ze),[i,n]=(0,_.useState)(new Map),s=(o,a)=>{n(new Map(i.set(o,a)))};return _.createElement(D.I,null,r.map((o,a)=>a===e&&_.createElement("div",{key:o.layer.getName()},_.createElement("div",null,o.features.map((l,h)=>{const c=l.getId()??h;return o.features.length>1?_.createElement(O.U,{key:c,collapsible:!0,label:ye(l,h),isOpen:i.get(c),onToggle:()=>{s(c,!i.get(c))},className:t.collapsibleRow},_.createElement(Fe,{feature:l})):_.createElement(Fe,{key:c,feature:l})})))))},ye=(r,e)=>{const t=["Name","name","Title","ID","id"];let i=r.getProperties(),n="";const s=r.get("frame");if(s){const o=r.get("rowIndex");for(const a of s.fields)if(a.type===M.fS.string){const l=(0,F.CZ)(a,s);n||(n=l),i[l]=a.values[o]}}for(let o of t){const a=i[o];if(a)return a}if(n)return _.createElement("span",null,n,": ",(0,Z.Q)(i[n]));for(let o of Object.keys(i)){const a=i[o];if((0,E.isString)(a))return _.createElement("span",null,o,": ",(0,Z.Q)(a))}return`Match: ${e+1}`},ze=r=>({collapsibleRow:(0,te.css)` margin-bottom: 0; `});var be=S(15372),ui=S(54281);const di=({layers:r,setActiveTabIndex:e,activeTabIndex:t})=>_.createElement(be.J,null,r&&r.map((i,n)=>_.createElement(ui.O,{key:n,label:i.layer.getName(),active:n===t,counter:i.features.length>1?i.features.length:null,onChangeTab:()=>{e(n)}}))),gn=({layers:r,onClose:e,isOpen:t})=>{const[i,n]=(0,_.useState)(0);return r?_.createElement(_.Fragment,null,t&&_.createElement(I.P,{style:{zIndex:1},onClick:e}),_.createElement(di,{layers:r,setActiveTabIndex:n,activeTabIndex:i}),_.createElement(Re,{layers:r,activeTabIndex:i})):null},mn=({ttip:r,onClose:e,isOpen:t})=>{const i=(0,_.createRef)(),{overlayProps:n}=(0,Je.Ir)({onClose:e,isDismissable:!0,isOpen:t},i),{dialogProps:s}=(0,je.R)({},i);return _.createElement(_.Fragment,null,r&&r.layers&&_.createElement(dt.h_,null,_.createElement(x.S,{position:{x:r.pageX,y:r.pageY},offset:{x:10,y:10},allowPointerEvents:!0},_.createElement("section",{ref:i,...n,...s},_.createElement(gn,{layers:r.layers,isOpen:t,onClose:e})))))};var de=S(71685),ve=S(74639),sr=S(80402),fi=S(12308);class aa extends _.PureComponent{constructor(e){super(e),this.style=la(fi.config.theme2),this.updateViewState=()=>{const t=this.props.map.getView();this.setState({zoom:t.getZoom(),center:(0,W.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 _.createElement("div",{className:this.style.infoWrap,"aria-label":ve.wl.components.DebugOverlay.wrapper},_.createElement("table",null,_.createElement("tbody",null,_.createElement("tr",null,_.createElement("th",null,"Zoom:"),_.createElement("td",null,e?.toFixed(1))),_.createElement("tr",null,_.createElement("th",null,"Center:\xA0"),_.createElement("td",null,t[0].toFixed(5),", ",t[1].toFixed(5))))))}}const la=(0,sr.B)(r=>({infoWrap:(0,te.css)` color: ${r.colors.text.primary}; background: ${(0,de.Z)(r.components.panel.background).setAlpha(.7).toString()}; border-radius: 2px; padding: 8px; `}));var pn=S(40705),_n=S(66670),Ei=S(28580),ns=S(67437),ft=S(21609);const qe=[{value:"length",label:"Length",geometry:"LineString",units:[{label:"Metric (m/km)",value:"m",format:r=>(0,ft.Cf)("lengthm")(r)},{label:"Feet (ft)",value:"ft",format:r=>(0,ft.Cf)("lengthft")(r*3.28084)},{label:"Miles (mi)",value:"mi",format:r=>(0,ft.Cf)("lengthmi")(r/1609)},{label:"Nautical miles (nmi)",value:"nmi",format:r=>(0,ft.Cf)("nmi")(r/1852)}],getUnit:r=>{const e=qe[0].units;return r?.endsWith("2")&&(r=r.substring(0,r.length-1)),e.find(t=>t.value===r)??e[0]}},{value:"area",label:"Area",geometry:"Polygon",units:[{label:"Square Meters (m\xB2)",value:"m2",format:r=>(0,ft.Cf)("areaM2")(r)},{label:"Square Kilometers (km\xB2)",value:"km2",format:r=>(0,ft.q2)("km\xB2")(r*1e-6)},{label:"Square Feet (ft\xB2)",value:"ft2",format:r=>(0,ft.Cf)("areaF2")(r*10.76391)},{label:"Square Miles (mi\xB2)",value:"mi2",format:r=>(0,ft.Cf)("areaMI2")(r*3861e-10)},{label:"Acres",value:"acre2",format:r=>(0,ft.q2)("acre")(r*247105e-9)},{label:"Hectare",value:"hectare2",format:r=>(0,ft.q2)("ha")(r*1e-4)}],getUnit:r=>{const e=qe[1].units;return r?.endsWith("2")||(r+="2"),e.find(t=>t.value===r)??e[0]}}];var He=S(84570),Mt=S(10680),ss=S(81780),xn=S(81459),yn=S(82723),ot=S(21750),Ke=S(19193),gt=S(24781),rr=S(94516),or=S(45759),J=S(80075),Vi=S(36095);class ha{constructor(e){this.rbush_=new or(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,J.sq)(t)]=i}load(e,t){const i=new Array(t.length);for(let n=0,s=t.length;n<s;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,J.sq)(a)]=l}this.rbush_.load(i)}remove(e){const t=(0,J.sq)(e),i=this.items_[t];return delete this.items_[t],this.rbush_.remove(i)!==null}update(e,t){const i=this.items_[(0,J.sq)(t)],n=[i.minX,i.minY,i.maxX,i.maxY];(0,C.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,s=e.length;n<s;n++)if(i=t(e[n]),i)return i;return i}isEmpty(){return(0,Vi.x)(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return(0,C.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 rs=ha,We={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var ar=S(85271);const Ae={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var at=S(69805);class os{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=(0,at.Pq)(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new os({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,J.O3)()}getImage(e){return(0,J.O3)()}getHitDetectionImage(){return(0,J.O3)()}getPixelRatio(e){return 1}getImageState(){return(0,J.O3)()}getImageSize(){return(0,J.O3)()}getOrigin(){return(0,J.O3)()}getSize(){return(0,J.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_=(0,at.Pq)(e)}listenImageChange(e){(0,J.O3)()}load(){(0,J.O3)()}unlistenImageChange(e){(0,J.O3)()}}const lr=os;var mt=S(59844);function Pt(r){return Array.isArray(r)?(0,mt.BB)(r):r}var ke=S(43045),U=S(62822);class as extends lr{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 as({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=(0,ke.E4)(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 Ae.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_,s=this.radius2_===void 0?n:this.radius2_;if(n<s){const P=n;n=s,s=P}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),h=Math.sqrt(s*s-l*l),c=n-h,d=Math.sqrt(l*l+c*c),u=d/l;if(e==="miter"&&u<=i)return u*t;const g=t/2/u,f=t/2*(c/d),p=Math.sqrt((n+g)*(n+g)+f*f)-n;if(this.radius2_===void 0||e==="bevel")return p*2;const v=n*Math.sin(a),y=Math.sqrt(n*n-v*v),w=s-y,L=Math.sqrt(v*v+w*w)/v;if(L<=i){const P=L*t/2-s-n;return 2*Math.max(p,P)}return p*2}createRenderOptions(){let e=U.rc,t=0,i=null,n=0,s,o=0;this.stroke_&&(s=this.stroke_.getColor(),s===null&&(s=U.Tx),s=Pt(s),o=this.stroke_.getWidth(),o===void 0&&(o=U.yC),i=this.stroke_.getLineDash(),n=this.stroke_.getLineDashOffset(),e=this.stroke_.getLineJoin(),e===void 0&&(e=U.rc),t=this.stroke_.getMiterLimit(),t===void 0&&(t=U.V4));const a=this.calculateLineJoinSize_(e,o,t),l=Math.max(this.radius_,this.radius2_||0),h=Math.ceil(2*l+a);return{strokeStyle:s,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=U.bL),t.fillStyle=Pt(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=(0,mt._2)(t)),t===null?i=1:Array.isArray(t)&&(i=t.length===4?t[3]:1),i===0){const n=(0,ke.E4)(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 s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){const l=s+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=U.bL,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 $e=as;class ls extends $e{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 ls({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 Ct=ls;class hs{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null}clone(){const e=this.getColor();return new hs({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){this.color_=e}}const Se=hs;class cs{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 cs({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 Te=cs;class Kt{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=cr,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 Kt({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_=cr,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function ca(r){let e;if(typeof r=="function")e=r;else{let t;Array.isArray(r)?t=r:((0,ue.h)(typeof r.getZIndex=="function",41),t=[r]),e=function(){return t}}return e}let us=null;function ua(r,e){if(!us){const t=new Se({color:"rgba(255,255,255,0.4)"}),i=new Te({color:"#3399CC",width:1.25});us=[new Kt({image:new Ct({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return us}function hr(){const r={},e=[255,255,255,1],t=[0,153,255,1],i=3;return r.Polygon=[new Kt({fill:new Se({color:[255,255,255,.5]})})],r.MultiPolygon=r.Polygon,r.LineString=[new Kt({stroke:new Te({color:e,width:i+2})}),new Kt({stroke:new Te({color:t,width:i})})],r.MultiLineString=r.LineString,r.Circle=r.Polygon.concat(r.LineString),r.Point=[new Kt({image:new Ct({radius:i*2,fill:new Se({color:t}),stroke:new Te({color:e,width:i/2})}),zIndex:1/0})],r.MultiPoint=r.Point,r.GeometryCollection=r.Polygon.concat(r.LineString,r.Point),r}function cr(r){return r.getGeometry()}const fe=Kt;var ur=S(17793),dr=S(49462),fr=S(90738),Qe=S(67314);class _u extends null{constructor(e,t,i,n,s,o,a){super(e,t,i,ImageState.IDLE),this.src_=n,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.context_=a,this.unlisten_=null,this.state=ImageState.IDLE,this.imageLoadFunction_=o}getImage(){if(this.state==ImageState.LOADED&&this.context_&&!(this.image_ instanceof HTMLCanvasElement)){const e=this.context_.canvas;e.width=this.image_.width,e.height=this.image_.height,this.context_.drawImage(this.image_,0,0),this.image_=this.context_.canvas}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_=ds(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 ds(r,e,t){const i=r;let n=!0,s=!1,o=!1;const a=[(0,Qe.Vx)(i,ot.Z.LOAD,function(){o=!0,s||e()})];return i.src&&fr.Tp?(s=!0,i.decode().then(function(){n&&e()}).catch(function(l){n&&(o?e():t())})):a.push((0,Qe.Vx)(i,ot.Z.ERROR,t)),function(){n=!1,a.forEach(Qe.bN)}}const xu=null;let Yi=null;class da extends ur.Z{constructor(e,t,i,n,s,o){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=s,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_===Ae.LOADED){Yi||(Yi=(0,ke.E4)(1,1,void 0,{willReadFrequently:!0})),Yi.drawImage(this.image_,0,0);try{Yi.getImageData(0,0,1,1),this.tainted_=!1}catch{Yi=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(ot.Z.CHANGE)}handleImageError_(){this.imageState_=Ae.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Ae.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=(0,ke.E4)(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_===Ae.IDLE){this.image_||this.initializeImage_(),this.imageState_=Ae.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=ds(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Ae.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=(0,mt.XC)(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 fa(r,e,t,i,n,s){let o=dr.c.get(e,i,s);return o||(o=new da(r,e,t,i,n,s),dr.c.set(e,i,s,o)),o}const yu=null;function gr(r,e,t,i){return t!==void 0&&i!==void 0?[t/r,i/e]:t!==void 0?t/r:i!==void 0?i/e:1}class fs extends lr{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,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:i,scale:n,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,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,ue.h)(!(a!==void 0&&o),4),(0,ue.h)(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||(0,J.sq)(o)),(0,ue.h)(a!==void 0&&a.length>0,6),(0,ue.h)(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),69);const l=e.src!==void 0?Ae.IDLE:Ae.LOADED;if(this.color_=e.color!==void 0?(0,mt._2)(e.color):null,this.iconImage_=fa(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,e.width!==void 0||e.height!==void 0){let h,c;if(e.size)[h,c]=e.size;else{const d=this.getImage(1);if(d instanceof HTMLCanvasElement||d.src&&d.complete)h=d.width,c=d.height;else{this.initialOptions_=e;const u=()=>{if(this.unlistenImageChange(u),!this.initialOptions_)return;const g=this.iconImage_.getSize();this.setScale(gr(g[0],g[1],e.width,e.height))};this.listenImageChange(u);return}}h!==void 0&&this.setScale(gr(h,c,e.width,e.height))}}clone(){let e,t,i;return this.initialOptions_?(t=this.initialOptions_.width,i=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new fs({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:e,width:t,height:i,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()}getWidth(){const e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Ae.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){const e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Ae.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(ot.Z.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(ot.Z.CHANGE,e)}}const vn=fs,ga="#333";class gs{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=(0,at.Pq)(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new Se({color:ga}),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 gs({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),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_}getRepeat(){return this.repeat_}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}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=(0,at.Pq)(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 gi=gs;function mr(r){return new fe({fill:ji(r,""),stroke:Hi(r,""),text:ma(r),image:pa(r)})}function ji(r,e){const t=r[e+"fill-color"];if(t)return new Se({color:t})}function Hi(r,e){const t=r[e+"stroke-width"],i=r[e+"stroke-color"];if(!(!t&&!i))return new Te({width:t,color:i,lineCap:r[e+"stroke-line-cap"],lineJoin:r[e+"stroke-line-join"],lineDash:r[e+"stroke-line-dash"],lineDashOffset:r[e+"stroke-line-dash-offset"],miterLimit:r[e+"stroke-miter-limit"]})}function ma(r){const e=r["text-value"];return e?new gi({text:e,font:r["text-font"],maxAngle:r["text-max-angle"],offsetX:r["text-offset-x"],offsetY:r["text-offset-y"],overflow:r["text-overflow"],placement:r["text-placement"],repeat:r["text-repeat"],scale:r["text-scale"],rotateWithView:r["text-rotate-with-view"],rotation:r["text-rotation"],textAlign:r["text-align"],justify:r["text-justify"],textBaseline:r["text-baseline"],padding:r["text-padding"],fill:ji(r,"text-"),backgroundFill:ji(r,"text-background-"),stroke:Hi(r,"text-"),backgroundStroke:Hi(r,"text-background-")}):void 0}function pa(r){const e=r["icon-src"],t=r["icon-img"];if(e||t)return new vn({src:e,img:t,imgSize:r["icon-img-size"],anchor:r["icon-anchor"],anchorOrigin:r["icon-anchor-origin"],anchorXUnits:r["icon-anchor-x-units"],anchorYUnits:r["icon-anchor-y-units"],color:r["icon-color"],crossOrigin:r["icon-cross-origin"],offset:r["icon-offset"],displacement:r["icon-displacement"],opacity:r["icon-opacity"],scale:r["icon-scale"],width:r["icon-width"],height:r["icon-height"],rotation:r["icon-rotation"],rotateWithView:r["icon-rotate-with-view"],size:r["icon-size"],declutterMode:r["icon-declutter-mode"]});const i=r["shape-points"];if(i){const s="shape-";return new $e({points:i,fill:ji(r,s),stroke:Hi(r,s),radius:r["shape-radius"],radius1:r["shape-radius1"],radius2:r["shape-radius2"],angle:r["shape-angle"],displacement:r["shape-displacement"],rotation:r["shape-rotation"],rotateWithView:r["shape-rotate-with-view"],scale:r["shape-scale"],declutterMode:r["shape-declutter-mode"]})}const n=r["circle-radius"];if(n){const s="circle-";return new Ct({radius:n,fill:ji(r,s),stroke:Hi(r,s),displacement:r["circle-displacement"],scale:r["circle-scale"],rotation:r["circle-rotation"],rotateWithView:r["circle-rotate-with-view"],declutterMode:r["circle-declutter-mode"]})}}const pr={RENDER_ORDER:"renderOrder"};class _a extends ar.Z{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(pr.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 or(9)),this.getRenderer().renderDeclutter(e)}setRenderOrder(e){this.set(pr.RENDER_ORDER,e)}setStyle(e){let t;if(e===void 0)t=ua;else if(e===null)t=null;else if(typeof e=="function")t=e;else if(e instanceof fe)t=e;else if(Array.isArray(e)){const i=e.length,n=new Array(i);for(let s=0;s<i;++s){const o=e[s];o instanceof fe?n[s]=o:n[s]=mr(o)}t=n}else t=mr(e);this.style_=t,this.styleFunction_=e===null?void 0:ca(this.style_),this.changed()}}const ms=_a,Ki={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},En=[Ki.FILL],$t=[Ki.STROKE],mi=[Ki.BEGIN_PATH],_r=[Ki.CLOSE_PATH],se=Ki;var xa=S(15419);class ya{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 xr=ya;var et=S(83441),Jt=S(67312);class va extends xr{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_,s=this.coordinates;let o=s.length;for(let a=0,l=e.length;a<l;a+=t)n[0]=e[a],n[1]=e[a+1],(0,C.b8)(i,n)&&(s[o++]=n[0],s[o++]=n[1]);return o}appendFlatLineCoordinates(e,t,i,n,s,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(t+=n);let c=e[t],d=e[t+1];const u=this.tmpCoordinate_;let g=!0,f,m,p;for(f=t+n;f<i;f+=n)u[0]=e[f],u[1]=e[f+1],p=(0,C.pX)(h,u),p!==m?(g&&(a[l++]=c,a[l++]=d,g=!1),a[l++]=u[0],a[l++]=u[1]):p===xa.Z.INTERSECTING?(a[l++]=u[0],a[l++]=u[1],g=!1):g=!0,c=u[0],d=u[1],m=p;return(s&&g||f===t+n)&&(a[l++]=c,a[l++]=d),l}drawCustomCoordinates_(e,t,i,n,s){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(e,t,l,n,!1,!1);s.push(h),t=l}return t}drawCustom(e,t,i,n){this.beginGeometry(e,t);const s=e.getType(),o=e.getStride(),a=this.coordinates.length;let l,h,c,d,u;switch(s){case"MultiPolygon":l=e.getOrientedFlatCoordinates(),d=[];const g=e.getEndss();u=0;for(let f=0,m=g.length;f<m;++f){const p=[];u=this.drawCustomCoordinates_(l,u,g[f],o,p),d.push(p)}this.instructions.push([se.CUSTOM,a,d,e,i,Jt.ug]),this.hitDetectionInstructions.push([se.CUSTOM,a,d,e,n||i,Jt.ug]);break;case"Polygon":case"MultiLineString":c=[],l=s=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),u=this.drawCustomCoordinates_(l,0,e.getEnds(),o,c),this.instructions.push([se.CUSTOM,a,c,e,i,Jt.o1]),this.hitDetectionInstructions.push([se.CUSTOM,a,c,e,n||i,Jt.o1]);break;case"LineString":case"Circle":l=e.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([se.CUSTOM,a,h,e,i,Jt.Ml]),this.hitDetectionInstructions.push([se.CUSTOM,a,h,e,n||i,Jt.Ml]);break;case"MultiPoint":l=e.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([se.CUSTOM,a,h,e,i,Jt.Ml]),this.hitDetectionInstructions.push([se.CUSTOM,a,h,e,n||i,Jt.Ml]));break;case"Point":l=e.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([se.CUSTOM,a,h,e,i]),this.hitDetectionInstructions.push([se.CUSTOM,a,h,e,n||i]);break;default:}this.endGeometry(t)}beginGeometry(e,t){this.beginGeometryInstruction1_=[se.BEGIN_GEOMETRY,t,0,e],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[se.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,s,o=-1;for(t=0;t<i;++t)n=e[t],s=n[0],s==se.END_GEOMETRY?o=t:s==se.BEGIN_GEOMETRY&&(n[2]=t,(0,et.FZ)(this.hitDetectionInstructions,o,t),o=-1)}setFillStrokeStyle(e,t){const i=this.state;if(e){const n=e.getColor();i.fillStyle=Pt(n||U.bL)}else i.fillStyle=void 0;if(t){const n=t.getColor();i.strokeStyle=Pt(n||U.Tx);const s=t.getLineCap();i.lineCap=s!==void 0?s:U.mb;const o=t.getLineDash();i.lineDash=o?o.slice():U.X9;const a=t.getLineDashOffset();i.lineDashOffset=a||U.He;const l=t.getLineJoin();i.lineJoin=l!==void 0?l:U.rc;const h=t.getWidth();i.lineWidth=h!==void 0?h:U.yC;const c=t.getMiterLimit();i.miterLimit=c!==void 0?c:U.V4,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=[se.SET_FILL_STYLE,t];return typeof t!="string"&&i.push(!0),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[se.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,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,h=e.miterLimit;(e.currentStrokeStyle!=i||e.currentLineCap!=n||s!=e.currentLineDash&&!(0,et.fS)(e.currentLineDash,s)||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=s,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=[se.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,C.d9)(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;(0,C.f3)(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const $i=va;class Ea extends $i{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(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([se.DRAW_IMAGE,s,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([se.DRAW_IMAGE,s,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(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([se.DRAW_IMAGE,s,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([se.DRAW_IMAGE,s,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(),s=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_=s[0],this.originY_=s[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 wa=Ea;class Ca extends $i{constructor(e,t,i,n){super(e,t,i,n)}drawFlatCoordinates_(e,t,i,n){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,i,n,!1,!1),a=[se.MOVE_TO_LINE_TO,s,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(e,t){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(n===void 0||s===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,U.X9,U.He],mi);const o=e.getFlatCoordinates(),a=e.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push($t),this.endGeometry(t)}drawMultiLineString(e,t){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(n===void 0||s===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],mi);const o=e.getEnds(),a=e.getFlatCoordinates(),l=e.getStride();let h=0;for(let c=0,d=o.length;c<d;++c)h=this.drawFlatCoordinates_(a,h,o[c],l);this.hitDetectionInstructions.push($t),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push($t),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push($t),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(mi)}}const Sa=Ca;var Ta=S(16168);class Ia extends $i{constructor(e,t,i,n){super(e,t,i,n)}drawFlatCoordinatess_(e,t,i,n){const s=this.state,o=s.fillStyle!==void 0,a=s.strokeStyle!==void 0,l=i.length;this.instructions.push(mi),this.hitDetectionInstructions.push(mi);for(let h=0;h<l;++h){const c=i[h],d=this.coordinates.length,u=this.appendFlatLineCoordinates(e,t,c,n,!0,!a),g=[se.MOVE_TO_LINE_TO,d,u];this.instructions.push(g),this.hitDetectionInstructions.push(g),a&&(this.instructions.push(_r),this.hitDetectionInstructions.push(_r)),t=c}return o&&(this.instructions.push(En),this.hitDetectionInstructions.push(En)),a&&(this.instructions.push($t),this.hitDetectionInstructions.push($t)),t}drawCircle(e,t){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(n===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_FILL_STYLE,U.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([se.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=[se.CIRCLE,l];this.instructions.push(mi,h),this.hitDetectionInstructions.push(mi,h),i.fillStyle!==void 0&&(this.instructions.push(En),this.hitDetectionInstructions.push(En)),i.strokeStyle!==void 0&&(this.instructions.push($t),this.hitDetectionInstructions.push($t)),this.endGeometry(t)}drawPolygon(e,t){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(n===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_FILL_STYLE,U.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([se.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,s=i.strokeStyle;if(n===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_FILL_STYLE,U.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([se.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,d=o.length;c<d;++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,Ta.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 yr=Ia;var _e=S(73863);function Ra(r,e,t,i,n){const s=[];let o=t,a=0,l=e.slice(t,2);for(;a<r&&o+n<i;){const[h,c]=l.slice(-2),d=e[o+n],u=e[o+n+1],g=Math.sqrt((d-h)*(d-h)+(u-c)*(u-c));if(a+=g,a>=r){const f=(r-a+g)/g,m=(0,_e.t7)(h,d,f),p=(0,_e.t7)(c,u,f);l.push(m,p),s.push(l),l=[m,p],a==r&&(o+=n),a=0}else if(a<r)l.push(e[o+n],e[o+n+1]),o+=n;else{const f=g-a,m=(0,_e.t7)(h,d,f/g),p=(0,_e.t7)(c,u,f/g);l.push(m,p),s.push(l),l=[m,p],a=0,o+=n}}return a>0&&s.push(l),s}function ba(r,e,t,i,n){let s=t,o=t,a=0,l=0,h=t,c,d,u,g,f,m,p,v,y,w;for(d=t;d<i;d+=n){const T=e[d],L=e[d+1];f!==void 0&&(y=T-f,w=L-m,g=Math.sqrt(y*y+w*w),p!==void 0&&(l+=u,c=Math.acos((p*y+v*w)/(u*g)),c>r&&(l>a&&(a=l,s=h,o=d),l=0,h=d-n)),u=g,p=y,v=w),f=T,m=L}return l+=g,l>a?[h,d]:[s,o]}const Ji={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class La extends $i{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_,s=this.textState_;if(this.text_===""||!s||!i&&!n)return;const o=this.coordinates;let a=o.length;const l=e.getType();let h=null,c=e.getStride();if(s.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!(0,C.kK)(this.getBufferedMaxExtent(),e.getExtent()))return;let d;if(h=e.getFlatCoordinates(),l=="LineString")d=[h.length];else if(l=="MultiLineString")d=e.getEnds();else if(l=="Polygon")d=e.getEnds().slice(0,1);else if(l=="MultiPolygon"){const m=e.getEndss();d=[];for(let p=0,v=m.length;p<v;++p)d.push(m[p][0])}this.beginGeometry(e,t);const u=s.repeat,g=u?void 0:s.textAlign;let f=0;for(let m=0,p=d.length;m<p;++m){let v;u?v=Ra(u*this.resolution,h,f,d[m],c):v=[h.slice(f,d[m])];for(let y=0,w=v.length;y<w;++y){const T=v[y];let L=0,P=T.length;if(g==null){const z=ba(s.maxAngle,T,0,T.length,2);L=z[0],P=z[1]}for(let z=L;z<P;z+=c)o.push(T[z],T[z+1]);const A=o.length;f=d[m],this.drawChars_(a,A),a=A}}this.endGeometry(t)}else{let d=s.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(),s.overflow||d.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const p=e.getFlatInteriorPoints();h=[];for(let v=0,y=p.length;v<y;v+=3)s.overflow||d.push(p[v+2]/this.resolution),h.push(p[v],p[v+1]);if(h.length===0)return;c=2;break;default:}const u=this.appendFlatPointCoordinates(h,c);if(u===a)return;if(d&&(u-a)/2!==h.length/c){let p=a/2;d=d.filter((v,y)=>{const w=o[(p+y)*2]===h[y*c]&&o[(p+y)*2+1]===h[y*c+1];return w||--p,w})}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(e,t);let g=s.padding;if(g!=U.oB&&(s.scale[0]<0||s.scale[1]<0)){let p=s.padding[0],v=s.padding[1],y=s.padding[2],w=s.padding[3];s.scale[0]<0&&(v=-v,w=-w),s.scale[1]<0&&(p=-p,y=-y),g=[p,v,y,w]}const f=this.pixelRatio;this.instructions.push([se.DRAW_IMAGE,a,u,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,g==U.oB?U.oB:g.map(function(p){return p*f}),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const m=1/f;this.hitDetectionInstructions.push([se.DRAW_IMAGE,a,u,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[m,m],NaN,void 0,this.declutterImageWithText_,g,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),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 s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||U.PH,justify:t.justify,textBaseline:t.textBaseline||U.ru,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_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=Ji[n.textBaseline],c=this.textOffsetY_*l,d=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([se.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,l,c,s,u*l,d,o,1]),this.hitDetectionInstructions.push([se.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,1,c,s,u,d,o,1/l])}setTextStyle(e,t){let i,n,s;if(!e)this.text_="";else{const o=e.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Pt(o.getColor()||U.bL)):(n=null,this.textFillState_=n);const a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const f=a.getLineDash(),m=a.getLineDashOffset(),p=a.getWidth(),v=a.getMiterLimit();s.lineCap=a.getLineCap()||U.mb,s.lineDash=f?f.slice():U.X9,s.lineDashOffset=m===void 0?U.He:m,s.lineJoin=a.getLineJoin()||U.rc,s.lineWidth=p===void 0?U.yC:p,s.miterLimit=v===void 0?U.V4:v,s.strokeStyle=Pt(a.getColor()||U.Tx)}i=this.textState_;const l=e.getFont()||U.Df;(0,U.Qx)(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.repeat=e.getRepeat(),i.justify=e.getJustify(),i.textBaseline=e.getTextBaseline()||U.ru,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||U.oB,i.scale=h===void 0?[1,1]:h;const c=e.getOffsetX(),d=e.getOffsetY(),u=e.getRotateWithView(),g=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=d===void 0?0:d,this.textRotateWithView_=u===void 0?!1:u,this.textRotation_=g===void 0?0:g,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:(0,J.sq)(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n?typeof n.fillStyle=="string"?n.fillStyle:"|"+(0,J.sq)(n.fillStyle):""}this.declutterImageWithText_=t}}const Fa={Circle:yr,Default:$i,Image:wa,LineString:Sa,Polygon:yr,Text:La};class Ma{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 s=i[n].finish();e[t][n]=s}}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 s=n[t];if(s===void 0){const o=Fa[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[t]=s}return s}}const vr=Ma;var ps=S(90346);class Pa extends ps.Z{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.declutterExecutorGroup=null}getFeatures(e){return(0,J.O3)()}getData(e){return null}prepareFrame(e){return(0,J.O3)()}renderFrame(e,t){return(0,J.O3)()}loadedTileCallback(e,t,i){e[t]||(e[t]={}),e[t][i.tileCoord.toString()]=i}createLoadedTileFinder(e,t,i){return(n,s)=>{const o=this.loadedTileCallback.bind(this,i,n);return e.forEachLoadedTile(t,n,s,o)}}forEachFeatureAtCoordinate(e,t,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){e.target.getState()===Ae.LOADED&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Ae.LOADED&&t!=Ae.ERROR&&e.addEventListener(ot.Z.CHANGE,this.boundHandleImageChange_),t==Ae.IDLE&&(e.load(),t=e.getState()),t==Ae.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Er=Pa;var wn=S(12297),qt=S(80032),q=S(81659);const wr=[];let wi=null;function Da(){wi=(0,ke.E4)(1,1,void 0,{willReadFrequently:!0})}class Aa extends Er{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=(0,q.Ue)(),this.pixelTransform=(0,q.Ue)(),this.inversePixelTransform=(0,q.Ue)(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,i){wi||Da(),wi.clearRect(0,0,1,1);let n;try{wi.drawImage(e,t,i,1,1,0,0,1,1),n=wi.getImageData(0,0,1,1).data}catch{return wi=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 s,o;if(e&&e.className===n&&(!i||e&&e.style.backgroundColor&&(0,et.fS)((0,mt._2)(e.style.backgroundColor),(0,mt._2)(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){s=document.createElement("div"),s.className=n;let a=s.style;a.position="absolute",a.width="100%",a.height="100%",o=(0,ke.E4)();const l=o.canvas;s.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=s,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(e,t,i){const n=(0,C.rL)(i),s=(0,C.Xv)(i),o=(0,C.w$)(i),a=(0,C.hC)(i);(0,q.nn)(t.coordinateToPixelTransform,n),(0,q.nn)(t.coordinateToPixelTransform,s),(0,q.nn)(t.coordinateToPixelTransform,o),(0,q.nn)(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;(0,q.nn)(l,n),(0,q.nn)(l,s),(0,q.nn)(l,o),(0,q.nn)(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(n[0]),Math.round(n[1])),e.lineTo(Math.round(s[0]),Math.round(s[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 s=new wn.Z(e,this.inversePixelTransform,i,t);n.dispatchEvent(s)}}preRender(e,t){this.frameState=t,this.dispatchRenderEvent_(qt.Z.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(qt.Z.POSTRENDER,e,t)}getRenderTransform(e,t,i,n,s,o,a){const l=s/2,h=o/2,c=n/t,d=-c,u=-e[0]+a,g=-e[1];return(0,q.qC)(this.tempTransform,l,h,c,d,-i,u,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const Cr=Aa;var pi=S(75925);function Oa(r,e,t,i,n,s,o,a,l,h,c,d){let u=r[e],g=r[e+1],f=0,m=0,p=0,v=0;function y(){f=u,m=g,e+=i,u=r[e],g=r[e+1],v+=p,p=Math.sqrt((u-f)*(u-f)+(g-m)*(g-m))}do y();while(e<t-i&&v+p<s);let w=p===0?0:(s-v)/p;const T=(0,_e.t7)(f,u,w),L=(0,_e.t7)(m,g,w),P=e-i,A=v,z=s+a*l(h,n,c);for(;e<t-i&&v+p<z;)y();w=p===0?0:(z-v)/p;const H=(0,_e.t7)(f,u,w),K=(0,_e.t7)(m,g,w);let le;if(d){const Y=[T,L,H,K];(0,pi.U1)(Y,0,4,2,d,Y,Y),le=Y[0]>Y[2]}else le=T>H;const he=Math.PI,Q=[],me=P+i===e;e=P,p=0,v=A,u=r[e],g=r[e+1];let re;if(me){y(),re=Math.atan2(g-m,u-f),le&&(re+=re>0?-he:he);const Y=(H+T)/2,N=(K+L)/2;return Q[0]=[Y,N,(z-s)/2,re,n],Q}n=n.replace(/\n/g," ");for(let Y=0,N=n.length;Y<N;){y();let $=Math.atan2(g-m,u-f);if(le&&($+=$>0?-he:he),re!==void 0){let Ce=$-re;if(Ce+=Ce>he?-2*he:Ce<-he?2*he:0,Math.abs(Ce)>o)return null}re=$;const Ee=Y;let Ie=0;for(;Y<N;++Y){const Ce=le?N-Y-1:Y,Le=a*l(h,n[Ce],c);if(e+i<t&&v+p<s+Ie+Le/2)break;Ie+=Le}if(Y===Ee)continue;const Ze=le?n.substring(N-Ee,N-Y):n.substring(Ee,Y);w=p===0?0:(s+Ie/2-v)/p;const G=(0,_e.t7)(f,u,w),ht=(0,_e.t7)(m,g,w);Q.push([G,ht,Ie/2,$,Ze]),s+=Ie}return Q}var ka=S(29416);const Ci=(0,C.lJ)(),Qt=[],Gt=[],Nt=[],ei=[];function Sr(r){return r[3].declutterBox}const Ba=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 Tr(r,e){return(e==="start"||e==="end")&&!Ba.test(r)&&(e=e==="start"?"left":"right"),Ji[e]}function za(r,e,t){return t>0&&r.push(` `,""),r.push(e,""),r}class Ga{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,q.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 s=e+t+i+n;if(this.labels_[s])return this.labels_[s];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],d=Array.isArray(e),u=l.justify?Ji[l.justify]:Tr(Array.isArray(e)?e[0]:e,l.textAlign||U.PH),g=n&&o.lineWidth?o.lineWidth:0,f=d?e:e.split(` `).reduce(za,[]),{width:m,height:p,widths:v,heights:y,lineWidths:w}=(0,U.Zw)(l,f),T=m+g,L=[],P=(T+2)*c[0],A=(p+g)*c[1],z={width:P<0?Math.floor(P):Math.ceil(P),height:A<0?Math.floor(A):Math.ceil(A),contextInstructions:L};(c[0]!=1||c[1]!=1)&&L.push("scale",c),n&&(L.push("strokeStyle",o.strokeStyle),L.push("lineWidth",g),L.push("lineCap",o.lineCap),L.push("lineJoin",o.lineJoin),L.push("miterLimit",o.miterLimit),L.push("setLineDash",[o.lineDash]),L.push("lineDashOffset",o.lineDashOffset)),i&&L.push("fillStyle",a.fillStyle),L.push("textBaseline","middle"),L.push("textAlign","center");const H=.5-u;let K=u*T+H*g;const le=[],he=[];let Q=0,me=0,re=0,Y=0,N;for(let $=0,Ee=f.length;$<Ee;$+=2){const Ie=f[$];if(Ie===` `){me+=Q,Q=0,K=u*T+H*g,++Y;continue}const Ze=f[$+1]||l.font;Ze!==N&&(n&&le.push("font",Ze),i&&he.push("font",Ze),N=Ze),Q=Math.max(Q,y[re]);const G=[Ie,K+H*v[re]+u*(v[re]-w[Y]),.5*(g+Q)+me];K+=v[re],n&&le.push("strokeText",G),i&&he.push("fillText",G),++re}return Array.prototype.push.apply(L,le),Array.prototype.push.apply(L,he),this.labels_[s]=z,z}replayTextBackground_(e,t,i,n,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,i),e.lineTo.apply(e,n),e.lineTo.apply(e,s),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,s,o,a,l,h,c,d,u,g,f,m,p){a*=u[0],l*=u[1];let v=i-a,y=n-l;const w=s+h>e?e-h:s,T=o+c>t?t-c:o,L=f[3]+w*u[0]+f[1],P=f[0]+T*u[1]+f[2],A=v-f[3],z=y-f[0];(m||d!==0)&&(Qt[0]=A,ei[0]=A,Qt[1]=z,Gt[1]=z,Gt[0]=A+L,Nt[0]=Gt[0],Nt[1]=z+P,ei[1]=Nt[1]);let H;return d!==0?(H=(0,q.qC)((0,q.Ue)(),i,n,1,1,d,-i,-n),(0,q.nn)(H,Qt),(0,q.nn)(H,Gt),(0,q.nn)(H,Nt),(0,q.nn)(H,ei),(0,C.T9)(Math.min(Qt[0],Gt[0],Nt[0],ei[0]),Math.min(Qt[1],Gt[1],Nt[1],ei[1]),Math.max(Qt[0],Gt[0],Nt[0],ei[0]),Math.max(Qt[1],Gt[1],Nt[1],ei[1]),Ci)):(0,C.T9)(Math.min(A,A+L),Math.min(z,z+P),Math.max(A,A+L),Math.max(z,z+P),Ci),g&&(v=Math.round(v),y=Math.round(y)),{drawImageX:v,drawImageY:y,drawImageW:w,drawImageH:T,originX:h,originY:c,declutterBox:{minX:Ci[0],minY:Ci[1],maxX:Ci[2],maxY:Ci[3],value:p},canvasTransform:H,scale:u}}replayImageOrLabel_(e,t,i,n,s,o,a){const l=!!(o||a),h=n.declutterBox,c=e.canvas,d=a?a[2]*n.scale[0]/2:0;return h.minX-d<=c.width/t&&h.maxX+d>=0&&h.minY-d<=c.height/t&&h.maxY+d>=0&&(l&&this.replayTextBackground_(e,Qt,Gt,Nt,ei,o,a),(0,U._f)(e,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(e){if(this.alignFill_){const t=(0,q.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 s=this.textStates[t],o=this.createLabel(e,t,n,i),a=this.strokeStates[i],l=this.pixelRatio,h=Tr(Array.isArray(e)?e[0]:e,s.textAlign||U.PH),c=Ji[s.textBaseline||U.ru],d=a&&a.lineWidth?a.lineWidth:0,u=o.width/l-2*s.scale[0],g=h*u+2*(.5-h)*d,f=c*o.height/l+2*(.5-c)*d;return{label:o,anchorX:g,anchorY:f}}execute_(e,t,i,n,s,o,a,l){let h;this.pixelCoordinates_&&(0,et.fS)(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=(0,pi.vT)(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),(0,q.lk)(this.renderedTransform_,i));let c=0;const d=n.length;let u=0,g,f,m,p,v,y,w,T,L,P,A,z,H=0,K=0,le=null,he=null;const Q=this.coordinateCache_,me=this.viewRotation_,re=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,Y={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:me},N=this.instructions!=n||this.overlaps?0:200;let $,Ee,Ie,Ze;for(;c<d;){const G=n[c];switch(G[0]){case se.BEGIN_GEOMETRY:$=G[1],Ze=G[3],$.getGeometry()?a!==void 0&&!(0,C.kK)(a,Ze.getExtent())?c=G[2]+1:++c:c=G[2];break;case se.BEGIN_PATH:H>N&&(this.fill_(e),H=0),K>N&&(e.stroke(),K=0),!H&&!K&&(e.beginPath(),p=NaN,v=NaN),++c;break;case se.CIRCLE:u=G[1];const Ce=h[u],Le=h[u+1],ai=h[u+2],Bt=h[u+3],Ue=ai-Ce,Vt=Bt-Le,Gi=Math.sqrt(Ue*Ue+Vt*Vt);e.moveTo(Ce+Gi,Le),e.arc(Ce,Le,Gi,0,2*Math.PI,!0),++c;break;case se.CLOSE_PATH:e.closePath(),++c;break;case se.CUSTOM:u=G[1],g=G[2];const Kn=G[3],Ni=G[4],$n=G.length==6?G[5]:void 0;Y.geometry=Kn,Y.feature=$,c in Q||(Q[c]=[]);const li=Q[c];$n?$n(h,u,g,2,li):(li[0]=h[u],li[1]=h[u+1],li.length=2),Ni(li,Y),++c;break;case se.DRAW_IMAGE:u=G[1],g=G[2],T=G[3],f=G[4],m=G[5];let cn=G[6];const hi=G[7],Jn=G[8],qn=G[9],Qn=G[10];let Zi=G[11];const er=G[12];let nt=G[13];const vt=G[14],bt=G[15];if(!T&&G.length>=20){L=G[19],P=G[20],A=G[21],z=G[22];const ct=this.drawLabelWithPointPlacement_(L,P,A,z);T=ct.label,G[3]=T;const Xi=G[23];f=(ct.anchorX-Xi)*this.pixelRatio,G[4]=f;const Et=G[24];m=(ct.anchorY-Et)*this.pixelRatio,G[5]=m,cn=T.height,G[6]=cn,nt=T.width,G[13]=nt}let Yt;G.length>25&&(Yt=G[25]);let Wi,vi,ci;G.length>17?(Wi=G[16],vi=G[17],ci=G[18]):(Wi=U.oB,vi=!1,ci=!1),Qn&&re?Zi+=me:!Qn&&!re&&(Zi-=me);let Ui=0;for(;u<g;u+=2){if(Yt&&Yt[Ui++]<nt/this.pixelRatio)continue;const ct=this.calculateImageOrLabelDimensions_(T.width,T.height,h[u],h[u+1],nt,cn,f,m,Jn,qn,Zi,er,s,Wi,vi||ci,$),Xi=[e,t,T,ct,hi,vi?le:null,ci?he:null];if(l){if(vt==="none")continue;if(vt==="obstacle"){l.insert(ct.declutterBox);continue}else{let Et,jt;if(bt){const ut=g-u;if(!bt[ut]){bt[ut]=Xi;continue}if(Et=bt[ut],delete bt[ut],jt=Sr(Et),l.collides(jt))continue}if(l.collides(ct.declutterBox))continue;Et&&(l.insert(jt),this.replayImageOrLabel_.apply(this,Et)),l.insert(ct.declutterBox)}}this.replayImageOrLabel_.apply(this,Xi)}++c;break;case se.DRAW_CHARS:const es=G[1],it=G[2],tr=G[3],gu=G[4];z=G[5];const mu=G[6],ia=G[7],na=G[8];A=G[9];const ir=G[10];L=G[11],P=G[12];const sa=[G[13],G[13]],nr=this.textStates[P],un=nr.font,dn=[nr.scale[0]*ia,nr.scale[1]*ia];let fn;un in this.widths_?fn=this.widths_[un]:(fn={},this.widths_[un]=fn);const ra=(0,ka.W)(h,es,it,2),oa=Math.abs(dn[0])*(0,U.Kd)(un,L,fn);if(gu||oa<=ra){const ct=this.textStates[P].textAlign,Xi=(ra-oa)*Ji[ct],Et=Oa(h,es,it,2,L,Xi,mu,Math.abs(dn[0]),U.Kd,un,fn,re?0:this.viewRotation_);e:if(Et){const jt=[];let ut,ts,is,st,wt;if(A)for(ut=0,ts=Et.length;ut<ts;++ut){wt=Et[ut],is=wt[4],st=this.createLabel(is,P,"",A),f=wt[2]+(dn[0]<0?-ir:ir),m=tr*st.height+(.5-tr)*2*ir*dn[1]/dn[0]-na;const Ht=this.calculateImageOrLabelDimensions_(st.width,st.height,wt[0],wt[1],st.width,st.height,f,m,0,0,wt[3],sa,!1,U.oB,!1,$);if(l&&l.collides(Ht.declutterBox))break e;jt.push([e,t,st,Ht,1,null,null])}if(z)for(ut=0,ts=Et.length;ut<ts;++ut){wt=Et[ut],is=wt[4],st=this.createLabel(is,P,z,""),f=wt[2],m=tr*st.height-na;const Ht=this.calculateImageOrLabelDimensions_(st.width,st.height,wt[0],wt[1],st.width,st.height,f,m,0,0,wt[3],sa,!1,U.oB,!1,$);if(l&&l.collides(Ht.declutterBox))break e;jt.push([e,t,st,Ht,1,null,null])}l&&l.load(jt.map(Sr));for(let Ht=0,pu=jt.length;Ht<pu;++Ht)this.replayImageOrLabel_.apply(this,jt[Ht])}}++c;break;case se.END_GEOMETRY:if(o!==void 0){$=G[1];const ct=o($,Ze);if(ct)return ct}++c;break;case se.FILL:N?H++:this.fill_(e),++c;break;case se.MOVE_TO_LINE_TO:for(u=G[1],g=G[2],Ee=h[u],Ie=h[u+1],y=Ee+.5|0,w=Ie+.5|0,(y!==p||w!==v)&&(e.moveTo(Ee,Ie),p=y,v=w),u+=2;u<g;u+=2)Ee=h[u],Ie=h[u+1],y=Ee+.5|0,w=Ie+.5|0,(u==g-2||y!==p||w!==v)&&(e.lineTo(Ee,Ie),p=y,v=w);++c;break;case se.SET_FILL_STYLE:le=G,this.alignFill_=G[2],H&&(this.fill_(e),H=0,K&&(e.stroke(),K=0)),e.fillStyle=G[1],++c;break;case se.SET_STROKE_STYLE:he=G,K&&(e.stroke(),K=0),this.setStrokeStyle_(e,G),++c;break;case se.STROKE:N?K++:e.stroke(),++c;break;default:++c;break}}H&&this.fill_(e),K&&e.stroke()}execute(e,t,i,n,s,o){this.viewRotation_=n,this.execute_(e,t,i,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,i,n,s){return this.viewRotation_=i,this.execute_(e,1,t,this.hitDetectionInstructions,!0,n,s)}}const Na=Ga,_s=["Polygon","Circle","LineString","Image","Text","Default"];class Za{constructor(e,t,i,n,s,o){this.maxExtent_=e,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=(0,q.Ue)(),this.createExecutors_(s)}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 s in n){const o=n[s];i[s]=new Na(this.resolution_,this.pixelRatio_,this.overlaps_,o)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const i=this.executorsByZIndex_[t];for(let n=0,s=e.length;n<s;++n)if(e[n]in i)return!0}return!1}forEachFeatureAtCoordinate(e,t,i,n,s,o){n=Math.round(n);const a=n*2+1,l=(0,q.qC)(this.hitDetectionTransform_,n+.5,n+.5,1/t,-1/t,-i,-e[0],-e[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=(0,ke.E4)(a,a,void 0,{willReadFrequently:!0}));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 d;this.renderBuffer_!==void 0&&(d=(0,C.lJ)(),(0,C.Wj)(d,e),(0,C.f3)(d,t*(this.renderBuffer_+n),d));const u=Wa(n);let g;function f(L,P){const A=c.getImageData(0,0,a,a).data;for(let z=0,H=u.length;z<H;z++)if(A[u[z]]>0){if(!o||g!=="Image"&&g!=="Text"||o.includes(L)){const K=(u[z]-3)/4,le=n-K%a,he=n-(K/a|0),Q=s(L,P,le*le+he*he);if(Q)return Q}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(et.j2);let p,v,y,w,T;for(p=m.length-1;p>=0;--p){const L=m[p].toString();for(y=this.executorsByZIndex_[L],v=_s.length-1;v>=0;--v)if(g=_s[v],w=y[g],w!==void 0&&(T=w.executeHitDetection(c,l,i,f,d),T))return T}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const i=t[0],n=t[1],s=t[2],o=t[3],a=[i,n,i,o,s,o,s,n];return(0,pi.vT)(a,0,8,2,e,a),a}isEmpty(){return(0,Vi.x)(this.executorsByZIndex_)}execute(e,t,i,n,s,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(et.j2),this.maxExtent_&&(e.save(),this.clip(e,i)),o=o||_s;let h,c,d,u,g,f;for(a&&l.reverse(),h=0,c=l.length;h<c;++h){const m=l[h].toString();for(g=this.executorsByZIndex_[m],d=0,u=o.length;d<u;++d){const p=o[d];f=g[p],f!==void 0&&f.execute(e,t,i,n,s,a)}}this.maxExtent_&&e.restore()}}const xs={};function Wa(r){if(xs[r]!==void 0)return xs[r];const e=r*2+1,t=r*r,i=new Array(t+1);for(let s=0;s<=r;++s)for(let o=0;o<=r;++o){const a=s*s+o*o;if(a>t)break;let l=i[a];l||(l=[],i[a]=l),l.push(((r+s)*e+(r+o))*4+3),s>0&&l.push(((r-s)*e+(r+o))*4+3),o>0&&(l.push(((r+s)*e+(r-o))*4+3),s>0&&l.push(((r-s)*e+(r-o))*4+3))}const n=[];for(let s=0,o=i.length;s<o;++s)i[s]&&n.push(...i[s]);return xs[r]=n,n}const Ir=Za;var Si=S(18637),Ti=S(95796);class Ua extends xr{constructor(e,t,i,n,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=i,this.transform_=n,this.transformRotation_=n?(0,_e.FH)(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,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,q.Ue)()}drawImages_(e,t,i,n){if(!this.image_)return;const s=(0,pi.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.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,d=s.length;c<d;c+=2){const u=s[c]-this.imageAnchorX_,g=s[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const f=u+this.imageAnchorX_,m=g+this.imageAnchorY_;(0,q.qC)(a,f,m,1,1,h,-f,-m),o.setTransform.apply(o,a),o.translate(f,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_,u,g,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 s=(0,pi.vT)(e,t,i,n,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<i;t+=n){const l=s[t]+this.textOffsetX_,h=s[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,s){const o=this.context_,a=(0,pi.vT)(e,t,i,n,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;s&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return s&&o.closePath(),i}drawRings_(e,t,i,n){for(let s=0,o=i.length;s<o;++s)t=this.moveToLineTo_(e,t,i[s],n,!0);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,C.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,Ti.Kr)(e,this.transform_,this.pixelCoordinates_),i=t[2]-t[0],n=t[3]-t[1],s=Math.sqrt(i*i+n*n),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,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&&(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,C.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,C.kK)(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,n=e.getFlatCoordinates();let s=0;const o=e.getEnds(),a=e.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)s=this.moveToLineTo_(n,s,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,C.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,C.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 s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){const h=s[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,et.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:U.PH;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:Pt(i||U.bL)}}if(!t)this.strokeState_=null;else{const i=t.getColor(),n=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),h=t.getMiterLimit(),c=s||U.X9;this.strokeState_={lineCap:n!==void 0?n:U.mb,lineDash:this.pixelRatio_===1?c:c.map(d=>d*this.pixelRatio_),lineDashOffset:(o||U.He)*this.pixelRatio_,lineJoin:a!==void 0?a:U.rc,lineWidth:(l!==void 0?l:U.yC)*this.pixelRatio_,miterLimit:h!==void 0?h:U.V4,strokeStyle:Pt(i||U.Tx)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const i=e.getPixelRatio(this.pixelRatio_),n=e.getAnchor(),s=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_=s[0],this.imageOriginY_=s[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 g=t.getColor();this.textFillState_={fillStyle:Pt(g||U.bL)}}const i=e.getStroke();if(!i)this.textStrokeState_=null;else{const g=i.getColor(),f=i.getLineCap(),m=i.getLineDash(),p=i.getLineDashOffset(),v=i.getLineJoin(),y=i.getWidth(),w=i.getMiterLimit();this.textStrokeState_={lineCap:f!==void 0?f:U.mb,lineDash:m||U.X9,lineDashOffset:p||U.He,lineJoin:v!==void 0?v:U.rc,lineWidth:y!==void 0?y:U.yC,miterLimit:w!==void 0?w:U.V4,strokeStyle:Pt(g||U.Tx)}}const n=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),h=e.getScaleArray(),c=e.getText(),d=e.getTextAlign(),u=e.getTextBaseline();this.textState_={font:n!==void 0?n:U.Df,textAlign:d!==void 0?d:U.PH,textBaseline:u!==void 0?u:U.ru},this.text_=c!==void 0?Array.isArray(c)?c.reduce((g,f,m)=>g+=m%2?" ":f,""):c:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s: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 Xa=Ua,Dt=.5;function Va(r,e,t,i,n,s,o){const a=r[0]*Dt,l=r[1]*Dt,h=(0,ke.E4)(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,d=new Xa(h,Dt,n,null,o),u=t.length,g=Math.floor((256*256*256-1)/u),f={};for(let p=1;p<=u;++p){const v=t[p-1],y=v.getStyleFunction()||i;if(!i)continue;let w=y(v,s);if(!w)continue;Array.isArray(w)||(w=[w]);const L=(p*g).toString(16).padStart(7,"#00000");for(let P=0,A=w.length;P<A;++P){const z=w[P],H=z.getGeometryFunction()(v);if(!H||!(0,C.kK)(n,H.getExtent()))continue;const K=z.clone(),le=K.getFill();le&&le.setColor(L);const he=K.getStroke();he&&(he.setColor(L),he.setLineDash(null)),K.setText(void 0);const Q=z.getImage();if(Q&&Q.getOpacity()!==0){const N=Q.getImageSize();if(!N)continue;const $=(0,ke.E4)(N[0],N[1],void 0,{alpha:!1}),Ee=$.canvas;$.fillStyle=L,$.fillRect(0,0,Ee.width,Ee.height),K.setImage(new vn({img:Ee,imgSize:N,anchor:Q.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:Q.getOrigin(),opacity:1,size:Q.getSize(),scale:Q.getScale(),rotation:Q.getRotation(),rotateWithView:Q.getRotateWithView()}))}const me=K.getZIndex()||0;let re=f[me];re||(re={},f[me]=re,re.Polygon=[],re.Circle=[],re.LineString=[],re.Point=[]);const Y=H.getType();if(Y==="GeometryCollection"){const N=H.getGeometriesArrayRecursive();for(let $=0,Ee=N.length;$<Ee;++$){const Ie=N[$];re[Ie.getType().replace("Multi","")].push(Ie,K)}}else re[Y.replace("Multi","")].push(H,K)}}const m=Object.keys(f).map(Number).sort(et.j2);for(let p=0,v=m.length;p<v;++p){const y=f[m[p]];for(const w in y){const T=y[w];for(let L=0,P=T.length;L<P;L+=2){d.setStyle(T[L+1]);for(let A=0,z=e.length;A<z;++A)d.setTransform(e[A]),d.drawGeometry(T[L])}}}return h.getImageData(0,0,c.width,c.height)}function Ya(r,e,t){const i=[];if(t){const n=Math.floor(Math.round(r[0])*Dt),s=Math.floor(Math.round(r[1])*Dt),o=((0,_e.uZ)(n,0,t.width-1)+(0,_e.uZ)(s,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),d=Math.floor((256*256*256-1)/e.length);c&&c%d===0&&i.push(e[c/d-1])}return i}const ja=.5,Rr={Point:il,LineString:Qa,Polygon:sl,MultiPoint:nl,MultiLineString:el,MultiPolygon:tl,GeometryCollection:qa,Circle:$a};function Ha(r,e){return parseInt((0,J.sq)(r),10)-parseInt((0,J.sq)(e),10)}function Ka(r,e){const t=ys(r,e);return t*t}function ys(r,e){return ja*r/e}function $a(r,e,t,i,n){const s=t.getFill(),o=t.getStroke();if(s||o){const l=r.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,i)}const a=t.getText();if(a&&a.getText()){const l=(n||r).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function br(r,e,t,i,n,s,o){let a=!1;const l=t.getImage();if(l){const h=l.getImageState();h==Ae.LOADED||h==Ae.ERROR?l.unlistenImageChange(n):(h==Ae.IDLE&&l.load(),l.listenImageChange(n),a=!0)}return Ja(r,e,t,i,s,o),a}function Ja(r,e,t,i,n,s){const o=t.getGeometryFunction()(e);if(!o)return;const a=o.simplifyTransformed(i,n);if(t.getRenderer())Lr(r,a,t,e);else{const h=Rr[a.getType()];h(r,a,t,e,s)}}function Lr(r,e,t,i){if(e.getType()=="GeometryCollection"){const s=e.getGeometries();for(let o=0,a=s.length;o<a;++o)Lr(r,s[o],t,i);return}r.getBuilder(t.getZIndex(),"Default").drawCustom(e,i,t.getRenderer(),t.getHitDetectionRenderer())}function qa(r,e,t,i,n){const s=e.getGeometriesArray();let o,a;for(o=0,a=s.length;o<a;++o){const l=Rr[s[o].getType()];l(r,s[o],t,i,n)}}function Qa(r,e,t,i,n){const s=t.getStroke();if(s){const a=r.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,i)}const o=t.getText();if(o&&o.getText()){const a=(n||r).getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i)}}function el(r,e,t,i,n){const s=t.getStroke();if(s){const a=r.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,i)}const o=t.getText();if(o&&o.getText()){const a=(n||r).getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i)}}function tl(r,e,t,i,n){const s=t.getFill(),o=t.getStroke();if(o||s){const l=r.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,i)}const a=t.getText();if(a&&a.getText()){const l=(n||r).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function il(r,e,t,i,n){const s=t.getImage(),o=t.getText();let a;if(s){if(s.getImageState()!=Ae.LOADED)return;let l=r;if(n){const c=s.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const d=r.getBuilder(t.getZIndex(),"Image");d.setImageStyle(s,a),d.drawPoint(e,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(t.getZIndex(),"Image");h.setImageStyle(s,a),h.drawPoint(e,i)}if(o&&o.getText()){let l=r;n&&(l=n);const h=l.getBuilder(t.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(e,i)}}function nl(r,e,t,i,n){const s=t.getImage(),o=t.getText();let a;if(s){if(s.getImageState()!=Ae.LOADED)return;let l=r;if(n){const c=s.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const d=r.getBuilder(t.getZIndex(),"Image");d.setImageStyle(s,a),d.drawMultiPoint(e,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(t.getZIndex(),"Image");h.setImageStyle(s,a),h.drawMultiPoint(e,i)}if(o&&o.getText()){let l=r;n&&(l=n);const h=l.getBuilder(t.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(e,i)}}function sl(r,e,t,i,n){const s=t.getFill(),o=t.getStroke();if(s||o){const l=r.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,i)}const a=t.getText();if(a&&a.getText()){const l=(n||r).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}var Ge=S(44445);class rl extends Cr{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,C.lJ)(),this.wrappedRenderedExtent_=(0,C.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,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,h=s.rotation,c=l.getExtent(),d=this.getLayer().getSource(),u=t.pixelRatio,g=t.viewHints,f=!(g[Si.Z.ANIMATING]||g[Si.Z.INTERACTING]),m=this.compositionContext_,p=Math.round(t.size[0]*u),v=Math.round(t.size[1]*u),y=d.getWrapX()&&l.canWrapX(),w=y?(0,C.dz)(c):null,T=y?Math.ceil((n[2]-c[2])/w)+1:1;let L=y?Math.floor((n[0]-c[0])/w):0;do{const P=this.getRenderTransform(o,a,h,u,p,v,L*w);e.execute(m,1,P,h,f,void 0,i)}while(++L<T)}setupCompositionContext_(){if(this.opacity_!==1){const e=(0,ke.E4)(this.context.canvas.width,this.context.canvas.height,wr);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,(0,ke.jy)(this.compositionContext_),wr.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,q.n3)(this.pixelTransform,1/i,1/i),(0,q.nb)(this.inversePixelTransform,this.pixelTransform);const s=(0,q.BB)(this.pixelTransform);this.useContainer(t,s,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),d=Math.round(e.size[1]*i);a.width!=c||a.height!=d?(a.width=c,a.height=d,a.style.transform!==s&&(a.style.transform=s)):this.containerReused||o.clearRect(0,0,c,d),this.preRender(o,e);const u=e.viewState,g=u.projection;this.opacity_=n.opacity,this.setupCompositionContext_();let f=!1,m=!0;if(n.extent&&this.clipping){const p=(0,W.dY)(n.extent,g);m=(0,C.kK)(p,e.extent),f=m&&!(0,C.r4)(p,e.extent),f&&this.clipUnrotated(this.compositionContext_,e,p)}return m&&this.renderWorlds(l,e),f&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(o,e),this.renderedRotation_!==u.rotation&&(this.renderedRotation_=u.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(e){return new Promise(t=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];(0,q.nn)(this.pixelTransform,i);const n=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],d=i[0]*Dt,u=i[1]*Dt;c.push(this.getRenderTransform(n,s,o,Dt,d,u,0).slice());const g=h.getSource(),f=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!(0,C.r4)(f,l)){let m=l[0];const p=(0,C.dz)(f);let v=0,y;for(;m<f[0];)--v,y=p*v,c.push(this.getRenderTransform(n,s,o,Dt,d,u,y).slice()),m+=p;for(v=0,m=l[2];m>f[2];)++v,y=p*v,c.push(this.getRenderTransform(n,s,o,Dt,d,u,y).slice()),m-=p}this.hitDetectionImageData_=Va(i,c,this.renderedFeatures_,h.getStyleFunction(),l,s,o)}t(Ya(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,i,n,s){if(!this.replayGroup_)return;const o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),h={},c=function(g,f,m){const p=(0,J.sq)(g),v=h[p];if(v){if(v!==!0&&m<v.distanceSq){if(m===0)return h[p]=!0,s.splice(s.lastIndexOf(v),1),n(g,l,f);v.geometry=f,v.distanceSq=m}}else{if(m===0)return h[p]=!0,n(g,l,f);s.push(h[p]={feature:g,layer:l,geometry:f,distanceSq:m,callback:n})}};let d;const u=[this.replayGroup_];return this.declutterExecutorGroup&&u.push(this.declutterExecutorGroup),u.some(g=>d=g.forEachFeatureAtCoordinate(e,o,a,i,c,g===this.declutterExecutorGroup&&t.declutterTree?t.declutterTree.all().map(f=>f.value):null)),d}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[Si.Z.ANIMATING],s=e.viewHints[Si.Z.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&n||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,h=e.viewState,c=h.projection,d=h.resolution,u=e.pixelRatio,g=t.getRevision(),f=t.getRenderBuffer();let m=t.getRenderOrder();m===void 0&&(m=Ha);const p=h.center.slice(),v=(0,C.f3)(l,f*d),y=v.slice(),w=[v.slice()],T=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!(0,C.r4)(T,e.extent)){const Y=(0,C.dz)(T),N=Math.max((0,C.dz)(v)/2,Y);v[0]=T[0]-N,v[2]=T[2]+N,(0,Ge.Cf)(p,c);const $=(0,C.Cf)(w[0],c);$[0]<T[0]&&$[2]<T[2]?w.push([$[0]+Y,$[1],$[2]+Y,$[3]]):$[0]>T[0]&&$[2]>T[2]&&w.push([$[0]-Y,$[1],$[2]-Y,$[3]])}if(this.ready&&this.renderedResolution_==d&&this.renderedRevision_==g&&this.renderedRenderOrder_==m&&(0,C.r4)(this.wrappedRenderedExtent_,v))return(0,et.fS)(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const L=new vr(ys(d,u),v,d,u);let P;this.getLayer().getDeclutter()&&(P=new vr(ys(d,u),v,d,u));const A=(0,W.Cs)();let z;if(A){for(let Y=0,N=w.length;Y<N;++Y){const $=w[Y],Ee=(0,W.Fj)($,c);i.loadFeatures(Ee,(0,W.on)(d,c),A)}z=(0,W.WO)(A,c)}else for(let Y=0,N=w.length;Y<N;++Y)i.loadFeatures(w[Y],d,c);const H=Ka(d,u);let K=!0;const le=Y=>{let N;const $=Y.getStyleFunction()||t.getStyleFunction();if($&&(N=$(Y,d)),N){const Ee=this.renderFeature(Y,H,N,L,z,P);K=K&&!Ee}},he=(0,W.Fj)(v,c),Q=i.getFeaturesInExtent(he);m&&Q.sort(m);for(let Y=0,N=Q.length;Y<N;++Y)le(Q[Y]);this.renderedFeatures_=Q,this.ready=K;const me=L.finish(),re=new Ir(v,d,u,i.getOverlaps(),me,t.getRenderBuffer());return P&&(this.declutterExecutorGroup=new Ir(v,d,u,i.getOverlaps(),P.finish(),t.getRenderBuffer())),this.renderedResolution_=d,this.renderedRevision_=g,this.renderedRenderOrder_=m,this.renderedExtent_=y,this.wrappedRenderedExtent_=v,this.renderedCenter_=p,this.renderedProjection_=c,this.replayGroup_=re,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,i,n,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=br(n,e,i[l],t,this.boundHandleStyleImageChange_,s,o)||a;else a=br(n,e,i,t,this.boundHandleStyleImageChange_,s,o);return a}}const ol=rl;class al extends ms{constructor(e){super(e)}createRenderer(){return new ol(this)}}const Be=al;var ll=S(26657),hl=S(42133);class cl extends hl.Z{constructor(e){super(),this.projection=(0,W.U2)(e.projection),this.attributions_=Fr(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(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=Fr(e),this.changed()}setState(e){this.state_=e,this.changed()}}function Fr(r){return r?Array.isArray(r)?function(e){return r}:typeof r=="function"?r:function(e){return[r]}:null}const Mr=cl;var qi=S(41875);function Pr(r,e){return[[-1/0,-1/0,1/0,1/0]]}function Eu(r,e){return[r]}function wu(r){return function(e,t,i){const n=r.getZForResolution(fromUserResolution(t,i)),s=r.getTileRangeForExtentAndZ(fromUserExtent(e,i),n),o=[],a=[n,0,0];for(a[1]=s.minX;a[1]<=s.maxX;++a[1])for(a[2]=s.minY;a[2]<=s.maxY;++a[2])o.push(toUserExtent(r.getTileCoordExtent(a),i));return o}}let Dr=!1;function ul(r,e,t,i,n,s,o){const a=new XMLHttpRequest;a.open("GET",typeof r=="function"?r(t,i,n):r,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Dr,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?s(e.readFeatures(c,{extent:t,featureProjection:n}),e.readProjection(c)):o()}else o()},a.onerror=o,a.send()}function Ar(r,e){return function(t,i,n,s,o){const a=this;ul(r,e,t,i,n,function(l,h){a.addFeatures(l),s!==void 0&&s(l)},o||qi.Zn)}}function Cu(r){Dr=r}class ti extends yn.ZP{constructor(e,t,i){super(e),this.feature=t,this.features=i}}class dl extends Mr{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_=qi.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,ue.h)(this.format_,7),this.loader_=Ar(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:Pr;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new rs:null,this.loadedExtentsRtree_=new rs,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 ss.Z(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,J.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 ti(We.ADDFEATURE,e))}setupChangeEvents_(e,t){this.featureChangeKeys_[e]=[(0,Qe.oL)(t,ot.Z.CHANGE,this.handleFeatureChange_,this),(0,Qe.oL)(t,ll.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,ue.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 s=0,o=e.length;s<o;s++){const a=e[s],l=(0,J.sq)(a);this.addToIndex_(l,a)&&i.push(a)}for(let s=0,o=i.length;s<o;s++){const a=i[s],l=(0,J.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(We.ADDFEATURE))for(let s=0,o=i.length;s<o;s++)this.dispatchEvent(new ti(We.ADDFEATURE,i[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(We.ADDFEATURE,function(i){t||(t=!0,e.push(i.feature),t=!1)}),this.addEventListener(We.REMOVEFEATURE,function(i){t||(t=!0,e.remove(i.feature),t=!1)}),e.addEventListener(xn.Z.ADD,i=>{t||(t=!0,this.addFeature(i.element),t=!1)}),e.addEventListener(xn.Z.REMOVE,i=>{t||(t=!0,this.removeFeature(i.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(Qe.bN);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const i=n=>{this.removeFeatureInternal(n)};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 ti(We.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 s=t(i);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),(0,Vi.x)(this.nullGeometryFeatures_)||(0,et.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,C.MV)(e,t);return[].concat(...n.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const i=e[0],n=e[1];let s=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||qi.uX,this.featuresRtree_.forEachInExtent(l,function(h){if(t(h)){const c=h.getGeometry(),d=a;if(a=c.closestPointXY(i,n,o,a),a<d){s=h;const u=Math.sqrt(a);l[0]=i-u,l[1]=n-u,l[2]=i+u,l[3]=n+u}}}),s}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,J.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 s=t.getId();if(s!==void 0){const o=s.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 ti(We.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:(0,J.sq)(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&(0,Vi.x)(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,i){const n=this.loadedExtentsRtree_,s=this.strategy_(e,t,i);for(let o=0,a=s.length;o<a;++o){const l=s[o];n.forEachInExtent(l,function(c){return(0,C.r4)(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new ti(We.FEATURESLOADSTART)),this.loader_.call(this,l,t,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new ti(We.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ti(We.FEATURESLOADERROR))}),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,C.fS)(n.extent,e))return i=n,!0}),i&&t.remove(i)}removeFeature(e){if(!e)return;const t=(0,J.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,J.sq)(e),i=this.featureChangeKeys_[t];if(!i)return;i.forEach(Qe.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 ti(We.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,ue.h)(this.format_,7),this.url_=e,this.setLoader(Ar(e,this.format_))}}const pt=dl;var Zt=S(31107),Wt=S(27349);const Or=0,Qi=1,kr=[0,0,0,0],Ii=[],vs={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class Es extends yn.ZP{constructor(e,t,i){super(e),this.features=t,this.mapBrowserEvent=i}}class fl extends rr.Z{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:Zt.Xp,this.defaultDeleteCondition_=function(i){return(0,Zt.Ko)(i)&&(0,Zt.Kf)(i)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Zt.Bx,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new rs,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Be({source:new pt({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:ml(),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 ss.Z(this.source_.getFeatures()),this.source_.addEventListener(We.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(We.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(xn.Z.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(xn.Z.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(ot.Z.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ss.Z;const i=this.featuresBeingModified_.getArray();for(let n=0,s=t.length;n<s;++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 Es(vs.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(ot.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 s=i[n];for(let o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===s&&this.dragSegments_.splice(o,1);t.remove(s)}}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,s=i.length;n<s;++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,s=i.length-1;n<s;++n){const o=i.slice(n,n+2),a={feature:e,geometry:t,index:n,segment:o};this.rBush_.insert((0,C.hI)(o),a)}}writeMultiLineStringGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++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,C.hI)(h),c)}}}writePolygonGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++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,C.hI)(h),c)}}}writeMultiPolygonGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a){const h=o[a];for(let c=0,d=h.length-1;c<d;++c){const u=h.slice(c,c+2),g={feature:e,geometry:t,depth:[a,n],index:c,segment:u};this.rBush_.insert((0,C.hI)(u),g)}}}}writeCircleGeometry_(e,t){const i=t.getCenter(),n={feature:e,geometry:t,index:Or,segment:[i,i]},s={feature:e,geometry:t,index:Qi,segment:[i,i]},o=[n,s];n.featureSegments=o,s.featureSegments=o,this.rBush_.insert((0,C.HK)(i),n);let a=t;const l=(0,W.Cs)();if(l&&this.getMap()){const h=this.getMap().getView().getProjection();a=a.clone().transform(l,h),a=(0,Wt.Bb)(a).transform(h,l)}this.rBush_.insert(a.getExtent(),s)}writeGeometryCollectionGeometry_(e,t){const i=t.getGeometriesArray();for(let n=0;n<i.length;++n){const s=i[n],o=this.SEGMENT_WRITERS_[s.getType()];o(e,s)}}createOrUpdateVertexFeature_(e,t,i){let n=this.vertexFeature_;return n?n.getGeometry().setCoordinates(e):(n=new Ke.Z(new Mt.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==gt.Z.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(e.type!=gt.Z.SINGLECLICK||!this.ignoreNextSingleClick_?t=this.removePoint():t=!0),e.type==gt.Z.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 s=0,o=this.dragSegments_.length;s<o;++s){const a=this.dragSegments_[s],l=a[0],h=l.feature;i.includes(h)||i.push(h);const c=l.geometry;n.includes(c)||n.push(c);const d=l.depth;let u;const g=l.segment,f=a[1];for(;t.length<c.getStride();)t.push(g[f][t.length]);switch(c.getType()){case"Point":u=t,g[0]=t,g[1]=t;break;case"MultiPoint":u=c.getCoordinates(),u[l.index]=t,g[0]=t,g[1]=t;break;case"LineString":u=c.getCoordinates(),u[l.index+f]=t,g[f]=t;break;case"MultiLineString":u=c.getCoordinates(),u[d[0]][l.index+f]=t,g[f]=t;break;case"Polygon":u=c.getCoordinates(),u[d[0]][l.index+f]=t,g[f]=t;break;case"MultiPolygon":u=c.getCoordinates(),u[d[1]][d[0]][l.index+f]=t,g[f]=t;break;case"Circle":if(g[0]=t,g[1]=t,l.index===Or)this.changingFeature_=!0,c.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;const m=e.map.getView().getProjection();let p=(0,Ge.TE)((0,W.Vs)(c.getCenter(),m),(0,W.Vs)(t,m));const v=(0,W.Cs)();if(v){const y=c.clone().transform(v,m);y.setRadius(p),p=y.transform(m,v).getRadius()}c.setRadius(p),this.changingFeature_=!1}break;default:}u&&this.setGeometryCoordinates_(c,u)}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(),s=[],o=i.getGeometry().getCoordinates(),a=(0,C.hI)([o]),l=this.rBush_.getInExtent(a),h={};l.sort(gl);for(let c=0,d=l.length;c<d;++c){const u=l[c],g=u.segment;let f=(0,J.sq)(u.geometry);const m=u.depth;if(m&&(f+="-"+m.join("-")),h[f]||(h[f]=new Array(2)),u.geometry.getType()==="Circle"&&u.index===Qi){const p=zr(t,u,n);(0,Ge.fS)(p,o)&&!h[f][0]&&(this.dragSegments_.push([u,0]),h[f][0]=u);continue}if((0,Ge.fS)(g[0],o)&&!h[f][0]){this.dragSegments_.push([u,0]),h[f][0]=u;continue}if((0,Ge.fS)(g[1],o)&&!h[f][1]){if(h[f][0]&&h[f][0].index===0){let p=u.geometry.getCoordinates();switch(u.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":p=p[m[1]];case"Polygon":if(u.index!==p[m[0]].length-2)continue;break;default:}}this.dragSegments_.push([u,1]),h[f][1]=u;continue}(0,J.sq)(g)in this.vertexSegments_&&!h[f][0]&&!h[f][1]&&this.insertVertexCondition_(e)&&s.push(u)}s.length&&this.willModifyFeatures_(e,[s]);for(let c=s.length-1;c>=0;--c)this.insertVertex_(s[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 s=n.getCenter(),o=i.featureSegments[0],a=i.featureSegments[1];o.segment[0]=s,o.segment[1]=s,a.segment[0]=s,a.segment[1]=s,this.rBush_.update((0,C.HK)(s),o);let l=n;const h=(0,W.Cs)();if(h){const c=e.map.getView().getProjection();l=l.clone().transform(h,c),l=(0,Wt.Bb)(l).transform(c,h)}this.rBush_.update(l.getExtent(),a)}else this.rBush_.update((0,C.hI)(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new Es(vs.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),s=t.getView().getProjection(),o=function(h,c){return Br(n,h,s)-Br(n,c,s)};let a,l;if(this.hitDetection_){const h=typeof this.hitDetection_=="object"?c=>c===this.hitDetection_:void 0;t.forEachFeatureAtPixel(e,(c,d,u)=>{u&&(u=new Mt.Z((0,W.lO)(u.getCoordinates(),s)));const g=u||c.getGeometry();if(g.getType()==="Point"&&c instanceof Ke.Z&&this.features_.getArray().includes(c)){l=g;const f=c.getGeometry().getFlatCoordinates().slice(0,2);a=[{feature:c,geometry:l,segment:[f,f]}]}return!0},{layerFilter:h})}if(!a){const h=(0,W.dY)((0,C.HK)(n,kr),s),c=t.getView().getResolution()*this.pixelTolerance_,d=(0,W.Fj)((0,C.f3)(h,c,kr),s);a=this.rBush_.getInExtent(d)}if(a&&a.length>0){const h=a.sort(o)[0],c=h.segment;let d=zr(n,h,s);const u=t.getPixelFromCoordinate(d);let g=(0,Ge.TE)(e,u);if(l||g<=this.pixelTolerance_){const f={};if(f[(0,J.sq)(c)]=!0,this.snapToPointer_||(this.delta_[0]=d[0]-n[0],this.delta_[1]=d[1]-n[1]),h.geometry.getType()==="Circle"&&h.index===Qi)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(d,[h.feature],[h.geometry]);else{const m=t.getPixelFromCoordinate(c[0]),p=t.getPixelFromCoordinate(c[1]),v=(0,Ge.bI)(u,m),y=(0,Ge.bI)(u,p);g=Math.sqrt(Math.min(v,y)),this.snappedToVertex_=g<=this.pixelTolerance_,this.snappedToVertex_&&(d=v>y?c[1]:c[0]),this.createOrUpdateVertexFeature_(d,[h.feature],[h.geometry]);const w={};w[(0,J.sq)(h.geometry)]=!0;for(let T=1,L=a.length;T<L;++T){const P=a[T].segment;if((0,Ge.fS)(c[0],P[0])&&(0,Ge.fS)(c[1],P[1])||(0,Ge.fS)(c[0],P[1])&&(0,Ge.fS)(c[1],P[0])){const A=(0,J.sq)(a[T].geometry);A in w||(w[A]=!0,f[(0,J.sq)(P)]=!0)}else break}}this.vertexSegments_=f;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(e,t){const i=e.segment,n=e.feature,s=e.geometry,o=e.depth,a=e.index;let l;for(;t.length<s.getStride();)t.push(0);switch(s.getType()){case"MultiLineString":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"Polygon":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"MultiPolygon":l=s.getCoordinates(),l[o[1]][o[0]].splice(a+1,0,t);break;case"LineString":l=s.getCoordinates(),l.splice(a+1,0,t);break;default:return}this.setGeometryCoordinates_(s,l);const h=this.rBush_;h.remove(e),this.updateSegmentIndices_(s,a,o,1);const c={segment:[i[0],t],feature:n,geometry:s,depth:o,index:a};h.insert((0,C.hI)(c.segment),c),this.dragSegments_.push([c,1]);const d={segment:[t,i[1]],feature:n,geometry:s,depth:o,index:a+1};h.insert((0,C.hI)(d.segment),d),this.dragSegments_.push([d,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=gt.Z.POINTERDRAG){const e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_);const t=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Es(vs.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null,t}return!1}removeVertex_(){const e=this.dragSegments_,t={};let i=!1,n,s,o,a,l,h,c,d,u,g,f;for(l=e.length-1;l>=0;--l)o=e[l],g=o[0],f=(0,J.sq)(g.feature),g.depth&&(f+="-"+g.depth.join("-")),f in t||(t[f]={}),o[1]===0?(t[f].right=g,t[f].index=g.index):o[1]==1&&(t[f].left=g,t[f].index=g.index+1);for(f in t){switch(u=t[f].right,c=t[f].left,h=t[f].index,d=h-1,c!==void 0?g=c:g=u,d<0&&(d=0),a=g.geometry,s=a.getCoordinates(),n=s,i=!1,a.getType()){case"MultiLineString":s[g.depth[0]].length>2&&(s[g.depth[0]].splice(h,1),i=!0);break;case"LineString":s.length>2&&(s.splice(h,1),i=!0);break;case"MultiPolygon":n=n[g.depth[1]];case"Polygon":n=n[g.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]),d=n.length-1));break;default:}if(i){this.setGeometryCoordinates_(a,s);const m=[];if(c!==void 0&&(this.rBush_.remove(c),m.push(c.segment[0])),u!==void 0&&(this.rBush_.remove(u),m.push(u.segment[1])),c!==void 0&&u!==void 0){const p={depth:g.depth,feature:g.feature,geometry:g.geometry,index:d,segment:m};this.rBush_.insert((0,C.hI)(p.segment),p)}this.updateSegmentIndices_(a,h,g.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(s){s.geometry===e&&(i===void 0||s.depth===void 0||(0,et.fS)(s.depth,i))&&s.index>t&&(s.index+=n)})}}function gl(r,e){return r.index-e.index}function Br(r,e,t){const i=e.geometry;if(i.getType()==="Circle"){let s=i;if(e.index===Qi){const o=(0,W.Cs)();o&&(s=s.clone().transform(o,t));const a=(0,Ge.bI)(s.getCenter(),(0,W.Vs)(r,t)),l=Math.sqrt(a)-s.getRadius();return l*l}}const n=(0,W.Vs)(r,t);return Ii[0]=(0,W.Vs)(e.segment[0],t),Ii[1]=(0,W.Vs)(e.segment[1],t),(0,Ge.Bs)(n,Ii)}function zr(r,e,t){const i=e.geometry;if(i.getType()==="Circle"&&e.index===Qi){let s=i;const o=(0,W.Cs)();return o&&(s=s.clone().transform(o,t)),(0,W.lO)(s.getClosestPoint((0,W.Vs)(r,t)),t)}const n=(0,W.Vs)(r,t);return Ii[0]=(0,W.Vs)(e.segment[0],t),Ii[1]=(0,W.Vs)(e.segment[1],t),(0,W.lO)((0,Ge.oL)(n,Ii),t)}function ml(){const r=hr();return function(e,t){return r.Point}}const pl=fl;var _l=S(32732);class Cn extends Ti.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 Cn(this.flatCoordinates.slice(),void 0,this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,n){const s=this.flatCoordinates,o=e-s[0],a=t-s[1],l=o*o+a*a;if(l<n){if(l===0)for(let h=0;h<this.stride;++h)i[h]=s[h];else{const h=this.getRadius()/Math.sqrt(l);i[0]=s[0]+h*o,i[1]=s[1]+h*a;for(let c=2;c<this.stride;++c)i[c]=s[c]}return i.length=this.stride,l}return n}containsXY(e,t){const i=this.flatCoordinates,n=e-i[0],s=t-i[1];return n*n+s*s<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(e){const t=this.flatCoordinates,i=t[this.stride]-t[0];return(0,C.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,C.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,C.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 s=1;s<t;++s)n[t+s]=e[s];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 s=(0,_l.IG)(n,0,e,this.stride);n[s++]=n[0]+t;for(let o=1,a=this.stride;o<a;++o)n[s++]=n[o];n.length=s,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,pi.U1)(i,0,i.length,n,e,t,i)),this.changed()}}Cn.prototype.transform;const Gr=Cn;var xl=S(87419),yl=S(93829),vl=S(40601),Sn=S(98311),El=S(75310),Ri=S(66627);const Tn={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class In extends yn.ZP{constructor(e,t){super(e),this.feature=t}}function wl(r,e){const t=[];for(let i=0;i<e.length;++i){const s=e[i].getGeometry();Nr(r,s,t)}return t}function Rn(r,e){return(0,_e.bI)(r[0],r[1],e[0],e[1])}function bi(r,e){const t=r.length;return e<0?r[e+t]:e>=t?r[e-t]:r[e]}function bn(r,e,t){let i,n;e<t?(i=e,n=t):(i=t,n=e);const s=Math.ceil(i),o=Math.floor(n);if(s>o){const l=Li(r,i),h=Li(r,n);return Rn(l,h)}let a=0;if(i<s){const l=Li(r,i),h=bi(r,s);a+=Rn(l,h)}if(o<n){const l=bi(r,o),h=Li(r,n);a+=Rn(l,h)}for(let l=s;l<o-1;++l){const h=bi(r,l),c=bi(r,l+1);a+=Rn(h,c)}return a}function Nr(r,e,t){if(e instanceof He.Z){Ln(r,e.getCoordinates(),!1,t);return}if(e instanceof Sn.Z){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n)Ln(r,i[n],!1,t);return}if(e instanceof Wt.ZP){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n)Ln(r,i[n],!0,t);return}if(e instanceof Ri.Z){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a)Ln(r,o[a],!0,t)}return}if(e instanceof xl.Z){const i=e.getGeometries();for(let n=0;n<i.length;++n)Nr(r,i[n],t);return}}const ws={index:-1,endIndex:NaN};function Cl(r,e,t,i){const n=r[0],s=r[1];let o=1/0,a=-1,l=NaN;for(let d=0;d<e.targets.length;++d){const u=e.targets[d],g=u.coordinates;let f=1/0,m;for(let p=0;p<g.length-1;++p){const v=g[p],y=g[p+1],w=Zr(n,s,v,y);w.squaredDistance<f&&(f=w.squaredDistance,m=p+w.along)}f<o&&(o=f,u.ring&&e.targetIndex===d&&(u.endIndex>u.startIndex?m<u.startIndex&&(m+=g.length):u.endIndex<u.startIndex&&m>u.startIndex&&(m-=g.length)),l=m,a=d)}const h=e.targets[a];let c=h.ring;if(e.targetIndex===a&&c){const d=Li(h.coordinates,l),u=t.getPixelFromCoordinate(d);(0,Ge.TE)(u,e.startPx)>i&&(c=!1)}if(c){const d=h.coordinates,u=d.length,g=h.startIndex,f=l;if(g<f){const m=bn(d,g,f);bn(d,g,f-u)<m&&(l-=u)}else{const m=bn(d,g,f);bn(d,g,f+u)<m&&(l+=u)}}return ws.index=a,ws.endIndex=l,ws}function Ln(r,e,t,i){const n=r[0],s=r[1];for(let o=0,a=e.length-1;o<a;++o){const l=e[o],h=e[o+1],c=Zr(n,s,l,h);if(c.squaredDistance===0){const d=o+c.along;i.push({coordinates:e,ring:t,startIndex:d,endIndex:d});return}}}const Cs={along:0,squaredDistance:0};function Zr(r,e,t,i){const n=t[0],s=t[1],o=i[0],a=i[1],l=o-n,h=a-s;let c=0,d=n,u=s;return(l!==0||h!==0)&&(c=(0,_e.uZ)(((r-n)*l+(e-s)*h)/(l*l+h*h),0,1),d+=l*c,u+=h*c),Cs.along=c,Cs.squaredDistance=(0,_e.FH)((0,_e.bI)(r,e,d,u),10),Cs}function Li(r,e){const t=r.length;let i=Math.floor(e);const n=e-i;i>=t?i-=t:i<0&&(i+=t);let s=i+1;s>=t&&(s-=t);const o=r[i],a=o[0],l=o[1],h=r[s],c=h[0]-a,d=h[1]-l;return[a+c*n,l+d*n]}class Sl extends rr.Z{constructor(e){const t=e;t.stopDown||(t.stopDown=qi.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_=Il(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:qi.uX,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let i=e.geometryFunction;if(!i){const n=this.mode_;if(n==="Circle")i=function(s,o,a){const l=o||new Gr([NaN,NaN]),h=(0,W.Vs)(s[0],a),c=(0,Ge.bI)(h,(0,W.Vs)(s[s.length-1],a));l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_);const d=(0,W.Cs)();return d&&l.transform(a,d),l};else{let s;n==="Point"?s=Mt.Z:n==="LineString"?s=He.Z:n==="Polygon"&&(s=Wt.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 s(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 Be({source:new pt({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:Tl(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:Zt.rM,this.freehandCondition_,e.freehand?this.freehandCondition_=Zt.Bx:this.freehandCondition_=e.freehandCondition?e.freehandCondition:Zt.vY,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(yl.Z.ACTIVE,this.updateState_)}setTrace(e){let t;e?e===!0?t=Zt.Bx:t=e:t=Zt.Fi,this.traceCondition_=t}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===ot.Z.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let t=e.type===gt.Z.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&e.type===gt.Z.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===gt.Z.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),i=!1):this.freehand_&&e.type===gt.Z.POINTERDOWN?i=!1:t&&this.getPointerCount()<2?(i=e.type===gt.Z.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===gt.Z.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===gt.Z.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(()=>{this.handlePointerMove_(new vl.Z(gt.Z.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},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_]),s=(0,C.hI)([i,n]),o=this.traceSource_.getFeaturesInExtent(s);if(o.length===0)return;const a=wl(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 s=Math.floor(t);s===t&&(s-=1),i=s-n+1}else{const n=Math.floor(e);let s=Math.ceil(t);s===t&&(s+=1),i=n-s+1}i>0&&this.removeLastPoints_(i)}addTracedCoordinates_(e,t,i){if(t===i)return;const n=[];if(t<i){const s=Math.ceil(t);let o=Math.floor(i);o===i&&(o-=1);for(let a=s;a<=o;++a)n.push(bi(e.coordinates,a))}else{const s=Math.floor(t);let o=Math.ceil(i);o===i&&(o+=1);for(let a=s;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,Ge.TE)(t.startPx,e.pixel)<this.snapTolerance_)return;const i=Cl(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 s=Li(n.coordinates,n.endIndex),o=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,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],s=t[1]-i[1],o=n*n+s*s;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,s=[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_,s=[a[0][0],a[0][a[0].length-2]],t?s=[a[0][0]]:s=[a[0][0],a[0][a[0].length-2]]}if(n){const a=this.getMap();for(let l=0,h=s.length;l<h;l++){const c=s[l],d=a.getPixelFromCoordinate(c),u=e[0]-d[0],g=e[1]-d[1],f=this.freehand_?1:this.snapTolerance_;if(i=Math.sqrt(u*u+g*g)<=f,i){this.finishCoordinate_=c;break}}}}return i}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Ke.Z(new Mt.Z(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Ke.Z);const t=e.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(t.getLayout(),t.getFlatCoordinates()),i.changed()):(i=new He.Z(t.getFlatCoordinates(),t.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(e){const t=this.getMap().getView().getProjection(),i=(0,Ti.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 Ke.Z(new He.Z(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,t);this.sketchFeature_=new Ke.Z,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new In(Tn.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const t=this.getMap(),i=this.sketchFeature_.getGeometry(),n=t.getView().getProjection(),s=(0,Ti.tP)(this.geometryLayout_);let o,a;for(;e.length<s;)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,s;const o=this.mode_;o==="LineString"||o==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():n=!0),s.push(e.slice()),this.geometryFunction_(s,t,i)):o==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():n=!0),s.push(e.slice()),n&&(this.finishCoordinate_=s[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 s=0;s<e;++s){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 El.Z([t])):this.type_==="MultiLineString"?e.setGeometry(new Sn.Z([t])):this.type_==="MultiPolygon"&&e.setGeometry(new Ri.Z([t])),this.dispatchEvent(new In(Tn.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 In(Tn.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 s=e[e.length-1];this.addToDrawing_(s),this.modifyDrawing_(s)}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 Ke.Z(new Mt.Z(n)),this.updateSketchFeatures_(),this.dispatchEvent(new In(Tn.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 Tl(){const r=hr();return function(e,t){return r[e.getGeometry().getType()]}}function Su(r,e){return function(t,i,n){const s=fromUserCoordinate(t[0],n),o=fromUserCoordinate(t[t.length-1],n),a=Math.sqrt(squaredCoordinateDistance(s,o));i=i||fromCircle(new Circle(s),r);let l=e;if(!e&&e!==0){const c=o[0]-s[0],d=o[1]-s[1];l=Math.atan2(d,c)}makeRegular(i,s,a,l);const h=getUserProjection();return h&&i.transform(n,h),i}}function Tu(){return function(r,e,t){const i=boundingExtent([r[0],r[r.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 s=getUserProjection();return s&&e.transform(t,s),e}}function Il(r){switch(r){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: "+r)}}const Rl=Sl;var Wr=S(36334);class Ur extends Be{constructor(){super({source:new pt}),this.opts={action:"length",unit:"m"},this.segmentStyle=new fe({text:new gi({font:"12px Calibri,sans-serif",fill:new Se({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Se({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textBaseline:"bottom",offsetY:-12}),image:new $e({radius:6,points:3,angle:Math.PI,displacement:[0,8],fill:new Se({color:"rgba(0, 0, 0, 0.4)"})})}),this.segmentStyles=[this.segmentStyle],this.shapeStyle=[new fe({fill:new Se({color:"rgba(255, 255, 255, 0.2)"}),image:new Ct({radius:5,stroke:new Te({color:"rgba(0, 0, 0, 0.7)"}),fill:new Se({color:"rgba(255, 255, 255, 0.2)"})})}),new fe({stroke:new Te({color:[0,0,0,1],width:2,lineDash:[4,8],lineDashOffset:6})}),new fe({stroke:new Te({color:[255,255,255,1],width:2,lineDash:[4,8]})})],this.labelStyle=new fe({text:new gi({font:"14px Calibri,sans-serif",fill:new Se({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Se({color:"rgba(0, 0, 0, 0.7)"}),padding:[3,3,3,3],textBaseline:"bottom",offsetY:-15}),image:new $e({radius:8,points:3,angle:Math.PI,displacement:[0,10],fill:new Se({color:"rgba(0, 0, 0, 0.7)"})})}),this.tipStyle=new fe({text:new gi({font:"12px Calibri,sans-serif",fill:new Se({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Se({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modifyStyle=new fe({image:new Ct({radius:5,stroke:new Te({color:"rgba(0, 0, 0, 0.7)"}),fill:new Se({color:"rgba(0, 0, 0, 0.4)"})}),text:new gi({text:"Drag to modify",font:"12px Calibri,sans-serif",fill:new Se({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Se({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modify=new pl({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=qe[0];return this.opts.action==="area"?(i=qe[1],t=(0,Wr.bg)(e)):t=(0,Wr.xA)(e),(0,ft.zc)(i.getUnit(this.opts.unit).format(t))}styleFunction(e,t,i,n){const s=[...this.shapeStyle],o=e.getGeometry();if(o){const a=o.getType();let l,h,c;if(!i||i===a)if(a==="Polygon"){const d=o;l=d.getInteriorPoint(),h=this.getMapMeasurement(o),c=new He.Z(d.getCoordinates()[0])}else a==="LineString"&&(c=o,l=new Mt.Z(c.getLastCoordinate()),h=this.getMapMeasurement(o));if(t&&c){let d=0;c.forEachSegment((u,g)=>{const f=new He.Z([u,g]),m=this.getMapMeasurement(f);this.segmentStyles.length-1<d&&this.segmentStyles.push(this.segmentStyle.clone());const p=new Mt.Z(f.getCoordinateAt(.5));this.segmentStyles[d].setGeometry(p),this.segmentStyles[d].getText().setText(m),s.push(this.segmentStyles[d]),d++})}h&&(this.labelStyle.setGeometry(l),this.labelStyle.getText().setText(h),s.push(this.labelStyle)),n&&a==="Point"&&!this.modify.getOverlay().getSource().getFeatures().length&&(this.tipPoint=o,this.tipStyle.getText().setText(n),s.push(this.tipStyle))}return s}addInteraction(e,t,i,n){const s=t,o=" Click to continue "+(s==="Polygon"?"polygon":"line")+` (double-click to end) `,a=" Click to start ";let l=a;this.draw=new Rl({source:this.getSource(),type:s,style:h=>this.styleFunction(h,i,s,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 bl=({map:r,menuActiveState:e})=>{const t=(0,_.useRef)(new Ur),i=Ll(fi.config.theme2),[n,s]=(0,_.useState)(!0),[o,a]=(0,_.useState)(!1),[l,h]=(0,_.useState)({action:qe[0].value,unit:qe[0].units[0].value}),c=(0,_.useMemo)(()=>{const f=qe.find(p=>p.value===l.action)??qe[0],m=f.getUnit(l.unit);return t.current.setOptions(l),{current:m,options:f.units}},[l]),d=!0,u=!1;function g(){if(a(!o),e(!o),o)r.removeInteraction(t.current.draw),t.current.setVisible(!1);else{n&&(s(!1),t.current.setZIndex(1),r.addLayer(t.current),r.addInteraction(t.current.modify)),t.current.setVisible(!0),r.removeInteraction(t.current.draw);const f=qe.find(m=>m.value===l.action)??qe[0];t.current.addInteraction(r,f.geometry,u,d)}}return _.createElement("div",{className:`${i.infoWrap} ${o?null:i.infoWrapClosed}`},o?_.createElement("div",null,_.createElement("div",{className:i.rowGroup},_.createElement(pn.S,{value:l.action,options:qe,size:"md",fullWidth:!1,onChange:f=>{r.removeInteraction(t.current.draw);const m=qe.find(v=>v.value===f)??qe[0],p=m.getUnit(l.unit);h({...l,action:m.value,unit:p.value}),t.current.addInteraction(r,m.geometry,u,d)}}),_.createElement(_n.zx,{className:i.button,icon:"times",variant:"secondary",size:"sm",onClick:g})),_.createElement(Ei.Ph,{className:i.unitSelect,value:c.current,options:c.options,isSearchable:!1,onChange:f=>{const m=qe.find(v=>v.value===l.action)??qe[0],p=m.getUnit(f.value)??m.units[0];h({...l,unit:p.value})}})):_.createElement(ns.h,{className:i.icon,name:"ruler-combined",tooltip:"show measure tools",tooltipPlacement:"left",onClick:g}))},Ll=(0,sr.B)(r=>({button:(0,te.css)` margin-left: auto; `,icon:(0,te.css)` background-color: ${r.colors.secondary.main}; display: inline-block; height: 19.25px; margin: 1px; width: 19.25px; `,infoWrap:(0,te.css)` color: ${r.colors.text}; background-color: ${r.colors.background.secondary}; border-radius: 4px; padding: 2px; `,infoWrapClosed:(0,te.css)` height: 25.25px; width: 25.25px; `,rowGroup:(0,te.css)` display: flex; justify-content: flex-end; `,unitSelect:(0,te.css)` min-width: 200px; `}));var Iu=S(31621),Ru=S(79366);function Fl(r){return(0,Ye.css)` .ol-scale-line { background: ${r.colors.border.weak}; // rgba(0,60,136,0.3); } .ol-scale-line-inner { border: 1px solid ${r.colors.text.primary}; // #eee; border-top: 0px; color: ${r.colors.text.primary}; // #eee; } .ol-control { background-color: ${r.colors.background.primary}; //rgba(255,255,255,0.4); } .ol-control:hover { background-color: ${r.colors.background.secondary}; // rgba(255,255,255,0.6); } .ol-control button { color: ${r.colors.secondary.text}; // white; background-color: ${r.colors.secondary.main}; // rgba(0,60,136,0.5); } .ol-control button:hover { color: ${r.colors.secondary.text}; background-color: ${r.colors.secondary.shade}; // rgba(0,60,136,0.5); } .ol-control button:focus { color: ${r.colors.secondary.text}; background-color: ${r.colors.secondary.main}; // rgba(0,60,136,0.5); } .ol-attribution ul { color: ${r.colors.text.primary}; // #000; text-shadow: none; } .ol-attribution:not(.ol-collapsed) { background-color: ${r.colors.background.secondary}; // rgba(255,255,255,0.8); } `}var Fn=S(37497),Ne=S(64167),St=S(83612);class en extends pt{constructor(e){super({}),this.location=e}update(e){this.clear(!0);const t=(0,St.g6)(e,this.location);if(!t.field){this.changed();return}for(let i=0;i<e.length;i++)this.addFeatureInternal(new Ke.Z({frame:e,rowIndex:i,geometry:t.field.values[i]}));this.changed()}updateLineString(e){this.clear(!0);const t=(0,St.g6)(e,this.location);if(!t.field){this.changed();return}const i=t.field,n=new He.Z(i.values.map(s=>s.getCoordinates()));this.addFeatureInternal(new Ke.Z({frame:e,rowIndex:0,geometry:n})),this.changed()}}var Mn=S(65217),Xr=S(45383),Vr=S(58192),Ml=S(11024),Pl=S(8747),Dl=S(50292),Al=S(55879);function Yr(r){const{layerName:e,styleConfig:t,layer:i}=r,n=(0,xe.wW)(Ol),s=(0,Mn.Z)(i?.__state?.mouseEvents??(0,Xr.of)(void 0)),o=t?.dims?.color?.field,a=(0,_.useMemo)(()=>{if(!o||!s)return;const f=s.getProperties();if(!f.frame)return;const p=f.rowIndex;return o.values[p]},[s,o]);if(!t)return _.createElement(_.Fragment,null);const{color:l,opacity:h}=t?.base??{},c=t?.config.symbol?.fixed;if(l&&c&&!o)return _.createElement("div",{className:n.infoWrap},_.createElement("div",{className:n.layerName},e),_.createElement("div",{className:(0,te.cx)(n.layerBody,n.fixedColorContainer)},_.createElement(Dl.V,{src:`public/${c}`,className:n.legendSymbol,title:"Symbol",style:{fill:l,opacity:h}})));if(!o)return _.createElement(_.Fragment,null);const d=(0,Vr.fD)(o);if(d.isContinuous&&d.getColors){const f=d.getColors(fi.config.theme2),m=(0,Ml.dz)(o),p=o.display?v=>(0,ft.zc)(o.display(v)):v=>`${v}`;return _.createElement("div",{className:n.infoWrap},_.createElement("div",{className:n.layerName},e),_.createElement("div",{className:(0,te.cx)(n.layerBody,n.colorScaleWrapper)},_.createElement(Pl.q,{hoverValue:a,colorPalette:f,min:m.min??0,max:m.max??100,display:p,useStopsPercentage:!1})))}const u=o?.config?.thresholds;if(!u||u.steps.length<2)return _.createElement("div",null);const g=(0,Al.Ur)(o.config,fi.config.theme2);return _.createElement("div",{className:n.infoWrap},_.createElement("div",{className:n.layerName},e),_.createElement("div",{className:(0,te.cx)(n.layerBody,n.legend)},g.map((f,m)=>_.createElement("div",{key:`${m}/${f.label}`,className:n.legendItem},_.createElement("i",{style:{background:f.color}}),f.label))))}const Ol=r=>({infoWrap:(0,te.css)` display: flex; flex-direction: column; background: ${r.colors.background.secondary}; border-radius: 1px; padding: ${r.spacing(1)}; border-bottom: 2px solid ${r.colors.border.strong}; min-width: 150px; `,layerName:(0,te.css)` font-size: ${r.typography.body.fontSize}; `,layerBody:(0,te.css)` padding-left: 10px; `,legend:(0,te.css)` line-height: 18px; display: flex; flex-direction: column; font-size: ${r.typography.bodySmall.fontSize}; padding: 5px 10px 0; i { width: 15px; height: 15px; float: left; margin-right: 8px; opacity: 0.7; border-radius: ${r.shape.radius.circle}; } `,legendItem:(0,te.css)` white-space: nowrap; `,fixedColorContainer:(0,te.css)` min-width: 80px; font-size: ${r.typography.bodySmall.fontSize}; padding-top: 5px; `,legendSymbol:(0,te.css)` height: 18px; width: 18px; margin: auto; `,colorScaleWrapper:(0,te.css)` min-width: 200px; font-size: ${r.typography.bodySmall.fontSize}; padding-top: 10px; `});class jr extends _.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 _.createElement(this.props.child,{...e})}}var Tt=S(71107),lt=S(48024),_t=S(22209),kl=S(53901),Bl=S(56025),Ss=S(64022),Ts=S(48570),Hr=S(79451),ii=S(78276),Pn=S(1553),X=S(11378),Kr=S(48154),Dn=S(25359),An=S(82382),zl=(r=>(r.circle="circle",r.square="square",r.triangle="triangle",r.star="star",r.cross="cross",r.x="x",r))(zl||{});const Fi={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 Mi(r){const e=r.opacity==null?.8:r.opacity;if(e===1)return new Se({color:r.color});if(e>0){const t=(0,de.Z)(r.color).setAlpha(e).toRgbString();return new Se({color:t})}}function Gl(r){const e=r.opacity==null?.8:r.opacity;if(e===1)return new Te({color:r.color,width:r.lineWidth??1});if(e>0){const t=(0,de.Z)(r.color).setAlpha(e).toRgbString();return new Te({color:t,width:r.lineWidth??1})}}const At=r=>{if(!r.text)return;const e=Xe.config.theme2.typography.fontFamily,t={...X.Er.textConfig,...r.textConfig};return new gi({text:r.text,fill:new Se({color:r.color??X.Er.color.fixed}),font:`normal ${t.fontSize}px ${e}`,...t})},Nl=r=>new fe({text:At(r)}),$r=r=>{const e=new Te({color:r.color,width:r.lineWidth??1});return new fe({image:new Ct({stroke:e,fill:Mi(r),radius:r.size??X.Cg}),text:At(r),stroke:e})},On=r=>new fe({fill:Mi(r),stroke:new Te({color:r.color,width:r.lineWidth??1}),text:At(r)}),Is=r=>new fe({fill:Mi(r),stroke:Gl(r),text:At(r)}),Jr=r=>{const e=r.size??X.Cg,t=new Te({color:"#F00",width:1});return[new fe({image:new $e({stroke:t,points:4,radius:e,angle:Math.PI/4})}),new fe({image:new $e({stroke:t,points:4,radius:e,radius2:0,angle:0})})]},Zl=[{id:"circle",name:"Circle",aliasIds:[Fi.circle],make:$r},{id:"square",name:"Square",aliasIds:[Fi.square],make:r=>{const e=r.size??X.Cg,t=r.rotation??0;return new fe({image:new $e({stroke:new Te({color:r.color,width:r.lineWidth??1}),fill:Mi(r),points:4,radius:e,rotation:t*Math.PI/180+Math.PI/4}),text:At(r)})}},{id:"triangle",name:"Triangle",aliasIds:[Fi.triangle],make:r=>{const e=r.size??X.Cg,t=r.rotation??0;return new fe({image:new $e({stroke:new Te({color:r.color,width:r.lineWidth??1}),fill:Mi(r),points:3,radius:e,rotation:t*Math.PI/180,angle:0}),text:At(r)})}},{id:"star",name:"Star",aliasIds:[Fi.star],make:r=>{const e=r.size??X.Cg,t=r.rotation??0;return new fe({image:new $e({stroke:new Te({color:r.color,width:r.lineWidth??1}),fill:Mi(r),points:5,radius:e,radius2:e*.4,angle:0,rotation:t*Math.PI/180}),text:At(r)})}},{id:"cross",name:"Cross",aliasIds:[Fi.cross],make:r=>{const e=r.size??X.Cg,t=r.rotation??0;return new fe({image:new $e({stroke:new Te({color:r.color,width:r.lineWidth??1}),points:4,radius:e,radius2:0,angle:0,rotation:t*Math.PI/180}),text:At(r)})}},{id:"x",name:"X",aliasIds:[Fi.x],make:r=>{const e=r.size??X.Cg,t=r.rotation??0;return new fe({image:new $e({stroke:new Te({color:r.color,width:r.lineWidth??1}),points:4,radius:e,radius2:0,rotation:t*Math.PI/180+Math.PI/4}),text:At(r)})}}];async function Wl(r,e){return fetch(r,{method:"GET"}).then(t=>t.text()).then(t=>{t=Kr.QX.sanitizeSVGContent(t);const s=new DOMParser().parseFromString(t,"image/svg+xml").getElementsByTagName("svg")[0];if(!s)return"";const o=e??100,a=s.getAttribute("width")??o,l=s.getAttribute("height")??o;s.setAttribute("fill","#fff"),s.setAttribute("width",`${a}px`),s.setAttribute("height",`${l}px`);const h=new XMLSerializer().serializeToString(s);return`data:image/svg+xml,${encodeURIComponent(h)}`}).catch(t=>(console.error(t),""))}const Rs=new Dn.B(()=>Zl);function Ul(r){const e=Rs.getIfExists(r);if(e?.aliasIds?.length)return e.aliasIds[0]}async function Xl(r,e){if(!r)return e?Nl:$r;let t=Rs.getIfExists(r);if(t)return t.make;if(r.endsWith(".svg")){const i=await Wl((0,An.getPublicOrAbsoluteUrl)(r));return t={id:r,name:r,aliasIds:[],make:i?n=>{const s=n.size??X.Cg,o=n.rotation??0;return[new fe({image:new vn({src:i,color:n.color,opacity:n.opacity??1,scale:(X.Cg+s)/100,rotation:o*Math.PI/180}),text:n?.text?At(n):void 0}),new fe({image:new $e({fill:new Se({color:"rgba(0,0,0,0)"}),points:4,radius:n.size,rotation:o*Math.PI/180+Math.PI/4})})]}:Jr},Rs.register(t),t.make}return Jr}function qr(r){const e=r?.text;return e?!!(e.mode===Ne.xy.Fixed&&e.fixed?.length||e.mode===Ne.xy.Field&&e.field?.length):!1}async function Ut(r){r||(r=X.Er);const e=qr(r),t={},i=await Xl(r.symbol?.fixed,e),n={config:r,hasText:e,fields:t,base:{color:Xe.config.theme2.visualization.getColorByName(r.color?.fixed??X.Er.color.fixed),opacity:r.opacity??X.Er.opacity,lineWidth:r.lineWidth??1,size:r.size?.fixed??X.Er.size.fixed,rotation:r.rotation?.fixed??X.Er.rotation.fixed},maker:i};return r.color?.field?.length&&(t.color=r.color.field),r.size?.field?.length&&(t.size=r.size.field),r.rotation?.field?.length&&(t.rotation=r.rotation.field),e&&(n.base.text=r.text?.fixed,n.base.textConfig=r.textConfig??X.Er.textConfig,r.text?.field?.length&&(t.text=r.text.field)),Object.keys(t).length||(n.fields=void 0),n}const ni=r=>{const{value:e,onChange:t,item:i}=r,n=(0,_.useMemo)(()=>i.settings?.frameMatcher?{...r.context,data:r.context.data.filter(i.settings.frameMatcher)}:r.context,[r.context,i.settings]),s=i.settings,o=T=>{t({...e,size:T})},a=T=>{t({...e,symbol:T})},l=T=>{t({...e,color:T})},h=T=>{t({...e,opacity:T})},c=T=>{t({...e,rotation:T})},d=T=>{t({...e,text:T})},u=T=>{t({...e,textConfig:{...e.textConfig,fontSize:T}})},g=T=>{t({...e,textConfig:{...e.textConfig,offsetX:T}})},f=T=>{t({...e,textConfig:{...e.textConfig,offsetY:T}})},m=T=>{t({...e,textConfig:{...e.textConfig,textAlign:T}})},p=T=>{t({...e,textConfig:{...e.textConfig,textBaseline:T}})},y=(0,Mn.Z)(s?.layerInfo??(0,Xr.of)())?.geometryType===X.bD.Point,w=qr(e);return s?.simpleFixedValues?_.createElement(_.Fragment,null,y&&_.createElement(_.Fragment,null,_.createElement(Tt.Z,null,_.createElement(lt._,{label:"Symbol"},_.createElement(ii.Lv,{value:e?.symbol??X.Er.symbol,context:n,onChange:a,item:{settings:{resourceType:"icon",folderName:Pn.QS.Marker,placeholderText:w?"Select a symbol":"Select a symbol or add a text label",placeholderValue:X.Er.symbol.fixed,showSourceRadio:!1}}}))),_.createElement(_t.g,{label:"Rotation angle"},_.createElement(ii.k9,{value:e?.rotation??X.Er.rotation,context:n,onChange:c,item:{settings:{min:X.Er.rotation.min,max:X.Er.rotation.max}}}))),_.createElement(Tt.Z,null,_.createElement(lt._,{label:"Color",labelWidth:10},_.createElement(kl.W,{width:4},_.createElement(Bl.zH,{color:e?.color?.fixed??X.Er.color.fixed,onChange:T=>{l({fixed:T})}})))),_.createElement(Tt.Z,null,_.createElement(lt._,{label:"Opacity",labelWidth:10,grow:!0},_.createElement(Hr.p,{value:e?.opacity??X.Er.opacity,context:n,onChange:h,item:{settings:{min:0,max:1,step:.1}}})))):_.createElement(_.Fragment,null,_.createElement(_t.g,{label:"Size"},_.createElement(ii.cL,{value:e?.size??X.Er.size,context:n,onChange:o,item:{settings:{min:1,max:100}}})),!s?.hideSymbol&&_.createElement(_t.g,{label:"Symbol"},_.createElement(ii.Lv,{value:e?.symbol??X.Er.symbol,context:n,onChange:a,item:{settings:{resourceType:Pn.DD.Icon,folderName:Pn.QS.Marker,placeholderText:w?"Select a symbol":"Select a symbol or add a text label",placeholderValue:X.Er.symbol.fixed,showSourceRadio:!1}}})),_.createElement(_t.g,{label:"Color"},_.createElement(ii.Lm,{value:e?.color??X.Er.color,context:n,onChange:l,item:{}})),_.createElement(_t.g,{label:"Fill opacity"},_.createElement(Hr.p,{value:e?.opacity??X.Er.opacity,context:n,onChange:h,item:{settings:{min:0,max:1,step:.1}}})),s?.displayRotation&&_.createElement(_t.g,{label:"Rotation angle"},_.createElement(ii.k9,{value:e?.rotation??X.Er.rotation,context:n,onChange:c,item:{settings:{min:X.Er.rotation.min,max:X.Er.rotation.max}}})),_.createElement(_t.g,{label:"Text label"},_.createElement(ii.$2,{value:e?.text??Pn.qj,context:n,onChange:d,item:{}})),w&&_.createElement(_.Fragment,null,_.createElement(Ss.Lh,null,_.createElement(_t.g,{label:"Font size"},_.createElement(Ts.w,{value:e?.textConfig?.fontSize??X.Er.textConfig.fontSize,context:n,onChange:u,item:{}})),_.createElement(_t.g,{label:"X offset"},_.createElement(Ts.w,{value:e?.textConfig?.offsetX??X.Er.textConfig.offsetX,context:n,onChange:g,item:{}})),_.createElement(_t.g,{label:"Y offset"},_.createElement(Ts.w,{value:e?.textConfig?.offsetY??X.Er.textConfig.offsetY,context:n,onChange:f,item:{}}))),_.createElement(_t.g,{label:"Align"},_.createElement(pn.S,{value:e?.textConfig?.textAlign??X.Er.textConfig.textAlign,onChange:m,options:[{value:X.H.Left,label:(0,E.capitalize)(X.H.Left)},{value:X.H.Center,label:(0,E.capitalize)(X.H.Center)},{value:X.H.Right,label:(0,E.capitalize)(X.H.Right)}]})),_.createElement(_t.g,{label:"Baseline"},_.createElement(pn.S,{value:e?.textConfig?.textBaseline??X.Er.textConfig.textBaseline,onChange:p,options:[{value:X.EQ.Top,label:(0,E.capitalize)(X.EQ.Top)},{value:X.EQ.Middle,label:(0,E.capitalize)(X.EQ.Middle)},{value:X.EQ.Bottom,label:(0,E.capitalize)(X.EQ.Bottom)}]}))))};var tt=S(42223);const tn={style:X.Er,showLegend:!0},bs="markers",Ls={type:bs,name:"",config:tn,location:{mode:Ne.q1.Auto},tooltip:!0},Vl={id:bs,name:"Markers",description:"Use markers to render each data point",isBaseMap:!1,showLocation:!0,hideOpacity:!0,create:async(r,e,t,i)=>{const n={...tn,...e?.config},s=await Ut(n.style),o=await(0,St.cJ)(e.location),a=new en(o),l=new Be({source:a}),h=new Fn.t(1);let c=null;return n.showLegend&&(c=_.createElement(jr,{watch:h,initialSubProps:{},child:Yr})),s.fields?l.setStyle(d=>{const u=d.get("rowIndex"),g=s.dims;if(!g||!(0,E.isNumber)(u))return s.maker(s.base);const f={...s.base};return g.color&&(f.color=g.color.get(u)),g.size&&(f.size=g.size.get(u)),g.text&&(f.text=g.text.get(u)),g.rotation&&(f.rotation=g.rotation.get(u)),s.maker(f)}):l.setStyle(s.maker(s.base)),{init:()=>l,legend:c,update:d=>{if(!d.series?.length){a.clear();return}for(const u of d.series){s.dims=(0,tt.vV)(u,s,i),c&&h.next({styleConfig:s,size:s.dims?.size,layerName:e.name,layer:l}),a.update(u);break}},registerOptionsUI:d=>{d.addCustomEditor({id:"config.style",path:"config.style",name:"Styles",editor:ni,settings:{displayRotation:!0},defaultValue:tn.style}).addBooleanSwitch({path:"config.showLegend",name:"Show legend",description:"Show map legend",defaultValue:tn.showLegend})}}},defaultOptions:tn};var _i=S(9232);const kn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Yl extends ar.Z{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(kn.PRELOAD)}setPreload(e){this.set(kn.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(kn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(kn.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}const jl=Yl;var ae=S(11719),Hl=S(43896);class Kl extends ur.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(ot.Z.CHANGE)}release(){this.state===ae.Z.ERROR&&this.setState(ae.Z.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let e=this.interimTile;do{if(e.getState()==ae.Z.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.Z.LOADED){e.interimTile=null;break}else e.getState()==ae.Z.LOADING?t=e:e.getState()==ae.Z.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.Z.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}load(){(0,J.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:(0,Hl.YQ)(n/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}}const Qr=Kl;class $l extends Qr{constructor(e,t,i,n,s,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_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=ae.Z.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=ae.Z.ERROR,this.unlistenImage_(),this.image_=Jl(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=ae.Z.LOADED:this.state=ae.Z.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==ae.Z.ERROR&&(this.state=ae.Z.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==ae.Z.IDLE&&(this.state=ae.Z.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=ds(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Jl(){const r=(0,ke.E4)(1,1);return r.fillStyle="rgba(0,0,0,0)",r.fillRect(0,0,1,1),r.canvas}const eo=$l,ql=.5,Ql=10,to=.25;class eh{constructor(e,t,i,n,s,o){this.sourceProj_=e,this.targetProj_=t;let a={};const l=(0,W.Ck)(this.targetProj_,this.sourceProj_);this.transformInv_=function(y){const w=y[0]+"/"+y[1];return a[w]||(a[w]=l(y)),a[w]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&(0,C.dz)(n)>=(0,C.dz)(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?(0,C.dz)(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?(0,C.dz)(this.targetProj_.getExtent()):null;const h=(0,C.rL)(i),c=(0,C.Xv)(i),d=(0,C.w$)(i),u=(0,C.hC)(i),g=this.transformInv_(h),f=this.transformInv_(c),m=this.transformInv_(d),p=this.transformInv_(u),v=Ql+(o?Math.max(0,Math.ceil(Math.log2((0,C.bg)(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,d,u,g,f,m,p,v),this.wrapsXInSource_){let y=1/0;this.triangles_.forEach(function(w,T,L){y=Math.min(y,w.source[0][0],w.source[1][0],w.source[2][0])}),this.triangles_.forEach(w=>{if(Math.max(w.source[0][0],w.source[1][0],w.source[2][0])-y>this.sourceWorldWidth_/2){const T=[[w.source[0][0],w.source[0][1]],[w.source[1][0],w.source[1][1]],[w.source[2][0],w.source[2][1]]];T[0][0]-y>this.sourceWorldWidth_/2&&(T[0][0]-=this.sourceWorldWidth_),T[1][0]-y>this.sourceWorldWidth_/2&&(T[1][0]-=this.sourceWorldWidth_),T[2][0]-y>this.sourceWorldWidth_/2&&(T[2][0]-=this.sourceWorldWidth_);const L=Math.min(T[0][0],T[1][0],T[2][0]);Math.max(T[0][0],T[1][0],T[2][0])-L<this.sourceWorldWidth_/2&&(w.source=T)}})}a={}}addTriangle_(e,t,i,n,s,o){this.triangles_.push({source:[n,s,o],target:[e,t,i]})}addQuad_(e,t,i,n,s,o,a,l,h){const c=(0,C.hI)([s,o,a,l]),d=this.sourceWorldWidth_?(0,C.dz)(c)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&d>.5&&d<1;let f=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const p=(0,C.hI)([e,t,i,n]);f=(0,C.dz)(p)/this.targetWorldWidth_>to||f}!g&&this.sourceProj_.isGlobal()&&d&&(f=d>to||f)}if(!f&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!(0,C.kK)(c,this.maxSourceExtent_))return;let m=0;if(!f&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)f=!0;else if(m=(!isFinite(s[0])||!isFinite(s[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(!f){const p=[(e[0]+i[0])/2,(e[1]+i[1])/2],v=this.transformInv_(p);let y;g?y=((0,_e.$W)(s[0],u)+(0,_e.$W)(a[0],u))/2-(0,_e.$W)(v[0],u):y=(s[0]+a[0])/2-v[0];const w=(s[1]+a[1])/2-v[1];f=y*y+w*w>this.errorThresholdSquared_}if(f){if(Math.abs(e[0]-i[0])<=Math.abs(e[1]-i[1])){const p=[(t[0]+i[0])/2,(t[1]+i[1])/2],v=this.transformInv_(p),y=[(n[0]+e[0])/2,(n[1]+e[1])/2],w=this.transformInv_(y);this.addQuad_(e,t,p,y,s,o,v,w,h-1),this.addQuad_(y,p,i,n,w,v,a,l,h-1)}else{const p=[(e[0]+t[0])/2,(e[1]+t[1])/2],v=this.transformInv_(p),y=[(i[0]+n[0])/2,(i[1]+n[1])/2],w=this.transformInv_(y);this.addQuad_(e,p,y,n,s,v,w,l,h-1),this.addQuad_(p,t,i,y,v,o,a,w,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,i,n,s,a,l),m&14||this.addTriangle_(e,i,t,s,a,o),m&&(m&13||this.addTriangle_(t,n,e,o,l,s),m&7||this.addTriangle_(t,n,i,o,l,a))}calculateSourceExtent(){const e=(0,C.lJ)();return this.triangles_.forEach(function(t,i,n){const s=t.source;(0,C.Wj)(e,s[0]),(0,C.Wj)(e,s[1]),(0,C.Wj)(e,s[2])}),e}getTriangles(){return this.triangles_}}const th=eh;let Fs;const Pi=[];function io(r,e,t,i,n){r.beginPath(),r.moveTo(0,0),r.lineTo(e,t),r.lineTo(i,n),r.closePath(),r.save(),r.clip(),r.fillRect(0,0,Math.max(e,i)+1,Math.max(t,n)),r.restore()}function Ms(r,e){return Math.abs(r[e*4]-210)>2||Math.abs(r[e*4+3]-.75*255)>2}function ih(){if(Fs===void 0){const r=(0,ke.E4)(6,6,Pi);r.globalCompositeOperation="lighter",r.fillStyle="rgba(210, 0, 0, 0.75)",io(r,4,5,4,0),io(r,4,5,0,5);const e=r.getImageData(0,0,3,3).data;Fs=Ms(e,0)||Ms(e,4)||Ms(e,8),(0,ke.jy)(r),Pi.push(r.canvas)}return Fs}function no(r,e,t,i){const n=(0,W.vs)(t,e,r);let s=(0,W._Q)(e,i,t);const o=e.getMetersPerUnit();o!==void 0&&(s*=o);const a=r.getMetersPerUnit();a!==void 0&&(s/=a);const l=r.getExtent();if(!l||(0,C.b8)(l,n)){const h=(0,W._Q)(r,s,n)/s;isFinite(h)&&h>0&&(s/=h)}return s}function nh(r,e,t,i){const n=(0,C.qg)(t);let s=no(r,e,n,i);return(!isFinite(s)||s<=0)&&(0,C.H6)(t,function(o){return s=no(r,e,o,i),isFinite(s)&&s>0}),s}function sh(r,e,t,i,n,s,o,a,l,h,c,d){const u=(0,ke.E4)(Math.round(t*r),Math.round(t*e),Pi);if(d||(u.imageSmoothingEnabled=!1),l.length===0)return u.canvas;u.scale(t,t);function g(T){return Math.round(T*t)/t}u.globalCompositeOperation="lighter";const f=(0,C.lJ)();l.forEach(function(T,L,P){(0,C.l7)(f,T.extent)});const m=(0,C.dz)(f),p=(0,C.Cr)(f),v=(0,ke.E4)(Math.round(t*m/i),Math.round(t*p/i),Pi);d||(v.imageSmoothingEnabled=!1);const y=t/i;l.forEach(function(T,L,P){const A=T.extent[0]-f[0],z=-(T.extent[3]-f[3]),H=(0,C.dz)(T.extent),K=(0,C.Cr)(T.extent);T.image.width>0&&T.image.height>0&&v.drawImage(T.image,h,h,T.image.width-2*h,T.image.height-2*h,A*y,z*y,H*y,K*y)});const w=(0,C.rL)(o);return a.getTriangles().forEach(function(T,L,P){const A=T.source,z=T.target;let H=A[0][0],K=A[0][1],le=A[1][0],he=A[1][1],Q=A[2][0],me=A[2][1];const re=g((z[0][0]-w[0])/s),Y=g(-(z[0][1]-w[1])/s),N=g((z[1][0]-w[0])/s),$=g(-(z[1][1]-w[1])/s),Ee=g((z[2][0]-w[0])/s),Ie=g(-(z[2][1]-w[1])/s),Ze=H,G=K;H=0,K=0,le-=Ze,he-=G,Q-=Ze,me-=G;const ht=[[le,he,0,0,N-re],[Q,me,0,0,Ee-re],[0,0,le,he,$-Y],[0,0,Q,me,Ie-Y]],Ce=(0,_e.SV)(ht);if(Ce){if(u.save(),u.beginPath(),ih()||!d){u.moveTo(N,$);const Le=4,ai=re-N,Bt=Y-$;for(let Ue=0;Ue<Le;Ue++)u.lineTo(N+g((Ue+1)*ai/Le),$+g(Ue*Bt/(Le-1))),Ue!=Le-1&&u.lineTo(N+g((Ue+1)*ai/Le),$+g((Ue+1)*Bt/(Le-1)));u.lineTo(Ee,Ie)}else u.moveTo(N,$),u.lineTo(re,Y),u.lineTo(Ee,Ie);u.clip(),u.transform(Ce[0],Ce[2],Ce[1],Ce[3],re,Y),u.translate(f[0]-Ze,f[3]-G),u.scale(i/t,-i/t),u.drawImage(v.canvas,0,0),u.restore()}}),(0,ke.jy)(v),Pi.push(v.canvas),c&&(u.save(),u.globalCompositeOperation="source-over",u.strokeStyle="black",u.lineWidth=1,a.getTriangles().forEach(function(T,L,P){const A=T.target,z=(A[0][0]-w[0])/s,H=-(A[0][1]-w[1])/s,K=(A[1][0]-w[0])/s,le=-(A[1][1]-w[1])/s,he=(A[2][0]-w[0])/s,Q=-(A[2][1]-w[1])/s;u.beginPath(),u.moveTo(K,le),u.lineTo(z,H),u.lineTo(he,Q),u.closePath(),u.stroke()}),u.restore()),u.canvas}class rh extends Qr{constructor(e,t,i,n,s,o,a,l,h,c,d,u){super(s,ae.Z.IDLE,{interpolate:!!u}),this.renderEdges_=d!==void 0?d:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=n,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const g=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const p=f?(0,C.Ed)(g,f):g;if((0,C.bg)(p)===0){this.state=ae.Z.EMPTY;return}const v=e.getExtent();v&&(m?m=(0,C.Ed)(m,v):m=v);const y=n.getResolution(this.wrappedTileCoord_[0]),w=nh(e,i,p,y);if(!isFinite(w)||w<=0){this.state=ae.Z.EMPTY;return}const T=c!==void 0?c:ql;if(this.triangulation_=new th(e,i,p,m,w*T,y),this.triangulation_.getTriangles().length===0){this.state=ae.Z.EMPTY;return}this.sourceZ_=t.getZForResolution(w);let L=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(L[1]=(0,_e.uZ)(L[1],m[1],m[3]),L[3]=(0,_e.uZ)(L[3],m[1],m[3])):L=(0,C.Ed)(L,m)),!(0,C.bg)(L))this.state=ae.Z.EMPTY;else{const P=t.getTileRangeForExtentAndZ(L,this.sourceZ_);for(let A=P.minX;A<=P.maxX;A++)for(let z=P.minY;z<=P.maxY;z++){const H=h(this.sourceZ_,A,z,a);H&&this.sourceTiles_.push(H)}this.sourceTiles_.length===0&&(this.state=ae.Z.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{t&&t.getState()==ae.Z.LOADED&&e.push({extent:this.sourceTileGrid_.getTileCoordExtent(t.tileCoord),image:t.getImage()})}),this.sourceTiles_.length=0,e.length===0)this.state=ae.Z.ERROR;else{const t=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(t),n=typeof i=="number"?i:i[0],s=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_=sh(n,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=ae.Z.LOADED}this.changed()}load(){if(this.state==ae.Z.IDLE){this.state=ae.Z.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(t=>{const i=t.getState();if(i==ae.Z.IDLE||i==ae.Z.LOADING){e++;const n=(0,Qe.oL)(t,ot.Z.CHANGE,function(s){const o=t.getState();(o==ae.Z.LOADED||o==ae.Z.ERROR||o==ae.Z.EMPTY)&&((0,Qe.bN)(n),e--,e===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(n)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t,i,n){t.getState()==ae.Z.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Qe.bN),this.sourcesListenerKeys_=null}release(){this.canvas_&&((0,ke.jy)(this.canvas_.getContext("2d")),Pi.push(this.canvas_),this.canvas_=null),super.release()}}const Ps=rh;class so{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 Di(r,e,t,i,n){return n!==void 0?(n.minX=r,n.maxX=e,n.minY=t,n.maxY=i,n):new so(r,e,t,i)}const ro=so;class oh extends Cr{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,C.lJ)(),this.tmpTileRange_=new ro(0,0,0,0)}isDrawableTile(e){const t=this.getLayer(),i=e.getState(),n=t.getUseInterimTilesOnError();return i==ae.Z.LOADED||i==ae.Z.EMPTY||i==ae.Z.ERROR&&!n}getTile(e,t,i,n){const s=n.pixelRatio,o=n.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(e,t,i,s,o);return h.getState()==ae.Z.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,q.nn)(t.pixelToCoordinateTransform,e.slice()),s=i.getExtent();if(s&&!(0,C.b8)(s,n))return null;const o=t.pixelRatio,a=t.viewState.projection,l=t.viewState,h=i.getRenderSource(),c=h.getTileGridForProjection(l.projection),d=h.getTilePixelRatio(t.pixelRatio);for(let u=c.getZForResolution(l.resolution);u>=c.getMinZoom();--u){const g=c.getTileCoordForCoordAndZ(n,u),f=h.getTile(u,g[1],g[2],o,a);if(!(f instanceof eo||f instanceof Ps)||f instanceof Ps&&f.getState()===ae.Z.EMPTY)return null;if(f.getState()!==ae.Z.LOADED)continue;const m=c.getOrigin(u),p=(0,at.Pq)(c.getTileSize(u)),v=c.getResolution(u),y=Math.floor(d*((n[0]-m[0])/v-g[1]*p[0])),w=Math.floor(d*((m[1]-n[1])/v-g[2]*p[1])),T=Math.round(d*h.getGutterForProjection(l.projection));return this.getImageData(f.getImage(),y+T,w+T)}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,s=n.projection,o=n.resolution,a=n.center,l=n.rotation,h=e.pixelRatio,c=this.getLayer(),d=c.getSource(),u=d.getRevision(),g=d.getTileGridForProjection(s),f=g.getZForResolution(o,d.zDirection),m=g.getResolution(f);let p=e.extent;const v=e.viewState.resolution,y=d.getTilePixelRatio(h),w=Math.round((0,C.dz)(p)/v*h),T=Math.round((0,C.Cr)(p)/v*h),L=i.extent&&(0,W.dY)(i.extent,s);L&&(p=(0,C.Ed)(p,(0,W.dY)(i.extent,s)));const P=m*w/2/y,A=m*T/2/y,z=[a[0]-P,a[1]-A,a[0]+P,a[1]+A],H=g.getTileRangeForExtentAndZ(p,f),K={};K[f]={};const le=this.createLoadedTileFinder(d,s,K),he=this.tmpExtent,Q=this.tmpTileRange_;this.newTiles_=!1;const me=l?(0,C.dY)(n.center,v,l,e.size):void 0;for(let ht=H.minX;ht<=H.maxX;++ht)for(let Ce=H.minY;Ce<=H.maxY;++Ce){if(l&&!g.tileCoordIntersectsViewport([f,ht,Ce],me))continue;const Le=this.getTile(f,ht,Ce,e);if(this.isDrawableTile(Le)){const Ue=(0,J.sq)(this);if(Le.getState()==ae.Z.LOADED){K[f][Le.tileCoord.toString()]=Le;let Vt=Le.inTransition(Ue);Vt&&i.opacity!==1&&(Le.endTransition(Ue),Vt=!1),!this.newTiles_&&(Vt||!this.renderedTiles.includes(Le))&&(this.newTiles_=!0)}if(Le.getAlpha(Ue,e.time)===1)continue}const ai=g.getTileCoordChildTileRange(Le.tileCoord,Q,he);let Bt=!1;ai&&(Bt=le(f+1,ai)),Bt||g.forEachTileCoordParentTileRange(Le.tileCoord,le,Q,he)}const re=m/o*h/y;(0,q.qC)(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/h,1/h,l,-w/2,-T/2);const Y=(0,q.BB)(this.pixelTransform);this.useContainer(t,Y,this.getBackground(e));const N=this.context,$=N.canvas;(0,q.nb)(this.inversePixelTransform,this.pixelTransform),(0,q.qC)(this.tempTransform,w/2,T/2,re,re,0,-w/2,-T/2),$.width!=w||$.height!=T?($.width=w,$.height=T):this.containerReused||N.clearRect(0,0,w,T),L&&this.clipUnrotated(N,e,L),d.getInterpolate()||(N.imageSmoothingEnabled=!1),this.preRender(N,e),this.renderedTiles.length=0;let Ee=Object.keys(K).map(Number);Ee.sort(et.j2);let Ie,Ze,G;i.opacity===1&&(!this.containerReused||d.getOpaque(e.viewState.projection))?Ee=Ee.reverse():(Ie=[],Ze=[]);for(let ht=Ee.length-1;ht>=0;--ht){const Ce=Ee[ht],Le=d.getTilePixelSize(Ce,h,s),Bt=g.getResolution(Ce)/m,Ue=Le[0]*Bt*re,Vt=Le[1]*Bt*re,Gi=g.getTileCoordForCoordAndZ((0,C.rL)(z),Ce),Kn=g.getTileCoordExtent(Gi),Ni=(0,q.nn)(this.tempTransform,[y*(Kn[0]-z[0])/m,y*(z[3]-Kn[3])/m]),$n=y*d.getGutterForProjection(s),li=K[Ce];for(const cn in li){const hi=li[cn],Jn=hi.tileCoord,qn=Gi[1]-Jn[1],Qn=Math.round(Ni[0]-(qn-1)*Ue),Zi=Gi[2]-Jn[2],er=Math.round(Ni[1]-(Zi-1)*Vt),nt=Math.round(Ni[0]-qn*Ue),vt=Math.round(Ni[1]-Zi*Vt),bt=Qn-nt,Yt=er-vt,Wi=f===Ce,vi=Wi&&hi.getAlpha((0,J.sq)(this),e.time)!==1;let ci=!1;if(!vi)if(Ie){G=[nt,vt,nt+bt,vt,nt+bt,vt+Yt,nt,vt+Yt];for(let Ui=0,es=Ie.length;Ui<es;++Ui)if(f!==Ce&&Ce<Ze[Ui]){const it=Ie[Ui];(0,C.kK)([nt,vt,nt+bt,vt+Yt],[it[0],it[3],it[4],it[7]])&&(ci||(N.save(),ci=!0),N.beginPath(),N.moveTo(G[0],G[1]),N.lineTo(G[2],G[3]),N.lineTo(G[4],G[5]),N.lineTo(G[6],G[7]),N.moveTo(it[6],it[7]),N.lineTo(it[4],it[5]),N.lineTo(it[2],it[3]),N.lineTo(it[0],it[1]),N.clip())}Ie.push(G),Ze.push(Ce)}else N.clearRect(nt,vt,bt,Yt);this.drawTileImage(hi,e,nt,vt,bt,Yt,$n,Wi),Ie&&!vi?(ci&&N.restore(),this.renderedTiles.unshift(hi)):this.renderedTiles.push(hi),this.updateUsedTiles(e.usedTiles,d,hi)}}return this.renderedRevision=u,this.renderedResolution=m,this.extentChanged=!this.renderedExtent_||!(0,C.fS)(this.renderedExtent_,z),this.renderedExtent_=z,this.renderedPixelRatio=h,this.renderedProjection=s,this.manageTilePyramid(e,d,g,h,s,p,f,c.getPreload()),this.scheduleExpireCache(e,d),this.postRender(N,e),i.extent&&N.restore(),N.imageSmoothingEnabled=!0,Y!==$.style.transform&&($.style.transform=Y),this.container}drawTileImage(e,t,i,n,s,o,a,l){const h=this.getTileImage(e);if(!h)return;const c=(0,J.sq)(this),d=t.layerStatesArray[t.layerIndex],u=d.opacity*(l?e.getAlpha(c,t.time):1),g=u!==this.context.globalAlpha;g&&(this.context.save(),this.context.globalAlpha=u),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,n,s,o),g&&this.context.restore(),u!==d.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,s,o){const a=(0,J.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,J.sq)(t);n in e||(e[n]={}),e[n][i.getKey()]=!0}manageTilePyramid(e,t,i,n,s,o,a,l,h){const c=(0,J.sq)(t);c in e.wantedTiles||(e.wantedTiles[c]={});const d=e.wantedTiles[c],u=e.tileQueue,g=i.getMinZoom(),f=e.viewState.rotation,m=f?(0,C.dY)(e.viewState.center,e.viewState.resolution,f,e.size):void 0;let p=0,v,y,w,T,L,P;for(P=g;P<=a;++P)for(y=i.getTileRangeForExtentAndZ(o,P,y),w=i.getResolution(P),T=y.minX;T<=y.maxX;++T)for(L=y.minY;L<=y.maxY;++L)f&&!i.tileCoordIntersectsViewport([P,T,L],m)||(a-P<=l?(++p,v=t.getTile(P,T,L,n,s),v.getState()==ae.Z.IDLE&&(d[v.getKey()]=!0,u.isKeyQueued(v.getKey())||u.enqueue([v,c,i.getTileCoordCenter(v.tileCoord),w])),h!==void 0&&h(v)):t.useTile(P,T,L,s));t.updateCacheSize(p,s)}}const ah=oh;class lh extends jl{constructor(e){super(e)}createRenderer(){return new ah(this)}}const Ds=lh;class hh{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,ue.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,ue.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,ue.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 ch=hh;function oo(r,e,t,i){return i!==void 0?(i[0]=r,i[1]=e,i[2]=t,i):[r,e,t]}function nn(r,e,t){return r+"/"+e+"/"+t}function ao(r){return nn(r[0],r[1],r[2])}function bu(r){const[e,t,i]=r.substring(r.lastIndexOf("/")+1,r.length).split(",").map(Number);return nn(e,t,i)}function uh(r){return r.split("/").map(Number)}function dh(r){return(r[1]<<r[0])+r[2]}function fh(r,e){const t=r[0],i=r[1],n=r[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const s=e.getFullTileRange(t);return s?s.containsXY(i,n):!0}class gh extends ch{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=uh(e)[0];this.forEach(n=>{n.tileCoord[0]!==i&&(this.remove(ao(n.tileCoord)),n.release())})}}const lo=gh,As={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var Os=S(16257),mh=S(61164);const Ai=[0,0,0],si=5;class ph{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,(0,ue.h)((0,et.pT)(this.resolutions_,function(n,s){return s-n},!0),17);let t;if(!e.origins){for(let n=0,s=this.resolutions_.length-1;n<s;++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,ue.h)(this.origins_.length==this.resolutions_.length,20));const i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=(0,C.rL)(i)),(0,ue.h)(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,(0,ue.h)(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:Os.S,(0,ue.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,s){const o=new ro(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,s);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 s=n.minX,o=n.maxX;s<=o;++s)for(let a=n.minY,l=n.maxY;a<=l;++a)i([t,s,a])}forEachTileCoordParentTileRange(e,t,i,n){let s,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),s=Di(o,o,a,a,i)):s=this.getTileRangeForExtentAndZ(l,h,i),t(h,s))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 s=e[1]*2,o=e[2]*2;return Di(s,s+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],s=e[1],o=e[2];if(t===n)return Di(s,o,s,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-n),h=Math.floor(s*l),c=Math.floor(o*l);if(t<n)return Di(h,h,c,c,i);const d=Math.floor(l*(s+1))-1,u=Math.floor(l*(o+1))-1;return Di(h,d,c,u,i)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,i)}getTileRangeForExtentAndZ(e,t,i){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Ai);const n=Ai[1],s=Ai[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Ai);const o=Ai[1],a=Ai[2];return Di(n,o,s,a,i)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),i=this.getResolution(e[0]),n=(0,at.Pq)(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]),s=(0,at.Pq)(this.getTileSize(e[0]),this.tmpSize_),o=i[0]+e[1]*s[0]*n,a=i[1]-(e[2]+1)*s[1]*n,l=o+s[0]*n,h=a+s[1]*n;return(0,C.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,s){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=(0,at.Pq)(this.getTileSize(o),this.tmpSize_);let c=a*(e-l[0])/i/h[0],d=a*(l[1]-t)/i/h[1];return n?(c=(0,_e.mD)(c,si)-1,d=(0,_e.mD)(d,si)-1):(c=(0,_e.GW)(c,si),d=(0,_e.GW)(d,si)),oo(o,c,d,s)}getTileCoordForXYAndZ_(e,t,i,n,s){const o=this.getOrigin(i),a=this.getResolution(i),l=(0,at.Pq)(this.getTileSize(i),this.tmpSize_);let h=(e-o[0])/a/l[0],c=(o[1]-t)/a/l[1];return n?(h=(0,_e.mD)(h,si)-1,c=(0,_e.mD)(c,si)-1):(h=(0,_e.GW)(h,si),c=(0,_e.GW)(c,si)),oo(i,h,c,s)}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,et.h7)(this.resolutions_,e,t||0);return(0,_e.uZ)(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return(0,mh.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 ho=ph;function co(r){let e=r.getDefaultTileGrid();return e||(e=vh(r),r.setDefaultTileGrid(e)),e}function _h(r,e,t){const i=e[0],n=r.getTileCoordCenter(e),s=ks(t);if(!(0,C.b8)(s,n)){const o=(0,C.dz)(s),a=Math.ceil((s[0]-n[0])/o);return n[0]+=o*a,r.getTileCoordForCoordAndZ(n,i)}return e}function xh(r,e,t,i){i=i!==void 0?i:"top-left";const n=uo(r,e,t);return new ho({extent:r,origin:(0,C.g0)(r,i),resolutions:n,tileSize:t})}function yh(r){const e=r||{},t=e.extent||(0,W.U2)("EPSG:3857").getExtent(),i={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:uo(t,e.maxZoom,e.tileSize,e.maxResolution)};return new ho(i)}function uo(r,e,t,i){e=e!==void 0?e:Os.e,t=(0,at.Pq)(t!==void 0?t:Os.S);const n=(0,C.Cr)(r),s=(0,C.dz)(r);i=i>0?i:Math.max(s/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 vh(r,e,t,i){const n=ks(r);return xh(n,e,t,i)}function ks(r){r=(0,W.U2)(r);let e=r.getExtent();if(!e){const t=180*W.Wm.degrees/r.getMetersPerUnit();e=(0,C.T9)(-t,-t,t,t)}return e}class Eh extends Mr{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&&(0,at.Pq)(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tileCache=new lo(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 s=this.getTileCacheForProjection(e);if(!s)return!1;let o=!0,a,l,h;for(let c=i.minX;c<=i.maxX;++c)for(let d=i.minY;d<=i.maxY;++d)l=nn(t,c,d),h=!1,s.containsKey(l)&&(a=s.get(l),h=a.getState()===ae.Z.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(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,i,n,s){return(0,J.O3)()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:co(e)}getTileCacheForProjection(e){const t=this.getProjection();return(0,ue.h)(t===null||(0,W.OP)(t,e),68),this.tileCache}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,i){const n=this.getTileGridForProjection(i),s=this.getTilePixelRatio(t),o=(0,at.Pq)(n.getTileSize(e),this.tmpSize);return s==1?o:(0,at.bA)(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){t=t!==void 0?t:this.getProjection();const i=this.getTileGridForProjection(t);return this.getWrapX()&&t.isGlobal()&&(e=_h(i,e,t)),fh(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 wh extends yn.ZP{constructor(e,t){super(e),this.tile=t}}const Ch=Eh;function Sh(r,e){const t=/\{z\}/g,i=/\{x\}/g,n=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){if(o)return r.replace(t,o[0].toString()).replace(i,o[1].toString()).replace(n,o[2].toString()).replace(s,function(){const h=o[0],c=e.getFullTileRange(h);return(0,ue.h)(c,55),(c.getHeight()-o[2]-1).toString()})}}function Th(r,e){const t=r.length,i=new Array(t);for(let n=0;n<t;++n)i[n]=Sh(r[n],e);return Ih(i)}function Ih(r){return r.length===1?r[0]:function(e,t,i){if(!e)return;const n=dh(e),s=(0,_e.$W)(n,r.length);return r[s](e,t,i)}}function Lu(r,e,t){}function Rh(r){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(r);if(t){const i=t[1].charCodeAt(0),n=t[2].charCodeAt(0);let s;for(s=i;s<=n;++s)e.push(r.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(r),t){const i=parseInt(t[2],10);for(let n=parseInt(t[1],10);n<=i;n++)e.push(r.replace(t[0],n.toString()));return e}return e.push(r),e}class Bs extends Ch{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===Bs.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,J.sq)(t),n=t.getState();let s;n==ae.Z.LOADING?(this.tileLoadingKeys_[i]=!0,s=As.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=n==ae.Z.ERROR?As.TILELOADERROR:n==ae.Z.LOADED?As.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new wh(s,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=Rh(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(` `);this.generateTileUrlFunction_?this.setTileUrlFunction(Th(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,i){}useTile(e,t,i){const n=nn(e,t,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}const bh=Bs;class Lh extends bh{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:Fh,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:eo,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 s=this.tileCacheForProjection[n];s.expireCache(s==i?t:{})}}getGutterForProjection(e){return this.getProjection()&&e&&!(0,W.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,W.OP)(this.getProjection(),e)?!1:super.getOpaque(e)}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||(0,W.OP)(t,e)))return this.tileGrid;const i=(0,J.sq)(e);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=co(e)),this.tileGridForProjection[i]}getTileCacheForProjection(e){const t=this.getProjection();if(!t||(0,W.OP)(t,e))return this.tileCache;const i=(0,J.sq)(e);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new lo(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(e,t,i,n,s,o){const a=[e,t,i],l=this.getTileCoordForTileUrlFunction(a,s),h=l?this.tileUrlFunction(l,n,s):void 0,c=new this.tileClass(a,h!==void 0?ae.Z.IDLE:ae.Z.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(ot.Z.CHANGE,this.handleTileChange.bind(this)),c}getTile(e,t,i,n,s){const o=this.getProjection();if(!o||!s||(0,W.OP)(o,s))return this.getTileInternal(e,t,i,n,o||s);const a=this.getTileCacheForProjection(s),l=[e,t,i];let h;const c=ao(l);a.containsKey(c)&&(h=a.get(c));const d=this.getKey();if(h&&h.key==d)return h;const u=this.getTileGridForProjection(o),g=this.getTileGridForProjection(s),f=this.getTileCoordForTileUrlFunction(l,s),m=new Ps(o,u,s,g,l,f,this.getTilePixelRatio(n),this.getGutter(),(p,v,y,w)=>this.getTileInternal(p,v,y,w,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return m.key=d,h?(m.interimTile=h,m.refreshInterimChain(),a.replace(c,m)):a.set(c,m),m}getTileInternal(e,t,i,n,s){let o=null;const a=nn(e,t,i),l=this.getKey();if(!this.tileCache.containsKey(a))o=this.createTile_(e,t,i,n,s,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,s,l),h.getState()==ae.Z.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,W.U2)(e);if(i){const n=(0,J.sq)(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=t)}}clear(){super.clear();for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear()}}function Fh(r,e){r.getImage().src=e}const Mh=Lh;class Ph extends Mh{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:yh({extent:ks(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 zs=Ph;var Dh=(r=>(r.Auto="auto",r.Light="light",r.Dark="dark",r))(Dh||{});const Bn={theme:"auto",showLabels:!0},fo={id:"carto",name:"CARTO basemap",description:"Add layer CARTO Raster basemaps",isBaseMap:!0,defaultOptions:Bn,create:async(r,e,t,i)=>({init:()=>{const n={...Bn,...e.config};let s=n.theme;return(!s||s==="auto")&&(s=i.isDark?"dark":"light"),n.showLabels?s+="_all":s+="_nolabels",new Ds({source:new zs({attributions:'<a href="https://carto.com/attribution/">\xA9 CARTO</a>',url:`https://{1-4}.basemaps.cartocdn.com/${s}/{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:Bn.theme}).addBooleanSwitch({path:"config.showLabels",name:"Show labels",description:"",defaultValue:Bn.showLabels})}})},Ah=[fo],go="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",Oi={url:go+"/tile/{z}/{y}/{x}",attribution:`Tiles \xA9 <a href="${go}">ArcGIS</a>`},mo={id:"xyz",name:"XYZ Tile layer",description:"Add map from a generic tile layer",isBaseMap:!0,create:async(r,e,t,i)=>({init:()=>{const n={...e.config};return n.url||(n.url=Oi.url,n.attribution=n.attribution??Oi.attribution),new Ds({source:new zs({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:Oi.url}}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:Oi.attribution}})}})},Oh=[mo],zn="custom",Gs="streets",po=new Dn.B(()=>[{id:Gs,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:zn,name:"Custom MapServer",description:"Use a custom MapServer with pre-cached values",slug:""}]),kh=[{id:"esri-xyz",name:"ArcGIS MapServer",description:"Add layer from an ESRI ArcGIS MapServer",isBaseMap:!0,create:async(r,e,t,i)=>{const n={...e.config},s=po.getIfExists(n.server??Gs);if(s.id!==zn){const a="https://services.arcgisonline.com/ArcGIS/rest/services/";n.url=`${a}${s.slug}/MapServer/tile/{z}/{y}/{x}`,n.attribution=`Tiles \xA9 <a href="${a}${s.slug}/MapServer">ArcGIS</a>`}const o={...e,config:n};return mo.create(r,o,t,i).then(a=>(a.registerOptionsUI=l=>{l.addSelect({path:"config.server",name:"Server instance",settings:{options:po.selectOptions().options}}).addTextInput({path:"config.url",name:"URL template",description:"Must include {x}, {y} or {-y}, and {z} placeholders",settings:{placeholder:Oi.url},showIf:h=>h.config?.server===zn}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:Oi.attribution},showIf:h=>h.config?.server===zn})},a))},defaultOptions:{server:Gs}}],Bh='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class zh extends zs{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[Bh];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 Gh=zh,Ns=[...[{id:"osm-standard",name:"Open Street Map",description:"Add map from a collaborative free geographic world database",isBaseMap:!0,create:async(r,e,t)=>({init:()=>new Ds({source:new Gh})})}],...Ah,...kh,...Oh];var Gn=S(35041),Ot=class extends pt{constructor(e){e=e||{},e.strategy=Pr,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 s=357.528+.9856003*i;s%=360;var o=n+1.915*Math.sin(s*t)+.02*Math.sin(2*s*t),a=1.00014-.01671*Math.cos(s*t)-.0014*Math.cos(2*s*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,s=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(s/90)*90;return s=s+(a-l),{alpha:s,delta:o}}static getNightLat(e,t){var i=180/Math.PI,n=Math.PI/180,s=t?new Date(t):new Date,o=s/864e5+24405875e-1,a=(18.697374558+24.06570982441908*(o-2451545))%24,l=Ot._sunEclipticPosition(o),h=Ot._eclipticObliquity(o),c=Ot._sunEquatorialPosition(l.lambda,h),d=a*15+e-c.alpha,u=Math.atan(-Math.cos(d*n)/Math.tan(c.delta*n))*i;return u}_loader(e,t,i){var n=this.getCoordinates(this.get("time")),s=new Wt.ZP([n]);s.transform("EPSG:4326",i),this.addFeature(new Ke.Z(s))}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,s=Ot._sunEclipticPosition(i),o=Ot._eclipticObliquity(i),a=Ot._sunEquatorialPosition(s.lambda,o);return[a.alpha-n*15,a.delta]}getCoordinates(e,t){for(var i=180/Math.PI,n=Math.PI/180,s=e?new Date(e):new Date,o=s/864e5+24405875e-1,a=(18.697374558+24.06570982441908*(o-2451545))%24,l=[],h=Ot._sunEclipticPosition(o),c=Ot._eclipticObliquity(o),d=Ot._sunEquatorialPosition(h.lambda,c),u=this.get("step")||1,g=-180;g<=180;g+=u){var f=g,m=a*15+f-d.alpha,p=Math.atan(-Math.cos(m*n)/Math.tan(d.delta*n))*i;l.push([f,p])}switch(t){case"line":break;case"day":d.delta*=-1;default:{p=d.delta<0?90:-90;for(var v=180;v>=-180;v-=u)l.push([v,p]);l.push(l[0]);break}}if(t==="daynight"){var y=[];l.forEach(function(w){y.push(w.slice())}),y[0][1]=-y[0][1],y[y.length-1][1]=-y[0][1],y[y.length-1][1]=-y[0][1],l=[l,y]}return l}};const _o=Ot;var Nh=(r=>(r.From="from",r.To="to",r))(Nh||{});const xi={show:"to",sun:!1,nightColor:"#a7a6ba4D"},xo="dayNight",Du={type:xo,name:"",config:xi,tooltip:!0},Zh={id:xo,name:"Night / Day",description:"Show day and night regions",isBaseMap:!1,create:async(r,e,t,i)=>{const n={...xi,...e?.config},s=new _o({}),o=Object.getPrototypeOf(s),a=new _o({}),l=Object.getPrototypeOf(a),h=new Be({source:s,style:new fe({fill:new Se({color:i.visualization.getColorByName(n.nightColor)})})}),c=new Be({source:new pt({features:[]}),style:new fe({stroke:new Te({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),d=new Ke.Z({geometry:new Mt.Z([])}),u=new Be({source:new pt({features:[d]}),style:new fe({image:new Ct({radius:13,fill:new Se({color:"rgb(253,184,19)"})})})}),g=new Ke.Z({geometry:new Mt.Z([])}),f=new fe({image:new Ct({radius:13,stroke:new Te({color:"rgb(253,184,19)",width:1.5})})}),m=new fe({image:new Ct({radius:15,stroke:new Te({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),p=new Be({source:new pt({features:[g]}),style:[m,f]}),v=new Gn.Z({layers:n.sun?[h,u,p,c]:[h,c]}),y=new j.w0;return{init:()=>v,dispose:()=>y.unsubscribe(),update:w=>{const T=new Date(w.timeRange.from.valueOf()),L=new Date(w.timeRange.to.valueOf());let P=new Date,A=[];n.show==="from"?P=T:P=L,s.setTime(P),n.sun&&(A=o.getSunPosition(P),d.getGeometry()?.setCoordinates((0,W.mi)(A)))},registerOptionsUI:w=>{e.config?.nightColor||(e.config={...xi,...e.config}),w.addRadio({path:"config.show",name:"Show",settings:{options:[{label:"From",value:"from"},{label:"To",value:"to"}]},defaultValue:xi.show}),w.addColorPicker({path:"config.nightColor",name:"Night region color",description:"Pick color of night region",defaultValue:xi.nightColor,settings:[{enableNamedColors:!1}]}),w.addBooleanSwitch({path:"config.sun",name:"Display sun",description:"Show the sun",defaultValue:xi.sun})}}},defaultOptions:xi};var yo=S(7954),vo=S(775),Eo=S(39343),Wh=S(35918);const wo=(r,e)=>{const t=e.get(r.property);return(0,Wh.f)(t,r.operation,r.value)};function Co(r){const e=new Set,t=new Set;r.some((n,s)=>{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 s>10});let i=X.bD.Any;if(e.size===1)switch(e.values().next().value){case"Point":case"MultiPoint":i=X.bD.Point;break;case"Line":case"MultiLine":i=X.bD.Line;break;case"Polygon":i=X.bD.Polygon}return{geometryType:i,propertes:Array.from(t.keys()).map(n=>({label:n,value:n}))}}function Uh(r,e){const t=new Set;for(const n of r){const s=n.get(e);s!=null&&t.add(`${s}`)}const i=Array.from(t);return i.sort(),i}const sn={src:"public/maps/countries.geojson",rules:[],style:X.Er,dataStyle:{}},Au={style:X.Er,check:{property:"",operation:Ne.Bd.EQ,value:""}},Xh={id:"dynamic-geojson",name:"Dynamic GeoJSON",description:"Style a geojson file based on query results",isBaseMap:!1,state:_i.BV.alpha,create:async(r,e,t,i)=>{const n={...sn,...e.config},s=new pt({url:n.src,format:new yo.Z}),o=new Fn.t,a=s.on("change",()=>{s.getState()==="ready"&&((0,ps.B)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const u of n.rules)if(u.style){const g=await Ut(u.style);l.push({state:g,rule:u.check})}}{const u=await Ut(n.style);l.push({state:u})}const h=await Ut(n.style),c=new Map,d=new Be({source:s,style:u=>{const g=c.get(u.getId()),f=h.dims;if(g&&f)return new fe({fill:new Se({color:f.color?.get(g)}),stroke:new Te({color:h.base.color,width:h.base.lineWidth??1})});const m=u.getGeometry()?.getType()==="Point";for(const p of l)if(!(p.rule&&!wo(p.rule,u))){if(p.state.fields){const v={...p.state.base},{text:y}=p.state.fields;return y&&(v.text=`${u.get(y)}`),m?p.state.maker(v):On(v)}return m?(p.point||(p.point=p.state.maker(p.state.base)),p.point):(p.poly||(p.poly=On(p.state.base)),p.poly)}}});return{init:()=>d,update:u=>{const g=u.series[0];if(g){const f=(0,An.findField)(g,n.idField);f&&(c.clear(),f.values.forEach((m,p)=>c.set(m,p))),h.dims=(0,tt.vV)(g,h,i,n.dataStyle)}d.changed()},registerOptionsUI:u=>{const g=o.pipe((0,vo.P)(),(0,Eo.U)(f=>Co(f)));u.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,tt.B1)()??[],allowCustomValue:!0},defaultValue:sn.src}).addFieldNamePicker({path:"config.idField",name:"ID Field"}).addCustomEditor({id:"config.dataStyle",path:"config.dataStyle",name:"Data style",editor:ni,settings:{displayRotation:!1},defaultValue:sn.dataStyle}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:ni,settings:{simpleFixedValues:!0,layerInfo:g},defaultValue:sn.style})}}},defaultOptions:sn};var So=S(45346),rn=S(55093);function To(r,e){if(r&&!e){const i={label:`${r}`,value:r};return{options:[i],current:i}}e||(e=[]);let t=e.find(i=>i.value===r);return r&&!t&&(t={label:`${r} (not found)`,value:r},e.push(t)),{options:e,current:t}}const Vh=({value:r,onChange:e,item:t,context:i})=>{const n=t.settings,{features:s,layerInfo:o}=n,a=(0,Mn.Z)(o),l=(0,Mn.Z)(s),h=(0,_.useMemo)(()=>{const L=r?.check?.property;return L&&l&&r.check?.operation===Ne.Bd.EQ?Uh(l,L).map(P=>{let A;return!isNaN(Number(P))?A={value:Number(P),label:P}:A={value:P,label:P},A}):[]},[l,r]),c=(0,xe.wW)(Yh),d=10,u=(0,_.useCallback)(L=>{e({...r,check:{...r.check,property:L?.value}})},[e,r]),g=(0,_.useCallback)(L=>{e({...r,check:{...r.check,operation:L.value??Ne.Bd.EQ}})},[e,r]),f=(0,_.useCallback)(L=>{e({...r,check:{...r.check,value:L?.value}})},[e,r]),m=(0,_.useCallback)(L=>{e({...r,check:{...r.check,value:L}})},[e,r]),p=(0,_.useCallback)(L=>{e({...r,style:L})},[e,r]),v=(0,_.useCallback)(()=>{e(void 0)},[e]),y=r.check??Io.check,w=To(y.property,a?.propertes),T=To(y.value,h);return _.createElement("div",{className:c.rule},_.createElement(Tt.Z,{className:c.row},_.createElement(lt._,{label:"Rule",labelWidth:d,grow:!0},_.createElement(Ei.Ph,{placeholder:"Feature property",value:w.current,options:w.options,onChange:u,"aria-label":"Feature property",isClearable:!0,allowCustomValue:!0})),_.createElement(lt._,{className:c.inline},_.createElement(Ei.Ph,{value:So.J8.find(L=>L.value===y.operation),options:So.J8,onChange:g,"aria-label":"Comparison operator",width:8})),_.createElement(lt._,{className:c.inline,grow:!0},_.createElement("div",{className:c.flexRow},(y.operation===Ne.Bd.EQ||y.operation===Ne.Bd.NEQ)&&_.createElement(Ei.Ph,{placeholder:"value",value:T.current,options:T.options,onChange:f,"aria-label":"Comparison value",isClearable:!0,allowCustomValue:!0}),y.operation!==Ne.Bd.EQ&&_.createElement(rn.Y,{key:`${y.property}/${y.operation}`,value:isNaN(Number(y.value))?0:Number(y.value),placeholder:"numeric value",onChange:m}))),_.createElement(_n.zx,{size:"md",icon:"trash-alt",onClick:()=>v(),variant:"secondary","aria-label":"Delete style rule",className:c.button})),_.createElement("div",null,_.createElement(ni,{value:r.style??X.Er,context:i,onChange:p,item:{settings:{simpleFixedValues:!0,layerInfo:o}}})))},Yh=r=>({rule:(0,te.css)` margin-bottom: ${r.spacing(1)}; `,row:(0,te.css)` display: flex; margin-bottom: 4px; `,inline:(0,te.css)` margin-bottom: 0; margin-left: 4px; `,button:(0,te.css)` margin-left: 4px; `,flexRow:(0,te.css)` display: flex; flex-direction: row; align-items: flex-start; `}),jh=({value:r,onChange:e,context:t,item:i})=>{const n=(0,xe.l4)(),s=i.settings,o=(0,_.useCallback)(()=>{const{palette:h}=n.visualization,c={fixed:h[Math.floor(Math.random()*h.length)]},d=[...r,{...Io,style:{...X.Er,color:c}}];e(d)},[e,r,n.visualization]),a=(0,_.useCallback)(h=>c=>{const d=[...r];c?d[h]=c:d.splice(h,1),e(d)},[e,r]),l=r&&r.map((h,c)=>{const d={settings:s};return _.createElement(Vh,{value:h,onChange:a(c),context:t,item:d,key:`${c}-${h.check?.property}`})});return _.createElement(_.Fragment,null,l,_.createElement(_n.zx,{size:"sm",icon:"plus",onClick:o,variant:"secondary","aria-label":"Add geomap style rule"},"Add style rule"))},Nn={src:"public/maps/countries.geojson",rules:[],style:X.Er},Io={style:X.Er,check:{property:"",operation:Ne.Bd.EQ,value:""}},Hh={id:"geojson",name:"GeoJSON",description:"Load static data from a geojson file",isBaseMap:!1,create:async(r,e,t,i)=>{const n={...Nn,...e.config},s=new pt({url:n.src,format:new yo.Z}),o=new Fn.t,a=s.on("change",()=>{s.getState()==="ready"&&((0,ps.B)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const c of n.rules)if(c.style){const d=await Ut(c.style);l.push({state:d,rule:c.check})}}{const c=await Ut(n.style);l.push({state:c})}const h=new Be({source:s,style:c=>{const d=c.getGeometry()?.getType()==="Point";for(const u of l)if(!(u.rule&&!wo(u.rule,c))){if(u.state.fields){const g={...u.state.base},{text:f}=u.state.fields;return f&&(g.text=`${c.get(f)}`),d?u.state.maker(g):On(g)}return d?(u.point||(u.point=u.state.maker(u.state.base)),u.point):(u.poly||(u.poly=On(u.state.base)),u.poly)}}});return{init:()=>h,registerOptionsUI:c=>{const d=o.pipe((0,vo.P)(),(0,Eo.U)(u=>Co(u)));c.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,tt.B1)()??[],allowCustomValue:!0},defaultValue:Nn.src}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:ni,settings:{simpleFixedValues:!0,layerInfo:d},defaultValue:Nn.style}).addCustomEditor({id:"config.rules",path:"config.rules",name:"Style rules",description:"Apply styles based on feature properties",editor:jh,settings:{features:o,layerInfo:d},defaultValue:[]})}}},defaultOptions:Nn},Zn=34962,Zs=34963,Kh=35040,$h=35044,Wn=35048,Jh=5121,qh=5123,Qh=5125,Ro=5126,bo=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Ws(r,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!fr.ME},e);const t=bo.length;for(let i=0;i<t;++i)try{const n=r.getContext(bo[i],e);if(n)return n}catch{}return null}let Us;function Ou(){if(!Us){const r=document.createElement("canvas"),e=Ws(r);e&&(Us=e.getSupportedExtensions())}return Us}const ec={STATIC_DRAW:$h,STREAM_DRAW:Kh,DYNAMIC_DRAW:Wn};class tc{constructor(e,t){this.array=null,this.type=e,(0,ue.h)(e===Zn||e===Zs,62),this.usage=t!==void 0?t:ec.STATIC_DRAW}ofSize(e){return this.array=new(Xs(this.type))(e),this}fromArray(e){return this.array=Xs(this.type).from(e),this}fromArrayBuffer(e){return this.array=new(Xs(this.type))(e),this}getType(){return this.type}getArray(){return this.array}getUsage(){return this.usage}getSize(){return this.array?this.array.length:0}}function Xs(r){switch(r){case Zn:return Float32Array;case Zs:return Uint32Array;default:return Float32Array}}const Vs=tc;var ic=S(50966);const Un={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"};var nc=S(78555);const sc=` 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); } `,rc=` 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 oc{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||sc),t.compileShader(i);const n=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(n,e.fragmentShader||rc),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 s=[-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(s),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(o=>{this.uniforms_.push({value:e.uniforms[o],location:t.getUniformLocation(this.renderTargetProgram_,o)})})}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,s=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,s,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 s=this.getGL(),o=e.size;if(s.bindFramebuffer(s.FRAMEBUFFER,t?t.getFrameBuffer():null),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.renderTargetTexture_),!t){const l=(0,J.sq)(s.canvas);if(!e.renderTargets[l]){const h=s.getContextAttributes();h&&h.preserveDrawingBuffer&&(s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT)),e.renderTargets[l]=!0}}s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.viewport(0,0,s.drawingBufferWidth,s.drawingBufferHeight),s.bindBuffer(s.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),s.useProgram(this.renderTargetProgram_),s.enableVertexAttribArray(this.renderTargetAttribLocation_),s.vertexAttribPointer(this.renderTargetAttribLocation_,2,s.FLOAT,!1,0,0),s.uniform2f(this.renderTargetUniformLocation_,o[0],o[1]),s.uniform1i(this.renderTargetTextureLocation_,0);const a=e.layerStatesArray[e.layerIndex].opacity;s.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(e),i&&i(s,e),s.drawArrays(s.TRIANGLES,0,6),n&&n(s,e)}getFrameBuffer(){return this.frameBuffer_}applyUniforms(e){const t=this.getGL();let i,n=1;this.uniforms_.forEach(function(s){if(i=typeof s.value=="function"?s.value(e):s.value,i instanceof HTMLCanvasElement||i instanceof ImageData)s.texture||(s.texture=t.createTexture()),t.activeTexture(t[`TEXTURE${n}`]),t.bindTexture(t.TEXTURE_2D,s.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(s.location,n++);else if(Array.isArray(i))switch(i.length){case 2:t.uniform2f(s.location,i[0],i[1]);return;case 3:t.uniform3f(s.location,i[0],i[1],i[2]);return;case 4:t.uniform4f(s.location,i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&t.uniform1f(s.location,i)})}}const Lo=oc;function ac(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ys(r,e){return r[0]=e[0],r[1]=e[1],r[4]=e[2],r[5]=e[3],r[12]=e[4],r[13]=e[5],r}const ku={FRAGMENT_SHADER:35632,VERTEX_SHADER:35633},ri={PROJECTION_MATRIX:"u_projectionMatrix",OFFSET_SCALE_MATRIX:"u_offsetScaleMatrix",OFFSET_ROTATION_MATRIX:"u_offsetRotateMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio"},It={UNSIGNED_BYTE:Jh,UNSIGNED_SHORT:qh,UNSIGNED_INT:Qh,FLOAT:Ro},Xn={};function Fo(r){return"shared/"+r}let Mo=0;function lc(){const r="unique/"+Mo;return Mo+=1,r}function hc(r){let e=Xn[r];if(!e){const t=document.createElement("canvas");t.style.position="absolute",t.style.left="0",e={users:0,canvas:t},Xn[r]=e}return e.users+=1,e.canvas}function cc(r){const e=Xn[r];if(!e||(e.users-=1,e.users>0))return;const t=e.canvas,n=Ws(t).getExtension("WEBGL_lose_context");n&&n.loseContext(),delete Xn[r]}class uc extends nc.Z{constructor(e){super(),e=e||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=e.canvasCacheKey?Fo(e.canvasCacheKey):lc(),this.canvas_=hc(this.canvasCacheKey_),this.gl_=Ws(this.canvas_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.canvas_.addEventListener(Un.LOST,this.boundHandleWebGLContextLost_),this.canvas_.addEventListener(Un.RESTORED,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=(0,q.Ue)(),this.offsetScaleMatrix_=(0,q.Ue)(),this.tmpMat4_=ac(),this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],e.uniforms&&this.setUniforms(e.uniforms),this.postProcessPasses_=e.postProcesses?e.postProcesses.map(t=>new Lo({webGlContext:this.gl_,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms})):[new Lo({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(e){this.uniforms_=[];for(const t in e)this.uniforms_.push({name:t,value:e[t]})}canvasCacheKeyMatches(e){return this.canvasCacheKey_===Fo(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.gl_,i=(0,J.sq)(e);let n=this.bufferCache_[i];if(!n){const s=t.createBuffer();n={buffer:e,webGlBuffer:s},this.bufferCache_[i]=n}t.bindBuffer(e.getType(),n.webGlBuffer)}flushBufferData(e){const t=this.gl_;this.bindBuffer(e),t.bufferData(e.getType(),e.getArray(),e.getUsage())}deleteBuffer(e){const t=this.gl_,i=(0,J.sq)(e),n=this.bufferCache_[i];n&&!t.isContextLost()&&t.deleteBuffer(n.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){this.canvas_.removeEventListener(Un.LOST,this.boundHandleWebGLContextLost_),this.canvas_.removeEventListener(Un.RESTORED,this.boundHandleWebGLContextRestored_),cc(this.canvasCacheKey_),delete this.gl_,delete this.canvas_}prepareDraw(e,t){const i=this.gl_,n=this.getCanvas(),s=e.size,o=e.pixelRatio;(n.width!==s[0]*o||n.height!==s[1]*o)&&(n.width=s[0]*o,n.height=s[1]*o,n.style.width=s[0]+"px",n.style.height=s[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)}bindTexture(e,t,i){const n=this.gl_;n.activeTexture(n.TEXTURE0+t),n.bindTexture(n.TEXTURE_2D,e),n.uniform1i(this.getUniformLocation(i),t)}prepareDrawToRenderTarget(e,t,i){const n=this.gl_,s=t.getSize();n.bindFramebuffer(n.FRAMEBUFFER,t.getFramebuffer()),n.viewport(0,0,s[0],s[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.gl_;this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,s=4,o=t-e,a=e*s;i.drawElements(i.TRIANGLES,o,n,a)}finalizeDraw(e,t,i){for(let n=0,s=this.postProcessPasses_.length;n<s;n++)n===s-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,s=(0,q.mc)(this.offsetScaleMatrix_);(0,q.bA)(s,2/t[0],2/t[1]);const o=(0,q.mc)(this.offsetRotateMatrix_);i!==0&&(0,q.U1)(o,-i),this.setUniformMatrixValue(ri.OFFSET_SCALE_MATRIX,Ys(this.tmpMat4_,s)),this.setUniformMatrixValue(ri.OFFSET_ROTATION_MATRIX,Ys(this.tmpMat4_,o)),this.setUniformFloatValue(ri.TIME,(Date.now()-this.startTime_)*.001),this.setUniformFloatValue(ri.ZOOM,e.viewState.zoom),this.setUniformFloatValue(ri.RESOLUTION,e.viewState.resolution),this.setUniformFloatValue(ri.PIXEL_RATIO,n),this.setUniformFloatVec2(ri.VIEWPORT_SIZE_PX,[t[0],t[1]])}applyUniforms(e){const t=this.gl_;let i,n=0;this.uniforms_.forEach(s=>{if(i=typeof s.value=="function"?s.value(e):s.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData)s.texture||(s.prevValue=void 0,s.texture=t.createTexture()),t.activeTexture(t[`TEXTURE${n}`]),t.bindTexture(t.TEXTURE_2D,s.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)&&s.prevValue!==i&&(s.prevValue=i,t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)),t.uniform1i(this.getUniformLocation(s.name),n++);else if(Array.isArray(i)&&i.length===6)this.setUniformMatrixValue(s.name,Ys(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:t.uniform2f(this.getUniformLocation(s.name),i[0],i[1]);return;case 3:t.uniform3f(this.getUniformLocation(s.name),i[0],i[1],i[2]);return;case 4:t.uniform4f(this.getUniformLocation(s.name),i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&t.uniform1f(this.getUniformLocation(s.name),i)})}useProgram(e,t){this.gl_.useProgram(e),this.currentProgram_=e,this.applyFrameState(t),this.applyUniforms(t)}compileShader(e,t){const i=this.gl_,n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}getProgram(e,t){const i=this.gl_,n=this.compileShader(e,i.FRAGMENT_SHADER),s=this.compileShader(t,i.VERTEX_SHADER),o=i.createProgram();if(i.attachShader(o,n),i.attachShader(o,s),i.linkProgram(o),!i.getShaderParameter(n,i.COMPILE_STATUS)){const a=`Fragment shader compilation failed: ${i.getShaderInfoLog(n)}`;throw new Error(a)}if(i.deleteShader(n),!i.getShaderParameter(s,i.COMPILE_STATUS)){const a=`Vertex shader compilation failed: ${i.getShaderInfoLog(s)}`;throw new Error(a)}if(i.deleteShader(s),!i.getProgramParameter(o,i.LINK_STATUS)){const a=`GL program linking failed: ${i.getProgramInfoLog(o)}`;throw new Error(a)}return o}getUniformLocation(e){const t=(0,J.sq)(this.currentProgram_);return this.uniformLocationsByProgram_[t]===void 0&&(this.uniformLocationsByProgram_[t]={}),this.uniformLocationsByProgram_[t][e]===void 0&&(this.uniformLocationsByProgram_[t][e]=this.gl_.getUniformLocation(this.currentProgram_,e)),this.uniformLocationsByProgram_[t][e]}getAttributeLocation(e){const t=(0,J.sq)(this.currentProgram_);return this.attribLocationsByProgram_[t]===void 0&&(this.attribLocationsByProgram_[t]={}),this.attribLocationsByProgram_[t][e]===void 0&&(this.attribLocationsByProgram_[t][e]=this.gl_.getAttribLocation(this.currentProgram_,e)),this.attribLocationsByProgram_[t][e]}makeProjectionTransform(e,t){const i=e.size,n=e.viewState.rotation,s=e.viewState.resolution,o=e.viewState.center;return(0,q.qC)(t,0,0,2/(s*i[0]),2/(s*i[1]),-n,-o[0],-o[1]),t}setUniformFloatValue(e,t){this.gl_.uniform1f(this.getUniformLocation(e),t)}setUniformFloatVec2(e,t){this.gl_.uniform2fv(this.getUniformLocation(e),t)}setUniformFloatVec4(e,t){this.gl_.uniform4fv(this.getUniformLocation(e),t)}setUniformMatrixValue(e,t){this.gl_.uniformMatrix4fv(this.getUniformLocation(e),!1,t)}enableAttributeArray_(e,t,i,n,s){const o=this.getAttributeLocation(e);o<0||(this.gl_.enableVertexAttribArray(o),this.gl_.vertexAttribPointer(o,t,i,!1,n,s))}enableAttributes(e){const t=dc(e);let i=0;for(let n=0;n<e.length;n++){const s=e[n];this.enableAttributeArray_(s.name,s.size,s.type||Ro,t,i),i+=s.size*Po(s.type)}}handleWebGLContextLost(){(0,Vi.Z)(this.bufferCache_),this.currentProgram_=null}handleWebGLContextRestored(){}createTexture(e,t,i){const n=this.gl_;i=i||n.createTexture();const s=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,s,o,l,h,t):n.texImage2D(n.TEXTURE_2D,s,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 dc(r){let e=0;for(let t=0;t<r.length;t++){const i=r[t];e+=i.size*Po(i.type)}return e}function Po(r){switch(r){case It.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case It.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case It.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case It.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}const fc=uc;class js extends Er{constructor(e,t){super(e),t=t||{},this.inversePixelTransform_=(0,q.Ue)(),this.pixelContext_=null,this.postProcesses_=t.postProcesses,this.uniforms_=t.uniforms,this.helper,e.addChangeListener(ic.Z.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(qt.Z.PRECOMPOSE)){const n=new wn.Z(qt.Z.PRECOMPOSE,void 0,t,e);i.dispatchEvent(n)}}dispatchPostComposeEvent(e,t){const i=this.getLayer();if(i.hasListener(qt.Z.POSTCOMPOSE)){const n=new wn.Z(qt.Z.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 js)){t=!0;continue}const c=l.getClassName();if((t||c!==n)&&(i+=1,t=!1),n=c,h===this)break}const s="map/"+e.mapId+"/group/"+i;(!this.helper||!this.helper.canvasCacheKeyMatches(s))&&(this.removeHelper(),this.helper=new fc({postProcesses:this.postProcesses_,uniforms:this.uniforms_,canvasCacheKey:s}),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,q.qC)(this.inversePixelTransform_,0,0,i.pixelRatio,-i.pixelRatio,0,0,-i.size[1]);const s=new wn.Z(e,this.inversePixelTransform_,i,t);n.dispatchEvent(s)}}preRender(e,t){this.dispatchRenderEvent_(qt.Z.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(qt.Z.POSTRENDER,e,t)}}const gc=js,kt=new Uint8Array(4);class mc{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,et.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 kt[0]=0,kt[1]=0,kt[2]=0,kt[3]=0,kt;this.readAll();const i=Math.floor(e)+(this.size_[1]-Math.floor(t)-1)*this.size_[0];return kt[0]=this.data_[i*4],kt[1]=this.data_[i*4+1],kt[2]=this.data_[i*4+2],kt[3]=this.data_[i*4+3],kt}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 pc=mc,Hs={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"};var Bu=S(83071);const _c=null,Ks={vertexPosition:0,indexPosition:0};function Vn(r,e,t,i,n){r[e+0]=t,r[e+1]=i,r[e+2]=n}function zu(r,e,t,i,n,s){const l=3+n,h=r[e+0],c=r[e+1],d=_c;d.length=n;for(let m=0;m<d.length;m++)d[m]=r[e+2+m];let u=s?s.vertexPosition:0,g=s?s.indexPosition:0;const f=u/l;return Vn(t,u,h,c,0),d.length&&t.set(d,u+3),u+=l,Vn(t,u,h,c,1),d.length&&t.set(d,u+3),u+=l,Vn(t,u,h,c,2),d.length&&t.set(d,u+3),u+=l,Vn(t,u,h,c,3),d.length&&t.set(d,u+3),u+=l,i[g++]=f,i[g++]=f+1,i[g++]=f+3,i[g++]=f+1,i[g++]=f+2,i[g++]=f+3,Ks.vertexPosition=u,Ks.indexPosition=g,Ks}function Gu(r,e,t,i,n,s,o,a,l,h){const d=5+a.length,u=s.length/d,g=[r[e+0],r[e+1]],f=[r[t],r[t+1]],m=applyTransform(h,[...g]),p=applyTransform(h,[...f]);function v(A,z,H){return Math.round(z*1500)+Math.round(H*1500)*1e4+A*1e4*1e4}function y(A,z,H){const K=Math.sqrt((z[0]-A[0])*(z[0]-A[0])+(z[1]-A[1])*(z[1]-A[1])),le=[(z[0]-A[0])/K,(z[1]-A[1])/K],he=[-le[1],le[0]],Q=Math.sqrt((H[0]-A[0])*(H[0]-A[0])+(H[1]-A[1])*(H[1]-A[1])),me=[(H[0]-A[0])/Q,(H[1]-A[1])/Q],re=K===0||Q===0?0:Math.acos(clamp(me[0]*le[0]+me[1]*le[1],-1,1));return me[0]*he[0]+me[1]*he[1]>0?re:Math.PI*2-re}const w=i!==null,T=n!==null;let L=0,P=0;if(w){const A=[r[i],r[i+1]],z=applyTransform(h,[...A]);L=y(m,p,z)}if(T){const A=[r[n],r[n+1]],z=applyTransform(h,[...A]);P=y(p,m,z)}s.push(g[0],g[1],f[0],f[1],v(0,L,P)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(1,L,P)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(2,L,P)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(3,L,P)),s.push(...a),o.push(u,u+1,u+2,u+1,u+3,u+2)}function Nu(r,e,t,i,n){const o=2+n;let a=e;const l=r.slice(a,a+n);a+=n;const h=r[a++];let c=0;const d=new Array(h-1);for(let f=0;f<h;f++)c+=r[a++],f<h-1&&(d[f]=c);const u=r.slice(a,a+c*2),g=earcut(u,d,2);for(let f=0;f<g.length;f++)i.push(g[f]+t.length/o);for(let f=0;f<u.length;f+=2)t.push(u[f],u[f+1],...l);return a+c*2}function Zu(){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 xc(r,e){e=e||[];const t=256,i=t-1;return e[0]=Math.floor(r/t/t/t)/i,e[1]=Math.floor(r/t/t)%t/i,e[2]=Math.floor(r/t)%t/i,e[3]=r%t/i,e}function yc(r){let e=0;const t=256,i=t-1;return e+=Math.round(r[0]*t*t*t*i),e+=Math.round(r[1]*t*t*i),e+=Math.round(r[2]*t*i),e+=Math.round(r[3]*i),e}var vc=S(20247).Buffer;function Ec(){const r='const e="GENERATE_POLYGON_BUFFERS",t="GENERATE_POINT_BUFFERS",n="GENERATE_LINE_STRING_BUFFERS",r={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",69:"`width` or `height` cannot be provided together with `scale`"};class o extends Error{constructor(e){const t=r[e];super(t),this.code=e,this.name="AssertionError",this.message=t}}var i=o;function a(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 s(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],a=t[1],s=t[2],u=t[3],f=t[4],x=t[5];return e[0]=u/n,e[1]=-a/n,e[2]=-s/n,e[3]=o/n,e[4]=(s*x-u*f)/n,e[5]=-(o*x-a*f)/n,e}function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}new Array(6);var f={exports:{}};function x(e,t,n){n=n||2;var r,o,i,a,s,u,f,x=t&&t.length,h=x?t[0]*n:e.length,v=l(e,0,h,n,!0),d=[];if(!v||v.next===v.prev)return d;if(x&&(v=function(e,t,n,r){var o,i,a,s=[];for(o=0,i=t.length;o<i;o++)(a=l(e,t[o]*r,o<i-1?t[o+1]*r:e.length,r,!1))===a.next&&(a.steiner=!0),s.push(A(a));for(s.sort(b),o=0;o<s.length;o++)n=g(s[o],n);return n}(e,t,v,n)),e.length>80*n){r=i=e[0],o=a=e[1];for(var y=n;y<h;y+=n)(s=e[y])<r&&(r=s),(u=e[y+1])<o&&(o=u),s>i&&(i=s),u>a&&(a=u);f=0!==(f=Math.max(i-r,a-o))?32767/f:0}return c(v,d,n,r,o,f,0),d}function l(e,t,n,r,o){var i,a;if(o===P(e,t,n,r)>0)for(i=t;i<n;i+=r)a=k(i,e[i],e[i+1],a);else for(i=n-r;i>=t;i-=r)a=k(i,e[i],e[i+1],a);return a&&F(a,a.next)&&(R(a),a=a.next),a}function h(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!F(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(R(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function c(e,t,n,r,o,i,a){if(e){!a&&i&&function(e,t,n,r){var o=e;do{0===o.z&&(o.z=w(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,a,s,u,f=1;do{for(n=e,e=null,i=null,a=0;n;){for(a++,r=n,s=0,t=0;t<f&&(s++,r=r.nextZ);t++);for(u=f;s>0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(o=n,n=n.nextZ,s--):(o=r,r=r.nextZ,u--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,f*=2}while(a>1)}(o)}(e,r,o,i);for(var s,u,f=e;e.prev!==e.next;)if(s=e.prev,u=e.next,i?d(e,r,o,i):v(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),R(e),e=u.next,f=u.next;else if((e=u)===f){a?1===a?c(e=y(h(e),t,n),t,n,r,o,i,2):2===a&&p(e,t,n,r,o,i):c(h(e),t,n,r,o,i,1);break}}}function v(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var o=t.x,i=n.x,a=r.x,s=t.y,u=n.y,f=r.y,x=o<i?o<a?o:a:i<a?i:a,l=s<u?s<f?s:f:u<f?u:f,h=o>i?o>a?o:a:i>a?i:a,c=s>u?s>f?s:f:u>f?u:f,v=r.next;v!==t;){if(v.x>=x&&v.x<=h&&v.y>=l&&v.y<=c&&E(o,s,i,u,a,f,v.x,v.y)&&Z(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function d(e,t,n,r){var o=e.prev,i=e,a=e.next;if(Z(o,i,a)>=0)return!1;for(var s=o.x,u=i.x,f=a.x,x=o.y,l=i.y,h=a.y,c=s<u?s<f?s:f:u<f?u:f,v=x<l?x<h?x:h:l<h?l:h,d=s>u?s>f?s:f:u>f?u:f,y=x>l?x>h?x:h:l>h?l:h,p=w(c,v,t,n,r),b=w(d,y,t,n,r),g=e.prevZ,m=e.nextZ;g&&g.z>=p&&m&&m.z<=b;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&E(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,m.x>=c&&m.x<=d&&m.y>=v&&m.y<=y&&m!==o&&m!==a&&E(s,x,u,l,f,h,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;g&&g.z>=p;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&E(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;m&&m.z<=b;){if(m.x>=c&&m.x<=d&&m.y>=v&&m.y<=y&&m!==o&&m!==a&&E(s,x,u,l,f,h,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function y(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!F(o,i)&&T(o,r,r.next,i)&&z(o,i)&&z(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),R(r),R(r.next),r=e=i),r=r.next}while(r!==e);return h(r)}function p(e,t,n,r,o,i){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&M(a,s)){var u=U(a,s);return a=h(a,a.next),u=h(u,u.next),c(a,t,n,r,o,i,0),void c(u,t,n,r,o,i,0)}s=s.next}a=a.next}while(a!==e)}function b(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,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=o&&s>a&&(a=s,n=r.x<r.next.x?r:r.next,s===o))return n}r=r.next}while(r!==t);if(!n)return null;var u,f=n,x=n.x,l=n.y,h=1/0;r=n;do{o>=r.x&&r.x>=x&&o!==r.x&&E(i<l?o:a,i,x,l,i<l?a:o,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(o-r.x),z(r,e)&&(u<h||u===h&&(r.x>n.x||r.x===n.x&&m(n,r)))&&(n=r,h=u)),r=r.next}while(r!==f);return n}(e,t);if(!n)return t;var r=U(n,e);return h(r,r.next),h(n,n.next)}function m(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function w(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function A(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 E(e,t,n,r,o,i,a,s){return(o-a)*(t-s)>=(e-a)*(i-s)&&(e-a)*(r-s)>=(n-a)*(t-s)&&(n-a)*(i-s)>=(o-a)*(r-s)}function M(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&&T(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(z(e,t)&&z(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))||F(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 F(e,t){return e.x===t.x&&e.y===t.y}function T(e,t,n,r){var o=S(Z(e,t,n)),i=S(Z(e,t,r)),a=S(Z(n,r,e)),s=S(Z(n,r,t));return o!==i&&a!==s||(!(0!==o||!I(e,n,t))||(!(0!==i||!I(e,r,t))||(!(0!==a||!I(n,e,r))||!(0!==s||!I(n,t,r)))))}function I(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 S(e){return e>0?1:e<0?-1:0}function z(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 U(e,t){var n=new B(e.i,e.x,e.y),r=new B(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 k(e,t,n,r){var o=new B(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 R(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 B(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function P(e,t,n,r){for(var o=0,i=t,a=n-r;i<n;i+=r)o+=(e[a]-e[i])*(e[i+1]+e[a+1]),a=i;return o}f.exports=x,f.exports.default=x,x.deviation=function(e,t,n,r){var o=t&&t.length,i=o?t[0]*n:e.length,a=Math.abs(P(e,0,i,n));if(o)for(var s=0,u=t.length;s<u;s++){var f=t[s]*n,x=s<u-1?t[s+1]*n:e.length;a-=Math.abs(P(e,f,x,n))}var l=0;for(s=0;s<r.length;s+=3){var h=r[s]*n,c=r[s+1]*n,v=r[s+2]*n;l+=Math.abs((e[h]-e[v])*(e[c+1]-e[h+1])-(e[h]-e[c])*(e[v+1]-e[h+1]))}return 0===a&&0===l?0:Math.abs((l-a)/a)},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 a=0;a<t;a++)n.vertices.push(e[o][i][a]);o>0&&(r+=e[o-1].length,n.holes.push(r))}return n};var N=u(f.exports);const _=[],O={vertexPosition:0,indexPosition:0};function q(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function L(e,t,n,r,o,i){const a=3+o,s=e[t+0],u=e[t+1],f=_;f.length=o;for(let n=0;n<f.length;n++)f[n]=e[t+2+n];let x=i?i.vertexPosition:0,l=i?i.indexPosition:0;const h=x/a;return q(n,x,s,u,0),f.length&&n.set(f,x+3),x+=a,q(n,x,s,u,1),f.length&&n.set(f,x+3),x+=a,q(n,x,s,u,2),f.length&&n.set(f,x+3),x+=a,q(n,x,s,u,3),f.length&&n.set(f,x+3),x+=a,r[l++]=h,r[l++]=h+1,r[l++]=h+3,r[l++]=h+1,r[l++]=h+2,r[l++]=h+3,O.vertexPosition=x,O.indexPosition=l,O}function C(e,t,n,r,o,i,s,u,f,x){const l=5+u.length,h=i.length/l,c=[e[t+0],e[t+1]],v=[e[n],e[n+1]],d=a(x,[...c]),y=a(x,[...v]);function p(e,t,n){const r=1e4;return Math.round(1500*t)+Math.round(1500*n)*r+e*r*r}function b(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]],a=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/a,(n[1]-e[1])/a],u=0===r||0===a?0:Math.acos((f=s[0]*o[0]+s[1]*o[1],x=-1,l=1,Math.min(Math.max(f,x),l)));var f,x,l;return s[0]*i[0]+s[1]*i[1]>0?u:2*Math.PI-u}const g=null!==o;let m=0,w=0;if(null!==r){m=b(d,y,a(x,[...[e[r],e[r+1]]]))}if(g){w=b(y,d,a(x,[...[e[o],e[o+1]]]))}i.push(c[0],c[1],v[0],v[1],p(0,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(1,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(2,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(3,m,w)),i.push(...u),s.push(h,h+1,h+2,h+1,h+3,h+2)}function G(e,t,n,r,o){const i=2+o;let a=t;const s=e.slice(a,a+o);a+=o;const u=e[a++];let f=0;const x=new Array(u-1);for(let t=0;t<u;t++)f+=e[a++],t<u-1&&(x[t]=f);const l=e.slice(a,a+2*f),h=N(l,x,2);for(let e=0;e<h.length;e++)r.push(h[e]+n.length/i);for(let e=0;e<l.length;e+=2)n.push(l[e],l[e+1],...s);return a+2*f}const j=self;j.onmessage=r=>{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesSize,r=t+n,i=new Float32Array(o.renderInstructions),a=i.length/r,s=4*a*(n+e),u=new Uint32Array(6*a),f=new Float32Array(s);let x;for(let e=0;e<i.length;e+=r)x=L(i,e,f,u,n,x);const l=Object.assign({vertexBuffer:f.buffer,indexBuffer:u.buffer,renderInstructions:i.buffer},o);j.postMessage(l,[f.buffer,u.buffer,i.buffer]);break}case n:{const e=[],t=[],n=o.customAttributesSize,r=2,i=new Float32Array(o.renderInstructions);let a=0;const u=o.renderInstructionsTransform,f=[1,0,0,1,0,0];let x,l;for(s(f,u);a<i.length;){l=Array.from(i.slice(a,a+n)),a+=n,x=i[a++];for(let n=0;n<x-1;n++)C(i,a+n*r,a+(n+1)*r,n>0?a+(n-1)*r:null,n<x-2?a+(n+2)*r:null,e,t,l,0,f);a+=x*r}const h=Uint32Array.from(t),c=Float32Array.from(e),v=Object.assign({vertexBuffer:c.buffer,indexBuffer:h.buffer,renderInstructions:i.buffer},o);j.postMessage(v,[c.buffer,h.buffer,i.buffer]);break}case e:{const e=[],t=[],n=o.customAttributesSize,r=new Float32Array(o.renderInstructions);let i=0;for(;i<r.length;)i=G(r,i,e,t,n);const a=Uint32Array.from(t),s=Float32Array.from(e),u=Object.assign({vertexBuffer:s.buffer,indexBuffer:a.buffer,renderInstructions:r.buffer},o);j.postMessage(u,[s.buffer,a.buffer,r.buffer]);break}}};';return new Worker(typeof Blob>"u"?"data:application/javascript;base64,"+vc.from(r,"binary").toString("base64"):URL.createObjectURL(new Blob([r],{type:"application/javascript"})))}class wc extends gc{constructor(e,t){const i=t.uniforms||{},n=(0,q.Ue)();i[ri.PROJECTION_MATRIX]=n,super(e,{uniforms:i,postProcesses:t.postProcesses}),this.sourceRevision_=-1,this.verticesBuffer_=new Vs(Zn,Wn),this.hitVerticesBuffer_=new Vs(Zn,Wn),this.indicesBuffer_=new Vs(Zs,Wn),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 s=t.attributes?t.attributes.map(function(a){return{name:"a_"+a.name,size:1,type:It.FLOAT}}):[];this.attributes=[{name:"a_position",size:2,type:It.FLOAT},{name:"a_index",size:1,type:It.FLOAT}].concat(s),this.hitDetectionAttributes=[{name:"a_position",size:2,type:It.FLOAT},{name:"a_index",size:1,type:It.FLOAT},{name:"a_hitColor",size:4,type:It.FLOAT},{name:"a_featureUid",size:1,type:It.FLOAT}].concat(s),this.customAttributes=t.attributes?t.attributes:[],this.previousExtent_=(0,C.lJ)(),this.currentTransform_=n,this.renderTransform_=(0,q.Ue)(),this.invertRenderTransform_=(0,q.Ue)(),this.renderInstructions_=new Float32Array(0),this.hitRenderInstructions_=new Float32Array(0),this.hitRenderTarget_,this.lastSentId=0,this.worker_=Ec(),this.worker_.addEventListener("message",a=>{const l=a.data;if(l.type===Hs.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,q.nb)(this.invertRenderTransform_,this.renderTransform_),l.hitDetection?this.hitRenderInstructions_=new Float32Array(a.data.renderInstructions):(this.renderInstructions_=new Float32Array(a.data.renderInstructions),l.id===this.lastSentId&&(this.ready=!0)),this.getLayer().changed()}}),this.featureCache_={},this.featureCount_=0;const o=this.getLayer().getSource();this.sourceListenKeys_=[(0,Qe.oL)(o,We.ADDFEATURE,this.handleSourceFeatureAdded_,this),(0,Qe.oL)(o,We.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,Qe.oL)(o,We.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,Qe.oL)(o,We.CLEAR,this.handleSourceFeatureClear_,this)],o.forEachFeature(a=>{this.featureCache_[(0,J.sq)(a)]={feature:a,properties:a.getProperties(),geometry:a.getGeometry()},this.featureCount_++})}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitProgram_=this.helper.getProgram(this.hitFragmentShader_,this.hitVertexShader_),this.hitRenderTarget_=new pc(this.helper))}handleSourceFeatureAdded_(e){const t=e.feature;this.featureCache_[(0,J.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(e){const t=e.feature;this.featureCache_[(0,J.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()}}handleSourceFeatureDelete_(e){const t=e.feature;delete this.featureCache_[(0,J.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,C.dz)(a):null,c=o?Math.ceil((l[2]-a[2])/h)+1:1,d=o?Math.floor((l[0]-a[0])/h):0;let u=d;const g=this.indicesBuffer_.getSize();do this.helper.makeProjectionTransform(e,this.currentTransform_),(0,q.Iu)(this.currentTransform_,u*h,0),(0,q.Jp)(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e),this.helper.drawElements(0,g);while(++u<c);this.helper.finalizeDraw(e,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const f=this.helper.getCanvas();return this.hitDetectionEnabled_&&(this.renderHitDetection(e,d,c,h),this.hitRenderTarget_.clearCachedData()),this.postRender(t,e),f}prepareFrameInternal(e){const t=this.getLayer(),i=t.getSource(),n=e.viewState,s=!e.viewHints[Si.Z.ANIMATING]&&!e.viewHints[Si.Z.INTERACTING],o=!(0,C.fS)(this.previousExtent_,e.extent),a=this.sourceRevision_<i.getRevision();if(a&&(this.sourceRevision_=i.getRevision()),s&&(o||a)){const l=n.projection,h=n.resolution,c=t instanceof ms?t.getRenderBuffer():0,d=(0,C.f3)(e.extent,c*h);i.loadFeatures(d,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,q.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 u=(7+this.customAttributes.length)*this.featureCount_;(!this.hitRenderInstructions_||this.hitRenderInstructions_.length!==u)&&(this.hitRenderInstructions_=new Float32Array(u))}let n,s;const o=[],a=[];let l=0,h=0,c;for(const u in this.featureCache_){if(n=this.featureCache_[u],s=n.geometry,!s||s.getType()!=="Point")continue;o[0]=s.getFlatCoordinates()[0],o[1]=s.getFlatCoordinates()[1],(0,q.nn)(t,o),c=xc(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(u));let g;for(let f=0;f<this.customAttributes.length;f++)g=this.customAttributes[f].callback(n.feature,n.properties),this.renderInstructions_[l++]=g,this.hitDetectionEnabled_&&(this.hitRenderInstructions_[h++]=g)}const d={id:++this.lastSentId,type:Hs.GENERATE_POINT_BUFFERS,renderInstructions:this.renderInstructions_.buffer,customAttributesSize:this.customAttributes.length};if(d.projectionTransform=t,this.ready=!1,this.worker_.postMessage(d,[this.renderInstructions_.buffer]),this.renderInstructions_=null,this.hitDetectionEnabled_){const u={id:0,type:Hs.GENERATE_POINT_BUFFERS,renderInstructions:this.hitRenderInstructions_.buffer,customAttributesSize:5+this.customAttributes.length};u.projectionTransform=t,u.hitDetection=!0,this.worker_.postMessage(u,[this.hitRenderInstructions_.buffer]),this.hitRenderInstructions_=null}}forEachFeatureAtCoordinate(e,t,i,n,s){if((0,ue.h)(this.hitDetectionEnabled_,66),!this.hitRenderInstructions_)return;const o=(0,q.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=yc(l),c=this.hitRenderInstructions_[h],d=Math.floor(c).toString(),g=this.getLayer().getSource().getFeatureByUid(d);if(g)return n(g,this.getLayer(),null)}renderHitDetection(e,t,i,n){if(!this.hitVerticesBuffer_.getSize())return;let s=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,q.Iu)(this.currentTransform_,s*n,0),(0,q.Jp)(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e);const o=this.indicesBuffer_.getSize();this.helper.drawElements(0,o)}while(++s<i)}disposeInternal(){this.worker_.terminate(),this.layer_=null,this.sourceListenKeys_.forEach(function(e){(0,Qe.bN)(e)}),this.sourceListenKeys_=null,super.disposeInternal()}}const Cc=wc,Rt={BLUR:"blur",GRADIENT:"gradient",RADIUS:"radius"},Sc=["#00f","#0ff","#0f0","#ff0","#f00"];class Tc extends ms{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(Rt.GRADIENT,this.handleGradientChanged_),this.setGradient(e.gradient?e.gradient:Sc),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(Rt.BLUR)}getGradient(){return this.get(Rt.GRADIENT)}getRadius(){return this.get(Rt.RADIUS)}handleGradientChanged_(){this.gradient_=Ic(this.getGradient())}setBlur(e){this.set(Rt.BLUR,e)}setGradient(e){this.set(Rt.GRADIENT,e)}setRadius(e){this.set(Rt.RADIUS,e)}createRenderer(){return new Cc(this,{className:this.getClassName(),attributes:[{name:"weight",callback:e=>{const t=this.weightFunction_(e);return t!==void 0?(0,_e.uZ)(t,0,1):1}}],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:()=>(this.get(Rt.RADIUS)+this.get(Rt.BLUR))*2,u_blurSlope:()=>this.get(Rt.RADIUS)/Math.max(1,this.get(Rt.BLUR))},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:()=>this.gradient_,u_opacity:()=>this.getOpacity()}}]})}renderDeclutter(){}}function Ic(r){const i=(0,ke.E4)(1,256),n=i.createLinearGradient(0,0,1,256),s=1/(r.length-1);for(let o=0,a=r.length;o<a;++o)n.addColorStop(o*s,r[o]);return i.fillStyle=n,i.fillRect(0,0,1,256),i.canvas}const Rc=Tc,Yn={weight:{fixed:1,min:0,max:1},blur:15,radius:5},bc={id:"heatmap",name:"Heatmap",description:"Visualizes a heatmap of the data",isBaseMap:!1,showLocation:!0,create:async(r,e,t,i)=>{const n={...Yn,...e.config},s=await(0,St.cJ)(e.location),o=new en(s),a="_weight",l=new Rc({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 d=(0,An.getScaledDimension)(c,n.weight);o.forEachFeature(f=>{const m=f.get("rowIndex");m!=null&&f.set(a,d.get(m))});let u=["#00f","#0ff","#0f0","#ff0","#f00"];const g=d.field??c.fields.find(f=>f.type===M.fS.number);if(g){const f=(0,Vr.fD)(g);f.isContinuous&&f.getColors&&(u=f.getColors(i))}l.setGradient(u)},registerOptionsUI:h=>{h.addCustomEditor({id:"config.weight",path:"config.weight",name:"Weight values",description:"Scale the distribution for each row",editor:ii.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:Yn.radius,settings:{min:1,max:50,step:1}}).addSliderInput({path:"config.blur",description:"Configures the amount of blur of clusters",name:"Blur",defaultValue:Yn.blur,settings:{min:1,max:50,step:1}})}}},defaultOptions:Yn},Do={icon:"https://openlayers.org/en/latest/examples/data/icon.png"},Lc={id:"last-point-tracker",name:"Icon at last point",description:"Show an icon at the last point",isBaseMap:!1,showLocation:!0,state:_i.BV.alpha,create:async(r,e,t,i)=>{const n=new Ke.Z({}),s={...Do,...e.config};n.setStyle(new fe({image:new vn({src:s.icon})}));const o=new pt({features:[n]}),a=new Be({source:o}),l=await(0,St.cJ)(e.location);return{init:()=>a,update:h=>{const c=h.series[0];if(c&&c.length){const d=(0,St.g6)(c,l);if(!d.field)return;n.setGeometry(d.field.values[c.length-1])}}}},defaultOptions:Do};var xt=function(r,e){var t=r[0]-e[0],i=r[1]-e[1];return Math.sqrt(t*t+i*i)},oi=function(r,e){return r[0]==e[0]&&r[1]==e[1]},Wu=function(r){return Fc(r.getGeometry())},Fc=function(r){switch(r.getType()){case"Point":return r.getCoordinates();case"MultiPolygon":r=r.getPolygon(0);case"Polygon":return r.getInteriorPoint().getCoordinates();default:return r.getClosestPoint(ol_extent_getCenter(r.getExtent()))}},Uu=function(r,e){var t=[],i=r.length-1,n=i,s,o,a,l,h,c,d,u,g,f,m,p,v,y=oi(r[0],r[i]);y||(m=r[0],p=r[1],v=[m[0]+(p[1]-m[1])/xt(m,p)*e,m[1]-(p[0]-m[0])/xt(m,p)*e],t.push(v),r.push(r[i]),i++,n--);for(var w=0;w<n;w++)m=r[w],p=r[(w+1)%i],v=r[(w+2)%i],s=(p[1]-m[1])/(p[0]-m[0]),o=(v[1]-p[1])/(v[0]-p[0]),Math.abs(s-o)>1e-10&&(a=Math.sqrt((p[0]-m[0])*(p[0]-m[0])+(p[1]-m[1])*(p[1]-m[1])),l=Math.sqrt((v[0]-p[0])*(v[0]-p[0])+(v[1]-p[1])*(v[1]-p[1])),h=m[0]+e*(p[1]-m[1])/a,c=p[0]+e*(v[1]-p[1])/l,d=m[1]-e*(p[0]-m[0])/a,u=p[1]-e*(v[0]-p[0])/l,g=(o*c-s*h+d-u)/(o-s),f=(s*o*(c-h)+o*d-s*u)/(o-s),p[0]-m[0]==0&&(g=p[0]+e*(p[1]-m[1])/Math.abs(p[1]-m[1]),f=o*g-o*c+u),v[0]-p[0]==0&&(g=v[0]+e*(v[1]-p[1])/Math.abs(v[1]-p[1]),f=s*g-s*h+d),t.push([g,f]));return y?t.push(t[0]):(r.pop(),m=r[r.length-1],p=r[r.length-2],v=[m[0]-(p[1]-m[1])/xt(m,p)*e,m[1]+(p[0]-m[0])/xt(m,p)*e],t.push(v)),t},Xu=function(r,e){for(var t=0;t<e.length-1;t++){var i=e[t],n=e[t+1];if(oi(r,i)||oi(r,n))return{index:1,segment:[i,n]};var s=xt(i,n),o=[(n[0]-i[0])/s,(n[1]-i[1])/s],a=xt(i,r),l=[(r[0]-i[0])/a,(r[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}},Vu=function(r,e,t){for(var i,n,s=[],o=0;o<r.length-1;o++)!r[o].length||!r[o+1].length||(r[o][1]<=e&&r[o+1][1]>e||r[o][1]>=e&&r[o+1][1]<e)&&(n=(e-r[o][1])/(r[o+1][1]-r[o][1]),i=n*(r[o+1][0]-r[o][0])+r[o][0],s.push({contour:t,index:o,pt:[i,e],abs:n}));s.sort(function(h,c){return h.pt[0]-c.pt[0]});for(var a=[],l=0;l<s.length-1;l+=2)a.push([s[l],s[l+1]]);return a},Yu=function(r,e){switch(r){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: "+r),null}},ju=function(r,e){var t=r[1][0]-r[0][0],i=r[1][1]-r[0][1],n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=t*s-i*n;if(o!=0){var a=(t*r[0][1]-t*e[0][1]-i*r[0][0]+i*e[0][0])/o;return[e[0][0]+a*n,e[0][1]+a*s]}else return!1},Ao;(function(){function r(t,i){var n;for(let s=t.length-1;s>0;s--)(t[s][0]>i&&t[s-1][0]<i||t[s][0]<i&&t[s-1][0]>i)&&(n=[i,(i-t[s][0])/(t[s-1][0]-t[s][0])*(t[s-1][1]-t[s][1])+t[s][1]],t.splice(s,0,n))}function e(t,i){var n;for(let s=t.length-1;s>0;s--)(t[s][1]>i&&t[s-1][1]<i||t[s][1]<i&&t[s-1][1]>i)&&(n=[(i-t[s][1])/(t[s-1][1]-t[s][1])*(t[s-1][0]-t[s][0])+t[s][0],i],t.splice(s,0,n))}Ao=function(t,i){var n=i.getType()==="Polygon";if(!n&&i.getType()!=="MultiPolygon")return null;var s=i.getCoordinates();return n&&(s=[s]),s.forEach(function(o){o.forEach(function(a){r(a,t[0]),r(a,t[2]),e(a,t[1]),e(a,t[3])})}),s.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 Wt.ZP(s[0]):new Ri.Z(s)}})();var jn=function(r,e,t,i){var n=[];i!==!1&&n.push(r);var s=xt(r,e);if(s){var o=Math.round(s/t);if(o>1)for(var a=(e[0]-r[0])/o,l=(e[1]-r[1])/o,h=1;h<o;h++)n.push([r[0]+a*h,r[1]+l*h])}return n.push(e),n};He.Z.prototype.sampleAt=function(r){for(var e=this.getCoordinates(),t=[],i=1;i<e.length;i++)t=t.concat(jn(e[i-1],e[i],r,i===1));return new He.Z(t)},Sn.Z.prototype.sampleAt=function(r){var e=this.getCoordinates(),t=[];return e.forEach(function(i){for(var n=[],s=1;s<i.length;s++)n=n.concat(jn(i[s-1],i[s],r,s===1));t.push(n)}),new Sn.Z(t)},Wt.ZP.prototype.sampleAt=function(r){var e=this.getCoordinates(),t=[];return e.forEach(function(i){for(var n=[],s=1;s<i.length;s++)n=n.concat(jn(i[s-1],i[s],r,s===1));t.push(n)}),new Wt.ZP(t)},Ri.Z.prototype.sampleAt=function(r){var e=this.getCoordinates(),t=[];return e.forEach(function(i){var n=[];t.push(n),i.forEach(function(s){for(var o=[],a=1;a<s.length;a++)o=o.concat(jn(s[a-1],s[a],r,a===1));n.push(o)})}),new Ri.Z(t)},Gr.prototype.intersection=function(r,e){if(r.sampleAt){var t=(0,C.f3)(this.getCenter().concat(this.getCenter()),this.getRadius());r=Ao(t,r),r=r.simplify(e);var i=this.getCenter(),n=this.getRadius(),s=r.sampleAt(e).getCoordinates();switch(r.getType()){case"Polygon":s=[s];case"MultiPolygon":{var o=!1,a=[];return s.forEach(function(l){var h=[];a.push(h),l.forEach(function(c){var d=[];h.push(d),c.forEach(function(u){var g=xt(i,u);g>n?(o=!0,d.push([i[0]+n/g*(u[0]-i[0]),i[1]+n/g*(u[1]-i[1])])):d.push(u)})})}),o?r.getType()==="Polygon"?new Wt.ZP(a[0]):new Ri.Z(a):r}}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+r.getType());return r},He.Z.prototype.splitAt=function(r,e){var t;if(!r)return[this];if(e||(e=1e-10),r.length&&r[0].length){var i=[this];for(t=0;t<r.length;t++){for(var n=[],s=0;s<i.length;s++){var o=i[s].splitAt(r[t],e);n=n.concat(o)}i=n}return i}if(oi(r,this.getFirstCoordinate())||oi(r,this.getLastCoordinate()))return[this];var a=this.getCoordinates(),l=[a[0]],h=[];for(t=0;t<a.length-1;t++)if(!oi(a[t],a[t+1])){if(oi(r,a[t+1]))l.push(a[t+1]),h.push(new He.Z(l)),l=[];else if(!oi(r,a[t])){var c,d,u=!1;a[t][0]==a[t+1][0]?(c=(a[t][1]-r[1])/(a[t][1]-a[t+1][1]),u=a[t][0]==r[0]&&0<c&&c<=1):a[t][1]==a[t+1][1]?(c=(a[t][0]-r[0])/(a[t][0]-a[t+1][0]),u=a[t][1]==r[1]&&0<c&&c<=1):(c=(a[t][0]-r[0])/(a[t][0]-a[t+1][0]),d=(a[t][1]-r[1])/(a[t][1]-a[t+1][1]),u=Math.abs(c-d)<=e&&0<c&&c<=1),u&&(l.push(r),h.push(new He.Z(l)),l=[r])}l.push(a[t+1])}return l.length>1&&h.push(new He.Z(l)),h.length?h:[this]};var Mc=class extends fe{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=(0,mt._2)(e)}catch{this._color=[0,0,0,1]}}setColor2(e){try{this._color2=(0,mt._2)(e)}catch{this._color2=null}}setArrowColor(e){try{this._acolor=(0,mt.XC)(e)}catch{this._acolor=null}}getColor(e,t){if(this._colorFn)return(0,mt.XC)(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,s){var o=this.getArrowSize()[0]*s,a=xt(t,i),l=(t[0]-i[0])/a,h=(t[1]-i[1])/a;n=Math.max(this.getArrowSize()[1]/2,n/2)*s,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,s,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,d=e[0][1]-n[0][0]*a*h+n[0][1]*a*l;for(e=[],i=0;s=n[i];i++)e[i]=[c+s[0]*a*l+s[1]*a*h,d+s[0]*a*h-s[1]*a*l,s[2]]}var u=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)&&(s=this._splitAsize(e,u),this._acolor?o.fillStyle=this._acolor:o.fillStyle=this.getColor(t.feature,0),this.drawArrow(o,s[0],s[1],this.getWidth(t.feature,0),t.pixelRatio)),e.length>1&&this.getArrow()>0&&(s=this._splitAsize(e,u,!0),this._acolor?o.fillStyle=this._acolor:o.fillStyle=this.getColor(t.feature,1),this.drawArrow(o,s[0],s[1],this.getWidth(t.feature,1),t.pixelRatio));var g=this._splitInto(e,255,2),f=0,m=g.length;if(o.lineJoin="round",o.lineCap=this._lineCap||"butt",g.length>1)for(f=0;f<g.length;f++){var p=f/m;for(n=g[f],o.lineWidth=this.getWidth(t.feature,p)*t.pixelRatio,o.strokeStyle=this.getColor(t.feature,p),o.beginPath(),o.moveTo(n[0][0],n[0][1]),i=1;s=n[i];i++)o.lineTo(s[0],s[1]);o.stroke()}o.restore()}}_splitAsize(e,t,i){var n,s,o,a,l=0;for(i?o=e.pop():o=e.shift(),n=o;e.length;){if(i?s=e.pop():s=e.shift(),a=xt(n,s),l+a>t){n=[n[0]+(s[0]-n[0])*(t-l)/a,n[1]+(s[1]-n[1])*(t-l)/a],a=xt(n,o),i?(e.push(s),e.push(n),e.push([n[0]+(o[0]-n[0])/a,n[1]+(o[1]-n[1])/a])):(e.unshift(s),e.unshift(n),e.unshift([n[0]+(o[0]-n[0])/a,n[1]+(o[1]-n[1])/a]));break}l+=a,n=s}return[o,n]}_splitInto(e,t,i){var n,s,o=this._noOverlap?1:.9,a=[],l,h=0;for(n=1;s=e[n];n++)h+=xt(e[n-1],s);var c=Math.max(i||2,h/(t||255)),d=e[0];h=0;var u=[d];for(n=1,s=e[1];n<e.length;){var g=s[0]-d[0],f=s[1]-d[1];if(l=Math.sqrt(g*g+f*f),h+l>c){var m=(c-h)/l;u.push([d[0]+g*m,d[1]+f*m]),a.push(u),d=[d[0]+g*m*o,d[1]+f*m*o],u=[d],h=0}else h+=l,d=s,u.push(d),n++,s=e[n]}return a.push(u),a}};const Oo=Mc;var ko=S(11995);const yi={style:X.Er,showLegend:!1,edgeStyle:X.Er,arrow:0},Bo="network",Hu={type:Bo,name:"",config:yi,location:{mode:Ne.q1.Auto}},Pc={id:Bo,name:"Network",description:"Render a node graph as a map layer",isBaseMap:!1,showLocation:!0,hideOpacity:!0,state:_i.BV.beta,create:async(r,e,t,i)=>{const n={...yi,...e?.config},s=await Ut(n.style),o=await Ut(n.edgeStyle),a=await(0,St.cJ)(e.location),l=new en(a),h=new Be({source:l}),c=n.arrow===1||n.arrow===-1||n.arrow===2,d=new Fn.t(1);let u=null;return n.showLegend&&(u=_.createElement(jr,{watch:d,initialSubProps:{},child:Yr})),h.setStyle(g=>{const f=g.getGeometry(),m=g.get("rowIndex"),p=s.dims;if(!s.fields&&!o.fields&&!c&&f?.getType()!=="LineString")return s.maker(s.base);if(f?.getType()==="LineString"&&f instanceof Ti.ZP){const y=o.dims,w=o.config.textConfig,T=Number(g.getId()),L=f.getCoordinates(),P=o.config.opacity??1;if(L&&y){const A=L[0],z=L[1],H=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(T))??o.base.color)).setAlpha(P).toString(),K=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(T))??o.base.color)).setAlpha(P).toString(),le=(y.size&&y.size.get(T))??o.base.size,he=(y.size&&y.size.get(T))??o.base.size,Q=[],me=new Oo({visible:!0,lineCap:n.arrow===0?"round":"square",color:H,color2:K,width:(y.size&&y.size.get(T))??o.base.size,width2:(y.size&&y.size.get(T))??o.base.size});n.arrow&&(me.setArrow(n.arrow),n.arrow>0?(me.setArrowColor(K),me.setArrowSize((he??0)*2)):(me.setArrowColor(H),me.setArrowSize((le??0)*2)));const re=new He.Z([A,z]);me.setGeometry(re);const Y=i.typography.fontFamily;if(y.text){const N=new fe({zIndex:10,text:new gi({text:y.text.get(T),font:`normal ${w?.fontSize}px ${Y}`,fill:new Se({color:H??X.Er.color.fixed}),stroke:new Te({color:(0,de.Z)(i.visualization.getColorByName("text")).setAlpha(P).toString(),width:Math.max(w?.fontSize/10,1)}),...w})});N.setGeometry(re),Q.push(N)}return Q.push(me),Q}}if(!p||!(0,E.isNumber)(m))return s.maker(s.base);const v={...s.base};return p.color&&(v.color=p.color.get(m)),p.size&&(v.size=p.size.get(m)),p.text&&(v.text=p.text.get(m)),p.rotation&&(v.rotation=p.rotation.get(m)),s.maker(v)}),{init:()=>h,legend:u,update:g=>{if(!g.series?.length){l.clear();return}u&&d.next({styleConfig:s,size:s.dims?.size,layerName:e.name,layer:h});const f=(0,ko.E_)(g.series);for(const m of g.series)m===f.edges[0]?o.dims=(0,tt.vV)(m,o,i):s.dims=(0,tt.vV)(m,s,i),Dc(l,f)},registerOptionsUI:(g,f)=>{const m=(0,ko.E_)(f.data),p=m.nodes[0],v=m.edges[0];g.addCustomEditor({id:"config.style",category:["Node Styles"],path:"config.style",name:"Node Styles",editor:ni,settings:{displayRotation:!0,frameMatcher:y=>y===p},defaultValue:yi.style}).addCustomEditor({id:"config.edgeStyle",category:["Edge Styles"],path:"config.edgeStyle",name:"Edge Styles",editor:ni,settings:{hideSymbol:!0,frameMatcher:y=>y===v},defaultValue:yi.style}).addRadio({path:"config.arrow",name:"Arrow",settings:{options:[{label:"None",value:0},{label:"Forward",value:1},{label:"Reverse",value:-1},{label:"Both",value:2}]},defaultValue:yi.arrow}).addBooleanSwitch({path:"config.showLegend",name:"Show legend",description:"Show map legend",defaultValue:yi.showLegend})}}},defaultOptions:yi};function Dc(r,e){r.clear(!0);const t=e.nodes[0],i=e.edges[0];if(!t||!i)return;const n=(0,St.g6)(t,r.location);if(!n.field){r.changed();return}const s=n.field,o=t.fields.findIndex(u=>u.name==="id"),a=t.fields[o].values,l=i.fields.findIndex(u=>u.name==="source"),h=i.fields.findIndex(u=>u.name==="target"),c=i.fields[l].values,d=i.fields[h].values;for(let u=0;u<c.length;u++){const g=c[u],f=d[u],m=a.findIndex(w=>w===g),p=a.findIndex(w=>w===f);if(!s.values[m]||!s.values[p])continue;const v=new He.Z([s.values[m].getCoordinates(),s.values[p].getCoordinates()]),y=new Ke.Z({geometry:v});y.setId(u),r.addFeatureInternal(y)}for(let u=0;u<t.length;u++)r.addFeatureInternal(new Ke.Z({frameNodes:t,rowIndex:u,geometry:n.field.values[u]}));r.changed()}var zo=class extends $e{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 Te({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:$e.prototype.render?new Se({color:[0,0,0,0]}):null}),this.sanchor_=t,this._shadow=i,!this.getHitDetectionImage){var s=super.getImage.call(this);if(!this.hitDetectionCanvas_){for(var o in this)if(this[o]&&this[o].getContext&&this[o]!==s){this.hitDetectionCanvas_=this[o];break}}this.hitDetectionCanvas_=document.createElement("canvas"),this.hitDetectionCanvas_.width=s.width,this.hitDetectionCanvas_.height=s.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,this._onerror=e.onerror,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 zo({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 s=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-s,l-s);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-s-2*h,d=Math.atan(6/c);e.save(),e.rotate(-d),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(d),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_-s,l-this.sanchor_-s,i),e.moveTo(a/2-this.sanchor_-s/2,l-this.sanchor_-s),e.lineTo(a/2+this.sanchor_-s/2,l-this.sanchor_-s),e.lineTo(a/2-s/2,l-s);break}default:{e.roundRect(0,0,a-s,l-s,i);break}}e.closePath()}getImage(e){e=e||1;var t=$e.prototype.getImage.call(this,e);if(this._gethit||this.img_)return t;var i,n=0;this._stroke&&(i=(0,mt.XC)(this._stroke.getColor()),n=this._stroke.getWidth()),this._gethit=!0;var s=this.getHitDetectionImage().getContext("2d");s.save(),s.setTransform(1,0,0,1,0,0),this.drawBack_(s,"#000",n,1),s.fill(),s.restore(),this._gethit=!1,s=t.getContext("2d"),s.save(),s.setTransform(e,0,0,e,0,0),this.drawBack_(s,i,n,e),this._shadow&&(s.shadowColor="rgba(0,0,0,0.5)",s.shadowBlur=e*this._shadow/2,s.shadowOffsetX=e*this._shadow/2,s.shadowOffsetY=e*this._shadow/2),s.fill(),s.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()},o._onerror&&(a.onerror=function(){o._onerror()})),!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"),s=0;this._stroke&&(s=this._stroke.getWidth());var o=2*this._radius;n.save(),$e.prototype.render&&n.setTransform(i,0,0,i,0,0),this._kind=="circle"&&(n.beginPath(),n.arc(this._radius+s,this._radius+s,this._radius,0,2*Math.PI,!1),n.clip());var a,l,h,c,d,u,g,f,m;this._crop?(a=Math.min(t.width/o,t.height/o),f=m=a*o,u=(t.width-f)/2,g=(t.height-m)/2,l=h=0,c=d=o+1):(a=Math.min(o/t.width,o/t.height),u=g=0,f=t.width,m=t.height,c=a*f,d=a*m,l=(o-c)/2,h=(o-d)/2),l+=s+this.sanchor_/2,h+=s,n.drawImage(t,u,g,f,m,l,h,c,d),this._kind=="circle"&&s&&(n.beginPath(),n.strokeStyle=(0,mt.XC)(this._stroke.getColor()),n.lineWidth=s/4,n.arc(this._radius+s,this._radius+s,this._radius,0,2*Math.PI,!1),n.stroke()),n.restore()}};CanvasRenderingContext2D.prototype.roundRect=function(r,e,t,i,n){return n?(t<2*n&&(n=t/2),i<2*n&&(n=i/2),this.beginPath(),this.moveTo(r+n,e),this.arcTo(r+t,e,r+t,e+i,n),this.arcTo(r+t,e+i,r,e+i,n),this.arcTo(r,e+i,r,e,n),this.arcTo(r,e,r+t,e,n),this.closePath()):this.rect(r,e,t,i),this};const $s=zo,Xt={kind:"square",border:2,shadow:!0,crop:!0,radius:20,color:"rgb(200, 200, 200)"},Go="photos",Ku={type:Go,name:"",config:Xt,location:{mode:Ne.q1.Auto},tooltip:!0},Js="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBjbGFzcz0iY3NzLWV5eDRkbyI+PHBhdGggZD0iTTExLjI5LDE1LjI5YTEuNTgsMS41OCwwLDAsMC0uMTIuMTUuNzYuNzYsMCwwLDAtLjA5LjE4LjY0LjY0LDAsMCwwLS4wNi4xOCwxLjM2LDEuMzYsMCwwLDAsMCwuMi44NC44NCwwLDAsMCwuMDguMzguOS45LDAsMCwwLC41NC41NC45NC45NCwwLDAsMCwuNzYsMCwuOS45LDAsMCwwLC41NC0uNTRBMSwxLDAsMCwwLDEzLDE2YTEsMSwwLDAsMC0uMjktLjcxQTEsMSwwLDAsMCwxMS4yOSwxNS4yOVpNMTIsMkExMCwxMCwwLDEsMCwyMiwxMiwxMCwxMCwwLDAsMCwxMiwyWm0wLDE4YTgsOCwwLDEsMSw4LThBOCw4LDAsMCwxLDEyLDIwWk0xMiw3QTMsMywwLDAsMCw5LjQsOC41YTEsMSwwLDEsMCwxLjczLDFBMSwxLDAsMCwxLDEyLDlhMSwxLDAsMCwxLDAsMiwxLDEsMCwwLDAtMSwxdjFhMSwxLDAsMCwwLDIsMHYtLjE4QTMsMywwLDAsMCwxMiw3WiI+PC9wYXRoPjwvc3ZnPgo=",Ac="data:image/svg+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";let on=[];const Oc={id:Go,name:"Photos",description:"Render photos at each data point",isBaseMap:!1,showLocation:!0,hideOpacity:!0,state:_i.BV.beta,create:async(r,e,t,i)=>{const n={...Xt,...e?.config},s=await(0,St.cJ)(e.location),o=new en(s),a=new Be({source:o});let l=[];return a.setStyle(h=>{let c=Js,d=1/0;l.length>0&&(d=h.get("rowIndex"),c=l[d]??Js);const u=new fe({image:new $s({src:c,radius:n.radius,crop:n.crop,kind:n.kind,shadow:!1,stroke:new Te({width:0,color:"rgba(0,0,0,0)"}),onload:()=>{a.changed(),on&&!on.includes(d)&&on.push(d)}})}),g=new fe({image:new $s({src:Ac,radius:n.radius,crop:!1,kind:n.kind,shadow:n.shadow,stroke:new Te({width:n.border??0,color:i.visualization.getColorByName(n.color)}),onload:()=>{a.changed()}})}),f=new fe({image:new $s({src:Js,radius:n.radius,crop:!1,kind:n.kind,shadow:!1,stroke:new Te({width:0,color:"rgba(0,0,0,0)"}),onload:()=>{a.changed()}})});return on&&on.includes(d)?[g,u]:[g,f,u]}),{init:()=>a,update:h=>{if(!h.series?.length){o.clear();return}for(const c of h.series){if(o.update(c),n.src){const d=(0,An.findField)(c,n.src);d&&(l=d?.values)}else for(let d=0;d<c.fields.length;d++){const u=c.fields[d];if(u.type===M.fS.string){l=u.values;break}}break}},registerOptionsUI:h=>{h.addFieldNamePicker({path:"config.src",name:"Image Source field",settings:{filter:c=>c.type===M.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:Xt.kind}).addBooleanSwitch({path:"config.crop",name:"Crop",settings:{},defaultValue:Xt.crop}).addBooleanSwitch({path:"config.shadow",name:"Shadow",settings:{},defaultValue:Xt.shadow}).addSliderInput({path:"config.border",name:"Border",settings:{min:0,max:10},defaultValue:Xt.border}).addColorPicker({path:"config.color",name:"Border color",defaultValue:Xt.color,settings:[{enableNamedColors:!1}]}).addSliderInput({path:"config.radius",name:"Radius",settings:{min:1,max:100},defaultValue:Xt.radius})}}},defaultOptions:Xt};var kc=S(44727),Bc=S(96750);const an={style:{...X.Er,opacity:1,lineWidth:2},arrow:0},No="route",$u={type:No,name:"",config:an,location:{mode:Ne.q1.Auto},tooltip:!1},zc={id:No,name:"Route",description:"Render data points as a route",isBaseMap:!1,showLocation:!0,state:_i.BV.beta,create:async(r,e,t,i)=>{const n={...an,...e?.config},s=await Ut(n.style),o=await(0,St.cJ)(e.location),a=new en(o),l=new Be({source:a}),h=n.arrow===1||n.arrow===-1;if(!s.fields&&!h){const p=Is(s.base);s.config.size&&s.config.size.fixed&&p.getStroke().setWidth(s.config.size.fixed),l.setStyle(p)}else l.setStyle(p=>{const v=p.get("rowIndex"),y=s.dims;if(!y||!(0,E.isNumber)(v))return Is(s.base);const w=[],T=p.getGeometry(),L=s.config.opacity??1;if(T instanceof Ti.ZP){const A=T.getCoordinates();if(A){let z=0;const H=2;for(let K=0;K<A.length-1;K++){const le=A[z],he=A[K+1],Q=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(z))??s.base.color)).setAlpha(L).toString(),me=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(K+1))??s.base.color)).setAlpha(L).toString(),re=(y.size&&y.size.get(z))??s.base.size,Y=(y.size&&y.size.get(K+1))??s.base.size,N=new Oo({visible:!0,lineCap:n.arrow===0?"round":"square",color:Q,color2:me,width:(y.size&&y.size.get(z))??s.base.size,width2:(y.size&&y.size.get(K+1))??s.base.size});if(n.arrow&&(N.setArrow(n.arrow),n.arrow>0?(N.setArrowColor(me),N.setArrowSize((Y??0)*1.5)):(N.setArrowColor(Q),N.setArrowSize((re??0)*1.5))),(0,tt.uH)(r,H,le,he)){const $=new He.Z([le,he]);N.setGeometry($),w.push(N),z=K+1}}if(w.length===0){const K=new Mt.Z(A[0]),le=((y.size&&y.size.get(0))??s.base.size??10)/2,he=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(0))??s.base.color)).setAlpha(L).toString(),Q=new fe({image:new Ct({radius:le,fill:new Se({color:he})})});Q.setGeometry(K),w.push(Q)}}return w}const P={...s.base};return y.color&&(P.color=y.color.get(v)),Is(P)});const c=new Ke.Z({}),d=(s.base.lineWidth||6)+2,u=new fe({image:new Ct({radius:d,stroke:new Te({color:(0,Bc.alpha)(s.base.color,.4),width:d+2}),fill:new Se({color:s.base.color})})}),g=new Be({source:new pt({features:[c]}),style:u}),f=new Gn.Z({layers:[l,g]}),m=new j.w0;return m.add(t.getStream(ee.es).pipe((0,kc.p)(8)).subscribe({next:p=>{const y=a.getFeatures()[0]?.get("frame"),w=p.payload?.point?.time;if(y&&w){const T=y.fields.find(L=>L.name===M.Ls);if(T){const L=T.values,P=Gc(L,w);if(P!==null){const A=(0,St.g6)(y,o);A.field&&(c.setGeometry(A.field.values[P]),c.setStyle(u))}}}}})),m.add(t.subscribe(ee.xH,p=>{c.setStyle(new fe({}))})),{init:()=>f,dispose:()=>m.unsubscribe(),update:p=>{if(p.series?.length)for(const v of p.series){(s.fields||h)&&(s.dims=(0,tt.vV)(v,s,i)),a.updateLineString(v);break}},registerOptionsUI:p=>{p.addCustomEditor({id:"config.style",path:"config.style",name:"Style",editor:ni,settings:{simpleFixedValues:!1},defaultValue:an.style}).addRadio({path:"config.arrow",name:"Arrow",settings:{options:[{label:"None",value:0},{label:"Forward",value:1},{label:"Reverse",value:-1}]},defaultValue:an.arrow})}}},defaultOptions:an};function Gc(r,e){if(r.length===0)return null;if(r.length===1)return 0;const t=r.length-1;if(e<r[0])return 0;if(e>r[t])return t;const i=Math.abs(Math.round(t*(e-r[0])/(r[t]-r[0])));if(e<r[i]){for(let n=i;n>0;n--)if(e>r[n])return n;return 0}else{for(let n=i;n<t;n++)if(e<r[n])return n;return t}}const Zo=[Vl,bc,Lc,Hh,Xh,Zh,zc,Oc,Pc],ki={type:"default",name:"",config:{}},Wo={id:ki.type,name:"Default base layer",isBaseMap:!0,create:(r,e,t,i)=>{const n=fi.config?.geomapDefaultBaseLayerConfig?.type;if(n){const s=ln.getIfExists(n);if(!s)throw new Error("Invalid basemap configuration on server");return s.create(r,fi.config.geomapDefaultBaseLayerConfig,t,i)}return fo.create(r,e,t,i)}},ln=new Dn.B(()=>[Wo,...Ns,...Zo]);function Uo(r,e){const t={options:[],current:[]},i=[];for(const n of r){const s={label:n.name,value:n.id,description:n.description};switch(n.state){case _i.BV.alpha:if(!fi.Oh)break;s.label=`${n.name} (Alpha)`,s.icon="bolt",i.push(s);break;case _i.BV.beta:s.label=`${n.name} (Beta)`;default:t.options.push(s)}n.id===e&&t.current.push(s)}for(const n of i)t.options.push(n);return t}function Xo(r,e){return Uo(r?[Wo,...Ns]:[...Zo,...Ns],e)}const Ju={layers:[]},Vo={allLayers:!0,id:"zero",lat:0,lon:0,zoom:1};var Bi=(r=>(r.Details="details",r.None="none",r))(Bi||{}),Nc=(r=>(r.Coords="coords",r.Fit="fit",r.Zero="zero",r))(Nc||{}),Zc=S(69966),Yo=S(76178);const qs=(r,e,t)=>{if(r.update){let i=t;if(e.filterData){const n=(0,Yo.b9)(e.filterData);i={...i,series:i.series.filter(n)}}r.update(i)}};async function Wc(r,e,t){if(!r.map)return!1;const i=r.byName.get(e);if(!i)return!1;let n=-1;const s=r.map?.getLayers();for(let a=0;a<s?.getLength();a++)if(s.item(a)===i.layer){n=a;break}if(t.name!==e){if(!t.name)t.name=e;else if(r.byName.has(t.name))return!1;r.byName.delete(e),e=t.name,r.byName.set(e,i)}i.options.type,t.type;const o=r.layers.slice(0);try{const a=await Hn(r,r.map,t,i.isBasemap);o[n]?.handler.dispose?.(),o[n]=a,s.setAt(n,a.layer),qs(a.handler,t,r.props.data)}catch(a){return console.warn("ERROR",a),!1}return r.setState({legends:[]}),r.layers=o,r.doOptionsUpdate(n),!0}async function Hn(r,e,t,i){i&&(!t?.type||Xe.config.geomapDisableCustomBaseLayer)&&(t=ki),t?.type||(t={type:bs,name:(0,tt.FB)(r),config:{}});const n=ln.getIfExists(t.type);if(!n)return Promise.reject("unknown layer: "+t.type);t.config?.attribution&&(t.config.attribution=Kr.QX.sanitizeTextPanelContent(t.config.attribution));const s=await n.create(e,t,r.props.eventBus,Xe.config.theme2),o=s.init();t.opacity!=null&&o.setOpacity(t.opacity),t.name||(t.name=(0,tt.FB)(r));const a=t.name,l={isBasemap:i,options:t,layer:o,handler:s,mouseEvents:new Zc.x,getName:()=>a,onChange:h=>{Wc(r,a,h)}};return r.byName.set(a,l),l.layer.__state=l,qs(s,t,r.props.data),l}const jo=r=>r?.__state,Uc=r=>({selectLayer:t=>{const i=r.layers.findIndex(n=>n.options.name===t);r.panelContext&&r.panelContext.onInstanceStateChange&&r.panelContext.onInstanceStateChange({map:r.map,layers:r.layers,selected:i,actions:r.actions})},canRename:t=>!r.byName.has(t),deleteLayer:t=>{const i=[];for(const n of r.layers)n.options.name===t?r.map?.removeLayer(n.layer):i.push(n);r.layers=i,r.doOptionsUpdate(0)},addlayer:t=>{const i=ln.getIfExists(t);i&&Hn(r,r.map,{type:i.id,name:(0,tt.FB)(r),config:(0,E.cloneDeep)(i.defaultOptions),location:i.showLocation?{mode:Ne.q1.Auto}:void 0,tooltip:!0,...!i.hideOpacity&&{opacity:X.Er.opacity}},!1).then(n=>{r.layers=r.layers.slice(0),r.layers.push(n),r.map?.addLayer(n.layer),r.doOptionsUpdate(r.layers.length-1)})},reorder:(t,i)=>{const n=Array.from(r.layers),[s]=n.splice(t,1);n.splice(i,0,s),r.layers=n,r.doOptionsUpdate(i);const o=r.map?.getLayers();o.clear(),r.layers.forEach(a=>o.push(a.layer))}});function Xc(r=[],e=!1,t=!1,i){return r.filter(n=>n.layer instanceof Be||n.layer instanceof Gn.Z).flatMap(n=>{const s=n.layer;if(s instanceof Gn.Z)return Vc(s);if(s instanceof Be){if(e)return[s.getSource().getExtent()];if(t&&i===n.options.name){const o=s.getSource().getFeatures(),l=o[o.length-1]?.getGeometry();return l?[l.getExtent()]:[]}else if(!t&&i===n.options.name)return[s.getSource().getExtent()];return[]}else return[]}).reduce(C.l7,(0,C.lJ)())}function Vc(r){return r.getLayers().getArray().filter(e=>e instanceof Be).map(e=>e instanceof Be?e.getSource().getExtent()??[]:[])}const Yc=r=>{r.map?.on("singleclick",r.pointerClickListener),r.map?.on("pointermove",(0,E.debounce)(r.pointerMoveListener,200)),r.map?.getViewport().addEventListener("mouseout",e=>{r.props.eventBus.publish(new ee.xH)})},jc=(r,e)=>{Ho(r,e)&&(r.preventDefault(),r.stopPropagation(),e.mapDiv.style.cursor="auto",e.setState({ttipOpen:!0}))},Ho=(r,e)=>{if(e.state.measureMenuActive)return!0;if(!e.map||e.state.ttipOpen&&e.state?.ttip?.layers?.length)return!1;const t=r.originalEvent,i=e.map.getEventPixel(t),n=(0,W.bU)(e.map.getCoordinateFromPixel(i)),{hoverPayload:s}=e;s.pageX=t.pageX,s.pageY=t.pageY,s.point={lat:n[1],lon:n[0]},s.data=void 0,s.columnIndex=void 0,s.rowIndex=void 0,s.layers=void 0;const o=[],a=new Map;let l={};e.map.forEachFeatureAtPixel(i,(c,d,u)=>{const g=jo(d);if(!s.data){const f=c.getProperties(),m=f.frame;m&&(s.data=l.data=m,s.rowIndex=l.rowIndex=f.rowIndex),g?.mouseEvents&&g.mouseEvents.next(c)}if(g){let f=a.get(g);f||(f={layer:g,features:[]},a.set(g,f),o.push(f)),f.features.push(c)}},{layerFilter:c=>jo(c)?.options?.tooltip!==!1}),e.hoverPayload.layers=o.length?o:void 0,e.props.eventBus.publish(e.hoverEvent),(e.state.ttip===void 0||e.state.ttip?.layers!==s.layers||s.layers)&&e.setState({ttip:{...s}}),o.length||e.layers.forEach(c=>{c.mouseEvents.next(void 0)});const h=!!o.length;return e.mapDiv.style.cursor=h?"pointer":"auto",h};var yt=(r=>(r.Zero="zero",r.Coordinates="coords",r.Fit="fit",r))(yt||{});const hn=new Dn.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 Ko;class $o extends _.Component{constructor(e){super(e),this.panelContext=void 0,this.subs=new j.w0,this.globalCSS=Fl(Xe.config.theme2),this.hoverPayload={point:{},pageX:-1,pageY:-1},this.hoverEvent=new ee.es(this.hoverPayload),this.layers=[],this.byName=new Map,this.actions=Uc(this),this.initMapRef=async t=>{if(!t)return;this.mapDiv=t,this.map&&this.map.dispose();const{options:i}=this.props,n=(0,tt.n_)(this,i,t);this.byName.clear();const s=[];try{s.push(await Hn(this,n,i.basemap??ki,!0)),i.layers||(i.layers=[Ls]);for(const o of i.layers)s.push(await Hn(this,n,o,!1))}catch(o){console.error("error loading layers",o)}for(const o of s)n.addLayer(o.layer);this.layers=s,this.map=n,this.initViewExtent(n.getView(),i.view),this.mouseWheelZoom=new V.Z,this.map?.addInteraction(this.mouseWheelZoom),(0,tt.sA)(this,i),Yc(this),(0,tt.gE)(this,s,s.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=>{jc(t,this)},this.pointerMoveListener=t=>{Ho(t,this)},this.initMapView=(t,i)=>{let n=new Ft.ZP({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(ce.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(s=>{s instanceof Ur&&(this.map?.removeLayer(s),this.map?.addLayer(s))}),i({...t,basemap:n[0].options,layers:n.slice(1).map(s=>s.options)}),(0,tt.gE)(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,Ko);Ko=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)qs(i.handler,i.options,this.props.data);const t=hn.getIfExists(this.props.options.view.id);if(t&&t.id===yt.Fit){const[,i]=this.initMapView(this.props.options.view);this.map&&i&&this.map.setView(i)}}initViewExtent(e,t){const i=hn.getIfExists(t.id);if(i){let n;if(i.lat==null){if(i.id===yt.Coordinates)n=[t.lon??0,t.lat??0];else if(i.id===yt.Fit){const s=Xc(this.layers,t.allLayers,t.lastOnly,t.layer);if(!(0,C.xb)(s)){const o=t.padding??5,a=e.getResolutionForExtent(s,this.map?.getSize()),l=t.zoom??t.maxZoom;e.fit(s,{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,W.mi)(n))}t.maxZoom&&e.setMaxZoom(t.maxZoom),t.minZoom&&e.setMaxZoom(t.minZoom),t.zoom&&i?.id!==yt.Fit&&e.setZoom(t.zoom)}initControls(e){if(!this.map)return;this.map.getControls().clear(),e.showZoom&&this.map.addControl(new B.Z),e.showScale&&this.map.addControl(new k({units:e.scaleUnits,minWidth:100})),this.mouseWheelZoom.setActive(!!e.mouseWheelZoom),e.showAttribution&&this.map.addControl(new zt.Z({collapsed:!0,collapsible:!0}));let t=[];e.showMeasure&&(t=[_.createElement(bl,{key:"measure",map:this.map,menuActiveState:n=>{this.setState({ttipOpen:n,measureMenuActive:n})}})]);let i=[];e.showDebug&&(i=[_.createElement(aa,{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(_.createElement("div",{key:t.options.name},t.handler.legend));return e}render(){let{ttip:e,ttipOpen:t,topRight1:i,legends:n,topRight2:s}=this.state;const{options:o}=this.props,a=o.controls.showScale;return!t&&o.tooltip?.mode===Bi.None&&(e=void 0),_.createElement(_.Fragment,null,_.createElement(Ye.Global,{styles:this.globalCSS}),_.createElement("div",{className:Jo.wrap,onMouseLeave:this.clearTooltip},_.createElement("div",{className:Jo.map,ref:this.initMapRef}),_.createElement(pe,{bottomLeft:n,topRight1:i,topRight2:s,blStyle:{bottom:a?"35px":"8px"}})),_.createElement(mn,{ttip:e,isOpen:t,onClose:this.tooltipPopupClosed}))}}$o.contextType=ge.bb;const Jo={wrap:(0,te.css)` position: relative; width: 100%; height: 100%; `,map:(0,te.css)` position: absolute; z-index: 0; width: 100%; height: 100%; `};var Hc=S(92791),Qs=S(85532),Kc=S(73453),$c=S(84270);const Jc="layer-drag-drop-list",qo=({layers:r,getLayerInfo:e,onDragEnd:t,onSelect:i,onDelete:n,onDuplicate:s,showActions:o,selection:a,excludeBaseLayer:l,onNameChange:h,verifyLayerNameUniqueness:c})=>{const d=(0,xe.wW)(qc),u=g=>g?`${d.row} ${d.sel}`:d.row;return _.createElement(Qs.Z5,{onDragEnd:t},_.createElement(Qs.bK,{droppableId:"droppable"},(g,f)=>_.createElement("div",{...g.droppableProps,ref:g.innerRef,"data-testid":Jc},(()=>{const m=[],p=l?1:0,v=l?2:1;for(let y=r.length-1;y>=p;y--){const w=r[y],T=w.getName(),L=!!a?.includes(T);m.push(_.createElement(Qs._l,{key:T,draggableId:T,index:m.length},(P,A)=>_.createElement("div",{className:u(L),ref:P.innerRef,...P.draggableProps,...P.dragHandleProps,onMouseDown:()=>i(w),role:"button",tabIndex:0},_.createElement($c.X,{name:T,onChange:z=>h(w,z),verifyLayerNameUniqueness:c??void 0}),_.createElement("div",{className:d.textWrapper},"\xA0 ",e(w)),o(w)&&_.createElement(_.Fragment,null,s?_.createElement(ns.h,{name:"copy",tooltip:"Duplicate",className:d.actionIcon,onClick:()=>s(w)}):null,_.createElement(ns.h,{name:"trash-alt",tooltip:"Remove",className:(0,te.cx)(d.actionIcon,d.dragIcon),onClick:()=>n(w)})),r.length>v&&_.createElement(Kc.J,{"aria-label":"Drag and drop icon",title:"Drag and drop to reorder",name:"draggabledots",size:"lg",className:d.dragIcon}))))}return m})(),g.placeholder)))};qo.defaultProps={isGroup:()=>!1};const qc=r=>({wrapper:(0,te.css)` margin-bottom: ${r.spacing(2)}; `,row:(0,te.css)` padding: ${r.spacing(.5,1)}; border-radius: ${r.shape.borderRadius(1)}; background: ${r.colors.background.secondary}; min-height: ${r.spacing(4)}; display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; cursor: pointer; border: 1px solid ${r.components.input.borderColor}; &:hover { border: 1px solid ${r.components.input.borderHover}; } `,sel:(0,te.css)` border: 1px solid ${r.colors.primary.border}; &:hover { border: 1px solid ${r.colors.primary.border}; } `,dragIcon:(0,te.css)` cursor: drag; `,actionIcon:(0,te.css)` color: ${r.colors.text.secondary}; &:hover { color: ${r.colors.text}; } `,typeWrapper:(0,te.css)` color: ${r.colors.primary.text}; margin-right: 5px; `,textWrapper:(0,te.css)` display: flex; align-items: center; flex-grow: 1; overflow: hidden; margin-right: ${r.spacing(1)}; `}),Qc=r=>{const{layers:e,selected:t,actions:i}=r.context.instanceState??{};if(!e||!i)return _.createElement("div",null,"No layers?");const n=c=>{if(!c.destination)return;const{layers:d,actions:u}=r.context.instanceState??{};if(!d||!u)return;const g=d.length-1,f=(c.source.index-g)*-1,m=(c.destination.index-g)*-1;u.reorder(f,m)},s=c=>{i.selectLayer(c.options.name)},o=c=>{i.deleteLayer(c.options.name)},a=c=>c.options.type,l=(c,d)=>{c.onChange({...c.options,name:d})},h=t?[e[t]?.getName()]:[];return _.createElement(_.Fragment,null,_.createElement(Ss.W2,null,_.createElement(Hc.f,{onChange:c=>i.addlayer(c.value),options:Xo(!1).options,label:"Add layer"})),_.createElement("br",null),_.createElement(qo,{layers:e,showActions:()=>e.length>2,getLayerInfo:a,onDragEnd:n,onSelect:s,onDelete:o,selection:h,excludeBaseLayer:!0,onNameChange:l,verifyLayerNameUniqueness:i.canRename}))},eu=({labelWidth:r,value:e,onChange:t})=>{const i=s=>{t({...e,lat:s})},n=s=>{t({...e,lon:s})};return _.createElement(_.Fragment,null,_.createElement(Tt.Z,null,_.createElement(lt._,{label:"Latitude",labelWidth:r,grow:!0},_.createElement(rn.Y,{value:e.lat,min:-90,max:90,step:.001,onChange:i}))),_.createElement(Tt.Z,null,_.createElement(lt._,{label:"Longitude",labelWidth:r,grow:!0},_.createElement(rn.Y,{value:e.lon,min:-180,max:180,step:.001,onChange:n}))))};var Qo=(r=>(r.all="all",r.layer="layer",r.last="last",r))(Qo||{}),ea=(r=>(r.all="All layers",r.layer="Layer",r.last="Last value",r))(ea||{});const tu=Object.values(Qo).map(r=>({label:ea[r],value:r})),iu=({labelWidth:r,value:e,onChange:t,context:i})=>{const n=(0,_.useMemo)(()=>i.options?.layers?i.options.layers.map(d=>({label:d.name,value:d.name,description:void 0})):[],[i.options?.layers]),s=(0,_.useCallback)(d=>{t({...e,layer:d.value})},[e,t]),o=_.createElement(Tt.Z,null,_.createElement(lt._,{label:"Layer",labelWidth:r,grow:!0},_.createElement(Ei.Ph,{options:n,onChange:s,placeholder:n[0]?.label}))),a=d=>{t({...e,padding:d})},l=_.createElement(Tt.Z,null,_.createElement(lt._,{label:"Padding",labelWidth:r,grow:!0,tooltip:"sets padding in relative percent beyond data extent"},_.createElement(rn.Y,{value:e?.padding??5,min:0,step:1,onChange:a}))),h=e.allLayers?"all":!e.allLayers&&e.lastOnly?"last":"layer",c=d=>{d!=="all"&&!e.layer?t({...e,allLayers:d==="all",lastOnly:d==="last",layer:n[0].value}):t({...e,allLayers:d==="all",lastOnly:d==="last"})};return _.createElement(_.Fragment,null,_.createElement(Tt.Z,null,_.createElement(lt._,{label:"Data",labelWidth:r,grow:!0},_.createElement(pn.S,{value:h,options:tu,onChange:c}))),!e?.allLayers&&o,!e?.lastOnly&&l)},nu=({value:r,onChange:e,context:t})=>{const n=(0,_.useMemo)(()=>{const a=[];return r?.id?a.push(r.id):a.push(hn.list()[0].id),hn.selectOptions(a)},[r?.id]),s=(0,_.useCallback)(()=>{const a=t.instanceState?.map;if(a){const l=a.getView(),h=l.getCenter();if(h){const c=(0,W.bU)(h,l.getProjection());e({...r,id:yt.Coordinates,lon:+c[0].toFixed(6),lat:+c[1].toFixed(6),zoom:+l.getZoom().toFixed(2)})}}},[r,e,t.instanceState]),o=(0,_.useCallback)(a=>{const l=hn.getIfExists(a.value);l&&e({...r,id:l.id,lat:l.lat??r?.lat,lon:l.lon??r?.lon,zoom:l.zoom??r?.zoom})},[r,e]);return _.createElement(_.Fragment,null,_.createElement(Tt.Z,null,_.createElement(lt._,{label:"View",labelWidth:10,grow:!0},_.createElement(Ei.Ph,{options:n.options,value:n.current,onChange:o}))),r.id===yt.Coordinates&&_.createElement(eu,{labelWidth:10,value:r,onChange:e}),r.id===yt.Fit&&_.createElement(iu,{labelWidth:10,value:r,onChange:e,context:t}),_.createElement(Tt.Z,null,_.createElement(lt._,{label:r?.id===yt.Fit?"Max Zoom":"Zoom",labelWidth:10,grow:!0},_.createElement(rn.Y,{value:r?.zoom??1,min:1,max:18,step:.01,onChange:a=>{e({...r,zoom:a})}}))),_.createElement(Ss.wc,null,_.createElement(_n.zx,{variant:"secondary",size:"sm",fullWidth:!0,onClick:s},_.createElement("span",null,"Use current map settings"))))};var su=S(11778),ru=S(79357),ou=S(65604);function ta(r){return{category:r.category,path:"--",defaultValue:r.basemaps?ki:Ls,values:e=>({getContext:t=>({...t,options:r.state.options,instanceState:r.state}),getValue:t=>(0,E.get)(r.state.options,t),onChange:(t,i)=>{const{state:n}=r,{options:s}=n;if(t==="type"&&i){const o=ln.getIfExists(i);if(o){const a={...s,type:o.id,config:{...o.defaultOptions}};o.showLocation&&(a.location?.mode?delete a.location:a.location={mode:Ne.q1.Auto}),n.onChange(a);return}}n.onChange((0,su.hs)(s,t,i))}}),build:(e,t)=>{if(!r.state)return;const{handler:i,options:n}=r.state,s=ln.getIfExists(n?.type),o=Xo(r.basemaps,n?.type?n.type:ki.type);if(e.addSelect({path:"type",name:"Layer type",settings:{options:o.options}}),i.update&&e.addCustomEditor({id:"filterData",path:"filterData",name:"Data",editor:ou.M,defaultValue:void 0}),!!s&&n.type!==ki.type){if(s.showLocation){let a=t.data;if(n.filterData){const l=(0,Yo.b9)(n.filterData);a=a.filter(l)}(0,ru.C)("Location","location.",e,n.location,a)}i.registerOptionsUI&&i.registerOptionsUI(e,t),(0,E.isEqual)(r.category,["Base layer"])||(s.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 au=S(66656),lu=S(14544),hu=S(5168);const cu=(r,e,t,i)=>{if(e==="grafana-worldmap-panel"&&t.angular){const{fieldConfig:n,options:s,xform:o}=uu({...t.angular,fieldConfig:i});return o?.id?.length&&(r.transformations=r.transformations?[...r.transformations,o]:[o]),r.fieldConfig=n,s}return{}};function uu(r){const e={defaults:{},overrides:[]},t=(0,E.cloneDeep)(Ls),i={view:{id:yt.Zero},controls:{showZoom:!0,mouseWheelZoom:!!r.mouseWheelZoom},basemap:{type:"default",name:"Basemap"},layers:[t],tooltip:{mode:Bi.Details}};let n=zi(r.decimals);n&&(e.defaults.decimals=n);const s=t.config.style;n=zi(r.circleMaxSize),n&&(s.size.max=n),n=zi(r.circleMinSize),n&&(s.size.min=n);let o;const a=au.TB.getIfExists(r.valueName);if(a&&r.locationData?.length)switch(o={id:lu.W.reduce,options:{reducers:[a.id]}},r.locationData){case"countries":case"countries_3letter":t.location={mode:Ne.q1.Lookup,gazetteer:"public/gazetteer/countries.json",lookup:void 0};break;case"states":t.location={mode:Ne.q1.Lookup,gazetteer:"public/gazetteer/usa-states.json",lookup:void 0};break}if(r.thresholds&&r.colors){const h=r.thresholds.split(",").map(d=>Number(d.trim())),c=[];for(const d of r.colors){const u=c.length-1;u>=0?c.push({value:h[u],color:d}):c.push({value:-1/0,color:d})}e.defaults.thresholds={mode:hu.H.Absolute,steps:c}}n=zi(r.initialZoom),n&&(i.view.zoom=n);const l={"(0\xB0, 0\xB0)":yt.Zero,"North America":"north-america",Europe:"europe","West Asia":"west-asia","SE Asia":"se-asia","Last GeoHash":yt.Coordinates};return i.view.id=l[r.mapCenter],i.view.lat=zi(r.mapCenterLatitude),i.view.lon=zi(r.mapCenterLongitude),{fieldConfig:e,options:i,xform:o}}function zi(r){const e=Number(r);return isNaN(e)?void 0:e}const du=r=>{const e=r?.pluginVersion??"";if((e.startsWith("8.1")||e.startsWith("8.2"))&&r.options?.layers?.length===1){const i=r.options.layers[0];if(i?.type==="markers"&&i.config){const n=i.config,s={style:(0,E.cloneDeep)(X.Er),showLegend:!!n.showLegend};n.size&&(s.style.size=n.size),n.color&&(s.style.color=n.color),n.fillOpacity&&(s.style.opacity=n.fillOpacity);const o=Ul(n.shape);return o&&(s.style.symbol={fixed:o,mode:Ne.Q8.Fixed}),{...r.options,layers:[{...i,config:s}]}}}return r.options},fu=new ie.c($o).setNoPadding().setPanelChangeHandler(cu).setMigrationHandler(du).useFieldConfig({useCustomConfig:r=>{Ve.B(r)}}).setPanelOptions((r,e)=>{let t=["Map view"];r.addCustomEditor({category:t,id:"view",path:"view",name:"Initial view",description:"This location will show when the panel first loads.",editor:nu,defaultValue:Vo}),r.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:Vo.shared});const i=e.instanceState;if(i?.layers){const n=["Map layers"],s=["Basemap layer"];r.addCustomEditor({category:n,id:"layers",path:"",name:"",editor:Qc});const o=i.layers[i.selected];i.selected&&o&&r.addNestedOptions(ta({state:o,category:n,basemaps:!1}));const a=i.layers[0];Xe.config.geomapDisableCustomBaseLayer?r.addCustomEditor({category:s,id:"layers",path:"",name:"",editor:()=>_.createElement("div",null,"The basemap layer is configured by the server admin.")}):a&&r.addNestedOptions(ta({state:a,category:s,basemaps:!0}))}t=["Map controls"],r.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:Bi.Details,settings:{options:[{label:"None",value:Bi.None,description:"Show contents on click, not hover"},{label:"Details",value:Bi.Details,description:"Show popup on hover"}]}})})},83071:Lt=>{"use strict";Lt.exports=we,Lt.exports.default=we;function we(x,I,E){E=E||2;var M=I&&I.length,F=M?I[0]*E:x.length,D=S(x,0,F,E,!0),O=[];if(!D||D.next===D.prev)return O;var Z,oe,ne,Fe,Re,ye,ze;if(M&&(D=Ft(x,I,D,E)),x.length>80*E){Z=ne=x[0],oe=Fe=x[1];for(var be=E;be<F;be+=E)Re=x[be],ye=x[be+1],Re<Z&&(Z=Re),ye<oe&&(oe=ye),Re>ne&&(ne=Re),ye>Fe&&(Fe=ye);ze=Math.max(ne-Z,Fe-oe),ze=ze!==0?32767/ze:0}return ie(D,O,E,Z,oe,ze,0),O}function S(x,I,E,M,F){var D,O;if(F===dt(x,I,E,M)>0)for(D=I;D<E;D+=M)O=Pe(D,x[D],x[D+1],O);else for(D=E-M;D>=I;D-=M)O=Pe(D,x[D],x[D+1],O);return O&&C(O,O.next)&&(je(O),O=O.next),O}function _(x,I){if(!x)return x;I||(I=x);var E=x,M;do if(M=!1,!E.steiner&&(C(E,E.next)||B(E.prev,E,E.next)===0)){if(je(E),E=I=E.prev,E===E.next)break;M=!0}else E=E.next;while(M||E!==I);return I}function ie(x,I,E,M,F,D,O){if(x){!O&&D&&ue(x,M,F,D);for(var Z=x,oe,ne;x.prev!==x.next;){if(oe=x.prev,ne=x.next,D?Ve(x,M,F,D):Xe(x)){I.push(oe.i/E|0),I.push(x.i/E|0),I.push(ne.i/E|0),je(x),x=ne.next,Z=ne.next;continue}if(x=ne,x===Z){O?O===1?(x=te(_(x),I,E),ie(x,I,E,M,F,D,2)):O===2&&Ye(x,I,E,M,F,D):ie(_(x),I,E,M,F,D,1);break}}}}function Xe(x){var I=x.prev,E=x,M=x.next;if(B(I,E,M)>=0)return!1;for(var F=I.x,D=E.x,O=M.x,Z=I.y,oe=E.y,ne=M.y,Fe=F<D?F<O?F:O:D<O?D:O,Re=Z<oe?Z<ne?Z:ne:oe<ne?oe:ne,ye=F>D?F>O?F:O:D>O?D:O,ze=Z>oe?Z>ne?Z:ne:oe>ne?oe:ne,be=M.next;be!==I;){if(be.x>=Fe&&be.x<=ye&&be.y>=Re&&be.y<=ze&&b(F,Z,D,oe,O,ne,be.x,be.y)&&B(be.prev,be,be.next)>=0)return!1;be=be.next}return!0}function Ve(x,I,E,M){var F=x.prev,D=x,O=x.next;if(B(F,D,O)>=0)return!1;for(var Z=F.x,oe=D.x,ne=O.x,Fe=F.y,Re=D.y,ye=O.y,ze=Z<oe?Z<ne?Z:ne:oe<ne?oe:ne,be=Fe<Re?Fe<ye?Fe:ye:Re<ye?Re:ye,ui=Z>oe?Z>ne?Z:ne:oe>ne?oe:ne,di=Fe>Re?Fe>ye?Fe:ye:Re>ye?Re:ye,gn=rt(ze,be,I,E,M),mn=rt(ui,di,I,E,M),de=x.prevZ,ve=x.nextZ;de&&de.z>=gn&&ve&&ve.z<=mn;){if(de.x>=ze&&de.x<=ui&&de.y>=be&&de.y<=di&&de!==F&&de!==O&&b(Z,Fe,oe,Re,ne,ye,de.x,de.y)&&B(de.prev,de,de.next)>=0||(de=de.prevZ,ve.x>=ze&&ve.x<=ui&&ve.y>=be&&ve.y<=di&&ve!==F&&ve!==O&&b(Z,Fe,oe,Re,ne,ye,ve.x,ve.y)&&B(ve.prev,ve,ve.next)>=0))return!1;ve=ve.nextZ}for(;de&&de.z>=gn;){if(de.x>=ze&&de.x<=ui&&de.y>=be&&de.y<=di&&de!==F&&de!==O&&b(Z,Fe,oe,Re,ne,ye,de.x,de.y)&&B(de.prev,de,de.next)>=0)return!1;de=de.prevZ}for(;ve&&ve.z<=mn;){if(ve.x>=ze&&ve.x<=ui&&ve.y>=be&&ve.y<=di&&ve!==F&&ve!==O&&b(Z,Fe,oe,Re,ne,ye,ve.x,ve.y)&&B(ve.prev,ve,ve.next)>=0)return!1;ve=ve.nextZ}return!0}function te(x,I,E){var M=x;do{var F=M.prev,D=M.next.next;!C(F,D)&&V(F,M,M.next,D)&&ce(F,D)&&ce(D,F)&&(I.push(F.i/E|0),I.push(M.i/E|0),I.push(D.i/E|0),je(M),je(M.next),M=x=D),M=M.next}while(M!==x);return _(M)}function Ye(x,I,E,M,F,D){var O=x;do{for(var Z=O.next.next;Z!==O.prev;){if(O.i!==Z.i&&k(O,Z)){var oe=pe(O,Z);O=_(O,O.next),oe=_(oe,oe.next),ie(O,I,E,M,F,D,0),ie(oe,I,E,M,F,D,0);return}Z=Z.next}O=O.next}while(O!==x)}function Ft(x,I,E,M){var F=[],D,O,Z,oe,ne;for(D=0,O=I.length;D<O;D++)Z=I[D]*M,oe=D<O-1?I[D+1]*M:x.length,ne=S(x,Z,oe,M,!1),ne===ne.next&&(ne.steiner=!0),F.push(R(ne));for(F.sort(zt),D=0;D<F.length;D++)E=Me(F[D],E);return E}function zt(x,I){return x.x-I.x}function Me(x,I){var E=Oe(x,I);if(!E)return I;var M=pe(E,x);return _(M,M.next),_(E,E.next)}function Oe(x,I){var E=I,M=x.x,F=x.y,D=-1/0,O;do{if(F<=E.y&&F>=E.next.y&&E.next.y!==E.y){var Z=E.x+(F-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(Z<=M&&Z>D&&(D=Z,O=E.x<E.next.x?E:E.next,Z===M))return O}E=E.next}while(E!==I);if(!O)return null;var oe=O,ne=O.x,Fe=O.y,Re=1/0,ye;E=O;do M>=E.x&&E.x>=ne&&M!==E.x&&b(F<Fe?M:D,F,ne,Fe,F<Fe?D:M,F,E.x,E.y)&&(ye=Math.abs(F-E.y)/(M-E.x),ce(E,x)&&(ye<Re||ye===Re&&(E.x>O.x||E.x===O.x&&W(O,E)))&&(O=E,Re=ye)),E=E.next;while(E!==oe);return O}function W(x,I){return B(x.prev,x,I.prev)<0&&B(I.next,x,x.next)<0}function ue(x,I,E,M){var F=x;do F.z===0&&(F.z=rt(F.x,F.y,I,E,M)),F.prevZ=F.prev,F.nextZ=F.next,F=F.next;while(F!==x);F.prevZ.nextZ=null,F.prevZ=null,De(F)}function De(x){var I,E,M,F,D,O,Z,oe,ne=1;do{for(E=x,x=null,D=null,O=0;E;){for(O++,M=E,Z=0,I=0;I<ne&&(Z++,M=M.nextZ,!!M);I++);for(oe=ne;Z>0||oe>0&&M;)Z!==0&&(oe===0||!M||E.z<=M.z)?(F=E,E=E.nextZ,Z--):(F=M,M=M.nextZ,oe--),D?D.nextZ=F:x=F,F.prevZ=D,D=F;E=M}D.nextZ=null,ne*=2}while(O>1);return x}function rt(x,I,E,M,F){return x=(x-E)*F|0,I=(I-M)*F|0,x=(x|x<<8)&16711935,x=(x|x<<4)&252645135,x=(x|x<<2)&858993459,x=(x|x<<1)&1431655765,I=(I|I<<8)&16711935,I=(I|I<<4)&252645135,I=(I|I<<2)&858993459,I=(I|I<<1)&1431655765,x|I<<1}function R(x){var I=x,E=x;do(I.x<E.x||I.x===E.x&&I.y<E.y)&&(E=I),I=I.next;while(I!==x);return E}function b(x,I,E,M,F,D,O,Z){return(F-O)*(I-Z)>=(x-O)*(D-Z)&&(x-O)*(M-Z)>=(E-O)*(I-Z)&&(E-O)*(D-Z)>=(F-O)*(M-Z)}function k(x,I){return x.next.i!==I.i&&x.prev.i!==I.i&&!ge(x,I)&&(ce(x,I)&&ce(I,x)&&xe(x,I)&&(B(x.prev,x,I.prev)||B(x,I.prev,I))||C(x,I)&&B(x.prev,x,x.next)>0&&B(I.prev,I,I.next)>0)}function B(x,I,E){return(I.y-x.y)*(E.x-I.x)-(I.x-x.x)*(E.y-I.y)}function C(x,I){return x.x===I.x&&x.y===I.y}function V(x,I,E,M){var F=ee(B(x,I,E)),D=ee(B(x,I,M)),O=ee(B(E,M,x)),Z=ee(B(E,M,I));return!!(F!==D&&O!==Z||F===0&&j(x,E,I)||D===0&&j(x,M,I)||O===0&&j(E,x,M)||Z===0&&j(E,I,M))}function j(x,I,E){return I.x<=Math.max(x.x,E.x)&&I.x>=Math.min(x.x,E.x)&&I.y<=Math.max(x.y,E.y)&&I.y>=Math.min(x.y,E.y)}function ee(x){return x>0?1:x<0?-1:0}function ge(x,I){var E=x;do{if(E.i!==x.i&&E.next.i!==x.i&&E.i!==I.i&&E.next.i!==I.i&&V(E,E.next,x,I))return!0;E=E.next}while(E!==x);return!1}function ce(x,I){return B(x.prev,x,x.next)<0?B(x,I,x.next)>=0&&B(x,x.prev,I)>=0:B(x,I,x.prev)<0||B(x,x.next,I)<0}function xe(x,I){var E=x,M=!1,F=(x.x+I.x)/2,D=(x.y+I.y)/2;do E.y>D!=E.next.y>D&&E.next.y!==E.y&&F<(E.next.x-E.x)*(D-E.y)/(E.next.y-E.y)+E.x&&(M=!M),E=E.next;while(E!==x);return M}function pe(x,I){var E=new Je(x.i,x.x,x.y),M=new Je(I.i,I.x,I.y),F=x.next,D=I.prev;return x.next=I,I.prev=x,E.next=F,F.prev=E,M.next=E,E.prev=M,D.next=M,M.prev=D,M}function Pe(x,I,E,M){var F=new Je(x,I,E);return M?(F.next=M.next,F.prev=M,M.next.prev=F,M.next=F):(F.prev=F,F.next=F),F}function je(x){x.next.prev=x.prev,x.prev.next=x.next,x.prevZ&&(x.prevZ.nextZ=x.nextZ),x.nextZ&&(x.nextZ.prevZ=x.prevZ)}function Je(x,I,E){this.i=x,this.x=I,this.y=E,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}we.deviation=function(x,I,E,M){var F=I&&I.length,D=F?I[0]*E:x.length,O=Math.abs(dt(x,0,D,E));if(F)for(var Z=0,oe=I.length;Z<oe;Z++){var ne=I[Z]*E,Fe=Z<oe-1?I[Z+1]*E:x.length;O-=Math.abs(dt(x,ne,Fe,E))}var Re=0;for(Z=0;Z<M.length;Z+=3){var ye=M[Z]*E,ze=M[Z+1]*E,be=M[Z+2]*E;Re+=Math.abs((x[ye]-x[be])*(x[ze+1]-x[ye+1])-(x[ye]-x[ze])*(x[be+1]-x[ye+1]))}return O===0&&Re===0?0:Math.abs((Re-O)/O)};function dt(x,I,E,M){for(var F=0,D=I,O=E-M;D<E;D+=M)F+=(x[O]-x[D])*(x[D+1]+x[O+1]),O=D;return F}we.flatten=function(x){for(var I=x[0][0].length,E={vertices:[],holes:[],dimensions:I},M=0,F=0;F<x.length;F++){for(var D=0;D<x[F].length;D++)for(var O=0;O<I;O++)E.vertices.push(x[F][D][O]);F>0&&(M+=x[F-1].length,E.holes.push(M))}return E}},45759:function(Lt){(function(we,S){Lt.exports=S()})(this,function(){"use strict";function we(R,b,k,B,C){(function V(j,ee,ge,ce,xe){for(;ce>ge;){if(ce-ge>600){var pe=ce-ge+1,Pe=ee-ge+1,je=Math.log(pe),Je=.5*Math.exp(2*je/3),dt=.5*Math.sqrt(je*Je*(pe-Je)/pe)*(Pe-pe/2<0?-1:1),x=Math.max(ge,Math.floor(ee-Pe*Je/pe+dt)),I=Math.min(ce,Math.floor(ee+(pe-Pe)*Je/pe+dt));V(j,ee,x,I,xe)}var E=j[ee],M=ge,F=ce;for(S(j,ge,ee),xe(j[ce],E)>0&&S(j,ge,ce);M<F;){for(S(j,M,F),M++,F--;xe(j[M],E)<0;)M++;for(;xe(j[F],E)>0;)F--}xe(j[ge],E)===0?S(j,ge,F):S(j,++F,ce),F<=ee&&(ge=F+1),ee<=F&&(ce=F-1)}})(R,b,k||0,B||R.length-1,C||_)}function S(R,b,k){var B=R[b];R[b]=R[k],R[k]=B}function _(R,b){return R<b?-1:R>b?1:0}var ie=function(R){R===void 0&&(R=9),this._maxEntries=Math.max(4,R),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function Xe(R,b,k){if(!k)return b.indexOf(R);for(var B=0;B<b.length;B++)if(k(R,b[B]))return B;return-1}function Ve(R,b){te(R,0,R.children.length,b,R)}function te(R,b,k,B,C){C||(C=De(null)),C.minX=1/0,C.minY=1/0,C.maxX=-1/0,C.maxY=-1/0;for(var V=b;V<k;V++){var j=R.children[V];Ye(C,R.leaf?B(j):j)}return C}function Ye(R,b){return R.minX=Math.min(R.minX,b.minX),R.minY=Math.min(R.minY,b.minY),R.maxX=Math.max(R.maxX,b.maxX),R.maxY=Math.max(R.maxY,b.maxY),R}function Ft(R,b){return R.minX-b.minX}function zt(R,b){return R.minY-b.minY}function Me(R){return(R.maxX-R.minX)*(R.maxY-R.minY)}function Oe(R){return R.maxX-R.minX+(R.maxY-R.minY)}function W(R,b){return R.minX<=b.minX&&R.minY<=b.minY&&b.maxX<=R.maxX&&b.maxY<=R.maxY}function ue(R,b){return b.minX<=R.maxX&&b.minY<=R.maxY&&b.maxX>=R.minX&&b.maxY>=R.minY}function De(R){return{children:R,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function rt(R,b,k,B,C){for(var V=[b,k];V.length;)if(!((k=V.pop())-(b=V.pop())<=B)){var j=b+Math.ceil((k-b)/B/2)*B;we(R,j,b,k,C),V.push(b,j,j,k)}}return ie.prototype.all=function(){return this._all(this.data,[])},ie.prototype.search=function(R){var b=this.data,k=[];if(!ue(R,b))return k;for(var B=this.toBBox,C=[];b;){for(var V=0;V<b.children.length;V++){var j=b.children[V],ee=b.leaf?B(j):j;ue(R,ee)&&(b.leaf?k.push(j):W(R,ee)?this._all(j,k):C.push(j))}b=C.pop()}return k},ie.prototype.collides=function(R){var b=this.data;if(!ue(R,b))return!1;for(var k=[];b;){for(var B=0;B<b.children.length;B++){var C=b.children[B],V=b.leaf?this.toBBox(C):C;if(ue(R,V)){if(b.leaf||W(R,V))return!0;k.push(C)}}b=k.pop()}return!1},ie.prototype.load=function(R){if(!R||!R.length)return this;if(R.length<this._minEntries){for(var b=0;b<R.length;b++)this.insert(R[b]);return this}var k=this._build(R.slice(),0,R.length-1,0);if(this.data.children.length)if(this.data.height===k.height)this._splitRoot(this.data,k);else{if(this.data.height<k.height){var B=this.data;this.data=k,k=B}this._insert(k,this.data.height-k.height-1,!0)}else this.data=k;return this},ie.prototype.insert=function(R){return R&&this._insert(R,this.data.height-1),this},ie.prototype.clear=function(){return this.data=De([]),this},ie.prototype.remove=function(R,b){if(!R)return this;for(var k,B,C,V=this.data,j=this.toBBox(R),ee=[],ge=[];V||ee.length;){if(V||(V=ee.pop(),B=ee[ee.length-1],k=ge.pop(),C=!0),V.leaf){var ce=Xe(R,V.children,b);if(ce!==-1)return V.children.splice(ce,1),ee.push(V),this._condense(ee),this}C||V.leaf||!W(V,j)?B?(k++,V=B.children[k],C=!1):V=null:(ee.push(V),ge.push(k),k=0,B=V,V=V.children[0])}return this},ie.prototype.toBBox=function(R){return R},ie.prototype.compareMinX=function(R,b){return R.minX-b.minX},ie.prototype.compareMinY=function(R,b){return R.minY-b.minY},ie.prototype.toJSON=function(){return this.data},ie.prototype.fromJSON=function(R){return this.data=R,this},ie.prototype._all=function(R,b){for(var k=[];R;)R.leaf?b.push.apply(b,R.children):k.push.apply(k,R.children),R=k.pop();return b},ie.prototype._build=function(R,b,k,B){var C,V=k-b+1,j=this._maxEntries;if(V<=j)return Ve(C=De(R.slice(b,k+1)),this.toBBox),C;B||(B=Math.ceil(Math.log(V)/Math.log(j)),j=Math.ceil(V/Math.pow(j,B-1))),(C=De([])).leaf=!1,C.height=B;var ee=Math.ceil(V/j),ge=ee*Math.ceil(Math.sqrt(j));rt(R,b,k,ge,this.compareMinX);for(var ce=b;ce<=k;ce+=ge){var xe=Math.min(ce+ge-1,k);rt(R,ce,xe,ee,this.compareMinY);for(var pe=ce;pe<=xe;pe+=ee){var Pe=Math.min(pe+ee-1,xe);C.children.push(this._build(R,pe,Pe,B-1))}}return Ve(C,this.toBBox),C},ie.prototype._chooseSubtree=function(R,b,k,B){for(;B.push(b),!b.leaf&&B.length-1!==k;){for(var C=1/0,V=1/0,j=void 0,ee=0;ee<b.children.length;ee++){var ge=b.children[ee],ce=Me(ge),xe=(pe=R,Pe=ge,(Math.max(Pe.maxX,pe.maxX)-Math.min(Pe.minX,pe.minX))*(Math.max(Pe.maxY,pe.maxY)-Math.min(Pe.minY,pe.minY))-ce);xe<V?(V=xe,C=ce<C?ce:C,j=ge):xe===V&&ce<C&&(C=ce,j=ge)}b=j||b.children[0]}var pe,Pe;return b},ie.prototype._insert=function(R,b,k){var B=k?R:this.toBBox(R),C=[],V=this._chooseSubtree(B,this.data,b,C);for(V.children.push(R),Ye(V,B);b>=0&&C[b].children.length>this._maxEntries;)this._split(C,b),b--;this._adjustParentBBoxes(B,C,b)},ie.prototype._split=function(R,b){var k=R[b],B=k.children.length,C=this._minEntries;this._chooseSplitAxis(k,C,B);var V=this._chooseSplitIndex(k,C,B),j=De(k.children.splice(V,k.children.length-V));j.height=k.height,j.leaf=k.leaf,Ve(k,this.toBBox),Ve(j,this.toBBox),b?R[b-1].children.push(j):this._splitRoot(k,j)},ie.prototype._splitRoot=function(R,b){this.data=De([R,b]),this.data.height=R.height+1,this.data.leaf=!1,Ve(this.data,this.toBBox)},ie.prototype._chooseSplitIndex=function(R,b,k){for(var B,C,V,j,ee,ge,ce,xe=1/0,pe=1/0,Pe=b;Pe<=k-b;Pe++){var je=te(R,0,Pe,this.toBBox),Je=te(R,Pe,k,this.toBBox),dt=(C=je,V=Je,j=void 0,ee=void 0,ge=void 0,ce=void 0,j=Math.max(C.minX,V.minX),ee=Math.max(C.minY,V.minY),ge=Math.min(C.maxX,V.maxX),ce=Math.min(C.maxY,V.maxY),Math.max(0,ge-j)*Math.max(0,ce-ee)),x=Me(je)+Me(Je);dt<xe?(xe=dt,B=Pe,pe=x<pe?x:pe):dt===xe&&x<pe&&(pe=x,B=Pe)}return B||k-b},ie.prototype._chooseSplitAxis=function(R,b,k){var B=R.leaf?this.compareMinX:Ft,C=R.leaf?this.compareMinY:zt;this._allDistMargin(R,b,k,B)<this._allDistMargin(R,b,k,C)&&R.children.sort(B)},ie.prototype._allDistMargin=function(R,b,k,B){R.children.sort(B);for(var C=this.toBBox,V=te(R,0,b,C),j=te(R,k-b,k,C),ee=Oe(V)+Oe(j),ge=b;ge<k-b;ge++){var ce=R.children[ge];Ye(V,R.leaf?C(ce):ce),ee+=Oe(V)}for(var xe=k-b-1;xe>=b;xe--){var pe=R.children[xe];Ye(j,R.leaf?C(pe):pe),ee+=Oe(j)}return ee},ie.prototype._adjustParentBBoxes=function(R,b,k){for(var B=k;B>=0;B--)Ye(b[B],R)},ie.prototype._condense=function(R){for(var b=R.length-1,k=void 0;b>=0;b--)R[b].children.length===0?b>0?(k=R[b-1].children).splice(k.indexOf(R[b]),1):this.clear():Ve(R[b],this.toBBox)},ie})}}]); //# sourceMappingURL=2421.ba873d4f1218ff190246.js.map