geostyler 18.4.1 → 18.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  Code: [github](https://github.com/geostyler/geostyler)
9
9
  Package: [npm](https://www.npmjs.com/package/geostyler)
10
10
  <!-- DO NOT TOUCH next line. It will be replaced auotmaticaly via RELEASE.yml -->
11
- Documentation: [main](https://geostyler.github.io/geostyler/main/index.html) / [latest](https://geostyler.github.io/geostyler/latest/index.html) / [18.4.1](https://geostyler.github.io/geostyler/v18.4.1/index.html)
11
+ Documentation: [main](https://geostyler.github.io/geostyler/main/index.html) / [latest](https://geostyler.github.io/geostyler/latest/index.html) / [18.4.2](https://geostyler.github.io/geostyler/v18.4.2/index.html)
12
12
 
13
13
  Examples:
14
14
  [Demo application](https://geostyler.github.io/geostyler-demo/)
@@ -12,7 +12,7 @@ Expecting `+fs.join(", ")+", got '"+(this.terminals_[Zt]||Zt)+"'":ys="Parse erro
12
12
  `||f===y){i=Math.max(i,o),n.push(o),o=0,l+=a,a=0;continue}const g=e[f+1]||s.font,d=r2(g,c);t.push(d),o+=d;const m=ER(g);r.push(m),a=Math.max(a,m)}return{width:i,height:l,widths:t,heights:r,lineWidths:n}}function CR(s,e,t,r,n,i,o,l,a,f,y){s.save(),t!==1&&(s.globalAlpha===void 0?s.globalAlpha=c=>c.globalAlpha*=t:s.globalAlpha*=t),e&&s.transform.apply(s,e),r.contextInstructions?(s.translate(a,f),s.scale(y[0],y[1]),TR(r,s)):y[0]<0||y[1]<0?(s.translate(a,f),s.scale(y[0],y[1]),s.drawImage(r,n,i,o,l,0,0,o,l)):s.drawImage(r,n,i,o,l,a,f,o*y[0],l*y[1]),s.restore()}function TR(s,e){const t=s.contextInstructions;for(let r=0,n=t.length;r<n;r+=2)Array.isArray(t[r+1])?e[t[r]].apply(e,t[r+1]):e[t[r]]=t[r+1]}class Df{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Dl(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new Df({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 He()}getImage(e){return He()}getHitDetectionImage(){return He()}getPixelRatio(e){return 1}getImageState(){return He()}getImageSize(){return He()}getOrigin(){return He()}getSize(){return He()}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_=Dl(e)}listenImageChange(e){He()}load(){He()}unlistenImageChange(e){He()}ready(){return Promise.resolve()}}class Rf extends Df{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,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.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Je.LOADING:Je.LOADED,this.imageState_===Je.LOADING&&this.ready().then(()=>this.imageState_=Je.LOADED),this.render()}clone(){const e=this.getScale(),t=new Rf({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_,t=this.getDisplacement(),r=this.getScaleArray();return[e[0]/2-t[0]/r[0],e[1]/2+t[1]/r[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){var i,o;const t=(i=this.fill_)==null?void 0:i.getKey(),r=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(",");let n=(o=Kr.get(r,null))==null?void 0:o.getImage(1);if(!n){const l=this.renderOptions_,a=Math.ceil(l.size*e),f=Xs(a,a);this.draw_(l,f,e),n=f.canvas;const y=new Jw(n,void 0,null,Je.LOADED,null);Kr.set(r,null,y),createImageBitmap(n).then(c=>{y.setImage(c)})}return n}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,r){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let n=this.radius,i=this.radius2_===void 0?n:this.radius2_;if(n<i){const L=n;n=i,i=L}const o=this.radius2_===void 0?this.points_:this.points_*2,l=2*Math.PI/o,a=i*Math.sin(l),f=Math.sqrt(i*i-a*a),y=n-f,c=Math.sqrt(a*a+y*y),g=c/a;if(e==="miter"&&g<=r)return g*t;const d=t/2/g,m=t/2*(y/c),F=Math.sqrt((n+d)*(n+d)+m*m)-n;if(this.radius2_===void 0||e==="bevel")return F*2;const v=n*Math.sin(l),_=Math.sqrt(n*n-v*v),$=i-_,S=Math.sqrt(v*v+$*$)/v;if(S<=r){const L=S*t/2-i-n;return 2*Math.max(F,L)}return F*2}createRenderOptions(){let e=zl,t=Gl,r=0,n=null,i=0,o,l=0;this.stroke_&&(o=Gn(this.stroke_.getColor()??Mf),l=this.stroke_.getWidth()??Nf,n=this.stroke_.getLineDash(),i=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Gl,e=this.stroke_.getLineCap()??zl,r=this.stroke_.getMiterLimit()??Af);const a=this.calculateLineJoinSize_(t,l,r),f=Math.max(this.radius,this.radius2_||0),y=Math.ceil(2*f+a);return{strokeStyle:o,strokeWidth:l,size:y,lineCap:e,lineDash:n,lineDashOffset:i,lineJoin:t,miterLimit:r}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,r){if(t.scale(r,r),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let n=this.fill_.getColor();n===null&&(n=mr),t.fillStyle=Gn(n),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let r=this.fill_.getColor(),n=0;typeof r=="string"&&(r=Bo(r)),r===null?n=1:Array.isArray(r)&&(n=r.length===4?r[3]:1),n===0&&(t=Xs(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_;const r=this.radius;if(t===1/0)e.arc(0,0,r,0,2*Math.PI);else{const n=this.radius2_===void 0?r:this.radius2_;this.radius2_!==void 0&&(t*=2);const i=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let l=0;l<t;l++){const a=i+l*o,f=l%2===0?r:n;e.lineTo(f*Math.cos(a),f*Math.sin(a))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=mr,t.fill(),e.strokeStyle&&(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())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class zf extends Rf{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 zf({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}}class Wi{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){const e=this.getColor();return new Wi({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){const t=Of(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Je.IDLE&&t.load(),t.getImageState()===Je.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){const e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?ns(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Bo(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function i2(s,e,t,r){return t!==void 0&&r!==void 0?[t/s,r/e]:t!==void 0?t/s:r!==void 0?r/e:1}class Gf extends Df{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,r=e.rotation!==void 0?e.rotation:0,n=e.scale!==void 0?e.scale:1,i=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:r,scale:n,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:i,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,this.referrerPolicy_=e.referrerPolicy;const o=e.img!==void 0?e.img:null;let l=e.src;ts(!(l!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(l===void 0||l.length===0)&&o&&(l=o.src||ns(o)),ts(l!==void 0&&l.length>0,"A defined and non-empty `src` or `image` must be provided"),ts(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let a;if(e.src!==void 0?a=Je.IDLE:o!==void 0&&("complete"in o?o.complete?a=o.src?Je.LOADED:Je.IDLE:a=Je.LOADING:a=Je.LOADED),this.color_=e.color!==void 0?Bo(e.color):null,this.iconImage_=Of(o,l,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},a,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,this.initialOptions_,e.width!==void 0||e.height!==void 0){let f,y;if(e.size)[f,y]=e.size;else{const c=this.getImage(1);if(c.width&&c.height)f=c.width,y=c.height;else if(c instanceof HTMLImageElement){this.initialOptions_=e;const g=()=>{if(this.unlistenImageChange(g),!this.initialOptions_)return;const d=this.iconImage_.getSize();this.setScale(i2(d[0],d[1],e.width,e.height))};this.listenImageChange(g);return}}f!==void 0&&this.setScale(i2(f,y,e.width,e.height))}}clone(){let e,t,r;return this.initialOptions_?(t=this.initialOptions_.width,r=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new Gf({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_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:r,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(),r=this.getScaleArray();return[e[0]-t[0]/r[0],e[1]+t[1]/r[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){const t=e?Bo(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,l)=>o===t[l]))return;this.color_=t;const r=this.getSrc(),n=r!==void 0?null:this.getHitDetectionImage(),i=r!==void 0?Je.IDLE:this.iconImage_.getImageState();this.iconImage_=Of(n,r,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},i,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(),r=this.iconImage_.getSize();if(!t||!r)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=r[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=r[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Of(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Je.IDLE,this.color_)}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()==Je.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()==Je.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(at.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(at.CHANGE,e)}ready(){return this.iconImage_.ready()}}class Bf{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.offset_=e.offset,this.width_=e.width}clone(){const e=this.getColor();return new Bf({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(),offset:this.getOffset(),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_}getOffset(){return this.offset_}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}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}}let Vo=class F4{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=l2,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 F4({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,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_=l2,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function LR(s){let e;if(typeof s=="function")e=s;else{let t;Array.isArray(s)?t=s:(ts(typeof s.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[s]),e=function(){return t}}return e}let jm=null;function o2(s,e){if(!jm){const t=new Wi({color:"rgba(255,255,255,0.4)"}),r=new Bf({color:"#3399CC",width:1.25});jm=[new Vo({image:new zf({fill:t,stroke:r,radius:5}),fill:t,stroke:r})]}return jm}function l2(s){return s.getGeometry()}const IR="#333";let a2=class j4{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Dl(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 Wi({color:IR}),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,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new j4({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof Wi?this.getFill().clone():this.getFill(),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,declutterMode:this.getDeclutterMode()})}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_}getKeepUpright(){return this.keepUpright_}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_}getDeclutterMode(){return this.declutterMode_}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}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Dl(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}};function OR(s){return!0}function AR(s){const e=Kw(),t=MR(s,e),r=Qw();return function(n,i){if(r.properties=n.getPropertiesInternal(),r.resolution=i,e.featureId){const o=n.getId();o!==void 0?r.featureId=o:r.featureId=null}return e.geometryType&&(r.geometryType=Zw(n.getGeometry())),t(r)}}function f2(s){const e=Kw(),t=s.length,r=new Array(t);for(let o=0;o<t;++o)r[o]=vm(s[o],e);const n=Qw(),i=new Array(t);return function(o,l){if(n.properties=o.getPropertiesInternal(),n.resolution=l,e.featureId){const f=o.getId();f!==void 0?n.featureId=f:n.featureId=null}let a=0;for(let f=0;f<t;++f){const y=r[f](n);y&&(i[a]=y,a+=1)}return i.length=a,i}}function MR(s,e){const t=s.length,r=new Array(t);for(let n=0;n<t;++n){const i=s[n],o="filter"in i?zn(i.filter,nr,e):OR;let l;if(Array.isArray(i.style)){const a=i.style.length;l=new Array(a);for(let f=0;f<a;++f)l[f]=vm(i.style[f],e)}else l=[vm(i.style,e)];r[n]={filter:o,styles:l}}return function(n){const i=[];let o=!1;for(let l=0;l<t;++l){const a=r[l].filter;if(a(n)&&!(s[l].else&&o)){o=!0;for(const f of r[l].styles){const y=f(n);y&&i.push(y)}}}return i}}function vm(s,e){const t=qf(s,"",e),r=Uf(s,"",e),n=PR(s,e),i=NR(s,e),o=Ds(s,"z-index",e);if(!t&&!r&&!n&&!i&&!To(s))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(s));const l=new Vo;return function(a){let f=!0;if(t){const y=t(a);y&&(f=!1),l.setFill(y)}if(r){const y=r(a);y&&(f=!1),l.setStroke(y)}if(n){const y=n(a);y&&(f=!1),l.setText(y)}if(i){const y=i(a);y&&(f=!1),l.setImage(y)}return o&&l.setZIndex(o(a)),f?null:l}}function qf(s,e,t){let r;if(e+"fill-pattern-src"in s)r=zR(s,e+"fill-",t);else{if(s[e+"fill-color"]==="none")return i=>null;r=Ic(s,e+"fill-color",t)}if(!r)return null;const n=new Wi;return function(i){const o=r(i);return o===lm?null:(n.setColor(o),n)}}function Uf(s,e,t){const r=Ds(s,e+"stroke-width",t),n=Ic(s,e+"stroke-color",t);if(!r&&!n)return null;const i=ci(s,e+"stroke-line-cap",t),o=ci(s,e+"stroke-line-join",t),l=y2(s,e+"stroke-line-dash",t),a=Ds(s,e+"stroke-line-dash-offset",t),f=Ds(s,e+"stroke-miter-limit",t),y=Ds(s,e+"stroke-offset",t),c=new Bf;return function(g){if(n){const d=n(g);if(d===lm)return null;c.setColor(d)}if(r&&c.setWidth(r(g)),i){const d=i(g);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(g);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return l&&c.setLineDash(l(g)),a&&c.setLineDashOffset(a(g)),f&&c.setMiterLimit(f(g)),y&&c.setOffset(y(g)),c}}function PR(s,e){const t="text-",r=ci(s,t+"value",e);if(!r)return null;const n=qf(s,t,e),i=qf(s,t+"background-",e),o=Uf(s,t,e),l=Uf(s,t+"background-",e),a=ci(s,t+"font",e),f=Ds(s,t+"max-angle",e),y=Ds(s,t+"offset-x",e),c=Ds(s,t+"offset-y",e),g=ql(s,t+"overflow",e),d=ci(s,t+"placement",e),m=Ds(s,t+"repeat",e),b=Ac(s,t+"scale",e),F=ql(s,t+"rotate-with-view",e),v=Ds(s,t+"rotation",e),_=ci(s,t+"align",e),$=ci(s,t+"justify",e),w=ci(s,t+"baseline",e),S=ql(s,t+"keep-upright",e),L=y2(s,t+"padding",e),O=Mc(s,t+"declutter-mode"),T=new a2({declutterMode:O});return function(C){if(T.setText(r(C)),n&&T.setFill(n(C)),i&&T.setBackgroundFill(i(C)),o&&T.setStroke(o(C)),l&&T.setBackgroundStroke(l(C)),a&&T.setFont(a(C)),f&&T.setMaxAngle(f(C)),y&&T.setOffsetX(y(C)),c&&T.setOffsetY(c(C)),g&&T.setOverflow(g(C)),d){const x=d(C);if(x!=="point"&&x!=="line")throw new Error("Expected point or line for text-placement");T.setPlacement(x)}if(m&&T.setRepeat(m(C)),b&&T.setScale(b(C)),F&&T.setRotateWithView(F(C)),v&&T.setRotation(v(C)),_){const x=_(C);if(x!=="left"&&x!=="center"&&x!=="right"&&x!=="end"&&x!=="start")throw new Error("Expected left, right, center, start, or end for text-align");T.setTextAlign(x)}if($){const x=$(C);if(x!=="left"&&x!=="right"&&x!=="center")throw new Error("Expected left, right, or center for text-justify");T.setJustify(x)}if(w){const x=w(C);if(x!=="bottom"&&x!=="top"&&x!=="middle"&&x!=="alphabetic"&&x!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");T.setTextBaseline(x)}return L&&T.setPadding(L(C)),S&&T.setKeepUpright(S(C)),T}}function NR(s,e){return"icon-src"in s?kR(s,e):"shape-points"in s?DR(s,e):"circle-radius"in s?RR(s,e):null}function kR(s,e){const t="icon-",r=t+"src",n=u2(s[r],r),i=Oc(s,t+"anchor",e),o=Ac(s,t+"scale",e),l=Ds(s,t+"opacity",e),a=Oc(s,t+"displacement",e),f=Ds(s,t+"rotation",e),y=ql(s,t+"rotate-with-view",e),c=c2(s,t+"anchor-origin"),g=g2(s,t+"anchor-x-units"),d=g2(s,t+"anchor-y-units"),m=hi(s,t+"color");let b,F=null;m!==void 0&&(Array.isArray(m)&&m.length>0&&typeof m[0]=="string"?F=Ic(s,t+"color",e):b=d2(m,t+"color"));const v=BR(s,t+"cross-origin"),_=qR(s,t+"offset"),$=c2(s,t+"offset-origin"),w=_m(s,t+"width"),S=_m(s,t+"height"),L=GR(s,t+"size"),O=Mc(s,t+"declutter-mode"),T={src:n,anchorOrigin:c,anchorXUnits:g,anchorYUnits:d,crossOrigin:v,offset:_,offsetOrigin:$,height:S,width:w,size:L,declutterMode:O};let C=null;return function(x){if(C)F&&C.setColor(F(x));else{const M=F?F(x):b;C=new Gf(M!==void 0?Object.assign({},T,{color:M}):Object.assign({},T))}return l&&C.setOpacity(l(x)),a&&C.setDisplacement(a(x)),f&&C.setRotation(f(x)),y&&C.setRotateWithView(y(x)),o&&C.setScale(o(x)),i&&C.setAnchor(i(x)),C}}function DR(s,e){const t="shape-",r=t+"points",n=t+"radius",i=$m(s[r],r);if(!(n in s))throw new Error(`Expected a number for ${n}`);const o=Ds(s,n,e),l=typeof s[n]=="number"?s[n]:5,a=t+"radius2",f=Ds(s,a,e),y=typeof s[a]=="number"?s[a]:void 0,c=qf(s,t,e),g=Uf(s,t,e),d=Ac(s,t+"scale",e),m=Oc(s,t+"displacement",e),b=Ds(s,t+"rotation",e),F=ql(s,t+"rotate-with-view",e),v=_m(s,t+"angle"),_=Mc(s,t+"declutter-mode"),$=new Rf({points:i,radius:l,radius2:y,angle:v,declutterMode:_});return function(w){return o&&$.setRadius(o(w)),f&&$.setRadius2(f(w)),c&&$.setFill(c(w)),g&&$.setStroke(g(w)),m&&$.setDisplacement(m(w)),b&&$.setRotation(b(w)),F&&$.setRotateWithView(F(w)),d&&$.setScale(d(w)),$}}function RR(s,e){const t="circle-",r=qf(s,t,e),n=Uf(s,t,e),i=Ds(s,t+"radius",e),o=Ac(s,t+"scale",e),l=Oc(s,t+"displacement",e),a=Ds(s,t+"rotation",e),f=ql(s,t+"rotate-with-view",e),y=Mc(s,t+"declutter-mode"),c=new zf({radius:5,declutterMode:y});return function(g){return i&&c.setRadius(i(g)),r&&c.setFill(r(g)),n&&c.setStroke(n(g)),l&&c.setDisplacement(l(g)),a&&c.setRotation(a(g)),f&&c.setRotateWithView(f(g)),o&&c.setScale(o(g)),c}}function hi(s,e){if(!(e in s))return;const t=s[e];return t===void 0?void 0:t}function Ds(s,e,t){const r=hi(s,e);if(r===void 0)return;const n=zn(r,yt,t);return function(i){return $m(n(i),e)}}function ci(s,e,t){const r=hi(s,e);if(r===void 0)return null;const n=zn(r,pr,t);return function(i){return u2(n(i),e)}}function zR(s,e,t){const r=ci(s,e+"pattern-src",t),n=h2(s,e+"pattern-offset",t),i=h2(s,e+"pattern-size",t),o=Ic(s,e+"color",t);return function(l){return{src:r(l),offset:n&&n(l),size:i&&i(l),color:o&&o(l)}}}function ql(s,e,t){const r=hi(s,e);if(r===void 0)return null;const n=zn(r,nr,t);return function(i){const o=n(i);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function Ic(s,e,t){const r=hi(s,e);if(r===void 0)return null;const n=zn(r,mn,t);return function(i){return d2(n(i),e)}}function y2(s,e,t){const r=hi(s,e);if(r===void 0)return null;if(Array.isArray(r)&&(r.length===0||typeof r[0]!="string")){const i=r.map((o,l)=>{if(typeof o=="number")return()=>o;const a=zn(o,yt,t);return function(f){return $m(a(f),`${e}[${l}]`)}});return function(o){const l=new Array(i.length);for(let a=0;a<i.length;++a)l[a]=i[a](o);return l}}const n=zn(r,Uo,t);return function(i){return Wf(n(i),e)}}function Oc(s,e,t){const r=hi(s,e);if(r===void 0)return null;const n=zn(r,Uo,t);return function(i){const o=Wf(n(i),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function h2(s,e,t){const r=hi(s,e);if(r===void 0)return null;const n=zn(r,Uo,t);return function(i){return p2(n(i),e)}}function Ac(s,e,t){const r=hi(s,e);if(r===void 0)return null;const n=zn(r,Uo|yt,t);return function(i){return UR(n(i),e)}}function _m(s,e){const t=s[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function GR(s,e){const t=s[e];if(t!==void 0){if(typeof t=="number")return Dl(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function BR(s,e){const t=s[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function c2(s,e){const t=s[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function g2(s,e){const t=s[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function qR(s,e){const t=s[e];if(t!==void 0)return Wf(t,e)}function Mc(s,e){const t=s[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function Wf(s,e){if(!Array.isArray(s))throw new Error(`Expected an array for ${e}`);const t=s.length;for(let r=0;r<t;++r)if(typeof s[r]!="number")throw new Error(`Expected an array of numbers for ${e}`);return s}function u2(s,e){if(typeof s!="string")throw new Error(`Expected a string for ${e}`);return s}function $m(s,e){if(typeof s!="number")throw new Error(`Expected a number for ${e}`);return s}function d2(s,e){if(typeof s=="string")return s;const t=Wf(s,e),r=t.length;if(r<3||r>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function p2(s,e){const t=Wf(s,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function UR(s,e){return typeof s=="number"?s:p2(s,e)}const m2={RENDER_ORDER:"renderOrder"};class b2 extends rm{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?String(e.declutter):void 0,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(m2.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){const r=this.getDeclutter();r in e.declutter||(e.declutter[r]=new Bw(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(m2.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?o2:e;const t=WR(e);this.styleFunction_=e===null?void 0:LR(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}}function WR(s){if(s===void 0)return o2;if(!s)return null;if(typeof s=="function"||s instanceof Vo)return s;if(!Array.isArray(s))return f2([s]);if(s.length===0)return[];const e=s.length,t=s[0];if(t instanceof Vo){const n=new Array(e);for(let i=0;i<e;++i){const o=s[i];if(!(o instanceof Vo))throw new Error("Expected a list of style instances");n[i]=o}return n}if("style"in t){const n=new Array(e);for(let i=0;i<e;++i){const o=s[i];if(!("style"in o))throw new Error("Expected a list of rules with a style property");n[i]=o}return AR(n)}return f2(s)}class F2 extends Mi{constructor(e,t,r,n){super(e),this.inversePixelTransform=t,this.frameState=r,this.context=n}}class VR extends ap{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){He()}calculateMatrices2D(e){const t=e.viewState,r=e.coordinateToPixelTransform,n=e.pixelToCoordinateTransform;Di(r,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),uw(n,r)}forEachFeatureAtCoordinate(e,t,r,n,i,o,l,a){let f;const y=t.viewState;function c(w,S,L,O){return i.call(o,S,w?L:null,O)}const g=y.projection,d=X$(e.slice(),g),m=[[0,0]];if(g.canWrapX()&&n){const w=g.getExtent(),S=Ns(w);m.push([-S,0],[S,0])}const b=t.layerStatesArray,F=b.length,v=[],_=[];for(let w=0;w<m.length;w++)for(let S=F-1;S>=0;--S){const L=b[S],O=L.layer;if(O.hasRenderer()&&nm(L,y)&&l.call(a,O)){const T=O.getRenderer(),C=O.getSource();if(T&&C){const x=C.getWrapX()?d:e,M=c.bind(null,L.managed);_[0]=x[0]+m[w][0],_[1]=x[1]+m[w][1],f=T.forEachFeatureAtCoordinate(_,t,r,M,v)}if(f)return f}}if(v.length===0)return;const $=1/v.length;return v.forEach((w,S)=>w.distanceSq+=S*$),v.sort((w,S)=>w.distanceSq-S.distanceSq),v.some(w=>f=w.callback(w.feature,w.layer,w.geometry)),f}hasFeatureAtCoordinate(e,t,r,n,i,o){return this.forEachFeatureAtCoordinate(e,t,r,n,nf,this,i,o)!==void 0}getMap(){return this.map_}renderFrame(e){He()}scheduleExpireIconCache(e){Kr.canExpireCache()&&e.postRenderFunctions.push(KR)}}function KR(s,e){Kr.expire()}class YR extends VR{constructor(e){super(e),this.fontChangeListenerKey_=mt(Bl,El.PROPERTYCHANGE,e.redrawText,e),this.element_=oi?Mw():document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=wc+" ol-layers";const r=e.getViewport();r&&r.insertBefore(this.element_,r.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const r=this.getMap();if(r.hasListener(e)){const n=new F2(e,void 0,t);r.dispatchEvent(n)}}disposeInternal(){Jt(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Vr.PRECOMPOSE,e);const t=e.layerStatesArray.sort((f,y)=>f.zIndex-y.zIndex);t.some(f=>f.layer instanceof b2&&f.layer.getDeclutter())&&(e.declutter={});const n=e.viewState;this.children_.length=0;const i=[];let o=null;for(let f=0,y=t.length;f<y;++f){const c=t[f];e.layerIndex=f;const g=c.layer,d=g.getSourceState();if(!nm(c,n)||d!="ready"&&d!="undefined"){g.unrender();continue}const m=g.render(e,o);m&&(m!==o&&(this.children_.push(m),o=m),i.push(c))}this.declutter(e,i),o6(this.element_,this.children_);const a=this.getMap().getTargetElement();if(Gi(a)){const f=a.getContext("2d");for(const y of this.children_){const c=y.firstElementChild||y,g=y.style.backgroundColor;if(g&&(!Gi(c)||c.width>0)&&(f.fillStyle=g,f.fillRect(0,0,a.width,a.height)),Gi(c)&&c.width>0){f.save();const d=y.style.opacity||c.style.opacity;f.globalAlpha=d===""?1:Number(d);const m=c.style.transform;if(m)f.transform(...Lp(m));else{const b=parseFloat(c.style.width)/c.width,F=parseFloat(c.style.height)/c.height;f.transform(b,0,0,F,0,0)}f.drawImage(c,0,0),f.restore()}}}this.dispatchRenderEvent(Vr.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let r=t.length-1;r>=0;--r){const n=t[r],i=n.layer;i.getDeclutter()&&i.renderDeclutter(e,n)}t.forEach(r=>r.layer.renderDeferred(e))}}}function j2(s){if(s instanceof rm){s.setMapInternal(null);return}s instanceof Pl&&s.getLayers().forEach(j2)}function v2(s,e){if(s instanceof rm){s.setMapInternal(e);return}if(s instanceof Pl){const t=s.getLayers().getArray();for(let r=0,n=t.length;r<n;++r)v2(t[r],e)}}let _2=class extends kn{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=XR(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:P$,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Wr(),this.pixelToCoordinateTransform_=Wr(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,oi||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,oi||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(oi?new Br:y6()),this.interactions=t.interactions||(oi?new Br:O6({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new C8(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ks.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ks.VIEW,this.handleViewChanged_),this.addChangeListener(Ks.SIZE,this.handleSizeChanged_),this.addChangeListener(Ks.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const r=this;e.view&&!(e.view instanceof Rn)&&e.view.then(function(n){r.setView(new Rn(n))}),this.controls.addEventListener(dr.ADD,n=>{n.element.setMap(this)}),this.controls.addEventListener(dr.REMOVE,n=>{n.element.setMap(null)}),this.interactions.addEventListener(dr.ADD,n=>{n.element.setMap(this)}),this.interactions.addEventListener(dr.REMOVE,n=>{n.element.setMap(null)}),this.overlays_.addEventListener(dr.ADD,n=>{this.addOverlayInternal_(n.element)}),this.overlays_.addEventListener(dr.REMOVE,n=>{const i=n.element.getId();i!==void 0&&delete this.overlayIdIndex_[i.toString()],n.element.setMap(null)}),this.controls.forEach(n=>{n.setMap(this)}),this.interactions.forEach(n=>{n.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){v2(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){var e;this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),(e=this.resizeObserver_)==null||e.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,r){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(e);r=r!==void 0?r:{};const i=r.hitTolerance!==void 0?r.hitTolerance:0,o=r.layerFilter!==void 0?r.layerFilter:nf,l=r.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,i,l,t,null,o,null)}getFeaturesAtPixel(e,t){const r=[];return this.forEachFeatureAtPixel(e,function(n){r.push(n)},t),r}getAllLayers(){const e=[];function t(r){r.forEach(function(n){n instanceof Pl?t(n.getLayers()):e.push(n)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const r=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const n=t.layerFilter!==void 0?t.layerFilter:nf,i=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(r,this.frameState_,i,o,n,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const r=this.viewport_.getBoundingClientRect(),n=this.getSize(),i=r.width/n[0],o=r.height/n[1],l="changedTouches"in e?e.changedTouches[0]:e;return[(l.clientX-r.left)/i,(l.clientY-r.top)/o]}getTarget(){return this.get(Ks.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Tp(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?rr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Ks.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof Br){t.setLayers(e);return}const r=t.getLayers();r.clear(),r.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,r=e.length;t<r;++t){const n=e[t];if(!n.visible)continue;const i=n.layer.getRenderer();if(i&&!i.ready)return!0;const o=n.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){const t=ai(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?rr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Ks.SIZE)}getView(){return this.get(Ks.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,r,n){return T8(this.frameState_,e,t,r,n)}handleBrowserEvent(e,t){t=t||e.type;const r=new Pi(t,this,e);this.handleMapBrowserEvent(r)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,r=t.type;if(r===yp.POINTERDOWN||r===at.WHEEL||r===at.KEYDOWN){const n=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():n,o=t.target,l=i instanceof ShadowRoot?i.host===o?i.host.ownerDocument:i:i===n?n.documentElement:i;if(this.overlayContainerStopEvent_.contains(o)||!l.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){const n=this.getInteractions().getArray().slice();for(let i=n.length-1;i>=0;i--){const o=n[i];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,i=n;if(e){const o=e.viewHints;if(o[Ys.ANIMATING]||o[Ys.INTERACTING]){const l=Date.now()-e.time>8;n=l?0:8,i=l?0:2}}t.getTilesLoading()<n&&(t.reprioritize(),t.loadMoreTiles(n,i))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Vr.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Vr.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new xl(Ni.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new xl(Ni.LOADSTART,this,e))));const r=this.postRenderFunctions_;if(e)for(let n=0,i=r.length;n<i;++n)r[n](this,e);r.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){var r,n;if(this.mapBrowserEventHandler_){for(let i=0,o=this.targetChangeHandlerKeys_.length;i<o;++i)Jt(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(at.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(at.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Gi(this.targetElement_)){(r=this.resizeObserver_)==null||r.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Gi(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new YR(this)),!Gi(t)){this.mapBrowserEventHandler_=new E8(this,this.moveTolerance_);for(const o in es)this.mapBrowserEventHandler_.addEventListener(es[o],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(at.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(at.WHEEL,this.boundHandleBrowserEvent_,N$?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const o=t.getRootNode();i=o instanceof ShadowRoot?o.host:t}if(this.targetChangeHandlerKeys_=[mt(i,at.KEYDOWN,this.handleBrowserEvent,this),mt(i,at.KEYPRESS,this.handleBrowserEvent,this)],t instanceof HTMLElement){const o=t.getRootNode();o instanceof ShadowRoot&&this.resizeObserver_.observe(o.host),(n=this.resizeObserver_)==null||n.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(Jt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(Jt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=mt(e,El.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=mt(e,at.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(Jt),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new qi("addlayer",e)),this.layerGroupPropertyListenerKeys_=[mt(e,El.PROPERTYCHANGE,this.render,this),mt(e,at.CHANGE,this.render,this),mt(e,"addlayer",this.handleLayerAdd_,this),mt(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const e=this.frameState_.layerStatesArray;for(let t=0,r=e.length;t<r;++t){const n=e[t].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){j2(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),r=this.getView(),n=this.frameState_;let i=null;if(t!==void 0&&Vw(t)&&r&&r.isDef()){const o=r.getHints(this.frameState_?this.frameState_.viewHints:void 0),l=r.getState();if(i={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:mp(l.center,l.resolution,l.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:l,viewHints:o,wantedTiles:{},mapId:ns(this),renderTargets:{}},l.nextCenter&&l.nextResolution){const a=isNaN(l.nextRotation)?l.rotation:l.nextRotation;i.nextExtent=mp(l.nextCenter,l.nextResolution,a,t)}}this.frameState_=i,this.renderer_.renderFrame(i),i&&(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),n&&(!this.previousExtent_||!gf(this.previousExtent_)&&!lc(i.extent,this.previousExtent_))&&(this.dispatchEvent(new xl(Ni.MOVESTART,this,n)),this.previousExtent_=cf(this.previousExtent_)),this.previousExtent_&&!i.viewHints[Ys.ANIMATING]&&!i.viewHints[Ys.INTERACTING]&&!lc(i.extent,this.previousExtent_)&&(this.dispatchEvent(new xl(Ni.MOVEEND,this,i)),G$(i.extent,this.previousExtent_))),this.dispatchEvent(new xl(Ni.POSTRENDER,this,i)),this.renderComplete_=(this.hasListener(Ni.LOADSTART)||this.hasListener(Ni.LOADEND)||this.hasListener(Vr.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new qi("removelayer",t)),this.set(Ks.LAYERGROUP,e)}setSize(e){this.set(Ks.SIZE,e)}setTarget(e){this.set(Ks.TARGET,e)}setView(e){if(!e||e instanceof Rn){this.set(Ks.VIEW,e);return}this.set(Ks.VIEW,new Rn);const t=this;e.then(function(r){t.setView(new Rn(r))})}updateSize(){const e=this.getTargetElement();let t;if(e){let n,i;if(Gi(e)){const o=e.getContext("2d").getTransform();n=e.width/o.a,i=e.height/o.d}else{const o=getComputedStyle(e);n=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),i=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(n)&&!isNaN(i)&&(t=[Math.max(0,n),Math.max(0,i)],!Vw(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&Z$("No map visible because the map container's width or height are 0."))}const r=this.getSize();t&&(!r||!Ai(t,r))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(e){const t=this.getView();t&&t.setViewportSize(e)}};function XR(s){let e=null;s.keyboardEventTarget!==void 0&&(e=typeof s.keyboardEventTarget=="string"?document.getElementById(s.keyboardEventTarget):s.keyboardEventTarget);const t={},r=s.layers&&typeof s.layers.getLayers=="function"?s.layers:new Pl({layers:s.layers});t[Ks.LAYERGROUP]=r,t[Ks.TARGET]=s.target,t[Ks.VIEW]=s.view instanceof Rn?s.view:new Rn;let n;s.controls!==void 0&&(Array.isArray(s.controls)?n=new Br(s.controls.slice()):(ts(typeof s.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),n=s.controls));let i;s.interactions!==void 0&&(Array.isArray(s.interactions)?i=new Br(s.interactions.slice()):(ts(typeof s.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),i=s.interactions));let o;return s.overlays!==void 0?Array.isArray(s.overlays)?o=new Br(s.overlays.slice()):(ts(typeof s.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=s.overlays):o=new Br,{controls:n,interactions:i,keyboardEventTarget:e,overlays:o,values:t}}class $2{drawCustom(e,t,r,n,i){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,r){}drawFeature(e,t,r){}drawGeometryCollection(e,t,r){}drawLineString(e,t,r){}drawMultiLineString(e,t,r){}drawMultiPoint(e,t,r){}drawMultiPolygon(e,t,r){}drawPoint(e,t,r){}drawPolygon(e,t,r){}drawText(e,t,r){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}}const ze={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},Pc=[ze.FILL],Vi=[ze.STROKE],Ko=[ze.BEGIN_PATH],w2=[ze.CLOSE_PATH];class Vf extends $2{constructor(e,t,r,n){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=r,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(r){return r*t})}appendFlatPointCoordinates(e,t){const r=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,i=this.coordinates;let o=i.length;for(let l=0,a=e.length;l<a;l+=t)n[0]=e[l],n[1]=e[l+1],gp(r,n)&&(i[o++]=n[0],i[o++]=n[1]);return o}appendFlatLineCoordinates(e,t,r,n,i,o){const l=this.coordinates;let a=l.length;const f=this.getBufferedMaxExtent();o&&(t+=n);let y=e[t],c=e[t+1];const g=this.tmpCoordinate_;let d=!0,m,b,F;for(m=t+n;m<r;m+=n)g[0]=e[m],g[1]=e[m+1],F=dp(f,g),F!==b?(d&&(l[a++]=y,l[a++]=c,d=!1),l[a++]=g[0],l[a++]=g[1]):F===Ls.INTERSECTING?(l[a++]=g[0],l[a++]=g[1],d=!1):d=!0,y=g[0],c=g[1],b=F;return(i&&d||m===t+n)&&(l[a++]=y,l[a++]=c),a}drawCustomCoordinates_(e,t,r,n,i){for(let o=0,l=r.length;o<l;++o){const a=r[o],f=this.appendFlatLineCoordinates(e,t,a,n,!1,!1);i.push(f),t=a}return t}drawCustom(e,t,r,n,i){this.beginGeometry(e,t,i);const o=e.getType(),l=e.getStride(),a=this.coordinates.length;let f,y,c,g,d;switch(o){case"MultiPolygon":f=e.getOrientedFlatCoordinates(),g=[];const m=e.getEndss();d=0;for(let b=0,F=m.length;b<F;++b){const v=[];d=this.drawCustomCoordinates_(f,d,m[b],l,v),g.push(v)}this.instructions.push([ze.CUSTOM,a,g,e,r,Pp,i]),this.hitDetectionInstructions.push([ze.CUSTOM,a,g,e,n||r,Pp,i]);break;case"Polygon":case"MultiLineString":c=[],f=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),d=this.drawCustomCoordinates_(f,0,e.getEnds(),l,c),this.instructions.push([ze.CUSTOM,a,c,e,r,mf,i]),this.hitDetectionInstructions.push([ze.CUSTOM,a,c,e,n||r,mf,i]);break;case"LineString":case"Circle":f=e.getFlatCoordinates(),y=this.appendFlatLineCoordinates(f,0,f.length,l,!1,!1),this.instructions.push([ze.CUSTOM,a,y,e,r,zi,i]),this.hitDetectionInstructions.push([ze.CUSTOM,a,y,e,n||r,zi,i]);break;case"MultiPoint":f=e.getFlatCoordinates(),y=this.appendFlatPointCoordinates(f,l),y>a&&(this.instructions.push([ze.CUSTOM,a,y,e,r,zi,i]),this.hitDetectionInstructions.push([ze.CUSTOM,a,y,e,n||r,zi,i]));break;case"Point":f=e.getFlatCoordinates(),this.coordinates.push(f[0],f[1]),y=this.coordinates.length,this.instructions.push([ze.CUSTOM,a,y,e,r,void 0,i]),this.hitDetectionInstructions.push([ze.CUSTOM,a,y,e,n||r,void 0,i]);break}this.endGeometry(t)}beginGeometry(e,t,r){this.beginGeometryInstruction1_=[ze.BEGIN_GEOMETRY,t,0,e,r],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[ze.BEGIN_GEOMETRY,t,0,e,r],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 r=e.length;let n,i,o=-1;for(t=0;t<r;++t)n=e[t],i=n[0],i==ze.END_GEOMETRY?o=t:i==ze.BEGIN_GEOMETRY&&(n[2]=t,j8(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){const r=e.getColor();t.fillPatternScale=r&&typeof r=="object"&&"src"in r?this.pixelRatio:1,t.fillStyle=Gn(r||mr)}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){const r=e.getColor();t.strokeStyle=Gn(r||Mf);const n=e.getLineCap();t.lineCap=n!==void 0?n:zl;const i=e.getLineDash();t.lineDash=i?i.slice():fi;const o=e.getLineDashOffset();t.lineDashOffset=o||yi;const l=e.getLineJoin();t.lineJoin=l!==void 0?l:Gl;const a=e.getWidth();t.lineWidth=a!==void 0?a:Nf;const f=e.getMiterLimit();t.miterLimit=f!==void 0?f:Af;const y=e.getOffset();t.strokeOffset=y??_R,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){const r=this.state;this.fillStyleToState(e,r),this.strokeStyleToState(t,r)}createFill(e){const t=e.fillStyle,r=[ze.SET_FILL_STYLE,t];return typeof t!="string"&&r.push(e.fillPatternScale),r}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[ze.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const r=e.fillStyle;(typeof r!="string"||e.currentFillStyle!=r)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=r)}updateStrokeStyle(e,t){const r=e.strokeStyle,n=e.lineCap,i=e.lineDash,o=e.lineDashOffset,l=e.lineJoin,a=e.lineWidth,f=e.miterLimit,y=e.strokeOffset;(e.currentStrokeStyle!=r||e.currentLineCap!=n||i!=e.currentLineDash&&!Ai(e.currentLineDash,i)||e.currentLineDashOffset!=o||e.currentLineJoin!=l||e.currentLineWidth!=a||e.currentMiterLimit!=f||e.currentStrokeOffset!=y)&&(t.call(this,e),e.currentStrokeStyle=r,e.currentLineCap=n,e.currentLineDash=i,e.currentLineDashOffset=o,e.currentLineJoin=l,e.currentLineWidth=a,e.currentMiterLimit=f,e.currentStrokeOffset=y)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[ze.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=G$(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;cp(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class HR extends Vf{constructor(e,t,r,n){super(e,t,r,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,r){if(!this.image_||this.maxExtent&&!gp(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,r);const n=e.getFlatCoordinates(),i=e.getStride(),o=this.coordinates.length,l=this.appendFlatPointCoordinates(n,i);this.instructions.push([ze.DRAW_IMAGE,o,l,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([ze.DRAW_IMAGE,o,l,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,r){if(!this.image_)return;this.beginGeometry(e,t,r);const n=e.getFlatCoordinates(),i=[];for(let a=0,f=n.length;a<f;a+=e.getStride())(!this.maxExtent||gp(this.maxExtent,n.slice(a,a+2)))&&i.push(n[a],n[a+1]);const o=this.coordinates.length,l=this.appendFlatPointCoordinates(i,2);this.instructions.push([ze.DRAW_IMAGE,o,l,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([ze.DRAW_IMAGE,o,l,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,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 r=e.getAnchor(),n=e.getSize(),i=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=e.getOpacity(),this.originX_=i[0],this.originY_=i[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=n[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}class ZR extends Vf{constructor(e,t,r,n){super(e,t,r,n)}drawFlatCoordinates_(e,t,r,n,i){const o=this.coordinates.length,l=this.appendFlatLineCoordinates(e,t,r,n,!1,!1);return this.instructions.push([ze.MOVE_TO_LINE_TO,o,l,i*this.pixelRatio]),this.hitDetectionInstructions.push([ze.MOVE_TO_LINE_TO,o,l,i]),r}drawLineString(e,t,r){const n=this.state,i=n.strokeStyle,o=n.lineWidth,l=n.strokeOffset;if(i===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(e,t,r),this.hitDetectionInstructions.push([ze.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,fi,yi],Ko);const a=e.getFlatCoordinates(),f=e.getStride();this.drawFlatCoordinates_(a,0,a.length,f,l),this.hitDetectionInstructions.push(Vi),this.endGeometry(t)}drawMultiLineString(e,t,r){const n=this.state,i=n.strokeStyle,o=n.lineWidth,l=n.strokeOffset;if(i===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(e,t,r),this.hitDetectionInstructions.push([ze.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,fi,yi],Ko);const a=e.getEnds(),f=e.getFlatCoordinates(),y=e.getStride();let c=0;for(let g=0,d=a.length;g<d;++g)c=this.drawFlatCoordinates_(f,c,a[g],y,l);this.hitDetectionInstructions.push(Vi),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Vi),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Vi),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(Ko)}}class S2 extends Vf{constructor(e,t,r,n){super(e,t,r,n)}drawFlatCoordinatess_(e,t,r,n,i){const o=this.state,l=o.fillStyle!==void 0,a=o.strokeStyle!==void 0,f=r.length;this.instructions.push(Ko),this.hitDetectionInstructions.push(Ko);for(let y=0;y<f;++y){const c=r[y],g=this.coordinates.length,d=this.appendFlatLineCoordinates(e,t,c,n,!0,!a);this.instructions.push([ze.MOVE_TO_LINE_TO,g,d,i*this.pixelRatio,!0]),this.hitDetectionInstructions.push([ze.MOVE_TO_LINE_TO,g,d,i,!0]),a&&(this.instructions.push(w2),this.hitDetectionInstructions.push(w2)),t=c}return l&&(this.instructions.push(Pc),this.hitDetectionInstructions.push(Pc)),a&&(this.instructions.push(Vi),this.hitDetectionInstructions.push(Vi)),t}drawCircle(e,t,r){const n=this.state,i=n.fillStyle,o=n.strokeStyle,l=n.strokeOffset;if(i===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,r)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,r),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([ze.SET_FILL_STYLE,mr]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([ze.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,fi,yi]);const a=e.getFlatCoordinates(),f=e.getStride(),y=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,f,!1,!1);const c=[ze.CIRCLE,y,l];this.instructions.push(Ko,c),this.hitDetectionInstructions.push(Ko,c),n.fillStyle!==void 0&&(this.instructions.push(Pc),this.hitDetectionInstructions.push(Pc)),n.strokeStyle!==void 0&&(this.instructions.push(Vi),this.hitDetectionInstructions.push(Vi)),this.endGeometry(t)}drawPolygon(e,t,r){const n=this.state,i=n.fillStyle,o=n.strokeStyle,l=n.strokeOffset;if(i===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,r)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,r),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([ze.SET_FILL_STYLE,mr]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([ze.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,fi,yi]);const a=e.getEnds(),f=e.getOrientedFlatCoordinates(),y=e.getStride();this.drawFlatCoordinatess_(f,0,a,y,l),this.endGeometry(t)}drawMultiPolygon(e,t,r){const n=this.state,i=n.fillStyle,o=n.strokeStyle,l=n.strokeOffset;if(i===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,r)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,r),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([ze.SET_FILL_STYLE,mr]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([ze.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,fi,yi]);const a=e.getEndss(),f=e.getOrientedFlatCoordinates(),y=e.getStride();let c=0;for(let g=0,d=a.length;g<d;++g)c=this.drawFlatCoordinatess_(f,c,a[g],y,l);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(e!==0){const t=this.coordinates;for(let r=0,n=t.length;r<n;++r)t[r]=Ro(t[r],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){const t=this.state,r=t.fillStyle,n=t.strokeStyle,i=t.strokeOffset;return Math.abs(i)>0&&r!==void 0&&n!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=n,t.strokeOffset=i,e(),t.fillStyle=r,!0):!1}}function QR(s,e,t,r,n){const i=[];let o=t,l=0,a=e.slice(t,2);for(;l<s&&o+n<r;){const[f,y]=a.slice(-2),c=e[o+n],g=e[o+n+1],d=Math.sqrt((c-f)*(c-f)+(g-y)*(g-y));if(l+=d,l>=s){const m=(s-l+d)/d,b=Cr(f,c,m),F=Cr(y,g,m);a.push(b,F),i.push(a),a=[b,F],l==s&&(o+=n),l=0}else if(l<s)a.push(e[o+n],e[o+n+1]),o+=n;else{const m=d-l,b=Cr(f,c,m/d),F=Cr(y,g,m/d);a.push(b,F),i.push(a),a=[b,F],l=0,o+=n}}return l>0&&i.push(a),i}function JR(s,e,t,r,n){let i=t,o=t,l=0,a=0,f=t,y,c,g,d,m,b,F,v,_,$;for(c=t;c<r;c+=n){const w=e[c],S=e[c+1];m!==void 0&&(_=w-m,$=S-b,d=Math.sqrt(_*_+$*$),F!==void 0&&(a+=g,y=Math.acos((F*_+v*$)/(g*d)),y>s&&(a>l&&(l=a,i=f,o=c),a=0,f=c-n)),g=d,F=_,v=$),m=w,b=S}return a+=d,a>l?[f,c]:[i,o]}const Nc={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class e7 extends Vf{constructor(e,t,r,n){super(e,t,r,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[mr]={fillStyle:mr},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,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,r){const n=this.textFillState_,i=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!n&&!i)return;const l=this.coordinates;let a=l.length;const f=e.getType();let y=null,c=e.getStride();if(o.placement==="line"&&(f=="LineString"||f=="MultiLineString"||f=="Polygon"||f=="MultiPolygon")){if(!qr(this.maxExtent,e.getExtent()))return;let g;if(y=e.getFlatCoordinates(),f=="LineString")g=[y.length];else if(f=="MultiLineString")g=e.getEnds();else if(f=="Polygon")g=e.getEnds().slice(0,1);else if(f=="MultiPolygon"){const F=e.getEndss();g=[];for(let v=0,_=F.length;v<_;++v)g.push(F[v][0])}this.beginGeometry(e,t,r);const d=o.repeat,m=d?void 0:o.textAlign;let b=0;for(let F=0,v=g.length;F<v;++F){let _;d?_=QR(d*this.resolution,y,b,g[F],c):_=[y.slice(b,g[F])];for(let $=0,w=_.length;$<w;++$){const S=_[$];let L=0,O=S.length;if(m==null){const C=JR(o.maxAngle,S,0,S.length,2);L=C[0],O=C[1]}for(let C=L;C<O;C+=c)l.push(S[C],S[C+1]);const T=l.length;b=g[F],this.drawChars_(a,T),a=T}}this.endGeometry(t)}else{let g=o.overflow?null:[];switch(f){case"Point":case"MultiPoint":y=e.getFlatCoordinates();break;case"LineString":y=e.getFlatMidpoint();break;case"Circle":y=e.getCenter();break;case"MultiLineString":y=e.getFlatMidpoints(),c=2;break;case"Polygon":y=e.getFlatInteriorPoint(),o.overflow||g.push(y[2]/this.resolution),c=3;break;case"MultiPolygon":const w=e.getFlatInteriorPoints();y=[];for(let S=0,L=w.length;S<L;S+=3)o.overflow||g.push(w[S+2]/this.resolution),y.push(w[S],w[S+1]);if(y.length===0)return;c=2;break}const d=this.appendFlatPointCoordinates(y,c);if(d===a)return;if(g&&(d-a)/2!==y.length/c){let w=a/2;g=g.filter((S,L)=>{const O=l[(w+L)*2]===y[L*c]&&l[(w+L)*2+1]===y[L*c+1];return O||--w,O})}this.saveTextStates_();const m=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,b=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,r);let F=o.padding;if(F!=Wo&&(o.scale[0]<0||o.scale[1]<0)){let w=o.padding[0],S=o.padding[1],L=o.padding[2],O=o.padding[3];o.scale[0]<0&&(S=-S,O=-O),o.scale[1]<0&&(w=-w,L=-L),F=[w,S,L,O]}const v=this.pixelRatio;this.instructions.push([ze.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,F==Wo?Wo:F.map(function(w){return w*v}),m,b,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,g]);const _=1/v,$=m?m.slice(0):null;$&&($[1]=mr),this.hitDetectionInstructions.push([ze.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,this.declutterMode_,this.declutterImageWithText_,F,$,b,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?mr:this.fillKey_,this.textOffsetX_,this.textOffsetY_,g]),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,r=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 i=this.textKey_;i in this.textStates||(this.textStates[i]={font:t.font,textAlign:t.textAlign||Pf,justify:t.justify,textBaseline:t.textBaseline||Lc,scale:t.scale});const o=this.fillKey_;r&&(o in this.fillStates||(this.fillStates[o]={fillStyle:r.fillStyle}))}drawChars_(e,t){const r=this.textStrokeState_,n=this.textState_,i=this.strokeKey_,o=this.textKey_,l=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,f=Nc[n.textBaseline],y=this.textOffsetY_*a,c=this.text_,g=r?r.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([ze.DRAW_CHARS,e,t,f,n.overflow,l,n.maxAngle,a,y,i,g*a,c,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([ze.DRAW_CHARS,e,t,f,n.overflow,l&&mr,n.maxAngle,a,y,i,g*a,c,o,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(e,t){let r,n,i;if(!e)this.text_="";else{const o=e.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Gn(o.getColor()||mr)):(n=null,this.textFillState_=n);const l=e.getStroke();if(!l)i=null,this.textStrokeState_=i;else{i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);const b=l.getLineDash(),F=l.getLineDashOffset(),v=l.getWidth(),_=l.getMiterLimit();i.lineCap=l.getLineCap()||zl,i.lineDash=b?b.slice():fi,i.lineDashOffset=F===void 0?yi:F,i.lineJoin=l.getLineJoin()||Gl,i.lineWidth=v===void 0?Nf:v,i.miterLimit=_===void 0?Af:_,i.strokeStyle=Gn(l.getColor()||Mf)}r=this.textState_;const a=e.getFont()||e2;SR(a);const f=e.getScaleArray();r.overflow=e.getOverflow(),r.font=a,r.maxAngle=e.getMaxAngle(),r.placement=e.getPlacement(),r.textAlign=e.getTextAlign(),r.repeat=e.getRepeat(),r.justify=e.getJustify(),r.textBaseline=e.getTextBaseline()||Lc,r.backgroundFill=e.getBackgroundFill(),r.backgroundStroke=e.getBackgroundStroke(),r.padding=e.getPadding()||Wo,r.scale=f===void 0?[1,1]:f;const y=e.getOffsetX(),c=e.getOffsetY(),g=e.getRotateWithView(),d=e.getKeepUpright(),m=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=y===void 0?0:y,this.textOffsetY_=c===void 0?0:c,this.textRotateWithView_=g===void 0?!1:g,this.textKeepUpright_=d===void 0?!0:d,this.textRotation_=m===void 0?0:m,this.strokeKey_=i?(typeof i.strokeStyle=="string"?i.strokeStyle:ns(i.strokeStyle))+i.lineCap+i.lineDashOffset+"|"+i.lineWidth+i.lineJoin+i.miterLimit+"["+i.lineDash.join()+"]":"",this.textKey_=r.font+r.scale+(r.textAlign||"?")+(r.repeat||"?")+(r.justify||"?")+(r.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?typeof n.fillStyle=="string"?n.fillStyle:"|"+ns(n.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const t7={Circle:S2,Default:Vf,Image:HR,LineString:ZR,Polygon:S2,Text:e7};class s7{constructor(e,t,r,n){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=n,this.resolution_=r,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const r=this.buildersByZIndex_[t];for(const n in r){const i=r[n].finish();e[t][n]=i}}return e}getBuilder(e,t){const r=e!==void 0?e.toString():"0";let n=this.buildersByZIndex_[r];n===void 0&&(n={},this.buildersByZIndex_[r]=n);let i=n[t];if(i===void 0){const o=t7[t];i=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[t]=i}return i}}function wm(s,e,t,r){let n=s[e],i=s[e+1],o=0;for(let l=e+r;l<t;l+=r){const a=s[l],f=s[l+1];o+=Math.sqrt((a-n)*(a-n)+(f-i)*(f-i)),n=a,i=f}return o}function r7(s,e,t,r,n,i){n=n??[],i=i??e;const o=s[0],l=s[1],a=s[s.length-4],f=s[s.length-3];let y,c,g,d,m,b,F,v,_=0;for(let $=0;$<s.length;$+=e){g=y,d=c,m=void 0,b=void 0,$+e<s.length&&(m=s[$+e],b=s[$+e+1]),r&&$===0&&(g=a,d=f),r&&$===s.length-2&&(m=o,b=l),y=s[$],c=s[$+1],[F,v]=kc(y,c,g,d,m,b,t),n[_++]=F,n[_++]=v;for(let w=2;w<i;w++)n[_++]=s[$+w]}return n.length!=_&&(n.length=_),n}function kc(s,e,t,r,n,i,o){let l,a;t!==void 0&&r!==void 0?(l=s-t,a=e-r):n!==void 0&&i!==void 0?(l=n-s,a=i-e):(l=1,a=0);const f=Math.hypot(l,a),y=l/f,c=a/f;if(l=-c,a=y,t===void 0||r===void 0)return[s+l*o,e+a*o];if(n===void 0||i===void 0)return[s+l*o,e+a*o];const g=q8([s,e],[t,r],[n,i]);if(Math.cos(g)>.998)return[s+y*o,e+c*o];const d=Math.cos(g/2),m=Math.sin(g/2),b=m*l+d*a,F=-d*l+m*a,v=b*(1/m),_=F*(1/m);return[s+v*o,e+_*o]}function n7(s,e,t,r,n,i,o,l,a,f,y,c,g=!0){let d=s[e],m=s[e+1],b=0,F=0,v=0,_=0;function $(){b=d,F=m,e+=r,d=s[e],m=s[e+1],_+=v,v=Math.sqrt((d-b)*(d-b)+(m-F)*(m-F))}do $();while(e<t-r&&_+v<i);let w=v===0?0:(i-_)/v;const S=Cr(b,d,w),L=Cr(F,m,w),O=e-r,T=_,C=i+l*a(f,n,y);for(;e<t-r&&_+v<C;)$();w=v===0?0:(C-_)/v;const x=Cr(b,d,w),M=Cr(F,m,w);let G=!1;if(g)if(c){const q=[S,L,x,M];dw(q,0,4,2,c,q,q),G=q[0]>q[2]}else G=S>x;const K=Math.PI,Z=[],W=O+r===e;e=O,v=0,_=T,d=s[e],m=s[e+1];let B;if(W){$(),B=Math.atan2(m-F,d-b),G&&(B+=B>0?-K:K);const q=(x+S)/2,ne=(M+L)/2;return Z[0]=[q,ne,(C-i)/2,B,n],Z}n=n.replace(/\n/g," ");for(let q=0,ne=n.length;q<ne;){$();let ee=Math.atan2(m-F,d-b);if(G&&(ee+=ee>0?-K:K),B!==void 0){let Q=ee-B;if(Q+=Q>K?-2*K:Q<-K?2*K:0,Math.abs(Q)>o)return null}B=ee;const ae=q;let se=0;for(;q<ne;++q){const Q=G?ne-q-1:q,oe=l*a(f,n[Q],y);if(e+r<t&&_+v<i+se+oe/2)break;se+=oe}if(q===ae)continue;const J=G?n.substring(ne-ae,ne-q):n.substring(ae,q);w=v===0?0:(i+se/2-_)/v;const we=Cr(b,d,w),ue=Cr(F,m,w);Z.push([we,ue,se/2,ee,J]),i+=se}return Z}class E2{constructor(){Le(this,"pushMethodArgs_",(...e)=>(this.push_(e),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Sc(),{get:(e,t)=>{if(typeof Sc()[t]=="function")return this.push_(t),this.pushMethodArgs_},set:(e,t,r)=>(this.push_(t,r),!0)})}push_(...e){const t=this.instructions_,r=this.zIndex+this.offset_;t[r]||(t[r]=[]),t[r].push(...e)}pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let r=0,n=t.length;r<n;++r){const i=t[r];if(typeof i=="function"){i(e);continue}const o=t[++r];if(typeof e[i]=="function")e[i](...o);else{if(typeof o=="function"){e[i]=o(e);continue}e[i]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const Ul=ki(),Ki=[],gi=[],ui=[],Yi=[];function x2(s){return s[3].declutterBox}const C2=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function Sm(s,e){return e==="start"?e=C2.test(s)?"right":"left":e==="end"&&(e=C2.test(s)?"left":"right"),Nc[e]}function i7(s,e,t){return t>0&&s.push(`
13
13
  `,""),s.push(e,""),s}function o7(s,e,t){return t%2===0&&(s+=e),s}class l7{constructor(e,t,r,n,i){this.overlaps=r,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=Wr(),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_={},this.zIndexContext_=i?new E2:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,r,n){const i=e+t+r+n;if(this.labels_[i])return this.labels_[i];const o=n?this.strokeStates[n]:null,l=r?this.fillStates[r]:null,a=this.textStates[t],f=this.pixelRatio,y=[a.scale[0]*f,a.scale[1]*f],c=a.justify?Nc[a.justify]:Sm(Array.isArray(e)?e[0]:e,a.textAlign||Pf),g=n&&o.lineWidth?o.lineWidth:0,d=Array.isArray(e)?e:String(e).split(`
14
14
  `).reduce(i7,[]),{width:m,height:b,widths:F,heights:v,lineWidths:_}=xR(a,d),$=m+g,w=[],S=($+2)*y[0],L=(b+g)*y[1],O={width:S<0?Math.floor(S):Math.ceil(S),height:L<0?Math.floor(L):Math.ceil(L),contextInstructions:w};(y[0]!=1||y[1]!=1)&&w.push("scale",y),n&&(w.push("strokeStyle",o.strokeStyle),w.push("lineWidth",g),w.push("lineCap",o.lineCap),w.push("lineJoin",o.lineJoin),w.push("miterLimit",o.miterLimit),w.push("setLineDash",[o.lineDash]),w.push("lineDashOffset",o.lineDashOffset)),r&&w.push("fillStyle",l.fillStyle),w.push("textBaseline","middle"),w.push("textAlign","center");const T=.5-c;let C=c*$+T*g;const x=[],M=[];let G=0,K=0,Z=0,W=0,B;for(let q=0,ne=d.length;q<ne;q+=2){const ee=d[q];if(ee===`
15
- `){K+=G,G=0,C=c*$+T*g,++W;continue}const ae=d[q+1]||a.font;ae!==B&&(n&&x.push("font",ae),r&&M.push("font",ae),B=ae),G=Math.max(G,v[Z]);const se=[ee,C+T*F[Z]+c*(F[Z]-_[W]),.5*(g+G)+K];C+=F[Z],n&&x.push("strokeText",se),r&&M.push("fillText",se),++Z}return Array.prototype.push.apply(w,x),Array.prototype.push.apply(w,M),this.labels_[i]=O,O}replayTextBackground_(e,t,r,n,i,o,l){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,r),e.lineTo.apply(e,n),e.lineTo.apply(e,i),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),l&&(this.setStrokeStyle_(e,l),e.stroke())}calculateImageOrLabelDimensions_(e,t,r,n,i,o,l,a,f,y,c,g,d,m,b,F){l*=g[0],a*=g[1];let v=r-l,_=n-a;const $=i+f>e?e-f:i,w=o+y>t?t-y:o,S=m[3]+$*g[0]+m[1],L=m[0]+w*g[1]+m[2],O=v-m[3],T=_-m[0];(b||c!==0)&&(Ki[0]=O,Yi[0]=O,Ki[1]=T,gi[1]=T,gi[0]=O+S,ui[0]=gi[0],ui[1]=T+L,Yi[1]=ui[1]);let C;return c!==0?(C=Di(Wr(),r,n,1,1,c,-r,-n),rr(C,Ki),rr(C,gi),rr(C,ui),rr(C,Yi),Cl(Math.min(Ki[0],gi[0],ui[0],Yi[0]),Math.min(Ki[1],gi[1],ui[1],Yi[1]),Math.max(Ki[0],gi[0],ui[0],Yi[0]),Math.max(Ki[1],gi[1],ui[1],Yi[1]),Ul)):Cl(Math.min(O,O+S),Math.min(T,T+L),Math.max(O,O+S),Math.max(T,T+L),Ul),d&&(v=Math.round(v),_=Math.round(_)),{drawImageX:v,drawImageY:_,drawImageW:$,drawImageH:w,originX:f,originY:y,declutterBox:{minX:Ul[0],minY:Ul[1],maxX:Ul[2],maxY:Ul[3],value:F},canvasTransform:C,scale:g}}replayImageOrLabel_(e,t,r,n,i,o,l){const a=!!(o||l),f=n.declutterBox,y=l?l[2]*n.scale[0]/2:0;return f.minX-y<=t[0]&&f.maxX+y>=0&&f.minY-y<=t[1]&&f.maxY+y>=0&&(a&&this.replayTextBackground_(e,Ki,gi,ui,Yi,o,l),CR(e,n.canvasTransform,i,r,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const r=rr(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;e.save(),e.translate(r[0]%n,r[1]%n),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],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,r,n){const i=this.textStates[t],o=this.createLabel(e,t,n,r),l=this.strokeStates[r],a=this.pixelRatio,f=Sm(Array.isArray(e)?e[0]:e,i.textAlign||Pf),y=Nc[i.textBaseline||Lc],c=l&&l.lineWidth?l.lineWidth:0,g=o.width/a-2*i.scale[0],d=f*g+2*(.5-f)*c,m=y*o.height/a+2*(.5-y)*c;return{label:o,anchorX:d,anchorY:m}}execute_(e,t,r,n,i,o,l,a){const f=this.zIndexContext_;let y;this.pixelCoordinates_&&Ai(r,this.renderedTransform_)?y=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),y=Ri(this.coordinates,0,this.coordinates.length,2,r,this.pixelCoordinates_),SD(this.renderedTransform_,r));let c=0;const g=n.length;let d=0,m,b,F,v,_,$,w,S,L,O,T,C,x,M,G,K,Z=0,W=0;const B=this.coordinateCache_,q=this.viewRotation_,ne=Math.round(Math.atan2(-r[1],r[0])*1e12)/1e12,ee={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:q},ae=this.instructions!=n||this.overlaps?0:200;let se,J,we,ue;for(;c<g;){const Q=n[c];switch(Q[0]){case ze.BEGIN_GEOMETRY:se=Q[1],ue=Q[3],se.getGeometry()?l!==void 0&&!qr(l,ue.getExtent())?c=Q[2]+1:++c:c=Q[2],f&&(f.zIndex=Q[4]);break;case ze.BEGIN_PATH:Z>ae&&(this.fill_(e),Z=0),W>ae&&(e.stroke(),W=0),!Z&&!W&&(e.beginPath(),S=NaN,L=NaN),++c;break;case ze.CIRCLE:d=Q[1],v=Q[2]??0;const ge=y[d],Xe=y[d+1],Te=y[d+2]-v,be=y[d+3]-v,qe=Te-ge,P=be-Xe,I=Math.sqrt(qe*qe+P*P);e.moveTo(ge+I,Xe),e.arc(ge,Xe,I,0,2*Math.PI,!0),++c;break;case ze.CLOSE_PATH:e.closePath(),++c;break;case ze.CUSTOM:d=Q[1],m=Q[2];const V=Q[3],R=Q[4],Re=Q[5];ee.geometry=V,ee.feature=se,c in B||(B[c]=[]);const Ae=B[c];Re?Re(y,d,m,2,Ae):(Ae[0]=y[d],Ae[1]=y[d+1],Ae.length=2),f&&(f.zIndex=Q[6]),R(Ae,ee),++c;break;case ze.DRAW_IMAGE:d=Q[1],m=Q[2],C=Q[3],b=Q[4],F=Q[5];let Be=Q[6];const $e=Q[7],ye=Q[8],ve=Q[9],je=Q[10];let de=Q[11];const H=Q[12];let Ot=Q[13];w=Q[14]||"declutter";const re=Q[15];if(!C&&Q.length>=20){x=Q[19],M=Q[20],G=Q[21],K=Q[22];const kt=this.drawLabelWithPointPlacement_(x,M,G,K);C=kt.label,Q[3]=C;const Js=Q[23];b=(kt.anchorX-Js)*this.pixelRatio,Q[4]=b;const Ft=Q[24];F=(kt.anchorY-Ft)*this.pixelRatio,Q[5]=F,Be=C.height,Q[6]=Be,Ot=C.width,Q[13]=Ot}let Wt;Q.length>25&&(Wt=Q[25]);let pt,Ht,Qs;Q.length>17?(pt=Q[16],Ht=Q[17],Qs=Q[18]):(pt=Wo,Ht=null,Qs=null),je&&ne?de+=q:!je&&!ne&&(de-=q);let gt=0;for(;d<m;d+=2){if(Wt&&Wt[gt++]<Ot/this.pixelRatio)continue;const kt=this.calculateImageOrLabelDimensions_(C.width,C.height,y[d],y[d+1],Ot,Be,b,F,ye,ve,de,H,i,pt,!!Ht||!!Qs,se),Js=[e,t,C,kt,$e,Ht,Qs];if(a){let Ft,hs,Mt;if(re){const xt=m-d;if(!re[xt]){re[xt]={args:Js,declutterMode:w};continue}const Dt=re[xt];Ft=Dt.args,hs=Dt.declutterMode,delete re[xt],Mt=x2(Ft)}let cs,Es;if(Ft&&(hs!=="declutter"||!a.collides(Mt))&&(cs=!0),(w!=="declutter"||!a.collides(kt.declutterBox))&&(Es=!0),hs==="declutter"&&w==="declutter"){const xt=cs&&Es;cs=xt,Es=xt}cs&&(hs!=="none"&&a.insert(Mt),this.replayImageOrLabel_.apply(this,Ft)),Es&&(w!=="none"&&a.insert(kt.declutterBox),this.replayImageOrLabel_.apply(this,Js))}else this.replayImageOrLabel_.apply(this,Js)}++c;break;case ze.DRAW_CHARS:const js=Q[1],ls=Q[2],as=Q[3],$n=Q[4];K=Q[5];const Qn=Q[6],Zt=Q[7],Gs=Q[8];G=Q[9];const vs=Q[10];x=Q[11],Array.isArray(x)&&(x=x.reduce(o7,"")),M=Q[12];const Jn=[Q[13],Q[13]];w=Q[14]||"declutter";const nn=Q[15],At=this.textStates[M],bt=At.font,Vt=[At.scale[0]*Zt,At.scale[1]*Zt];let fs;bt in this.widths_?fs=this.widths_[bt]:(fs={},this.widths_[bt]=fs);const ys=wm(y,js,ls,2),Gt=Math.abs(Vt[0])*n2(bt,x,fs);if($n||Gt<=ys){const kt=this.textStates[M].textAlign,Js=(ys-Gt)*Sm(x,kt),Ft=n7(y,js,ls,2,x,Js,Qn,Math.abs(Vt[0]),n2,bt,fs,ne?0:this.viewRotation_,nn);e:if(Ft){const hs=[];let Mt,cs,Es,xt,Dt;if(G)for(Mt=0,cs=Ft.length;Mt<cs;++Mt){Dt=Ft[Mt],Es=Dt[4],xt=this.createLabel(Es,M,"",G),b=Dt[2]+(Vt[0]<0?-vs:vs),F=as*xt.height+(.5-as)*2*vs*Vt[1]/Vt[0]-Gs;const Bs=this.calculateImageOrLabelDimensions_(xt.width,xt.height,Dt[0],Dt[1],xt.width,xt.height,b,F,0,0,Dt[3],Jn,!1,Wo,!1,se);if(a&&w==="declutter"&&a.collides(Bs.declutterBox))break e;hs.push([e,t,xt,Bs,1,null,null])}if(K)for(Mt=0,cs=Ft.length;Mt<cs;++Mt){Dt=Ft[Mt],Es=Dt[4],xt=this.createLabel(Es,M,K,""),b=Dt[2],F=as*xt.height-Gs;const Bs=this.calculateImageOrLabelDimensions_(xt.width,xt.height,Dt[0],Dt[1],xt.width,xt.height,b,F,0,0,Dt[3],Jn,!1,Wo,!1,se);if(a&&w==="declutter"&&a.collides(Bs.declutterBox))break e;hs.push([e,t,xt,Bs,1,null,null])}a&&w!=="none"&&a.load(hs.map(x2));for(let Bs=0,ll=hs.length;Bs<ll;++Bs)this.replayImageOrLabel_.apply(this,hs[Bs])}}++c;break;case ze.END_GEOMETRY:if(o!==void 0){se=Q[1];const kt=o(se,ue,w);if(kt)return kt}++c;break;case ze.FILL:ae?Z++:this.fill_(e),++c;break;case ze.MOVE_TO_LINE_TO:for(d=Q[1],m=Q[2],v=Q[3],_=Q[4]??!1,J=y[d],we=y[d+1],v&&($=d,[J,we]=kc(J,we,_?y[m-4]:void 0,_?y[m-3]:void 0,y[d+2],y[d+3],v)),e.moveTo(J,we),S=J+.5|0,L=we+.5|0,d+=2;d<m;d+=2)J=y[d],we=y[d+1],O=J+.5|0,T=we+.5|0,(d==m-2||O!==S||T!==L)&&(v&&(d==m-2?[J,we]=kc(J,we,y[d-2],y[d-1],_?y[$+2]:void 0,_?y[$+3]:void 0,v):[J,we]=kc(J,we,y[d-2],y[d-1],y[d+2],y[d+3],v)),e.lineTo(J,we),S=O,L=T);++c;break;case ze.SET_FILL_STYLE:this.alignAndScaleFill_=Q[2],Z&&(this.fill_(e),Z=0,W&&(e.stroke(),W=0)),e.fillStyle=Q[1],++c;break;case ze.SET_STROKE_STYLE:W&&(e.stroke(),W=0),this.setStrokeStyle_(e,Q),++c;break;case ze.STROKE:ae?W++:e.stroke(),++c;break;default:++c;break}}Z&&this.fill_(e),W&&e.stroke()}execute(e,t,r,n,i,o){this.viewRotation_=n,this.execute_(e,t,r,this.instructions,i,void 0,void 0,o)}executeHitDetection(e,t,r,n,i){return this.viewRotation_=r,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,n,i)}}const Yo=["Polygon","Circle","LineString","Image","Text","Default"],T2=["Image","Text"],a7=Yo.filter(s=>!T2.includes(s));let L2=!1,I2=!1;function f7(){let s=0;const e=r=>{const n=Xs(1,1,null,{willReadFrequently:r});let i=0;const o=performance.now();for(;performance.now()-o<50;++i)n.fillStyle=`rgba(255,0,${i%256},1)`,n.fillRect(0,0,1,1),n.getImageData(0,0,1,1);return s=i>s?i:s,i};L2={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[s],I2=!0}class y7{constructor(e,t,r,n,i,o,l){this.maxExtent_=e,this.overlaps_=n,this.pixelRatio_=r,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Wr(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,l)}clip(e,t){const r=this.getClipCoords(t);e.beginPath(),e.moveTo(r[0],r[1]),e.lineTo(r[2],r[3]),e.lineTo(r[4],r[5]),e.lineTo(r[6],r[7]),e.clip()}createExecutors_(e,t){for(const r in e){let n=this.executorsByZIndex_[r];n===void 0&&(n={},this.executorsByZIndex_[r]=n);const i=e[r];for(const o in i){const l=i[o];n[o]=new l7(this.resolution_,this.pixelRatio_,this.overlaps_,l,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const r=this.executorsByZIndex_[t];for(let n=0,i=e.length;n<i;++n)if(e[n]in r)return!0}return!1}forEachFeatureAtCoordinate(e,t,r,n,i,o){I2===!1&&f7(),n=Math.round(n);const l=n*2+1,a=Di(this.hitDetectionTransform_,n+.5,n+.5,1/t,-1/t,-r,-e[0],-e[1]),f=!this.hitDetectionContext_;f&&(this.hitDetectionContext_=Xs(l,l,null,{willReadFrequently:L2}));const y=this.hitDetectionContext_;y.canvas.width!==l||y.canvas.height!==l?(y.canvas.width=l,y.canvas.height=l):f||y.clearRect(0,0,l,l);let c;this.renderBuffer_!==void 0&&(c=ki(),A8(c,e),cp(c,t*(this.renderBuffer_+n),c));const g=h7(n);let d;function m(S,L,O){const T=y.getImageData(0,0,l,l).data;for(let C=0,x=g.length;C<x;C++)if(T[g[C]]>0){if(!o||O==="none"||d!=="Image"&&d!=="Text"||o.includes(S)){const M=(g[C]-3)/4,G=n-M%l,K=n-(M/l|0),Z=i(S,L,G*G+K*K);if(Z)return Z}y.clearRect(0,0,l,l);break}}const b=Object.keys(this.executorsByZIndex_).map(Number);b.sort(Co);let F,v,_,$,w;for(F=b.length-1;F>=0;--F){const S=b[F].toString();for(_=this.executorsByZIndex_[S],v=Yo.length-1;v>=0;--v)if(d=Yo[v],$=_[d],$!==void 0&&(w=$.executeHitDetection(y,a,r,m,c),w))return w}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const r=t[0],n=t[1],i=t[2],o=t[3],l=[r,n,r,o,i,o,i,n];return Ri(l,0,8,2,e,l),l}isEmpty(){return To(this.executorsByZIndex_)}execute(e,t,r,n,i,o,l){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(l?F8:Co),o=o||Yo;const f=Yo.length;for(let y=0,c=a.length;y<c;++y){const g=a[y].toString(),d=this.executorsByZIndex_[g];for(let m=0,b=o.length;m<b;++m){const F=o[m],v=d[F];if(v!==void 0){const _=l===null?void 0:v.getZIndexContext(),$=_?_.getContext():e,w=this.maxExtent_&&F!=="Image"&&F!=="Text";if(w&&($.save(),this.clip($,r)),!_||F==="Text"||F==="Image"?v.execute($,t,r,n,i,l):_.pushFunction(S=>v.execute(S,t,r,n,i,l)),w&&$.restore(),_){_.offset();const S=a[y]*f+Yo.indexOf(F);this.deferredZIndexContexts_[S]||(this.deferredZIndexContexts_[S]=[]),this.deferredZIndexContexts_[S].push(_)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Co);for(let r=0,n=t.length;r<n;++r)e[t[r]].forEach(i=>{i.draw(this.renderedContext_),i.clear()}),e[t[r]].length=0}}const Em={};function h7(s){if(Em[s]!==void 0)return Em[s];const e=s*2+1,t=s*s,r=new Array(t+1);for(let i=0;i<=s;++i)for(let o=0;o<=s;++o){const l=i*i+o*o;if(l>t)break;let a=r[l];a||(a=[],r[l]=a),a.push(((s+i)*e+(s+o))*4+3),i>0&&a.push(((s-i)*e+(s+o))*4+3),o>0&&(a.push(((s+i)*e+(s-o))*4+3),i>0&&a.push(((s-i)*e+(s-o))*4+3))}const n=[];for(let i=0,o=r.length;i<o;++i)r[i]&&n.push(...r[i]);return Em[s]=n,n}class O2 extends $2{constructor(e,t,r,n,i,o,l){super(),this.context_=e,this.pixelRatio_=t,this.extent_=r,this.transform_=n,this.transformRotation_=n?R$(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=i,this.squaredTolerance_=o,this.userTransform_=l,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_=Wr()}drawImages_(e,t,r,n){if(!this.image_)return;const i=Ri(e,t,r,n,this.transform_,this.pixelCoordinates_),o=this.context_,l=this.tmpLocalTransform_,a=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=a*this.imageOpacity_);let f=this.imageRotation_;this.transformRotation_===0&&(f-=this.viewRotation_),this.imageRotateWithView_&&(f+=this.viewRotation_);for(let y=0,c=i.length;y<c;y+=2){const g=i[y]-this.imageAnchorX_,d=i[y+1]-this.imageAnchorY_;if(f!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const m=g+this.imageAnchorX_,b=d+this.imageAnchorY_;Di(l,m,b,1,1,f,-m,-b),o.save(),o.transform.apply(o,l),o.translate(m,b),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.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,g,d,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=a)}drawText_(e,t,r,n){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const i=Ri(e,t,r,n,this.transform_,this.pixelCoordinates_),o=this.context_;let l=this.textRotation_;for(this.transformRotation_===0&&(l-=this.viewRotation_),this.textRotateWithView_&&(l+=this.viewRotation_);t<r;t+=n){const a=i[t]+this.textOffsetX_,f=i[t+1]+this.textOffsetY_;l!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(a-this.textOffsetX_,f-this.textOffsetY_),o.rotate(l),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.restore()):(this.textStrokeState_&&o.strokeText(this.text_,a,f),this.textFillState_&&o.fillText(this.text_,a,f))}}moveToLineTo_(e,t,r,n,i,o){const l=this.context_;let a=Ri(e,t,r,n,this.transform_,this.pixelCoordinates_);Math.abs(o)>0&&(a=r7(a,n,o,i,a)),l.moveTo(a[0],a[1]);let f=a.length;i&&(f-=2);for(let y=2;y<f;y+=2)l.lineTo(a[y],a[y+1]);return i&&l.closePath(),r}drawRings_(e,t,r,n,i){for(let o=0,l=r.length;o<l;++o)t=this.moveToLineTo_(e,t,r[o],n,!0,i);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!qr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=MD(e,this.transform_,this.pixelCoordinates_),r=t[2]-t[0],n=t[3]-t[1],i=Math.sqrt(r*r+n*n),o=this.context_;o.beginPath(),o.arc(t[0],t[1],i,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}}drawFeature(e,t){const r=t.getGeometryFunction()(e);r&&(this.setStyle(t),this.drawGeometry(r))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let r=0,n=t.length;r<n;++r)this.drawGeometry(t[r])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),r=e.getStride();this.image_&&this.drawImages_(t,0,t.length,r),this.text_!==""&&this.drawText_(t,0,t.length,r)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),r=e.getStride();this.image_&&this.drawImages_(t,0,t.length,r),this.text_!==""&&this.drawText_(t,0,t.length,r)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!qr(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,r=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(r,0,r.length,e.getStride(),!1,this.strokeState_.strokeOffset),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(qr(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const r=this.context_,n=e.getFlatCoordinates();let i=0;const o=e.getEnds(),l=e.getStride();r.beginPath();for(let a=0,f=o.length;a<f;++a)i=this.moveToLineTo_(n,i,o[a],l,!1,this.strokeState_.strokeOffset);r.stroke()}if(this.text_!==""){const r=e.getFlatMidpoints();this.drawText_(r,0,r.length,2)}}}drawPolygon(e){var t;if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!qr(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const r=this.context_;r.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),(t=this.strokeState_)==null?void 0:t.strokeOffset),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}if(this.text_!==""){const r=e.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}}drawMultiPolygon(e){var t;if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!qr(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const r=this.context_,n=e.getOrientedFlatCoordinates();let i=0;const o=e.getEndss(),l=e.getStride();r.beginPath();for(let a=0,f=o.length;a<f;++a){const y=o[a];i=this.drawRings_(n,i,y,l,(t=this.strokeState_)==null?void 0:t.strokeOffset)}this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}if(this.text_!==""){const r=e.getFlatInteriorPoints();this.drawText_(r,0,r.length,2)}}}setContextFillState_(e){const t=this.context_,r=this.contextFillState_;r?r.fillStyle!=e.fillStyle&&(r.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=e.lineCap&&(r.lineCap=e.lineCap,t.lineCap=e.lineCap),Ai(r.lineDash,e.lineDash)||t.setLineDash(r.lineDash=e.lineDash),r.lineDashOffset!=e.lineDashOffset&&(r.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),r.lineJoin!=e.lineJoin&&(r.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),r.lineWidth!=e.lineWidth&&(r.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),r.miterLimit!=e.miterLimit&&(r.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),r.strokeStyle!=e.strokeStyle&&(r.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_,r=this.contextTextState_,n=e.textAlign?e.textAlign:Pf;r?(r.font!=e.font&&(r.font=e.font,t.font=e.font),r.textAlign!=n&&(r.textAlign=n,t.textAlign=n),r.textBaseline!=e.textBaseline&&(r.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 r=e.getColor();this.fillState_={fillStyle:Gn(r||mr)}}if(!t)this.strokeState_=null;else{const r=t.getColor(),n=t.getLineCap(),i=t.getLineDash(),o=t.getLineDashOffset(),l=t.getLineJoin(),a=t.getWidth(),f=t.getMiterLimit(),y=i||fi,c=t.getOffset();this.strokeState_={lineCap:n!==void 0?n:zl,lineDash:this.pixelRatio_===1?y:y.map(g=>g*this.pixelRatio_),lineDashOffset:(o||yi)*this.pixelRatio_,lineJoin:l!==void 0?l:Gl,lineWidth:(a!==void 0?a:Nf)*this.pixelRatio_,miterLimit:f!==void 0?f:Af,strokeStyle:Gn(r||Mf),strokeOffset:(c??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const r=e.getPixelRatio(this.pixelRatio_),n=e.getAnchor(),i=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*r,this.imageAnchorY_=n[1]*r,this.imageHeight_=t[1]*r,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/r,o[1]*this.pixelRatio_/r],this.imageWidth_=t[0]*r}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const d=t.getColor();this.textFillState_={fillStyle:Gn(d||mr)}}const r=e.getStroke();if(!r)this.textStrokeState_=null;else{const d=r.getColor(),m=r.getLineCap(),b=r.getLineDash(),F=r.getLineDashOffset(),v=r.getLineJoin(),_=r.getWidth(),$=r.getMiterLimit();this.textStrokeState_={lineCap:m!==void 0?m:zl,lineDash:b||fi,lineDashOffset:F||yi,lineJoin:v!==void 0?v:Gl,lineWidth:_!==void 0?_:Nf,miterLimit:$!==void 0?$:Af,strokeStyle:Gn(d||Mf)}}const n=e.getFont(),i=e.getOffsetX(),o=e.getOffsetY(),l=e.getRotateWithView(),a=e.getRotation(),f=e.getScaleArray(),y=e.getText(),c=e.getTextAlign(),g=e.getTextBaseline();this.textState_={font:n!==void 0?n:e2,textAlign:c!==void 0?c:Pf,textBaseline:g!==void 0?g:Lc},this.text_=y!==void 0?Array.isArray(y)?y.reduce((d,m,b)=>d+=b%2?" ":m,""):y:"",this.textOffsetX_=i!==void 0?this.pixelRatio_*i:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=l!==void 0?l:!1,this.textRotation_=a!==void 0?a:0,this.textScale_=[this.pixelRatio_*f[0],this.pixelRatio_*f[1]]}}}const Bn=.5;function c7(s,e,t,r,n,i,o,l,a){const f=n,y=s[0]*Bn,c=s[1]*Bn,g=Xs(y,c);g.imageSmoothingEnabled=!1;const d=g.canvas,m=new O2(g,Bn,n,null,o,l,null),b=t.length,F=Math.floor((256*256*256-1)/b),v={};for(let $=1;$<=b;++$){const w=t[$-1],S=w.getStyleFunction()||r;if(!S)continue;let L=S(w,i);if(!L)continue;Array.isArray(L)||(L=[L]);const T=($*F).toString(16).padStart(7,"#00000");for(let C=0,x=L.length;C<x;++C){const M=L[C],G=M.getGeometryFunction()(w);if(!G||!qr(f,G.getExtent()))continue;const K=M.clone(),Z=K.getFill();Z&&Z.setColor(T);const W=K.getStroke();W&&(W.setColor(T),W.setLineDash(null)),K.setText(void 0);const B=M.getImage();if(B){const ae=B.getImageSize();if(!ae)continue;const se=Xs(ae[0],ae[1],void 0,{alpha:!1}),J=se.canvas;se.fillStyle=T,se.fillRect(0,0,J.width,J.height),K.setImage(new Gf({img:J,anchor:B.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:B.getOrigin(),opacity:1,size:B.getSize(),scale:B.getScale(),rotation:B.getRotation(),rotateWithView:B.getRotateWithView()}))}const q=K.getZIndex()||0;let ne=v[q];ne||(ne={},v[q]=ne,ne.Polygon=[],ne.Circle=[],ne.LineString=[],ne.Point=[]);const ee=G.getType();if(ee==="GeometryCollection"){const ae=G.getGeometriesArrayRecursive();for(let se=0,J=ae.length;se<J;++se){const we=ae[se];ne[we.getType().replace("Multi","")].push(we,K)}}else ne[ee.replace("Multi","")].push(G,K)}}const _=Object.keys(v).map(Number).sort(Co);for(let $=0,w=_.length;$<w;++$){const S=v[_[$]];for(const L in S){const O=S[L];for(let T=0,C=O.length;T<C;T+=2){m.setStyle(O[T+1]);for(let x=0,M=e.length;x<M;++x)m.setTransform(e[x]),m.drawGeometry(O[T])}}}return g.getImageData(0,0,d.width,d.height)}function g7(s,e,t){const r=[];if(t){const n=Math.floor(Math.round(s[0])*Bn),i=Math.floor(Math.round(s[1])*Bn),o=(Yt(n,0,t.width-1)+Yt(i,0,t.height-1)*t.width)*4,l=t.data[o],a=t.data[o+1],y=t.data[o+2]+256*(a+256*l),c=Math.floor((256*256*256-1)/e.length);y&&y%c===0&&r.push(e[y/c-1])}return r}const u7=.5,A2={Point:_7,LineString:F7,Polygon:w7,MultiPoint:$7,MultiLineString:j7,MultiPolygon:v7,GeometryCollection:b7,Circle:p7};function d7(s,e){return parseInt(ns(s),10)-parseInt(ns(e),10)}function M2(s,e){const t=P2(s,e);return t*t}function P2(s,e){return u7*s/e}function p7(s,e,t,r,n){const i=t.getFill(),o=t.getStroke();if(i||o){const a=s.getBuilder(t.getZIndex(),"Circle");a.setFillStrokeStyle(i,o),a.drawCircle(e,r,n)}const l=t.getText();if(l&&l.getText()){const a=s.getBuilder(t.getZIndex(),"Text");a.setTextStyle(l),a.drawText(e,r)}}function N2(s,e,t,r,n,i,o,l){const a=[],f=t.getImage();if(f){let g=!0;const d=f.getImageState();d==Je.LOADED||d==Je.ERROR?g=!1:d==Je.IDLE&&f.load(),g&&a.push(f.ready())}const y=t.getFill();y&&y.loading()&&a.push(y.ready());const c=a.length>0;return c&&Promise.all(a).then(()=>n(null)),m7(s,e,t,r,i,o,l),c}function m7(s,e,t,r,n,i,o){const l=t.getGeometryFunction()(e);if(!l)return;const a=l.simplifyTransformed(r,n);if(t.getRenderer())k2(s,a,t,e,o);else{const y=A2[a.getType()];y(s,a,t,e,o,i)}}function k2(s,e,t,r,n){if(e.getType()=="GeometryCollection"){const o=e.getGeometries();for(let l=0,a=o.length;l<a;++l)k2(s,o[l],t,r,n);return}s.getBuilder(t.getZIndex(),"Default").drawCustom(e,r,t.getRenderer(),t.getHitDetectionRenderer(),n)}function b7(s,e,t,r,n,i){const o=e.getGeometriesArray();let l,a;for(l=0,a=o.length;l<a;++l){const f=A2[o[l].getType()];f(s,o[l],t,r,n,i)}}function F7(s,e,t,r,n){const i=t.getStroke();if(i){const l=s.getBuilder(t.getZIndex(),"LineString");l.setFillStrokeStyle(null,i),l.drawLineString(e,r,n)}const o=t.getText();if(o&&o.getText()){const l=s.getBuilder(t.getZIndex(),"Text");l.setTextStyle(o),l.drawText(e,r,n)}}function j7(s,e,t,r,n){const i=t.getStroke();if(i){const l=s.getBuilder(t.getZIndex(),"LineString");l.setFillStrokeStyle(null,i),l.drawMultiLineString(e,r,n)}const o=t.getText();if(o&&o.getText()){const l=s.getBuilder(t.getZIndex(),"Text");l.setTextStyle(o),l.drawText(e,r,n)}}function v7(s,e,t,r,n){const i=t.getFill(),o=t.getStroke();if(o||i){const a=s.getBuilder(t.getZIndex(),"Polygon");a.setFillStrokeStyle(i,o),a.drawMultiPolygon(e,r,n)}const l=t.getText();if(l&&l.getText()){const a=s.getBuilder(t.getZIndex(),"Text");a.setTextStyle(l),a.drawText(e,r,n)}}function _7(s,e,t,r,n,i){const o=t.getImage(),l=t.getText(),a=l&&l.getText(),f=i&&o&&a?{}:void 0;if(o){if(o.getImageState()!=Je.LOADED)return;const y=s.getBuilder(t.getZIndex(),"Image");y.setImageStyle(o,f),y.drawPoint(e,r,n)}if(a){const y=s.getBuilder(t.getZIndex(),"Text");y.setTextStyle(l,f),y.drawText(e,r,n)}}function $7(s,e,t,r,n,i){const o=t.getImage(),l=o&&o.getOpacity()!==0,a=t.getText(),f=a&&a.getText(),y=i&&l&&f?{}:void 0;if(l){if(o.getImageState()!=Je.LOADED)return;const c=s.getBuilder(t.getZIndex(),"Image");c.setImageStyle(o,y),c.drawMultiPoint(e,r,n)}if(f){const c=s.getBuilder(t.getZIndex(),"Text");c.setTextStyle(a,y),c.drawText(e,r,n)}}function w7(s,e,t,r,n){const i=t.getFill(),o=t.getStroke();if(i||o){const a=s.getBuilder(t.getZIndex(),"Polygon");a.setFillStrokeStyle(i,o),a.drawPolygon(e,r,n)}const l=t.getText();if(l&&l.getText()){const a=s.getBuilder(t.getZIndex(),"Text");a.setTextStyle(l),a.drawText(e,r,n)}}const S7=5;class E7 extends af{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=S7}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return He()}getData(e){return null}prepareFrame(e){return He()}renderFrame(e,t){return He()}forEachFeatureAtCoordinate(e,t,r,n,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;(t.getState()===Je.LOADED||t.getState()===Je.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Je.LOADED&&t!=Je.ERROR&&e.addEventListener(at.CHANGE,this.boundHandleImageChange_),t==Je.IDLE&&(e.load(),t=e.getState()),t==Je.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const D2=[];let Wl=null;function x7(){Wl=Xs(1,1,void 0,{willReadFrequently:!0})}class C7 extends E7{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Wr(),this.pixelTransform=Wr(),this.inversePixelTransform=Wr(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,r){Wl||x7(),Wl.clearRect(0,0,1,1);let n;try{Wl.drawImage(e,t,r,1,1,0,0,1,1),n=Wl.getImageData(0,0,1,1).data}catch{return Wl=null,null}return n}getBackground(e){let r=this.getLayer().getBackground();return typeof r=="function"&&(r=r(e.viewState.resolution)),r||void 0}useContainer(e,t,r){const n=this.getLayer().getClassName();let i,o;if(e&&e.className===n&&(!r||e&&e.style.backgroundColor&&Ai(Bo(e.style.backgroundColor),Bo(r)))){const l=e.firstElementChild;Gi(l)&&(o=l.getContext("2d"))}if(o&&LD(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&&(this.container.style.backgroundColor=null),!this.container){i=oi?Mw():document.createElement("div"),i.className=n;let l=i.style;l.position="absolute",l.width="100%",l.height="100%",o=Xs();const a=o.canvas;i.appendChild(a),l=a.style,l.position="absolute",l.left="0",l.transformOrigin="top left",this.container=i,this.context=o}!this.containerReused&&r&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=r)}clipUnrotated(e,t,r){const n=V$(r),i=K$(r),o=W$(r),l=U$(r);rr(t.coordinateToPixelTransform,n),rr(t.coordinateToPixelTransform,i),rr(t.coordinateToPixelTransform,o),rr(t.coordinateToPixelTransform,l);const a=this.inversePixelTransform;rr(a,n),rr(a,i),rr(a,o),rr(a,l),e.save(),e.beginPath(),e.moveTo(Math.round(n[0]),Math.round(n[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(l[0]),Math.round(l[1])),e.clip()}prepareContainer(e,t){const r=e.extent,n=e.viewState.resolution,i=e.viewState.rotation,o=e.pixelRatio,l=Math.round(Ns(r)/n*o),a=Math.round(li(r)/n*o);Di(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,i,-l/2,-a/2),uw(this.inversePixelTransform,this.pixelTransform);const f=TD(this.pixelTransform);if(this.useContainer(t,f,this.getBackground(e)),!this.containerReused){const y=this.context.canvas;y.width!=l||y.height!=a?(y.width=l,y.height=a):this.context.clearRect(0,0,l,a),f!==y.style.transform&&(y.style.transform=f)}}dispatchRenderEvent_(e,t,r){const n=this.getLayer();if(n.hasListener(e)){const i=new F2(e,this.inversePixelTransform,r,t);n.dispatchEvent(i)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Vr.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Vr.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new E2),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Vr.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Vr.POSTRENDER,this.context,e))}getRenderTransform(e,t,r,n,i,o,l){const a=i/2,f=o/2,y=n/t,c=-y,g=-e[0]+l,d=-e[1];return Di(this.tempTransform,a,f,y,c,-r,g,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class T7 extends C7{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=ki(),this.wrappedRenderedExtent_=ki(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,r){const n=t.extent,i=t.viewState,o=i.center,l=i.resolution,a=i.projection,f=i.rotation,y=a.getExtent(),c=this.getLayer().getSource(),g=this.getLayer().getDeclutter(),d=t.pixelRatio,m=t.viewHints,b=!(m[Ys.ANIMATING]||m[Ys.INTERACTING]),F=this.context,v=Math.round(Ns(n)/l*d),_=Math.round(li(n)/l*d),$=c.getWrapX()&&a.canWrapX(),w=$?Ns(y):null,S=$?Math.ceil((n[2]-y[2])/w)+(this.extendX_?2:1):1;let L=$?Math.floor((n[0]-y[0])/w)-(this.extendX_?1:0):0;do{let O=this.getRenderTransform(o,l,0,d,v,_,L*w);t.declutter&&(O=O.slice(0)),e.execute(F,[F.canvas.width,F.canvas.height],O,f,b,r===void 0?Yo:r?T2:a7,r?g&&t.declutter[g]:void 0)}while(++L<S)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Xs(this.context.canvas.width,this.context.canvas.height,D2))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,n6(this.context),D2.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){const r=e.layerStatesArray[e.layerIndex];this.opacity_=r.opacity;const n=e.viewState;this.prepareContainer(e,t);const i=this.context,o=this.replayGroup_;let l=o&&!o.isEmpty();if(!l&&!(this.getLayer().hasListener(Vr.PRERENDER)||this.getLayer().hasListener(Vr.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(i,e),n.projection,this.clipExtent_=null;let a=!1;if(l&&r.extent&&this.clipping){const f=df(r.extent);l=qr(f,e.extent),l&&!hf(f,e.extent)&&(e.declutter?this.clipExtent_=f:(this.clipUnrotated(i,e,f),a=!0))}return l&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),a&&i.restore(),this.postRender(i,e),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const r=this.frameState.size.slice(),n=this.renderedCenter_,i=this.renderedResolution_,o=this.renderedRotation_,l=this.renderedProjection_,a=this.wrappedRenderedExtent_,f=this.getLayer(),y=[],c=r[0]*Bn,g=r[1]*Bn;y.push(this.getRenderTransform(n,i,o,Bn,c,g,0).slice());const d=f.getSource(),m=l.getExtent();if(d.getWrapX()&&l.canWrapX()&&!hf(m,a)){let b=a[0];const F=Ns(m);let v=0,_;for(;b<m[0];)--v,_=F*v,y.push(this.getRenderTransform(n,i,o,Bn,c,g,_).slice()),b+=F;for(v=0,b=a[2];b>m[2];)++v,_=F*v,y.push(this.getRenderTransform(n,i,o,Bn,c,g,_).slice()),b-=F}this.hitDetectionImageData_=c7(r,y,this.renderedFeatures_,f.getStyleFunction(),a,i,o,M2(i,this.renderedPixelRatio_))}t(g7(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,r,n,i){var g,d;if(!this.replayGroup_)return;const o=t.viewState.resolution,l=t.viewState.rotation,a=this.getLayer(),f={},y=function(m,b,F){const v=ns(m),_=f[v];if(_){if(_!==!0&&F<_.distanceSq){if(F===0)return f[v]=!0,i.splice(i.lastIndexOf(_),1),n(m,a,b);_.geometry=b,_.distanceSq=F}}else{if(F===0)return f[v]=!0,n(m,a,b);i.push(f[v]={feature:m,layer:a,geometry:b,distanceSq:F,callback:n})}},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,l,r,y,c?(d=(g=t.declutter)==null?void 0:g[c])==null?void 0:d.all().map(m=>m.value):null)}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),r=t.getSource();if(!r)return!1;const n=e.viewHints[Ys.ANIMATING],i=e.viewHints[Ys.INTERACTING],o=t.getUpdateWhileAnimating(),l=t.getUpdateWhileInteracting();if(this.ready&&!o&&n||!l&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=e.extent,f=e.viewState,y=f.projection,c=f.resolution,g=e.pixelRatio,d=t.getRevision(),m=t.getRenderBuffer();let b=t.getRenderOrder();b===void 0&&(b=d7);const F=f.center.slice(),v=cp(a,m*c),_=v.slice(),$=[v.slice()],w=y.getExtent(),S=r.getWrapX()&&y.canWrapX();if(this.extendX_=!1,S){const W=r.getExtent();W&&!gf(W)&&(this.extendX_=W[0]<w[0]||W[2]>w[2])}if(S&&(!hf(w,e.extent)||this.extendX_)){const W=Ns(w),B=Math.max(Ns(v)/2,W);let q=w[0],ne=w[2];this.extendX_&&(q-=W,ne+=W),v[0]=q-B,v[2]=ne+B,X$(F,y);const ee=Y$($[0],y);ee[0]<w[0]&&ee[2]<w[2]?$.push([ee[0]+W,ee[1],ee[2]+W,ee[3]]):ee[0]>w[0]&&ee[2]>w[2]&&$.push([ee[0]-W,ee[1],ee[2]-W,ee[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===g&&this.renderedRevision_==d&&this.renderedRenderOrder_==b&&this.renderedFrameDeclutter_===!!e.declutter&&hf(this.wrappedRenderedExtent_,v))return Ai(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=F,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const L=new s7(P2(c,g),v,c,g);let O;for(let W=0,B=$.length;W<B;++W)r.loadFeatures($[W],c,y);const T=M2(c,g);let C=!0;const x=(W,B)=>{let q;const ne=W.getStyleFunction()||t.getStyleFunction();if(ne&&(q=ne(W,c)),q){const ee=this.renderFeature(W,T,q,L,O,this.getLayer().getDeclutter(),B);C=C&&!ee}},M=cw(v),G=r.getFeaturesInExtent(M);b&&G.sort(b);for(let W=0,B=G.length;W<B;++W)x(G[W],W);this.renderedFeatures_=G,this.ready=C;const K=L.finish(),Z=new y7(v,c,g,r.getOverlaps(),K,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=b,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=_,this.wrappedRenderedExtent_=v,this.renderedCenter_=F,this.renderedProjection_=y,this.renderedPixelRatio_=g,this.replayGroup_=Z,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,r,n,i,o,l){if(!r)return!1;let a=!1;if(Array.isArray(r))for(let f=0,y=r.length;f<y;++f)a=N2(n,e,r[f],t,this.boundHandleStyleImageChange_,i,o,l)||a;else a=N2(n,e,r,t,this.boundHandleStyleImageChange_,i,o,l);return a}}class R2 extends b2{constructor(e){super(e)}createRenderer(){return new T7(this)}}let L7=!1;function I7(s,e,t,r,n,i,o){const l=new XMLHttpRequest;l.open("GET",typeof s=="function"?s(t,r,n):s,!0),e.getType()=="arraybuffer"&&(l.responseType="arraybuffer"),l.withCredentials=L7,l.onload=function(a){if(!l.status||l.status>=200&&l.status<300){const f=e.getType();try{let y;f=="text"||f=="json"?y=l.responseText:f=="xml"?y=l.responseXML||l.responseText:f=="arraybuffer"&&(y=l.response),y?i(e.readFeatures(y,{extent:t,featureProjection:n}),e.readProjection(y)):o()}catch{o()}}else o()},l.onerror=o,l.send()}function z2(s,e){return function(t,r,n,i,o){I7(s,e,t,r,n,(l,a)=>{this.addFeatures(l),i!==void 0&&i(l)},()=>{this.changed(),o!==void 0&&o()})}}function O7(s,e){return[[-1/0,-1/0,1/0,1/0]]}class Xo extends kn{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const e=new Xo(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());const t=this.getGeometry();t&&e.setGeometry(t.clone());const r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Jt(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=mt(e,at.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?A7(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function A7(s){if(typeof s=="function")return s;let e;return Array.isArray(s)?e=s:(ts(typeof s.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[s]),function(){return e}}function G2(s,e,t,r){const n=[];let i=ki();for(let o=0,l=t.length;o<l;++o){const a=t[o];i=pp(s,e,a[0],r),n.push((i[0]+i[2])/2,(i[1]+i[3])/2),e=a[a.length-1]}return n}function Dc(s,e,t,r,n,i,o){let l,a;const f=(t-e)/r;if(f===1)l=e;else if(f===2)l=e,a=n;else if(f!==0){let y=s[e],c=s[e+1],g=0;const d=[0];for(let F=e+r;F<t;F+=r){const v=s[F],_=s[F+1];g+=Math.sqrt((v-y)*(v-y)+(_-c)*(_-c)),d.push(g),y=v,c=_}const m=n*g,b=b8(d,m);b<0?(a=(m-d[-b-2])/(d[-b-1]-d[-b-2]),l=e+(-b-2)*r):l=e+b*r}o=o>1?o:2,i=i||new Array(o);for(let y=0;y<o;++y)i[y]=l===void 0?NaN:a===void 0?s[l+y]:Cr(s[l+y],s[l+r+y],a);return i}function xm(s,e,t,r,n,i){if(t==e)return null;let o;if(n<s[e+r-1])return i?(o=s.slice(e,e+r),o[r-1]=n,o):null;if(s[t-1]<n)return i?(o=s.slice(t-r,t),o[r-1]=n,o):null;if(n==s[e+r-1])return s.slice(e,e+r);let l=e/r,a=t/r;for(;l<a;){const g=l+a>>1;n<s[(g+1)*r-1]?a=g:l=g+1}const f=s[l*r-1];if(n==f)return s.slice((l-1)*r,(l-1)*r+r);const y=s[(l+1)*r-1],c=(n-f)/(y-f);o=[];for(let g=0;g<r-1;++g)o.push(Cr(s[(l-1)*r+g],s[l*r+g],c));return o.push(n),o}function M7(s,e,t,r,n,i,o){if(o)return xm(s,e,t[t.length-1],r,n,i);let l;if(n<s[r-1])return i?(l=s.slice(0,r),l[r-1]=n,l):null;if(s[s.length-1]<n)return i?(l=s.slice(s.length-r),l[r-1]=n,l):null;for(let a=0,f=t.length;a<f;++a){const y=t[a];if(e!=y){if(n<s[e+r-1])return null;if(n<=s[y-1])return xm(s,e,y,r,n,!1);e=y}}return null}class Rc extends mw{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Jt),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const e=this.geometries_;for(let t=0,r=e.length;t<r;++t)this.changeEventsKeys_.push(mt(e[t],at.CHANGE,this.changed,this))}clone(){const e=new Rc(Cm(this.geometries_));return e.applyProperties(this),e}closestPointXY(e,t,r,n){if(n<Oo(this.getExtent(),e,t))return n;const i=this.geometries_;for(let o=0,l=i.length;o<l;++o)n=i[o].closestPointXY(e,t,r,n);return n}containsXY(e,t){const r=this.geometries_;for(let n=0,i=r.length;n<i;++n)if(r[n].containsXY(e,t))return!0;return!1}computeExtent(e){cf(e);const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)O8(e,t[r].getExtent());return e}getGeometries(){return Cm(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)t[r].getType()===this.getType()?e=e.concat(t[r].getGeometriesArrayRecursive()):e.push(t[r]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=[],r=this.geometries_;let n=!1;for(let i=0,o=r.length;i<o;++i){const l=r[i],a=l.getSimplifiedGeometry(e);t.push(a),a!==l&&(n=!0)}return n?new Rc(t):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)if(t[r].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){const r=this.geometries_;for(let n=0,i=r.length;n<i;++n)r[n].rotate(e,t);this.changed()}scale(e,t,r){r||(r=Ao(this.getExtent()));const n=this.geometries_;for(let i=0,o=n.length;i<o;++i)n[i].scale(e,t,r);this.changed()}setGeometries(e){this.setGeometriesArray(Cm(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)t[r].applyTransform(e);this.changed()}translate(e,t){const r=this.geometries_;for(let n=0,i=r.length;n<i;++n)r[n].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Cm(s){return s.map(e=>e.clone())}class qn extends ko{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Nn(this.flatCoordinates,e),this.changed()}clone(){const e=new qn(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,r,n){return n<Oo(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ip(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ap(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,r,n))}forEachSegment(e){return Sw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,xm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return zi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return Dc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return wm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){const t=[];return t.length=Fc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new qn(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return jc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=bc(this.flatCoordinates,0,e,this.stride),this.changed()}}class Kf extends ko{constructor(e,t,r){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&r)this.setFlatCoordinates(t,e),this.ends_=r;else{const n=e,i=[],o=[];for(let a=0,f=n.length;a<f;++a){const y=n[a];Nn(i,y.getFlatCoordinates()),o.push(i.length)}const l=n.length===0?this.getLayout():n[0].getLayout();this.setFlatCoordinates(l,i),this.ends_=o}}appendLineString(e){Nn(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new Kf(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,r,n){return n<Oo(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Op(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Mp(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,r,n))}getCoordinateAtM(e,t,r){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,r=r!==void 0?r:!1,M7(this.flatCoordinates,0,this.ends_,this.stride,e,t,r))}getCoordinates(){return mf(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new qn(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,r=this.layout,n=[];let i=0;for(let o=0,l=t.length;o<l;++o){const a=t[o],f=new qn(e.slice(i,a),r);n.push(f),i=a}return n}getLength(){const e=this.ends_;let t=0,r=0;for(let n=0,i=e.length;n<i;++n)r+=wm(this.flatCoordinates,t,e[n],this.stride),t=e[n];return r}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let r=0;const n=this.ends_,i=this.stride;for(let o=0,l=n.length;o<l;++o){const a=n[o],f=Dc(t,r,a,i,.5);Nn(e,f),r=a}return e}getSimplifiedGeometryInternal(e){const t=[],r=[];return t.length=$w(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,r),new Kf(t,"XY",r)}getType(){return"MultiLineString"}intersectsExtent(e){return qD(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const r=pf(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()}}class zc extends ko{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Nn(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){const e=new zc(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,r,n){if(n<Oo(this.getExtent(),e,t))return n;const i=this.flatCoordinates,o=this.stride;for(let l=0,a=i.length;l<a;l+=o){const f=Io(e,t,i[l],i[l+1]);if(f<n){n=f;for(let y=0;y<o;++y)r[y]=i[l+y];r.length=o}}return n}getCoordinates(){return zi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Dn(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,r=this.stride,n=[];for(let i=0,o=e.length;i<o;i+=r){const l=new Dn(e.slice(i,i+r),t);n.push(l)}return n}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,r=this.stride;for(let n=0,i=t.length;n<i;n+=r){const o=t[n],l=t[n+1];if(up(e,o,l))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=bc(this.flatCoordinates,0,e,this.stride),this.changed()}}class Yf extends ko{constructor(e,t,r){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!r&&!Array.isArray(e[0])){const n=e,i=[],o=[];for(let l=0,a=n.length;l<a;++l){const f=n[l],y=i.length,c=f.getEnds();for(let g=0,d=c.length;g<d;++g)c[g]+=y;Nn(i,f.getFlatCoordinates()),o.push(c)}t=n.length===0?this.getLayout():n[0].getLayout(),e=i,r=o}t!==void 0&&r?(this.setFlatCoordinates(t,e),this.endss_=r):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{const r=this.flatCoordinates.length;Nn(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let n=0,i=t.length;n<i;++n)t[n]+=r}this.endss_.push(t),this.changed()}clone(){const e=this.endss_.length,t=new Array(e);for(let n=0;n<e;++n)t[n]=this.endss_[n].slice();const r=new Yf(this.flatCoordinates.slice(),this.layout,t);return r.applyProperties(this),r}closestPointXY(e,t,r,n){return n<Oo(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ND(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),kD(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,r,n))}containsXY(e,t){return BD(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return PD(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Gp(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Pp(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=G2(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=ww(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new zc(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;xw(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Gp(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],r=[];return t.length=zD(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,r),new Yf(t,"XY",r)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{const i=this.endss_[e-1];t=i[i.length-1]}const r=this.endss_[e].slice(),n=r[r.length-1];if(t!==0)for(let i=0,o=r.length;i<o;++i)r[i]-=t;return new pn(this.flatCoordinates.slice(t,n),this.layout,r)}getPolygons(){const e=this.layout,t=this.flatCoordinates,r=this.endss_,n=[];let i=0;for(let o=0,l=r.length;o<l;++o){const a=r[o].slice(),f=a[a.length-1];if(i!==0)for(let c=0,g=a.length;c<g;++c)a[c]-=i;const y=new pn(t.slice(i,f),e,a);n.push(y),i=f}return n}getType(){return"MultiPolygon"}intersectsExtent(e){return WD(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const r=_w(this.flatCoordinates,0,e,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{const n=r[r.length-1];this.flatCoordinates.length=n.length===0?0:n[n.length-1]}this.changed()}}const B2=Wr();class Tr{constructor(e,t,r,n,i,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=r||null,this.properties_=i,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?B$(this.flatCoordinates_):pp(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=Ao(this.getExtent());this.flatInteriorPoints_=Dp(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=KD(this.flatCoordinates_,this.ends_),t=G2(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=ww(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Dc(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const r=this.ends_;for(let n=0,i=r.length;n<i;++n){const o=r[n],l=Dc(e,t,o,2,.5);Nn(this.flatMidpoints_,l),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=$s(e);const t=e.getExtent(),r=e.getWorldExtent();if(t&&r){const n=li(r)/li(t);Di(B2,r[0],r[3],n,-n,0,0,0),Ri(this.flatCoordinates_,0,this.flatCoordinates_.length,2,B2,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var e;return new Tr(this.type_,this.flatCoordinates_.slice(),(e=this.ends_)==null?void 0:e.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=L$((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);const r=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":r.length=Fc(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,r,0),n=[r.length];break;case"MultiLineString":n=[],r.length=$w(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,r,0,n);break;case"Polygon":n=[],r.length=Np(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),r,0,n);break}return n&&(this.simplifiedGeometry_=new Tr(this.type_,r,n,2,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}}Tr.prototype.getFlatCoordinates=Tr.prototype.getOrientedFlatCoordinates;class q2{constructor(e){this.rbush_=new Bw(e),this.items_={}}insert(e,t){const r={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(r),this.items_[ns(t)]=r}load(e,t){const r=new Array(t.length);for(let n=0,i=t.length;n<i;n++){const o=e[n],l=t[n],a={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:l};r[n]=a,this.items_[ns(l)]=a}this.rbush_.load(r)}remove(e){const t=ns(e),r=this.items_[t];return delete this.items_[t],this.rbush_.remove(r)!==null}update(e,t){const r=this.items_[ns(t)],n=[r.minX,r.minY,r.maxX,r.maxY];lc(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 r;for(let n=0,i=e.length;n<i;n++)if(r=t(e[n]),r)return r;return r}isEmpty(){return To(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return Cl(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]}}class P7 extends kn{constructor(e){super(),this.projection=$s(e.projection),this.attributions_=U2(e.attributions),this.attributionsCollapsible_=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(r,n){t.viewResolver=r,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_=U2(e),this.changed()}setState(e){this.state_=e,this.changed()}}function U2(s){return s?typeof s=="function"?s:(Array.isArray(s)||(s=[s]),e=>s):null}const Yr={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class Xi extends Mi{constructor(e,t,r){super(e),this.feature=t,this.features=r}}class W2 extends P7{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_=of,this.format_=e.format||null,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&&(ts(this.format_,"`format` must be set when `url` is set"),this.loader_=z2(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:O7;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new q2:null,this.loadedExtentsRtree_=new q2,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let r,n;Array.isArray(e.features)?n=e.features:e.features&&(r=e.features,n=r.getArray()),!t&&r===void 0&&(r=new Br(n)),n!==void 0&&this.addFeaturesInternal(n),r!==void 0&&this.bindFeaturesCollection_(r)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=ns(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const r=e.getGeometry();if(r){const n=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Xi(Yr.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof Tr||(this.featureChangeKeys_[e]=[mt(t,at.CHANGE,this.handleFeatureChange_,this),mt(t,El.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let r=!0;if(t.getId()!==void 0){const n=String(t.getId());if(!(n in this.idIndex_))this.idIndex_[n]=t;else if(t instanceof Tr){const i=this.idIndex_[n];i instanceof Tr?Array.isArray(i)?i.push(t):this.idIndex_[n]=[i,t]:r=!1}else r=!1}return r&&(ts(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),r}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],r=[],n=[];for(let i=0,o=e.length;i<o;i++){const l=e[i],a=ns(l);this.addToIndex_(a,l)&&r.push(l)}for(let i=0,o=r.length;i<o;i++){const l=r[i],a=ns(l);this.setupChangeEvents_(a,l);const f=l.getGeometry();if(f){const y=f.getExtent();t.push(y),n.push(l)}else this.nullGeometryFeatures_[a]=l}if(this.featuresRtree_&&this.featuresRtree_.load(t,n),this.hasListener(Yr.ADDFEATURE))for(let i=0,o=r.length;i<o;i++)this.dispatchEvent(new Xi(Yr.ADDFEATURE,r[i]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Yr.ADDFEATURE,function(r){t||(t=!0,e.push(r.feature),t=!1)}),this.addEventListener(Yr.REMOVEFEATURE,function(r){t||(t=!0,e.remove(r.feature),t=!1)}),e.addEventListener(dr.ADD,r=>{t||(t=!0,this.addFeature(r.element),t=!1)}),e.addEventListener(dr.REMOVE,r=>{t||(t=!0,this.removeFeature(r.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const r in this.featureChangeKeys_)this.featureChangeKeys_[r].forEach(Jt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(r=>{this.removeFeatureInternal(r)});for(const r in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[r])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new Xi(Yr.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 r=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(r,function(n){const i=n.getGeometry();if(i instanceof Tr||i.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(r){const n=r.getGeometry();if(n instanceof Tr||n.intersectsExtent(e)){const i=t(r);if(i)return i}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),To(this.nullGeometryFeatures_)||Nn(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(r){t.push(r)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const n=z8(e,t);return[].concat(...n.map(i=>this.featuresRtree_.getInExtent(i)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const r=e[0],n=e[1];let i=null;const o=[NaN,NaN];let l=1/0;const a=[-1/0,-1/0,1/0,1/0];return t=t||nf,this.featuresRtree_.forEachInExtent(a,function(f){if(t(f)){const y=f.getGeometry(),c=l;if(l=y instanceof Tr?0:y.closestPointXY(r,n,o,l),l<c){i=f;const g=Math.sqrt(l);a[0]=r-g,a[1]=n-g,a[2]=r+g,a[3]=n+g}}}),i}getExtent(e){var t;return((t=this.featuresRtree_)==null?void 0:t.getExtent(e))??null}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,r=ns(t),n=t.getGeometry();if(!n)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[r]=t);else{const o=n.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}const i=t.getId();if(i!==void 0){const o=i.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[r]=t;this.changed(),this.dispatchEvent(new Xi(Yr.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:ns(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&To(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,r){const n=this.loadedExtentsRtree_,i=this.strategy_(e,t,r);for(let o=0,l=i.length;o<l;++o){const a=i[o];n.forEachInExtent(a,function(y){return hf(y.extent,a)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Xi(Yr.FEATURESLOADSTART)),this.loader_.call(this,a,t,r,y=>{--this.loadingExtentsCount_,this.dispatchEvent(new Xi(Yr.FEATURESLOADEND,void 0,y))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Xi(Yr.FEATURESLOADERROR))}),n.insert(a,{extent:a.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_,r=t.forEachInExtent(e,function(n){if(lc(n.extent,e))return n});r&&t.remove(r)}removeFeatures(e){let t=!1;for(let r=0,n=e.length;r<n;++r)t=this.removeFeatureInternal(e[r])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=ns(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e);const r=this.featureChangeKeys_[t];r==null||r.forEach(Jt),delete this.featureChangeKeys_[t];const n=e.getId();if(n!==void 0){const i=n.toString(),o=this.idIndex_[i];o===e?delete this.idIndex_[i]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[i]=o[0]))}return delete this.uidIndex_[t],this.hasListener(Yr.REMOVEFEATURE)&&this.dispatchEvent(new Xi(Yr.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(const t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){ts(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(z2(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}}function V2(s){return!/^(-?\d|--)/.test(s)}function K2(s){const e=[];let t="",r="",n=7;for(let i,o=0;i=s.charAt(o);o++)if(/[a-zA-Z\d\xa0-\uffff_-]/.test(i)&&n===7)t+=i;else if(i==="\\"&&n===7)n=6;else if(i===" "&&n===7){if(t!==""){if(!V2(t))return null;e.push(t),t=""}}else if(n===6)/[0-9a-f]/i.test(i)?(r+=i,n=8):(t+=i,n=7);else{if(n!==8)return null;/[0-9a-f]/i.test(i)&&r.length<6?r+=i:(t+=String.fromCodePoint(parseInt(r,16)),t+=i,r="",n=7)}if(t!==""){if(!V2(t))return null;e.push(t)}return e.join(" ")}function N7(s,e){let t=e,r="";const n={"font-family":[]};for(let i,o=0;i=s.charAt(o);o+=1)if(t!==4||i!=='"'&&i!=="'")if(t===3&&i===",")t=4,r="";else if(t===4&&i===","){const l=K2(r);l&&n["font-family"].push(l),r=""}else if(t===5&&i===" ")/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:deg|grad|rad|turn)$/.test(r)?(n["font-style"]+=" "+r,r=""):o-=1,t=1;else if(t!==1||i!==" "&&i!=="/")t===2&&i===" "?(/^(?:\+|-)?([0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)?$/.test(r)&&(n["line-height"]=r),t=4,r=""):r+=i;else{if(/^(?:(?:xx|x)-large|(?:xx|s)-small|small|large|medium)$/.test(r)||/^(?:larg|small)er$/.test(r)||/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)$/.test(r))t=i==="/"?2:4,n["font-size"]=r;else if(/^italic$/.test(r))n["font-style"]=r;else if(/^oblique$/.test(r))n["font-style"]=r,t=5;else if(/^small-caps$/.test(r))n["font-variant"]=r;else if(/^(?:bold(?:er)?|lighter|normal)$/.test(r))n["font-weight"]=r;else if(/^[+-]?(?:[0-9]*\.)?[0-9]+(?:e[+-]?(?:0|[1-9][0-9]*))?$/.test(r)){const l=parseFloat(r);l>=1&&l<=1e3&&(n["font-weight"]=r)}else/^(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)$/.test(r)&&(n["font-stretch"]=r);r=""}else{let l=o+1;do if(l=s.indexOf(i,l)+1,!l)return null;while(s.charAt(l-2)==="\\");n["font-family"].push(s.slice(o+1,l-1).replace(/\\('|")/g,"$1")),o=l-1,t=3,r=""}if(t===3&&!/^\s*$/.test(r))return null;if(t===4){const i=K2(r);i&&n["font-family"].push(i)}return n}function k7(s){const e=N7(s,1);return e!==null&&e["font-size"]&&e["font-family"].length?e:null}const Y2={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Tm=/^ttf:\/\/(.+)#(.+)$/,X2="geostyler-mark-symbolizer",Xr=Math.PI/180;let De=class Ws{static getRgbaColor(e,t){if(Ti(e)&&(e=Ws.evaluateStringFunction(e)),typeof e!="string")return;if(e.startsWith("rgba("))return e;if(!/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e))return;const r=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return bo(t)&&(t=Ws.evaluateNumberFunction(t)),t<0&&(t=1),"rgba("+r+", "+n+", "+i+", "+t+")"}static splitRgbaColor(e){const t=e.substring(e.indexOf("(")+1,e.lastIndexOf(")")).split(/,\s*/),r=parseInt(t[0],10),n=parseInt(t[1],10),i=parseInt(t[2],10),o=parseFloat(t[3]);return[r,n,i,o]}static getHexColor(e){if(e.startsWith("#"))return e;if(e.startsWith("rgb")){const t=Ws.splitRgbaColor(e);return Ws.getHexCodeFromRgbArray(t)}else if(Y2[e.toLocaleLowerCase()]!==void 0){const t=Y2[e.toLocaleLowerCase()];return Ws.getHexCodeFromRgbArray(t)}else return}static getHexCodeFromRgbArray(e){return"#"+e.map((t,r)=>{const n=t.toString(16);return r<3?n.length===1?"0"+n:n:""}).join("")}static getHexAlphaFromHexAndOpacity(e,t){if(!e.startsWith("#"))return;t=Math.max(0,Math.min(1,t));const r=Math.round(t*255).toString(16).padStart(2,"0");return`${e}${r}`}static getOpacity(e){const t=e.startsWith("rgba("),r=e.startsWith("#")&&e.length>7;if(!t&&!r)return;let n;if(t?n=Ws.splitRgbaColor(e):n=[void 0,void 0,void 0,parseInt(e.slice(7,9),16)/255],n.length===4)return n[3]}static checkOpacity(e){return typeof e=="number"&&e>=0&&e<1}static getTextFont(e){const t=e.fontWeight??"normal",r=e.fontStyle??"normal",n=e.size,i=e.font;return t+" "+r+" "+n+"px "+(i==null?void 0:i.join(", "))}static getIsFontGlyphBased(e){return Tm.test(e.wellKnownName)}static getIsMarkSymbolizerFont(e){if(!e)return!1;const t=X2;return e.substring(e.length-t.length,e.length)===t}static getTextFontForMarkSymbolizer(e){const t=e.wellKnownName.match(Tm);if(!t)throw new Error(`Could not parse font-based well known name: ${e.wellKnownName}`);const r=t[1];return`Normal ${e.radius||5}px '${r}', ${X2}`}static getCharacterForMarkSymbolizer(e){const t=e.wellKnownName.match(Tm);if(!t)throw new Error(`Could not parse font-based well known name: ${e.wellKnownName}`);return String.fromCharCode(parseInt(t[2],16))}static getFontNameFromOlFont(e){const t=e.match(/(?:\d+\S+) '?"?([^,'"]+)/);if(!t)throw new Error(`Could not find font family name in the following string: ${e}`);return t[1]}static getSizeFromOlFont(e){const t=e.match(/(?:(\d+)px)/);return t?parseInt(t[1],10):0}static resolveAttributeTemplate(e,t,r="n.v.",n=(i,o)=>o){const i="\\{\\{",o="\\}\\}",l=new RegExp(i+"(.*?)"+o,"g"),a=t.match(l);return a&&a.forEach(f=>{let y=0;for(const[c,g]of Object.entries(e.getProperties()))if(f.slice(2,f.length-2).toLowerCase()===c.toLowerCase()){t=t.replace(f,n(c,g));break}else y++;y===Object.keys(e.getProperties()).length&&(t=t.replace(f,r))}),t}static evaluateFunction(e,t){if(e.name==="property"){if(!t)throw new Error(`Could not evalute 'property' function. Feature ${t} is not defined.`);return Ti(e.args[0])?t==null?void 0:t.get(Ws.evaluateStringFunction(e.args[0],t)):t==null?void 0:t.get(e.args[0])}if(hd(e))return Ws.evaluateUnknownFunction(e,t);if(Ti(e))return Ws.evaluateStringFunction(e,t);if(bo(e))return Ws.evaluateNumberFunction(e,t);if(Tn(e))return Ws.evaluateBooleanFunction(e,t)}static evaluateBooleanFunction(e,t){const r=e.args.map(n=>Ie(n)?Ws.evaluateFunction(n,t):n);switch(e.name){case"all":return r.map(n=>this.evaluateBooleanFunction(n,t)).every(n=>n===!0);case"any":return r.map(n=>this.evaluateBooleanFunction(n,t)).some(n=>n===!0);case"between":return r[0]>=r[1]&&r[0]<=r[2];case"double2bool":return!1;case"equalTo":return r[0]===r[1];case"greaterThan":return r[0]>r[1];case"greaterThanOrEqualTo":return r[0]>=r[1];case"in":return r.slice(1).includes(r[0]);case"lessThan":return r[0]<r[1];case"lessThanOrEqualTo":return r[0]<=r[1];case"not":return!r[0];case"notEqualTo":return r[0]!==r[1];case"parseBoolean":return!!r[0];case"strEndsWith":return r[0].endsWith(r[1]);case"strEqualsIgnoreCase":return r[0].toLowerCase()===r[1].toLowerCase();case"strMatches":{const n=r[1].match(/\/(.*?)\/([gimy]{0,4})$/);return n&&n.length===3?new RegExp(n[1],n[2]).test(r[0]):!1}case"strStartsWith":return r[0].startsWith(r[1]);default:return!1}}static evaluateNumberFunction(e,t){if(e.name==="pi")return Math.PI;if(e.name==="random")return Math.random();const r=e.args.map(n=>Ie(n)?Ws.evaluateFunction(n,t):n);switch(e.name){case"abs":return Math.abs(r[0]);case"acos":return Math.acos(r[0]);case"add":return r[0]+r[1];case"asin":return Math.asin(r[0]);case"atan":return Math.atan(r[0]);case"atan2":return r[0];case"ceil":return Math.ceil(r[0]);case"cos":return Math.cos(r[0]);case"div":return r[0]/r[1];case"exp":return Math.exp(r[0]);case"floor":return Math.floor(r[0]);case"log":return Math.log(r[0]);case"max":return Math.max(...r);case"min":return Math.min(...r);case"modulo":return r[0]%r[1];case"mul":return r[0]*r[1];case"pow":return Math.pow(r[0],r[1]);case"rint":return r[0];case"round":return Math.round(r[0]);case"sin":return Math.sin(r[0]);case"sqrt":return Math.sqrt(r[0]);case"strIndexOf":return r[0].indexOf(r[1]);case"strLastIndexOf":return r[0].lastIndexOf(r[1]);case"strLength":return r[0].length;case"sub":return r[0]-r[1];case"tan":return Math.tan(r[0]);case"toDegrees":return r[0]/Xr;case"toRadians":return r[0]*Xr;default:return r[0]}}static evaluateUnknownFunction(e,t){const r=e.args.map(n=>Ie(n)?Ws.evaluateFunction(n,t):n);switch(e.name){case"property":return t==null?void 0:t.get(r[0]);case"case":{const n=r;let i;for(let o=0;o<n.length;o++){const l=n[o];if(o===n.length-1){i=l;break}else if(l.case===!0){i=l.value;break}else if(Ws.evaluateBooleanFunction(l.case,t)){i=l.value;break}}return i}default:return r[0]}}static evaluateStringFunction(e,t){var n;const r=e.args.map(i=>Ie(i)?Ws.evaluateFunction(i,t):i);switch(e.name){case"numberFormat":return r[0];case"strAbbreviate":return r[0];case"strCapitalize":{const i=r[0].toLowerCase().split(" ");for(let o of i)o=o.charAt(0).toUpperCase()+o.substring(1);return i.join(" ")}case"strConcat":return r.join();case"strDefaultIfBlank":return((n=r[0])==null?void 0:n.length)<1?r[1]:r[0];case"strReplace":return r[3]===!0?r[0].replaceAll(r[1],r[2]):r[0].replace(r[1],r[2]);case"strStripAccents":return r[0].normalize("NFKD").replace(/[\u0300-\u036f]/g,"");case"strSubstring":return r[0].substring(r[1],r[2]);case"strSubstringStart":return r[0].substring(r[1]);case"strToLowerCase":return r[0].toLowerCase();case"strToUpperCase":return r[0].toUpperCase();case"strTrim":return r[0].trim();default:return r[0]}}static containsGeoStylerFunctions(e){return e.rules.some(t=>{var o,l,a,f;const r=Array.isArray(t.filter)&&((o=t.filter)==null?void 0:o.some(Ie)),n=(l=t.symbolizers)==null?void 0:l.some(y=>Object.values(y).some(Ie)),i=Ie((a=t==null?void 0:t.scaleDenominator)==null?void 0:a.max)||Ie((f=t==null?void 0:t.scaleDenominator)==null?void 0:f.min);return r||n||i})}};const H2=["horline","vertline","line"],Xf=["horline","vertline","line","cross","cross2","slash","backslash","oarrow","x","half_arc","third_arc","quarter_arc","arrowhead"],Z2="data:image/svg+xml;utf8,",D7=s=>Z2+encodeURIComponent(s),R7=s=>decodeURIComponent(s).replace(Z2,""),Q2=s=>{const e=s.split(";").filter(r=>r.trim()!==""),t={};for(const r of e){const[n,i]=r.split(":").map(o=>o.trim());n&&i&&(t[n]=i)}return t},z7=s=>{const e=new DOMParser().parseFromString(s,"image/svg+xml").querySelector("svg");if(!e)return;const t=e.getAttribute("width"),r=e.getAttribute("viewBox");if(!r)return;const n=Array.from(e.children).find(y=>y instanceof Element),i=n==null?void 0:n.getAttribute("id"),o=(n==null?void 0:n.getAttribute("style"))??"",l=Q2(o),{radius:a,strokeWidth:f}=U7(Number(t),Number(l["stroke-width"]),r);return{kind:"Mark",wellKnownName:i,radius:a,...l.fill&&{color:l.fill},...l["fill-opacity"]&&{fillOpacity:Number(l["fill-opacity"])},...l.stroke&&{strokeColor:l.stroke},...l["stroke-width"]&&{strokeWidth:f},...l["stroke-opacity"]&&{strokeOpacity:Number(l["stroke-opacity"])}}},G7=(s,e,t,r)=>{var y;const n=new DOMParser().parseFromString(s,"image/svg+xml").querySelector("svg");if(!n)return;const i=(n.getAttribute("viewBox")||"0 0 0 0").split(" ").map(parseFloat)[2],o=i===8,l=parseFloat(n.getAttribute("width")||"0")/i,a=1/l;e.save(),o||(e.translate(t/2,t/2),e.rotate(r*Xr),e.scale(l,l));const f=n.children;for(const c of f){const g=c.getAttribute("style")||"",d=Q2(g),m=d.fill||"",b=Number(d["fill-opacity"]??1),F=De.getHexAlphaFromHexAndOpacity(m,b),v=d.stroke||"",_=d["stroke-width"],$=Number(d["stroke-opacity"]??1),w=De.getHexAlphaFromHexAndOpacity(v,$);switch(F?e.fillStyle=F:e.fillStyle="none",w?(e.strokeStyle=w,e.lineWidth=Number(_)*a):(e.strokeStyle="none",e.lineWidth=0),c.tagName){case"rect":{const S=parseFloat(c.getAttribute("x")||"0"),L=parseFloat(c.getAttribute("y")||"0"),O=parseFloat(String(c.getAttribute("width"))),T=parseFloat(String(c.getAttribute("height")));F&&e.fillRect(S,L,O,T),w&&e.strokeRect(S,L,O,T);break}case"circle":{const S=parseFloat(c.getAttribute("cx")||"0"),L=parseFloat(c.getAttribute("cy")||"0"),O=parseFloat(c.getAttribute("r")||"0");e.beginPath(),e.arc(S,L,O,0,2*Math.PI),F&&e.fill(),w&&e.stroke();break}case"polygon":{const S=(y=c.getAttribute("points"))==null?void 0:y.split(" ");if(!S)break;e.beginPath();for(let L=0;L<S.length;L++){const O=S[L].split(",");L===0?e.moveTo(parseFloat(O[0]),parseFloat(O[1])):e.lineTo(parseFloat(O[0]),parseFloat(O[1]))}e.closePath(),F&&e.fill(),w&&e.stroke();break}case"path":{const S=c.getAttribute("d");if(!S)break;const L=S.match(/[MALZ][^MALZ]*/g);if(!L)break;e.beginPath();let O=0,T=0;for(const C of L){const x=C[0],M=C.split(/[, ]+/).slice(1).map(parseFloat);switch(x){case"M":{for(let G=0;G<M.length-1;G+=2)G<2?e.moveTo(M[G],M[G+1]):e.lineTo(M[G],M[G+1]),O=M[G],T=M[G+1];break}case"L":{for(let G=0;G<M.length-1;G+=2)e.lineTo(M[G],M[G+1]),O=M[G],T=M[G+1];break}case"A":{B7(e,O,T,M[0],M[1],M[2],M[3],M[4],M[5],M[6]),O=M[5],T=M[6];break}case"Z":{e.closePath();break}}}F&&e.fill(),w&&e.stroke();break}}}e.restore()},B7=(s,e,t,r,n,i,o,l,a,f)=>{const y=K=>K*Math.PI/180,c=(e-a)/2,g=(t-f)/2,d=Math.cos(y(i)),m=Math.sin(y(i)),b=d*c+m*g,F=-m*c+d*g;let v=r*r,_=n*n;const $=b*b,w=F*F,S=$/v+w/_;S>1&&(r*=Math.sqrt(S),n*=Math.sqrt(S),v=r*r,_=n*n);const L=(o!==l?1:-1)*Math.sqrt(Math.max(0,(v*_-v*w-_*$)/(v*w+_*$))),O=L*(r*F/n),T=L*(-(n*b)/r),C=d*O-m*T+(e+a)/2,x=m*O+d*T+(t+f)/2,M=Math.atan2((F-T)/n,(b-O)/r);let G=Math.atan2((-F-T)/n,(-b-O)/r);!l&&G>M?G-=2*Math.PI:l&&G<M&&(G+=2*Math.PI),s.arc(C,x,r,M,G,!l)},q7=(s,e,t)=>{const r=s*2,n=t/r,i=r/t,o=e*n,l=e*n,a=o+l,f=a*i,y=t+a,c=-(y/2),g=r+f;return{minV:c,sizeV:y,heightPx:g}},U7=(s,e,t)=>{const r=!Number.isNaN(e),n=t.split(" ").map(parseFloat)[2],i=s/n,o=n/s,l=r?e:o,a=(n-2*l)/2*i,f=r?l*i:void 0;return{radius:a,strokeWidth:f}},W7={arrow:20,arrowhead:20,asterisk_fill:20,backslash:24,carrow:20,circle:20,cross:24,cross_fill:20,cross2:24,decagon:20,diagonal_half_square:20,diamond:20,equilateral_triangle:20,filled_arrowhead:20,half_arc:20,half_square:20,heart:20,hexagon:20,horline:24,left_half_triangle:20,line:24,oarrow:20,octagon:20,parallelogram_left:20,parallelogram_right:20,pentagon:20,quarter_arc:20,quarter_circle:20,quarter_square:20,right_half_triangle:20,rounded_square:20,semi_circle:20,shield:20,slash:24,square:20,square_with_corners:20,star:20,star_diamond:20,third_arc:20,third_circle:20,trapezoid:20,triangle:20},J2={arrow:'d="M 0,-10 L 5,-5 L 2.5,-5 L 2.5,10 L -2.5,10 L -2.5,-5 L -5,-5 L 0,-10 Z"',arrowhead:'d="M -10 -10 L 0 0 L -10 10"',asterisk_fill:'d="M -1.5,-10 L 1.5,-10L 1.5,-3.939 L 6.011,-8.132 L 8.132,-6.011 L 3.939,-1.5 L 10,-1.5 L 10,1.5 L 3.939,1.5 L 8.132,6.011 L 6.011,8.132 L 1.5,3.939 L 1.5,10 L -1.5,10 L -1.5,3.939 L -6.011,8.132 L -8.132,6.011 L -3.939,1.5 L -10,1.5 L -10,-1.5 L -3.939,-1.5 L -8.132,-6.011 L -6.011,-8.132 L -1.5,-3.939 L -1.5,-10 Z"',backslash:'d="M -12 -12 L 12 12"',carrow:'d="M -10 10 L 0 -10 L 10 10 Z"',circle:'cx="0" cy="0" r="10"',cross:'d="M -12 0 L 12 0 M 0 -12 L 0 12"',cross_fill:'d="M -10,-2 L -10,-2 L -10,2 L -2,2 L -2,10 L 2,10 L 2,2 L 10,2 L 10,-2 L 2,-2 L 2,-10 L -2,-10 L -2,-2 L -10,-2 Z"',cross2:'d="M -12 -12 L 12 12 M 12 -12 L -12 12"',decagon:'points="5.878,8.09 9.511,3.09 9.511,-3.09 5.878,-8.09 0,-10 -5.878,-8.09 -9.511,-3.09 -9.511,3.09 -5.878,8.09 0,10 5.878,8.09"',diagonal_half_square:'points="-10,-10 10,10 -10,10 -10,-10"',diamond:'points="-10,0 0,10 10,0 0,-10 -10,0"',equilateral_triangle:'points="-8.66,5 8.66,5 0,-10 -8.66,5"',filled_arrowhead:'d="M 0,0 L -10,10 L -10,-10 L 0,0 Z"',half_arc:'d="M -10 0 A 10 10 0 0 1 10 0"',half_square:'points="-10,-10 0,-10 0,10 -10,10 -10,-10"',heart:'d="M -9.5 -2 A 1 1 0 0 1 0 -7.5 A 1 1 0 0 1 9.5 -2 L 0 10 Z"',hexagon:'points="-8.66,-5 -8.66,5 0,10 8.66,5 8.66,-5 0,-10 -8.66,-5"',horline:'d="M -12 0 L 12 0"',left_half_triangle:'points="0,10 10,10 0,-10 0,10"',line:'d="M 0 -12 L 0 12"',oarrow:'d="M -10 10 L 0 -10 L 10 10"',octagon:'points="-4.142,10 4.142,10 10,4.142 10,-4.142 4.142,-10 -4.142,-10 -10,-4.142 -10,4.142 -4.142,10"',parallelogram_left:'points="10,5 5,-5 -10,-5 -5,5 10,5"',parallelogram_right:'points="5,5 10,-5 -5,-5 -10,5 5,5"',pentagon:'points="-9.511,-3.09 -5.878,8.09 5.878,8.09 9.511,-3.09 0,-10 -9.511,-3.09"',quarter_arc:'d="M 0 -10 A 10 10 0 0 0 -10 0"',quarter_circle:'d="M 0 -10 A 10 10 0 0 0 -10 0 L 0 0 Z"',quarter_square:'points="-10,-10 0,-10 0,0 -10,0 -10,-10"',right_half_triangle:'points="-10,10 0,10 0,-10 -10,10"',rounded_square:'x="-10" y="-10" width="20" height="20" rx="2.5" ry="2.5"',semi_circle:'d="M -10 0 A 10 10 0 0 1 10 0 L 0 0 Z"',shield:'points="10,5 10,-10 -10,-10 -10,5 0,10 10,5"',slash:'d="M 12 -12 L -12 12"',square:'points="-10,-10 10,-10 10,10 -10,10"',square_with_corners:'points="-6.072,10 6.072,10 10,6.072 10,-6.072 6.072,-10 -6.072,-10 -10,-6.072 -10,6.072 -6.072,10"',star:'d="M -2.24514,-3.09017 -9.51057,-3.09017 -3.63271,1.18034 -5.87785,8.09017 0,3.81966 5.87785,8.09017 3.63271,1.18034 9.51057,-3.09017 2.24514,-3.09017 0,-10 -2.24514,-3.09017 Z"',star_diamond:'d="M -2.70091,-2.70091 -10,0 -2.70091,2.70091 0,10 2.70091,2.70091 10,0 2.70091,-2.70091 0,-10 Z"',third_arc:'d="M 0 -10 A 10 10 0 0 0 -5 8.66"',third_circle:'d="M 0 -10 A 10 10 0 0 0 -5 8.66 L 0 0 Z"',trapezoid:'points="5,-5 10,5 -10,5 -5,-5 5,-5"',triangle:'points="-10,10 10,10 0,-10 -10,10"'},Lm=s=>{let e=s.replace("shape://","");switch(e=e.replace("brush://",""),e){case"dot":return"circle";case"plus":return"cross";case"times":case"x":return"cross2";case"vertline":return"line";default:return e}},eS=s=>Lm(s)in J2,tS=s=>{const{wellKnownName:e,radius:t=6,color:r,fillOpacity:n,strokeColor:i,strokeWidth:o,strokeOpacity:l}=s;if(!eS(e))throw new Error("Unknown wellKnownName: "+e);const a=Lm(e),f=o??1,y=W7[a],{minV:c,sizeV:g,heightPx:d}=q7(t,f,y),m='<svg xmlns="http://www.w3.org/2000/svg" width="'+d+'" height="'+d+`" viewBox="${c} ${c} ${g} ${g}">`,b="</svg>";let F=J2[a]+" ";F.startsWith("points=")?F='<polygon id="'+a+'" '+F:F.startsWith("x=")?F='<rect id="'+a+'" '+F:F.startsWith("cx=")?F='<circle id="'+a+'" '+F:F='<path id="'+a+'" '+F;let v="";if(r&&!Xf.includes(a)?v+="fill:"+r+"; ":Xf.includes(a)&&(v+="fill:none; "),De.checkOpacity(n)&&!Xf.includes(a)&&(v+="fill-opacity:"+n+"; "),i&&(v+="stroke:"+i+"; "),o){const _=d/g;v+="stroke-width:"+Number(o)/_+"; "}return De.checkOpacity(l)&&(v+="stroke-opacity:"+l+"; "),H2.includes(a)&&(v=v+"stroke-linejoin: butt"),F+='style="'+v.trim()+'" />',m+F+b};function V7(s,e){const t=s.canvas;e=e||{};const r=e.pixelRatio||P$,n=e.size;n&&(t.width=n[0]*r,t.height=n[1]*r,t.style.width=n[0]+"px",t.style.height=n[1]+"px");const i=[0,0,t.width,t.height],o=ED(Wr(),r,r);return new O2(s,r,i,o,0)}const K7={horline:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',line:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',cross:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',slash:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',backslash:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',x:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense1:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense2:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="1" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense3:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="1" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense4:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense5:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense6:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense7:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>'},Y7=s=>{const{wellKnownName:e,color:t,fillOpacity:r,strokeColor:n,strokeOpacity:i,strokeWidth:o}=s,l=e.replace("brush://",""),a=!o&&Xf.includes(String(l)),f=l.startsWith("dense");let y;return f||a?(y=K7[l],f?(y=y.replace(/fill:black/g,`fill:${t}`),y=y.replace(/fill-opacity:1/g,`fill-opacity:${r??1}`)):(y=y.replace(/fill:black/g,`fill:${n}`),y=y.replace(/fill-opacity:1/g,`fill-opacity:${i??1}`))):y=tS(s),y};class Lr{static containsGraphicStroke(e){return e.rules.some(t=>{var r;return(r=t.symbolizers)==null?void 0:r.some(n=>n.kind==="Line"&&n.graphicStroke)})}static getSegmentRotation(e,t){const r=t[0]-e[0],n=t[1]-e[1],i=Math.atan2(n,r),o=180/Math.PI;return-i*o}static getSegmentRotations(e){const t=[];return e.forEachSegment((r,n)=>{const i=Lr.getSegmentRotation(r,n);t.push(i)}),t}static getPatternSize(e,t){const r=e.reduce((n,i)=>n+i,0);return t*r}static getSegmentFractions(e){const t=[],r=e.getLength();let n=0;return e.forEachSegment((i,o)=>{const l=new qn([i,o]).getLength()/r;n+=l,t.push(n)}),t}static getDashAsFractions(e,t,r){const n=i=>i*t/r;return e.map(i=>n(i))}static getTickFractions(e,t,r,n,i){if(t<=0)return[];const o=e.getLength(),l=t*r/o,a=(i?i*r:0)/o;return n&&n.length>0?Lr.getTickFractionsWithDash(n,r,o,l,a):Lr.getTickFractionsWithoutDash(l)}static tryAddTick(e,t,r,n){return n>1?!1:(r>=0&&e.push(t),!0)}static getTickFractionsWithoutDash(e){const t=[],r=e/2;let n=r;for(;;){const i=n+e,o=n-r,l=n+r,a=Lr.tryAddTick(t,n,o,l);if(n=i,!a)break}return t}static getTickFractionsWithDash(e,t,r,n,i){const o=e.length%2===0?e:[...e,...e],l=Lr.getDashAsFractions(o,t,r),a=n/2,f=[];let y=i+a,c=0;for(;y<=1;){const g=c%2===1,d=l[c];if(g)y+=d;else{const m=d/n,b=Math.floor(m);for(let v=0;v<b;v++){const _=y-a,$=y+a,w=y+n,S=Lr.tryAddTick(f,y,_,$);if(y=w,!S)return f}const F=m%1*n;y+=F}c=(c+1)%l.length}return f}static processLineStringGraphicStroke(e,t,r,n,i,o,l,a,f){const y=Lr.getTickFractions(e,t,r,n,i),c=Lr.getSegmentFractions(e),g=Lr.getSegmentRotations(e).map(d=>{const m=d+o,b=structuredClone(l);return b.rotate=m,a(b)});return y.map(d=>{const m=e.getCoordinateAt(d),b=new f(m),F=c.findIndex(_=>d<=_),v=g[F].clone();return v.setGeometry(b),v})}static getLineStringsFromGeometry(e,t){if(!e)throw new Error("GraphicStroke can only be applied to features with geometries");if(e instanceof t.LineString)return[e];if(e instanceof t.MultiLineString)return e.getLineStrings();if(e instanceof t.Polygon)return e.getLinearRings().map(r=>new t.LineString(r.getCoordinates()));if(e instanceof t.MultiPolygon)return e.getPolygons().flatMap(r=>r.getLinearRings().map(n=>new t.LineString(n.getCoordinates())));throw new Error("GraphicStroke can only be applied to (Multi-)LineString or (Multi-)Polygon geometries")}}class Im{constructor(e){Le(this,"unsupportedProperties",{Symbolizer:{MarkSymbolizer:{avoidEdges:"none",blur:"none",offsetAnchor:"none",pitchAlignment:"none",pitchScale:"none"},FillSymbolizer:{antialias:"none",opacity:{support:"none",info:"Use fillOpacity instead."}},IconSymbolizer:{allowOverlap:"none",anchor:"none",avoidEdges:"none",color:"none",haloBlur:"none",haloColor:"none",haloWidth:"none",keepUpright:"none",offsetAnchor:"none",size:{support:"partial",info:"Will set/get the width of the ol Icon."},optional:"none",padding:"none",pitchAlignment:"none",rotationAlignment:"none",textFit:"none",textFitPadding:"none"},LineSymbolizer:{blur:"none",gapWidth:"none",gradient:"none",miterLimit:"none",roundLimit:"none",spacing:"none",graphicFill:"none",perpendicularOffset:"none"},RasterSymbolizer:"none",TextSymbolizer:{anchor:"none",placement:{support:"partial",info:"point and line supported. line-center will be mapped to line."}}},Function:{double2bool:{support:"none",info:"Always returns false"},atan2:{support:"none",info:"Currently returns the first argument"},rint:{support:"none",info:"Currently returns the first argument"},numberFormat:{support:"none",info:"Currently returns the first argument"},strAbbreviate:{support:"none",info:"Currently returns the first argument"}}});Le(this,"title","OpenLayers Style Parser");Le(this,"olIconStyleCache",{});Le(this,"OlStyleConstructor",Vo);Le(this,"OlStyleImageConstructor",Df);Le(this,"OlStyleFillConstructor",Wi);Le(this,"OlStyleStrokeConstructor",Bf);Le(this,"OlStyleTextConstructor",a2);Le(this,"OlStyleCircleConstructor",zf);Le(this,"OlStyleIconConstructor",Gf);Le(this,"OlStyleRegularshapeConstructor",Rf);Le(this,"OlLineStringContructor",qn);Le(this,"OlMultiLineStringConstructor",Kf);Le(this,"OlPolygonConstructor",pn);Le(this,"OlMultiPolygonConstructor",Yf);Le(this,"OlPointConstructor",Dn);Le(this,"isOlParserStyleFct",e=>typeof e=="function");e&&(this.OlStyleConstructor=e.style.Style,this.OlStyleImageConstructor=e.style.Image,this.OlStyleFillConstructor=e.style.Fill,this.OlStyleStrokeConstructor=e.style.Stroke,this.OlStyleTextConstructor=e.style.Text,this.OlStyleCircleConstructor=e.style.Circle,this.OlStyleIconConstructor=e.style.Icon,this.OlStyleRegularshapeConstructor=e.style.RegularShape,this.OlLineStringContructor=e.geom.LineString,this.OlMultiLineStringConstructor=e.geom.MultiLineString,this.OlPolygonConstructor=e.geom.Polygon,this.OlMultiPolygonConstructor=e.geom.MultiPolygon,this.OlPointConstructor=e.geom.Point)}getPointSymbolizerFromOlStyle(e){let t;if(e.getImage()instanceof this.OlStyleCircleConstructor){const r=e.getImage(),n=r.getFill(),i=r.getStroke(),o=r.getDisplacement();t={kind:"Mark",wellKnownName:"circle",color:n?De.getHexColor(n.getColor()):void 0,opacity:r.getOpacity()!==1?r.getOpacity():void 0,fillOpacity:n?De.getOpacity(n.getColor()):void 0,radius:r.getRadius()!==0?r.getRadius():5,strokeColor:i?i.getColor():void 0,strokeOpacity:i?De.getOpacity(i.getColor()):void 0,strokeWidth:i?i.getWidth():void 0,offset:o[0]||o[1]?o:void 0}}else if(e.getImage()instanceof this.OlStyleRegularshapeConstructor){const r=e.getImage(),n=r.getFill(),i=r.getStroke(),o=r.getRadius(),l=r.getRadius2(),a=r.getPoints(),f=r.getAngle(),y=r.getDisplacement(),c={kind:"Mark",color:n?De.getHexColor(n.getColor()):void 0,opacity:r.getOpacity()!==1?r.getOpacity():void 0,fillOpacity:n?De.getOpacity(n.getColor()):void 0,strokeColor:i?i.getColor():void 0,strokeOpacity:i?De.getOpacity(i.getColor()):void 0,strokeWidth:i?i.getWidth():void 0,radius:o!==0?o:5,rotate:r.getRotation()/Xr,offset:y[0]||y[1]?y:void 0};switch(a){case 2:switch(f){case 0:c.wellKnownName="shape://vertline";break;case Math.PI/2:c.wellKnownName="shape://horline";break;case Math.PI/4:c.wellKnownName="shape://slash";break;case 2*Math.PI-Math.PI/4:c.wellKnownName="shape://backslash";break}break;case 3:switch(f){case 0:c.wellKnownName="triangle";break;case Math.PI/2:c.wellKnownName="shape://carrow";break}break;case 4:Number.isFinite(l)?r.getAngle()===0?r.getRadius2()===0?c.wellKnownName="shape://plus":c.wellKnownName="star_diamond":c.wellKnownName="x":r.getAngle()===0?c.wellKnownName="diamond":c.wellKnownName="square";break;case 5:Number.isFinite(l)?c.wellKnownName="star":c.wellKnownName="pentagon";break;case 6:c.wellKnownName="hexagon";break;case 8:c.wellKnownName="octagon";break;case 10:c.wellKnownName="decagon";break;default:throw new Error("Could not parse OlStyle.")}t=c}else if(e.getText()instanceof this.OlStyleTextConstructor){const r=e.getText(),n=r.getFill(),i=r.getStroke(),o=r.getRotation();let l=r.getText()||"a";const a=r.getFont()||"10px sans-serif",f=De.getFontNameFromOlFont(a),y=De.getSizeFromOlFont(a),c=[r.getOffsetX(),r.getOffsetY()];Array.isArray(l)&&(l=l[0]),t={kind:"Mark",wellKnownName:`ttf://${f}#0x${l.charCodeAt(0).toString(16)}`,color:n?De.getHexColor(n.getColor()):void 0,opacity:n?De.getOpacity(n.getColor()):void 0,strokeColor:i?i.getColor():void 0,strokeOpacity:i?De.getOpacity(i.getColor()):void 0,strokeWidth:i?i.getWidth():void 0,radius:y!==0?y:5,rotate:o?o/Xr:0,offset:c[0]||c[1]?c:void 0}}else{const r=e.getImage(),n=r.getDisplacement(),i=r.getWidth(),o=r.getRotation()/Xr,l=r.getOpacity(),a=r.getSrc();let f;a&&a.startsWith("data:image/svg+xml")?f=R7(a):a&&a.trim().startsWith("<svg")&&(f=a.trim()),f?t={...z7(f),...De.checkOpacity(l)&&{opacity:l},...o&&{rotate:o},...(n[0]||n[1])&&{offset:n}}:t={kind:"Icon",image:this.getImageFromIconStyle(r),size:i,...De.checkOpacity(l)&&{opacity:l},...o&&{rotate:o},...(n[0]||n[1])&&{offset:n}}}return t}getImageFromIconStyle(e){const t=e.getSize();if(Array.isArray(t)){const r=e.offset_,n=e.offsetOrigin_;if(n&&n!=="top-left")throw new Error(`Offset origin ${n} not supported`);return{source:e.getSrc(),position:r,size:t}}else return e.getSrc()?e.getSrc():void 0}getLineSymbolizerFromOlStyle(e){const t=e.getStroke(),r=t?t.getLineDash():void 0;return{kind:"Line",color:t?De.getHexColor(t.getColor()):void 0,opacity:t?De.getOpacity(t.getColor()):void 0,width:t?t.getWidth():void 0,cap:t?t.getLineCap():"butt",join:t?t.getLineJoin():"miter",dasharray:r||void 0,dashOffset:t?t.getLineDashOffset():void 0}}getFillSymbolizerFromOlStyle(e){const t=e.getFill(),r=e.getStroke(),n=r?r.getLineDash():void 0,i={kind:"Fill"};return t&&(i.color=De.getHexColor(t.getColor())),t&&(i.fillOpacity=De.getOpacity(t.getColor())),r&&(i.outlineColor=De.getHexColor(r.getColor())),n&&(i.outlineDasharray=n),r&&(i.outlineOpacity=De.getOpacity(r.getColor())),r&&r.getWidth()&&(i.outlineWidth=r.getWidth()),i}getTextSymbolizerFromOlStyle(e){var _;const t=e.getText();if(!t)throw new Error("Could not get text from olStyle.");const r=t.getFill(),n=t.getStroke(),i=t.getOffsetX(),o=t.getOffsetY(),l=t.getFont(),a=t.getRotation(),f=t.getOverflow()?t.getOverflow():void 0,y=t.getPlacement(),c=t.getRepeat(),g=t.getText(),d=Array.isArray(g)?g[0]:g;let m=1/0,b,F,v;if(l){const $=k7(l);$["font-weight"]&&(F=$["font-weight"]),$["font-size"]&&(m=parseInt($["font-size"],10)),$["font-family"]&&(b=(_=$["font-family"])==null?void 0:_.map(w=>w.includes(" ")?'"'+w+'"':w)),$["font-style"]&&(v=$["font-style"])}return{kind:"Text",label:d,placement:y,repeat:c,allowOverlap:f,color:r?De.getHexColor(r.getColor()):void 0,size:isFinite(m)?m:void 0,font:b,fontWeight:F||void 0,fontStyle:v||void 0,offset:i!==void 0&&o!==void 0?[i,o]:[0,0],haloColor:n&&n.getColor()?De.getHexColor(n.getColor()):void 0,haloWidth:n?n.getWidth():void 0,rotate:a!==void 0?a/Xr:void 0}}getSymbolizersFromOlStyle(e){const t=[];return e.forEach(r=>{let n;switch(this.getStyleTypeFromOlStyle(r)){case"Point":r.getText()&&!De.getIsMarkSymbolizerFont(r.getText().getFont())?n=this.getTextSymbolizerFromOlStyle(r):n=this.getPointSymbolizerFromOlStyle(r);break;case"Line":n=this.getLineSymbolizerFromOlStyle(r);break;case"Fill":n=this.getFillSymbolizerFromOlStyle(r);break;default:throw new Error("Failed to parse SymbolizerKind from OpenLayers Style")}t.push(n)}),t}getRuleFromOlStyle(e){let t;return Array.isArray(e)?t=this.getSymbolizersFromOlStyle(e):t=this.getSymbolizersFromOlStyle([e]),{name:"OL Style Rule 0",symbolizers:t}}getStyleTypeFromOlStyle(e){let t;if(e.getImage()instanceof this.OlStyleImageConstructor)t="Point";else if(e.getText()instanceof this.OlStyleTextConstructor)t="Point";else if(e.getFill()instanceof this.OlStyleFillConstructor)t="Fill";else if(e.getStroke()&&!e.getFill())t="Line";else throw new Error("StyleType could not be detected");return t}olStyleToGeoStylerStyle(e){const t="OL Style",r=this.getRuleFromOlStyle(e);return{name:t,rules:[r]}}readStyle(e){return new Promise(t=>{try{if(this.isOlParserStyleFct(e))t({output:e.__geoStylerStyle});else{e=e;const r=this.olStyleToGeoStylerStyle(e),n=this.checkForUnsupportedProperties(r);t({output:r,unsupportedProperties:n})}}catch(r){t({errors:[r]})}})}writeStyle(e){return new Promise(t=>{const r=structuredClone(e),n=this.checkForUnsupportedProperties(r);try{const i=this.getOlStyleTypeFromGeoStylerStyle(r);t({output:i,unsupportedProperties:n,warnings:n&&["Your style contains unsupportedProperties!"]})}catch(i){t({errors:[i]})}})}checkForUnsupportedProperties(e){const t=n=>n[0].toUpperCase()+n.slice(1),r={};if(e.rules.forEach(n=>{n.symbolizers.forEach(i=>{var a,f;const o=t(`${i.kind}Symbolizer`),l=(f=(a=this.unsupportedProperties)==null?void 0:a.Symbolizer)==null?void 0:f[o];l&&(typeof l=="string"?(r.Symbolizer||(r.Symbolizer={}),r.Symbolizer[o]=l):Object.keys(i).forEach(y=>{l[y]&&(r.Symbolizer||(r.Symbolizer={}),r.Symbolizer[o]||(r.Symbolizer[o]={}),r.Symbolizer[o][y]=l[y])}))})}),Object.keys(r).length>0)return r}getOlStyleTypeFromGeoStylerStyle(e){var r,n,i,o,l,a,f,y;const t=e.rules;if(t.length===1){const c=((n=(r=e==null?void 0:e.rules)==null?void 0:r[0])==null?void 0:n.filter)!==void 0,g=((l=(o=(i=e==null?void 0:e.rules)==null?void 0:i[0])==null?void 0:o.scaleDenominator)==null?void 0:l.min)!==void 0,d=((y=(f=(a=e==null?void 0:e.rules)==null?void 0:a[0])==null?void 0:f.scaleDenominator)==null?void 0:y.max)!==void 0,m=!!(g||d),b=De.containsGeoStylerFunctions(e),F=Lr.containsGraphicStroke(e),v=e.rules[0].symbolizers.length,_=t[0].symbolizers.some(w=>w.kind==="Text"),$=t[0].symbolizers.some(w=>w.kind==="Icon"&&typeof w.image=="string"&&w.image.includes("{{"));return!c&&!m&&!_&&!$&&!b&&!F?v===1?this.geoStylerStyleToOlStyle(e):this.geoStylerStyleToOlStyleArray(e):this.geoStylerStyleToOlParserStyleFct(e)}else return this.geoStylerStyleToOlParserStyleFct(e)}geoStylerStyleToOlStyle(e){const t=e.rules[0].symbolizers[0];return this.getOlSymbolizerFromSymbolizer(t)}geoStylerStyleToOlStyleArray(e){const t=e.rules[0],r=[];return t.symbolizers.forEach(n=>{const i=this.getOlSymbolizerFromSymbolizer(n);r.push(i)}),r}geoStylerStyleToOlParserStyleFct(e){const t=structuredClone(e.rules),r=(n,i)=>{const o=[],l=90.7142857142857,a=Fp.m,f=i*a*39.37*l;return t.forEach(y=>{var b,F;let c=(b=y==null?void 0:y.scaleDenominator)==null?void 0:b.min,g=(F=y==null?void 0:y.scaleDenominator)==null?void 0:F.max,d=!0;(c||g)&&(c=Ie(c)?De.evaluateNumberFunction(c):c,g=Ie(g)?De.evaluateNumberFunction(g):g,c&&f<c&&(d=!1),g&&f>=g&&(d=!1));let m=!1;if(!y.filter)m=!0;else try{m=this.geoStylerFilterToOlParserFilter(n,y.filter)}catch{m=!1}d&&m&&y.symbolizers.forEach(v=>{v.visibility===!1&&o.push(null),Tn(v.visibility)&&(De.evaluateBooleanFunction(v.visibility)||o.push(null));const _=this.getOlSymbolizerFromSymbolizer(v,n,i);if(typeof _=="function"){const $=_(n,i);o.push($)}else Array.isArray(_)?_.forEach($=>{if(typeof $=="function"){const w=$(n,i);o.push(w)}else o.push($)}):o.push(_)})}),o};return r.__geoStylerStyle=e,r}geoStylerFilterToOlParserFilter(e,t){const r={"&&":!0,"||":!0,"!":!0};let n=!0;if(Tn(t))return De.evaluateBooleanFunction(t,e);if(t===!0||t===!1)return t;const i=t[0];let o=!1;r[i]&&(o=!0);try{if(o){let l,a;switch(t[0]){case"&&":l=!0,a=t.slice(1),a.forEach(f=>{this.geoStylerFilterToOlParserFilter(e,f)||(l=!1)}),n=l;break;case"||":l=!1,a=t.slice(1),a.forEach(f=>{this.geoStylerFilterToOlParserFilter(e,f)&&(l=!0)}),n=l;break;case"!":n=!this.geoStylerFilterToOlParserFilter(e,t[1]);break;default:throw new Error("Cannot parse Filter. Unknown combination or negation operator.")}}else{let l;Ie(t[1])?l=De.evaluateFunction(t[1],e):l=e.get(t[1]);let a;switch(Ie(t[2])?a=De.evaluateFunction(t[2],e):a=t[2],t[0]){case"==":n=""+l==""+a;break;case"*=":typeof a=="string"&&typeof l=="string"&&(a.length>l.length?n=!1:n=l.indexOf(a)!==-1);break;case"!=":n=""+l!=""+a;break;case"<":n=Number(l)<Number(a);break;case"<=":n=Number(l)<=Number(a);break;case">":n=Number(l)>Number(a);break;case">=":n=Number(l)>=Number(a);break;default:throw new Error("Cannot parse Filter. Unknown comparison operator.")}}}catch{throw new Error("Cannot parse Filter. Invalid structure.")}return n}getOlSymbolizerFromSymbolizer(e,t,r){let n;switch(e=structuredClone(e),e.kind){case"Mark":n=this.getOlPointSymbolizerFromMarkSymbolizer(e,t);break;case"Icon":n=this.getOlIconSymbolizerFromIconSymbolizer(e,t);break;case"Text":n=this.getOlTextSymbolizerFromTextSymbolizer(e,t);break;case"Line":n=this.getOlLineSymbolizerFromLineSymbolizer(e,t,r);break;case"Fill":n=this.getOlPolygonSymbolizerFromFillSymbolizer(e,t);break;default:{const i=new this.OlStyleFillConstructor({color:"rgba(255,255,255,0.4)"}),o=new this.OlStyleStrokeConstructor({color:"#3399CC",width:1.25});n=new this.OlStyleConstructor({image:new this.OlStyleCircleConstructor({fill:i,stroke:o,radius:5}),fill:i,stroke:o});break}}return n}getOlPointSymbolizerFromMarkSymbolizer(e,t){for(const c of Object.keys(e))Ie(e[c])&&(e[c]=De.evaluateFunction(e[c],t));const r=e.strokeColor,n=e.strokeOpacity,i=e.strokeWidth,o=e.color,l=e.fillOpacity,a=Number(e.rotate)*Xr,f=e.offset;let y;if(eS(e.wellKnownName)){const c=e.opacity,g=tS(e);y=new this.OlStyleConstructor({image:new this.OlStyleIconConstructor({crossOrigin:"anonymous",...f&&{displacement:f},...De.checkOpacity(c)&&{opacity:c},...a&&{rotation:a},scale:1,src:D7(g)})})}else if(De.getIsFontGlyphBased(e)){const c=r&&De.checkOpacity(n)?De.getRgbaColor(r,n):r,g=o&&De.checkOpacity(l)?De.getRgbaColor(o,l):o,d=new this.OlStyleStrokeConstructor({...c&&{color:c},...i&&{width:i}}),m=new this.OlStyleFillConstructor({...g&&{color:g}});y=new this.OlStyleConstructor({text:new this.OlStyleTextConstructor({text:De.getCharacterForMarkSymbolizer(e),font:De.getTextFontForMarkSymbolizer(e),...m&&{fill:m},...f&&{offsetX:f[0]},...f&&{offsetY:f[1]},...d&&{stroke:d},...a&&{rotation:a}})})}else throw new Error("MarkSymbolizer cannot be parsed. Unsupported WellKnownName.");return y}getOlIconSymbolizerFromIconSymbolizer(e,t){for(const l of Object.keys(e))Ie(e[l])&&(e[l]=De.evaluateFunction(e[l],t));const r={src:Li(e.image)?e.image.source:e.image,crossOrigin:"anonymous",opacity:e.opacity,width:e.size,rotation:typeof e.rotate=="number"?e.rotate*Xr:void 0,displacement:e.offset,size:Li(e.image)?e.image.size:void 0,offset:Li(e.image)?e.image.position:void 0},n="\\{\\{",i="\\}\\}",o=new RegExp(n+".*?"+i,"g");return typeof e.image=="string"&&e.image.match(o)?l=>{let a=De.resolveAttributeTemplate(l,e.image,"");a||(a=e.image+"");let f;return this.olIconStyleCache[a]?(f=this.olIconStyleCache[a],r.rotation!==void 0&&f.setRotation(r.rotation),r.opacity!==void 0&&f.setOpacity(r.opacity)):(f=new this.OlStyleIconConstructor({...r,src:a}),this.olIconStyleCache[a]=f),new this.OlStyleConstructor({image:f})}:new this.OlStyleConstructor({image:new this.OlStyleIconConstructor({...r})})}getOlLineSymbolizerFromLineSymbolizer(e,t,r){if(e.graphicStroke)return this.getOlGraphicStrokeFromGraphicStroke(e,t,r);for(const l of Object.keys(e))Ie(e[l])&&(e[l]=De.evaluateFunction(e[l],t));const n=e.color,i=e.opacity,o=n&&i!==null&&i!==void 0?De.getRgbaColor(n,i):n;return new this.OlStyleConstructor({stroke:new this.OlStyleStrokeConstructor({color:o,width:e.width,lineCap:e.cap,lineJoin:e.join,lineDash:e.dasharray,lineDashOffset:e.dashOffset})})}getOlGraphicStrokeFromGraphicStroke(e,t,r){const n=Lr.getLineStringsFromGeometry(t.getGeometry(),{LineString:this.OlLineStringContructor,MultiLineString:this.OlMultiLineStringConstructor,Polygon:this.OlPolygonConstructor,MultiPolygon:this.OlMultiPolygonConstructor}),i=e.graphicStroke,o=this.getSymbolSizeFromGraphicStroke(i,t);if(o<=0)return console.warn("Symbol size must be greater than zero for graphic stroke. No graphic will be drawn."),[];const l=i.rotate,a=Ie(l)?De.evaluateNumberFunction(l,t):l??0,f=e.dasharray,y=e.dashOffset||0,c=Ie(y)?De.evaluateNumberFunction(y,t):y,g=d=>this.getOlSymbolizerFromSymbolizer(d,t,r);return n.flatMap(d=>Lr.processLineStringGraphicStroke(d,o,r,f,c,a,i,g,this.OlPointConstructor))}getSymbolSizeFromGraphicStroke(e,t){let r=0;if(e.kind==="Mark"){const n=e.radius;if(Ie(n)?r=De.evaluateNumberFunction(n,t)*2:r=(n??0)*2,r<=0)return r;const i=e.strokeWidth;Ie(i)?r+=De.evaluateNumberFunction(i,t):r+=i??0}else if(e.kind==="Icon"){const n=e.size;Ie(n)?r=De.evaluateNumberFunction(n,t):r=n??0}return r}getOlPolygonSymbolizerFromFillSymbolizer(e,t){for(const g of Object.keys(e))Ie(e[g])&&(e[g]=De.evaluateFunction(e[g],t));const r=e.color,n=e.fillOpacity,i=r&&Number.isFinite(n)?De.getRgbaColor(r,n):r;let o=r?new this.OlStyleFillConstructor({color:i}):void 0;const l=e.outlineColor,a=e.outlineOpacity,f=l&&Number.isFinite(a)?De.getRgbaColor(l,a):l,y=l||e.outlineWidth?new this.OlStyleStrokeConstructor({color:f,width:e.outlineWidth,lineDash:e.outlineDasharray}):void 0,c=new Vo({fill:o,stroke:y});if(e.graphicFill){const g=this.getOlPatternFromGraphicFill(e.graphicFill);o||(o=new Wi({})),g&&o.setColor(g),c.setFill(o)}return c}getOlPatternFromGraphicFill(e){if(!La(e)&&!lv(e))return null;const t=document.createElement("canvas"),r=t.getContext("2d");let n,i=[8,8],o=1.5,l=1;if(La(e)){const b=this.getOlIconSymbolizerFromIconSymbolizer(e),F=b==null?void 0:b.getImage();if(F==null||F.load(),(F==null?void 0:F.getImageState())!==Je.LOADED)return null;i=b.getImage().getSize(),n=i.map(w=>w*o),t.width=n[0],t.height=n[1];const v=V7(r,{size:n,pixelRatio:1}),_=n.map(w=>w/2),$=new Xo(new Dn(_));return v.drawFeature($,b),r.createPattern(t,"repeat")}const a=Y7(e),f=H2.includes(String(e.wellKnownName)),y=Lm(e.wellKnownName),c=!e.strokeWidth&&Xf.includes(y),g=y.startsWith("dense"),d=e.rotate||0;(f||c||g)&&(d/Xr%1!==0&&(l=Math.sin(d*Xr)),o=1);const m=(e.radius??4)*2;return i=[m,m],n=i.map(b=>b*o*l),t.width=n[0],t.height=n[1],G7(a,r,n[0],d),r.createPattern(t,"repeat")}getOlTextSymbolizerFromTextSymbolizer(e,t){for(const b of Object.keys(e))Ie(e[b])&&(e[b]=De.evaluateFunction(e[b],t));const r=e.color;let n=e.placement;n||(n="point"),n==="line-center"&&(n="line");const i=e.opacity,o=r&&Number.isFinite(i)?De.getRgbaColor(r,i):r,l=e.haloColor,a=e.haloWidth,f=l&&Number.isFinite(i)?De.getRgbaColor(l,i):l,y={font:De.getTextFont(e),fill:new this.OlStyleFillConstructor({color:o}),stroke:new this.OlStyleStrokeConstructor({color:f,width:a||0}),overflow:e.allowOverlap,offsetX:e.offset?e.offset[0]:0,offsetY:e.offset?e.offset[1]:0,rotation:typeof e.rotate=="number"?e.rotate*Xr:void 0,placement:n,repeat:e.repeat},c="\\{\\{",g="\\}\\}",d=new RegExp(c+".*?"+g,"g");let m;return Ti(e.label)||(m=e.label?e.label.match(d):null),m?b=>{const F=new this.OlStyleTextConstructor({text:De.resolveAttributeTemplate(b,e.label,""),...y});return new this.OlStyleConstructor({text:F})}:new this.OlStyleConstructor({text:new this.OlStyleTextConstructor({text:e.label,...y})})}}Le(Im,"title","OpenLayers Style Parser");const Om="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgdmlld0JveD0iNjQgNjQgODk2IDg5NiIKICAgZm9jdXNhYmxlPSJmYWxzZSIKICAgZGF0YS1pY29uPSJmdW5jdGlvbiIKICAgd2lkdGg9IjI0cHgiCiAgIGhlaWdodD0iMjRweCIKICAgZmlsbD0iY3VycmVudENvbG9yIgogICBhcmlhLWhpZGRlbj0idHJ1ZSIKICAgdmVyc2lvbj0iMS4xIgogICBpZD0ic3ZnNTAiCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGRlZnMKICAgICBpZD0iZGVmczQ2Ij4KICAgIDxzdHlsZQogICAgICAgaWQ9InN0eWxlNDQiIC8+CiAgPC9kZWZzPgogIDxwYXRoCiAgICAgZD0iTTg0MSAzNzBjMy0zLjMgMi43LTguMy0uNi0xMS4zYTguMjQgOC4yNCAwIDAwLTUuMy0yLjFoLTcyLjZjLTIuNCAwLTQuNiAxLTYuMSAyLjhMNjMzLjUgNTA0LjZhNy45NiA3Ljk2IDAgMDEtMTMuNC0xLjlsLTYzLjUtMTQxLjNhNy45IDcuOSAwIDAwLTcuMy00LjdIMzgwLjdsLjktNC43IDgtNDIuM2MxMC41LTU1LjQgMzgtODEuNCA4NS44LTgxLjQgMTguNiAwIDM1LjUgMS43IDQ4LjggNC43bDE0LjEtNjYuOGMtMjIuNi00LjctMzUuMi02LjEtNTQuOS02LjEtMTAzLjMgMC0xNTYuNCA0NC4zLTE3NS45IDE0Ny4zbC05LjQgNDkuNGgtOTcuNmMtMy44IDAtNy4xIDIuNy03LjggNi40TDE4MS45IDQxNWE4LjA3IDguMDcgMCAwMDcuOCA5LjdIMjg0bC04OSA0MjkuOWE4LjA3IDguMDcgMCAwMDcuOCA5LjdIMjY5YzMuOCAwIDcuMS0yLjcgNy44LTYuNGw4OS43LTQzMy4xaDEzNS44bDY4LjIgMTM5LjFjMS40IDIuOSAxIDYuNC0xLjIgOC44bC0xODAuNiAyMDNjLTIuOSAzLjMtMi42IDguNC43IDExLjMgMS41IDEuMyAzLjQgMiA1LjMgMmg3Mi43YzIuNCAwIDQuNi0xIDYuMS0yLjhsMTIzLjctMTQ2LjdjMi44LTMuNCA3LjktMy44IDExLjMtMSAuOS44IDEuNiAxLjcgMi4xIDIuOEw2NzYuNCA3ODRjMS4zIDIuOCA0LjEgNC43IDcuMyA0LjdoNjQuNmE4LjAyIDguMDIgMCAwMDcuMi0xMS41bC05NS4yLTE5OC45Yy0xLjQtMi45LS45LTYuNCAxLjMtOC44TDg0MSAzNzB6IgogICAgIGlkPSJwYXRoNDgiIC8+Cjwvc3ZnPgo=",sS=({onClick:s,symbolizerKind:e,symbolizers:t})=>{const r=p.useRef(void 0),n=p.useRef(null),i=p.useRef(void 0),[o,l]=p.useState(!1),a=Pe("Renderer"),f=p.useCallback(()=>{switch(e||dt(t,"[0].kind")){case"Mark":case"Icon":case"Text":return new Dn([7,50]);case"Fill":return new pn([[[7,50],[8,51],[9,51],[10,50],[9,49],[8,48],[7,48],[6,49],[6,50],[7,50]]]);case"Line":return new qn([[7,50],[8,50],[8.4,50.75],[9,49],[9.5,52],[10,49.5],[10.2,50],[12,50]]);default:return new Dn([7.10066,50.735851])}},[e,t]),y=p.useCallback(()=>{i.current.getSource().clear();const g=new Xo({geometry:f(),Name:"Sample Feature"});i.current.getSource().addFeature(g);const d=i.current.getSource().getExtent();r.current.getView().fit(d,{maxZoom:20,padding:[10,10,10,10]})},[f]);p.useEffect(()=>{if(n.current)return i.current=new R2({source:new W2}),r.current=new _2({layers:[i.current],controls:[],interactions:[],target:n.current,view:new Rn({projection:"EPSG:4326"})}),()=>{r.current&&r.current.setTarget(void 0)}},[n]),p.useEffect(()=>{y()},[y]),p.useEffect(()=>{c(t)},[t]);const c=async g=>{if(!g)return;const d=new Im;let m=structuredClone(g),b=!1;for(const $ of g)for(const w of Object.values($))if(Ie(w)){b=!0;const S=$.kind;["Mark","Icon","Text"].includes(S)&&(m=[{kind:"Mark",wellKnownName:"circle",strokeColor:"#000000",strokeWidth:2,color:"#FFFFFF",radius:20},{kind:"Icon",image:Om,size:24,offset:[24,-24]}]),S==="Fill"&&(m=[{kind:"Fill",outlineColor:"#000000",outlineWidth:2,graphicFill:{kind:"Icon",image:Om,size:24}}]),S==="Line"&&(m=[{kind:"Line",width:2},{kind:"Icon",image:Om,size:24}]);break}l(b);const F={name:"WrapperStyle4Symbolizer",rules:[{name:"WrapperRule4Symbolizer",symbolizers:m}]},{output:v,errors:_=[]}=await d.writeStyle(F);if(!(_.length>0))return i.current.setStyle(v),v};return p.createElement("div",{ref:n,className:"gs-symbolizer-olrenderer",role:"presentation",onClick:g=>{s&&s(t,g)}},o&&p.createElement(D.Tooltip,{title:a.placeholderInfo},p.createElement(Qe.InfoCircleTwoTone,null)))},rS=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",X7=rS+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",H7="["+rS+"]["+X7+"]*",Z7=new RegExp("^"+H7+"$");function nS(s,e){const t=[];let r=e.exec(s);for(;r;){const n=[];n.startIndex=e.lastIndex-r[0].length;const i=r.length;for(let o=0;o<i;o++)n.push(r[o]);t.push(n),r=e.exec(s)}return t}const Gc=function(s){const e=Z7.exec(s);return!(e===null||typeof e>"u")};function Q7(s){return typeof s<"u"}const Am=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],iS=["__proto__","constructor","prototype"],J7={allowBooleanAttributes:!1,unpairedTags:[]};function e9(s,e){e=Object.assign({},J7,e);const t=[];let r=!1,n=!1;s[0]==="\uFEFF"&&(s=s.substr(1));for(let i=0;i<s.length;i++)if(s[i]==="<"&&s[i+1]==="?"){if(i+=2,i=lS(s,i),i.err)return i}else if(s[i]==="<"){let o=i;if(i++,s[i]==="!"){i=aS(s,i);continue}else{let l=!1;s[i]==="/"&&(l=!0,i++);let a="";for(;i<s.length&&s[i]!==">"&&s[i]!==" "&&s[i]!==" "&&s[i]!==`
15
+ `){K+=G,G=0,C=c*$+T*g,++W;continue}const ae=d[q+1]||a.font;ae!==B&&(n&&x.push("font",ae),r&&M.push("font",ae),B=ae),G=Math.max(G,v[Z]);const se=[ee,C+T*F[Z]+c*(F[Z]-_[W]),.5*(g+G)+K];C+=F[Z],n&&x.push("strokeText",se),r&&M.push("fillText",se),++Z}return Array.prototype.push.apply(w,x),Array.prototype.push.apply(w,M),this.labels_[i]=O,O}replayTextBackground_(e,t,r,n,i,o,l){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,r),e.lineTo.apply(e,n),e.lineTo.apply(e,i),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),l&&(this.setStrokeStyle_(e,l),e.stroke())}calculateImageOrLabelDimensions_(e,t,r,n,i,o,l,a,f,y,c,g,d,m,b,F){l*=g[0],a*=g[1];let v=r-l,_=n-a;const $=i+f>e?e-f:i,w=o+y>t?t-y:o,S=m[3]+$*g[0]+m[1],L=m[0]+w*g[1]+m[2],O=v-m[3],T=_-m[0];(b||c!==0)&&(Ki[0]=O,Yi[0]=O,Ki[1]=T,gi[1]=T,gi[0]=O+S,ui[0]=gi[0],ui[1]=T+L,Yi[1]=ui[1]);let C;return c!==0?(C=Di(Wr(),r,n,1,1,c,-r,-n),rr(C,Ki),rr(C,gi),rr(C,ui),rr(C,Yi),Cl(Math.min(Ki[0],gi[0],ui[0],Yi[0]),Math.min(Ki[1],gi[1],ui[1],Yi[1]),Math.max(Ki[0],gi[0],ui[0],Yi[0]),Math.max(Ki[1],gi[1],ui[1],Yi[1]),Ul)):Cl(Math.min(O,O+S),Math.min(T,T+L),Math.max(O,O+S),Math.max(T,T+L),Ul),d&&(v=Math.round(v),_=Math.round(_)),{drawImageX:v,drawImageY:_,drawImageW:$,drawImageH:w,originX:f,originY:y,declutterBox:{minX:Ul[0],minY:Ul[1],maxX:Ul[2],maxY:Ul[3],value:F},canvasTransform:C,scale:g}}replayImageOrLabel_(e,t,r,n,i,o,l){const a=!!(o||l),f=n.declutterBox,y=l?l[2]*n.scale[0]/2:0;return f.minX-y<=t[0]&&f.maxX+y>=0&&f.minY-y<=t[1]&&f.maxY+y>=0&&(a&&this.replayTextBackground_(e,Ki,gi,ui,Yi,o,l),CR(e,n.canvasTransform,i,r,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const r=rr(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;e.save(),e.translate(r[0]%n,r[1]%n),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],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,r,n){const i=this.textStates[t],o=this.createLabel(e,t,n,r),l=this.strokeStates[r],a=this.pixelRatio,f=Sm(Array.isArray(e)?e[0]:e,i.textAlign||Pf),y=Nc[i.textBaseline||Lc],c=l&&l.lineWidth?l.lineWidth:0,g=o.width/a-2*i.scale[0],d=f*g+2*(.5-f)*c,m=y*o.height/a+2*(.5-y)*c;return{label:o,anchorX:d,anchorY:m}}execute_(e,t,r,n,i,o,l,a){const f=this.zIndexContext_;let y;this.pixelCoordinates_&&Ai(r,this.renderedTransform_)?y=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),y=Ri(this.coordinates,0,this.coordinates.length,2,r,this.pixelCoordinates_),SD(this.renderedTransform_,r));let c=0;const g=n.length;let d=0,m,b,F,v,_,$,w,S,L,O,T,C,x,M,G,K,Z=0,W=0;const B=this.coordinateCache_,q=this.viewRotation_,ne=Math.round(Math.atan2(-r[1],r[0])*1e12)/1e12,ee={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:q},ae=this.instructions!=n||this.overlaps?0:200;let se,J,we,ue;for(;c<g;){const Q=n[c];switch(Q[0]){case ze.BEGIN_GEOMETRY:se=Q[1],ue=Q[3],se.getGeometry()?l!==void 0&&!qr(l,ue.getExtent())?c=Q[2]+1:++c:c=Q[2],f&&(f.zIndex=Q[4]);break;case ze.BEGIN_PATH:Z>ae&&(this.fill_(e),Z=0),W>ae&&(e.stroke(),W=0),!Z&&!W&&(e.beginPath(),S=NaN,L=NaN),++c;break;case ze.CIRCLE:d=Q[1],v=Q[2]??0;const ge=y[d],Xe=y[d+1],Te=y[d+2]-v,be=y[d+3]-v,qe=Te-ge,P=be-Xe,I=Math.sqrt(qe*qe+P*P);e.moveTo(ge+I,Xe),e.arc(ge,Xe,I,0,2*Math.PI,!0),++c;break;case ze.CLOSE_PATH:e.closePath(),++c;break;case ze.CUSTOM:d=Q[1],m=Q[2];const V=Q[3],R=Q[4],Re=Q[5];ee.geometry=V,ee.feature=se,c in B||(B[c]=[]);const Ae=B[c];Re?Re(y,d,m,2,Ae):(Ae[0]=y[d],Ae[1]=y[d+1],Ae.length=2),f&&(f.zIndex=Q[6]),R(Ae,ee),++c;break;case ze.DRAW_IMAGE:d=Q[1],m=Q[2],C=Q[3],b=Q[4],F=Q[5];let Be=Q[6];const $e=Q[7],ye=Q[8],ve=Q[9],je=Q[10];let de=Q[11];const H=Q[12];let Ot=Q[13];w=Q[14]||"declutter";const re=Q[15];if(!C&&Q.length>=20){x=Q[19],M=Q[20],G=Q[21],K=Q[22];const kt=this.drawLabelWithPointPlacement_(x,M,G,K);C=kt.label,Q[3]=C;const Js=Q[23];b=(kt.anchorX-Js)*this.pixelRatio,Q[4]=b;const Ft=Q[24];F=(kt.anchorY-Ft)*this.pixelRatio,Q[5]=F,Be=C.height,Q[6]=Be,Ot=C.width,Q[13]=Ot}let Wt;Q.length>25&&(Wt=Q[25]);let pt,Ht,Qs;Q.length>17?(pt=Q[16],Ht=Q[17],Qs=Q[18]):(pt=Wo,Ht=null,Qs=null),je&&ne?de+=q:!je&&!ne&&(de-=q);let gt=0;for(;d<m;d+=2){if(Wt&&Wt[gt++]<Ot/this.pixelRatio)continue;const kt=this.calculateImageOrLabelDimensions_(C.width,C.height,y[d],y[d+1],Ot,Be,b,F,ye,ve,de,H,i,pt,!!Ht||!!Qs,se),Js=[e,t,C,kt,$e,Ht,Qs];if(a){let Ft,hs,Mt;if(re){const xt=m-d;if(!re[xt]){re[xt]={args:Js,declutterMode:w};continue}const Dt=re[xt];Ft=Dt.args,hs=Dt.declutterMode,delete re[xt],Mt=x2(Ft)}let cs,Es;if(Ft&&(hs!=="declutter"||!a.collides(Mt))&&(cs=!0),(w!=="declutter"||!a.collides(kt.declutterBox))&&(Es=!0),hs==="declutter"&&w==="declutter"){const xt=cs&&Es;cs=xt,Es=xt}cs&&(hs!=="none"&&a.insert(Mt),this.replayImageOrLabel_.apply(this,Ft)),Es&&(w!=="none"&&a.insert(kt.declutterBox),this.replayImageOrLabel_.apply(this,Js))}else this.replayImageOrLabel_.apply(this,Js)}++c;break;case ze.DRAW_CHARS:const js=Q[1],ls=Q[2],as=Q[3],$n=Q[4];K=Q[5];const Qn=Q[6],Zt=Q[7],Gs=Q[8];G=Q[9];const vs=Q[10];x=Q[11],Array.isArray(x)&&(x=x.reduce(o7,"")),M=Q[12];const Jn=[Q[13],Q[13]];w=Q[14]||"declutter";const nn=Q[15],At=this.textStates[M],bt=At.font,Vt=[At.scale[0]*Zt,At.scale[1]*Zt];let fs;bt in this.widths_?fs=this.widths_[bt]:(fs={},this.widths_[bt]=fs);const ys=wm(y,js,ls,2),Gt=Math.abs(Vt[0])*n2(bt,x,fs);if($n||Gt<=ys){const kt=this.textStates[M].textAlign,Js=(ys-Gt)*Sm(x,kt),Ft=n7(y,js,ls,2,x,Js,Qn,Math.abs(Vt[0]),n2,bt,fs,ne?0:this.viewRotation_,nn);e:if(Ft){const hs=[];let Mt,cs,Es,xt,Dt;if(G)for(Mt=0,cs=Ft.length;Mt<cs;++Mt){Dt=Ft[Mt],Es=Dt[4],xt=this.createLabel(Es,M,"",G),b=Dt[2]+(Vt[0]<0?-vs:vs),F=as*xt.height+(.5-as)*2*vs*Vt[1]/Vt[0]-Gs;const Bs=this.calculateImageOrLabelDimensions_(xt.width,xt.height,Dt[0],Dt[1],xt.width,xt.height,b,F,0,0,Dt[3],Jn,!1,Wo,!1,se);if(a&&w==="declutter"&&a.collides(Bs.declutterBox))break e;hs.push([e,t,xt,Bs,1,null,null])}if(K)for(Mt=0,cs=Ft.length;Mt<cs;++Mt){Dt=Ft[Mt],Es=Dt[4],xt=this.createLabel(Es,M,K,""),b=Dt[2],F=as*xt.height-Gs;const Bs=this.calculateImageOrLabelDimensions_(xt.width,xt.height,Dt[0],Dt[1],xt.width,xt.height,b,F,0,0,Dt[3],Jn,!1,Wo,!1,se);if(a&&w==="declutter"&&a.collides(Bs.declutterBox))break e;hs.push([e,t,xt,Bs,1,null,null])}a&&w!=="none"&&a.load(hs.map(x2));for(let Bs=0,ll=hs.length;Bs<ll;++Bs)this.replayImageOrLabel_.apply(this,hs[Bs])}}++c;break;case ze.END_GEOMETRY:if(o!==void 0){se=Q[1];const kt=o(se,ue,w);if(kt)return kt}++c;break;case ze.FILL:ae?Z++:this.fill_(e),++c;break;case ze.MOVE_TO_LINE_TO:for(d=Q[1],m=Q[2],v=Q[3],_=Q[4]??!1,J=y[d],we=y[d+1],v&&($=d,[J,we]=kc(J,we,_?y[m-4]:void 0,_?y[m-3]:void 0,y[d+2],y[d+3],v)),e.moveTo(J,we),S=J+.5|0,L=we+.5|0,d+=2;d<m;d+=2)J=y[d],we=y[d+1],O=J+.5|0,T=we+.5|0,(d==m-2||O!==S||T!==L)&&(v&&(d==m-2?[J,we]=kc(J,we,y[d-2],y[d-1],_?y[$+2]:void 0,_?y[$+3]:void 0,v):[J,we]=kc(J,we,y[d-2],y[d-1],y[d+2],y[d+3],v)),e.lineTo(J,we),S=O,L=T);++c;break;case ze.SET_FILL_STYLE:this.alignAndScaleFill_=Q[2],Z&&(this.fill_(e),Z=0,W&&(e.stroke(),W=0)),e.fillStyle=Q[1],++c;break;case ze.SET_STROKE_STYLE:W&&(e.stroke(),W=0),this.setStrokeStyle_(e,Q),++c;break;case ze.STROKE:ae?W++:e.stroke(),++c;break;default:++c;break}}Z&&this.fill_(e),W&&e.stroke()}execute(e,t,r,n,i,o){this.viewRotation_=n,this.execute_(e,t,r,this.instructions,i,void 0,void 0,o)}executeHitDetection(e,t,r,n,i){return this.viewRotation_=r,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,n,i)}}const Yo=["Polygon","Circle","LineString","Image","Text","Default"],T2=["Image","Text"],a7=Yo.filter(s=>!T2.includes(s));let L2=!1,I2=!1;function f7(){let s=0;const e=r=>{const n=Xs(1,1,null,{willReadFrequently:r});let i=0;const o=performance.now();for(;performance.now()-o<50;++i)n.fillStyle=`rgba(255,0,${i%256},1)`,n.fillRect(0,0,1,1),n.getImageData(0,0,1,1);return s=i>s?i:s,i};L2={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[s],I2=!0}class y7{constructor(e,t,r,n,i,o,l){this.maxExtent_=e,this.overlaps_=n,this.pixelRatio_=r,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Wr(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,l)}clip(e,t){const r=this.getClipCoords(t);e.beginPath(),e.moveTo(r[0],r[1]),e.lineTo(r[2],r[3]),e.lineTo(r[4],r[5]),e.lineTo(r[6],r[7]),e.clip()}createExecutors_(e,t){for(const r in e){let n=this.executorsByZIndex_[r];n===void 0&&(n={},this.executorsByZIndex_[r]=n);const i=e[r];for(const o in i){const l=i[o];n[o]=new l7(this.resolution_,this.pixelRatio_,this.overlaps_,l,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const r=this.executorsByZIndex_[t];for(let n=0,i=e.length;n<i;++n)if(e[n]in r)return!0}return!1}forEachFeatureAtCoordinate(e,t,r,n,i,o){I2===!1&&f7(),n=Math.round(n);const l=n*2+1,a=Di(this.hitDetectionTransform_,n+.5,n+.5,1/t,-1/t,-r,-e[0],-e[1]),f=!this.hitDetectionContext_;f&&(this.hitDetectionContext_=Xs(l,l,null,{willReadFrequently:L2}));const y=this.hitDetectionContext_;y.canvas.width!==l||y.canvas.height!==l?(y.canvas.width=l,y.canvas.height=l):f||y.clearRect(0,0,l,l);let c;this.renderBuffer_!==void 0&&(c=ki(),A8(c,e),cp(c,t*(this.renderBuffer_+n),c));const g=h7(n);let d;function m(S,L,O){const T=y.getImageData(0,0,l,l).data;for(let C=0,x=g.length;C<x;C++)if(T[g[C]]>0){if(!o||O==="none"||d!=="Image"&&d!=="Text"||o.includes(S)){const M=(g[C]-3)/4,G=n-M%l,K=n-(M/l|0),Z=i(S,L,G*G+K*K);if(Z)return Z}y.clearRect(0,0,l,l);break}}const b=Object.keys(this.executorsByZIndex_).map(Number);b.sort(Co);let F,v,_,$,w;for(F=b.length-1;F>=0;--F){const S=b[F].toString();for(_=this.executorsByZIndex_[S],v=Yo.length-1;v>=0;--v)if(d=Yo[v],$=_[d],$!==void 0&&(w=$.executeHitDetection(y,a,r,m,c),w))return w}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const r=t[0],n=t[1],i=t[2],o=t[3],l=[r,n,r,o,i,o,i,n];return Ri(l,0,8,2,e,l),l}isEmpty(){return To(this.executorsByZIndex_)}execute(e,t,r,n,i,o,l){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(l?F8:Co),o=o||Yo;const f=Yo.length;for(let y=0,c=a.length;y<c;++y){const g=a[y].toString(),d=this.executorsByZIndex_[g];for(let m=0,b=o.length;m<b;++m){const F=o[m],v=d[F];if(v!==void 0){const _=l===null?void 0:v.getZIndexContext(),$=_?_.getContext():e,w=this.maxExtent_&&F!=="Image"&&F!=="Text";if(w&&($.save(),this.clip($,r)),!_||F==="Text"||F==="Image"?v.execute($,t,r,n,i,l):_.pushFunction(S=>v.execute(S,t,r,n,i,l)),w&&$.restore(),_){_.offset();const S=a[y]*f+Yo.indexOf(F);this.deferredZIndexContexts_[S]||(this.deferredZIndexContexts_[S]=[]),this.deferredZIndexContexts_[S].push(_)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Co);for(let r=0,n=t.length;r<n;++r)e[t[r]].forEach(i=>{i.draw(this.renderedContext_),i.clear()}),e[t[r]].length=0}}const Em={};function h7(s){if(Em[s]!==void 0)return Em[s];const e=s*2+1,t=s*s,r=new Array(t+1);for(let i=0;i<=s;++i)for(let o=0;o<=s;++o){const l=i*i+o*o;if(l>t)break;let a=r[l];a||(a=[],r[l]=a),a.push(((s+i)*e+(s+o))*4+3),i>0&&a.push(((s-i)*e+(s+o))*4+3),o>0&&(a.push(((s+i)*e+(s-o))*4+3),i>0&&a.push(((s-i)*e+(s-o))*4+3))}const n=[];for(let i=0,o=r.length;i<o;++i)r[i]&&n.push(...r[i]);return Em[s]=n,n}class O2 extends $2{constructor(e,t,r,n,i,o,l){super(),this.context_=e,this.pixelRatio_=t,this.extent_=r,this.transform_=n,this.transformRotation_=n?R$(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=i,this.squaredTolerance_=o,this.userTransform_=l,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_=Wr()}drawImages_(e,t,r,n){if(!this.image_)return;const i=Ri(e,t,r,n,this.transform_,this.pixelCoordinates_),o=this.context_,l=this.tmpLocalTransform_,a=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=a*this.imageOpacity_);let f=this.imageRotation_;this.transformRotation_===0&&(f-=this.viewRotation_),this.imageRotateWithView_&&(f+=this.viewRotation_);for(let y=0,c=i.length;y<c;y+=2){const g=i[y]-this.imageAnchorX_,d=i[y+1]-this.imageAnchorY_;if(f!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const m=g+this.imageAnchorX_,b=d+this.imageAnchorY_;Di(l,m,b,1,1,f,-m,-b),o.save(),o.transform.apply(o,l),o.translate(m,b),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.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,g,d,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=a)}drawText_(e,t,r,n){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const i=Ri(e,t,r,n,this.transform_,this.pixelCoordinates_),o=this.context_;let l=this.textRotation_;for(this.transformRotation_===0&&(l-=this.viewRotation_),this.textRotateWithView_&&(l+=this.viewRotation_);t<r;t+=n){const a=i[t]+this.textOffsetX_,f=i[t+1]+this.textOffsetY_;l!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(a-this.textOffsetX_,f-this.textOffsetY_),o.rotate(l),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.restore()):(this.textStrokeState_&&o.strokeText(this.text_,a,f),this.textFillState_&&o.fillText(this.text_,a,f))}}moveToLineTo_(e,t,r,n,i,o){const l=this.context_;let a=Ri(e,t,r,n,this.transform_,this.pixelCoordinates_);Math.abs(o)>0&&(a=r7(a,n,o,i,a)),l.moveTo(a[0],a[1]);let f=a.length;i&&(f-=2);for(let y=2;y<f;y+=2)l.lineTo(a[y],a[y+1]);return i&&l.closePath(),r}drawRings_(e,t,r,n,i){for(let o=0,l=r.length;o<l;++o)t=this.moveToLineTo_(e,t,r[o],n,!0,i);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!qr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=MD(e,this.transform_,this.pixelCoordinates_),r=t[2]-t[0],n=t[3]-t[1],i=Math.sqrt(r*r+n*n),o=this.context_;o.beginPath(),o.arc(t[0],t[1],i,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}}drawFeature(e,t){const r=t.getGeometryFunction()(e);r&&(this.setStyle(t),this.drawGeometry(r))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let r=0,n=t.length;r<n;++r)this.drawGeometry(t[r])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),r=e.getStride();this.image_&&this.drawImages_(t,0,t.length,r),this.text_!==""&&this.drawText_(t,0,t.length,r)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),r=e.getStride();this.image_&&this.drawImages_(t,0,t.length,r),this.text_!==""&&this.drawText_(t,0,t.length,r)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!qr(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,r=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(r,0,r.length,e.getStride(),!1,this.strokeState_.strokeOffset),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(qr(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const r=this.context_,n=e.getFlatCoordinates();let i=0;const o=e.getEnds(),l=e.getStride();r.beginPath();for(let a=0,f=o.length;a<f;++a)i=this.moveToLineTo_(n,i,o[a],l,!1,this.strokeState_.strokeOffset);r.stroke()}if(this.text_!==""){const r=e.getFlatMidpoints();this.drawText_(r,0,r.length,2)}}}drawPolygon(e){var t;if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!qr(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const r=this.context_;r.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),(t=this.strokeState_)==null?void 0:t.strokeOffset),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}if(this.text_!==""){const r=e.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}}drawMultiPolygon(e){var t;if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!qr(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const r=this.context_,n=e.getOrientedFlatCoordinates();let i=0;const o=e.getEndss(),l=e.getStride();r.beginPath();for(let a=0,f=o.length;a<f;++a){const y=o[a];i=this.drawRings_(n,i,y,l,(t=this.strokeState_)==null?void 0:t.strokeOffset)}this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}if(this.text_!==""){const r=e.getFlatInteriorPoints();this.drawText_(r,0,r.length,2)}}}setContextFillState_(e){const t=this.context_,r=this.contextFillState_;r?r.fillStyle!=e.fillStyle&&(r.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=e.lineCap&&(r.lineCap=e.lineCap,t.lineCap=e.lineCap),Ai(r.lineDash,e.lineDash)||t.setLineDash(r.lineDash=e.lineDash),r.lineDashOffset!=e.lineDashOffset&&(r.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),r.lineJoin!=e.lineJoin&&(r.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),r.lineWidth!=e.lineWidth&&(r.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),r.miterLimit!=e.miterLimit&&(r.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),r.strokeStyle!=e.strokeStyle&&(r.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_,r=this.contextTextState_,n=e.textAlign?e.textAlign:Pf;r?(r.font!=e.font&&(r.font=e.font,t.font=e.font),r.textAlign!=n&&(r.textAlign=n,t.textAlign=n),r.textBaseline!=e.textBaseline&&(r.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 r=e.getColor();this.fillState_={fillStyle:Gn(r||mr)}}if(!t)this.strokeState_=null;else{const r=t.getColor(),n=t.getLineCap(),i=t.getLineDash(),o=t.getLineDashOffset(),l=t.getLineJoin(),a=t.getWidth(),f=t.getMiterLimit(),y=i||fi,c=t.getOffset();this.strokeState_={lineCap:n!==void 0?n:zl,lineDash:this.pixelRatio_===1?y:y.map(g=>g*this.pixelRatio_),lineDashOffset:(o||yi)*this.pixelRatio_,lineJoin:l!==void 0?l:Gl,lineWidth:(a!==void 0?a:Nf)*this.pixelRatio_,miterLimit:f!==void 0?f:Af,strokeStyle:Gn(r||Mf),strokeOffset:(c??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const r=e.getPixelRatio(this.pixelRatio_),n=e.getAnchor(),i=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*r,this.imageAnchorY_=n[1]*r,this.imageHeight_=t[1]*r,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/r,o[1]*this.pixelRatio_/r],this.imageWidth_=t[0]*r}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const d=t.getColor();this.textFillState_={fillStyle:Gn(d||mr)}}const r=e.getStroke();if(!r)this.textStrokeState_=null;else{const d=r.getColor(),m=r.getLineCap(),b=r.getLineDash(),F=r.getLineDashOffset(),v=r.getLineJoin(),_=r.getWidth(),$=r.getMiterLimit();this.textStrokeState_={lineCap:m!==void 0?m:zl,lineDash:b||fi,lineDashOffset:F||yi,lineJoin:v!==void 0?v:Gl,lineWidth:_!==void 0?_:Nf,miterLimit:$!==void 0?$:Af,strokeStyle:Gn(d||Mf)}}const n=e.getFont(),i=e.getOffsetX(),o=e.getOffsetY(),l=e.getRotateWithView(),a=e.getRotation(),f=e.getScaleArray(),y=e.getText(),c=e.getTextAlign(),g=e.getTextBaseline();this.textState_={font:n!==void 0?n:e2,textAlign:c!==void 0?c:Pf,textBaseline:g!==void 0?g:Lc},this.text_=y!==void 0?Array.isArray(y)?y.reduce((d,m,b)=>d+=b%2?" ":m,""):y:"",this.textOffsetX_=i!==void 0?this.pixelRatio_*i:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=l!==void 0?l:!1,this.textRotation_=a!==void 0?a:0,this.textScale_=[this.pixelRatio_*f[0],this.pixelRatio_*f[1]]}}}const Bn=.5;function c7(s,e,t,r,n,i,o,l,a){const f=n,y=s[0]*Bn,c=s[1]*Bn,g=Xs(y,c);g.imageSmoothingEnabled=!1;const d=g.canvas,m=new O2(g,Bn,n,null,o,l,null),b=t.length,F=Math.floor((256*256*256-1)/b),v={};for(let $=1;$<=b;++$){const w=t[$-1],S=w.getStyleFunction()||r;if(!S)continue;let L=S(w,i);if(!L)continue;Array.isArray(L)||(L=[L]);const T=($*F).toString(16).padStart(7,"#00000");for(let C=0,x=L.length;C<x;++C){const M=L[C],G=M.getGeometryFunction()(w);if(!G||!qr(f,G.getExtent()))continue;const K=M.clone(),Z=K.getFill();Z&&Z.setColor(T);const W=K.getStroke();W&&(W.setColor(T),W.setLineDash(null)),K.setText(void 0);const B=M.getImage();if(B){const ae=B.getImageSize();if(!ae)continue;const se=Xs(ae[0],ae[1],void 0,{alpha:!1}),J=se.canvas;se.fillStyle=T,se.fillRect(0,0,J.width,J.height),K.setImage(new Gf({img:J,anchor:B.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:B.getOrigin(),opacity:1,size:B.getSize(),scale:B.getScale(),rotation:B.getRotation(),rotateWithView:B.getRotateWithView()}))}const q=K.getZIndex()||0;let ne=v[q];ne||(ne={},v[q]=ne,ne.Polygon=[],ne.Circle=[],ne.LineString=[],ne.Point=[]);const ee=G.getType();if(ee==="GeometryCollection"){const ae=G.getGeometriesArrayRecursive();for(let se=0,J=ae.length;se<J;++se){const we=ae[se];ne[we.getType().replace("Multi","")].push(we,K)}}else ne[ee.replace("Multi","")].push(G,K)}}const _=Object.keys(v).map(Number).sort(Co);for(let $=0,w=_.length;$<w;++$){const S=v[_[$]];for(const L in S){const O=S[L];for(let T=0,C=O.length;T<C;T+=2){m.setStyle(O[T+1]);for(let x=0,M=e.length;x<M;++x)m.setTransform(e[x]),m.drawGeometry(O[T])}}}return g.getImageData(0,0,d.width,d.height)}function g7(s,e,t){const r=[];if(t){const n=Math.floor(Math.round(s[0])*Bn),i=Math.floor(Math.round(s[1])*Bn),o=(Yt(n,0,t.width-1)+Yt(i,0,t.height-1)*t.width)*4,l=t.data[o],a=t.data[o+1],y=t.data[o+2]+256*(a+256*l),c=Math.floor((256*256*256-1)/e.length);y&&y%c===0&&r.push(e[y/c-1])}return r}const u7=.5,A2={Point:_7,LineString:F7,Polygon:w7,MultiPoint:$7,MultiLineString:j7,MultiPolygon:v7,GeometryCollection:b7,Circle:p7};function d7(s,e){return parseInt(ns(s),10)-parseInt(ns(e),10)}function M2(s,e){const t=P2(s,e);return t*t}function P2(s,e){return u7*s/e}function p7(s,e,t,r,n){const i=t.getFill(),o=t.getStroke();if(i||o){const a=s.getBuilder(t.getZIndex(),"Circle");a.setFillStrokeStyle(i,o),a.drawCircle(e,r,n)}const l=t.getText();if(l&&l.getText()){const a=s.getBuilder(t.getZIndex(),"Text");a.setTextStyle(l),a.drawText(e,r)}}function N2(s,e,t,r,n,i,o,l){const a=[],f=t.getImage();if(f){let g=!0;const d=f.getImageState();d==Je.LOADED||d==Je.ERROR?g=!1:d==Je.IDLE&&f.load(),g&&a.push(f.ready())}const y=t.getFill();y&&y.loading()&&a.push(y.ready());const c=a.length>0;return c&&Promise.all(a).then(()=>n(null)),m7(s,e,t,r,i,o,l),c}function m7(s,e,t,r,n,i,o){const l=t.getGeometryFunction()(e);if(!l)return;const a=l.simplifyTransformed(r,n);if(t.getRenderer())k2(s,a,t,e,o);else{const y=A2[a.getType()];y(s,a,t,e,o,i)}}function k2(s,e,t,r,n){if(e.getType()=="GeometryCollection"){const o=e.getGeometries();for(let l=0,a=o.length;l<a;++l)k2(s,o[l],t,r,n);return}s.getBuilder(t.getZIndex(),"Default").drawCustom(e,r,t.getRenderer(),t.getHitDetectionRenderer(),n)}function b7(s,e,t,r,n,i){const o=e.getGeometriesArray();let l,a;for(l=0,a=o.length;l<a;++l){const f=A2[o[l].getType()];f(s,o[l],t,r,n,i)}}function F7(s,e,t,r,n){const i=t.getStroke();if(i){const l=s.getBuilder(t.getZIndex(),"LineString");l.setFillStrokeStyle(null,i),l.drawLineString(e,r,n)}const o=t.getText();if(o&&o.getText()){const l=s.getBuilder(t.getZIndex(),"Text");l.setTextStyle(o),l.drawText(e,r,n)}}function j7(s,e,t,r,n){const i=t.getStroke();if(i){const l=s.getBuilder(t.getZIndex(),"LineString");l.setFillStrokeStyle(null,i),l.drawMultiLineString(e,r,n)}const o=t.getText();if(o&&o.getText()){const l=s.getBuilder(t.getZIndex(),"Text");l.setTextStyle(o),l.drawText(e,r,n)}}function v7(s,e,t,r,n){const i=t.getFill(),o=t.getStroke();if(o||i){const a=s.getBuilder(t.getZIndex(),"Polygon");a.setFillStrokeStyle(i,o),a.drawMultiPolygon(e,r,n)}const l=t.getText();if(l&&l.getText()){const a=s.getBuilder(t.getZIndex(),"Text");a.setTextStyle(l),a.drawText(e,r,n)}}function _7(s,e,t,r,n,i){const o=t.getImage(),l=t.getText(),a=l&&l.getText(),f=i&&o&&a?{}:void 0;if(o){if(o.getImageState()!=Je.LOADED)return;const y=s.getBuilder(t.getZIndex(),"Image");y.setImageStyle(o,f),y.drawPoint(e,r,n)}if(a){const y=s.getBuilder(t.getZIndex(),"Text");y.setTextStyle(l,f),y.drawText(e,r,n)}}function $7(s,e,t,r,n,i){const o=t.getImage(),l=o&&o.getOpacity()!==0,a=t.getText(),f=a&&a.getText(),y=i&&l&&f?{}:void 0;if(l){if(o.getImageState()!=Je.LOADED)return;const c=s.getBuilder(t.getZIndex(),"Image");c.setImageStyle(o,y),c.drawMultiPoint(e,r,n)}if(f){const c=s.getBuilder(t.getZIndex(),"Text");c.setTextStyle(a,y),c.drawText(e,r,n)}}function w7(s,e,t,r,n){const i=t.getFill(),o=t.getStroke();if(i||o){const a=s.getBuilder(t.getZIndex(),"Polygon");a.setFillStrokeStyle(i,o),a.drawPolygon(e,r,n)}const l=t.getText();if(l&&l.getText()){const a=s.getBuilder(t.getZIndex(),"Text");a.setTextStyle(l),a.drawText(e,r,n)}}const S7=5;class E7 extends af{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=S7}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return He()}getData(e){return null}prepareFrame(e){return He()}renderFrame(e,t){return He()}forEachFeatureAtCoordinate(e,t,r,n,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;(t.getState()===Je.LOADED||t.getState()===Je.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Je.LOADED&&t!=Je.ERROR&&e.addEventListener(at.CHANGE,this.boundHandleImageChange_),t==Je.IDLE&&(e.load(),t=e.getState()),t==Je.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const D2=[];let Wl=null;function x7(){Wl=Xs(1,1,void 0,{willReadFrequently:!0})}class C7 extends E7{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Wr(),this.pixelTransform=Wr(),this.inversePixelTransform=Wr(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,r){Wl||x7(),Wl.clearRect(0,0,1,1);let n;try{Wl.drawImage(e,t,r,1,1,0,0,1,1),n=Wl.getImageData(0,0,1,1).data}catch{return Wl=null,null}return n}getBackground(e){let r=this.getLayer().getBackground();return typeof r=="function"&&(r=r(e.viewState.resolution)),r||void 0}useContainer(e,t,r){const n=this.getLayer().getClassName();let i,o;if(e&&e.className===n&&(!r||e&&e.style.backgroundColor&&Ai(Bo(e.style.backgroundColor),Bo(r)))){const l=e.firstElementChild;Gi(l)&&(o=l.getContext("2d"))}if(o&&LD(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&&(this.container.style.backgroundColor=null),!this.container){i=oi?Mw():document.createElement("div"),i.className=n;let l=i.style;l.position="absolute",l.width="100%",l.height="100%",o=Xs();const a=o.canvas;i.appendChild(a),l=a.style,l.position="absolute",l.left="0",l.transformOrigin="top left",this.container=i,this.context=o}!this.containerReused&&r&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=r)}clipUnrotated(e,t,r){const n=V$(r),i=K$(r),o=W$(r),l=U$(r);rr(t.coordinateToPixelTransform,n),rr(t.coordinateToPixelTransform,i),rr(t.coordinateToPixelTransform,o),rr(t.coordinateToPixelTransform,l);const a=this.inversePixelTransform;rr(a,n),rr(a,i),rr(a,o),rr(a,l),e.save(),e.beginPath(),e.moveTo(Math.round(n[0]),Math.round(n[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(l[0]),Math.round(l[1])),e.clip()}prepareContainer(e,t){const r=e.extent,n=e.viewState.resolution,i=e.viewState.rotation,o=e.pixelRatio,l=Math.round(Ns(r)/n*o),a=Math.round(li(r)/n*o);Di(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,i,-l/2,-a/2),uw(this.inversePixelTransform,this.pixelTransform);const f=TD(this.pixelTransform);if(this.useContainer(t,f,this.getBackground(e)),!this.containerReused){const y=this.context.canvas;y.width!=l||y.height!=a?(y.width=l,y.height=a):this.context.clearRect(0,0,l,a),f!==y.style.transform&&(y.style.transform=f)}}dispatchRenderEvent_(e,t,r){const n=this.getLayer();if(n.hasListener(e)){const i=new F2(e,this.inversePixelTransform,r,t);n.dispatchEvent(i)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Vr.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Vr.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new E2),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Vr.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Vr.POSTRENDER,this.context,e))}getRenderTransform(e,t,r,n,i,o,l){const a=i/2,f=o/2,y=n/t,c=-y,g=-e[0]+l,d=-e[1];return Di(this.tempTransform,a,f,y,c,-r,g,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class T7 extends C7{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=ki(),this.wrappedRenderedExtent_=ki(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,r){const n=t.extent,i=t.viewState,o=i.center,l=i.resolution,a=i.projection,f=i.rotation,y=a.getExtent(),c=this.getLayer().getSource(),g=this.getLayer().getDeclutter(),d=t.pixelRatio,m=t.viewHints,b=!(m[Ys.ANIMATING]||m[Ys.INTERACTING]),F=this.context,v=Math.round(Ns(n)/l*d),_=Math.round(li(n)/l*d),$=c.getWrapX()&&a.canWrapX(),w=$?Ns(y):null,S=$?Math.ceil((n[2]-y[2])/w)+(this.extendX_?2:1):1;let L=$?Math.floor((n[0]-y[0])/w)-(this.extendX_?1:0):0;do{let O=this.getRenderTransform(o,l,0,d,v,_,L*w);t.declutter&&(O=O.slice(0)),e.execute(F,[F.canvas.width,F.canvas.height],O,f,b,r===void 0?Yo:r?T2:a7,r?g&&t.declutter[g]:void 0)}while(++L<S)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Xs(this.context.canvas.width,this.context.canvas.height,D2))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,n6(this.context),D2.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){const r=e.layerStatesArray[e.layerIndex];this.opacity_=r.opacity;const n=e.viewState;this.prepareContainer(e,t);const i=this.context,o=this.replayGroup_;let l=o&&!o.isEmpty();if(!l&&!(this.getLayer().hasListener(Vr.PRERENDER)||this.getLayer().hasListener(Vr.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(i,e),n.projection,this.clipExtent_=null;let a=!1;if(l&&r.extent&&this.clipping){const f=df(r.extent);l=qr(f,e.extent),l&&!hf(f,e.extent)&&(e.declutter?this.clipExtent_=f:(this.clipUnrotated(i,e,f),a=!0))}return l&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),a&&i.restore(),this.postRender(i,e),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const r=this.frameState.size.slice(),n=this.renderedCenter_,i=this.renderedResolution_,o=this.renderedRotation_,l=this.renderedProjection_,a=this.wrappedRenderedExtent_,f=this.getLayer(),y=[],c=r[0]*Bn,g=r[1]*Bn;y.push(this.getRenderTransform(n,i,o,Bn,c,g,0).slice());const d=f.getSource(),m=l.getExtent();if(d.getWrapX()&&l.canWrapX()&&!hf(m,a)){let b=a[0];const F=Ns(m);let v=0,_;for(;b<m[0];)--v,_=F*v,y.push(this.getRenderTransform(n,i,o,Bn,c,g,_).slice()),b+=F;for(v=0,b=a[2];b>m[2];)++v,_=F*v,y.push(this.getRenderTransform(n,i,o,Bn,c,g,_).slice()),b-=F}this.hitDetectionImageData_=c7(r,y,this.renderedFeatures_,f.getStyleFunction(),a,i,o,M2(i,this.renderedPixelRatio_))}t(g7(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,r,n,i){var g,d;if(!this.replayGroup_)return;const o=t.viewState.resolution,l=t.viewState.rotation,a=this.getLayer(),f={},y=function(m,b,F){const v=ns(m),_=f[v];if(_){if(_!==!0&&F<_.distanceSq){if(F===0)return f[v]=!0,i.splice(i.lastIndexOf(_),1),n(m,a,b);_.geometry=b,_.distanceSq=F}}else{if(F===0)return f[v]=!0,n(m,a,b);i.push(f[v]={feature:m,layer:a,geometry:b,distanceSq:F,callback:n})}},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,l,r,y,c?(d=(g=t.declutter)==null?void 0:g[c])==null?void 0:d.all().map(m=>m.value):null)}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),r=t.getSource();if(!r)return!1;const n=e.viewHints[Ys.ANIMATING],i=e.viewHints[Ys.INTERACTING],o=t.getUpdateWhileAnimating(),l=t.getUpdateWhileInteracting();if(this.ready&&!o&&n||!l&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=e.extent,f=e.viewState,y=f.projection,c=f.resolution,g=e.pixelRatio,d=t.getRevision(),m=t.getRenderBuffer();let b=t.getRenderOrder();b===void 0&&(b=d7);const F=f.center.slice(),v=cp(a,m*c),_=v.slice(),$=[v.slice()],w=y.getExtent(),S=r.getWrapX()&&y.canWrapX();if(this.extendX_=!1,S){const W=r.getExtent();W&&!gf(W)&&(this.extendX_=W[0]<w[0]||W[2]>w[2])}if(S&&(!hf(w,e.extent)||this.extendX_)){const W=Ns(w),B=Math.max(Ns(v)/2,W);let q=w[0],ne=w[2];this.extendX_&&(q-=W,ne+=W),v[0]=q-B,v[2]=ne+B,X$(F,y);const ee=Y$($[0],y);ee[0]<w[0]&&ee[2]<w[2]?$.push([ee[0]+W,ee[1],ee[2]+W,ee[3]]):ee[0]>w[0]&&ee[2]>w[2]&&$.push([ee[0]-W,ee[1],ee[2]-W,ee[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===g&&this.renderedRevision_==d&&this.renderedRenderOrder_==b&&this.renderedFrameDeclutter_===!!e.declutter&&hf(this.wrappedRenderedExtent_,v))return Ai(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=F,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const L=new s7(P2(c,g),v,c,g);let O;for(let W=0,B=$.length;W<B;++W)r.loadFeatures($[W],c,y);const T=M2(c,g);let C=!0;const x=(W,B)=>{let q;const ne=W.getStyleFunction()||t.getStyleFunction();if(ne&&(q=ne(W,c)),q){const ee=this.renderFeature(W,T,q,L,O,this.getLayer().getDeclutter(),B);C=C&&!ee}},M=cw(v),G=r.getFeaturesInExtent(M);b&&G.sort(b);for(let W=0,B=G.length;W<B;++W)x(G[W],W);this.renderedFeatures_=G,this.ready=C;const K=L.finish(),Z=new y7(v,c,g,r.getOverlaps(),K,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=b,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=_,this.wrappedRenderedExtent_=v,this.renderedCenter_=F,this.renderedProjection_=y,this.renderedPixelRatio_=g,this.replayGroup_=Z,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,r,n,i,o,l){if(!r)return!1;let a=!1;if(Array.isArray(r))for(let f=0,y=r.length;f<y;++f)a=N2(n,e,r[f],t,this.boundHandleStyleImageChange_,i,o,l)||a;else a=N2(n,e,r,t,this.boundHandleStyleImageChange_,i,o,l);return a}}class R2 extends b2{constructor(e){super(e)}createRenderer(){return new T7(this)}}let L7=!1;function I7(s,e,t,r,n,i,o){const l=new XMLHttpRequest;l.open("GET",typeof s=="function"?s(t,r,n):s,!0),e.getType()=="arraybuffer"&&(l.responseType="arraybuffer"),l.withCredentials=L7,l.onload=function(a){if(!l.status||l.status>=200&&l.status<300){const f=e.getType();try{let y;f=="text"||f=="json"?y=l.responseText:f=="xml"?y=l.responseXML||l.responseText:f=="arraybuffer"&&(y=l.response),y?i(e.readFeatures(y,{extent:t,featureProjection:n}),e.readProjection(y)):o()}catch{o()}}else o()},l.onerror=o,l.send()}function z2(s,e){return function(t,r,n,i,o){I7(s,e,t,r,n,(l,a)=>{this.addFeatures(l),i!==void 0&&i(l)},()=>{this.changed(),o!==void 0&&o()})}}function O7(s,e){return[[-1/0,-1/0,1/0,1/0]]}class Xo extends kn{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const e=new Xo(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());const t=this.getGeometry();t&&e.setGeometry(t.clone());const r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Jt(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=mt(e,at.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?A7(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function A7(s){if(typeof s=="function")return s;let e;return Array.isArray(s)?e=s:(ts(typeof s.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[s]),function(){return e}}function G2(s,e,t,r){const n=[];let i=ki();for(let o=0,l=t.length;o<l;++o){const a=t[o];i=pp(s,e,a[0],r),n.push((i[0]+i[2])/2,(i[1]+i[3])/2),e=a[a.length-1]}return n}function Dc(s,e,t,r,n,i,o){let l,a;const f=(t-e)/r;if(f===1)l=e;else if(f===2)l=e,a=n;else if(f!==0){let y=s[e],c=s[e+1],g=0;const d=[0];for(let F=e+r;F<t;F+=r){const v=s[F],_=s[F+1];g+=Math.sqrt((v-y)*(v-y)+(_-c)*(_-c)),d.push(g),y=v,c=_}const m=n*g,b=b8(d,m);b<0?(a=(m-d[-b-2])/(d[-b-1]-d[-b-2]),l=e+(-b-2)*r):l=e+b*r}o=o>1?o:2,i=i||new Array(o);for(let y=0;y<o;++y)i[y]=l===void 0?NaN:a===void 0?s[l+y]:Cr(s[l+y],s[l+r+y],a);return i}function xm(s,e,t,r,n,i){if(t==e)return null;let o;if(n<s[e+r-1])return i?(o=s.slice(e,e+r),o[r-1]=n,o):null;if(s[t-1]<n)return i?(o=s.slice(t-r,t),o[r-1]=n,o):null;if(n==s[e+r-1])return s.slice(e,e+r);let l=e/r,a=t/r;for(;l<a;){const g=l+a>>1;n<s[(g+1)*r-1]?a=g:l=g+1}const f=s[l*r-1];if(n==f)return s.slice((l-1)*r,(l-1)*r+r);const y=s[(l+1)*r-1],c=(n-f)/(y-f);o=[];for(let g=0;g<r-1;++g)o.push(Cr(s[(l-1)*r+g],s[l*r+g],c));return o.push(n),o}function M7(s,e,t,r,n,i,o){if(o)return xm(s,e,t[t.length-1],r,n,i);let l;if(n<s[r-1])return i?(l=s.slice(0,r),l[r-1]=n,l):null;if(s[s.length-1]<n)return i?(l=s.slice(s.length-r),l[r-1]=n,l):null;for(let a=0,f=t.length;a<f;++a){const y=t[a];if(e!=y){if(n<s[e+r-1])return null;if(n<=s[y-1])return xm(s,e,y,r,n,!1);e=y}}return null}class Rc extends mw{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Jt),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const e=this.geometries_;for(let t=0,r=e.length;t<r;++t)this.changeEventsKeys_.push(mt(e[t],at.CHANGE,this.changed,this))}clone(){const e=new Rc(Cm(this.geometries_));return e.applyProperties(this),e}closestPointXY(e,t,r,n){if(n<Oo(this.getExtent(),e,t))return n;const i=this.geometries_;for(let o=0,l=i.length;o<l;++o)n=i[o].closestPointXY(e,t,r,n);return n}containsXY(e,t){const r=this.geometries_;for(let n=0,i=r.length;n<i;++n)if(r[n].containsXY(e,t))return!0;return!1}computeExtent(e){cf(e);const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)O8(e,t[r].getExtent());return e}getGeometries(){return Cm(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)t[r].getType()===this.getType()?e=e.concat(t[r].getGeometriesArrayRecursive()):e.push(t[r]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=[],r=this.geometries_;let n=!1;for(let i=0,o=r.length;i<o;++i){const l=r[i],a=l.getSimplifiedGeometry(e);t.push(a),a!==l&&(n=!0)}return n?new Rc(t):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)if(t[r].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){const r=this.geometries_;for(let n=0,i=r.length;n<i;++n)r[n].rotate(e,t);this.changed()}scale(e,t,r){r||(r=Ao(this.getExtent()));const n=this.geometries_;for(let i=0,o=n.length;i<o;++i)n[i].scale(e,t,r);this.changed()}setGeometries(e){this.setGeometriesArray(Cm(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)t[r].applyTransform(e);this.changed()}translate(e,t){const r=this.geometries_;for(let n=0,i=r.length;n<i;++n)r[n].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Cm(s){return s.map(e=>e.clone())}class qn extends ko{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Nn(this.flatCoordinates,e),this.changed()}clone(){const e=new qn(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,r,n){return n<Oo(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ip(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ap(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,r,n))}forEachSegment(e){return Sw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,xm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return zi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return Dc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return wm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){const t=[];return t.length=Fc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new qn(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return jc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=bc(this.flatCoordinates,0,e,this.stride),this.changed()}}class Kf extends ko{constructor(e,t,r){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&r)this.setFlatCoordinates(t,e),this.ends_=r;else{const n=e,i=[],o=[];for(let a=0,f=n.length;a<f;++a){const y=n[a];Nn(i,y.getFlatCoordinates()),o.push(i.length)}const l=n.length===0?this.getLayout():n[0].getLayout();this.setFlatCoordinates(l,i),this.ends_=o}}appendLineString(e){Nn(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new Kf(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,r,n){return n<Oo(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Op(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Mp(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,r,n))}getCoordinateAtM(e,t,r){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,r=r!==void 0?r:!1,M7(this.flatCoordinates,0,this.ends_,this.stride,e,t,r))}getCoordinates(){return mf(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new qn(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,r=this.layout,n=[];let i=0;for(let o=0,l=t.length;o<l;++o){const a=t[o],f=new qn(e.slice(i,a),r);n.push(f),i=a}return n}getLength(){const e=this.ends_;let t=0,r=0;for(let n=0,i=e.length;n<i;++n)r+=wm(this.flatCoordinates,t,e[n],this.stride),t=e[n];return r}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let r=0;const n=this.ends_,i=this.stride;for(let o=0,l=n.length;o<l;++o){const a=n[o],f=Dc(t,r,a,i,.5);Nn(e,f),r=a}return e}getSimplifiedGeometryInternal(e){const t=[],r=[];return t.length=$w(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,r),new Kf(t,"XY",r)}getType(){return"MultiLineString"}intersectsExtent(e){return qD(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const r=pf(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()}}class zc extends ko{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Nn(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){const e=new zc(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,r,n){if(n<Oo(this.getExtent(),e,t))return n;const i=this.flatCoordinates,o=this.stride;for(let l=0,a=i.length;l<a;l+=o){const f=Io(e,t,i[l],i[l+1]);if(f<n){n=f;for(let y=0;y<o;++y)r[y]=i[l+y];r.length=o}}return n}getCoordinates(){return zi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Dn(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,r=this.stride,n=[];for(let i=0,o=e.length;i<o;i+=r){const l=new Dn(e.slice(i,i+r),t);n.push(l)}return n}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,r=this.stride;for(let n=0,i=t.length;n<i;n+=r){const o=t[n],l=t[n+1];if(up(e,o,l))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=bc(this.flatCoordinates,0,e,this.stride),this.changed()}}class Yf extends ko{constructor(e,t,r){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!r&&!Array.isArray(e[0])){const n=e,i=[],o=[];for(let l=0,a=n.length;l<a;++l){const f=n[l],y=i.length,c=f.getEnds();for(let g=0,d=c.length;g<d;++g)c[g]+=y;Nn(i,f.getFlatCoordinates()),o.push(c)}t=n.length===0?this.getLayout():n[0].getLayout(),e=i,r=o}t!==void 0&&r?(this.setFlatCoordinates(t,e),this.endss_=r):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{const r=this.flatCoordinates.length;Nn(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let n=0,i=t.length;n<i;++n)t[n]+=r}this.endss_.push(t),this.changed()}clone(){const e=this.endss_.length,t=new Array(e);for(let n=0;n<e;++n)t[n]=this.endss_[n].slice();const r=new Yf(this.flatCoordinates.slice(),this.layout,t);return r.applyProperties(this),r}closestPointXY(e,t,r,n){return n<Oo(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ND(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),kD(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,r,n))}containsXY(e,t){return BD(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return PD(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Gp(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Pp(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=G2(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=ww(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new zc(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;xw(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Gp(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],r=[];return t.length=zD(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,r),new Yf(t,"XY",r)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{const i=this.endss_[e-1];t=i[i.length-1]}const r=this.endss_[e].slice(),n=r[r.length-1];if(t!==0)for(let i=0,o=r.length;i<o;++i)r[i]-=t;return new pn(this.flatCoordinates.slice(t,n),this.layout,r)}getPolygons(){const e=this.layout,t=this.flatCoordinates,r=this.endss_,n=[];let i=0;for(let o=0,l=r.length;o<l;++o){const a=r[o].slice(),f=a[a.length-1];if(i!==0)for(let c=0,g=a.length;c<g;++c)a[c]-=i;const y=new pn(t.slice(i,f),e,a);n.push(y),i=f}return n}getType(){return"MultiPolygon"}intersectsExtent(e){return WD(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const r=_w(this.flatCoordinates,0,e,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{const n=r[r.length-1];this.flatCoordinates.length=n.length===0?0:n[n.length-1]}this.changed()}}const B2=Wr();class Tr{constructor(e,t,r,n,i,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=r||null,this.properties_=i,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?B$(this.flatCoordinates_):pp(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=Ao(this.getExtent());this.flatInteriorPoints_=Dp(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=KD(this.flatCoordinates_,this.ends_),t=G2(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=ww(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Dc(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const r=this.ends_;for(let n=0,i=r.length;n<i;++n){const o=r[n],l=Dc(e,t,o,2,.5);Nn(this.flatMidpoints_,l),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=$s(e);const t=e.getExtent(),r=e.getWorldExtent();if(t&&r){const n=li(r)/li(t);Di(B2,r[0],r[3],n,-n,0,0,0),Ri(this.flatCoordinates_,0,this.flatCoordinates_.length,2,B2,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var e;return new Tr(this.type_,this.flatCoordinates_.slice(),(e=this.ends_)==null?void 0:e.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=L$((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);const r=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":r.length=Fc(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,r,0),n=[r.length];break;case"MultiLineString":n=[],r.length=$w(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,r,0,n);break;case"Polygon":n=[],r.length=Np(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),r,0,n);break}return n&&(this.simplifiedGeometry_=new Tr(this.type_,r,n,2,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}}Tr.prototype.getFlatCoordinates=Tr.prototype.getOrientedFlatCoordinates;class q2{constructor(e){this.rbush_=new Bw(e),this.items_={}}insert(e,t){const r={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(r),this.items_[ns(t)]=r}load(e,t){const r=new Array(t.length);for(let n=0,i=t.length;n<i;n++){const o=e[n],l=t[n],a={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:l};r[n]=a,this.items_[ns(l)]=a}this.rbush_.load(r)}remove(e){const t=ns(e),r=this.items_[t];return delete this.items_[t],this.rbush_.remove(r)!==null}update(e,t){const r=this.items_[ns(t)],n=[r.minX,r.minY,r.maxX,r.maxY];lc(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 r;for(let n=0,i=e.length;n<i;n++)if(r=t(e[n]),r)return r;return r}isEmpty(){return To(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return Cl(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]}}class P7 extends kn{constructor(e){super(),this.projection=$s(e.projection),this.attributions_=U2(e.attributions),this.attributionsCollapsible_=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(r,n){t.viewResolver=r,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_=U2(e),this.changed()}setState(e){this.state_=e,this.changed()}}function U2(s){return s?typeof s=="function"?s:(Array.isArray(s)||(s=[s]),e=>s):null}const Yr={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class Xi extends Mi{constructor(e,t,r){super(e),this.feature=t,this.features=r}}class W2 extends P7{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_=of,this.format_=e.format||null,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&&(ts(this.format_,"`format` must be set when `url` is set"),this.loader_=z2(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:O7;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new q2:null,this.loadedExtentsRtree_=new q2,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let r,n;Array.isArray(e.features)?n=e.features:e.features&&(r=e.features,n=r.getArray()),!t&&r===void 0&&(r=new Br(n)),n!==void 0&&this.addFeaturesInternal(n),r!==void 0&&this.bindFeaturesCollection_(r)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=ns(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const r=e.getGeometry();if(r){const n=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Xi(Yr.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof Tr||(this.featureChangeKeys_[e]=[mt(t,at.CHANGE,this.handleFeatureChange_,this),mt(t,El.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let r=!0;if(t.getId()!==void 0){const n=String(t.getId());if(!(n in this.idIndex_))this.idIndex_[n]=t;else if(t instanceof Tr){const i=this.idIndex_[n];i instanceof Tr?Array.isArray(i)?i.push(t):this.idIndex_[n]=[i,t]:r=!1}else r=!1}return r&&(ts(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),r}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],r=[],n=[];for(let i=0,o=e.length;i<o;i++){const l=e[i],a=ns(l);this.addToIndex_(a,l)&&r.push(l)}for(let i=0,o=r.length;i<o;i++){const l=r[i],a=ns(l);this.setupChangeEvents_(a,l);const f=l.getGeometry();if(f){const y=f.getExtent();t.push(y),n.push(l)}else this.nullGeometryFeatures_[a]=l}if(this.featuresRtree_&&this.featuresRtree_.load(t,n),this.hasListener(Yr.ADDFEATURE))for(let i=0,o=r.length;i<o;i++)this.dispatchEvent(new Xi(Yr.ADDFEATURE,r[i]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Yr.ADDFEATURE,function(r){t||(t=!0,e.push(r.feature),t=!1)}),this.addEventListener(Yr.REMOVEFEATURE,function(r){t||(t=!0,e.remove(r.feature),t=!1)}),e.addEventListener(dr.ADD,r=>{t||(t=!0,this.addFeature(r.element),t=!1)}),e.addEventListener(dr.REMOVE,r=>{t||(t=!0,this.removeFeature(r.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const r in this.featureChangeKeys_)this.featureChangeKeys_[r].forEach(Jt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(r=>{this.removeFeatureInternal(r)});for(const r in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[r])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new Xi(Yr.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 r=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(r,function(n){const i=n.getGeometry();if(i instanceof Tr||i.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(r){const n=r.getGeometry();if(n instanceof Tr||n.intersectsExtent(e)){const i=t(r);if(i)return i}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),To(this.nullGeometryFeatures_)||Nn(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(r){t.push(r)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const n=z8(e,t);return[].concat(...n.map(i=>this.featuresRtree_.getInExtent(i)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const r=e[0],n=e[1];let i=null;const o=[NaN,NaN];let l=1/0;const a=[-1/0,-1/0,1/0,1/0];return t=t||nf,this.featuresRtree_.forEachInExtent(a,function(f){if(t(f)){const y=f.getGeometry(),c=l;if(l=y instanceof Tr?0:y.closestPointXY(r,n,o,l),l<c){i=f;const g=Math.sqrt(l);a[0]=r-g,a[1]=n-g,a[2]=r+g,a[3]=n+g}}}),i}getExtent(e){var t;return((t=this.featuresRtree_)==null?void 0:t.getExtent(e))??null}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,r=ns(t),n=t.getGeometry();if(!n)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[r]=t);else{const o=n.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}const i=t.getId();if(i!==void 0){const o=i.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[r]=t;this.changed(),this.dispatchEvent(new Xi(Yr.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:ns(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&To(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,r){const n=this.loadedExtentsRtree_,i=this.strategy_(e,t,r);for(let o=0,l=i.length;o<l;++o){const a=i[o];n.forEachInExtent(a,function(y){return hf(y.extent,a)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Xi(Yr.FEATURESLOADSTART)),this.loader_.call(this,a,t,r,y=>{--this.loadingExtentsCount_,this.dispatchEvent(new Xi(Yr.FEATURESLOADEND,void 0,y))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Xi(Yr.FEATURESLOADERROR))}),n.insert(a,{extent:a.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_,r=t.forEachInExtent(e,function(n){if(lc(n.extent,e))return n});r&&t.remove(r)}removeFeatures(e){let t=!1;for(let r=0,n=e.length;r<n;++r)t=this.removeFeatureInternal(e[r])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=ns(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e);const r=this.featureChangeKeys_[t];r==null||r.forEach(Jt),delete this.featureChangeKeys_[t];const n=e.getId();if(n!==void 0){const i=n.toString(),o=this.idIndex_[i];o===e?delete this.idIndex_[i]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[i]=o[0]))}return delete this.uidIndex_[t],this.hasListener(Yr.REMOVEFEATURE)&&this.dispatchEvent(new Xi(Yr.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(const t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){ts(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(z2(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}}function V2(s){return!/^(-?\d|--)/.test(s)}function K2(s){const e=[];let t="",r="",n=7;for(let i,o=0;i=s.charAt(o);o++)if(/[a-zA-Z\d\xa0-\uffff_-]/.test(i)&&n===7)t+=i;else if(i==="\\"&&n===7)n=6;else if(i===" "&&n===7){if(t!==""){if(!V2(t))return null;e.push(t),t=""}}else if(n===6)/[0-9a-f]/i.test(i)?(r+=i,n=8):(t+=i,n=7);else{if(n!==8)return null;/[0-9a-f]/i.test(i)&&r.length<6?r+=i:(t+=String.fromCodePoint(parseInt(r,16)),t+=i,r="",n=7)}if(t!==""){if(!V2(t))return null;e.push(t)}return e.join(" ")}function N7(s,e){let t=e,r="";const n={"font-family":[]};for(let i,o=0;i=s.charAt(o);o+=1)if(t!==4||i!=='"'&&i!=="'")if(t===3&&i===",")t=4,r="";else if(t===4&&i===","){const l=K2(r);l&&n["font-family"].push(l),r=""}else if(t===5&&i===" ")/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:deg|grad|rad|turn)$/.test(r)?(n["font-style"]+=" "+r,r=""):o-=1,t=1;else if(t!==1||i!==" "&&i!=="/")t===2&&i===" "?(/^(?:\+|-)?([0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)?$/.test(r)&&(n["line-height"]=r),t=4,r=""):r+=i;else{if(/^(?:(?:xx|x)-large|(?:xx|s)-small|small|large|medium)$/.test(r)||/^(?:larg|small)er$/.test(r)||/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)$/.test(r))t=i==="/"?2:4,n["font-size"]=r;else if(/^italic$/.test(r))n["font-style"]=r;else if(/^oblique$/.test(r))n["font-style"]=r,t=5;else if(/^small-caps$/.test(r))n["font-variant"]=r;else if(/^(?:bold(?:er)?|lighter|normal)$/.test(r))n["font-weight"]=r;else if(/^[+-]?(?:[0-9]*\.)?[0-9]+(?:e[+-]?(?:0|[1-9][0-9]*))?$/.test(r)){const l=parseFloat(r);l>=1&&l<=1e3&&(n["font-weight"]=r)}else/^(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)$/.test(r)&&(n["font-stretch"]=r);r=""}else{let l=o+1;do if(l=s.indexOf(i,l)+1,!l)return null;while(s.charAt(l-2)==="\\");n["font-family"].push(s.slice(o+1,l-1).replace(/\\('|")/g,"$1")),o=l-1,t=3,r=""}if(t===3&&!/^\s*$/.test(r))return null;if(t===4){const i=K2(r);i&&n["font-family"].push(i)}return n}function k7(s){const e=N7(s,1);return e!==null&&e["font-size"]&&e["font-family"].length?e:null}const Y2={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Tm=/^ttf:\/\/(.+)#(.+)$/,X2="geostyler-mark-symbolizer",Xr=Math.PI/180;let De=class Ws{static getRgbaColor(e,t){if(Ti(e)&&(e=Ws.evaluateStringFunction(e)),typeof e!="string")return;if(e.startsWith("rgba("))return e;if(!/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e))return;const r=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return bo(t)&&(t=Ws.evaluateNumberFunction(t)),t<0&&(t=1),"rgba("+r+", "+n+", "+i+", "+t+")"}static splitRgbaColor(e){const t=e.substring(e.indexOf("(")+1,e.lastIndexOf(")")).split(/,\s*/),r=parseInt(t[0],10),n=parseInt(t[1],10),i=parseInt(t[2],10),o=parseFloat(t[3]);return[r,n,i,o]}static getHexColor(e){if(e.startsWith("#"))return e;if(e.startsWith("rgb")){const t=Ws.splitRgbaColor(e);return Ws.getHexCodeFromRgbArray(t)}else if(Y2[e.toLocaleLowerCase()]!==void 0){const t=Y2[e.toLocaleLowerCase()];return Ws.getHexCodeFromRgbArray(t)}else return}static getHexCodeFromRgbArray(e){return"#"+e.map((t,r)=>{const n=t.toString(16);return r<3?n.length===1?"0"+n:n:""}).join("")}static getHexAlphaFromHexAndOpacity(e,t){if(!e.startsWith("#"))return;t=Math.max(0,Math.min(1,t));const r=Math.round(t*255).toString(16).padStart(2,"0");return`${e}${r}`}static getOpacity(e){const t=e.startsWith("rgba("),r=e.startsWith("#")&&e.length>7;if(!t&&!r)return;let n;if(t?n=Ws.splitRgbaColor(e):n=[void 0,void 0,void 0,parseInt(e.slice(7,9),16)/255],n.length===4)return n[3]}static checkOpacity(e){return typeof e=="number"&&e>=0&&e<1}static getTextFont(e){const t=e.fontWeight??"normal",r=e.fontStyle??"normal",n=e.size,i=e.font;return t+" "+r+" "+n+"px "+(i==null?void 0:i.join(", "))}static getIsFontGlyphBased(e){return Tm.test(e.wellKnownName)}static getIsMarkSymbolizerFont(e){if(!e)return!1;const t=X2;return e.substring(e.length-t.length,e.length)===t}static getTextFontForMarkSymbolizer(e){const t=e.wellKnownName.match(Tm);if(!t)throw new Error(`Could not parse font-based well known name: ${e.wellKnownName}`);const r=t[1];return`Normal ${e.radius||5}px '${r}', ${X2}`}static getCharacterForMarkSymbolizer(e){const t=e.wellKnownName.match(Tm);if(!t)throw new Error(`Could not parse font-based well known name: ${e.wellKnownName}`);return String.fromCharCode(parseInt(t[2],16))}static getFontNameFromOlFont(e){const t=e.match(/(?:\d+\S+) '?"?([^,'"]+)/);if(!t)throw new Error(`Could not find font family name in the following string: ${e}`);return t[1]}static getSizeFromOlFont(e){const t=e.match(/(?:(\d+)px)/);return t?parseInt(t[1],10):0}static resolveAttributeTemplate(e,t,r="n.v.",n=(i,o)=>o){const i="\\{\\{",o="\\}\\}",l=new RegExp(i+"(.*?)"+o,"g"),a=t.match(l);return a&&a.forEach(f=>{let y=0;for(const[c,g]of Object.entries(e.getProperties()))if(f.slice(2,f.length-2).toLowerCase()===c.toLowerCase()){t=t.replace(f,n(c,g));break}else y++;y===Object.keys(e.getProperties()).length&&(t=t.replace(f,r))}),t}static evaluateFunction(e,t){if(e.name==="property"){if(!t)throw new Error(`Could not evalute 'property' function. Feature ${t} is not defined.`);return Ti(e.args[0])?t==null?void 0:t.get(Ws.evaluateStringFunction(e.args[0],t)):t==null?void 0:t.get(e.args[0])}if(hd(e))return Ws.evaluateUnknownFunction(e,t);if(Ti(e))return Ws.evaluateStringFunction(e,t);if(bo(e))return Ws.evaluateNumberFunction(e,t);if(Tn(e))return Ws.evaluateBooleanFunction(e,t)}static evaluateBooleanFunction(e,t){const r=e.args.map(n=>Ie(n)?Ws.evaluateFunction(n,t):n);switch(e.name){case"all":return r.map(n=>this.evaluateBooleanFunction(n,t)).every(n=>n===!0);case"any":return r.map(n=>this.evaluateBooleanFunction(n,t)).some(n=>n===!0);case"between":return r[0]>=r[1]&&r[0]<=r[2];case"double2bool":return!1;case"equalTo":return r[0]===r[1];case"greaterThan":return r[0]>r[1];case"greaterThanOrEqualTo":return r[0]>=r[1];case"in":return r.slice(1).includes(r[0]);case"lessThan":return r[0]<r[1];case"lessThanOrEqualTo":return r[0]<=r[1];case"not":return!r[0];case"notEqualTo":return r[0]!==r[1];case"parseBoolean":return!!r[0];case"strEndsWith":return r[0].endsWith(r[1]);case"strEqualsIgnoreCase":return r[0].toLowerCase()===r[1].toLowerCase();case"strMatches":{const n=r[1].match(/\/(.*?)\/([gimy]{0,4})$/);return n&&n.length===3?new RegExp(n[1],n[2]).test(r[0]):!1}case"strStartsWith":return r[0].startsWith(r[1]);default:return!1}}static evaluateNumberFunction(e,t){if(e.name==="pi")return Math.PI;if(e.name==="random")return Math.random();const r=e.args.map(n=>Ie(n)?Ws.evaluateFunction(n,t):n);switch(e.name){case"abs":return Math.abs(r[0]);case"acos":return Math.acos(r[0]);case"add":return r[0]+r[1];case"asin":return Math.asin(r[0]);case"atan":return Math.atan(r[0]);case"atan2":return r[0];case"ceil":return Math.ceil(r[0]);case"cos":return Math.cos(r[0]);case"div":return r[0]/r[1];case"exp":return Math.exp(r[0]);case"floor":return Math.floor(r[0]);case"log":return Math.log(r[0]);case"max":return Math.max(...r);case"min":return Math.min(...r);case"modulo":return r[0]%r[1];case"mul":return r[0]*r[1];case"pow":return Math.pow(r[0],r[1]);case"rint":return r[0];case"round":return Math.round(r[0]);case"sin":return Math.sin(r[0]);case"sqrt":return Math.sqrt(r[0]);case"strIndexOf":return r[0].indexOf(r[1]);case"strLastIndexOf":return r[0].lastIndexOf(r[1]);case"strLength":return r[0].length;case"sub":return r[0]-r[1];case"tan":return Math.tan(r[0]);case"toDegrees":return r[0]/Xr;case"toRadians":return r[0]*Xr;default:return r[0]}}static evaluateUnknownFunction(e,t){const r=e.args.map(n=>Ie(n)?Ws.evaluateFunction(n,t):n);switch(e.name){case"property":return t==null?void 0:t.get(r[0]);case"case":{const n=r;let i;for(let o=0;o<n.length;o++){const l=n[o];if(o===n.length-1){i=l;break}else if(l.case===!0){i=l.value;break}else if(Ws.evaluateBooleanFunction(l.case,t)){i=l.value;break}}return i}default:return r[0]}}static evaluateStringFunction(e,t){var n;const r=e.args.map(i=>Ie(i)?Ws.evaluateFunction(i,t):i);switch(e.name){case"numberFormat":return r[0];case"strAbbreviate":return r[0];case"strCapitalize":{const i=r[0].toLowerCase().split(" ");for(let o of i)o=o.charAt(0).toUpperCase()+o.substring(1);return i.join(" ")}case"strConcat":return r.join();case"strDefaultIfBlank":return((n=r[0])==null?void 0:n.length)<1?r[1]:r[0];case"strReplace":return r[3]===!0?r[0].replaceAll(r[1],r[2]):r[0].replace(r[1],r[2]);case"strStripAccents":return r[0].normalize("NFKD").replace(/[\u0300-\u036f]/g,"");case"strSubstring":return r[0].substring(r[1],r[2]);case"strSubstringStart":return r[0].substring(r[1]);case"strToLowerCase":return r[0].toLowerCase();case"strToUpperCase":return r[0].toUpperCase();case"strTrim":return r[0].trim();default:return r[0]}}static containsGeoStylerFunctions(e){return e.rules.some(t=>{var o,l,a,f;const r=Array.isArray(t.filter)&&((o=t.filter)==null?void 0:o.some(Ie)),n=(l=t.symbolizers)==null?void 0:l.some(y=>Object.values(y).some(Ie)),i=Ie((a=t==null?void 0:t.scaleDenominator)==null?void 0:a.max)||Ie((f=t==null?void 0:t.scaleDenominator)==null?void 0:f.min);return r||n||i})}};const H2=["horline","vertline","line"],Xf=["horline","vertline","line","cross","cross2","slash","backslash","oarrow","x","half_arc","third_arc","quarter_arc","arrowhead"],Z2="data:image/svg+xml;utf8,",D7=s=>Z2+encodeURIComponent(s),R7=s=>decodeURIComponent(s).replace(Z2,""),Q2=s=>{const e=s.split(";").filter(r=>r.trim()!==""),t={};for(const r of e){const[n,i]=r.split(":").map(o=>o.trim());n&&i&&(t[n]=i)}return t},z7=s=>{const e=new DOMParser().parseFromString(s,"image/svg+xml").querySelector("svg");if(!e)return;const t=e.getAttribute("width"),r=e.getAttribute("viewBox");if(!r)return;const n=Array.from(e.children).find(y=>y instanceof Element),i=n==null?void 0:n.getAttribute("id"),o=(n==null?void 0:n.getAttribute("style"))??"",l=Q2(o),{radius:a,strokeWidth:f}=U7(Number(t),Number(l["stroke-width"]),r);return{kind:"Mark",wellKnownName:i,radius:a,...l.fill&&{color:l.fill},...l["fill-opacity"]&&{fillOpacity:Number(l["fill-opacity"])},...l.stroke&&{strokeColor:l.stroke},...l["stroke-width"]&&{strokeWidth:f},...l["stroke-opacity"]&&{strokeOpacity:Number(l["stroke-opacity"])}}},G7=(s,e,t,r)=>{var y;const n=new DOMParser().parseFromString(s,"image/svg+xml").querySelector("svg");if(!n)return;const i=(n.getAttribute("viewBox")||"0 0 0 0").split(" ").map(parseFloat)[2],o=i===8,l=parseFloat(n.getAttribute("width")||"0")/i,a=1/l;e.save(),o||(e.translate(t/2,t/2),e.rotate(r*Xr),e.scale(l,l));const f=n.children;for(const c of f){const g=c.getAttribute("style")||"",d=Q2(g),m=d.fill||"",b=Number(d["fill-opacity"]??1),F=De.getHexAlphaFromHexAndOpacity(m,b),v=d.stroke||"",_=d["stroke-width"],$=Number(d["stroke-opacity"]??1),w=De.getHexAlphaFromHexAndOpacity(v,$);switch(F?e.fillStyle=F:e.fillStyle="none",w?(e.strokeStyle=w,e.lineWidth=Number(_)*a):(e.strokeStyle="none",e.lineWidth=0),c.tagName){case"rect":{const S=parseFloat(c.getAttribute("x")||"0"),L=parseFloat(c.getAttribute("y")||"0"),O=parseFloat(String(c.getAttribute("width"))),T=parseFloat(String(c.getAttribute("height")));F&&e.fillRect(S,L,O,T),w&&e.strokeRect(S,L,O,T);break}case"circle":{const S=parseFloat(c.getAttribute("cx")||"0"),L=parseFloat(c.getAttribute("cy")||"0"),O=parseFloat(c.getAttribute("r")||"0");e.beginPath(),e.arc(S,L,O,0,2*Math.PI),F&&e.fill(),w&&e.stroke();break}case"polygon":{const S=(y=c.getAttribute("points"))==null?void 0:y.split(" ");if(!S)break;e.beginPath();for(let L=0;L<S.length;L++){const O=S[L].split(",");L===0?e.moveTo(parseFloat(O[0]),parseFloat(O[1])):e.lineTo(parseFloat(O[0]),parseFloat(O[1]))}e.closePath(),F&&e.fill(),w&&e.stroke();break}case"path":{const S=c.getAttribute("d");if(!S)break;const L=S.match(/[MALZ][^MALZ]*/g);if(!L)break;e.beginPath();let O=0,T=0;for(const C of L){const x=C[0],M=C.split(/[, ]+/).slice(1).map(parseFloat);switch(x){case"M":{for(let G=0;G<M.length-1;G+=2)G<2?e.moveTo(M[G],M[G+1]):e.lineTo(M[G],M[G+1]),O=M[G],T=M[G+1];break}case"L":{for(let G=0;G<M.length-1;G+=2)e.lineTo(M[G],M[G+1]),O=M[G],T=M[G+1];break}case"A":{B7(e,O,T,M[0],M[1],M[2],M[3],M[4],M[5],M[6]),O=M[5],T=M[6];break}case"Z":{e.closePath();break}}}F&&e.fill(),w&&e.stroke();break}}}e.restore()},B7=(s,e,t,r,n,i,o,l,a,f)=>{const y=K=>K*Math.PI/180,c=(e-a)/2,g=(t-f)/2,d=Math.cos(y(i)),m=Math.sin(y(i)),b=d*c+m*g,F=-m*c+d*g;let v=r*r,_=n*n;const $=b*b,w=F*F,S=$/v+w/_;S>1&&(r*=Math.sqrt(S),n*=Math.sqrt(S),v=r*r,_=n*n);const L=(o!==l?1:-1)*Math.sqrt(Math.max(0,(v*_-v*w-_*$)/(v*w+_*$))),O=L*(r*F/n),T=L*(-(n*b)/r),C=d*O-m*T+(e+a)/2,x=m*O+d*T+(t+f)/2,M=Math.atan2((F-T)/n,(b-O)/r);let G=Math.atan2((-F-T)/n,(-b-O)/r);!l&&G>M?G-=2*Math.PI:l&&G<M&&(G+=2*Math.PI),s.arc(C,x,r,M,G,!l)},q7=(s,e,t)=>{const r=s*2,n=t/r,i=r/t,o=e*n,l=e*n,a=o+l,f=a*i,y=t+a,c=-(y/2),g=r+f;return{minV:c,sizeV:y,heightPx:g}},U7=(s,e,t)=>{const r=!Number.isNaN(e),n=t.split(" ").map(parseFloat)[2],i=s/n,o=n/s,l=r?e:o,a=(n-2*l)/2*i,f=r?l*i:void 0;return{radius:a,strokeWidth:f}},W7={arrow:20,arrowhead:20,asterisk_fill:20,backslash:24,carrow:20,circle:20,cross:24,cross_fill:20,cross2:24,decagon:20,diagonal_half_square:20,diamond:20,equilateral_triangle:20,filled_arrowhead:20,half_arc:20,half_square:20,heart:20,hexagon:20,horline:24,left_half_triangle:20,line:24,oarrow:20,octagon:20,parallelogram_left:20,parallelogram_right:20,pentagon:20,quarter_arc:20,quarter_circle:20,quarter_square:20,right_half_triangle:20,rounded_square:20,semi_circle:20,shield:20,slash:24,square:20,square_with_corners:20,star:20,star_diamond:20,third_arc:20,third_circle:20,trapezoid:20,triangle:20},J2={arrow:'d="M 0,-10 L 5,-5 L 2.5,-5 L 2.5,10 L -2.5,10 L -2.5,-5 L -5,-5 L 0,-10 Z"',arrowhead:'d="M -10 -10 L 0 0 L -10 10"',asterisk_fill:'d="M -1.5,-10 L 1.5,-10L 1.5,-3.939 L 6.011,-8.132 L 8.132,-6.011 L 3.939,-1.5 L 10,-1.5 L 10,1.5 L 3.939,1.5 L 8.132,6.011 L 6.011,8.132 L 1.5,3.939 L 1.5,10 L -1.5,10 L -1.5,3.939 L -6.011,8.132 L -8.132,6.011 L -3.939,1.5 L -10,1.5 L -10,-1.5 L -3.939,-1.5 L -8.132,-6.011 L -6.011,-8.132 L -1.5,-3.939 L -1.5,-10 Z"',backslash:'d="M -12 -12 L 12 12"',carrow:'d="M -10 10 L 0 -10 L 10 10 Z"',circle:'cx="0" cy="0" r="10"',cross:'d="M -12 0 L 12 0 M 0 -12 L 0 12"',cross_fill:'d="M -10,-2 L -10,-2 L -10,2 L -2,2 L -2,10 L 2,10 L 2,2 L 10,2 L 10,-2 L 2,-2 L 2,-10 L -2,-10 L -2,-2 L -10,-2 Z"',cross2:'d="M -12 -12 L 12 12 M 12 -12 L -12 12"',decagon:'points="5.878,8.09 9.511,3.09 9.511,-3.09 5.878,-8.09 0,-10 -5.878,-8.09 -9.511,-3.09 -9.511,3.09 -5.878,8.09 0,10 5.878,8.09"',diagonal_half_square:'points="-10,-10 10,10 -10,10 -10,-10"',diamond:'points="-10,0 0,10 10,0 0,-10 -10,0"',equilateral_triangle:'points="-8.66,5 8.66,5 0,-10 -8.66,5"',filled_arrowhead:'d="M 0,0 L -10,10 L -10,-10 L 0,0 Z"',half_arc:'d="M -10 0 A 10 10 0 0 1 10 0"',half_square:'points="-10,-10 0,-10 0,10 -10,10 -10,-10"',heart:'d="M -9.5 -2 A 1 1 0 0 1 0 -7.5 A 1 1 0 0 1 9.5 -2 L 0 10 Z"',hexagon:'points="-8.66,-5 -8.66,5 0,10 8.66,5 8.66,-5 0,-10 -8.66,-5"',horline:'d="M -12 0 L 12 0"',left_half_triangle:'points="0,10 10,10 0,-10 0,10"',line:'d="M 0 -12 L 0 12"',oarrow:'d="M -10 10 L 0 -10 L 10 10"',octagon:'points="-4.142,10 4.142,10 10,4.142 10,-4.142 4.142,-10 -4.142,-10 -10,-4.142 -10,4.142 -4.142,10"',parallelogram_left:'points="10,5 5,-5 -10,-5 -5,5 10,5"',parallelogram_right:'points="5,5 10,-5 -5,-5 -10,5 5,5"',pentagon:'points="-9.511,-3.09 -5.878,8.09 5.878,8.09 9.511,-3.09 0,-10 -9.511,-3.09"',quarter_arc:'d="M 0 -10 A 10 10 0 0 0 -10 0"',quarter_circle:'d="M 0 -10 A 10 10 0 0 0 -10 0 L 0 0 Z"',quarter_square:'points="-10,-10 0,-10 0,0 -10,0 -10,-10"',right_half_triangle:'points="-10,10 0,10 0,-10 -10,10"',rounded_square:'x="-10" y="-10" width="20" height="20" rx="2.5" ry="2.5"',semi_circle:'d="M -10 0 A 10 10 0 0 1 10 0 L 0 0 Z"',shield:'points="10,5 10,-10 -10,-10 -10,5 0,10 10,5"',slash:'d="M 12 -12 L -12 12"',square:'points="-10,-10 10,-10 10,10 -10,10"',square_with_corners:'points="-6.072,10 6.072,10 10,6.072 10,-6.072 6.072,-10 -6.072,-10 -10,-6.072 -10,6.072 -6.072,10"',star:'d="M -2.24514,-3.09017 -9.51057,-3.09017 -3.63271,1.18034 -5.87785,8.09017 0,3.81966 5.87785,8.09017 3.63271,1.18034 9.51057,-3.09017 2.24514,-3.09017 0,-10 -2.24514,-3.09017 Z"',star_diamond:'d="M -2.70091,-2.70091 -10,0 -2.70091,2.70091 0,10 2.70091,2.70091 10,0 2.70091,-2.70091 0,-10 Z"',third_arc:'d="M 0 -10 A 10 10 0 0 0 -5 8.66"',third_circle:'d="M 0 -10 A 10 10 0 0 0 -5 8.66 L 0 0 Z"',trapezoid:'points="5,-5 10,5 -10,5 -5,-5 5,-5"',triangle:'points="-10,10 10,10 0,-10 -10,10"'},Lm=s=>{let e=s.replace("shape://","");switch(e=e.replace("brush://",""),e){case"dot":return"circle";case"plus":return"cross";case"times":case"x":return"cross2";case"vertline":return"line";default:return e}},eS=s=>Lm(s)in J2,tS=s=>{const{wellKnownName:e,radius:t=6,color:r,fillOpacity:n,strokeColor:i,strokeWidth:o,strokeOpacity:l}=s;if(!eS(e))throw new Error("Unknown wellKnownName: "+e);const a=Lm(e),f=o??1,y=W7[a],{minV:c,sizeV:g,heightPx:d}=q7(t,f,y),m='<svg xmlns="http://www.w3.org/2000/svg" width="'+d+'" height="'+d+`" viewBox="${c} ${c} ${g} ${g}">`,b="</svg>";let F=J2[a]+" ";F.startsWith("points=")?F='<polygon id="'+a+'" '+F:F.startsWith("x=")?F='<rect id="'+a+'" '+F:F.startsWith("cx=")?F='<circle id="'+a+'" '+F:F='<path id="'+a+'" '+F;let v="";if(r&&!Xf.includes(a)?v+="fill:"+r+"; ":Xf.includes(a)&&(v+="fill:none; "),De.checkOpacity(n)&&!Xf.includes(a)&&(v+="fill-opacity:"+n+"; "),i&&(v+="stroke:"+i+"; "),o){const _=d/g;v+="stroke-width:"+Number(o)/_+"; "}return De.checkOpacity(l)&&(v+="stroke-opacity:"+l+"; "),H2.includes(a)&&(v=v+"stroke-linejoin: butt"),F+='style="'+v.trim()+'" />',m+F+b};function V7(s,e){const t=s.canvas;e=e||{};const r=e.pixelRatio||P$,n=e.size;n&&(t.width=n[0]*r,t.height=n[1]*r,t.style.width=n[0]+"px",t.style.height=n[1]+"px");const i=[0,0,t.width,t.height],o=ED(Wr(),r,r);return new O2(s,r,i,o,0)}const K7={horline:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',line:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',cross:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',slash:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',backslash:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',x:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense1:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense2:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="1" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense3:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="1" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense4:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense5:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="3" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="3" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="7" y="7" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense6:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="0" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="0" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="2" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="0" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="4" y="4" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="2" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="6" y="6" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>',dense7:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><rect x="1" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="1" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="1" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /><rect x="5" y="5" width="1" height="1" style="fill:black; fill-opacity:1" /></svg>'},Y7=s=>{const{wellKnownName:e,color:t,fillOpacity:r,strokeColor:n,strokeOpacity:i,strokeWidth:o}=s,l=e.replace("brush://",""),a=!o&&Xf.includes(String(l)),f=l.startsWith("dense");let y;return f||a?(y=K7[l],f?(y=y.replace(/fill:black/g,`fill:${t}`),y=y.replace(/fill-opacity:1/g,`fill-opacity:${r??1}`)):(y=y.replace(/fill:black/g,`fill:${n}`),y=y.replace(/fill-opacity:1/g,`fill-opacity:${i??1}`))):y=tS(s),y};class Lr{static containsGraphicStroke(e){return e.rules.some(t=>{var r;return(r=t.symbolizers)==null?void 0:r.some(n=>n.kind==="Line"&&n.graphicStroke)})}static getSegmentRotation(e,t){const r=t[0]-e[0],n=t[1]-e[1],i=Math.atan2(n,r),o=180/Math.PI;return-i*o}static getSegmentRotations(e){const t=[];return e.forEachSegment((r,n)=>{const i=Lr.getSegmentRotation(r,n);t.push(i)}),t}static getPatternSize(e,t){const r=e.reduce((n,i)=>n+i,0);return t*r}static getSegmentFractions(e){const t=[],r=e.getLength();let n=0;return e.forEachSegment((i,o)=>{const l=new qn([i,o]).getLength()/r;n+=l,t.push(n)}),t}static getDashAsFractions(e,t,r){const n=i=>i*t/r;return e.map(i=>n(i))}static getTickFractions(e,t,r,n,i){if(t<=0)return[];const o=e.getLength(),l=t*r/o,a=(i?i*r:0)/o;return n&&n.length>0?Lr.getTickFractionsWithDash(n,r,o,l,a):Lr.getTickFractionsWithoutDash(l)}static tryAddTick(e,t,r,n){return n>1?!1:(r>=0&&e.push(t),!0)}static getTickFractionsWithoutDash(e){const t=[],r=e/2;let n=r;for(;;){const i=n+e,o=n-r,l=n+r,a=Lr.tryAddTick(t,n,o,l);if(n=i,!a)break}return t}static getTickFractionsWithDash(e,t,r,n,i){const o=e.length%2===0?e:[...e,...e],l=Lr.getDashAsFractions(o,t,r),a=n/2,f=[];let y=i+a,c=0;for(;y<=1;){const g=c%2===1,d=l[c];if(g)y+=d;else{const m=d/n,b=Math.floor(m);for(let v=0;v<b;v++){const _=y-a,$=y+a,w=y+n,S=Lr.tryAddTick(f,y,_,$);if(y=w,!S)return f}const F=m%1*n;y+=F}c=(c+1)%l.length}return f}static processLineStringGraphicStroke(e,t,r,n,i,o,l,a,f){const y=Lr.getTickFractions(e,t,r,n,i),c=Lr.getSegmentFractions(e),g=Lr.getSegmentRotations(e).map(d=>{const m=d+o,b=structuredClone(l);return b.rotate=m,a(b)});return y.map(d=>{const m=e.getCoordinateAt(d),b=new f(m),F=c.findIndex(_=>d<=_),v=g[F].clone();return v.setGeometry(b),v})}static getLineStringsFromGeometry(e,t){if(!e)throw new Error("GraphicStroke can only be applied to features with geometries");if(e instanceof t.LineString)return[e];if(e instanceof t.MultiLineString)return e.getLineStrings();if(e instanceof t.Polygon)return e.getLinearRings().map(r=>new t.LineString(r.getCoordinates()));if(e instanceof t.MultiPolygon)return e.getPolygons().flatMap(r=>r.getLinearRings().map(n=>new t.LineString(n.getCoordinates())));throw new Error("GraphicStroke can only be applied to (Multi-)LineString or (Multi-)Polygon geometries")}}class Im{constructor(e){Le(this,"unsupportedProperties",{Symbolizer:{MarkSymbolizer:{avoidEdges:"none",blur:"none",offsetAnchor:"none",pitchAlignment:"none",pitchScale:"none"},FillSymbolizer:{antialias:"none",opacity:{support:"none",info:"Use fillOpacity instead."}},IconSymbolizer:{allowOverlap:"none",anchor:"none",avoidEdges:"none",color:"none",haloBlur:"none",haloColor:"none",haloWidth:"none",keepUpright:"none",offsetAnchor:"none",size:{support:"partial",info:"Will set/get the width of the ol Icon."},optional:"none",padding:"none",pitchAlignment:"none",rotationAlignment:"none",textFit:"none",textFitPadding:"none"},LineSymbolizer:{blur:"none",gapWidth:"none",gradient:"none",miterLimit:"none",roundLimit:"none",spacing:"none",graphicFill:"none",perpendicularOffset:"none"},RasterSymbolizer:"none",TextSymbolizer:{anchor:"none",placement:{support:"partial",info:"point and line supported. line-center will be mapped to line."}}},Function:{double2bool:{support:"none",info:"Always returns false"},atan2:{support:"none",info:"Currently returns the first argument"},rint:{support:"none",info:"Currently returns the first argument"},numberFormat:{support:"none",info:"Currently returns the first argument"},strAbbreviate:{support:"none",info:"Currently returns the first argument"}}});Le(this,"title","OpenLayers Style Parser");Le(this,"olIconStyleCache",{});Le(this,"OlStyleConstructor",Vo);Le(this,"OlStyleImageConstructor",Df);Le(this,"OlStyleFillConstructor",Wi);Le(this,"OlStyleStrokeConstructor",Bf);Le(this,"OlStyleTextConstructor",a2);Le(this,"OlStyleCircleConstructor",zf);Le(this,"OlStyleIconConstructor",Gf);Le(this,"OlStyleRegularshapeConstructor",Rf);Le(this,"OlLineStringContructor",qn);Le(this,"OlMultiLineStringConstructor",Kf);Le(this,"OlPolygonConstructor",pn);Le(this,"OlMultiPolygonConstructor",Yf);Le(this,"OlPointConstructor",Dn);Le(this,"isOlParserStyleFct",e=>typeof e=="function");e&&(this.OlStyleConstructor=e.style.Style,this.OlStyleImageConstructor=e.style.Image,this.OlStyleFillConstructor=e.style.Fill,this.OlStyleStrokeConstructor=e.style.Stroke,this.OlStyleTextConstructor=e.style.Text,this.OlStyleCircleConstructor=e.style.Circle,this.OlStyleIconConstructor=e.style.Icon,this.OlStyleRegularshapeConstructor=e.style.RegularShape,this.OlLineStringContructor=e.geom.LineString,this.OlMultiLineStringConstructor=e.geom.MultiLineString,this.OlPolygonConstructor=e.geom.Polygon,this.OlMultiPolygonConstructor=e.geom.MultiPolygon,this.OlPointConstructor=e.geom.Point)}getPointSymbolizerFromOlStyle(e){let t;if(e.getImage()instanceof this.OlStyleCircleConstructor){const r=e.getImage(),n=r.getFill(),i=r.getStroke(),o=r.getDisplacement();t={kind:"Mark",wellKnownName:"circle",color:n?De.getHexColor(n.getColor()):void 0,opacity:r.getOpacity()!==1?r.getOpacity():void 0,fillOpacity:n?De.getOpacity(n.getColor()):void 0,radius:r.getRadius()!==0?r.getRadius():5,strokeColor:i?i.getColor():void 0,strokeOpacity:i?De.getOpacity(i.getColor()):void 0,strokeWidth:i?i.getWidth():void 0,offset:o[0]||o[1]?o:void 0}}else if(e.getImage()instanceof this.OlStyleRegularshapeConstructor){const r=e.getImage(),n=r.getFill(),i=r.getStroke(),o=r.getRadius(),l=r.getRadius2(),a=r.getPoints(),f=r.getAngle(),y=r.getDisplacement(),c={kind:"Mark",color:n?De.getHexColor(n.getColor()):void 0,opacity:r.getOpacity()!==1?r.getOpacity():void 0,fillOpacity:n?De.getOpacity(n.getColor()):void 0,strokeColor:i?i.getColor():void 0,strokeOpacity:i?De.getOpacity(i.getColor()):void 0,strokeWidth:i?i.getWidth():void 0,radius:o!==0?o:5,rotate:r.getRotation()/Xr,offset:y[0]||y[1]?y:void 0};switch(a){case 2:switch(f){case 0:c.wellKnownName="shape://vertline";break;case Math.PI/2:c.wellKnownName="shape://horline";break;case Math.PI/4:c.wellKnownName="shape://slash";break;case 2*Math.PI-Math.PI/4:c.wellKnownName="shape://backslash";break}break;case 3:switch(f){case 0:c.wellKnownName="triangle";break;case Math.PI/2:c.wellKnownName="shape://carrow";break}break;case 4:Number.isFinite(l)?r.getAngle()===0?r.getRadius2()===0?c.wellKnownName="shape://plus":c.wellKnownName="star_diamond":c.wellKnownName="x":r.getAngle()===0?c.wellKnownName="diamond":c.wellKnownName="square";break;case 5:Number.isFinite(l)?c.wellKnownName="star":c.wellKnownName="pentagon";break;case 6:c.wellKnownName="hexagon";break;case 8:c.wellKnownName="octagon";break;case 10:c.wellKnownName="decagon";break;default:throw new Error("Could not parse OlStyle.")}t=c}else if(e.getText()instanceof this.OlStyleTextConstructor){const r=e.getText(),n=r.getFill(),i=r.getStroke(),o=r.getRotation();let l=r.getText()||"a";const a=r.getFont()||"10px sans-serif",f=De.getFontNameFromOlFont(a),y=De.getSizeFromOlFont(a),c=[r.getOffsetX(),r.getOffsetY()];Array.isArray(l)&&(l=l[0]),t={kind:"Mark",wellKnownName:`ttf://${f}#0x${l.charCodeAt(0).toString(16)}`,color:n?De.getHexColor(n.getColor()):void 0,opacity:n?De.getOpacity(n.getColor()):void 0,strokeColor:i?i.getColor():void 0,strokeOpacity:i?De.getOpacity(i.getColor()):void 0,strokeWidth:i?i.getWidth():void 0,radius:y!==0?y:5,rotate:o?o/Xr:0,offset:c[0]||c[1]?c:void 0}}else{const r=e.getImage(),n=r.getDisplacement(),i=r.getWidth(),o=r.getRotation()/Xr,l=r.getOpacity(),a=r.getSrc();let f;a&&a.startsWith("data:image/svg+xml")?f=R7(a):a&&a.trim().startsWith("<svg")&&(f=a.trim()),f?t={...z7(f),...De.checkOpacity(l)&&{opacity:l},...o&&{rotate:o},...(n[0]||n[1])&&{offset:n}}:t={kind:"Icon",image:this.getImageFromIconStyle(r),size:i,...De.checkOpacity(l)&&{opacity:l},...o&&{rotate:o},...(n[0]||n[1])&&{offset:n}}}return t}getImageFromIconStyle(e){const t=e.getSize();if(Array.isArray(t)){const r=e.offset_,n=e.offsetOrigin_;if(n&&n!=="top-left")throw new Error(`Offset origin ${n} not supported`);return{source:e.getSrc(),position:r,size:t}}else return e.getSrc()?e.getSrc():void 0}getLineSymbolizerFromOlStyle(e){const t=e.getStroke(),r=t?t.getLineDash():void 0;return{kind:"Line",color:t?De.getHexColor(t.getColor()):void 0,opacity:t?De.getOpacity(t.getColor()):void 0,width:t?t.getWidth():void 0,cap:t?t.getLineCap():"butt",join:t?t.getLineJoin():"miter",dasharray:r||void 0,dashOffset:t?t.getLineDashOffset():void 0}}getFillSymbolizerFromOlStyle(e){const t=e.getFill(),r=e.getStroke(),n=r?r.getLineDash():void 0,i={kind:"Fill"};return t&&(i.color=De.getHexColor(t.getColor())),t&&(i.fillOpacity=De.getOpacity(t.getColor())),r&&(i.outlineColor=De.getHexColor(r.getColor())),n&&(i.outlineDasharray=n),r&&(i.outlineOpacity=De.getOpacity(r.getColor())),r&&r.getWidth()&&(i.outlineWidth=r.getWidth()),i}getTextSymbolizerFromOlStyle(e){var _;const t=e.getText();if(!t)throw new Error("Could not get text from olStyle.");const r=t.getFill(),n=t.getStroke(),i=t.getOffsetX(),o=t.getOffsetY(),l=t.getFont(),a=t.getRotation(),f=t.getOverflow()?t.getOverflow():void 0,y=t.getPlacement(),c=t.getRepeat(),g=t.getText(),d=Array.isArray(g)?g[0]:g;let m=1/0,b,F,v;if(l){const $=k7(l);$["font-weight"]&&(F=$["font-weight"]),$["font-size"]&&(m=parseInt($["font-size"],10)),$["font-family"]&&(b=(_=$["font-family"])==null?void 0:_.map(w=>w.includes(" ")?'"'+w+'"':w)),$["font-style"]&&(v=$["font-style"])}return{kind:"Text",label:d,placement:y,repeat:c,allowOverlap:f,color:r?De.getHexColor(r.getColor()):void 0,size:isFinite(m)?m:void 0,font:b,fontWeight:F||void 0,fontStyle:v||void 0,offset:i!==void 0&&o!==void 0?[i,o]:[0,0],haloColor:n&&n.getColor()?De.getHexColor(n.getColor()):void 0,haloWidth:n?n.getWidth():void 0,rotate:a!==void 0?a/Xr:void 0}}getSymbolizersFromOlStyle(e){const t=[];return e.forEach(r=>{let n;switch(this.getStyleTypeFromOlStyle(r)){case"Point":r.getText()&&!De.getIsMarkSymbolizerFont(r.getText().getFont())?n=this.getTextSymbolizerFromOlStyle(r):n=this.getPointSymbolizerFromOlStyle(r);break;case"Line":n=this.getLineSymbolizerFromOlStyle(r);break;case"Fill":n=this.getFillSymbolizerFromOlStyle(r);break;default:throw new Error("Failed to parse SymbolizerKind from OpenLayers Style")}t.push(n)}),t}getRuleFromOlStyle(e){let t;return Array.isArray(e)?t=this.getSymbolizersFromOlStyle(e):t=this.getSymbolizersFromOlStyle([e]),{name:"OL Style Rule 0",symbolizers:t}}getStyleTypeFromOlStyle(e){let t;if(e.getImage()instanceof this.OlStyleImageConstructor)t="Point";else if(e.getText()instanceof this.OlStyleTextConstructor)t="Point";else if(e.getFill()instanceof this.OlStyleFillConstructor)t="Fill";else if(e.getStroke()&&!e.getFill())t="Line";else throw new Error("StyleType could not be detected");return t}olStyleToGeoStylerStyle(e){const t="OL Style",r=this.getRuleFromOlStyle(e);return{name:t,rules:[r]}}readStyle(e){return new Promise(t=>{try{if(this.isOlParserStyleFct(e))t({output:e.__geoStylerStyle});else{e=e;const r=this.olStyleToGeoStylerStyle(e),n=this.checkForUnsupportedProperties(r);t({output:r,unsupportedProperties:n})}}catch(r){t({errors:[r]})}})}writeStyle(e){return new Promise(t=>{const r=structuredClone(e),n=this.checkForUnsupportedProperties(r);try{const i=this.getOlStyleTypeFromGeoStylerStyle(r);t({output:i,unsupportedProperties:n,warnings:n&&["Your style contains unsupportedProperties!"]})}catch(i){t({errors:[i]})}})}checkForUnsupportedProperties(e){const t=n=>n[0].toUpperCase()+n.slice(1),r={};if(e.rules.forEach(n=>{n.symbolizers.forEach(i=>{var a,f;const o=t(`${i.kind}Symbolizer`),l=(f=(a=this.unsupportedProperties)==null?void 0:a.Symbolizer)==null?void 0:f[o];l&&(typeof l=="string"?(r.Symbolizer||(r.Symbolizer={}),r.Symbolizer[o]=l):Object.keys(i).forEach(y=>{l[y]&&(r.Symbolizer||(r.Symbolizer={}),r.Symbolizer[o]||(r.Symbolizer[o]={}),r.Symbolizer[o][y]=l[y])}))})}),Object.keys(r).length>0)return r}getOlStyleTypeFromGeoStylerStyle(e){var r,n,i,o,l,a,f,y;const t=e.rules;if(t.length===1){const c=((n=(r=e==null?void 0:e.rules)==null?void 0:r[0])==null?void 0:n.filter)!==void 0,g=((l=(o=(i=e==null?void 0:e.rules)==null?void 0:i[0])==null?void 0:o.scaleDenominator)==null?void 0:l.min)!==void 0,d=((y=(f=(a=e==null?void 0:e.rules)==null?void 0:a[0])==null?void 0:f.scaleDenominator)==null?void 0:y.max)!==void 0,m=!!(g||d),b=De.containsGeoStylerFunctions(e),F=Lr.containsGraphicStroke(e),v=e.rules[0].symbolizers.length,_=t[0].symbolizers.some(w=>w.kind==="Text"),$=t[0].symbolizers.some(w=>w.kind==="Icon"&&typeof w.image=="string"&&w.image.includes("{{"));return!c&&!m&&!_&&!$&&!b&&!F?v===1?this.geoStylerStyleToOlStyle(e):this.geoStylerStyleToOlStyleArray(e):this.geoStylerStyleToOlParserStyleFct(e)}else return this.geoStylerStyleToOlParserStyleFct(e)}geoStylerStyleToOlStyle(e){const t=e.rules[0].symbolizers[0];return this.getOlSymbolizerFromSymbolizer(t)}geoStylerStyleToOlStyleArray(e){const t=e.rules[0],r=[];return t.symbolizers.forEach(n=>{const i=this.getOlSymbolizerFromSymbolizer(n);r.push(i)}),r}geoStylerStyleToOlParserStyleFct(e){const t=structuredClone(e.rules),r=(n,i)=>{const o=[],l=90.7142857142857,a=Fp.m,f=i*a*39.37*l;return t.forEach(y=>{var b,F;let c=(b=y==null?void 0:y.scaleDenominator)==null?void 0:b.min,g=(F=y==null?void 0:y.scaleDenominator)==null?void 0:F.max,d=!0;(c||g)&&(c=Ie(c)?De.evaluateFunction(c,n):c,g=Ie(g)?De.evaluateFunction(g,n):g,c&&f<c&&(d=!1),g&&f>=g&&(d=!1));let m=!1;if(!y.filter)m=!0;else try{m=this.geoStylerFilterToOlParserFilter(n,y.filter)}catch{m=!1}d&&m&&y.symbolizers.forEach(v=>{v.visibility===!1&&o.push(null),Tn(v.visibility)&&(De.evaluateFunction(v.visibility,n)||o.push(null));const _=this.getOlSymbolizerFromSymbolizer(v,n,i);if(typeof _=="function"){const $=_(n,i);o.push($)}else Array.isArray(_)?_.forEach($=>{if(typeof $=="function"){const w=$(n,i);o.push(w)}else o.push($)}):o.push(_)})}),o};return r.__geoStylerStyle=e,r}geoStylerFilterToOlParserFilter(e,t){const r={"&&":!0,"||":!0,"!":!0};let n=!0;if(Tn(t))return De.evaluateBooleanFunction(t,e);if(t===!0||t===!1)return t;const i=t[0];let o=!1;r[i]&&(o=!0);try{if(o){let l,a;switch(t[0]){case"&&":l=!0,a=t.slice(1),a.forEach(f=>{this.geoStylerFilterToOlParserFilter(e,f)||(l=!1)}),n=l;break;case"||":l=!1,a=t.slice(1),a.forEach(f=>{this.geoStylerFilterToOlParserFilter(e,f)&&(l=!0)}),n=l;break;case"!":n=!this.geoStylerFilterToOlParserFilter(e,t[1]);break;default:throw new Error("Cannot parse Filter. Unknown combination or negation operator.")}}else{let l;Ie(t[1])?l=De.evaluateFunction(t[1],e):l=e.get(t[1]);let a;switch(Ie(t[2])?a=De.evaluateFunction(t[2],e):a=t[2],t[0]){case"==":n=""+l==""+a;break;case"*=":typeof a=="string"&&typeof l=="string"&&(a.length>l.length?n=!1:n=l.indexOf(a)!==-1);break;case"!=":n=""+l!=""+a;break;case"<":n=Number(l)<Number(a);break;case"<=":n=Number(l)<=Number(a);break;case">":n=Number(l)>Number(a);break;case">=":n=Number(l)>=Number(a);break;default:throw new Error("Cannot parse Filter. Unknown comparison operator.")}}}catch{throw new Error("Cannot parse Filter. Invalid structure.")}return n}getOlSymbolizerFromSymbolizer(e,t,r){let n;switch(e=structuredClone(e),e.kind){case"Mark":n=this.getOlPointSymbolizerFromMarkSymbolizer(e,t);break;case"Icon":n=this.getOlIconSymbolizerFromIconSymbolizer(e,t);break;case"Text":n=this.getOlTextSymbolizerFromTextSymbolizer(e,t);break;case"Line":n=this.getOlLineSymbolizerFromLineSymbolizer(e,t,r);break;case"Fill":n=this.getOlPolygonSymbolizerFromFillSymbolizer(e,t);break;default:{const i=new this.OlStyleFillConstructor({color:"rgba(255,255,255,0.4)"}),o=new this.OlStyleStrokeConstructor({color:"#3399CC",width:1.25});n=new this.OlStyleConstructor({image:new this.OlStyleCircleConstructor({fill:i,stroke:o,radius:5}),fill:i,stroke:o});break}}return n}getOlPointSymbolizerFromMarkSymbolizer(e,t){for(const c of Object.keys(e))Ie(e[c])&&(e[c]=De.evaluateFunction(e[c],t));const r=e.strokeColor,n=e.strokeOpacity,i=e.strokeWidth,o=e.color,l=e.fillOpacity,a=Number(e.rotate)*Xr,f=e.offset;let y;if(eS(e.wellKnownName)){const c=e.opacity,g=tS(e);y=new this.OlStyleConstructor({image:new this.OlStyleIconConstructor({crossOrigin:"anonymous",...f&&{displacement:f},...De.checkOpacity(c)&&{opacity:c},...a&&{rotation:a},scale:1,src:D7(g)})})}else if(De.getIsFontGlyphBased(e)){const c=r&&De.checkOpacity(n)?De.getRgbaColor(r,n):r,g=o&&De.checkOpacity(l)?De.getRgbaColor(o,l):o,d=new this.OlStyleStrokeConstructor({...c&&{color:c},...i&&{width:i}}),m=new this.OlStyleFillConstructor({...g&&{color:g}});y=new this.OlStyleConstructor({text:new this.OlStyleTextConstructor({text:De.getCharacterForMarkSymbolizer(e),font:De.getTextFontForMarkSymbolizer(e),...m&&{fill:m},...f&&{offsetX:f[0]},...f&&{offsetY:f[1]},...d&&{stroke:d},...a&&{rotation:a}})})}else throw new Error("MarkSymbolizer cannot be parsed. Unsupported WellKnownName.");return y}getOlIconSymbolizerFromIconSymbolizer(e,t){for(const l of Object.keys(e))Ie(e[l])&&(e[l]=De.evaluateFunction(e[l],t));const r={src:Li(e.image)?e.image.source:e.image,crossOrigin:"anonymous",opacity:e.opacity,width:e.size,rotation:typeof e.rotate=="number"?e.rotate*Xr:void 0,displacement:e.offset,size:Li(e.image)?e.image.size:void 0,offset:Li(e.image)?e.image.position:void 0},n="\\{\\{",i="\\}\\}",o=new RegExp(n+".*?"+i,"g");return typeof e.image=="string"&&e.image.match(o)?l=>{let a=De.resolveAttributeTemplate(l,e.image,"");a||(a=e.image+"");let f;return this.olIconStyleCache[a]?(f=this.olIconStyleCache[a],r.rotation!==void 0&&f.setRotation(r.rotation),r.opacity!==void 0&&f.setOpacity(r.opacity)):(f=new this.OlStyleIconConstructor({...r,src:a}),this.olIconStyleCache[a]=f),new this.OlStyleConstructor({image:f})}:new this.OlStyleConstructor({image:new this.OlStyleIconConstructor({...r})})}getOlLineSymbolizerFromLineSymbolizer(e,t,r){if(e.graphicStroke)return this.getOlGraphicStrokeFromGraphicStroke(e,t,r);for(const l of Object.keys(e))Ie(e[l])&&(e[l]=De.evaluateFunction(e[l],t));const n=e.color,i=e.opacity,o=n&&i!==null&&i!==void 0?De.getRgbaColor(n,i):n;return new this.OlStyleConstructor({stroke:new this.OlStyleStrokeConstructor({color:o,width:e.width,lineCap:e.cap,lineJoin:e.join,lineDash:e.dasharray,lineDashOffset:e.dashOffset})})}getOlGraphicStrokeFromGraphicStroke(e,t,r){const n=Lr.getLineStringsFromGeometry(t.getGeometry(),{LineString:this.OlLineStringContructor,MultiLineString:this.OlMultiLineStringConstructor,Polygon:this.OlPolygonConstructor,MultiPolygon:this.OlMultiPolygonConstructor}),i=e.graphicStroke,o=this.getSymbolSizeFromGraphicStroke(i,t);if(o<=0)return console.warn("Symbol size must be greater than zero for graphic stroke. No graphic will be drawn."),[];const l=i.rotate,a=Ie(l)?De.evaluateFunction(l,t):l??0,f=e.dasharray,y=e.dashOffset||0,c=Ie(y)?De.evaluateFunction(y,t):y,g=d=>this.getOlSymbolizerFromSymbolizer(d,t,r);return n.flatMap(d=>Lr.processLineStringGraphicStroke(d,o,r,f,c,a,i,g,this.OlPointConstructor))}getSymbolSizeFromGraphicStroke(e,t){let r=0;if(e.kind==="Mark"){const n=e.radius;if(Ie(n)?r=De.evaluateFunction(n,t)*2:r=(n??0)*2,r<=0)return r;const i=e.strokeWidth;Ie(i)?r+=De.evaluateFunction(i,t):r+=i??0}else if(e.kind==="Icon"){const n=e.size;Ie(n)?r=De.evaluateFunction(n,t):r=n??0}return r}getOlPolygonSymbolizerFromFillSymbolizer(e,t){for(const g of Object.keys(e))Ie(e[g])&&(e[g]=De.evaluateFunction(e[g],t));const r=e.color,n=e.fillOpacity,i=r&&Number.isFinite(n)?De.getRgbaColor(r,n):r;let o=r?new this.OlStyleFillConstructor({color:i}):void 0;const l=e.outlineColor,a=e.outlineOpacity,f=l&&Number.isFinite(a)?De.getRgbaColor(l,a):l,y=l||e.outlineWidth?new this.OlStyleStrokeConstructor({color:f,width:e.outlineWidth,lineDash:e.outlineDasharray}):void 0,c=new Vo({fill:o,stroke:y});if(e.graphicFill){const g=this.getOlPatternFromGraphicFill(e.graphicFill);o||(o=new Wi({})),g&&o.setColor(g),c.setFill(o)}return c}getOlPatternFromGraphicFill(e){if(!La(e)&&!lv(e))return null;const t=document.createElement("canvas"),r=t.getContext("2d");let n,i=[8,8],o=1.5,l=1;if(La(e)){const b=this.getOlIconSymbolizerFromIconSymbolizer(e),F=b==null?void 0:b.getImage();if(F==null||F.load(),(F==null?void 0:F.getImageState())!==Je.LOADED)return null;i=b.getImage().getSize(),n=i.map(w=>w*o),t.width=n[0],t.height=n[1];const v=V7(r,{size:n,pixelRatio:1}),_=n.map(w=>w/2),$=new Xo(new Dn(_));return v.drawFeature($,b),r.createPattern(t,"repeat")}const a=Y7(e),f=H2.includes(String(e.wellKnownName)),y=Lm(e.wellKnownName),c=!e.strokeWidth&&Xf.includes(y),g=y.startsWith("dense"),d=e.rotate||0;(f||c||g)&&(d/Xr%1!==0&&(l=Math.sin(d*Xr)),o=1);const m=(e.radius??4)*2;return i=[m,m],n=i.map(b=>b*o*l),t.width=n[0],t.height=n[1],G7(a,r,n[0],d),r.createPattern(t,"repeat")}getOlTextSymbolizerFromTextSymbolizer(e,t){for(const b of Object.keys(e))Ie(e[b])&&(e[b]=De.evaluateFunction(e[b],t));const r=e.color;let n=e.placement;n||(n="point"),n==="line-center"&&(n="line");const i=e.opacity,o=r&&Number.isFinite(i)?De.getRgbaColor(r,i):r,l=e.haloColor,a=e.haloWidth,f=l&&Number.isFinite(i)?De.getRgbaColor(l,i):l,y={font:De.getTextFont(e),fill:new this.OlStyleFillConstructor({color:o}),stroke:new this.OlStyleStrokeConstructor({color:f,width:a||0}),overflow:e.allowOverlap,offsetX:e.offset?e.offset[0]:0,offsetY:e.offset?e.offset[1]:0,rotation:typeof e.rotate=="number"?e.rotate*Xr:void 0,placement:n,repeat:e.repeat},c="\\{\\{",g="\\}\\}",d=new RegExp(c+".*?"+g,"g");let m;return Ti(e.label)||(m=e.label?e.label.match(d):null),m?b=>{const F=new this.OlStyleTextConstructor({text:De.resolveAttributeTemplate(b,e.label,""),...y});return new this.OlStyleConstructor({text:F})}:new this.OlStyleConstructor({text:new this.OlStyleTextConstructor({text:e.label,...y})})}}Le(Im,"title","OpenLayers Style Parser");const Om="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgdmlld0JveD0iNjQgNjQgODk2IDg5NiIKICAgZm9jdXNhYmxlPSJmYWxzZSIKICAgZGF0YS1pY29uPSJmdW5jdGlvbiIKICAgd2lkdGg9IjI0cHgiCiAgIGhlaWdodD0iMjRweCIKICAgZmlsbD0iY3VycmVudENvbG9yIgogICBhcmlhLWhpZGRlbj0idHJ1ZSIKICAgdmVyc2lvbj0iMS4xIgogICBpZD0ic3ZnNTAiCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGRlZnMKICAgICBpZD0iZGVmczQ2Ij4KICAgIDxzdHlsZQogICAgICAgaWQ9InN0eWxlNDQiIC8+CiAgPC9kZWZzPgogIDxwYXRoCiAgICAgZD0iTTg0MSAzNzBjMy0zLjMgMi43LTguMy0uNi0xMS4zYTguMjQgOC4yNCAwIDAwLTUuMy0yLjFoLTcyLjZjLTIuNCAwLTQuNiAxLTYuMSAyLjhMNjMzLjUgNTA0LjZhNy45NiA3Ljk2IDAgMDEtMTMuNC0xLjlsLTYzLjUtMTQxLjNhNy45IDcuOSAwIDAwLTcuMy00LjdIMzgwLjdsLjktNC43IDgtNDIuM2MxMC41LTU1LjQgMzgtODEuNCA4NS44LTgxLjQgMTguNiAwIDM1LjUgMS43IDQ4LjggNC43bDE0LjEtNjYuOGMtMjIuNi00LjctMzUuMi02LjEtNTQuOS02LjEtMTAzLjMgMC0xNTYuNCA0NC4zLTE3NS45IDE0Ny4zbC05LjQgNDkuNGgtOTcuNmMtMy44IDAtNy4xIDIuNy03LjggNi40TDE4MS45IDQxNWE4LjA3IDguMDcgMCAwMDcuOCA5LjdIMjg0bC04OSA0MjkuOWE4LjA3IDguMDcgMCAwMDcuOCA5LjdIMjY5YzMuOCAwIDcuMS0yLjcgNy44LTYuNGw4OS43LTQzMy4xaDEzNS44bDY4LjIgMTM5LjFjMS40IDIuOSAxIDYuNC0xLjIgOC44bC0xODAuNiAyMDNjLTIuOSAzLjMtMi42IDguNC43IDExLjMgMS41IDEuMyAzLjQgMiA1LjMgMmg3Mi43YzIuNCAwIDQuNi0xIDYuMS0yLjhsMTIzLjctMTQ2LjdjMi44LTMuNCA3LjktMy44IDExLjMtMSAuOS44IDEuNiAxLjcgMi4xIDIuOEw2NzYuNCA3ODRjMS4zIDIuOCA0LjEgNC43IDcuMyA0LjdoNjQuNmE4LjAyIDguMDIgMCAwMDcuMi0xMS41bC05NS4yLTE5OC45Yy0xLjQtMi45LS45LTYuNCAxLjMtOC44TDg0MSAzNzB6IgogICAgIGlkPSJwYXRoNDgiIC8+Cjwvc3ZnPgo=",sS=({onClick:s,symbolizerKind:e,symbolizers:t})=>{const r=p.useRef(void 0),n=p.useRef(null),i=p.useRef(void 0),[o,l]=p.useState(!1),a=Pe("Renderer"),f=p.useCallback(()=>{switch(e||dt(t,"[0].kind")){case"Mark":case"Icon":case"Text":return new Dn([7,50]);case"Fill":return new pn([[[7,50],[8,51],[9,51],[10,50],[9,49],[8,48],[7,48],[6,49],[6,50],[7,50]]]);case"Line":return new qn([[7,50],[8,50],[8.4,50.75],[9,49],[9.5,52],[10,49.5],[10.2,50],[12,50]]);default:return new Dn([7.10066,50.735851])}},[e,t]),y=p.useCallback(()=>{i.current.getSource().clear();const g=new Xo({geometry:f(),Name:"Sample Feature"});i.current.getSource().addFeature(g);const d=i.current.getSource().getExtent();r.current.getView().fit(d,{maxZoom:20,padding:[10,10,10,10]})},[f]);p.useEffect(()=>{if(n.current)return i.current=new R2({source:new W2}),r.current=new _2({layers:[i.current],controls:[],interactions:[],target:n.current,view:new Rn({projection:"EPSG:4326"})}),()=>{r.current&&r.current.setTarget(void 0)}},[n]),p.useEffect(()=>{y()},[y]),p.useEffect(()=>{c(t)},[t]);const c=async g=>{if(!g)return;const d=new Im;let m=structuredClone(g),b=!1;for(const $ of g)for(const w of Object.values($))if(Ie(w)){b=!0;const S=$.kind;["Mark","Icon","Text"].includes(S)&&(m=[{kind:"Mark",wellKnownName:"circle",strokeColor:"#000000",strokeWidth:2,color:"#FFFFFF",radius:20},{kind:"Icon",image:Om,size:24,offset:[24,-24]}]),S==="Fill"&&(m=[{kind:"Fill",outlineColor:"#000000",outlineWidth:2,graphicFill:{kind:"Icon",image:Om,size:24}}]),S==="Line"&&(m=[{kind:"Line",width:2},{kind:"Icon",image:Om,size:24}]);break}l(b);const F={name:"WrapperStyle4Symbolizer",rules:[{name:"WrapperRule4Symbolizer",symbolizers:m}]},{output:v,errors:_=[]}=await d.writeStyle(F);if(!(_.length>0))return i.current.setStyle(v),v};return p.createElement("div",{ref:n,className:"gs-symbolizer-olrenderer",role:"presentation",onClick:g=>{s&&s(t,g)}},o&&p.createElement(D.Tooltip,{title:a.placeholderInfo},p.createElement(Qe.InfoCircleTwoTone,null)))},rS=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",X7=rS+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",H7="["+rS+"]["+X7+"]*",Z7=new RegExp("^"+H7+"$");function nS(s,e){const t=[];let r=e.exec(s);for(;r;){const n=[];n.startIndex=e.lastIndex-r[0].length;const i=r.length;for(let o=0;o<i;o++)n.push(r[o]);t.push(n),r=e.exec(s)}return t}const Gc=function(s){const e=Z7.exec(s);return!(e===null||typeof e>"u")};function Q7(s){return typeof s<"u"}const Am=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],iS=["__proto__","constructor","prototype"],J7={allowBooleanAttributes:!1,unpairedTags:[]};function e9(s,e){e=Object.assign({},J7,e);const t=[];let r=!1,n=!1;s[0]==="\uFEFF"&&(s=s.substr(1));for(let i=0;i<s.length;i++)if(s[i]==="<"&&s[i+1]==="?"){if(i+=2,i=lS(s,i),i.err)return i}else if(s[i]==="<"){let o=i;if(i++,s[i]==="!"){i=aS(s,i);continue}else{let l=!1;s[i]==="/"&&(l=!0,i++);let a="";for(;i<s.length&&s[i]!==">"&&s[i]!==" "&&s[i]!==" "&&s[i]!==`
16
16
  `&&s[i]!=="\r";i++)a+=s[i];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),i--),!a9(a)){let c;return a.trim().length===0?c="Invalid space after '<'.":c="Tag '"+a+"' is an invalid name.",is("InvalidTag",c,ir(s,i))}const f=r9(s,i);if(f===!1)return is("InvalidAttr","Attributes for '"+a+"' have open quote.",ir(s,i));let y=f.value;if(i=f.index,y[y.length-1]==="/"){const c=i-y.length;y=y.substring(0,y.length-1);const g=fS(y,e);if(g===!0)r=!0;else return is(g.err.code,g.err.msg,ir(s,c+g.err.line))}else if(l)if(f.tagClosed){if(y.trim().length>0)return is("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",ir(s,o));if(t.length===0)return is("InvalidTag","Closing tag '"+a+"' has not been opened.",ir(s,o));{const c=t.pop();if(a!==c.tagName){let g=ir(s,c.tagStartPos);return is("InvalidTag","Expected closing tag '"+c.tagName+"' (opened in line "+g.line+", col "+g.col+") instead of closing tag '"+a+"'.",ir(s,o))}t.length==0&&(n=!0)}}else return is("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",ir(s,i));else{const c=fS(y,e);if(c!==!0)return is(c.err.code,c.err.msg,ir(s,i-y.length+c.err.line));if(n===!0)return is("InvalidXml","Multiple possible root nodes found.",ir(s,i));e.unpairedTags.indexOf(a)!==-1||t.push({tagName:a,tagStartPos:o}),r=!0}for(i++;i<s.length;i++)if(s[i]==="<")if(s[i+1]==="!"){i++,i=aS(s,i);continue}else if(s[i+1]==="?"){if(i=lS(s,++i),i.err)return i}else break;else if(s[i]==="&"){const c=o9(s,i);if(c==-1)return is("InvalidChar","char '&' is not expected.",ir(s,i));i=c}else if(n===!0&&!oS(s[i]))return is("InvalidXml","Extra text at the end",ir(s,i));s[i]==="<"&&i--}}else{if(oS(s[i]))continue;return is("InvalidChar","char '"+s[i]+"' is not expected.",ir(s,i))}if(r){if(t.length==1)return is("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",ir(s,t[0].tagStartPos));if(t.length>0)return is("InvalidXml","Invalid '"+JSON.stringify(t.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return is("InvalidXml","Start tag expected.",1);return!0}function oS(s){return s===" "||s===" "||s===`
17
17
  `||s==="\r"}function lS(s,e){const t=e;for(;e<s.length;e++)if(s[e]=="?"||s[e]==" "){const r=s.substr(t,e-t);if(e>5&&r==="xml")return is("InvalidXml","XML declaration allowed only at the start of the document.",ir(s,e));if(s[e]=="?"&&s[e+1]==">"){e++;break}else continue}return e}function aS(s,e){if(s.length>e+5&&s[e+1]==="-"&&s[e+2]==="-"){for(e+=3;e<s.length;e++)if(s[e]==="-"&&s[e+1]==="-"&&s[e+2]===">"){e+=2;break}}else if(s.length>e+8&&s[e+1]==="D"&&s[e+2]==="O"&&s[e+3]==="C"&&s[e+4]==="T"&&s[e+5]==="Y"&&s[e+6]==="P"&&s[e+7]==="E"){let t=1;for(e+=8;e<s.length;e++)if(s[e]==="<")t++;else if(s[e]===">"&&(t--,t===0))break}else if(s.length>e+9&&s[e+1]==="["&&s[e+2]==="C"&&s[e+3]==="D"&&s[e+4]==="A"&&s[e+5]==="T"&&s[e+6]==="A"&&s[e+7]==="["){for(e+=8;e<s.length;e++)if(s[e]==="]"&&s[e+1]==="]"&&s[e+2]===">"){e+=2;break}}return e}const t9='"',s9="'";function r9(s,e){let t="",r="",n=!1;for(;e<s.length;e++){if(s[e]===t9||s[e]===s9)r===""?r=s[e]:r!==s[e]||(r="");else if(s[e]===">"&&r===""){n=!0;break}t+=s[e]}return r!==""?!1:{value:t,index:e,tagClosed:n}}const n9=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function fS(s,e){const t=nS(s,n9),r={};for(let n=0;n<t.length;n++){if(t[n][1].length===0)return is("InvalidAttr","Attribute '"+t[n][2]+"' has no space in starting.",Hf(t[n]));if(t[n][3]!==void 0&&t[n][4]===void 0)return is("InvalidAttr","Attribute '"+t[n][2]+"' is without value.",Hf(t[n]));if(t[n][3]===void 0&&!e.allowBooleanAttributes)return is("InvalidAttr","boolean attribute '"+t[n][2]+"' is not allowed.",Hf(t[n]));const i=t[n][2];if(!l9(i))return is("InvalidAttr","Attribute '"+i+"' is an invalid name.",Hf(t[n]));if(!Object.prototype.hasOwnProperty.call(r,i))r[i]=1;else return is("InvalidAttr","Attribute '"+i+"' is repeated.",Hf(t[n]))}return!0}function i9(s,e){let t=/\d/;for(s[e]==="x"&&(e++,t=/[\da-fA-F]/);e<s.length;e++){if(s[e]===";")return e;if(!s[e].match(t))break}return-1}function o9(s,e){if(e++,s[e]===";")return-1;if(s[e]==="#")return e++,i9(s,e);let t=0;for(;e<s.length;e++,t++)if(!(s[e].match(/\w/)&&t<20)){if(s[e]===";")break;return-1}return e}function is(s,e,t){return{err:{code:s,msg:e,line:t.line||t,col:t.col}}}function l9(s){return Gc(s)}function a9(s){return Gc(s)}function ir(s,e){const t=s.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function Hf(s){return s.startIndex+s[1].length}const yS=s=>Am.includes(s)?"__"+s:s,f9={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(s,e){return e},attributeValueProcessor:function(s,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(s,e,t){return s},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:yS};function y9(s,e){if(typeof s!="string")return;const t=s.toLowerCase();if(Am.some(r=>t===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${s}" is a reserved JavaScript keyword that could cause prototype pollution`);if(iS.some(r=>t===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${s}" is a reserved JavaScript keyword that could cause prototype pollution`)}function hS(s){return typeof s=="boolean"?{enabled:s,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:typeof s=="object"&&s!==null?{enabled:s.enabled!==!1,maxEntitySize:Math.max(1,s.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,s.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,s.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,s.maxExpandedLength??1e5),maxEntityCount:Math.max(1,s.maxEntityCount??1e3),allowedTags:s.allowedTags??null,tagFilter:s.tagFilter??null}:hS(!0)}const h9=function(s){const e=Object.assign({},f9,s),t=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(const{value:r,name:n}of t)r&&y9(r,n);return e.onDangerousProperty===null&&(e.onDangerousProperty=yS),e.processEntities=hS(e.processEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(r=>typeof r=="string"&&r.startsWith("*.")?".."+r.substring(2):r)),e};let Bc;typeof Symbol!="function"?Bc="@@xmlMetadata":Bc=Symbol("XML Node Metadata");class Hi{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][Bc]={startIndex:t})}static getMetaDataSymbol(){return Bc}}class c9{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,t){const r=Object.create(null);let n=0;if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let i=1,o=!1,l=!1,a="";for(;t<e.length;t++)if(e[t]==="<"&&!l){if(o&&Ho(e,"!ENTITY",t)){t+=7;let f,y;if([f,y,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),y.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&n>=this.options.maxEntityCount)throw new Error(`Entity count (${n+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const c=f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r[f]={regx:RegExp(`&${c};`,"g"),val:y},n++}}else if(o&&Ho(e,"!ELEMENT",t)){t+=8;const{index:f}=this.readElementExp(e,t+1);t=f}else if(o&&Ho(e,"!ATTLIST",t))t+=8;else if(o&&Ho(e,"!NOTATION",t)){t+=9;const{index:f}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=f}else if(Ho(e,"!--",t))l=!0;else throw new Error("Invalid DOCTYPE");i++,a=""}else if(e[t]===">"){if(l?e[t-1]==="-"&&e[t-2]==="-"&&(l=!1,i--):i--,i===0)break}else e[t]==="["?o=!0:a+=e[t];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:t}}readEntityExp(e,t){t=br(e,t);const r=t;for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)t++;let n=e.substring(r,t);if(Zf(n),t=br(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[t]==="%")throw new Error("Parameter entities are not supported")}let i="";if([t,i]=this.readIdentifierVal(e,t,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[n,i,t]}readNotationExp(e,t){t=br(e,t);const r=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let n=e.substring(r,t);!this.suppressValidationErr&&Zf(n),t=br(e,t);const i=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&i!=="SYSTEM"&&i!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);t+=i.length,t=br(e,t);let o=null,l=null;if(i==="PUBLIC")[t,o]=this.readIdentifierVal(e,t,"publicIdentifier"),t=br(e,t),(e[t]==='"'||e[t]==="'")&&([t,l]=this.readIdentifierVal(e,t,"systemIdentifier"));else if(i==="SYSTEM"&&([t,l]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!l))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:o,systemIdentifier:l,index:--t}}readIdentifierVal(e,t,r){let n="";const i=e[t];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);t++;const o=t;for(;t<e.length&&e[t]!==i;)t++;if(n=e.substring(o,t),e[t]!==i)throw new Error(`Unterminated ${r} value`);return t++,[t,n]}readElementExp(e,t){t=br(e,t);const r=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let n=e.substring(r,t);if(!this.suppressValidationErr&&!Gc(n))throw new Error(`Invalid element name: "${n}"`);t=br(e,t);let i="";if(e[t]==="E"&&Ho(e,"MPTY",t))t+=4;else if(e[t]==="A"&&Ho(e,"NY",t))t+=2;else if(e[t]==="("){t++;const o=t;for(;t<e.length&&e[t]!==")";)t++;if(i=e.substring(o,t),e[t]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:n,contentModel:i.trim(),index:t}}readAttlistExp(e,t){t=br(e,t);let r=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let n=e.substring(r,t);for(Zf(n),t=br(e,t),r=t;t<e.length&&!/\s/.test(e[t]);)t++;let i=e.substring(r,t);if(!Zf(i))throw new Error(`Invalid attribute name: "${i}"`);t=br(e,t);let o="";if(e.substring(t,t+8).toUpperCase()==="NOTATION"){if(o="NOTATION",t+=8,t=br(e,t),e[t]!=="(")throw new Error(`Expected '(', found "${e[t]}"`);t++;let a=[];for(;t<e.length&&e[t]!==")";){const f=t;for(;t<e.length&&e[t]!=="|"&&e[t]!==")";)t++;let y=e.substring(f,t);if(y=y.trim(),!Zf(y))throw new Error(`Invalid notation name: "${y}"`);a.push(y),e[t]==="|"&&(t++,t=br(e,t))}if(e[t]!==")")throw new Error("Unterminated list of notations");t++,o+=" ("+a.join("|")+")"}else{const a=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;o+=e.substring(a,t);const f=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!f.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}t=br(e,t);let l="";return e.substring(t,t+8).toUpperCase()==="#REQUIRED"?(l="#REQUIRED",t+=8):e.substring(t,t+7).toUpperCase()==="#IMPLIED"?(l="#IMPLIED",t+=7):[t,l]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:n,attributeName:i,attributeType:o,defaultValue:l,index:t}}}const br=(s,e)=>{for(;e<s.length&&/\s/.test(s[e]);)e++;return e};function Ho(s,e,t){for(let r=0;r<e.length;r++)if(e[r]!==s[t+r+1])return!1;return!0}function Zf(s){if(Gc(s))return s;throw new Error(`Invalid entity name ${s}`)}const g9=/^[-+]?0x[a-fA-F0-9]+$/,u9=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,d9={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function p9(s,e={}){if(e=Object.assign({},d9,e),!s||typeof s!="string")return s;let t=s.trim();if(t.length===0)return s;if(e.skipLike!==void 0&&e.skipLike.test(t))return s;if(t==="0")return 0;if(e.hex&&g9.test(t))return j9(t,16);if(isFinite(t)){if(t.includes("e")||t.includes("E"))return b9(s,t,e);{const r=u9.exec(t);if(r){const n=r[1]||"",i=r[2];let o=F9(r[3]);const l=n?s[i.length+1]===".":s[i.length]===".";if(!e.leadingZeros&&(i.length>1||i.length===1&&!l))return s;{const a=Number(t),f=String(a);if(a===0)return a;if(f.search(/[eE]/)!==-1)return e.eNotation?a:s;if(t.indexOf(".")!==-1)return f==="0"||f===o||f===`${n}${o}`?a:s;let y=i?o:t;return i?y===f||n+y===f?a:s:y===f||y===n+f?a:s}}else return s}}else return v9(s,Number(t),e)}const m9=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function b9(s,e,t){if(!t.eNotation)return s;const r=e.match(m9);if(r){let n=r[1]||"";const i=r[3].indexOf("e")===-1?"E":"e",o=r[2],l=n?s[o.length+1]===i:s[o.length]===i;return o.length>1&&l?s:o.length===1&&(r[3].startsWith(`.${i}`)||r[3][0]===i)?Number(e):o.length>0?t.leadingZeros&&!l?(e=(r[1]||"")+r[3],Number(e)):s:Number(e)}else return s}function F9(s){return s&&s.indexOf(".")!==-1&&(s=s.replace(/0+$/,""),s==="."?s="0":s[0]==="."?s="0"+s:s[s.length-1]==="."&&(s=s.substring(0,s.length-1))),s}function j9(s,e){if(parseInt)return parseInt(s,e);if(Number.parseInt)return Number.parseInt(s,e);if(window&&window.parseInt)return window.parseInt(s,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function v9(s,e,t){const r=e===1/0;switch(t.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return r?"Infinity":"-Infinity";case"original":default:return s}}function _9(s){return typeof s=="function"?s:Array.isArray(s)?e=>{for(const t of s)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}class Vl{constructor(e,t={},r){this.pattern=e,this.separator=t.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(n=>n.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(n=>n.attrName!==void 0),this._hasPositionSelector=this.segments.some(n=>n.position!==void 0)}_parse(e){const t=[];let r=0,n="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(n.trim()&&(t.push(this._parseSegment(n.trim())),n=""),t.push({type:"deep-wildcard"}),r+=2):(n.trim()&&t.push(this._parseSegment(n.trim())),n="",r++):(n+=e[r],r++);return n.trim()&&t.push(this._parseSegment(n.trim())),t}_parseSegment(e){const t={type:"tag"};let r=null,n=e;const i=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(n=i[1]+i[3],i[2])){const y=i[2].slice(1,-1);y&&(r=y)}let o,l=n;if(n.includes("::")){const y=n.indexOf("::");if(o=n.substring(0,y).trim(),l=n.substring(y+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${e}`)}let a,f=null;if(l.includes(":")){const y=l.lastIndexOf(":"),c=l.substring(0,y).trim(),g=l.substring(y+1).trim();["first","last","odd","even"].includes(g)||/^nth\(\d+\)$/.test(g)?(a=c,f=g):a=l}else a=l;if(!a)throw new Error(`Invalid segment pattern: ${e}`);if(t.tag=a,o&&(t.namespace=o),r)if(r.includes("=")){const y=r.indexOf("=");t.attrName=r.substring(0,y).trim(),t.attrValue=r.substring(y+1).trim()}else t.attrName=r.trim();if(f){const y=f.match(/^nth\((\d+)\)$/);y?(t.position="nth",t.positionValue=parseInt(y[1],10)):t.position=f}return t}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class $9{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(e){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard())return this._deepWildcards.push(e),this;const t=e.length,r=e.segments[e.segments.length-1],n=r==null?void 0:r.tag;if(!n||n==="*")this._wildcardByDepth.has(t)||this._wildcardByDepth.set(t,[]),this._wildcardByDepth.get(t).push(e);else{const i=`${t}:${n}`;this._byDepthAndTag.has(i)||this._byDepthAndTag.set(i,[]),this._byDepthAndTag.get(i).push(e)}return this}addAll(e){for(const t of e)this.add(t);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){const t=e.getDepth(),r=e.getCurrentTag(),n=`${t}:${r}`,i=this._byDepthAndTag.get(n);if(i){for(let l=0;l<i.length;l++)if(e.matches(i[l]))return i[l]}const o=this._wildcardByDepth.get(t);if(o){for(let l=0;l<o.length;l++)if(e.matches(o[l]))return o[l]}for(let l=0;l<this._deepWildcards.length;l++)if(e.matches(this._deepWildcards[l]))return this._deepWildcards[l];return null}}class w9{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){const e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){var r;const t=this._matcher.path;if(t.length!==0)return(r=t[t.length-1].values)==null?void 0:r[e]}hasAttr(e){const t=this._matcher.path;if(t.length===0)return!1;const r=t[t.length-1];return r.values!==void 0&&e in r.values}getPosition(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,t=!0){return this._matcher.toString(e,t)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class Mm{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new w9(this)}push(e,t=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const n=this.path.length;this.siblingStacks[n]||(this.siblingStacks[n]=new Map);const i=this.siblingStacks[n],o=r?`${r}:${e}`:e,l=i.get(o)||0;let a=0;for(const y of i.values())a+=y;i.set(o,l+1);const f={tag:e,position:a,counter:l};r!=null&&(f.namespace=r),t!=null&&(f.values=t),this.path.push(f)}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){const t=this.path[this.path.length-1];e!=null&&(t.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){var t;if(this.path.length!==0)return(t=this.path[this.path.length-1].values)==null?void 0:t[e]}hasAttr(e){if(this.path.length===0)return!1;const t=this.path[this.path.length-1];return t.values!==void 0&&e in t.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,t=!0){const r=e||this.separator;if(r===this.separator&&t===!0){if(this._pathStringCache!==null)return this._pathStringCache;const i=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r);return this._pathStringCache=i,i}return this.path.map(i=>t&&i.namespace?`${i.namespace}:${i.tag}`:i.tag).join(r)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(e){const t=e.segments;return t.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(t):this._matchSimple(t)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let t=0;t<e.length;t++)if(!this._matchSegment(e[t],this.path[t],t===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let t=this.path.length-1,r=e.length-1;for(;r>=0&&t>=0;){const n=e[r];if(n.type==="deep-wildcard"){if(r--,r<0)return!0;const i=e[r];let o=!1;for(let l=t;l>=0;l--)if(this._matchSegment(i,this.path[l],l===this.path.length-1)){t=l-1,r--,o=!0;break}if(!o)return!1}else{if(!this._matchSegment(n,this.path[t],t===this.path.length-1))return!1;t--,r--}}return r<0}_matchSegment(e,t,r){if(e.tag!=="*"&&e.tag!==t.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==t.namespace||e.attrName!==void 0&&(!r||!t.values||!(e.attrName in t.values)||e.attrValue!==void 0&&String(t.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!r)return!1;const n=t.counter??0;if(e.position==="first"&&n!==0)return!1;if(e.position==="odd"&&n%2!==1)return!1;if(e.position==="even"&&n%2!==0)return!1;if(e.position==="nth"&&n!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(t=>({...t})),this.siblingStacks=e.siblingStacks.map(t=>new Map(t))}readOnly(){return this._view}}function S9(s,e){if(!s)return{};const t=e.attributesGroupName?s[e.attributesGroupName]:s;if(!t)return{};const r={};for(const n in t)if(n.startsWith(e.attributeNamePrefix)){const i=n.substring(e.attributeNamePrefix.length);r[i]=t[n]}else r[n]=t[n];return r}function E9(s){if(!s||typeof s!="string")return;const e=s.indexOf(":");if(e!==-1&&e>0){const t=s.substring(0,e);if(t!=="xmlns")return t}}class x9{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>cS(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>cS(n,16,"&#x")}},this.addExternalEntities=C9,this.parseXml=A9,this.parseTextData=T9,this.resolveNameSpace=L9,this.buildAttributesMap=O9,this.isItStopNode=k9,this.replaceEntitiesValue=P9,this.readStopNodeData=z9,this.saveTextToParentTag=N9,this.addChild=M9,this.ignoreAttributesFn=_9(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new Mm,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new $9;const t=this.options.stopNodes;if(t&&t.length>0){for(let r=0;r<t.length;r++){const n=t[r];typeof n=="string"?this.stopNodeExpressionsSet.add(new Vl(n)):n instanceof Vl&&this.stopNodeExpressionsSet.add(n)}this.stopNodeExpressionsSet.seal()}}}function C9(s){const e=Object.keys(s);for(let t=0;t<e.length;t++){const r=e[t],n=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+n+";","g"),val:s[r]}}}function T9(s,e,t,r,n,i,o){const l=this.options;if(s!==void 0&&(l.trimValues&&!r&&(s=s.trim()),s.length>0)){o||(s=this.replaceEntitiesValue(s,e,t));const a=l.jPath?t.toString():t,f=l.tagValueProcessor(e,s,a,n,i);return f==null?s:typeof f!=typeof s||f!==s?f:l.trimValues||s.trim()===s?Nm(s,l.parseTagValue,l.numberParseOptions):s}}function L9(s){if(this.options.removeNSPrefix){const e=s.split(":"),t=s.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(s=t+e[1])}return s}const I9=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function O9(s,e,t){const r=this.options;if(r.ignoreAttributes!==!0&&typeof s=="string"){const n=nS(s,I9),i=n.length,o={},l=new Array(i);let a=!1;const f={};for(let g=0;g<i;g++){const d=this.resolveNameSpace(n[g][1]),m=n[g][4];if(d.length&&m!==void 0){let b=m;r.trimValues&&(b=b.trim()),b=this.replaceEntitiesValue(b,t,this.readonlyMatcher),l[g]=b,f[d]=b,a=!0}}a&&typeof e=="object"&&e.updateCurrent&&e.updateCurrent(f);const y=r.jPath?e.toString():this.readonlyMatcher;let c=!1;for(let g=0;g<i;g++){const d=this.resolveNameSpace(n[g][1]);if(this.ignoreAttributesFn(d,y))continue;let m=r.attributeNamePrefix+d;if(d.length)if(r.transformAttributeName&&(m=r.transformAttributeName(m)),m=gS(m,r),n[g][4]!==void 0){const b=l[g],F=r.attributeValueProcessor(d,b,y);F==null?o[m]=b:typeof F!=typeof b||F!==b?o[m]=F:o[m]=Nm(b,r.parseAttributeValue,r.numberParseOptions),c=!0}else r.allowBooleanAttributes&&(o[m]=!0,c=!0)}if(!c)return;if(r.attributesGroupName){const g={};return g[r.attributesGroupName]=o,g}return o}}const A9=function(s){s=s.replace(/\r\n?/g,`
18
18
  `);const e=new Hi("!xml");let t=e,r="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0,this.docTypeEntitiesKeys=[],this.lastEntitiesKeys=Object.keys(this.lastEntities),this.htmlEntitiesKeys=this.options.htmlEntities?Object.keys(this.htmlEntities):[];const n=this.options,i=new c9(n.processEntities),o=s.length;for(let l=0;l<o;l++)if(s[l]==="<"){const f=s.charCodeAt(l+1);if(f===47){const y=Kl(s,">",l,"Closing Tag is not closed.");let c=s.substring(l+2,y).trim();if(n.removeNSPrefix){const d=c.indexOf(":");d!==-1&&(c=c.substr(d+1))}c=km(n.transformTagName,c,"",n).tagName,t&&(r=this.saveTextToParentTag(r,t,this.readonlyMatcher));const g=this.matcher.getCurrentTag();if(c&&n.unpairedTagsSet.has(c))throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);g&&n.unpairedTagsSet.has(g)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,t=this.tagsNodeStack.pop(),r="",l=y}else if(f===63){let y=Pm(s,l,!1,"?>");if(!y)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,t,this.readonlyMatcher),!(n.ignoreDeclaration&&y.tagName==="?xml"||n.ignorePiTags)){const c=new Hi(y.tagName);c.add(n.textNodeName,""),y.tagName!==y.tagExp&&y.attrExpPresent&&(c[":@"]=this.buildAttributesMap(y.tagExp,this.matcher,y.tagName)),this.addChild(t,c,this.readonlyMatcher,l)}l=y.closeIndex+1}else if(f===33&&s.charCodeAt(l+2)===45&&s.charCodeAt(l+3)===45){const y=Kl(s,"-->",l+4,"Comment is not closed.");if(n.commentPropName){const c=s.substring(l+4,y-2);r=this.saveTextToParentTag(r,t,this.readonlyMatcher),t.add(n.commentPropName,[{[n.textNodeName]:c}])}l=y}else if(f===33&&s.charCodeAt(l+2)===68){const y=i.readDocType(s,l);this.docTypeEntities=y.entities,this.docTypeEntitiesKeys=Object.keys(this.docTypeEntities)||[],l=y.i}else if(f===33&&s.charCodeAt(l+2)===91){const y=Kl(s,"]]>",l,"CDATA is not closed.")-2,c=s.substring(l+9,y);r=this.saveTextToParentTag(r,t,this.readonlyMatcher);let g=this.parseTextData(c,t.tagname,this.readonlyMatcher,!0,!1,!0,!0);g==null&&(g=""),n.cdataPropName?t.add(n.cdataPropName,[{[n.textNodeName]:c}]):t.add(n.textNodeName,g),l=y+2}else{let y=Pm(s,l,n.removeNSPrefix);if(!y){const S=s.substring(Math.max(0,l-50),Math.min(o,l+50));throw new Error(`readTagExp returned undefined at position ${l}. Context: "${S}"`)}let c=y.tagName;const g=y.rawTagName;let d=y.tagExp,m=y.attrExpPresent,b=y.closeIndex;if({tagName:c,tagExp:d}=km(n.transformTagName,c,d,n),n.strictReservedNames&&(c===n.commentPropName||c===n.cdataPropName||c===n.textNodeName||c===n.attributesGroupName))throw new Error(`Invalid tag name: ${c}`);t&&r&&t.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,t,this.readonlyMatcher,!1));const F=t;F&&n.unpairedTagsSet.has(F.tagname)&&(t=this.tagsNodeStack.pop(),this.matcher.pop());let v=!1;d.length>0&&d.lastIndexOf("/")===d.length-1&&(v=!0,c[c.length-1]==="/"?(c=c.substr(0,c.length-1),d=c):d=d.substr(0,d.length-1),m=c!==d);let _=null,$;$=E9(g),c!==e.tagname&&this.matcher.push(c,{},$),c!==d&&m&&(_=this.buildAttributesMap(d,this.matcher,c),_&&S9(_,n)),c!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());const w=l;if(this.isCurrentNodeStopNode){let S="";if(v)l=y.closeIndex;else if(n.unpairedTagsSet.has(c))l=y.closeIndex;else{const O=this.readStopNodeData(s,g,b+1);if(!O)throw new Error(`Unexpected end of ${g}`);l=O.i,S=O.tagContent}const L=new Hi(c);_&&(L[":@"]=_),L.add(n.textNodeName,S),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(t,L,this.readonlyMatcher,w)}else{if(v){({tagName:c,tagExp:d}=km(n.transformTagName,c,d,n));const S=new Hi(c);_&&(S[":@"]=_),this.addChild(t,S,this.readonlyMatcher,w),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(n.unpairedTagsSet.has(c)){const S=new Hi(c);_&&(S[":@"]=_),this.addChild(t,S,this.readonlyMatcher,w),this.matcher.pop(),this.isCurrentNodeStopNode=!1,l=y.closeIndex;continue}else{const S=new Hi(c);if(this.tagsNodeStack.length>n.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(t),_&&(S[":@"]=_),this.addChild(t,S,this.readonlyMatcher,w),t=S}r="",l=b}}}else r+=s[l];return e.child};function M9(s,e,t,r){this.options.captureMetaData||(r=void 0);const n=this.options.jPath?t.toString():t,i=this.options.updateTag(e.tagname,n,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),s.addChild(e,r))}function P9(s,e,t){const r=this.options.processEntities;if(!r||!r.enabled)return s;if(r.allowedTags){const n=this.options.jPath?t.toString():t;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(e):r.allowedTags(e,n)))return s}if(r.tagFilter){const n=this.options.jPath?t.toString():t;if(!r.tagFilter(e,n))return s}for(const n of this.docTypeEntitiesKeys){const i=this.docTypeEntities[n],o=s.match(i.regx);if(o){if(this.entityExpansionCount+=o.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const l=s.length;if(s=s.replace(i.regx,i.val),r.maxExpandedLength&&(this.currentExpandedLength+=s.length-l,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(s.indexOf("&")===-1)return s;for(const n of this.lastEntitiesKeys){const i=this.lastEntities[n],o=s.match(i.regex);if(o&&(this.entityExpansionCount+=o.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);s=s.replace(i.regex,i.val)}if(s.indexOf("&")===-1)return s;for(const n of this.htmlEntitiesKeys){const i=this.htmlEntities[n],o=s.match(i.regex);if(o&&(this.entityExpansionCount+=o.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);s=s.replace(i.regex,i.val)}return s=s.replace(this.ampEntity.regex,this.ampEntity.val),s}function N9(s,e,t,r){return s&&(r===void 0&&(r=e.child.length===0),s=this.parseTextData(s,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),s!==void 0&&s!==""&&e.add(this.options.textNodeName,s),s=""),s}function k9(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function D9(s,e,t=">"){let r=0;const n=[],i=s.length,o=t.charCodeAt(0),l=t.length>1?t.charCodeAt(1):-1;for(let a=e;a<i;a++){const f=s.charCodeAt(a);if(r)f===r&&(r=0);else if(f===34||f===39)r=f;else if(f===o)if(l!==-1){if(s.charCodeAt(a+1)===l)return{data:String.fromCharCode(...n),index:a}}else return{data:String.fromCharCode(...n),index:a};else if(f===9){n.push(32);continue}n.push(f)}}function Kl(s,e,t,r){const n=s.indexOf(e,t);if(n===-1)throw new Error(r);return n+e.length-1}function R9(s,e,t,r){const n=s.indexOf(e,t);if(n===-1)throw new Error(r);return n}function Pm(s,e,t,r=">"){const n=D9(s,e+1,r);if(!n)return;let i=n.data;const o=n.index,l=i.search(/\s/);let a=i,f=!0;l!==-1&&(a=i.substring(0,l),i=i.substring(l+1).trimStart());const y=a;if(t){const c=a.indexOf(":");c!==-1&&(a=a.substr(c+1),f=a!==n.data.substr(c+1))}return{tagName:a,tagExp:i,closeIndex:o,attrExpPresent:f,rawTagName:y}}function z9(s,e,t){const r=t;let n=1;const i=s.length;for(;t<i;t++)if(s[t]==="<"){const o=s.charCodeAt(t+1);if(o===47){const l=R9(s,">",t,`${e} is not closed`);if(s.substring(t+2,l).trim()===e&&(n--,n===0))return{tagContent:s.substring(r,t),i:l};t=l}else if(o===63)t=Kl(s,"?>",t+1,"StopNode is not closed.");else if(o===33&&s.charCodeAt(t+2)===45&&s.charCodeAt(t+3)===45)t=Kl(s,"-->",t+3,"StopNode is not closed.");else if(o===33&&s.charCodeAt(t+2)===91)t=Kl(s,"]]>",t,"StopNode is not closed.")-2;else{const l=Pm(s,t,">");l&&((l&&l.tagName)===e&&l.tagExp[l.tagExp.length-1]!=="/"&&n++,t=l.closeIndex)}}}function Nm(s,e,t){if(e&&typeof s=="string"){const r=s.trim();return r==="true"?!0:r==="false"?!1:p9(s,t)}else return Q7(s)?s:""}function cS(s,e,t){const r=Number.parseInt(s,e);return r>=0&&r<=1114111?String.fromCodePoint(r):t+s+";"}function km(s,e,t,r){if(s){const n=s(e);t===e&&(t=n),e=n}return e=gS(e,r),{tagName:e,tagExp:t}}function gS(s,e){if(iS.includes(s))throw new Error(`[SECURITY] Invalid name: "${s}" is a reserved JavaScript keyword that could cause prototype pollution`);return Am.includes(s)?e.onDangerousProperty(s):s}const Dm=Hi.getMetaDataSymbol();function G9(s,e){if(!s||typeof s!="object")return{};if(!e)return s;const t={};for(const r in s)if(r.startsWith(e)){const n=r.substring(e.length);t[n]=s[r]}else t[r]=s[r];return t}function B9(s,e,t,r){return uS(s,e,t,r)}function uS(s,e,t,r){let n;const i={};for(let o=0;o<s.length;o++){const l=s[o],a=q9(l);if(a!==void 0&&a!==e.textNodeName){const f=G9(l[":@"]||{},e.attributeNamePrefix);t.push(a,f)}if(a===e.textNodeName)n===void 0?n=l[a]:n+=""+l[a];else{if(a===void 0)continue;if(l[a]){let f=uS(l[a],e,t,r);const y=W9(f,e);if(l[":@"]?U9(f,l[":@"],r,e):Object.keys(f).length===1&&f[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?f=f[e.textNodeName]:Object.keys(f).length===0&&(e.alwaysCreateTextNode?f[e.textNodeName]="":f=""),l[Dm]!==void 0&&typeof f=="object"&&f!==null&&(f[Dm]=l[Dm]),i[a]!==void 0&&Object.prototype.hasOwnProperty.call(i,a))Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(f);else{const c=e.jPath?r.toString():r;e.isArray(a,c,y)?i[a]=[f]:i[a]=f}a!==void 0&&a!==e.textNodeName&&t.pop()}}}return typeof n=="string"?n.length>0&&(i[e.textNodeName]=n):n!==void 0&&(i[e.textNodeName]=n),i}function q9(s){const e=Object.keys(s);for(let t=0;t<e.length;t++){const r=e[t];if(r!==":@")return r}}function U9(s,e,t,r){if(e){const n=Object.keys(e),i=n.length;for(let o=0;o<i;o++){const l=n[o],a=l.startsWith(r.attributeNamePrefix)?l.substring(r.attributeNamePrefix.length):l,f=r.jPath?t.toString()+"."+a:t;r.isArray(l,f,!0,!0)?s[l]=[e[l]]:s[l]=e[l]}}}function W9(s,e){const{textNodeName:t}=e,r=Object.keys(s).length;return!!(r===0||r===1&&(s[t]||typeof s[t]=="boolean"||s[t]===0))}class V9{constructor(e){this.externalEntities={},this.options=h9(e)}parse(e,t){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const i=e9(e,t);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new x9(this.options);r.addExternalEntities(this.externalEntities);const n=r.parseXml(e);return this.options.preserveOrder||n===void 0?n:B9(n,this.options,r.matcher,r.readonlyMatcher)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}static getMetaDataSymbol(){return Hi.getMetaDataSymbol()}}const K9=`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geostyler",
3
- "version": "18.4.1",
3
+ "version": "18.4.2",
4
4
  "description": "Framework for styling geodata",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -77,7 +77,7 @@
77
77
  "geostyler-data": "^1.1.0",
78
78
  "geostyler-geojson-parser": "^2.0.0",
79
79
  "geostyler-mapbox-parser": "^6.1.1",
80
- "geostyler-openlayers-parser": "^5.6.0",
80
+ "geostyler-openlayers-parser": "^5.6.1",
81
81
  "geostyler-qgis-parser": "^4.0.2",
82
82
  "geostyler-sld-parser": "^8.4.2",
83
83
  "geostyler-style": "^11.0.2",