mobility-toolbox-js 2.0.0-beta.62 → 2.0.0-beta.64

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/mbt.min.js CHANGED
@@ -1079,5 +1079,5 @@ uniform ${se} ${pe} u_${xe};
1079
1079
  `||N===V){s=Math.max(s,P),r.push(P),P=0,z+=F;continue}var _e=p[N+1]||y.font,Se=ig(_e,me);n.push(Se),P+=Se;var Ne=Sw(_e);u.push(Ne),F=Math.max(F,Ne)}return{width:s,height:z,widths:n,heights:u,lineWidths:r}}function Vx(y,p,n,u,r,s,P,z,F,N,V){y.save(),n!==1&&(y.globalAlpha*=n),p&&y.setTransform.apply(y,p),u.contextInstructions?(y.translate(F,N),y.scale(V[0],V[1]),Iw(u,y)):V[0]<0||V[1]<0?(y.translate(F,N),y.scale(V[0],V[1]),y.drawImage(u,r,s,P,z,0,0,P,z)):y.drawImage(u,r,s,P,z,F,N,P*V[0],z*V[1]),y.restore()}function Iw(y,p){for(var n=y.contextInstructions,u=0,r=n.length;u<r;u+=2)Array.isArray(n[u+1])?p[n[u]].apply(p,n[u+1]):p[n[u]]=n[u+1]}var Cw=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Aw=function(y){Cw(p,y);function p(n){var u=this,r=n.rotateWithView!==void 0?n.rotateWithView:!1;return u=y.call(this,{opacity:1,rotateWithView:r,rotation:n.rotation!==void 0?n.rotation:0,scale:n.scale!==void 0?n.scale:1,displacement:n.displacement!==void 0?n.displacement:[0,0]})||this,u.canvas_=void 0,u.hitDetectionCanvas_=null,u.fill_=n.fill!==void 0?n.fill:null,u.origin_=[0,0],u.points_=n.points,u.radius_=n.radius!==void 0?n.radius:n.radius1,u.radius2_=n.radius2,u.angle_=n.angle!==void 0?n.angle:0,u.stroke_=n.stroke!==void 0?n.stroke:null,u.size_=null,u.renderOptions_=null,u.render(),u}return p.prototype.clone=function(){var n=this.getScale(),u=new p({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(n)?n.slice():n,displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},p.prototype.getAnchor=function(){var n=this.size_;if(!n)return null;var u=this.getDisplacement();return[n[0]/2-u[0],n[1]/2+u[1]]},p.prototype.getAngle=function(){return this.angle_},p.prototype.getFill=function(){return this.fill_},p.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_},p.prototype.getImage=function(n){var u=this.canvas_[n];if(!u){var r=this.renderOptions_,s=Ja(r.size*n,r.size*n);this.draw_(r,s,n),u=s.canvas,this.canvas_[n]=u}return u},p.prototype.getPixelRatio=function(n){return n},p.prototype.getImageSize=function(){return this.size_},p.prototype.getImageState=function(){return Wi.LOADED},p.prototype.getOrigin=function(){return this.origin_},p.prototype.getPoints=function(){return this.points_},p.prototype.getRadius=function(){return this.radius_},p.prototype.getRadius2=function(){return this.radius2_},p.prototype.getSize=function(){return this.size_},p.prototype.getStroke=function(){return this.stroke_},p.prototype.listenImageChange=function(n){},p.prototype.load=function(){},p.prototype.unlistenImageChange=function(n){},p.prototype.calculateLineJoinSize_=function(n,u,r){if(u===0||this.points_===1/0||n!=="bevel"&&n!=="miter")return u;var s=this.radius_,P=this.radius2_===void 0?s:this.radius2_;if(s<P){var z=s;s=P,P=z}var F=this.radius2_===void 0?this.points_:this.points_*2,N=2*Math.PI/F,V=P*Math.sin(N),me=Math.sqrt(P*P-V*V),_e=s-me,Se=Math.sqrt(V*V+_e*_e),Ne=Se/V;if(n==="miter"&&Ne<=r)return Ne*u;var Je=u/2/Ne,Ce=u/2*(_e/Se),Ue=Math.sqrt((s+Je)*(s+Je)+Ce*Ce),Ye=Ue-s;if(this.radius2_===void 0||n==="bevel")return Ye*2;var rt=s*Math.sin(N),_t=Math.sqrt(s*s-rt*rt),dt=P-_t,ht=Math.sqrt(rt*rt+dt*dt),Tt=ht/rt;if(Tt<=r){var It=Tt*u/2-P-s;return 2*Math.max(Ye,It)}return Ye*2},p.prototype.createRenderOptions=function(){var n=Iu,u=0,r=null,s=0,P,z=0;this.stroke_&&(P=this.stroke_.getColor(),P===null&&(P=fc),P=Ts(P),z=this.stroke_.getWidth(),z===void 0&&(z=mc),r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),n=this.stroke_.getLineJoin(),n===void 0&&(n=Iu),u=this.stroke_.getMiterLimit(),u===void 0&&(u=pc));var F=this.calculateLineJoinSize_(n,z,u),N=Math.max(this.radius_,this.radius2_||0),V=Math.ceil(2*N+F);return{strokeStyle:P,strokeWidth:z,size:V,lineDash:r,lineDashOffset:s,lineJoin:n,miterLimit:u}},p.prototype.render=function(){this.renderOptions_=this.createRenderOptions();var n=this.renderOptions_.size;this.canvas_={},this.size_=[n,n]},p.prototype.draw_=function(n,u,r){if(u.scale(r,r),u.translate(n.size/2,n.size/2),this.createPath_(u),this.fill_){var s=this.fill_.getColor();s===null&&(s=Ss),u.fillStyle=Ts(s),u.fill()}this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,u.setLineDash&&n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},p.prototype.createHitDetectionCanvas_=function(n){if(this.fill_){var u=this.fill_.getColor(),r=0;if(typeof u=="string"&&(u=Jh(u)),u===null?r=1:Array.isArray(u)&&(r=u.length===4?u[3]:1),r===0){var s=Ja(n.size,n.size);this.hitDetectionCanvas_=s.canvas,this.drawHitDetectionCanvas_(n,s)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))},p.prototype.createPath_=function(n){var u=this.points_,r=this.radius_;if(u===1/0)n.arc(0,0,r,0,2*Math.PI);else{var s=this.radius2_===void 0?r:this.radius2_;this.radius2_!==void 0&&(u*=2);for(var P=this.angle_-Math.PI/2,z=2*Math.PI/u,F=0;F<u;F++){var N=P+F*z,V=F%2===0?r:s;n.lineTo(V*Math.cos(N),V*Math.sin(N))}n.closePath()}},p.prototype.drawHitDetectionCanvas_=function(n,u){u.translate(n.size/2,n.size/2),this.createPath_(u),u.fillStyle=Ss,u.fill(),this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},p}(tg),Gx=Aw;var Pw=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Mw=function(y){Pw(p,y);function p(n){var u=n||{};return y.call(this,{points:1/0,fill:u.fill,radius:u.radius,stroke:u.stroke,scale:u.scale!==void 0?u.scale:1,rotation:u.rotation!==void 0?u.rotation:0,rotateWithView:u.rotateWithView!==void 0?u.rotateWithView:!1,displacement:u.displacement!==void 0?u.displacement:[0,0]})||this}return p.prototype.clone=function(){var n=this.getScale(),u=new p({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(n)?n.slice():n,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},p.prototype.setRadius=function(n){this.radius_=n,this.render()},p}(Gx),xl=Mw;var lf=function(){function y(p){var n=p||{};this.geometry_=null,this.geometryFunction_=jx,n.geometry!==void 0&&this.setGeometry(n.geometry),this.fill_=n.fill!==void 0?n.fill:null,this.image_=n.image!==void 0?n.image:null,this.renderer_=n.renderer!==void 0?n.renderer:null,this.hitDetectionRenderer_=n.hitDetectionRenderer!==void 0?n.hitDetectionRenderer:null,this.stroke_=n.stroke!==void 0?n.stroke:null,this.text_=n.text!==void 0?n.text:null,this.zIndex_=n.zIndex}return y.prototype.clone=function(){var p=this.getGeometry();return p&&typeof p=="object"&&(p=p.clone()),new y({geometry:p,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},y.prototype.getRenderer=function(){return this.renderer_},y.prototype.setRenderer=function(p){this.renderer_=p},y.prototype.setHitDetectionRenderer=function(p){this.hitDetectionRenderer_=p},y.prototype.getHitDetectionRenderer=function(){return this.hitDetectionRenderer_},y.prototype.getGeometry=function(){return this.geometry_},y.prototype.getGeometryFunction=function(){return this.geometryFunction_},y.prototype.getFill=function(){return this.fill_},y.prototype.setFill=function(p){this.fill_=p},y.prototype.getImage=function(){return this.image_},y.prototype.setImage=function(p){this.image_=p},y.prototype.getStroke=function(){return this.stroke_},y.prototype.setStroke=function(p){this.stroke_=p},y.prototype.getText=function(){return this.text_},y.prototype.setText=function(p){this.text_=p},y.prototype.getZIndex=function(){return this.zIndex_},y.prototype.setGeometry=function(p){typeof p=="function"?this.geometryFunction_=p:typeof p=="string"?this.geometryFunction_=function(n){return n.get(p)}:p?p!==void 0&&(this.geometryFunction_=function(){return p}):this.geometryFunction_=jx,this.geometry_=p},y.prototype.setZIndex=function(p){this.zIndex_=p},y}();function qx(y){var p;if(typeof y=="function")p=y;else{var n;if(Array.isArray(y))n=y;else{wn(typeof y.getZIndex=="function",41);var u=y;n=[u]}p=function(){return n}}return p}var n_=null;function Zx(y,p){if(!n_){var n=new Ks({color:"rgba(255,255,255,0.4)"}),u=new va({color:"#3399CC",width:1.25});n_=[new lf({image:new xl({fill:n,stroke:u,radius:5}),fill:n,stroke:u})]}return n_}function Wx(){var y={},p=[255,255,255,1],n=[0,153,255,1],u=3;return y[Mt.POLYGON]=[new lf({fill:new Ks({color:[255,255,255,.5]})})],y[Mt.MULTI_POLYGON]=y[Mt.POLYGON],y[Mt.LINE_STRING]=[new lf({stroke:new va({color:p,width:u+2})}),new lf({stroke:new va({color:n,width:u})})],y[Mt.MULTI_LINE_STRING]=y[Mt.LINE_STRING],y[Mt.CIRCLE]=y[Mt.POLYGON].concat(y[Mt.LINE_STRING]),y[Mt.POINT]=[new lf({image:new xl({radius:u*2,fill:new Ks({color:n}),stroke:new va({color:p,width:u/2})}),zIndex:1/0})],y[Mt.MULTI_POINT]=y[Mt.POINT],y[Mt.GEOMETRY_COLLECTION]=y[Mt.POLYGON].concat(y[Mt.LINE_STRING],y[Mt.POINT]),y}function jx(y){return y.getGeometry()}var Xl=lf;var Xx={POINT:"point",LINE:"line"};var Kx=Gp(s_(),1);var kw=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),$x={RENDER_ORDER:"renderOrder"},Lw=function(y){kw(p,y);function p(n){var u=this,r=n||{},s=Ra({},r);return delete s.style,delete s.renderBuffer,delete s.updateWhileAnimating,delete s.updateWhileInteracting,u=y.call(this,s)||this,u.declutter_=r.declutter!==void 0?r.declutter:!1,u.renderBuffer_=r.renderBuffer!==void 0?r.renderBuffer:100,u.style_=null,u.styleFunction_=void 0,u.setStyle(r.style),u.updateWhileAnimating_=r.updateWhileAnimating!==void 0?r.updateWhileAnimating:!1,u.updateWhileInteracting_=r.updateWhileInteracting!==void 0?r.updateWhileInteracting:!1,u}return p.prototype.getDeclutter=function(){return this.declutter_},p.prototype.getFeatures=function(n){return y.prototype.getFeatures.call(this,n)},p.prototype.getRenderBuffer=function(){return this.renderBuffer_},p.prototype.getRenderOrder=function(){return this.get($x.RENDER_ORDER)},p.prototype.getStyle=function(){return this.style_},p.prototype.getStyleFunction=function(){return this.styleFunction_},p.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},p.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},p.prototype.renderDeclutter=function(n){n.declutterTree||(n.declutterTree=new Kx.default(9)),this.getRenderer().renderDeclutter(n)},p.prototype.setRenderOrder=function(n){this.set($x.RENDER_ORDER,n)},p.prototype.setStyle=function(n){this.style_=n!==void 0?n:Zx,this.styleFunction_=n===null?void 0:qx(this.style_),this.changed()},p}(Hh),Hx=Lw;var gd={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},yd=[gd.FILL],Cu=[gd.STROKE],gc=[gd.BEGIN_PATH],l_=[gd.CLOSE_PATH],qr=gd;var Rw=function(){function y(){}return y.prototype.drawCustom=function(p,n,u,r){},y.prototype.drawGeometry=function(p){},y.prototype.setStyle=function(p){},y.prototype.drawCircle=function(p,n){},y.prototype.drawFeature=function(p,n){},y.prototype.drawGeometryCollection=function(p,n){},y.prototype.drawLineString=function(p,n){},y.prototype.drawMultiLineString=function(p,n){},y.prototype.drawMultiPoint=function(p,n){},y.prototype.drawMultiPolygon=function(p,n){},y.prototype.drawPoint=function(p,n){},y.prototype.drawPolygon=function(p,n){},y.prototype.drawText=function(p,n){},y.prototype.setFillStrokeStyle=function(p,n){},y.prototype.setImageStyle=function(p,n){},y.prototype.setTextStyle=function(p,n){},y}(),og=Rw;var zw=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Dw=function(y){zw(p,y);function p(n,u,r,s){var P=y.call(this)||this;return P.tolerance=n,P.maxExtent=u,P.pixelRatio=s,P.maxLineWidth=0,P.resolution=r,P.beginGeometryInstruction1_=null,P.beginGeometryInstruction2_=null,P.bufferedMaxExtent_=null,P.instructions=[],P.coordinates=[],P.tmpCoordinate_=[],P.hitDetectionInstructions=[],P.state={},P}return p.prototype.applyPixelRatio=function(n){var u=this.pixelRatio;return u==1?n:n.map(function(r){return r*u})},p.prototype.appendFlatPointCoordinates=function(n,u){for(var r=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,P=this.coordinates,z=P.length,F=0,N=n.length;F<N;F+=u)s[0]=n[F],s[1]=n[F+1],Kp(r,s)&&(P[z++]=s[0],P[z++]=s[1]);return z},p.prototype.appendFlatLineCoordinates=function(n,u,r,s,P,z){var F=this.coordinates,N=F.length,V=this.getBufferedMaxExtent();z&&(u+=s);var me=n[u],_e=n[u+1],Se=this.tmpCoordinate_,Ne=!0,Je,Ce,Ue;for(Je=u+s;Je<r;Je+=s)Se[0]=n[Je],Se[1]=n[Je+1],Ue=Um(V,Se),Ue!==Ce?(Ne&&(F[N++]=me,F[N++]=_e,Ne=!1),F[N++]=Se[0],F[N++]=Se[1]):Ue===ko.INTERSECTING?(F[N++]=Se[0],F[N++]=Se[1],Ne=!1):Ne=!0,me=Se[0],_e=Se[1],Ce=Ue;return(P&&Ne||Je===u+s)&&(F[N++]=me,F[N++]=_e),N},p.prototype.drawCustomCoordinates_=function(n,u,r,s,P){for(var z=0,F=r.length;z<F;++z){var N=r[z],V=this.appendFlatLineCoordinates(n,u,N,s,!1,!1);P.push(V),u=N}return u},p.prototype.drawCustom=function(n,u,r,s){this.beginGeometry(n,u);var P=n.getType(),z=n.getStride(),F=this.coordinates.length,N,V,me,_e,Se;switch(P){case Mt.MULTI_POLYGON:N=n.getOrientedFlatCoordinates(),_e=[];var Ne=n.getEndss();Se=0;for(var Je=0,Ce=Ne.length;Je<Ce;++Je){var Ue=[];Se=this.drawCustomCoordinates_(N,Se,Ne[Je],z,Ue),_e.push(Ue)}this.instructions.push([qr.CUSTOM,F,_e,n,r,pd]),this.hitDetectionInstructions.push([qr.CUSTOM,F,_e,n,s||r,pd]);break;case Mt.POLYGON:case Mt.MULTI_LINE_STRING:me=[],N=P==Mt.POLYGON?n.getOrientedFlatCoordinates():n.getFlatCoordinates(),Se=this.drawCustomCoordinates_(N,0,n.getEnds(),z,me),this.instructions.push([qr.CUSTOM,F,me,n,r,ph]),this.hitDetectionInstructions.push([qr.CUSTOM,F,me,n,s||r,ph]);break;case Mt.LINE_STRING:case Mt.CIRCLE:N=n.getFlatCoordinates(),V=this.appendFlatLineCoordinates(N,0,N.length,z,!1,!1),this.instructions.push([qr.CUSTOM,F,V,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r,vl]);break;case Mt.MULTI_POINT:N=n.getFlatCoordinates(),V=this.appendFlatPointCoordinates(N,z),V>F&&(this.instructions.push([qr.CUSTOM,F,V,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r,vl]));break;case Mt.POINT:N=n.getFlatCoordinates(),this.coordinates.push(N[0],N[1]),V=this.coordinates.length,this.instructions.push([qr.CUSTOM,F,V,n,r]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r]);break;default:}this.endGeometry(u)},p.prototype.beginGeometry=function(n,u){this.beginGeometryInstruction1_=[qr.BEGIN_GEOMETRY,u,0,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[qr.BEGIN_GEOMETRY,u,0,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},p.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},p.prototype.reverseHitDetectionInstructions=function(){var n=this.hitDetectionInstructions;n.reverse();var u,r=n.length,s,P,z=-1;for(u=0;u<r;++u)s=n[u],P=s[0],P==qr.END_GEOMETRY?z=u:P==qr.BEGIN_GEOMETRY&&(s[2]=u,xv(this.hitDetectionInstructions,z,u),z=-1)},p.prototype.setFillStrokeStyle=function(n,u){var r=this.state;if(n){var s=n.getColor();r.fillStyle=Ts(s||Ss)}else r.fillStyle=void 0;if(u){var P=u.getColor();r.strokeStyle=Ts(P||fc);var z=u.getLineCap();r.lineCap=z!==void 0?z:Qh;var F=u.getLineDash();r.lineDash=F?F.slice():cc;var N=u.getLineDashOffset();r.lineDashOffset=N||hc;var V=u.getLineJoin();r.lineJoin=V!==void 0?V:Iu;var me=u.getWidth();r.lineWidth=me!==void 0?me:mc;var _e=u.getMiterLimit();r.miterLimit=_e!==void 0?_e:pc,r.lineWidth>this.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},p.prototype.createFill=function(n){var u=n.fillStyle,r=[qr.SET_FILL_STYLE,u];return typeof u!="string"&&r.push(!0),r},p.prototype.applyStroke=function(n){this.instructions.push(this.createStroke(n))},p.prototype.createStroke=function(n){return[qr.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth*this.pixelRatio,n.lineCap,n.lineJoin,n.miterLimit,this.applyPixelRatio(n.lineDash),n.lineDashOffset*this.pixelRatio]},p.prototype.updateFillStyle=function(n,u){var r=n.fillStyle;(typeof r!="string"||n.currentFillStyle!=r)&&(r!==void 0&&this.instructions.push(u.call(this,n)),n.currentFillStyle=r)},p.prototype.updateStrokeStyle=function(n,u){var r=n.strokeStyle,s=n.lineCap,P=n.lineDash,z=n.lineDashOffset,F=n.lineJoin,N=n.lineWidth,V=n.miterLimit;(n.currentStrokeStyle!=r||n.currentLineCap!=s||P!=n.currentLineDash&&!_s(n.currentLineDash,P)||n.currentLineDashOffset!=z||n.currentLineJoin!=F||n.currentLineWidth!=N||n.currentMiterLimit!=V)&&(r!==void 0&&u.call(this,n),n.currentStrokeStyle=r,n.currentLineCap=s,n.currentLineDash=P,n.currentLineDashOffset=z,n.currentLineJoin=F,n.currentLineWidth=N,n.currentMiterLimit=V)},p.prototype.endGeometry=function(n){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var u=[qr.END_GEOMETRY,n];this.instructions.push(u),this.hitDetectionInstructions.push(u)},p.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Zv(this.maxExtent),this.maxLineWidth>0)){var n=this.resolution*(this.maxLineWidth+1)/2;yl(this.bufferedMaxExtent_,n,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},p}(og),Au=Dw;var Ow=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Fw=function(y){Ow(p,y);function p(n,u,r,s){var P=y.call(this,n,u,r,s)||this;return P.hitDetectionImage_=null,P.image_=null,P.imagePixelRatio_=void 0,P.anchorX_=void 0,P.anchorY_=void 0,P.height_=void 0,P.opacity_=void 0,P.originX_=void 0,P.originY_=void 0,P.rotateWithView_=void 0,P.rotation_=void 0,P.scale_=void 0,P.width_=void 0,P.declutterImageWithText_=void 0,P}return p.prototype.drawPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,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.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},p.prototype.drawMultiPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,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.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},p.prototype.finish=function(){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,y.prototype.finish.call(this)},p.prototype.setImageStyle=function(n,u){var r=n.getAnchor(),s=n.getSize(),P=n.getHitDetectionImage(),z=n.getImage(this.pixelRatio),F=n.getOrigin();this.imagePixelRatio_=n.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=P,this.image_=z,this.height_=s[1],this.opacity_=n.getOpacity(),this.originX_=F[0]*this.imagePixelRatio_,this.originY_=F[1]*this.imagePixelRatio_,this.rotateWithView_=n.getRotateWithView(),this.rotation_=n.getRotation(),this.scale_=n.getScaleArray(),this.width_=s[0],this.declutterImageWithText_=u},p}(Au),Yx=Fw;var Bw=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Uw=function(y){Bw(p,y);function p(n,u,r,s){return y.call(this,n,u,r,s)||this}return p.prototype.drawFlatCoordinates_=function(n,u,r,s){var P=this.coordinates.length,z=this.appendFlatLineCoordinates(n,u,r,s,!1,!1),F=[qr.MOVE_TO_LINE_TO,P,z];return this.instructions.push(F),this.hitDetectionInstructions.push(F),r},p.prototype.drawLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,cc,hc],gc);var z=n.getFlatCoordinates(),F=n.getStride();this.drawFlatCoordinates_(z,0,z.length,F),this.hitDetectionInstructions.push(Cu),this.endGeometry(u)}},p.prototype.drawMultiLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],gc);for(var z=n.getEnds(),F=n.getFlatCoordinates(),N=n.getStride(),V=0,me=0,_e=z.length;me<_e;++me)V=this.drawFlatCoordinates_(F,V,z[me],N);this.hitDetectionInstructions.push(Cu),this.endGeometry(u)}},p.prototype.finish=function(){var n=this.state;return n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&this.instructions.push(Cu),this.reverseHitDetectionInstructions(),this.state=null,y.prototype.finish.call(this)},p.prototype.applyStroke=function(n){n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&(this.instructions.push(Cu),n.lastStroke=this.coordinates.length),n.lastStroke=0,y.prototype.applyStroke.call(this,n),this.instructions.push(gc)},p}(Au),Jx=Uw;var Nw=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Vw=function(y){Nw(p,y);function p(n,u,r,s){return y.call(this,n,u,r,s)||this}return p.prototype.drawFlatCoordinatess_=function(n,u,r,s){var P=this.state,z=P.fillStyle!==void 0,F=P.strokeStyle!==void 0,N=r.length;this.instructions.push(gc),this.hitDetectionInstructions.push(gc);for(var V=0;V<N;++V){var me=r[V],_e=this.coordinates.length,Se=this.appendFlatLineCoordinates(n,u,me,s,!0,!F),Ne=[qr.MOVE_TO_LINE_TO,_e,Se];this.instructions.push(Ne),this.hitDetectionInstructions.push(Ne),F&&(this.instructions.push(l_),this.hitDetectionInstructions.push(l_)),u=me}return z&&(this.instructions.push(yd),this.hitDetectionInstructions.push(yd)),F&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),u},p.prototype.drawCircle=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getFlatCoordinates(),F=n.getStride(),N=this.coordinates.length;this.appendFlatLineCoordinates(z,0,z.length,F,!1,!1);var V=[qr.CIRCLE,N];this.instructions.push(gc,V),this.hitDetectionInstructions.push(gc,V),r.fillStyle!==void 0&&(this.instructions.push(yd),this.hitDetectionInstructions.push(yd)),r.strokeStyle!==void 0&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),this.endGeometry(u)}},p.prototype.drawPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getEnds(),F=n.getOrientedFlatCoordinates(),N=n.getStride();this.drawFlatCoordinatess_(F,0,z,N),this.endGeometry(u)}},p.prototype.drawMultiPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);for(var z=n.getEndss(),F=n.getOrientedFlatCoordinates(),N=n.getStride(),V=0,me=0,_e=z.length;me<_e;++me)V=this.drawFlatCoordinatess_(F,V,z[me],N);this.endGeometry(u)}},p.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var n=this.tolerance;if(n!==0)for(var u=this.coordinates,r=0,s=u.length;r<s;++r)u[r]=hh(u[r],n);return y.prototype.finish.call(this)},p.prototype.setFillStrokeStyles_=function(){var n=this.state,u=n.fillStyle;u!==void 0&&this.updateFillStyle(n,this.createFill),n.strokeStyle!==void 0&&this.updateStrokeStyle(n,this.applyStroke)},p}(Au),u_=Vw;function Qx(y,p,n,u,r){var s=n,P=n,z=0,F=0,N=n,V,me,_e,Se,Ne,Je,Ce,Ue,Ye,rt;for(me=n;me<u;me+=r){var _t=p[me],dt=p[me+1];Ne!==void 0&&(Ye=_t-Ne,rt=dt-Je,Se=Math.sqrt(Ye*Ye+rt*rt),Ce!==void 0&&(F+=_e,V=Math.acos((Ce*Ye+Ue*rt)/(_e*Se)),V>y&&(F>z&&(z=F,s=N,P=me),F=0,N=me-r)),_e=Se,Ce=Ye,Ue=rt),Ne=_t,Je=dt}return F+=Se,F>z?[N,me]:[s,P]}var Gw=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),_d={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},jw=function(y){Gw(p,y);function p(n,u,r,s){var P=y.call(this,n,u,r,s)||this;return P.labels_=null,P.text_="",P.textOffsetX_=0,P.textOffsetY_=0,P.textRotateWithView_=void 0,P.textRotation_=0,P.textFillState_=null,P.fillStates={},P.textStrokeState_=null,P.strokeStates={},P.textState_={},P.textStates={},P.textKey_="",P.fillKey_="",P.strokeKey_="",P.declutterImageWithText_=void 0,P}return p.prototype.finish=function(){var n=y.prototype.finish.call(this);return n.textStates=this.textStates,n.fillStates=this.fillStates,n.strokeStates=this.strokeStates,n},p.prototype.drawText=function(n,u){var r=this.textFillState_,s=this.textStrokeState_,P=this.textState_;if(!(this.text_===""||!P||!r&&!s)){var z=this.coordinates,F=z.length,N=n.getType(),V=null,me=n.getStride();if(P.placement===Xx.LINE&&(N==Mt.LINE_STRING||N==Mt.MULTI_LINE_STRING||N==Mt.POLYGON||N==Mt.MULTI_POLYGON)){if(!Lo(this.getBufferedMaxExtent(),n.getExtent()))return;var _e=void 0;if(V=n.getFlatCoordinates(),N==Mt.LINE_STRING)_e=[V.length];else if(N==Mt.MULTI_LINE_STRING)_e=n.getEnds();else if(N==Mt.POLYGON)_e=n.getEnds().slice(0,1);else if(N==Mt.MULTI_POLYGON){var Se=n.getEndss();_e=[];for(var Ne=0,Je=Se.length;Ne<Je;++Ne)_e.push(Se[Ne][0])}this.beginGeometry(n,u);for(var Ce=P.textAlign,Ue=0,Ye=void 0,rt=0,_t=_e.length;rt<_t;++rt){if(Ce==null){var dt=Qx(P.maxAngle,V,Ue,_e[rt],me);Ue=dt[0],Ye=dt[1]}else Ye=_e[rt];for(var Ne=Ue;Ne<Ye;Ne+=me)z.push(V[Ne],V[Ne+1]);var ht=z.length;Ue=_e[rt],this.drawChars_(F,ht),F=ht}this.endGeometry(u)}else{var Tt=P.overflow?null:[];switch(N){case Mt.POINT:case Mt.MULTI_POINT:V=n.getFlatCoordinates();break;case Mt.LINE_STRING:V=n.getFlatMidpoint();break;case Mt.CIRCLE:V=n.getCenter();break;case Mt.MULTI_LINE_STRING:V=n.getFlatMidpoints(),me=2;break;case Mt.POLYGON:V=n.getFlatInteriorPoint(),P.overflow||Tt.push(V[2]/this.resolution),me=3;break;case Mt.MULTI_POLYGON:var It=n.getFlatInteriorPoints();V=[];for(var Ne=0,Je=It.length;Ne<Je;Ne+=3)P.overflow||Tt.push(It[Ne+2]/this.resolution),V.push(It[Ne],It[Ne+1]);if(V.length===0)return;me=2;break;default:}var ht=this.appendFlatPointCoordinates(V,me);if(ht===F)return;if(Tt&&(ht-F)/2!==V.length/me){var Lt=F/2;Tt=Tt.filter(function(_r,Er){var br=z[(Lt+Er)*2]===V[Er*me]&&z[(Lt+Er)*2+1]===V[Er*me+1];return br||--Lt,br})}this.saveTextStates_(),(P.backgroundFill||P.backgroundStroke)&&(this.setFillStrokeStyle(P.backgroundFill,P.backgroundStroke),P.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),P.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(n,u);var er=P.padding;if(er!=dc&&(P.scale[0]<0||P.scale[1]<0)){var Nt=P.padding[0],Qt=P.padding[1],hr=P.padding[2],Pt=P.padding[3];P.scale[0]<0&&(Qt=-Qt,Pt=-Pt),P.scale[1]<0&&(Nt=-Nt,hr=-hr),er=[Nt,Qt,hr,Pt]}var Ar=this.pixelRatio;this.instructions.push([qr.DRAW_IMAGE,F,ht,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterImageWithText_,er==dc?dc:er.map(function(_r){return _r*Ar}),!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]);var Sr=1/Ar;this.hitDetectionInstructions.push([qr.DRAW_IMAGE,F,ht,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[Sr,Sr],NaN,this.declutterImageWithText_,er,!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]),this.endGeometry(u)}}},p.prototype.saveTextStates_=function(){var n=this.textStrokeState_,u=this.textState_,r=this.textFillState_,s=this.strokeKey_;n&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:n.strokeStyle,lineCap:n.lineCap,lineDashOffset:n.lineDashOffset,lineWidth:n.lineWidth,lineJoin:n.lineJoin,miterLimit:n.miterLimit,lineDash:n.lineDash}));var P=this.textKey_;P in this.textStates||(this.textStates[P]={font:u.font,textAlign:u.textAlign||mh,textBaseline:u.textBaseline||ep,scale:u.scale});var z=this.fillKey_;r&&(z in this.fillStates||(this.fillStates[z]={fillStyle:r.fillStyle}))},p.prototype.drawChars_=function(n,u){var r=this.textStrokeState_,s=this.textState_,P=this.strokeKey_,z=this.textKey_,F=this.fillKey_;this.saveTextStates_();var N=this.pixelRatio,V=_d[s.textBaseline],me=this.textOffsetY_*N,_e=this.text_,Se=r?r.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([qr.DRAW_CHARS,n,u,V,s.overflow,F,s.maxAngle,N,me,P,Se*N,_e,z,1]),this.hitDetectionInstructions.push([qr.DRAW_CHARS,n,u,V,s.overflow,F,s.maxAngle,1,me,P,Se,_e,z,1/N])},p.prototype.setTextStyle=function(n,u){var r,s,P;if(!n)this.text_="";else{var z=n.getFill();z?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=Ts(z.getColor()||Ss)):(s=null,this.textFillState_=s);var F=n.getStroke();if(!F)P=null,this.textStrokeState_=P;else{P=this.textStrokeState_,P||(P={},this.textStrokeState_=P);var N=F.getLineDash(),V=F.getLineDashOffset(),me=F.getWidth(),_e=F.getMiterLimit();P.lineCap=F.getLineCap()||Qh,P.lineDash=N?N.slice():cc,P.lineDashOffset=V===void 0?hc:V,P.lineJoin=F.getLineJoin()||Iu,P.lineWidth=me===void 0?mc:me,P.miterLimit=_e===void 0?pc:_e,P.strokeStyle=Ts(F.getColor()||fc)}r=this.textState_;var Se=n.getFont()||ng;Bx(Se);var Ne=n.getScaleArray();r.overflow=n.getOverflow(),r.font=Se,r.maxAngle=n.getMaxAngle(),r.placement=n.getPlacement(),r.textAlign=n.getTextAlign(),r.textBaseline=n.getTextBaseline()||ep,r.backgroundFill=n.getBackgroundFill(),r.backgroundStroke=n.getBackgroundStroke(),r.padding=n.getPadding()||dc,r.scale=Ne===void 0?[1,1]:Ne;var Je=n.getOffsetX(),Ce=n.getOffsetY(),Ue=n.getRotateWithView(),Ye=n.getRotation();this.text_=n.getText()||"",this.textOffsetX_=Je===void 0?0:Je,this.textOffsetY_=Ce===void 0?0:Ce,this.textRotateWithView_=Ue===void 0?!1:Ue,this.textRotation_=Ye===void 0?0:Ye,this.strokeKey_=P?(typeof P.strokeStyle=="string"?P.strokeStyle:Pi(P.strokeStyle))+P.lineCap+P.lineDashOffset+"|"+P.lineWidth+P.lineJoin+P.miterLimit+"["+P.lineDash.join()+"]":"",this.textKey_=r.font+r.scale+(r.textAlign||"?")+(r.textBaseline||"?"),this.fillKey_=s?typeof s.fillStyle=="string"?s.fillStyle:"|"+Pi(s.fillStyle):""}this.declutterImageWithText_=u},p}(Au),e0=jw;var qw={Circle:u_,Default:Au,Image:Yx,LineString:Jx,Polygon:u_,Text:e0},Zw=function(){function y(p,n,u,r){this.tolerance_=p,this.maxExtent_=n,this.pixelRatio_=r,this.resolution_=u,this.buildersByZIndex_={}}return y.prototype.finish=function(){var p={};for(var n in this.buildersByZIndex_){p[n]=p[n]||{};var u=this.buildersByZIndex_[n];for(var r in u){var s=u[r].finish();p[n][r]=s}}return p},y.prototype.getBuilder=function(p,n){var u=p!==void 0?p.toString():"0",r=this.buildersByZIndex_[u];r===void 0&&(r={},this.buildersByZIndex_[u]=r);var s=r[n];if(s===void 0){var P=qw[n];s=new P(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[n]=s}return s},y}(),c_=Zw;var Ww=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Xw=function(y){Ww(p,y);function p(n){var u=y.call(this)||this;return u.ready=!0,u.boundHandleImageChange_=u.handleImageChange_.bind(u),u.layer_=n,u.declutterExecutorGroup=null,u}return p.prototype.getFeatures=function(n){return jr()},p.prototype.getData=function(n){return null},p.prototype.prepareFrame=function(n){return jr()},p.prototype.renderFrame=function(n,u){return jr()},p.prototype.loadedTileCallback=function(n,u,r){n[u]||(n[u]={}),n[u][r.tileCoord.toString()]=r},p.prototype.createLoadedTileFinder=function(n,u,r){return function(s,P){var z=this.loadedTileCallback.bind(this,r,s);return n.forEachLoadedTile(u,s,P,z)}.bind(this)},p.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){},p.prototype.getDataAtPixel=function(n,u,r){return null},p.prototype.getLayer=function(){return this.layer_},p.prototype.handleFontsChanged=function(){},p.prototype.handleImageChange_=function(n){var u=n.target;u.getState()===Wi.LOADED&&this.renderIfReadyAndVisible()},p.prototype.loadImage=function(n){var u=n.getState();return u!=Wi.LOADED&&u!=Wi.ERROR&&n.addEventListener(Qi.CHANGE,this.boundHandleImageChange_),u==Wi.IDLE&&(n.load(),u=n.getState()),u==Wi.LOADED},p.prototype.renderIfReadyAndVisible=function(){var n=this.getLayer();n.getVisible()&&n.getSourceState()==Su.READY&&n.changed()},p.prototype.disposeInternal=function(){delete this.layer_,y.prototype.disposeInternal.call(this)},p}(km),t0=Xw;var $w=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Kw=function(y){$w(p,y);function p(n,u,r,s){var P=y.call(this,n)||this;return P.inversePixelTransform=u,P.frameState=r,P.context=s,P}return p}(sn),r0=Kw;var Hw=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vd=null;function Yw(){var y=document.createElement("canvas");y.width=1,y.height=1,vd=y.getContext("2d")}var Jw=function(y){Hw(p,y);function p(n){var u=y.call(this,n)||this;return u.container=null,u.renderedResolution,u.tempTransform=za(),u.pixelTransform=za(),u.inversePixelTransform=za(),u.context=null,u.containerReused=!1,u.pixelContext_=null,u.frameState=null,u}return p.prototype.getImageData=function(n,u,r){vd||Yw(),vd.clearRect(0,0,1,1);var s;try{vd.drawImage(n,u,r,1,1,0,0,1,1),s=vd.getImageData(0,0,1,1).data}catch{return null}return s},p.prototype.getBackground=function(n){var u=this.getLayer(),r=u.getBackground();return typeof r=="function"&&(r=r(n.viewState.resolution)),r||void 0},p.prototype.useContainer=function(n,u,r,s){var P=this.getLayer().getClassName(),z,F;if(n&&n.className===P&&n.style.opacity===""&&r===1&&(!s||n.style.backgroundColor&&_s(Jh(n.style.backgroundColor),Jh(s)))){var N=n.firstElementChild;N instanceof HTMLCanvasElement&&(F=N.getContext("2d"))}if(F&&F.canvas.style.transform===u?(this.container=n,this.context=F,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){z=document.createElement("div"),z.className=P;var V=z.style;V.position="absolute",V.width="100%",V.height="100%",s&&(V.backgroundColor=s),F=Ja();var N=F.canvas;z.appendChild(N),V=N.style,V.position="absolute",V.left="0",V.transformOrigin="top left",this.container=z,this.context=F}},p.prototype.clipUnrotated=function(n,u,r){var s=by(r),P=wy(r),z=xy(r),F=vy(r);bo(u.coordinateToPixelTransform,s),bo(u.coordinateToPixelTransform,P),bo(u.coordinateToPixelTransform,z),bo(u.coordinateToPixelTransform,F);var N=this.inversePixelTransform;bo(N,s),bo(N,P),bo(N,z),bo(N,F),n.save(),n.beginPath(),n.moveTo(Math.round(s[0]),Math.round(s[1])),n.lineTo(Math.round(P[0]),Math.round(P[1])),n.lineTo(Math.round(z[0]),Math.round(z[1])),n.lineTo(Math.round(F[0]),Math.round(F[1])),n.clip()},p.prototype.dispatchRenderEvent_=function(n,u,r){var s=this.getLayer();if(s.hasListener(n)){var P=new r0(n,this.inversePixelTransform,r,u);s.dispatchEvent(P)}},p.prototype.preRender=function(n,u){this.frameState=u,this.dispatchRenderEvent_(od.PRERENDER,n,u)},p.prototype.postRender=function(n,u){this.dispatchRenderEvent_(od.POSTRENDER,n,u)},p.prototype.getRenderTransform=function(n,u,r,s,P,z,F){var N=P/2,V=z/2,me=s/u,_e=-me,Se=-n[0]+F,Ne=-n[1];return vs(this.tempTransform,N,V,me,_e,-r,Se,Ne)},p.prototype.getDataAtPixel=function(n,u,r){var s=bo(this.inversePixelTransform,n.slice()),P=this.context,z=this.getLayer(),F=z.getExtent();if(F){var N=bo(u.pixelToCoordinateTransform,n.slice());if(!Kp(F,N))return null}var V=Math.round(s[0]),me=Math.round(s[1]),_e=this.pixelContext_;if(!_e){var Se=document.createElement("canvas");Se.width=1,Se.height=1,_e=Se.getContext("2d"),this.pixelContext_=_e}_e.clearRect(0,0,1,1);var Ne;try{_e.drawImage(P.canvas,V,me,1,1,0,0,1,1),Ne=_e.getImageData(0,0,1,1).data}catch(Je){return Je.name==="SecurityError"?(this.pixelContext_=null,new Uint8Array):Ne}return Ne[3]===0?null:Ne},p.prototype.disposeInternal=function(){delete this.frameState,y.prototype.disposeInternal.call(this)},p}(t0),i0=Jw;var Dn={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function n0(y,p,n,u,r,s,P,z,F,N,V,me){var _e=y[p],Se=y[p+1],Ne=0,Je=0,Ce=0,Ue=0;function Ye(){Ne=_e,Je=Se,p+=u,_e=y[p],Se=y[p+1],Ue+=Ce,Ce=Math.sqrt((_e-Ne)*(_e-Ne)+(Se-Je)*(Se-Je))}do Ye();while(p<n-u&&Ue+Ce<s);for(var rt=Ce===0?0:(s-Ue)/Ce,_t=gl(Ne,_e,rt),dt=gl(Je,Se,rt),ht=p-u,Tt=Ue,It=s+z*F(N,r,V);p<n-u&&Ue+Ce<It;)Ye();rt=Ce===0?0:(It-Ue)/Ce;var Lt=gl(Ne,_e,rt),er=gl(Je,Se,rt),Nt;if(me){var Qt=[_t,dt,Lt,er];$m(Qt,0,4,2,me,Qt,Qt),Nt=Qt[0]>Qt[2]}else Nt=_t>Lt;var hr=Math.PI,Pt=[],Ar=ht+u===p;p=ht,Ce=0,Ue=Tt,_e=y[p],Se=y[p+1];var Sr;if(Ar){Ye(),Sr=Math.atan2(Se-Je,_e-Ne),Nt&&(Sr+=Sr>0?-hr:hr);var Dr=(Lt+_t)/2,_r=(er+dt)/2;return Pt[0]=[Dr,_r,(It-s)/2,Sr,r],Pt}for(var Er=0,br=r.length;Er<br;){Ye();var si=Math.atan2(Se-Je,_e-Ne);if(Nt&&(si+=si>0?-hr:hr),Sr!==void 0){var Gt=si-Sr;if(Gt+=Gt>hr?-2*hr:Gt<-hr?2*hr:0,Math.abs(Gt)>P)return null}Sr=si;for(var ei=Er,bi=0;Er<br;++Er){var ti=Nt?br-Er-1:Er,zi=z*F(N,r[ti],V);if(p+u<n&&Ue+Ce<s+bi+zi/2)break;bi+=zi}if(Er!==ei){var Vr=Nt?r.substring(br-ei,br-Er):r.substring(ei,Er);rt=Ce===0?0:(s+bi/2-Ue)/Ce;var Dr=gl(Ne,_e,rt),_r=gl(Je,Se,rt);Pt.push([Dr,_r,bi/2,si,Vr]),s+=bi}}return Pt}var uf=Ya(),gh=[],yc=[],_c=[],yh=[];function o0(y){return y[3].declutterBox}var Qw=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function a0(y,p){return(p==="start"||p==="end")&&!Qw.test(y)&&(p=p==="start"?"left":"right"),_d[p]}function e2(y,p,n){return n>0&&y.push(`
1080
1080
  `,""),y.push(p,""),y}var t2=function(){function y(p,n,u,r){this.overlaps=u,this.pixelRatio=n,this.resolution=p,this.alignFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=za(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={}}return y.prototype.createLabel=function(p,n,u,r){var s=p+n+u+r;if(this.labels_[s])return this.labels_[s];var P=r?this.strokeStates[r]:null,z=u?this.fillStates[u]:null,F=this.textStates[n],N=this.pixelRatio,V=[F.scale[0]*N,F.scale[1]*N],me=Array.isArray(p),_e=a0(me?p[0]:p,F.textAlign||mh),Se=r&&P.lineWidth?P.lineWidth:0,Ne=me?p:p.split(`
1081
1081
  `).reduce(e2,[]),Je=Nx(F,Ne),Ce=Je.width,Ue=Je.height,Ye=Je.widths,rt=Je.heights,_t=Je.lineWidths,dt=Ce+Se,ht=[],Tt=(dt+2)*V[0],It=(Ue+Se)*V[1],Lt={width:Tt<0?Math.floor(Tt):Math.ceil(Tt),height:It<0?Math.floor(It):Math.ceil(It),contextInstructions:ht};if((V[0]!=1||V[1]!=1)&&ht.push("scale",V),r){ht.push("strokeStyle",P.strokeStyle),ht.push("lineWidth",Se),ht.push("lineCap",P.lineCap),ht.push("lineJoin",P.lineJoin),ht.push("miterLimit",P.miterLimit);var er=ah?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D;er.prototype.setLineDash&&(ht.push("setLineDash",[P.lineDash]),ht.push("lineDashOffset",P.lineDashOffset))}u&&ht.push("fillStyle",z.fillStyle),ht.push("textBaseline","middle"),ht.push("textAlign","center");for(var Nt=.5-_e,Qt=_e*dt+Nt*Se,hr=[],Pt=[],Ar=0,Sr=0,Dr=0,_r=0,Er,br=0,si=Ne.length;br<si;br+=2){var Gt=Ne[br];if(Gt===`
1082
- `){Sr+=Ar,Ar=0,Qt=_e*dt+Nt*Se,++_r;continue}var ei=Ne[br+1]||F.font;ei!==Er&&(r&&hr.push("font",ei),u&&Pt.push("font",ei),Er=ei),Ar=Math.max(Ar,rt[Dr]);var bi=[Gt,Qt+Nt*Ye[Dr]+_e*(Ye[Dr]-_t[_r]),.5*(Se+Ar)+Sr];Qt+=Ye[Dr],r&&hr.push("strokeText",bi),u&&Pt.push("fillText",bi),++Dr}return Array.prototype.push.apply(ht,hr),Array.prototype.push.apply(ht,Pt),this.labels_[s]=Lt,Lt},y.prototype.replayTextBackground_=function(p,n,u,r,s,P,z){p.beginPath(),p.moveTo.apply(p,n),p.lineTo.apply(p,u),p.lineTo.apply(p,r),p.lineTo.apply(p,s),p.lineTo.apply(p,n),P&&(this.alignFill_=P[2],this.fill_(p)),z&&(this.setStrokeStyle_(p,z),p.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(p,n,u,r,s,P,z,F,N,V,me,_e,Se,Ne,Je,Ce){z*=_e[0],F*=_e[1];var Ue=u-z,Ye=r-F,rt=s+N>p?p-N:s,_t=P+V>n?n-V:P,dt=Ne[3]+rt*_e[0]+Ne[1],ht=Ne[0]+_t*_e[1]+Ne[2],Tt=Ue-Ne[3],It=Ye-Ne[0];(Je||me!==0)&&(gh[0]=Tt,yh[0]=Tt,gh[1]=It,yc[1]=It,yc[0]=Tt+dt,_c[0]=yc[0],_c[1]=It+ht,yh[1]=_c[1]);var Lt;return me!==0?(Lt=vs(za(),u,r,1,1,me,-u,-r),bo(Lt,gh),bo(Lt,yc),bo(Lt,_c),bo(Lt,yh),sh(Math.min(gh[0],yc[0],_c[0],yh[0]),Math.min(gh[1],yc[1],_c[1],yh[1]),Math.max(gh[0],yc[0],_c[0],yh[0]),Math.max(gh[1],yc[1],_c[1],yh[1]),uf)):sh(Math.min(Tt,Tt+dt),Math.min(It,It+ht),Math.max(Tt,Tt+dt),Math.max(It,It+ht),uf),Se&&(Ue=Math.round(Ue),Ye=Math.round(Ye)),{drawImageX:Ue,drawImageY:Ye,drawImageW:rt,drawImageH:_t,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ce},canvasTransform:Lt,scale:_e}},y.prototype.replayImageOrLabel_=function(p,n,u,r,s,P,z){var F=!!(P||z),N=r.declutterBox,V=p.canvas,me=z?z[2]*r.scale[0]/2:0,_e=N.minX-me<=V.width/n&&N.maxX+me>=0&&N.minY-me<=V.height/n&&N.maxY+me>=0;return _e&&(F&&this.replayTextBackground_(p,gh,yc,_c,yh,P,z),Vx(p,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(p){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;p.save(),p.translate(n[0]%u,n[1]%u),p.rotate(this.viewRotation_)}p.fill(),this.alignFill_&&p.restore()},y.prototype.setStrokeStyle_=function(p,n){p.strokeStyle=n[1],p.lineWidth=n[2],p.lineCap=n[3],p.lineJoin=n[4],p.miterLimit=n[5],p.setLineDash&&(p.lineDashOffset=n[7],p.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(p,n,u,r){var s=this.textStates[n],P=this.createLabel(p,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,N=a0(Array.isArray(p)?p[0]:p,s.textAlign||mh),V=_d[s.textBaseline||ep],me=z&&z.lineWidth?z.lineWidth:0,_e=P.width/F-2*s.scale[0],Se=N*_e+2*(.5-N)*me,Ne=V*P.height/F+2*(.5-V)*me;return{label:P,anchorX:Se,anchorY:Ne}},y.prototype.execute_=function(p,n,u,r,s,P,z,F){var N;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),kv(this.renderedTransform_,u));for(var V=0,me=r.length,_e=0,Se,Ne,Je,Ce,Ue,Ye,rt,_t,dt,ht,Tt,It,Lt=0,er=0,Nt=null,Qt=null,hr=this.coordinateCache_,Pt=this.viewRotation_,Ar=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,Sr={context:p,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Pt},Dr=this.instructions!=r||this.overlaps?0:200,_r,Er,br,si;V<me;){var Gt=r[V],ei=Gt[0];switch(ei){case qr.BEGIN_GEOMETRY:_r=Gt[1],si=Gt[3],_r.getGeometry()?z!==void 0&&!Lo(z,si.getExtent())?V=Gt[2]+1:++V:V=Gt[2];break;case qr.BEGIN_PATH:Lt>Dr&&(this.fill_(p),Lt=0),er>Dr&&(p.stroke(),er=0),!Lt&&!er&&(p.beginPath(),Ce=NaN,Ue=NaN),++V;break;case qr.CIRCLE:_e=Gt[1];var bi=N[_e],ti=N[_e+1],zi=N[_e+2],Vr=N[_e+3],Pn=zi-bi,to=Vr-ti,vi=Math.sqrt(Pn*Pn+to*to);p.moveTo(bi+vi,ti),p.arc(bi,ti,vi,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:p.closePath(),++V;break;case qr.CUSTOM:_e=Gt[1],Se=Gt[2];var Ir=Gt[3],On=Gt[4],Mi=Gt.length==6?Gt[5]:void 0;Sr.geometry=Ir,Sr.feature=_r,V in hr||(hr[V]=[]);var Gi=hr[V];Mi?Mi(N,_e,Se,2,Gi):(Gi[0]=N[_e],Gi[1]=N[_e+1],Gi.length=2),On(Gi,Sr),++V;break;case qr.DRAW_IMAGE:_e=Gt[1],Se=Gt[2],_t=Gt[3],Ne=Gt[4],Je=Gt[5];var qo=Gt[6],Wn=Gt[7],Yr=Gt[8],ln=Gt[9],Xn=Gt[10],$n=Gt[11],Fn=Gt[12],Xi=Gt[13],mn=Gt[14];if(!_t&&Gt.length>=19){dt=Gt[18],ht=Gt[19],Tt=Gt[20],It=Gt[21];var En=this.drawLabelWithPointPlacement_(dt,ht,Tt,It);_t=En.label,Gt[3]=_t;var wo=Gt[22];Ne=(En.anchorX-wo)*this.pixelRatio,Gt[4]=Ne;var wt=Gt[23];Je=(En.anchorY-wt)*this.pixelRatio,Gt[5]=Je,qo=_t.height,Gt[6]=qo,Xi=_t.width,Gt[13]=Xi}var Xt=void 0;Gt.length>24&&(Xt=Gt[24]);var ho=void 0,gn=void 0,Wr=void 0;Gt.length>16?(ho=Gt[15],gn=Gt[16],Wr=Gt[17]):(ho=dc,gn=!1,Wr=!1),Xn&&Ar?$n+=Pt:!Xn&&!Ar&&($n-=Pt);for(var Mn=0;_e<Se;_e+=2)if(!(Xt&&Xt[Mn++]<Xi/this.pixelRatio)){var Bi=this.calculateImageOrLabelDimensions_(_t.width,_t.height,N[_e],N[_e+1],Xi,qo,Ne,Je,Yr,ln,$n,Fn,s,ho,gn||Wr,_r),fn=[p,n,_t,Bi,Wn,gn?Nt:null,Wr?Qt:null],Kn=void 0,Zt=void 0;if(F&&mn){var Ur=Se-_e;if(!mn[Ur]){mn[Ur]=fn;continue}if(Kn=mn[Ur],delete mn[Ur],Zt=o0(Kn),F.collides(Zt))continue}F&&F.collides(Bi.declutterBox)||(Kn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Kn)),F&&F.insert(Bi.declutterBox),this.replayImageOrLabel_.apply(this,fn))}++V;break;case qr.DRAW_CHARS:var Or=Gt[1],ji=Gt[2],Tn=Gt[3],Pr=Gt[4];It=Gt[5];var ro=Gt[6],$i=Gt[7],wi=Gt[8];Tt=Gt[9];var te=Gt[10];dt=Gt[11],ht=Gt[12];var he=[Gt[13],Gt[13]],de=this.textStates[ht],Te=de.font,Re=[de.scale[0]*$i,de.scale[1]*$i],Xe=void 0;Te in this.widths_?Xe=this.widths_[Te]:(Xe={},this.widths_[Te]=Xe);var Qe=eg(N,Or,ji,2),we=Math.abs(Re[0])*i_(Te,dt,Xe);if(Pr||we<=Qe){var Ve=this.textStates[ht].textAlign,ie=(Qe-we)*_d[Ve],W=n0(N,Or,ji,2,dt,ie,ro,Math.abs(Re[0]),i_,Te,Xe,Ar?0:this.viewRotation_);e:if(W){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=W.length;re<le;++re){ge=W[re],Ae=ge[4],ke=this.createLabel(Ae,ht,"",Tt),Ne=ge[2]+(Re[0]<0?-te:te),Je=Tn*ke.height+(.5-Tn)*2*te*Re[1]/Re[0]-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ne,Je,0,0,ge[3],he,!1,dc,!1,_r);if(F&&F.collides(Bi.declutterBox))break e;J.push([p,n,ke,Bi,1,null,null])}if(It)for(re=0,le=W.length;re<le;++re){ge=W[re],Ae=ge[4],ke=this.createLabel(Ae,ht,It,""),Ne=ge[2],Je=Tn*ke.height-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ne,Je,0,0,ge[3],he,!1,dc,!1,_r);if(F&&F.collides(Bi.declutterBox))break e;J.push([p,n,ke,Bi,1,null,null])}F&&F.load(J.map(o0));for(var Ie=0,Le=J.length;Ie<Le;++Ie)this.replayImageOrLabel_.apply(this,J[Ie])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){_r=Gt[1];var Ke=P(_r,si);if(Ke)return Ke}++V;break;case qr.FILL:Dr?Lt++:this.fill_(p),++V;break;case qr.MOVE_TO_LINE_TO:for(_e=Gt[1],Se=Gt[2],Er=N[_e],br=N[_e+1],Ye=Er+.5|0,rt=br+.5|0,(Ye!==Ce||rt!==Ue)&&(p.moveTo(Er,br),Ce=Ye,Ue=rt),_e+=2;_e<Se;_e+=2)Er=N[_e],br=N[_e+1],Ye=Er+.5|0,rt=br+.5|0,(_e==Se-2||Ye!==Ce||rt!==Ue)&&(p.lineTo(Er,br),Ce=Ye,Ue=rt);++V;break;case qr.SET_FILL_STYLE:Nt=Gt,this.alignFill_=Gt[2],Lt&&(this.fill_(p),Lt=0,er&&(p.stroke(),er=0)),p.fillStyle=Gt[1],++V;break;case qr.SET_STROKE_STYLE:Qt=Gt,er&&(p.stroke(),er=0),this.setStrokeStyle_(p,Gt),++V;break;case qr.STROKE:Dr?er++:p.stroke(),++V;break;default:++V;break}}Lt&&this.fill_(p),er&&p.stroke()},y.prototype.execute=function(p,n,u,r,s,P){this.viewRotation_=r,this.execute_(p,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(p,n,u,r,s){return this.viewRotation_=u,this.execute_(p,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),s0=t2;var h_=[Dn.POLYGON,Dn.CIRCLE,Dn.LINE_STRING,Dn.IMAGE,Dn.TEXT,Dn.DEFAULT],r2=function(){function y(p,n,u,r,s,P){this.maxExtent_=p,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(p,n){var u=this.getClipCoords(n);p.beginPath(),p.moveTo(u[0],u[1]),p.lineTo(u[2],u[3]),p.lineTo(u[4],u[5]),p.lineTo(u[6],u[7]),p.clip()},y.prototype.createExecutors_=function(p){for(var n in p){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=p[n];for(var s in r){var P=r[s];u[s]=new s0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(p){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=p.length;r<s;++r)if(p[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(p,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-p[0],-p[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(z,z));var V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):N||V.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),yy(me,p),yl(me,n*(this.renderBuffer_+r),me));var _e=i2(r),Se;function Ne(ht,Tt){for(var It=V.getImageData(0,0,z,z).data,Lt=0,er=_e.length;Lt<er;Lt++)if(It[_e[Lt]]>0){if(!P||Se!==Dn.IMAGE&&Se!==Dn.TEXT||P.indexOf(ht)!==-1){var Nt=(_e[Lt]-3)/4,Qt=r-Nt%z,hr=r-(Nt/z|0),Pt=s(ht,Tt,Qt*Qt+hr*hr);if(Pt)return Pt}V.clearRect(0,0,z,z);break}}var Je=Object.keys(this.executorsByZIndex_).map(Number);Je.sort(rh);var Ce,Ue,Ye,rt,_t;for(Ce=Je.length-1;Ce>=0;--Ce){var dt=Je[Ce].toString();for(Ye=this.executorsByZIndex_[dt],Ue=h_.length-1;Ue>=0;--Ue)if(Se=h_[Ue],rt=Ye[Se],rt!==void 0&&(_t=rt.executeHitDetection(V,F,u,Ne,me),_t))return _t}},y.prototype.getClipCoords=function(p){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,p,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(p,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(p.save(),this.clip(p,u));var N=P||h_,V,me,_e,Se,Ne,Je;for(z&&F.reverse(),V=0,me=F.length;V<me;++V){var Ce=F[V].toString();for(Ne=this.executorsByZIndex_[Ce],_e=0,Se=N.length;_e<Se;++_e){var Ue=N[_e];Je=Ne[Ue],Je!==void 0&&Je.execute(p,n,u,r,s,z)}}this.maxExtent_&&p.restore()},y}(),p_={};function i2(y){if(p_[y]!==void 0)return p_[y];for(var p=y*2+1,n=y*y,u=new Array(n+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((y+r)*p+(y+s))*4+3),r>0&&z.push(((y-r)*p+(y+s))*4+3),s>0&&(z.push(((y+r)*p+(y-s))*4+3),r>0&&z.push(((y-r)*p+(y-s))*4+3))}for(var F=[],r=0,N=u.length;r<N;++r)u[r]&&F.push.apply(F,u[r]);return p_[y]=F,F}var f_=r2;var xd={ANIMATING:0,INTERACTING:1};var n2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),o2=function(y){n2(p,y);function p(n,u,r,s,P,z,F){var N=y.call(this)||this;return N.context_=n,N.pixelRatio_=u,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=z,N.userTransform_=F,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return p.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,N=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var me=0,_e=P.length;me<_e;me+=2){var Se=P[me]-this.imageAnchorX_,Ne=P[me+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Je=Se+this.imageAnchorX_,Ce=Ne+this.imageAnchorY_;vs(F,Je,Ce,1,1,V,-Je,-Ce),z.setTransform.apply(z,F),z.translate(Je,Ce),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ne,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=N)}},p.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var N=P[u]+this.textOffsetX_,V=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,N,V,1,1,F,-N,-V);z.setTransform.apply(z,me),z.translate(N,V),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,N,V),this.textFillState_&&z.fillText(this.text_,N,V)}}},p.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var N=F.length;P&&(N-=2);for(var V=2;V<N;V+=2)z.lineTo(F[V],F[V+1]);return P&&z.closePath(),r},p.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},p.prototype.drawCircle=function(n){if(!!Lo(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=gx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},p.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},p.prototype.setTransform=function(n){this.transform_=n},p.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Mt.POINT:this.drawPoint(n);break;case Mt.LINE_STRING:this.drawLineString(n);break;case Mt.POLYGON:this.drawPolygon(n);break;case Mt.MULTI_POINT:this.drawMultiPoint(n);break;case Mt.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Mt.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Mt.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Mt.CIRCLE:this.drawCircle(n);break;default:}},p.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Lo(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},p.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},p.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},p.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},p.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},p.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Lo(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var N=0,V=z.length;N<V;++N)P=this.moveToLineTo_(s,P,z[N],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},p.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},p.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,N=P.length;F<N;++F){var V=P[F];s=this.drawRings_(r,s,V,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},p.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},p.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},p.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:mh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},p.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),N=u.getLineDashOffset(),V=u.getLineJoin(),me=u.getWidth(),_e=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:Qh,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ne){return Ne*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}},p.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},p.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),me=s.getWidth(),_e=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:Qh,lineDash:F||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:me!==void 0?me:mc,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ne=n.getOffsetX(),Je=n.getOffsetY(),Ce=n.getRotateWithView(),Ue=n.getRotation(),Ye=n.getScaleArray(),rt=n.getText(),_t=n.getTextAlign(),dt=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:ng,textAlign:_t!==void 0?_t:mh,textBaseline:dt!==void 0?dt:ep},this.text_=rt!==void 0?Array.isArray(rt)?rt.reduce(function(ht,Tt,It){return ht+=It%2?" ":Tt},""):rt:"",this.textOffsetX_=Ne!==void 0?this.pixelRatio_*Ne:0,this.textOffsetY_=Je!==void 0?this.pixelRatio_*Je:0,this.textRotateWithView_=Ce!==void 0?Ce:!1,this.textRotation_=Ue!==void 0?Ue:0,this.textScale_=[this.pixelRatio_*Ye[0],this.pixelRatio_*Ye[1]]}},p}(og),l0=o2;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var a2=function(){function y(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return y.prototype.clear=function(){this.cache_={},this.cacheSize_=0},y.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},y.prototype.expire=function(){if(this.canExpireCache()){var p=0;for(var n in this.cache_){var u=this.cache_[n];(p++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(p,n,u){var r=u0(p,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(p,n,u,r){var s=u0(p,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(p){this.maxCacheSize_=p,this.expire()},y}();function u0(y,p,n){var u=n?rg(n):"null";return p+":"+y+":"+u}var d_=new a2;var s2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),l2=function(y){s2(p,y);function p(n,u,r,s){var P=y.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return p.prototype.changed=function(){this.dispatchEvent(Qi.CHANGE)},p.prototype.getExtent=function(){return this.extent},p.prototype.getImage=function(){return jr()},p.prototype.getPixelRatio=function(){return this.pixelRatio_},p.prototype.getResolution=function(){return this.resolution},p.prototype.getState=function(){return this.state},p.prototype.load=function(){jr()},p}(nh),c0=l2;var u2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),pL=function(y){u2(p,y);function p(n,u,r,s,P,z){var F=y.call(this,n,u,r,Wi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=Wi.IDLE,F.imageLoadFunction_=z,F}return p.prototype.getImage=function(){return this.image_},p.prototype.handleImageError_=function(){this.state=Wi.ERROR,this.unlistenImage_(),this.changed()},p.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=Wi.LOADED,this.unlistenImage_(),this.changed()},p.prototype.load=function(){(this.state==Wi.IDLE||this.state==Wi.ERROR)&&(this.state=Wi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=m_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},p.prototype.setImage=function(n){this.image_=n,this.resolution=Eu(this.extent)/this.image_.height},p.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},p}(c0);function m_(y,p,n){var u=y,r=!0,s=!1,P=!1,z=[qp(u,Qi.LOAD,function(){P=!0,s||p()})];return u.src&&Pv?(s=!0,u.decode().then(function(){r&&p()}).catch(function(F){r&&(P?p():n())})):z.push(qp(u,Qi.ERROR,n)),function(){r=!1,z.forEach(Po)}}var c2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),bd=null,h2=function(y){c2(p,y);function p(n,u,r,s,P,z){var F=y.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return p.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===Wi.LOADED){bd||(bd=Ja(1,1)),bd.drawImage(this.image_,0,0);try{bd.getImageData(0,0,1,1),this.tainted_=!1}catch{bd=null,this.tainted_=!0}}return this.tainted_===!0},p.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Qi.CHANGE)},p.prototype.handleImageError_=function(){this.imageState_=Wi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},p.prototype.handleImageLoad_=function(){this.imageState_=Wi.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},p.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},p.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},p.prototype.getImageState=function(){return this.imageState_},p.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},p.prototype.getSize=function(){return this.size_},p.prototype.getSrc=function(){return this.src_},p.prototype.load=function(){if(this.imageState_==Wi.IDLE){this.imageState_=Wi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=m_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},p.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==Wi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=rg(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],me=0,_e=P.length;me<_e;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=N,P[me+3]*=V;r.putImageData(s,0,0)}}},p.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},p}(nh);function h0(y,p,n,u,r,s){var P=d_.get(p,u,s);return P||(P=new h2(y,p,n,u,r,s),d_.set(p,u,s,P)),P}var p2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),f2=function(y){p2(p,y);function p(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=y.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var V=r.src;wn(!(V!==void 0&&N),4),wn(!N||N&&u.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Pi(N)),wn(V!==void 0&&V.length>0,6);var me=r.src!==void 0?Wi.IDLE:Wi.LOADED;return u.color_=r.color!==void 0?Jh(r.color):null,u.iconImage_=h0(N,V,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return p.prototype.clone=function(){var n=this.getScale();return new p({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},p.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Pu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},p.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},p.prototype.getColor=function(){return this.color_},p.prototype.getImage=function(n){return this.iconImage_.getImage(n)},p.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},p.prototype.getImageSize=function(){return this.iconImage_.getSize()},p.prototype.getImageState=function(){return this.iconImage_.getImageState()},p.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},p.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},p.prototype.getSrc=function(){return this.iconImage_.getSrc()},p.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},p.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(Qi.CHANGE,n)},p.prototype.load=function(){this.iconImage_.load()},p.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(Qi.CHANGE,n)},p}(tg),g_=f2;var $l=.5;function p0(y,p,n,u,r,s,P){var z=y[0]*$l,F=y[1]*$l,N=Ja(z,F);N.imageSmoothingEnabled=!1;for(var V=N.canvas,me=new l0(N,$l,r,null,P),_e=n.length,Se=Math.floor((256*256*256-1)/_e),Ne={},Je=1;Je<=_e;++Je){var Ce=n[Je-1],Ue=Ce.getStyleFunction()||u;if(!!u){var Ye=Ue(Ce,s);if(!!Ye){Array.isArray(Ye)||(Ye=[Ye]);for(var rt=Je*Se,_t="#"+("000000"+rt.toString(16)).slice(-6),dt=0,ht=Ye.length;dt<ht;++dt){var Tt=Ye[dt],It=Tt.getGeometryFunction()(Ce);if(!(!It||!Lo(r,It.getExtent()))){var Lt=Tt.clone(),er=Lt.getFill();er&&er.setColor(_t);var Nt=Lt.getStroke();Nt&&(Nt.setColor(_t),Nt.setLineDash(null)),Lt.setText(void 0);var Qt=Tt.getImage();if(Qt&&Qt.getOpacity()!==0){var hr=Qt.getImageSize();if(!hr)continue;var Pt=Ja(hr[0],hr[1],void 0,{alpha:!1}),Ar=Pt.canvas;Pt.fillStyle=_t,Pt.fillRect(0,0,Ar.width,Ar.height),Lt.setImage(new g_({img:Ar,imgSize:hr,anchor:Qt.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Qt.getOrigin(),opacity:1,size:Qt.getSize(),scale:Qt.getScale(),rotation:Qt.getRotation(),rotateWithView:Qt.getRotateWithView()}))}var Sr=Lt.getZIndex()||0,Dr=Ne[Sr];Dr||(Dr={},Ne[Sr]=Dr,Dr[Mt.POLYGON]=[],Dr[Mt.CIRCLE]=[],Dr[Mt.LINE_STRING]=[],Dr[Mt.POINT]=[]),Dr[It.getType().replace("Multi","")].push(It,Lt)}}}}}for(var _r=Object.keys(Ne).map(Number).sort(rh),Je=0,Er=_r.length;Je<Er;++Je){var Dr=Ne[_r[Je]];for(var br in Dr)for(var si=Dr[br],dt=0,ht=si.length;dt<ht;dt+=2){me.setStyle(si[dt+1]);for(var Gt=0,ei=p.length;Gt<ei;++Gt)me.setTransform(p[Gt]),me.drawGeometry(si[dt])}}return N.getImageData(0,0,V.width,V.height)}function f0(y,p,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*$l),s=Math.floor(Math.round(y[1])*$l),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],N=n.data[P+2],V=N+256*(F+256*z),me=Math.floor((256*256*256-1)/p.length);V&&V%me===0&&u.push(p[V/me-1])}return u}var d2=.5,d0={Point:b2,LineString:_2,Polygon:E2,MultiPoint:w2,MultiLineString:v2,MultiPolygon:x2,GeometryCollection:y2,Circle:m2};function m0(y,p){return parseInt(Pi(y),10)-parseInt(Pi(p),10)}function g0(y,p){var n=ag(y,p);return n*n}function ag(y,p){return d2*y/p}function m2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Dn.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(p,u)}}function y_(y,p,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var N=F.getImageState();N==Wi.LOADED||N==Wi.ERROR?F.unlistenImageChange(r):(N==Wi.IDLE&&F.load(),N=F.getImageState(),F.listenImageChange(r),z=!0)}return g2(y,p,n,u,s,P),z}function g2(y,p,n,u,r,s){var P=n.getGeometryFunction()(p);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)y0(y,z,n,p);else{var N=d0[z.getType()];N(y,z,n,p,s)}}}function y0(y,p,n,u){if(p.getType()==Mt.GEOMETRY_COLLECTION){for(var r=p.getGeometries(),s=0,P=r.length;s<P;++s)y0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),Dn.DEFAULT);z.drawCustom(p,u,n.getRenderer(),n.getHitDetectionRenderer())}function y2(y,p,n,u,r){var s=p.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=d0[s[P].getType()];F(y,s[P],n,u,r)}}function _2(y,p,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Dn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(p,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);F.setTextStyle(z),F.drawText(p,u)}}function v2(y,p,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Dn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(p,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);F.setTextStyle(z),F.drawText(p,u)}}function x2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),Dn.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(p,u)}}function b2(y,p,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=Wi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Dn.IMAGE);F.setImageStyle(s,z),F.drawPoint(p,u)}if(P&&P.getText()){var N=y.getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(P,z),N.drawText(p,u)}}function w2(y,p,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=Wi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Dn.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(p,u)}if(P&&P.getText()){var N=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(P,z),N.drawText(p,u)}}function E2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Dn.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(p,u)}}var T2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),S2=function(y){T2(p,y);function p(n){var u=y.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return p.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,N=P.projection,V=P.rotation,me=N.getExtent(),_e=this.getLayer().getSource(),Se=u.pixelRatio,Ne=u.viewHints,Je=!(Ne[xd.ANIMATING]||Ne[xd.INTERACTING]),Ce=this.context,Ue=Math.round(u.size[0]*Se),Ye=Math.round(u.size[1]*Se),rt=_e.getWrapX()&&N.canWrapX(),_t=rt?bs(me):null,dt=rt?Math.ceil((s[2]-me[2])/_t)+1:1,ht=rt?Math.floor((s[0]-me[0])/_t):0;do{var Tt=this.getRenderTransform(z,F,V,Se,Ue,Ye,ht*_t);n.execute(Ce,1,Tt,V,Je,void 0,r)}while(++ht<dt)},p.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},p.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];Lv(this.pixelTransform,1/r,1/r),zv(this.inversePixelTransform,this.pixelTransform);var P=fy(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var me=Math.round(n.size[0]*r),_e=Math.round(n.size[1]*r);F.width!=me||F.height!=_e?(F.width=me,F.height=_e,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,_e),this.preRender(z,n);var Se=n.viewState,Ne=Se.projection,Je=!1,Ce=!0;if(s.extent&&this.clipping){var Ue=rd(s.extent,Ne);Ce=Lo(Ue,n.extent),Je=Ce&&!sc(Ue,n.extent),Je&&this.clipUnrotated(z,n,Ue)}Ce&&this.renderWorlds(N,n),Je&&z.restore(),this.postRender(z,n);var Ye=Fx(s.opacity),rt=this.container;return Ye!==rt.style.opacity&&(rt.style.opacity=Ye),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},p.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];bo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),me=[],_e=r[0]*$l,Se=r[1]*$l;me.push(this.getRenderTransform(s,P,z,$l,_e,Se,0).slice());var Ne=V.getSource(),Je=F.getExtent();if(Ne.getWrapX()&&F.canWrapX()&&!sc(Je,N)){for(var Ce=N[0],Ue=bs(Je),Ye=0,rt=void 0;Ce<Je[0];)--Ye,rt=Ue*Ye,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ce+=Ue;for(Ye=0,Ce=N[2];Ce>Je[2];)++Ye,rt=Ue*Ye,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ce-=Ue}this.hitDetectionImageData_=p0(r,me,this.renderedFeatures_,V.getStyleFunction(),N,P,z)}u(f0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},p.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,N=u.viewState.rotation,V=this.getLayer(),me={},_e=function(Je,Ce,Ue){var Ye=Pi(Je),rt=me[Ye];if(rt){if(rt!==!0&&Ue<rt.distanceSq){if(Ue===0)return me[Ye]=!0,P.splice(P.lastIndexOf(rt),1),s(Je,V,Ce);rt.geometry=Ce,rt.distanceSq=Ue}}else{if(Ue===0)return me[Ye]=!0,s(Je,V,Ce);P.push(me[Ye]={feature:Je,layer:V,geometry:Ce,distanceSq:Ue,callback:s})}},Se,Ne=[this.replayGroup_];return this.declutterExecutorGroup&&Ne.push(this.declutterExecutorGroup),Ne.some(function(Je){return Se=Je.forEachFeatureAtCoordinate(n,F,N,r,_e,Je===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ce){return Ce.value}):null)}),Se}},p.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},p.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},p.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[xd.ANIMATING],P=n.viewHints[xd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=n.extent,V=n.viewState,me=V.projection,_e=V.resolution,Se=n.pixelRatio,Ne=u.getRevision(),Je=u.getRenderBuffer(),Ce=u.getRenderOrder();Ce===void 0&&(Ce=m0);var Ue=V.center.slice(),Ye=yl(N,Je*_e),rt=Ye.slice(),_t=[Ye.slice()],dt=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!sc(dt,n.extent)){var ht=bs(dt),Tt=Math.max(bs(Ye)/2,ht);Ye[0]=dt[0]-Tt,Ye[2]=dt[2]+Tt,ex(Ue,me);var It=Jv(_t[0],me);It[0]<dt[0]&&It[2]<dt[2]?_t.push([It[0]+ht,It[1],It[2]+ht,It[3]]):It[0]>dt[0]&&It[2]>dt[2]&&_t.push([It[0]-ht,It[1],It[2]-ht,It[3]])}if(!this.dirty_&&this.renderedResolution_==_e&&this.renderedRevision_==Ne&&this.renderedRenderOrder_==Ce&&sc(this.wrappedRenderedExtent_,Ye))return _s(this.renderedExtent_,rt)||(this.hitDetectionImageData_=null,this.renderedExtent_=rt),this.renderedCenter_=Ue,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Lt=new c_(ag(_e,Se),Ye,_e,Se),er;this.getLayer().getDeclutter()&&(er=new c_(ag(_e,Se),Ye,_e,Se));var Nt=uh(),Qt;if(Nt){for(var hr=0,Pt=_t.length;hr<Pt;++hr){var Ar=_t[hr],Sr=Qp(Ar,me);r.loadFeatures(Sr,nx(_e,me),Nt)}Qt=Gm(Nt,me)}else for(var hr=0,Pt=_t.length;hr<Pt;++hr)r.loadFeatures(_t[hr],_e,me);var Dr=g0(_e,Se),_r=function(ei){var bi,ti=ei.getStyleFunction()||u.getStyleFunction();if(ti&&(bi=ti(ei,_e)),bi){var zi=this.renderFeature(ei,Dr,bi,Lt,Qt,er);this.dirty_=this.dirty_||zi}}.bind(this),Er=Qp(Ye,me),br=r.getFeaturesInExtent(Er);Ce&&br.sort(Ce);for(var hr=0,Pt=br.length;hr<Pt;++hr)_r(br[hr]);this.renderedFeatures_=br;var si=Lt.finish(),Gt=new f_(Ye,_e,Se,r.getOverlaps(),si,u.getRenderBuffer());return er&&(this.declutterExecutorGroup=new f_(Ye,_e,Se,r.getOverlaps(),er.finish(),u.getRenderBuffer())),this.renderedResolution_=_e,this.renderedRevision_=Ne,this.renderedRenderOrder_=Ce,this.renderedExtent_=rt,this.wrappedRenderedExtent_=Ye,this.renderedCenter_=Ue,this.renderedProjection_=me,this.replayGroup_=Gt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},p.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)F=y_(s,n,r[N],u,this.boundHandleStyleImageChange_,P,z)||F;else F=y_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},p}(i0),_0=S2;var I2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),C2=function(y){I2(p,y);function p(n){return y.call(this,n)||this}return p.prototype.createRenderer=function(){return new _0(this)},p}(Hx),tp=C2;var v0=Gp(s_(),1);var A2=function(){function y(p){this.rbush_=new v0.default(p),this.items_={}}return y.prototype.insert=function(p,n){var u={minX:p[0],minY:p[1],maxX:p[2],maxY:p[3],value:n};this.rbush_.insert(u),this.items_[Pi(n)]=u},y.prototype.load=function(p,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=p[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Pi(z)]=F}this.rbush_.load(u)},y.prototype.remove=function(p){var n=Pi(p),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(p,n){var u=this.items_[Pi(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Vm(r,p)||(this.remove(n),this.insert(p,n))},y.prototype.getAll=function(){var p=this.rbush_.all();return p.map(function(n){return n.value})},y.prototype.getInExtent=function(p){var n={minX:p[0],minY:p[1],maxX:p[2],maxY:p[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(p){return this.forEach_(this.getAll(),p)},y.prototype.forEachInExtent=function(p,n){return this.forEach_(this.getInExtent(p),n)},y.prototype.forEach_=function(p,n){for(var u,r=0,s=p.length;r<s;r++)if(u=n(p[r]),u)return u;return u},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(p){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,p)},y.prototype.concat=function(p){this.rbush_.load(p.rbush_.all());for(var n in p.items_)this.items_[n]=p.items_[n]},y}(),wd=A2;var P2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),M2=function(y){P2(p,y);function p(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=x0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Su.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return p.prototype.getAttributions=function(){return this.attributions_},p.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},p.prototype.getProjection=function(){return this.projection},p.prototype.getResolutions=function(){return jr()},p.prototype.getView=function(){return this.viewPromise_},p.prototype.getState=function(){return this.state_},p.prototype.getWrapX=function(){return this.wrapX_},p.prototype.getInterpolate=function(){return this.interpolate_},p.prototype.refresh=function(){this.changed()},p.prototype.setAttributions=function(n){this.attributions_=x0(n),this.changed()},p.prototype.setState=function(n){this.state_=n,this.changed()},p}(Mo);function x0(y){return y?Array.isArray(y)?function(p){return y}:typeof y=="function"?y:function(p){return[y]}:null}var cf=M2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function b0(y,p){return[[-1/0,-1/0,1/0,1/0]]}var _h={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var k2=!1;function L2(y,p,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),p.getType()==_h.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=k2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var N=p.getType(),V=void 0;N==_h.JSON||N==_h.TEXT?V=z.responseText:N==_h.XML?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):N==_h.ARRAY_BUFFER&&(V=z.response),V?s(p.readFeatures(V,{extent:n,featureProjection:r}),p.readProjection(V)):P()}else P()},z.onerror=P,z.send()}function __(y,p){return function(n,u,r,s,P){var z=this;L2(y,p,n,u,r,function(F,N){z.addFeatures(F),s!==void 0&&s(F)},P||qh)}}var w0=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vh=function(y){w0(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return p}(sn);var R2=function(y){w0(p,y);function p(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=qh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(wn(u.format_,7),u.loader_=__(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:b0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new wd:null,u.loadedExtentsRtree_=new wd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new ch(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return p.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},p.prototype.addFeatureInternal=function(n){var u=Pi(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new vh(Qa.ADDFEATURE,n))},p.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[uo(u,Qi.CHANGE,this.handleFeatureChange_,this),uo(u,jp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},p.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(wn(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},p.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},p.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],N=Pi(F);this.addToIndex_(N,F)&&r.push(F)}for(var P=0,V=r.length;P<V;P++){var F=r[P],N=Pi(F);this.setupChangeEvents_(N,F);var me=F.getGeometry();if(me){var _e=me.getExtent();u.push(_e),s.push(F)}else this.nullGeometryFeatures_[N]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new vh(Qa.ADDFEATURE,r[P]))},p.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(ws.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(ws.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},p.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Po)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new vh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},p.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},p.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},p.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},p.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},p.prototype.getFeaturesCollection=function(){return this.featuresCollection_},p.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(n,Pm(this.nullGeometryFeatures_))),n},p.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},p.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},p.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,N=[-1/0,-1/0,1/0,1/0],V=u||Am;return this.featuresRtree_.forEachInExtent(N,function(me){if(V(me)){var _e=me.getGeometry(),Se=F;if(F=_e.closestPointXY(r,s,z,F),F<Se){P=me;var Ne=Math.sqrt(F);N[0]=r-Ne,N[1]=s-Ne,N[2]=r+Ne,N[3]=s+Ne}}}),P},p.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},p.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},p.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},p.prototype.getFormat=function(){return this.format_},p.prototype.getOverlaps=function(){return this.overlaps_},p.prototype.getUrl=function(){return this.url_},p.prototype.handleFeatureChange_=function(n){var u=n.target,r=Pi(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new vh(Qa.CHANGEFEATURE,u))},p.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Pi(n)in this.uidIndex_},p.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},p.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,_e){var Se=P[me],Ne=s.forEachInExtent(Se,function(Je){return sc(Je.extent,Se)});Ne||(++F.loadingExtentsCount_,F.dispatchEvent(new vh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(Je){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADEND,void 0,Je))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,N=0,V=P.length;N<V;++N)z(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},p.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},p.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Vm(s.extent,n))return r=s,!0}),r&&u.remove(r)},p.prototype.removeFeature=function(n){if(!!n){var u=Pi(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},p.prototype.removeFeatureInternal=function(n){var u=Pi(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Po),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new vh(Qa.REMOVEFEATURE,n)),n}},p.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},p.prototype.setLoader=function(n){this.loader_=n},p.prototype.setUrl=function(n){wn(this.format_,7),this.url_=n,this.setLoader(__(n,this.format_))},p}(cf),rp=R2;var E0=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hf=function(y){E0(p,y);function p(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return p}(sn);var v_={LAYERS:"layers"},z2=function(y){E0(p,y);function p(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=y.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(v_.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):wn(typeof P.getArray=="function",43):P=new ch(void 0,{unique:!0}),u.setLayers(P),u}return p.prototype.handleLayerChange_=function(){this.changed()},p.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Po),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(uo(n,ws.ADD,this.handleLayersAdd_,this),uo(n,ws.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Po);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new hf("addlayer",z))}this.changed()},p.prototype.registerLayerListeners_=function(n){var u=[uo(n,jp.PROPERTYCHANGE,this.handleLayerChange_,this),uo(n,Qi.CHANGE,this.handleLayerChange_,this)];n instanceof p&&u.push(uo(n,"addlayer",this.handleLayerGroupAdd_,this),uo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Pi(n)]=u},p.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new hf("addlayer",n.layer))},p.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new hf("removelayer",n.layer))},p.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new hf("addlayer",u)),this.changed()},p.prototype.handleLayersRemove_=function(n){var u=n.element,r=Pi(u);this.listenerKeys_[r].forEach(Po),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",u)),this.changed()},p.prototype.getLayers=function(){return this.get(v_.LAYERS)},p.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(v_.LAYERS,n)},p.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},p.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var N=u[z];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=$v(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return u},p.prototype.getSourceState=function(){return Su.READY},p}(Zm),x_=z2;var na={SINGLECLICK:"singleclick",CLICK:Qi.CLICK,DBLCLICK:Qi.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var b_={ACTIVE:"active"};var D2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(p,y);function p(n){var u=y.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return p.prototype.getActive=function(){return this.get(b_.ACTIVE)},p.prototype.getMap=function(){return this.map_},p.prototype.handleEvent=function(n){return!0},p.prototype.setActive=function(n){this.set(b_.ACTIVE,n)},p.prototype.setMap=function(n){this.map_=n},p}(Mo);var T0=O2;var F2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),B2=function(y){F2(p,y);function p(n){var u=this,r=n||{};return u=y.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return p.prototype.getPointerCount=function(){return this.targetPointers.length},p.prototype.handleDownEvent=function(n){return!1},p.prototype.handleDragEvent=function(n){},p.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==na.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==na.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==na.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==na.POINTERMOVE&&this.handleMoveEvent(n);return!u},p.prototype.handleMoveEvent=function(n){},p.prototype.handleUpEvent=function(n){return!1},p.prototype.stopDown=function(n){return n},p.prototype.updateTrackedPointers_=function(n){if(U2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==na.POINTERUP?delete this.trackedPointers_[r]:n.type==na.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Pm(this.trackedPointers_)}},p}(T0);function U2(y){var p=y.type;return p===na.POINTERDOWN||p===na.POINTERDRAG||p===na.POINTERUP}var S0=B2;var I0=function(y){var p=y.originalEvent;return p.altKey&&!(p.metaKey||p.ctrlKey)&&!p.shiftKey};var C0=Am,A0=function(y){return y.type==na.CLICK};var P0=function(y){return y.type==na.SINGLECLICK};var M0=function(y){var p=y.originalEvent;return wn(p!==void 0,56),p.isPrimary&&p.button===0};var N2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),V2=function(y){N2(p,y);function p(n,u,r){var s=y.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(n[0]))s.setCoordinates(n,u);else if(u!==void 0&&r)s.setFlatCoordinates(u,n),s.ends_=r;else{for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout()),Ka(F,_e.getFlatCoordinates()),N.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=N}return s}return p.prototype.appendLineString=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates().slice()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ud(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},p.prototype.getCoordinateAtM=function(n,u,r){if(this.layout!=An.XYM&&this.layout!=An.XYZM||this.flatCoordinates.length===0)return null;var s=u!==void 0?u:!1,P=r!==void 0?r:!1;return zx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},p.prototype.getCoordinates=function(){return ph(this.flatCoordinates,0,this.ends_,this.stride)},p.prototype.getEnds=function(){return this.ends_},p.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new uc(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},p.prototype.getLineStrings=function(){for(var n=this.flatCoordinates,u=this.ends_,r=this.layout,s=[],P=0,z=0,F=u.length;z<F;++z){var N=u[z],V=new uc(n.slice(P,N),r);s.push(V),P=N}return s},p.prototype.getFlatMidpoints=function(){for(var n=[],u=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,z=0,F=s.length;z<F;++z){var N=s[z],V=Qm(u,r,N,P,.5);Ka(n,V),r=N}return n},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=wx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new p(u,An.XY,r)},p.prototype.getType=function(){return Mt.MULTI_LINE_STRING},p.prototype.intersectsExtent=function(n){return Ax(this.flatCoordinates,0,this.ends_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=cd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},p}(Es),k0=V2;var G2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),j2=function(y){G2(p,y);function p(n,u){var r=y.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return p.prototype.appendPoint=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.flatCoordinates,z=this.stride,F=0,N=P.length;F<N;F+=z){var V=ql(n,u,P[F],P[F+1]);if(V<s){s=V;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},p.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getPoint=function(n){var u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return n<0||u<=n?null:new _a(this.flatCoordinates.slice(n*this.stride,(n+1)*this.stride),this.layout)},p.prototype.getPoints=function(){for(var n=this.flatCoordinates,u=this.layout,r=this.stride,s=[],P=0,z=n.length;P<z;P+=r){var F=new _a(n.slice(P,P+r),u);s.push(F)}return s},p.prototype.getType=function(){return Mt.MULTI_POINT},p.prototype.intersectsExtent=function(n){for(var u=this.flatCoordinates,r=this.stride,s=0,P=u.length;s<P;s+=r){var z=u[s],F=u[s+1];if(Qf(n,z,F))return!0}return!1},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),sg=j2;function L0(y,p,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Nm(y,p,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),p=F[F.length-1]}return r}var q2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Z2=function(y){q2(p,y);function p(n,u,r){var s=y.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(n[0])){for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout());for(var Se=F.length,Ne=_e.getEnds(),Je=0,Ce=Ne.length;Je<Ce;++Je)Ne[Je]+=Se;Ka(F,_e.getFlatCoordinates()),N.push(Ne)}u=P,n=F,r=N}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return p.prototype.appendPolygon=function(n){var u;if(!this.flatCoordinates)this.flatCoordinates=n.getFlatCoordinates().slice(),u=n.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ka(this.flatCoordinates,n.getFlatCoordinates()),u=n.getEnds().slice();for(var s=0,P=u.length;s<P;++s)u[s]+=r}this.endss_.push(u),this.changed()},p.prototype.clone=function(){for(var n=this.endss_.length,u=new Array(n),r=0;r<n;++r)u[r]=this.endss_[r].slice();var s=new p(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_x(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),vx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},p.prototype.containsXY=function(n,u){return Ix(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},p.prototype.getArea=function(){return Tx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},p.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Hy(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,pd(u,0,this.endss_,this.stride)},p.prototype.getEndss=function(){return this.endss_},p.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=L0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Cx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},p.prototype.getInteriorPoints=function(){return new sg(this.getFlatInteriorPoints().slice(),An.XYM)},p.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Lx(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Hy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Ex(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new p(u,An.XY,r)},p.prototype.getPolygon=function(n){if(n<0||this.endss_.length<=n)return null;var u;if(n===0)u=0;else{var r=this.endss_[n-1];u=r[r.length-1]}var s=this.endss_[n].slice(),P=s[s.length-1];if(u!==0)for(var z=0,F=s.length;z<F;++z)s[z]-=u;return new md(this.flatCoordinates.slice(u,P),this.layout,s)},p.prototype.getPolygons=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.endss_,s=[],P=0,z=0,F=r.length;z<F;++z){var N=r[z].slice(),V=N[N.length-1];if(P!==0)for(var me=0,_e=N.length;me<_e;++me)N[me]-=P;var Se=new md(u.slice(P,V),n,N);s.push(Se),P=V}return s},p.prototype.getType=function(){return Mt.MULTI_POLYGON},p.prototype.intersectsExtent=function(n){return Px(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=bx(this.flatCoordinates,0,n,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},p}(Es),R0=Z2;var B0=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),z0=0,Ed=1,D0=[0,0,0,0],pf=[],w_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},E_=function(y){B0(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return p}(sn);var W2=function(y){B0(p,y);function p(n){var u=y.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:M0,u.defaultDeleteCondition_=function(s){return I0(s)&&P0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:C0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new wd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new tp({source:new rp({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:$2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new ch(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(ws.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(ws.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return p.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(Qi.CHANGE,this.boundHandleFeatureChange_)},p.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ch;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,N=z.length;F<N;++F){var V=z[F].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new E_(w_.MODIFYSTART,this.featuresBeingModified_,n))}},p.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(Qi.CHANGE,this.boundHandleFeatureChange_)},p.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},p.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},p.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},p.prototype.getOverlay=function(){return this.overlay_},p.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},p.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},p.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},p.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},p.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},p.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},p.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},p.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(wu(z),F)}},p.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},p.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},p.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length;F<N;++F)for(var V=z[F],me=0,_e=V.length-1;me<_e;++me){var Se=V.slice(me,me+2),Ne={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(wu(Se),Ne)}},p.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:z0,segment:[r,r]},P={feature:n,geometry:u,index:Ed,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Yp(r),s);var F=u,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();F=F.clone().transform(N,V),F=Yy(F).transform(V,N)}this.rBush_.insert(F.getExtent(),P)},p.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},p.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new lc(new _a(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},p.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==na.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=na.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==na.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,n)&&!u},p.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],N=F[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var me=N.geometry;s.indexOf(me)===-1&&s.push(me);for(var _e=N.depth,Se=void 0,Ne=N.segment,Je=F[1];u.length<me.getStride();)u.push(Ne[Je][u.length]);switch(me.getType()){case Mt.POINT:Se=u,Ne[0]=u,Ne[1]=u;break;case Mt.MULTI_POINT:Se=me.getCoordinates(),Se[N.index]=u,Ne[0]=u,Ne[1]=u;break;case Mt.LINE_STRING:Se=me.getCoordinates(),Se[N.index+Je]=u,Ne[Je]=u;break;case Mt.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[_e[0]][N.index+Je]=u,Ne[Je]=u;break;case Mt.POLYGON:Se=me.getCoordinates(),Se[_e[0]][N.index+Je]=u,Ne[Je]=u;break;case Mt.MULTI_POLYGON:Se=me.getCoordinates(),Se[_e[1]][_e[0]][N.index+Je]=u,Ne[Je]=u;break;case Mt.CIRCLE:if(Ne[0]=u,Ne[1]=u,N.index===z0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ce=n.map.getView().getProjection(),Ue=Ty(Wl(me.getCenter(),Ce),Wl(u,Ce)),Ye=uh();if(Ye){var rt=me.clone().transform(Ye,Ce);rt.setRadius(Ue),Ue=rt.transform(Ce,Ye).getRadius()}me.setRadius(Ue),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},p.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=wu([z]),N=this.rBush_.getInExtent(F),V={};N.sort(X2);for(var me=0,_e=N.length;me<_e;++me){var Se=N[me],Ne=Se.segment,Je=Pi(Se.geometry),Ce=Se.depth;if(Ce&&(Je+="-"+Ce.join("-")),V[Je]||(V[Je]=new Array(2)),Se.geometry.getType()===Mt.CIRCLE&&Se.index===Ed){var Ue=F0(u,Se,s);Tu(Ue,z)&&!V[Je][0]&&(this.dragSegments_.push([Se,0]),V[Je][0]=Se);continue}if(Tu(Ne[0],z)&&!V[Je][0]){this.dragSegments_.push([Se,0]),V[Je][0]=Se;continue}if(Tu(Ne[1],z)&&!V[Je][1]){if((Se.geometry.getType()===Mt.LINE_STRING||Se.geometry.getType()===Mt.MULTI_LINE_STRING)&&V[Je][0]&&V[Je][0].index===0)continue;this.dragSegments_.push([Se,1]),V[Je][1]=Se;continue}Pi(Ne)in this.vertexSegments_&&!V[Je][0]&&!V[Je][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var Ye=P.length-1;Ye>=0;--Ye)this.insertVertex_(P[Ye],z)}return!!this.vertexFeature_},p.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Mt.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Yp(P),z);var N=s,V=uh();if(V){var me=n.map.getView().getProjection();N=N.clone().transform(V,me),N=Yy(N).transform(me,V)}this.rBush_.update(N.getExtent(),F)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new E_(w_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},p.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},p.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(Pt,Ar){return O0(P,Pt,z)-O0(P,Ar,z)},N,V;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(Pt){return Pt===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(Pt,Ar,Sr){if(Sr=Sr||Pt.getGeometry(),Sr.getType()===Mt.POINT&&vv(s.features_.getArray(),Pt)){V=Sr;var Dr=Sr.getFlatCoordinates().slice(0,2);N=[{feature:Pt,geometry:Sr,segment:[Dr,Dr]}]}return!0},{layerFilter:me})}if(!N){var _e=rd(Yp(P,D0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ne=Qp(yl(_e,Se,D0),z);N=this.rBush_.getInExtent(Ne)}if(N&&N.length>0){var Je=N.sort(F)[0],Ce=Je.segment,Ue=F0(P,Je,z),Ye=u.getPixelFromCoordinate(Ue),rt=Ty(n,Ye);if(V||rt<=this.pixelTolerance_){var _t={};if(_t[Pi(Ce)]=!0,this.snapToPointer_||(this.delta_[0]=Ue[0]-P[0],this.delta_[1]=Ue[1]-P[1]),Je.geometry.getType()===Mt.CIRCLE&&Je.index===Ed)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ue,[Je.feature],[Je.geometry]);else{var dt=u.getPixelFromCoordinate(Ce[0]),ht=u.getPixelFromCoordinate(Ce[1]),Tt=Jp(Ye,dt),It=Jp(Ye,ht);rt=Math.sqrt(Math.min(Tt,It)),this.snappedToVertex_=rt<=this.pixelTolerance_,this.snappedToVertex_&&(Ue=Tt>It?Ce[1]:Ce[0]),this.createOrUpdateVertexFeature_(Ue,[Je.feature],[Je.geometry]);var Lt={};Lt[Pi(Je.geometry)]=!0;for(var er=1,Nt=N.length;er<Nt;++er){var Qt=N[er].segment;if(Tu(Ce[0],Qt[0])&&Tu(Ce[1],Qt[1])||Tu(Ce[0],Qt[1])&&Tu(Ce[1],Qt[0])){var hr=Pi(N[er].geometry);hr in Lt||(Lt[hr]=!0,_t[Pi(Qt)]=!0)}else break}}this.vertexSegments_=_t;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},p.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,N;u.length<P.getStride();)u.push(0);switch(P.getType()){case Mt.MULTI_LINE_STRING:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.POLYGON:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.MULTI_POLYGON:N=P.getCoordinates(),N[z[1]][z[0]].splice(F+1,0,u);break;case Mt.LINE_STRING:N=P.getCoordinates(),N.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};V.insert(wu(me.segment),me),this.dragSegments_.push([me,1]);var _e={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};V.insert(wu(_e.segment),_e),this.dragSegments_.push([_e,0]),this.ignoreNextSingleClick_=!0},p.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=na.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new E_(w_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},p.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,N,V,me,_e,Se,Ne,Je;for(N=n.length-1;N>=0;--N)z=n[N],Ne=z[0],Je=Pi(Ne.feature),Ne.depth&&(Je+="-"+Ne.depth.join("-")),Je in u||(u[Je]={}),z[1]===0?(u[Je].right=Ne,u[Je].index=Ne.index):z[1]==1&&(u[Je].left=Ne,u[Je].index=Ne.index+1);for(Je in u){switch(Se=u[Je].right,me=u[Je].left,V=u[Je].index,_e=V-1,me!==void 0?Ne=me:Ne=Se,_e<0&&(_e=0),F=Ne.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Mt.MULTI_LINE_STRING:P[Ne.depth[0]].length>2&&(P[Ne.depth[0]].splice(V,1),r=!0);break;case Mt.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Mt.MULTI_POLYGON:s=s[Ne.depth[1]];case Mt.POLYGON:s=s[Ne.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),_e=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ce=[];if(me!==void 0&&(this.rBush_.remove(me),Ce.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ce.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ue={depth:Ne.depth,feature:Ne.feature,geometry:Ne.geometry,index:_e,segment:Ce};this.rBush_.insert(wu(Ue.segment),Ue)}this.updateSegmentIndices_(F,V,Ne.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},p.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},p.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},p}(S0);function X2(y,p){return y.index-p.index}function O0(y,p,n){var u=p.geometry;if(u.getType()===Mt.CIRCLE){var r=u;if(p.index===Ed){var s=uh();s&&(r=r.clone().transform(s,n));var P=Jp(r.getCenter(),Wl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Wl(y,n);return pf[0]=Wl(p.segment[0],n),pf[1]=Wl(p.segment[1],n),Qv(F,pf)}function F0(y,p,n){var u=p.geometry;if(u.getType()===Mt.CIRCLE&&p.index===Ed){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Cy(r.getClosestPoint(Wl(y,n)),n)}var P=Wl(y,n);return pf[0]=Wl(p.segment[0],n),pf[1]=Wl(p.segment[1],n),Cy(Ey(P,pf),n)}function $2(){var y=Wx();return function(p,n){return y[Mt.POINT]}}var T_=W2;var K2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),H2=function(y){K2(p,y);function p(n){var u=y.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return p.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Po),this.changeEventsKeys_.length=0},p.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(uo(this.geometries_[n],Qi.CHANGE,this.changed,this))},p.prototype.clone=function(){var n=new p(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.geometries_,z=0,F=P.length;z<F;++z)s=P[z].closestPointXY(n,u,r,s);return s},p.prototype.containsXY=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(n,u))return!0;return!1},p.prototype.computeExtent=function(n){Hp(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)Wv(n,u[r].getExtent());return n},p.prototype.getGeometries=function(){return U0(this.geometries_)},p.prototype.getGeometriesArray=function(){return this.geometries_},p.prototype.getGeometriesArrayRecursive=function(){for(var n=[],u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].getType()===this.getType()?n=n.concat(u[r].getGeometriesArrayRecursive()):n.push(u[r]);return n},p.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var u=[],r=this.geometries_,s=!1,P=0,z=r.length;P<z;++P){var F=r[P],N=F.getSimplifiedGeometry(n);u.push(N),N!==F&&(s=!0)}if(s){var V=new p(null);return V.setGeometriesArray(u),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},p.prototype.getType=function(){return Mt.GEOMETRY_COLLECTION},p.prototype.intersectsExtent=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)if(u[r].intersectsExtent(n))return!0;return!1},p.prototype.isEmpty=function(){return this.geometries_.length===0},p.prototype.rotate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(n,u);this.changed()},p.prototype.scale=function(n,u,r){var s=r;s||(s=$h(this.getExtent()));for(var P=this.geometries_,z=0,F=P.length;z<F;++z)P[z].scale(n,u,s);this.changed()},p.prototype.setGeometries=function(n){this.setGeometriesArray(U0(n))},p.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},p.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},p.prototype.translate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(n,u);this.changed()},p.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},p}(Km);function U0(y){for(var p=[],n=0,u=y.length;n<u;++n)p.push(y[n].clone());return p}var N0=H2;var Y2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(p,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(p);n.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(p){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},p)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(p,n){return jr()},y.prototype.readFeatures=function(p,n){return jr()},y.prototype.readGeometry=function(p,n){return jr()},y.prototype.readProjection=function(p){return jr()},y.prototype.writeFeature=function(p,n){return jr()},y.prototype.writeFeatures=function(p,n){return jr()},y.prototype.writeGeometry=function(p,n){return jr()},y}(),V0=Y2;function S_(y,p,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!ix(u,r)?s=(p?y.clone():y).transform(p?u:r,p?r:u):s=y,p&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var N=0,V=F.length;N<V;++N)F[N]=Math.round(F[N]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var J2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(p,y);function p(){return y.call(this)||this}return p.prototype.getType=function(){return _h.JSON},p.prototype.readFeature=function(n,u){return this.readFeatureFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readFeatureFromObject=function(n,u){return jr()},p.prototype.readFeaturesFromObject=function(n,u){return jr()},p.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readGeometryFromObject=function(n,u){return jr()},p.prototype.readProjection=function(n){return this.readProjectionFromObject(lg(n))},p.prototype.readProjectionFromObject=function(n){return jr()},p.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},p.prototype.writeFeatureObject=function(n,u){return jr()},p.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},p.prototype.writeFeaturesObject=function(n,u){return jr()},p.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},p.prototype.writeGeometryObject=function(n,u){return jr()},p}(V0);function lg(y){if(typeof y=="string"){var p=JSON.parse(y);return p||null}else return y!==null?y:null}var G0=Q2;var eE=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),tE=function(y){eE(p,y);function p(n){var u=this,r=n||{};return u=y.call(this)||this,u.dataProjection=ya(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ya(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return p.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=I_(r.geometry,u),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},p.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,N=z.length;F<N;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},p.prototype.readGeometryFromObject=function(n,u){return I_(n,u)},p.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ya(u.properties.name):u.type==="EPSG"?r=ya("EPSG:"+u.properties.code):wn(!1,36):r=this.dataProjection,r},p.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=C_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},p.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},p.prototype.writeGeometryObject=function(n,u){return C_(n,this.adaptOptions(u))},p}(G0);function I_(y,p){if(!y)return null;var n;switch(y.type){case Mt.POINT:{n=iE(y);break}case Mt.LINE_STRING:{n=nE(y);break}case Mt.POLYGON:{n=lE(y);break}case Mt.MULTI_POINT:{n=aE(y);break}case Mt.MULTI_LINE_STRING:{n=oE(y);break}case Mt.MULTI_POLYGON:{n=sE(y);break}case Mt.GEOMETRY_COLLECTION:{n=rE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return S_(n,!1,p)}function rE(y,p){var n=y.geometries.map(function(u){return I_(u,p)});return new N0(n)}function iE(y){return new _a(y.coordinates)}function nE(y){return new uc(y.coordinates)}function oE(y){return new k0(y.coordinates)}function aE(y){return new sg(y.coordinates)}function sE(y){return new R0(y.coordinates)}function lE(y){return new md(y.coordinates)}function C_(y,p){y=S_(y,!0,p);var n=y.getType(),u;switch(n){case Mt.POINT:{u=dE(y,p);break}case Mt.LINE_STRING:{u=cE(y,p);break}case Mt.POLYGON:{u=mE(y,p);break}case Mt.MULTI_POINT:{u=pE(y,p);break}case Mt.MULTI_LINE_STRING:{u=hE(y,p);break}case Mt.MULTI_POLYGON:{u=fE(y,p);break}case Mt.GEOMETRY_COLLECTION:{u=uE(y,p);break}case Mt.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function uE(y,p){var n=y.getGeometriesArray().map(function(u){var r=Ra({},p);return delete r.featureProjection,C_(u,r)});return{type:"GeometryCollection",geometries:n}}function cE(y,p){return{type:"LineString",coordinates:y.getCoordinates()}}function hE(y,p){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function pE(y,p){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function fE(y,p){var n;return p&&(n=p.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function dE(y,p){return{type:"Point",coordinates:y.getCoordinates()}}function mE(y,p){var n;return p&&(n=p.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=tE;var ug,gE=new Uint8Array(16);function A_(){if(!ug&&(ug=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ug))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ug(gE)}var j0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function yE(y){return typeof y=="string"&&j0.test(y)}var q0=yE;var xa=[];for(cg=0;cg<256;++cg)xa.push((cg+256).toString(16).substr(1));var cg;function _E(y){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(xa[y[p+0]]+xa[y[p+1]]+xa[y[p+2]]+xa[y[p+3]]+"-"+xa[y[p+4]]+xa[y[p+5]]+"-"+xa[y[p+6]]+xa[y[p+7]]+"-"+xa[y[p+8]]+xa[y[p+9]]+"-"+xa[y[p+10]]+xa[y[p+11]]+xa[y[p+12]]+xa[y[p+13]]+xa[y[p+14]]+xa[y[p+15]]).toLowerCase();if(!q0(n))throw TypeError("Stringified UUID is invalid");return n}var Z0=_E;function vE(y,p,n){y=y||{};var u=y.random||(y.rng||A_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,p){n=n||0;for(var r=0;r<16;++r)p[n+r]=u[r];return p}return Z0(u)}var P_=vE;var ip=class extends Mo{constructor(n={}){super();this.properties={};this.options={};this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.options=n,this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=P_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let N=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",N||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(N=>N.visible)&&this.children.forEach(N=>{N.visible=!0}),this.parent&&this.group){let N=this.parent;for(;N.parent;)N=N.parent;let V=new sn("change:visible:group");V.target=this,N.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(N=>{N.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(N=>N.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(N=>{N.parent=void 0}),Array.isArray(F)&&F.forEach(N=>{N.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return Kf(this)}};function xE(y){return class extends y{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var hg=xE;var Td=class extends hg(ip){constructor(n){super(n);this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(n){super.defineProperties(n),Object.defineProperties(this,{olLayer:{value:n.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!this.map&&(this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ha(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ha([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new Td({...this.options,...n})}},Is=Td;var W0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),bE=new Xl({stroke:new va({color:[0,0,0,1],width:5})}),wE=new Xl({image:W0,stroke:new va({color:[255,0,0,1],width:3})}),EE=new Xl({image:W0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),TE=(y,p)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=p<=n&&p>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[bE,wE]:[EE]},Sd=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new tp({source:new rp,style:n.style||TE})}clone(n){return new Sd({...this.options,...n})}},pg=Sd;var SE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,X0=/^([\d.]+),([\d.]+)$/,$0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,fg="stop-fetch",K0=y=>{let p=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&p.push(...u)}),p},Id=class extends af{constructor(n={}){super(n);this.viaPoints=[];this.loading=!1;this.graphs=[];this.modify=!0;this.useRawViaPoints=!1;this.snapToClosestStation=!1;this.cacheStationData={};this.abortControllers={};this.segments=[];this.format=new bl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:u=>{u&&(this.set("mot",u),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:u=>{this.set("loading",u)}},modify:{get:()=>this.get("modify"),set:u=>{this.set("modify",u)}}}),this.loading=!1,this.graphs=n.graphs||[["osm",0,99]],this.mot=n.mot||"bus",this.modify=n.modify!==!1,this.routingApiParams=n.routingApiParams,this.useRawViaPoints=n.useRawViaPoints||!1,this.snapToClosestStation=n.snapToClosestStation||!1,this.apiKey=n.apiKey,this.stopsApiKey=n.stopsApiKey||this.apiKey,this.stopsApiUrl=n.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...n}),this.routingLayer=n.routingLayer||new pg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new sn("change:route")),this.reset(),console.error(u)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(n,u){let r=u.getView();return n.map(([,s,P])=>[r.getResolutionForZoom(s),r.getResolutionForZoom(P||s+1)])}addViaPoint(n,u=-1,r=0){this.viaPoints.splice(u===-1?this.viaPoints.length:u,r,n),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new sn("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new sn("change:route"))}abortRequests(){this.graphs.forEach(n=>{let u=n[0];this.abortControllers[u]&&this.abortControllers[u].abort(),this.abortControllers[u]=new AbortController}),this.abortControllers[fg]?.abort(),this.abortControllers[fg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer?.olLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[fg]);let n=this.viaPoints.map(u=>{if(Array.isArray(u)){let r=this.map?.getView().getProjection(),[s,P]=lh(u,r);return this.snapToClosestStation?[`@${P}`,s]:[P,s]}return this.useRawViaPoints?u:`!${u}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((u,r)=>this.drawViaPoint(u,r,this.abortControllers[fg])),Promise.all(this.graphs.map(([u],r)=>{let{signal:s}=this.abortControllers[u];return this.api?this.api.route({graph:u,via:`${n.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:s}).then(P=>{if(this.segments=this.format.readFeatures(P),this.mot==="foot"){let N=this.segments.reduce((V,me)=>{let _e=me.get("trg");return V.find(Se=>Se[0]===_e[0]&&Se[1]===_e[1])?V:[...V,_e]},[]);this.segments=N.map(V=>{let me=this.segments.filter(Se=>{let Ne=Se.get("trg");return Ne[0]===V[0]&&Ne[1]===V[1]}),_e=K0(me);return new lc({geometry:new uc(_e)})})}let z=K0(this.segments),F=new lc({geometry:new uc(z)});F.set("graph",u),F.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[r]?.length>=2&&(F.set("minResolution",this.graphsResolutions[r][0]),F.set("maxResolution",this.graphsResolutions[r][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(F),this.loading=!1}).catch(P=>{P.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new sn("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new lc;if(s.set("viaPointIdx",u),Array.isArray(n))return s.setGeometry(new _a(n)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s);if(!this.useRawViaPoints||$0.test(n)){let V,me;return this.useRawViaPoints?[,V,,me]=$0.exec(n)||[]:[V,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${V}?key=${this.stopsApiKey}`,{signal:r.signal}).then(_e=>_e.json()).then(_e=>{let{coordinates:Se}=_e.features[0].geometry;return this.cacheStationData[n]=co(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(co(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(_e=>{_e.name!=="AbortError"&&(this.dispatchEvent(new sn("error")),this.onRouteError(_e,this),this.loading=!1)})}if(this.useRawViaPoints&&X0.test(n)){let[V,me]=X0.exec(n)||[],_e=co([parseFloat(me),parseFloat(V)],this.map?.getView().getProjection());return s.setGeometry(new _a(_e)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,N]=SE.exec(n)||[];if(F&&z){let V=co([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",N),s.setGeometry(new _a(V)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}return P?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${P}&limit=1`,{signal:r.signal}).then(V=>V.json()).then(V=>{let{coordinates:me}=V.features[0].geometry;return this.cacheStationData[n]=co(me),s.set("viaPointTrack",N),s.setGeometry(new _a(co(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(V=>(this.dispatchEvent(new sn("error")),this.onRouteError(V,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("viaPointIdx")!==void 0);if(r){this.removeViaPoint(r.get("viaPointIdx"));return}this.addViaPoint(n.coordinate)}onModifyStart(n){let u=-1,r=n.features.getArray().find(P=>P.getGeometry()?.getType()===Mt.LINE_STRING);if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=yl(new _a(r.getGeometry()?.getClosestPoint(n.mapBrowserEvent.coordinate)).getExtent(),.001);u=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(P))}let s=(n.features.getArray().filter(P=>P.getGeometry()?.getType()===Mt.POINT)||[])[0];this.initialRouteDrag={viaPoint:s,oldRoute:r&&r.clone(),segmentIndex:u}}onModifyEnd(n){let u=n.mapBrowserEvent.coordinate,{oldRoute:r,viaPoint:s,segmentIndex:P}=this.initialRouteDrag||{};return s?this.addViaPoint(u,s.get("viaPointIdx"),1):r?P===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(u,(P||0)+1):this.addViaPoint(u,0,1)}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new T_({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:n=>{let r=n.target.getFeaturesAtPixel(n.pixel,{hitTolerance:5}).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("index"));return A0(n)&&r?(this.removeViaPoint(r.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){!this.modify||(this.removeListeners(),this.onMapClickKey=this.map?.on("singleclick",this.onMapClick))}removeListeners(){this.onMapClickKey&&Ha(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Id.getGraphsResolutions(this.graphs,this.map),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.routingLayer?.attachToMap(this.map),this.modifyInteraction&&this.map.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}deactivate(){this.map&&(this.routingLayer?.detachFromMap(),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}render(){}},H0=Id;var M_=class extends af{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s,placeholder:P}=n||{};this.apiParams={limit:20,...u||{}},this.placeholder=P||"Search for a stop...";let z={apiKey:r};s&&(z.url=s),this.api=new Wf(z),this.abortController=new AbortController}deactivate(){}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},Y0=M_;var k_=class extends Y0{onSuggestionClick(p){let n=co(p.geometry.coordinates);this.map.getView().setCenter(n)}},J0=k_;var e1=Gp(Q0());var z_=class extends Is{constructor(n){super(n);this.olLayer=new Hh({source:new cf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let u=this.getMapboxMapClass();this.mbMap=new u({style:Zh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new sn("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=oc(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},dg=z_;var np=class extends dg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{!this.mbMap||(this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return tf(this)}getMapboxMapClass(){return e1.Map}clone(n){return new np({...this.options,...n})}};var i1=Gp(r1());var op=class extends dg{getOlLayerRender(){return ef(this)}getMapboxMapClass(){return i1.Map}clone(n){return new op({...this.options,...n})}};var Cd=class extends Is{constructor(n){super(n);this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=u=>!!this.styleLayers?.find(r=>u.id===r.id))}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none",F=P.layers||[];for(let N=0;N<F.length;N+=1){let V=F[N];r(V)&&s.getLayer(V.id)&&s.setLayoutProperty(V.id,"visibility",z)}}}clone(n){return new Cd({...this.options,...n})}},n1=Cd;var N_=Gp(l1()),V_=Gp(f1());function aT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||ia.TOPOGRAPHIC,this.api=u.api||new $f(u),this.tenant=u.tenant||"",this.minZoomInterpolation=u.minZoomInterpolation||8,this.format=new bl;let r=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"];this.motsByZoom=u.motsByZoom||[r],this.getMotsByZoom=s=>u.getMotsByZoom&&u.getMotsByZoom(s,this.motsByZoom)||this.motsByZoom[s]||this.motsByZoom[this.motsByZoom.length-1],this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=s=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(s,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[s],this.renderTimeIntervalByZoom=u.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=s=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(s,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[s],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:N,sort:V,time:me,live:_e,canvas:Se,styleOptions:Ne}=u,Je=Se,Ce=s||1,Ue=me||new Date,Ye=r||Kh;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{get:()=>(Je||(Je=document.createElement("canvas")),Je),set:rt=>{Je=rt}},style:{get:()=>Ye,set:rt=>{Ye=rt,this.renderTrajectories()}},styleOptions:{value:{...rf,...Ne||{}}},speed:{get:()=>Ce,set:rt=>{Ce=rt,this.start()}},filter:{value:N,writable:!0},sort:{value:V,writable:!0},live:{value:_e===!1?_e:!0,writable:!0},time:{get:()=>Ue,set:rt=>{Ue=rt&&rt.getTime?rt:new Date(rt),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas&&(this.canvas.getContext("2d")?.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap())}start(){this.stop(),this.purgeOutOfDateTrajectories(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=Hf(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{filter:this.filter,noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(r),this.mots&&s.push(`mots=${this.mots}`)),this.api.bbox=s}setMode(u){this.mode!==u&&(this.mode=u,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=yl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let N=[];for(let V=0;V<F.length&&(F[V].properties.coordinate&&Kp(z,F[V].properties.coordinate)&&N.push(F[V]),N.length!==P);V+=1);return Promise.resolve({layer:this,features:N.map(V=>this.format.readFeature(V)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([u,r])=>{let s=r?.properties?.time_intervals;this.time&&s.length&&s[s.length-1][0]<this.time&&this.trackerLayer.removeTrajectory(u)})}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Lo(r,z)||this.mots&&!this.mots.includes(P)||P!=="rail"&&s<9?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?(this.stop(),this.trajectories={}):this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===ia.TOPOGRAPHIC&&F?r.properties.olGeometry={type:"Point",coordinates:co(F,this.map.getView().getProjection())}:r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var gg=aT;var sT=new Xl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),lT=(y,p,n)=>{let u="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[sT,new Xl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},yg=lT;var uT=new Xl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),cT=new Xl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),hT=()=>[uT,cT],d1=hT;var pT=new bl,Ad=class extends gg(Is){constructor(n){super({...n});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!n.allowRenderWhenAnimating,this.olLayer=n.olLayer||new x_({layers:[new tp({source:new rp({features:[]}),style:(u,r)=>(n.fullTrajectoryStyle||yg)(u,r,this.styleOptions)}),new Hh({source:new cf({}),render:u=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:r,resolution:s,rotation:P}=u.viewState,{center:z,resolution:F,rotation:N}=this.renderedViewState;if(F/s>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let V=this.map.getPixelFromCoordinate(z),me=this.map.getPixelFromCoordinate(r);this.transformContainer.style.transform=Rv(V[0]-me[0],V[1]-me[1],F/s,F/s,P-N,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],u=>{let r=(u.map||u.target).getView();if(r.getAnimating()||r.getInteracting())return;let s=r.getZoom();this.currentZoom!==s&&this.onZoomEnd(),this.currentZoom=s,this.onMoveEnd(u)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(n){if(this.map&&this.canvas){let u=this.canvas.getContext("2d"),r=this.map.getPixelFromCoordinate(n);return!!u?.getImageData(r[0]*(this.pixelRatio||1),r[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(n){if(!this.map)return;let u=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:u.calculateExtent(),resolution:u.getResolution(),rotation:u.getRotation(),zoom:u.getZoom(),pixelRatio:this.pixelRatio},n)}renderTrajectoriesInternal(n,u){if(!this.map)return!1;let r=!1;return r=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(n,u),r&&(this.renderedViewState={...n},this.transformContainer&&(this.transformContainer.style.transform="")),r}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(n,u={}){let r=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(n,{resolution:r,...u})}onMoveEnd(n){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd()}onFeatureHover(n,u,r){super.onFeatureHover(n,u,r),this.map.getTargetElement().style.cursor=n.length?"pointer":"auto"}onFeatureClick(n,u,r){super.onFeatureClick(n,u,r),!n.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(n,u,r){return super.purgeTrajectory(n,u||this.map.getView().calculateExtent(),r||this.map.getView().getZoom())}setBbox(n,u){let r=n,s=u;!r&&this.isUpdateBboxOnMoveEnd&&(r=n||this.map.getView().calculateExtent(),s=Math.floor(this.map.getView().getZoom())),super.setBbox(r,s)}highlightTrajectory(n){this.api.getFullTrajectory(n,this.mode,this.generalizationLevel).then(u=>{let r=u.content;if(this.vectorLayer.getSource().clear(),!r||!r.features||!r.features.length)return;let s=pT.readFeatures(r);this.vectorLayer.getSource().addFeatures(s)})}clone(n){return new Ad({...this.options,...n})}},m1=Ad;var Pd=class extends Is{getFeatureInfoAtCoordinate(p){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(p);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:p})}clone(p){return new Pd({...this.options,...p})}},g1=Pd;var Md=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Md({...this.options,...n})}},y1=Md;var wg={};ay(wg,{CopyrightControl:()=>_1,Layer:()=>vg,RealtimeAPI:()=>$f,RealtimeLayer:()=>L1,RealtimeModes:()=>ia,RoutingAPI:()=>Zf,StopsAPI:()=>Wf,compareDepartures:()=>id,createRealtimeFilters:()=>hy,debounceDeparturesMessages:()=>Ay,debounceWebsocketMessages:()=>Xf,getCircleCanvas:()=>Oy,getDelayBgCanvas:()=>zy,getDelayTextCanvas:()=>Dy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>Kf,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getMercatorResolution:()=>bg,getSourceCoordinates:()=>Rd,getTextCanvas:()=>Fy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Zh,pad:()=>zm,realtimeConfig:()=>rf,realtimeDefaultStyle:()=>Kh,realtimeDelayStyle:()=>By,realtimeSimpleStyle:()=>Uy,removeDuplicate:()=>Wh,renderTrajectories:()=>Hf,sortAndFilterDepartures:()=>nd,sortByDelay:()=>py});var G_=class extends Wm{constructor(p){super(p),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},_1=G_;var kd=class extends hg(ip){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ha(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let n=this.map.getBounds().toArray();return td([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new kd({...this.options,...n})}},vg=kd;var jo=63710088e-1,v1={centimeters:jo*100,centimetres:jo*100,degrees:jo/111325,feet:jo*3.28084,inches:jo*39.37,kilometers:jo/1e3,kilometres:jo/1e3,meters:jo,metres:jo,miles:jo/1609.344,millimeters:jo*1e3,millimetres:jo*1e3,nauticalmiles:jo/1852,radians:1,yards:jo*1.0936},P5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/jo,yards:1.0936133};function x1(y,p,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=p||{},u.geometry=y,u}function xh(y,p,n){if(n===void 0&&(n={}),!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!j_(y[0])||!j_(y[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:y};return x1(u,p,n)}function fT(y,p){p===void 0&&(p="kilometers");var n=v1[p];if(!n)throw new Error(p+" units is invalid");return y*n}function dT(y,p){p===void 0&&(p="kilometers");var n=v1[p];if(!n)throw new Error(p+" units is invalid");return y/n}function b1(y){var p=y%(2*Math.PI);return p*180/Math.PI}function ap(y){var p=y%360;return p*Math.PI/180}function xg(y,p,n){if(p===void 0&&(p="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return fT(dT(y,p),n)}function j_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function q_(y){return!!y&&y.constructor===Object}function Ld(y,p,n){if(y!==null)for(var u,r,s,P,z,F,N,V=0,me=0,_e,Se=y.type,Ne=Se==="FeatureCollection",Je=Se==="Feature",Ce=Ne?y.features.length:1,Ue=0;Ue<Ce;Ue++){N=Ne?y.features[Ue].geometry:Je?y.geometry:y,_e=N?N.type==="GeometryCollection":!1,z=_e?N.geometries.length:1;for(var Ye=0;Ye<z;Ye++){var rt=0,_t=0;if(P=_e?N.geometries[Ye]:N,P!==null){F=P.coordinates;var dt=P.type;switch(V=n&&(dt==="Polygon"||dt==="MultiPolygon")?1:0,dt){case null:break;case"Point":if(p(F,me,Ue,rt,_t)===!1)return!1;me++,rt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(p(F[u],me,Ue,rt,_t)===!1)return!1;me++,dt==="MultiPoint"&&rt++}dt==="LineString"&&rt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-V;r++){if(p(F[u][r],me,Ue,rt,_t)===!1)return!1;me++}dt==="MultiLineString"&&rt++,dt==="Polygon"&&_t++}dt==="Polygon"&&rt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(_t=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-V;s++){if(p(F[u][r][s],me,Ue,rt,_t)===!1)return!1;me++}_t++}rt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(Ld(P.geometries[u],p,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function mT(y,p){p===void 0&&(p={});var n=0,u=0,r=0;return Ld(y,function(s){n+=s[0],u+=s[1],r++},!0),xh([n/r,u/r],p.properties)}var w1=mT;function Mu(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function E1(y){if(Array.isArray(y))return y;if(y.type==="Feature"){if(y.geometry!==null)return y.geometry.coordinates}else if(y.coordinates)return y.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function gT(y,p,n){n===void 0&&(n={});var u;n.final?u=T1(Mu(p),Mu(y)):u=T1(Mu(y),Mu(p));var r=u>180?-(360-u):u;return r}function T1(y,p){var n=ap(y[1]),u=ap(p[1]),r=ap(p[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(b1(P)+360)%360}var S1=gT;function yT(y,p,n){n===void 0&&(n={});var u=Mu(y),r=Mu(p);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=_T(u,r),P=xg(s,"meters",n.units);return P}function _T(y,p,n){n=n===void 0?jo:Number(n);var u=n,r=y[1]*Math.PI/180,s=p[1]*Math.PI/180,P=s-r,z=Math.abs(p[0]-y[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(F)>1e-11?P/F:Math.cos(r),V=Math.sqrt(P*P+N*N*z*z),me=V*u;return me}var I1=yT;function vT(y,p,n,u){u===void 0&&(u={});var r=p<0,s=xg(Math.abs(p),u.units,"meters");r&&(s=-Math.abs(s));var P=Mu(y),z=xT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,xh(z,u.properties)}function xT(y,p,n,u){u=u===void 0?jo:Number(u);var r=p/u,s=y[0]*Math.PI/180,P=ap(y[1]),z=ap(n),F=r*Math.cos(z),N=P+F;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(V)>1e-11?F/V:Math.cos(P),_e=r*Math.sin(z)/me,Se=s+_e;return[(Se*180/Math.PI+540)%360-180,N*180/Math.PI]}var C1=vT;function bT(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return A1(y);case"FeatureCollection":return wT(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Z_(y);default:throw new Error("unknown GeoJSON type")}}function A1(y){var p={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:p[n]=y[n]}}),p.properties=P1(y.properties),p.geometry=Z_(y.geometry),p}function P1(y){var p={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?p[n]=null:Array.isArray(u)?p[n]=u.map(function(r){return r}):p[n]=P1(u):p[n]=u}),p}function wT(y){var p={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:p[n]=y[n]}}),p.features=y.features.map(function(n){return A1(n)}),p}function Z_(y){var p={type:y.type};return y.bbox&&(p.bbox=y.bbox),y.type==="GeometryCollection"?(p.geometries=y.geometries.map(function(n){return Z_(n)}),p):(p.coordinates=M1(y.coordinates),p)}function M1(y){var p=y;return typeof p[0]!="object"?p.slice():p.map(function(n){return M1(n)})}var k1=bT;function ET(y,p,n){if(n=n||{},!q_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!y)throw new Error("geojson is required");if(p==null||isNaN(p))throw new Error("angle is required");return p===0||(u||(u=w1(y)),(r===!1||r===void 0)&&(y=k1(y)),Ld(y,function(s){var P=S1(u,s),z=P+p,F=I1(u,s),N=E1(C1(u,F,z));s[0]=N[0],s[1]=N[1]})),y}var W_=ET;var TT=(y,p=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/p}),P=y.unproject({x:n/p,y:u/p}),z=y.unproject({x:n/p,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Rd=TT;var ST=y=>{let p=y.getBounds().toArray(),n=co(p[0]),u=co(p[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Eu(r)/P;return Math.max(z,F)},bg=ST;var X_=class extends gg(vg){constructor(p={}){super({...p}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(p,n){!p||(super.attachToMap(p),this.source={type:"canvas",canvas:this.canvas,coordinates:Rd(p,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},p.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(p=>{Ha(p)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(p){super.onUserMoveCallback({coordinate:co(p.lngLat.toArray()),...p})}renderTrajectories(p=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=W_(xh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=W_(xh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...co(z),...co(F)],V=bs(N)/(n/this.pixelRatio),me=Eu(N)/(u/this.pixelRatio),_e=Math.max(V,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:co([r.lng,r.lat]),extent:N,resolution:_e,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,p)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(p,n={}){let u=bg(this.map);return super.getFeatureInfoAtCoordinate(p,{resolution:u,...n})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(p,n,u){return super.purgeTrajectory(p,n||this.getMercatorExtent(),u||Math.floor(this.map.getZoom()+1))}setBbox(p,n){let u=p,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=p||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(p,n=!1){let u=super.renderTrajectoriesInternal(p,n);if(u&&this.map.style){let r=Rd(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(p,n,u){super.onFeatureHover(p,n,u),this.map.getCanvasContainer().style.cursor=p.length?"pointer":"auto"}},L1=X_;var $_={ol:_g,mapbox:wg};typeof window<"u"&&(window.mbt=$_);var M3=$_;})();
1082
+ `){Sr+=Ar,Ar=0,Qt=_e*dt+Nt*Se,++_r;continue}var ei=Ne[br+1]||F.font;ei!==Er&&(r&&hr.push("font",ei),u&&Pt.push("font",ei),Er=ei),Ar=Math.max(Ar,rt[Dr]);var bi=[Gt,Qt+Nt*Ye[Dr]+_e*(Ye[Dr]-_t[_r]),.5*(Se+Ar)+Sr];Qt+=Ye[Dr],r&&hr.push("strokeText",bi),u&&Pt.push("fillText",bi),++Dr}return Array.prototype.push.apply(ht,hr),Array.prototype.push.apply(ht,Pt),this.labels_[s]=Lt,Lt},y.prototype.replayTextBackground_=function(p,n,u,r,s,P,z){p.beginPath(),p.moveTo.apply(p,n),p.lineTo.apply(p,u),p.lineTo.apply(p,r),p.lineTo.apply(p,s),p.lineTo.apply(p,n),P&&(this.alignFill_=P[2],this.fill_(p)),z&&(this.setStrokeStyle_(p,z),p.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(p,n,u,r,s,P,z,F,N,V,me,_e,Se,Ne,Je,Ce){z*=_e[0],F*=_e[1];var Ue=u-z,Ye=r-F,rt=s+N>p?p-N:s,_t=P+V>n?n-V:P,dt=Ne[3]+rt*_e[0]+Ne[1],ht=Ne[0]+_t*_e[1]+Ne[2],Tt=Ue-Ne[3],It=Ye-Ne[0];(Je||me!==0)&&(gh[0]=Tt,yh[0]=Tt,gh[1]=It,yc[1]=It,yc[0]=Tt+dt,_c[0]=yc[0],_c[1]=It+ht,yh[1]=_c[1]);var Lt;return me!==0?(Lt=vs(za(),u,r,1,1,me,-u,-r),bo(Lt,gh),bo(Lt,yc),bo(Lt,_c),bo(Lt,yh),sh(Math.min(gh[0],yc[0],_c[0],yh[0]),Math.min(gh[1],yc[1],_c[1],yh[1]),Math.max(gh[0],yc[0],_c[0],yh[0]),Math.max(gh[1],yc[1],_c[1],yh[1]),uf)):sh(Math.min(Tt,Tt+dt),Math.min(It,It+ht),Math.max(Tt,Tt+dt),Math.max(It,It+ht),uf),Se&&(Ue=Math.round(Ue),Ye=Math.round(Ye)),{drawImageX:Ue,drawImageY:Ye,drawImageW:rt,drawImageH:_t,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ce},canvasTransform:Lt,scale:_e}},y.prototype.replayImageOrLabel_=function(p,n,u,r,s,P,z){var F=!!(P||z),N=r.declutterBox,V=p.canvas,me=z?z[2]*r.scale[0]/2:0,_e=N.minX-me<=V.width/n&&N.maxX+me>=0&&N.minY-me<=V.height/n&&N.maxY+me>=0;return _e&&(F&&this.replayTextBackground_(p,gh,yc,_c,yh,P,z),Vx(p,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(p){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;p.save(),p.translate(n[0]%u,n[1]%u),p.rotate(this.viewRotation_)}p.fill(),this.alignFill_&&p.restore()},y.prototype.setStrokeStyle_=function(p,n){p.strokeStyle=n[1],p.lineWidth=n[2],p.lineCap=n[3],p.lineJoin=n[4],p.miterLimit=n[5],p.setLineDash&&(p.lineDashOffset=n[7],p.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(p,n,u,r){var s=this.textStates[n],P=this.createLabel(p,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,N=a0(Array.isArray(p)?p[0]:p,s.textAlign||mh),V=_d[s.textBaseline||ep],me=z&&z.lineWidth?z.lineWidth:0,_e=P.width/F-2*s.scale[0],Se=N*_e+2*(.5-N)*me,Ne=V*P.height/F+2*(.5-V)*me;return{label:P,anchorX:Se,anchorY:Ne}},y.prototype.execute_=function(p,n,u,r,s,P,z,F){var N;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),kv(this.renderedTransform_,u));for(var V=0,me=r.length,_e=0,Se,Ne,Je,Ce,Ue,Ye,rt,_t,dt,ht,Tt,It,Lt=0,er=0,Nt=null,Qt=null,hr=this.coordinateCache_,Pt=this.viewRotation_,Ar=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,Sr={context:p,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Pt},Dr=this.instructions!=r||this.overlaps?0:200,_r,Er,br,si;V<me;){var Gt=r[V],ei=Gt[0];switch(ei){case qr.BEGIN_GEOMETRY:_r=Gt[1],si=Gt[3],_r.getGeometry()?z!==void 0&&!Lo(z,si.getExtent())?V=Gt[2]+1:++V:V=Gt[2];break;case qr.BEGIN_PATH:Lt>Dr&&(this.fill_(p),Lt=0),er>Dr&&(p.stroke(),er=0),!Lt&&!er&&(p.beginPath(),Ce=NaN,Ue=NaN),++V;break;case qr.CIRCLE:_e=Gt[1];var bi=N[_e],ti=N[_e+1],zi=N[_e+2],Vr=N[_e+3],Pn=zi-bi,to=Vr-ti,vi=Math.sqrt(Pn*Pn+to*to);p.moveTo(bi+vi,ti),p.arc(bi,ti,vi,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:p.closePath(),++V;break;case qr.CUSTOM:_e=Gt[1],Se=Gt[2];var Ir=Gt[3],On=Gt[4],Mi=Gt.length==6?Gt[5]:void 0;Sr.geometry=Ir,Sr.feature=_r,V in hr||(hr[V]=[]);var Gi=hr[V];Mi?Mi(N,_e,Se,2,Gi):(Gi[0]=N[_e],Gi[1]=N[_e+1],Gi.length=2),On(Gi,Sr),++V;break;case qr.DRAW_IMAGE:_e=Gt[1],Se=Gt[2],_t=Gt[3],Ne=Gt[4],Je=Gt[5];var qo=Gt[6],Wn=Gt[7],Yr=Gt[8],ln=Gt[9],Xn=Gt[10],$n=Gt[11],Fn=Gt[12],Xi=Gt[13],mn=Gt[14];if(!_t&&Gt.length>=19){dt=Gt[18],ht=Gt[19],Tt=Gt[20],It=Gt[21];var En=this.drawLabelWithPointPlacement_(dt,ht,Tt,It);_t=En.label,Gt[3]=_t;var wo=Gt[22];Ne=(En.anchorX-wo)*this.pixelRatio,Gt[4]=Ne;var wt=Gt[23];Je=(En.anchorY-wt)*this.pixelRatio,Gt[5]=Je,qo=_t.height,Gt[6]=qo,Xi=_t.width,Gt[13]=Xi}var Xt=void 0;Gt.length>24&&(Xt=Gt[24]);var ho=void 0,gn=void 0,Wr=void 0;Gt.length>16?(ho=Gt[15],gn=Gt[16],Wr=Gt[17]):(ho=dc,gn=!1,Wr=!1),Xn&&Ar?$n+=Pt:!Xn&&!Ar&&($n-=Pt);for(var Mn=0;_e<Se;_e+=2)if(!(Xt&&Xt[Mn++]<Xi/this.pixelRatio)){var Bi=this.calculateImageOrLabelDimensions_(_t.width,_t.height,N[_e],N[_e+1],Xi,qo,Ne,Je,Yr,ln,$n,Fn,s,ho,gn||Wr,_r),fn=[p,n,_t,Bi,Wn,gn?Nt:null,Wr?Qt:null],Kn=void 0,Zt=void 0;if(F&&mn){var Ur=Se-_e;if(!mn[Ur]){mn[Ur]=fn;continue}if(Kn=mn[Ur],delete mn[Ur],Zt=o0(Kn),F.collides(Zt))continue}F&&F.collides(Bi.declutterBox)||(Kn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Kn)),F&&F.insert(Bi.declutterBox),this.replayImageOrLabel_.apply(this,fn))}++V;break;case qr.DRAW_CHARS:var Or=Gt[1],ji=Gt[2],Tn=Gt[3],Pr=Gt[4];It=Gt[5];var ro=Gt[6],$i=Gt[7],wi=Gt[8];Tt=Gt[9];var te=Gt[10];dt=Gt[11],ht=Gt[12];var he=[Gt[13],Gt[13]],de=this.textStates[ht],Te=de.font,Re=[de.scale[0]*$i,de.scale[1]*$i],Xe=void 0;Te in this.widths_?Xe=this.widths_[Te]:(Xe={},this.widths_[Te]=Xe);var Qe=eg(N,Or,ji,2),we=Math.abs(Re[0])*i_(Te,dt,Xe);if(Pr||we<=Qe){var Ve=this.textStates[ht].textAlign,ie=(Qe-we)*_d[Ve],W=n0(N,Or,ji,2,dt,ie,ro,Math.abs(Re[0]),i_,Te,Xe,Ar?0:this.viewRotation_);e:if(W){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=W.length;re<le;++re){ge=W[re],Ae=ge[4],ke=this.createLabel(Ae,ht,"",Tt),Ne=ge[2]+(Re[0]<0?-te:te),Je=Tn*ke.height+(.5-Tn)*2*te*Re[1]/Re[0]-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ne,Je,0,0,ge[3],he,!1,dc,!1,_r);if(F&&F.collides(Bi.declutterBox))break e;J.push([p,n,ke,Bi,1,null,null])}if(It)for(re=0,le=W.length;re<le;++re){ge=W[re],Ae=ge[4],ke=this.createLabel(Ae,ht,It,""),Ne=ge[2],Je=Tn*ke.height-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ne,Je,0,0,ge[3],he,!1,dc,!1,_r);if(F&&F.collides(Bi.declutterBox))break e;J.push([p,n,ke,Bi,1,null,null])}F&&F.load(J.map(o0));for(var Ie=0,Le=J.length;Ie<Le;++Ie)this.replayImageOrLabel_.apply(this,J[Ie])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){_r=Gt[1];var Ke=P(_r,si);if(Ke)return Ke}++V;break;case qr.FILL:Dr?Lt++:this.fill_(p),++V;break;case qr.MOVE_TO_LINE_TO:for(_e=Gt[1],Se=Gt[2],Er=N[_e],br=N[_e+1],Ye=Er+.5|0,rt=br+.5|0,(Ye!==Ce||rt!==Ue)&&(p.moveTo(Er,br),Ce=Ye,Ue=rt),_e+=2;_e<Se;_e+=2)Er=N[_e],br=N[_e+1],Ye=Er+.5|0,rt=br+.5|0,(_e==Se-2||Ye!==Ce||rt!==Ue)&&(p.lineTo(Er,br),Ce=Ye,Ue=rt);++V;break;case qr.SET_FILL_STYLE:Nt=Gt,this.alignFill_=Gt[2],Lt&&(this.fill_(p),Lt=0,er&&(p.stroke(),er=0)),p.fillStyle=Gt[1],++V;break;case qr.SET_STROKE_STYLE:Qt=Gt,er&&(p.stroke(),er=0),this.setStrokeStyle_(p,Gt),++V;break;case qr.STROKE:Dr?er++:p.stroke(),++V;break;default:++V;break}}Lt&&this.fill_(p),er&&p.stroke()},y.prototype.execute=function(p,n,u,r,s,P){this.viewRotation_=r,this.execute_(p,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(p,n,u,r,s){return this.viewRotation_=u,this.execute_(p,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),s0=t2;var h_=[Dn.POLYGON,Dn.CIRCLE,Dn.LINE_STRING,Dn.IMAGE,Dn.TEXT,Dn.DEFAULT],r2=function(){function y(p,n,u,r,s,P){this.maxExtent_=p,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(p,n){var u=this.getClipCoords(n);p.beginPath(),p.moveTo(u[0],u[1]),p.lineTo(u[2],u[3]),p.lineTo(u[4],u[5]),p.lineTo(u[6],u[7]),p.clip()},y.prototype.createExecutors_=function(p){for(var n in p){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=p[n];for(var s in r){var P=r[s];u[s]=new s0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(p){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=p.length;r<s;++r)if(p[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(p,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-p[0],-p[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(z,z));var V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):N||V.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),yy(me,p),yl(me,n*(this.renderBuffer_+r),me));var _e=i2(r),Se;function Ne(ht,Tt){for(var It=V.getImageData(0,0,z,z).data,Lt=0,er=_e.length;Lt<er;Lt++)if(It[_e[Lt]]>0){if(!P||Se!==Dn.IMAGE&&Se!==Dn.TEXT||P.indexOf(ht)!==-1){var Nt=(_e[Lt]-3)/4,Qt=r-Nt%z,hr=r-(Nt/z|0),Pt=s(ht,Tt,Qt*Qt+hr*hr);if(Pt)return Pt}V.clearRect(0,0,z,z);break}}var Je=Object.keys(this.executorsByZIndex_).map(Number);Je.sort(rh);var Ce,Ue,Ye,rt,_t;for(Ce=Je.length-1;Ce>=0;--Ce){var dt=Je[Ce].toString();for(Ye=this.executorsByZIndex_[dt],Ue=h_.length-1;Ue>=0;--Ue)if(Se=h_[Ue],rt=Ye[Se],rt!==void 0&&(_t=rt.executeHitDetection(V,F,u,Ne,me),_t))return _t}},y.prototype.getClipCoords=function(p){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,p,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(p,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(p.save(),this.clip(p,u));var N=P||h_,V,me,_e,Se,Ne,Je;for(z&&F.reverse(),V=0,me=F.length;V<me;++V){var Ce=F[V].toString();for(Ne=this.executorsByZIndex_[Ce],_e=0,Se=N.length;_e<Se;++_e){var Ue=N[_e];Je=Ne[Ue],Je!==void 0&&Je.execute(p,n,u,r,s,z)}}this.maxExtent_&&p.restore()},y}(),p_={};function i2(y){if(p_[y]!==void 0)return p_[y];for(var p=y*2+1,n=y*y,u=new Array(n+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((y+r)*p+(y+s))*4+3),r>0&&z.push(((y-r)*p+(y+s))*4+3),s>0&&(z.push(((y+r)*p+(y-s))*4+3),r>0&&z.push(((y-r)*p+(y-s))*4+3))}for(var F=[],r=0,N=u.length;r<N;++r)u[r]&&F.push.apply(F,u[r]);return p_[y]=F,F}var f_=r2;var xd={ANIMATING:0,INTERACTING:1};var n2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),o2=function(y){n2(p,y);function p(n,u,r,s,P,z,F){var N=y.call(this)||this;return N.context_=n,N.pixelRatio_=u,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=z,N.userTransform_=F,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return p.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,N=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var me=0,_e=P.length;me<_e;me+=2){var Se=P[me]-this.imageAnchorX_,Ne=P[me+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Je=Se+this.imageAnchorX_,Ce=Ne+this.imageAnchorY_;vs(F,Je,Ce,1,1,V,-Je,-Ce),z.setTransform.apply(z,F),z.translate(Je,Ce),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ne,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=N)}},p.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var N=P[u]+this.textOffsetX_,V=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,N,V,1,1,F,-N,-V);z.setTransform.apply(z,me),z.translate(N,V),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,N,V),this.textFillState_&&z.fillText(this.text_,N,V)}}},p.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var N=F.length;P&&(N-=2);for(var V=2;V<N;V+=2)z.lineTo(F[V],F[V+1]);return P&&z.closePath(),r},p.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},p.prototype.drawCircle=function(n){if(!!Lo(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=gx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},p.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},p.prototype.setTransform=function(n){this.transform_=n},p.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Mt.POINT:this.drawPoint(n);break;case Mt.LINE_STRING:this.drawLineString(n);break;case Mt.POLYGON:this.drawPolygon(n);break;case Mt.MULTI_POINT:this.drawMultiPoint(n);break;case Mt.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Mt.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Mt.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Mt.CIRCLE:this.drawCircle(n);break;default:}},p.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Lo(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},p.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},p.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},p.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},p.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},p.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Lo(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var N=0,V=z.length;N<V;++N)P=this.moveToLineTo_(s,P,z[N],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},p.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},p.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,N=P.length;F<N;++F){var V=P[F];s=this.drawRings_(r,s,V,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},p.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},p.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},p.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:mh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},p.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),N=u.getLineDashOffset(),V=u.getLineJoin(),me=u.getWidth(),_e=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:Qh,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ne){return Ne*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}},p.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},p.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),me=s.getWidth(),_e=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:Qh,lineDash:F||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:me!==void 0?me:mc,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ne=n.getOffsetX(),Je=n.getOffsetY(),Ce=n.getRotateWithView(),Ue=n.getRotation(),Ye=n.getScaleArray(),rt=n.getText(),_t=n.getTextAlign(),dt=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:ng,textAlign:_t!==void 0?_t:mh,textBaseline:dt!==void 0?dt:ep},this.text_=rt!==void 0?Array.isArray(rt)?rt.reduce(function(ht,Tt,It){return ht+=It%2?" ":Tt},""):rt:"",this.textOffsetX_=Ne!==void 0?this.pixelRatio_*Ne:0,this.textOffsetY_=Je!==void 0?this.pixelRatio_*Je:0,this.textRotateWithView_=Ce!==void 0?Ce:!1,this.textRotation_=Ue!==void 0?Ue:0,this.textScale_=[this.pixelRatio_*Ye[0],this.pixelRatio_*Ye[1]]}},p}(og),l0=o2;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var a2=function(){function y(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return y.prototype.clear=function(){this.cache_={},this.cacheSize_=0},y.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},y.prototype.expire=function(){if(this.canExpireCache()){var p=0;for(var n in this.cache_){var u=this.cache_[n];(p++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(p,n,u){var r=u0(p,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(p,n,u,r){var s=u0(p,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(p){this.maxCacheSize_=p,this.expire()},y}();function u0(y,p,n){var u=n?rg(n):"null";return p+":"+y+":"+u}var d_=new a2;var s2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),l2=function(y){s2(p,y);function p(n,u,r,s){var P=y.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return p.prototype.changed=function(){this.dispatchEvent(Qi.CHANGE)},p.prototype.getExtent=function(){return this.extent},p.prototype.getImage=function(){return jr()},p.prototype.getPixelRatio=function(){return this.pixelRatio_},p.prototype.getResolution=function(){return this.resolution},p.prototype.getState=function(){return this.state},p.prototype.load=function(){jr()},p}(nh),c0=l2;var u2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),pL=function(y){u2(p,y);function p(n,u,r,s,P,z){var F=y.call(this,n,u,r,Wi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=Wi.IDLE,F.imageLoadFunction_=z,F}return p.prototype.getImage=function(){return this.image_},p.prototype.handleImageError_=function(){this.state=Wi.ERROR,this.unlistenImage_(),this.changed()},p.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=Wi.LOADED,this.unlistenImage_(),this.changed()},p.prototype.load=function(){(this.state==Wi.IDLE||this.state==Wi.ERROR)&&(this.state=Wi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=m_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},p.prototype.setImage=function(n){this.image_=n,this.resolution=Eu(this.extent)/this.image_.height},p.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},p}(c0);function m_(y,p,n){var u=y,r=!0,s=!1,P=!1,z=[qp(u,Qi.LOAD,function(){P=!0,s||p()})];return u.src&&Pv?(s=!0,u.decode().then(function(){r&&p()}).catch(function(F){r&&(P?p():n())})):z.push(qp(u,Qi.ERROR,n)),function(){r=!1,z.forEach(Po)}}var c2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),bd=null,h2=function(y){c2(p,y);function p(n,u,r,s,P,z){var F=y.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return p.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===Wi.LOADED){bd||(bd=Ja(1,1)),bd.drawImage(this.image_,0,0);try{bd.getImageData(0,0,1,1),this.tainted_=!1}catch{bd=null,this.tainted_=!0}}return this.tainted_===!0},p.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Qi.CHANGE)},p.prototype.handleImageError_=function(){this.imageState_=Wi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},p.prototype.handleImageLoad_=function(){this.imageState_=Wi.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},p.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},p.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},p.prototype.getImageState=function(){return this.imageState_},p.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},p.prototype.getSize=function(){return this.size_},p.prototype.getSrc=function(){return this.src_},p.prototype.load=function(){if(this.imageState_==Wi.IDLE){this.imageState_=Wi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=m_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},p.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==Wi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=rg(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],me=0,_e=P.length;me<_e;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=N,P[me+3]*=V;r.putImageData(s,0,0)}}},p.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},p}(nh);function h0(y,p,n,u,r,s){var P=d_.get(p,u,s);return P||(P=new h2(y,p,n,u,r,s),d_.set(p,u,s,P)),P}var p2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),f2=function(y){p2(p,y);function p(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=y.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var V=r.src;wn(!(V!==void 0&&N),4),wn(!N||N&&u.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Pi(N)),wn(V!==void 0&&V.length>0,6);var me=r.src!==void 0?Wi.IDLE:Wi.LOADED;return u.color_=r.color!==void 0?Jh(r.color):null,u.iconImage_=h0(N,V,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return p.prototype.clone=function(){var n=this.getScale();return new p({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},p.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Pu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},p.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},p.prototype.getColor=function(){return this.color_},p.prototype.getImage=function(n){return this.iconImage_.getImage(n)},p.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},p.prototype.getImageSize=function(){return this.iconImage_.getSize()},p.prototype.getImageState=function(){return this.iconImage_.getImageState()},p.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},p.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},p.prototype.getSrc=function(){return this.iconImage_.getSrc()},p.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},p.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(Qi.CHANGE,n)},p.prototype.load=function(){this.iconImage_.load()},p.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(Qi.CHANGE,n)},p}(tg),g_=f2;var $l=.5;function p0(y,p,n,u,r,s,P){var z=y[0]*$l,F=y[1]*$l,N=Ja(z,F);N.imageSmoothingEnabled=!1;for(var V=N.canvas,me=new l0(N,$l,r,null,P),_e=n.length,Se=Math.floor((256*256*256-1)/_e),Ne={},Je=1;Je<=_e;++Je){var Ce=n[Je-1],Ue=Ce.getStyleFunction()||u;if(!!u){var Ye=Ue(Ce,s);if(!!Ye){Array.isArray(Ye)||(Ye=[Ye]);for(var rt=Je*Se,_t="#"+("000000"+rt.toString(16)).slice(-6),dt=0,ht=Ye.length;dt<ht;++dt){var Tt=Ye[dt],It=Tt.getGeometryFunction()(Ce);if(!(!It||!Lo(r,It.getExtent()))){var Lt=Tt.clone(),er=Lt.getFill();er&&er.setColor(_t);var Nt=Lt.getStroke();Nt&&(Nt.setColor(_t),Nt.setLineDash(null)),Lt.setText(void 0);var Qt=Tt.getImage();if(Qt&&Qt.getOpacity()!==0){var hr=Qt.getImageSize();if(!hr)continue;var Pt=Ja(hr[0],hr[1],void 0,{alpha:!1}),Ar=Pt.canvas;Pt.fillStyle=_t,Pt.fillRect(0,0,Ar.width,Ar.height),Lt.setImage(new g_({img:Ar,imgSize:hr,anchor:Qt.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Qt.getOrigin(),opacity:1,size:Qt.getSize(),scale:Qt.getScale(),rotation:Qt.getRotation(),rotateWithView:Qt.getRotateWithView()}))}var Sr=Lt.getZIndex()||0,Dr=Ne[Sr];Dr||(Dr={},Ne[Sr]=Dr,Dr[Mt.POLYGON]=[],Dr[Mt.CIRCLE]=[],Dr[Mt.LINE_STRING]=[],Dr[Mt.POINT]=[]),Dr[It.getType().replace("Multi","")].push(It,Lt)}}}}}for(var _r=Object.keys(Ne).map(Number).sort(rh),Je=0,Er=_r.length;Je<Er;++Je){var Dr=Ne[_r[Je]];for(var br in Dr)for(var si=Dr[br],dt=0,ht=si.length;dt<ht;dt+=2){me.setStyle(si[dt+1]);for(var Gt=0,ei=p.length;Gt<ei;++Gt)me.setTransform(p[Gt]),me.drawGeometry(si[dt])}}return N.getImageData(0,0,V.width,V.height)}function f0(y,p,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*$l),s=Math.floor(Math.round(y[1])*$l),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],N=n.data[P+2],V=N+256*(F+256*z),me=Math.floor((256*256*256-1)/p.length);V&&V%me===0&&u.push(p[V/me-1])}return u}var d2=.5,d0={Point:b2,LineString:_2,Polygon:E2,MultiPoint:w2,MultiLineString:v2,MultiPolygon:x2,GeometryCollection:y2,Circle:m2};function m0(y,p){return parseInt(Pi(y),10)-parseInt(Pi(p),10)}function g0(y,p){var n=ag(y,p);return n*n}function ag(y,p){return d2*y/p}function m2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Dn.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(p,u)}}function y_(y,p,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var N=F.getImageState();N==Wi.LOADED||N==Wi.ERROR?F.unlistenImageChange(r):(N==Wi.IDLE&&F.load(),N=F.getImageState(),F.listenImageChange(r),z=!0)}return g2(y,p,n,u,s,P),z}function g2(y,p,n,u,r,s){var P=n.getGeometryFunction()(p);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)y0(y,z,n,p);else{var N=d0[z.getType()];N(y,z,n,p,s)}}}function y0(y,p,n,u){if(p.getType()==Mt.GEOMETRY_COLLECTION){for(var r=p.getGeometries(),s=0,P=r.length;s<P;++s)y0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),Dn.DEFAULT);z.drawCustom(p,u,n.getRenderer(),n.getHitDetectionRenderer())}function y2(y,p,n,u,r){var s=p.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=d0[s[P].getType()];F(y,s[P],n,u,r)}}function _2(y,p,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Dn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(p,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);F.setTextStyle(z),F.drawText(p,u)}}function v2(y,p,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Dn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(p,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);F.setTextStyle(z),F.drawText(p,u)}}function x2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),Dn.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(p,u)}}function b2(y,p,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=Wi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Dn.IMAGE);F.setImageStyle(s,z),F.drawPoint(p,u)}if(P&&P.getText()){var N=y.getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(P,z),N.drawText(p,u)}}function w2(y,p,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=Wi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Dn.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(p,u)}if(P&&P.getText()){var N=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(P,z),N.drawText(p,u)}}function E2(y,p,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Dn.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(p,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(p,u)}}var T2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),S2=function(y){T2(p,y);function p(n){var u=y.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return p.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,N=P.projection,V=P.rotation,me=N.getExtent(),_e=this.getLayer().getSource(),Se=u.pixelRatio,Ne=u.viewHints,Je=!(Ne[xd.ANIMATING]||Ne[xd.INTERACTING]),Ce=this.context,Ue=Math.round(u.size[0]*Se),Ye=Math.round(u.size[1]*Se),rt=_e.getWrapX()&&N.canWrapX(),_t=rt?bs(me):null,dt=rt?Math.ceil((s[2]-me[2])/_t)+1:1,ht=rt?Math.floor((s[0]-me[0])/_t):0;do{var Tt=this.getRenderTransform(z,F,V,Se,Ue,Ye,ht*_t);n.execute(Ce,1,Tt,V,Je,void 0,r)}while(++ht<dt)},p.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},p.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];Lv(this.pixelTransform,1/r,1/r),zv(this.inversePixelTransform,this.pixelTransform);var P=fy(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var me=Math.round(n.size[0]*r),_e=Math.round(n.size[1]*r);F.width!=me||F.height!=_e?(F.width=me,F.height=_e,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,_e),this.preRender(z,n);var Se=n.viewState,Ne=Se.projection,Je=!1,Ce=!0;if(s.extent&&this.clipping){var Ue=rd(s.extent,Ne);Ce=Lo(Ue,n.extent),Je=Ce&&!sc(Ue,n.extent),Je&&this.clipUnrotated(z,n,Ue)}Ce&&this.renderWorlds(N,n),Je&&z.restore(),this.postRender(z,n);var Ye=Fx(s.opacity),rt=this.container;return Ye!==rt.style.opacity&&(rt.style.opacity=Ye),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},p.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];bo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),me=[],_e=r[0]*$l,Se=r[1]*$l;me.push(this.getRenderTransform(s,P,z,$l,_e,Se,0).slice());var Ne=V.getSource(),Je=F.getExtent();if(Ne.getWrapX()&&F.canWrapX()&&!sc(Je,N)){for(var Ce=N[0],Ue=bs(Je),Ye=0,rt=void 0;Ce<Je[0];)--Ye,rt=Ue*Ye,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ce+=Ue;for(Ye=0,Ce=N[2];Ce>Je[2];)++Ye,rt=Ue*Ye,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ce-=Ue}this.hitDetectionImageData_=p0(r,me,this.renderedFeatures_,V.getStyleFunction(),N,P,z)}u(f0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},p.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,N=u.viewState.rotation,V=this.getLayer(),me={},_e=function(Je,Ce,Ue){var Ye=Pi(Je),rt=me[Ye];if(rt){if(rt!==!0&&Ue<rt.distanceSq){if(Ue===0)return me[Ye]=!0,P.splice(P.lastIndexOf(rt),1),s(Je,V,Ce);rt.geometry=Ce,rt.distanceSq=Ue}}else{if(Ue===0)return me[Ye]=!0,s(Je,V,Ce);P.push(me[Ye]={feature:Je,layer:V,geometry:Ce,distanceSq:Ue,callback:s})}},Se,Ne=[this.replayGroup_];return this.declutterExecutorGroup&&Ne.push(this.declutterExecutorGroup),Ne.some(function(Je){return Se=Je.forEachFeatureAtCoordinate(n,F,N,r,_e,Je===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ce){return Ce.value}):null)}),Se}},p.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},p.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},p.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[xd.ANIMATING],P=n.viewHints[xd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=n.extent,V=n.viewState,me=V.projection,_e=V.resolution,Se=n.pixelRatio,Ne=u.getRevision(),Je=u.getRenderBuffer(),Ce=u.getRenderOrder();Ce===void 0&&(Ce=m0);var Ue=V.center.slice(),Ye=yl(N,Je*_e),rt=Ye.slice(),_t=[Ye.slice()],dt=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!sc(dt,n.extent)){var ht=bs(dt),Tt=Math.max(bs(Ye)/2,ht);Ye[0]=dt[0]-Tt,Ye[2]=dt[2]+Tt,ex(Ue,me);var It=Jv(_t[0],me);It[0]<dt[0]&&It[2]<dt[2]?_t.push([It[0]+ht,It[1],It[2]+ht,It[3]]):It[0]>dt[0]&&It[2]>dt[2]&&_t.push([It[0]-ht,It[1],It[2]-ht,It[3]])}if(!this.dirty_&&this.renderedResolution_==_e&&this.renderedRevision_==Ne&&this.renderedRenderOrder_==Ce&&sc(this.wrappedRenderedExtent_,Ye))return _s(this.renderedExtent_,rt)||(this.hitDetectionImageData_=null,this.renderedExtent_=rt),this.renderedCenter_=Ue,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Lt=new c_(ag(_e,Se),Ye,_e,Se),er;this.getLayer().getDeclutter()&&(er=new c_(ag(_e,Se),Ye,_e,Se));var Nt=uh(),Qt;if(Nt){for(var hr=0,Pt=_t.length;hr<Pt;++hr){var Ar=_t[hr],Sr=Qp(Ar,me);r.loadFeatures(Sr,nx(_e,me),Nt)}Qt=Gm(Nt,me)}else for(var hr=0,Pt=_t.length;hr<Pt;++hr)r.loadFeatures(_t[hr],_e,me);var Dr=g0(_e,Se),_r=function(ei){var bi,ti=ei.getStyleFunction()||u.getStyleFunction();if(ti&&(bi=ti(ei,_e)),bi){var zi=this.renderFeature(ei,Dr,bi,Lt,Qt,er);this.dirty_=this.dirty_||zi}}.bind(this),Er=Qp(Ye,me),br=r.getFeaturesInExtent(Er);Ce&&br.sort(Ce);for(var hr=0,Pt=br.length;hr<Pt;++hr)_r(br[hr]);this.renderedFeatures_=br;var si=Lt.finish(),Gt=new f_(Ye,_e,Se,r.getOverlaps(),si,u.getRenderBuffer());return er&&(this.declutterExecutorGroup=new f_(Ye,_e,Se,r.getOverlaps(),er.finish(),u.getRenderBuffer())),this.renderedResolution_=_e,this.renderedRevision_=Ne,this.renderedRenderOrder_=Ce,this.renderedExtent_=rt,this.wrappedRenderedExtent_=Ye,this.renderedCenter_=Ue,this.renderedProjection_=me,this.replayGroup_=Gt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},p.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)F=y_(s,n,r[N],u,this.boundHandleStyleImageChange_,P,z)||F;else F=y_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},p}(i0),_0=S2;var I2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),C2=function(y){I2(p,y);function p(n){return y.call(this,n)||this}return p.prototype.createRenderer=function(){return new _0(this)},p}(Hx),tp=C2;var v0=Gp(s_(),1);var A2=function(){function y(p){this.rbush_=new v0.default(p),this.items_={}}return y.prototype.insert=function(p,n){var u={minX:p[0],minY:p[1],maxX:p[2],maxY:p[3],value:n};this.rbush_.insert(u),this.items_[Pi(n)]=u},y.prototype.load=function(p,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=p[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Pi(z)]=F}this.rbush_.load(u)},y.prototype.remove=function(p){var n=Pi(p),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(p,n){var u=this.items_[Pi(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Vm(r,p)||(this.remove(n),this.insert(p,n))},y.prototype.getAll=function(){var p=this.rbush_.all();return p.map(function(n){return n.value})},y.prototype.getInExtent=function(p){var n={minX:p[0],minY:p[1],maxX:p[2],maxY:p[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(p){return this.forEach_(this.getAll(),p)},y.prototype.forEachInExtent=function(p,n){return this.forEach_(this.getInExtent(p),n)},y.prototype.forEach_=function(p,n){for(var u,r=0,s=p.length;r<s;r++)if(u=n(p[r]),u)return u;return u},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(p){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,p)},y.prototype.concat=function(p){this.rbush_.load(p.rbush_.all());for(var n in p.items_)this.items_[n]=p.items_[n]},y}(),wd=A2;var P2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),M2=function(y){P2(p,y);function p(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=x0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Su.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return p.prototype.getAttributions=function(){return this.attributions_},p.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},p.prototype.getProjection=function(){return this.projection},p.prototype.getResolutions=function(){return jr()},p.prototype.getView=function(){return this.viewPromise_},p.prototype.getState=function(){return this.state_},p.prototype.getWrapX=function(){return this.wrapX_},p.prototype.getInterpolate=function(){return this.interpolate_},p.prototype.refresh=function(){this.changed()},p.prototype.setAttributions=function(n){this.attributions_=x0(n),this.changed()},p.prototype.setState=function(n){this.state_=n,this.changed()},p}(Mo);function x0(y){return y?Array.isArray(y)?function(p){return y}:typeof y=="function"?y:function(p){return[y]}:null}var cf=M2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function b0(y,p){return[[-1/0,-1/0,1/0,1/0]]}var _h={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var k2=!1;function L2(y,p,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),p.getType()==_h.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=k2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var N=p.getType(),V=void 0;N==_h.JSON||N==_h.TEXT?V=z.responseText:N==_h.XML?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):N==_h.ARRAY_BUFFER&&(V=z.response),V?s(p.readFeatures(V,{extent:n,featureProjection:r}),p.readProjection(V)):P()}else P()},z.onerror=P,z.send()}function __(y,p){return function(n,u,r,s,P){var z=this;L2(y,p,n,u,r,function(F,N){z.addFeatures(F),s!==void 0&&s(F)},P||qh)}}var w0=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vh=function(y){w0(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return p}(sn);var R2=function(y){w0(p,y);function p(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=qh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(wn(u.format_,7),u.loader_=__(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:b0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new wd:null,u.loadedExtentsRtree_=new wd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new ch(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return p.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},p.prototype.addFeatureInternal=function(n){var u=Pi(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new vh(Qa.ADDFEATURE,n))},p.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[uo(u,Qi.CHANGE,this.handleFeatureChange_,this),uo(u,jp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},p.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(wn(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},p.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},p.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],N=Pi(F);this.addToIndex_(N,F)&&r.push(F)}for(var P=0,V=r.length;P<V;P++){var F=r[P],N=Pi(F);this.setupChangeEvents_(N,F);var me=F.getGeometry();if(me){var _e=me.getExtent();u.push(_e),s.push(F)}else this.nullGeometryFeatures_[N]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new vh(Qa.ADDFEATURE,r[P]))},p.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(ws.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(ws.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},p.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Po)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new vh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},p.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},p.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},p.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},p.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},p.prototype.getFeaturesCollection=function(){return this.featuresCollection_},p.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(n,Pm(this.nullGeometryFeatures_))),n},p.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},p.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},p.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,N=[-1/0,-1/0,1/0,1/0],V=u||Am;return this.featuresRtree_.forEachInExtent(N,function(me){if(V(me)){var _e=me.getGeometry(),Se=F;if(F=_e.closestPointXY(r,s,z,F),F<Se){P=me;var Ne=Math.sqrt(F);N[0]=r-Ne,N[1]=s-Ne,N[2]=r+Ne,N[3]=s+Ne}}}),P},p.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},p.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},p.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},p.prototype.getFormat=function(){return this.format_},p.prototype.getOverlaps=function(){return this.overlaps_},p.prototype.getUrl=function(){return this.url_},p.prototype.handleFeatureChange_=function(n){var u=n.target,r=Pi(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new vh(Qa.CHANGEFEATURE,u))},p.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Pi(n)in this.uidIndex_},p.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},p.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,_e){var Se=P[me],Ne=s.forEachInExtent(Se,function(Je){return sc(Je.extent,Se)});Ne||(++F.loadingExtentsCount_,F.dispatchEvent(new vh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(Je){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADEND,void 0,Je))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,N=0,V=P.length;N<V;++N)z(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},p.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},p.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Vm(s.extent,n))return r=s,!0}),r&&u.remove(r)},p.prototype.removeFeature=function(n){if(!!n){var u=Pi(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},p.prototype.removeFeatureInternal=function(n){var u=Pi(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Po),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new vh(Qa.REMOVEFEATURE,n)),n}},p.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},p.prototype.setLoader=function(n){this.loader_=n},p.prototype.setUrl=function(n){wn(this.format_,7),this.url_=n,this.setLoader(__(n,this.format_))},p}(cf),rp=R2;var E0=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hf=function(y){E0(p,y);function p(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return p}(sn);var v_={LAYERS:"layers"},z2=function(y){E0(p,y);function p(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=y.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(v_.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):wn(typeof P.getArray=="function",43):P=new ch(void 0,{unique:!0}),u.setLayers(P),u}return p.prototype.handleLayerChange_=function(){this.changed()},p.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Po),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(uo(n,ws.ADD,this.handleLayersAdd_,this),uo(n,ws.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Po);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new hf("addlayer",z))}this.changed()},p.prototype.registerLayerListeners_=function(n){var u=[uo(n,jp.PROPERTYCHANGE,this.handleLayerChange_,this),uo(n,Qi.CHANGE,this.handleLayerChange_,this)];n instanceof p&&u.push(uo(n,"addlayer",this.handleLayerGroupAdd_,this),uo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Pi(n)]=u},p.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new hf("addlayer",n.layer))},p.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new hf("removelayer",n.layer))},p.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new hf("addlayer",u)),this.changed()},p.prototype.handleLayersRemove_=function(n){var u=n.element,r=Pi(u);this.listenerKeys_[r].forEach(Po),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",u)),this.changed()},p.prototype.getLayers=function(){return this.get(v_.LAYERS)},p.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(v_.LAYERS,n)},p.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},p.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var N=u[z];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=$v(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return u},p.prototype.getSourceState=function(){return Su.READY},p}(Zm),x_=z2;var na={SINGLECLICK:"singleclick",CLICK:Qi.CLICK,DBLCLICK:Qi.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var b_={ACTIVE:"active"};var D2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(p,y);function p(n){var u=y.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return p.prototype.getActive=function(){return this.get(b_.ACTIVE)},p.prototype.getMap=function(){return this.map_},p.prototype.handleEvent=function(n){return!0},p.prototype.setActive=function(n){this.set(b_.ACTIVE,n)},p.prototype.setMap=function(n){this.map_=n},p}(Mo);var T0=O2;var F2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),B2=function(y){F2(p,y);function p(n){var u=this,r=n||{};return u=y.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return p.prototype.getPointerCount=function(){return this.targetPointers.length},p.prototype.handleDownEvent=function(n){return!1},p.prototype.handleDragEvent=function(n){},p.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==na.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==na.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==na.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==na.POINTERMOVE&&this.handleMoveEvent(n);return!u},p.prototype.handleMoveEvent=function(n){},p.prototype.handleUpEvent=function(n){return!1},p.prototype.stopDown=function(n){return n},p.prototype.updateTrackedPointers_=function(n){if(U2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==na.POINTERUP?delete this.trackedPointers_[r]:n.type==na.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Pm(this.trackedPointers_)}},p}(T0);function U2(y){var p=y.type;return p===na.POINTERDOWN||p===na.POINTERDRAG||p===na.POINTERUP}var S0=B2;var I0=function(y){var p=y.originalEvent;return p.altKey&&!(p.metaKey||p.ctrlKey)&&!p.shiftKey};var C0=Am,A0=function(y){return y.type==na.CLICK};var P0=function(y){return y.type==na.SINGLECLICK};var M0=function(y){var p=y.originalEvent;return wn(p!==void 0,56),p.isPrimary&&p.button===0};var N2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),V2=function(y){N2(p,y);function p(n,u,r){var s=y.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(n[0]))s.setCoordinates(n,u);else if(u!==void 0&&r)s.setFlatCoordinates(u,n),s.ends_=r;else{for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout()),Ka(F,_e.getFlatCoordinates()),N.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=N}return s}return p.prototype.appendLineString=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates().slice()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ud(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},p.prototype.getCoordinateAtM=function(n,u,r){if(this.layout!=An.XYM&&this.layout!=An.XYZM||this.flatCoordinates.length===0)return null;var s=u!==void 0?u:!1,P=r!==void 0?r:!1;return zx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},p.prototype.getCoordinates=function(){return ph(this.flatCoordinates,0,this.ends_,this.stride)},p.prototype.getEnds=function(){return this.ends_},p.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new uc(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},p.prototype.getLineStrings=function(){for(var n=this.flatCoordinates,u=this.ends_,r=this.layout,s=[],P=0,z=0,F=u.length;z<F;++z){var N=u[z],V=new uc(n.slice(P,N),r);s.push(V),P=N}return s},p.prototype.getFlatMidpoints=function(){for(var n=[],u=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,z=0,F=s.length;z<F;++z){var N=s[z],V=Qm(u,r,N,P,.5);Ka(n,V),r=N}return n},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=wx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new p(u,An.XY,r)},p.prototype.getType=function(){return Mt.MULTI_LINE_STRING},p.prototype.intersectsExtent=function(n){return Ax(this.flatCoordinates,0,this.ends_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=cd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},p}(Es),k0=V2;var G2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),j2=function(y){G2(p,y);function p(n,u){var r=y.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return p.prototype.appendPoint=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},p.prototype.clone=function(){var n=new p(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.flatCoordinates,z=this.stride,F=0,N=P.length;F<N;F+=z){var V=ql(n,u,P[F],P[F+1]);if(V<s){s=V;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},p.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},p.prototype.getPoint=function(n){var u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return n<0||u<=n?null:new _a(this.flatCoordinates.slice(n*this.stride,(n+1)*this.stride),this.layout)},p.prototype.getPoints=function(){for(var n=this.flatCoordinates,u=this.layout,r=this.stride,s=[],P=0,z=n.length;P<z;P+=r){var F=new _a(n.slice(P,P+r),u);s.push(F)}return s},p.prototype.getType=function(){return Mt.MULTI_POINT},p.prototype.intersectsExtent=function(n){for(var u=this.flatCoordinates,r=this.stride,s=0,P=u.length;s<P;s+=r){var z=u[s],F=u[s+1];if(Qf(n,z,F))return!0}return!1},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},p}(Es),sg=j2;function L0(y,p,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Nm(y,p,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),p=F[F.length-1]}return r}var q2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Z2=function(y){q2(p,y);function p(n,u,r){var s=y.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(n[0])){for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout());for(var Se=F.length,Ne=_e.getEnds(),Je=0,Ce=Ne.length;Je<Ce;++Je)Ne[Je]+=Se;Ka(F,_e.getFlatCoordinates()),N.push(Ne)}u=P,n=F,r=N}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return p.prototype.appendPolygon=function(n){var u;if(!this.flatCoordinates)this.flatCoordinates=n.getFlatCoordinates().slice(),u=n.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ka(this.flatCoordinates,n.getFlatCoordinates()),u=n.getEnds().slice();for(var s=0,P=u.length;s<P;++s)u[s]+=r}this.endss_.push(u),this.changed()},p.prototype.clone=function(){for(var n=this.endss_.length,u=new Array(n),r=0;r<n;++r)u[r]=this.endss_[r].slice();var s=new p(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},p.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_x(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),vx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},p.prototype.containsXY=function(n,u){return Ix(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},p.prototype.getArea=function(){return Tx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},p.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Hy(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,pd(u,0,this.endss_,this.stride)},p.prototype.getEndss=function(){return this.endss_},p.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=L0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Cx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},p.prototype.getInteriorPoints=function(){return new sg(this.getFlatInteriorPoints().slice(),An.XYM)},p.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Lx(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Hy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},p.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Ex(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new p(u,An.XY,r)},p.prototype.getPolygon=function(n){if(n<0||this.endss_.length<=n)return null;var u;if(n===0)u=0;else{var r=this.endss_[n-1];u=r[r.length-1]}var s=this.endss_[n].slice(),P=s[s.length-1];if(u!==0)for(var z=0,F=s.length;z<F;++z)s[z]-=u;return new md(this.flatCoordinates.slice(u,P),this.layout,s)},p.prototype.getPolygons=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.endss_,s=[],P=0,z=0,F=r.length;z<F;++z){var N=r[z].slice(),V=N[N.length-1];if(P!==0)for(var me=0,_e=N.length;me<_e;++me)N[me]-=P;var Se=new md(u.slice(P,V),n,N);s.push(Se),P=V}return s},p.prototype.getType=function(){return Mt.MULTI_POLYGON},p.prototype.intersectsExtent=function(n){return Px(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},p.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=bx(this.flatCoordinates,0,n,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},p}(Es),R0=Z2;var B0=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),z0=0,Ed=1,D0=[0,0,0,0],pf=[],w_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},E_=function(y){B0(p,y);function p(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return p}(sn);var W2=function(y){B0(p,y);function p(n){var u=y.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:M0,u.defaultDeleteCondition_=function(s){return I0(s)&&P0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:C0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new wd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new tp({source:new rp({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:$2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new ch(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(ws.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(ws.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return p.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(Qi.CHANGE,this.boundHandleFeatureChange_)},p.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ch;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,N=z.length;F<N;++F){var V=z[F].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new E_(w_.MODIFYSTART,this.featuresBeingModified_,n))}},p.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(Qi.CHANGE,this.boundHandleFeatureChange_)},p.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},p.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},p.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},p.prototype.getOverlay=function(){return this.overlay_},p.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},p.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},p.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},p.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},p.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},p.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},p.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},p.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(wu(z),F)}},p.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},p.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},p.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length;F<N;++F)for(var V=z[F],me=0,_e=V.length-1;me<_e;++me){var Se=V.slice(me,me+2),Ne={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(wu(Se),Ne)}},p.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:z0,segment:[r,r]},P={feature:n,geometry:u,index:Ed,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Yp(r),s);var F=u,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();F=F.clone().transform(N,V),F=Yy(F).transform(V,N)}this.rBush_.insert(F.getExtent(),P)},p.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},p.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new lc(new _a(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},p.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==na.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=na.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==na.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,n)&&!u},p.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],N=F[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var me=N.geometry;s.indexOf(me)===-1&&s.push(me);for(var _e=N.depth,Se=void 0,Ne=N.segment,Je=F[1];u.length<me.getStride();)u.push(Ne[Je][u.length]);switch(me.getType()){case Mt.POINT:Se=u,Ne[0]=u,Ne[1]=u;break;case Mt.MULTI_POINT:Se=me.getCoordinates(),Se[N.index]=u,Ne[0]=u,Ne[1]=u;break;case Mt.LINE_STRING:Se=me.getCoordinates(),Se[N.index+Je]=u,Ne[Je]=u;break;case Mt.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[_e[0]][N.index+Je]=u,Ne[Je]=u;break;case Mt.POLYGON:Se=me.getCoordinates(),Se[_e[0]][N.index+Je]=u,Ne[Je]=u;break;case Mt.MULTI_POLYGON:Se=me.getCoordinates(),Se[_e[1]][_e[0]][N.index+Je]=u,Ne[Je]=u;break;case Mt.CIRCLE:if(Ne[0]=u,Ne[1]=u,N.index===z0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ce=n.map.getView().getProjection(),Ue=Ty(Wl(me.getCenter(),Ce),Wl(u,Ce)),Ye=uh();if(Ye){var rt=me.clone().transform(Ye,Ce);rt.setRadius(Ue),Ue=rt.transform(Ce,Ye).getRadius()}me.setRadius(Ue),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},p.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=wu([z]),N=this.rBush_.getInExtent(F),V={};N.sort(X2);for(var me=0,_e=N.length;me<_e;++me){var Se=N[me],Ne=Se.segment,Je=Pi(Se.geometry),Ce=Se.depth;if(Ce&&(Je+="-"+Ce.join("-")),V[Je]||(V[Je]=new Array(2)),Se.geometry.getType()===Mt.CIRCLE&&Se.index===Ed){var Ue=F0(u,Se,s);Tu(Ue,z)&&!V[Je][0]&&(this.dragSegments_.push([Se,0]),V[Je][0]=Se);continue}if(Tu(Ne[0],z)&&!V[Je][0]){this.dragSegments_.push([Se,0]),V[Je][0]=Se;continue}if(Tu(Ne[1],z)&&!V[Je][1]){if((Se.geometry.getType()===Mt.LINE_STRING||Se.geometry.getType()===Mt.MULTI_LINE_STRING)&&V[Je][0]&&V[Je][0].index===0)continue;this.dragSegments_.push([Se,1]),V[Je][1]=Se;continue}Pi(Ne)in this.vertexSegments_&&!V[Je][0]&&!V[Je][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var Ye=P.length-1;Ye>=0;--Ye)this.insertVertex_(P[Ye],z)}return!!this.vertexFeature_},p.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Mt.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Yp(P),z);var N=s,V=uh();if(V){var me=n.map.getView().getProjection();N=N.clone().transform(V,me),N=Yy(N).transform(me,V)}this.rBush_.update(N.getExtent(),F)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new E_(w_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},p.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},p.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(Pt,Ar){return O0(P,Pt,z)-O0(P,Ar,z)},N,V;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(Pt){return Pt===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(Pt,Ar,Sr){if(Sr=Sr||Pt.getGeometry(),Sr.getType()===Mt.POINT&&vv(s.features_.getArray(),Pt)){V=Sr;var Dr=Sr.getFlatCoordinates().slice(0,2);N=[{feature:Pt,geometry:Sr,segment:[Dr,Dr]}]}return!0},{layerFilter:me})}if(!N){var _e=rd(Yp(P,D0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ne=Qp(yl(_e,Se,D0),z);N=this.rBush_.getInExtent(Ne)}if(N&&N.length>0){var Je=N.sort(F)[0],Ce=Je.segment,Ue=F0(P,Je,z),Ye=u.getPixelFromCoordinate(Ue),rt=Ty(n,Ye);if(V||rt<=this.pixelTolerance_){var _t={};if(_t[Pi(Ce)]=!0,this.snapToPointer_||(this.delta_[0]=Ue[0]-P[0],this.delta_[1]=Ue[1]-P[1]),Je.geometry.getType()===Mt.CIRCLE&&Je.index===Ed)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ue,[Je.feature],[Je.geometry]);else{var dt=u.getPixelFromCoordinate(Ce[0]),ht=u.getPixelFromCoordinate(Ce[1]),Tt=Jp(Ye,dt),It=Jp(Ye,ht);rt=Math.sqrt(Math.min(Tt,It)),this.snappedToVertex_=rt<=this.pixelTolerance_,this.snappedToVertex_&&(Ue=Tt>It?Ce[1]:Ce[0]),this.createOrUpdateVertexFeature_(Ue,[Je.feature],[Je.geometry]);var Lt={};Lt[Pi(Je.geometry)]=!0;for(var er=1,Nt=N.length;er<Nt;++er){var Qt=N[er].segment;if(Tu(Ce[0],Qt[0])&&Tu(Ce[1],Qt[1])||Tu(Ce[0],Qt[1])&&Tu(Ce[1],Qt[0])){var hr=Pi(N[er].geometry);hr in Lt||(Lt[hr]=!0,_t[Pi(Qt)]=!0)}else break}}this.vertexSegments_=_t;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},p.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,N;u.length<P.getStride();)u.push(0);switch(P.getType()){case Mt.MULTI_LINE_STRING:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.POLYGON:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.MULTI_POLYGON:N=P.getCoordinates(),N[z[1]][z[0]].splice(F+1,0,u);break;case Mt.LINE_STRING:N=P.getCoordinates(),N.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};V.insert(wu(me.segment),me),this.dragSegments_.push([me,1]);var _e={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};V.insert(wu(_e.segment),_e),this.dragSegments_.push([_e,0]),this.ignoreNextSingleClick_=!0},p.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=na.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new E_(w_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},p.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,N,V,me,_e,Se,Ne,Je;for(N=n.length-1;N>=0;--N)z=n[N],Ne=z[0],Je=Pi(Ne.feature),Ne.depth&&(Je+="-"+Ne.depth.join("-")),Je in u||(u[Je]={}),z[1]===0?(u[Je].right=Ne,u[Je].index=Ne.index):z[1]==1&&(u[Je].left=Ne,u[Je].index=Ne.index+1);for(Je in u){switch(Se=u[Je].right,me=u[Je].left,V=u[Je].index,_e=V-1,me!==void 0?Ne=me:Ne=Se,_e<0&&(_e=0),F=Ne.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Mt.MULTI_LINE_STRING:P[Ne.depth[0]].length>2&&(P[Ne.depth[0]].splice(V,1),r=!0);break;case Mt.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Mt.MULTI_POLYGON:s=s[Ne.depth[1]];case Mt.POLYGON:s=s[Ne.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),_e=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ce=[];if(me!==void 0&&(this.rBush_.remove(me),Ce.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ce.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ue={depth:Ne.depth,feature:Ne.feature,geometry:Ne.geometry,index:_e,segment:Ce};this.rBush_.insert(wu(Ue.segment),Ue)}this.updateSegmentIndices_(F,V,Ne.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},p.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},p.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},p}(S0);function X2(y,p){return y.index-p.index}function O0(y,p,n){var u=p.geometry;if(u.getType()===Mt.CIRCLE){var r=u;if(p.index===Ed){var s=uh();s&&(r=r.clone().transform(s,n));var P=Jp(r.getCenter(),Wl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Wl(y,n);return pf[0]=Wl(p.segment[0],n),pf[1]=Wl(p.segment[1],n),Qv(F,pf)}function F0(y,p,n){var u=p.geometry;if(u.getType()===Mt.CIRCLE&&p.index===Ed){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Cy(r.getClosestPoint(Wl(y,n)),n)}var P=Wl(y,n);return pf[0]=Wl(p.segment[0],n),pf[1]=Wl(p.segment[1],n),Cy(Ey(P,pf),n)}function $2(){var y=Wx();return function(p,n){return y[Mt.POINT]}}var T_=W2;var K2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),H2=function(y){K2(p,y);function p(n){var u=y.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return p.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Po),this.changeEventsKeys_.length=0},p.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(uo(this.geometries_[n],Qi.CHANGE,this.changed,this))},p.prototype.clone=function(){var n=new p(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},p.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.geometries_,z=0,F=P.length;z<F;++z)s=P[z].closestPointXY(n,u,r,s);return s},p.prototype.containsXY=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(n,u))return!0;return!1},p.prototype.computeExtent=function(n){Hp(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)Wv(n,u[r].getExtent());return n},p.prototype.getGeometries=function(){return U0(this.geometries_)},p.prototype.getGeometriesArray=function(){return this.geometries_},p.prototype.getGeometriesArrayRecursive=function(){for(var n=[],u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].getType()===this.getType()?n=n.concat(u[r].getGeometriesArrayRecursive()):n.push(u[r]);return n},p.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var u=[],r=this.geometries_,s=!1,P=0,z=r.length;P<z;++P){var F=r[P],N=F.getSimplifiedGeometry(n);u.push(N),N!==F&&(s=!0)}if(s){var V=new p(null);return V.setGeometriesArray(u),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},p.prototype.getType=function(){return Mt.GEOMETRY_COLLECTION},p.prototype.intersectsExtent=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)if(u[r].intersectsExtent(n))return!0;return!1},p.prototype.isEmpty=function(){return this.geometries_.length===0},p.prototype.rotate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(n,u);this.changed()},p.prototype.scale=function(n,u,r){var s=r;s||(s=$h(this.getExtent()));for(var P=this.geometries_,z=0,F=P.length;z<F;++z)P[z].scale(n,u,s);this.changed()},p.prototype.setGeometries=function(n){this.setGeometriesArray(U0(n))},p.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},p.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},p.prototype.translate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(n,u);this.changed()},p.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},p}(Km);function U0(y){for(var p=[],n=0,u=y.length;n<u;++n)p.push(y[n].clone());return p}var N0=H2;var Y2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(p,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(p);n.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(p){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},p)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(p,n){return jr()},y.prototype.readFeatures=function(p,n){return jr()},y.prototype.readGeometry=function(p,n){return jr()},y.prototype.readProjection=function(p){return jr()},y.prototype.writeFeature=function(p,n){return jr()},y.prototype.writeFeatures=function(p,n){return jr()},y.prototype.writeGeometry=function(p,n){return jr()},y}(),V0=Y2;function S_(y,p,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!ix(u,r)?s=(p?y.clone():y).transform(p?u:r,p?r:u):s=y,p&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var N=0,V=F.length;N<V;++N)F[N]=Math.round(F[N]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var J2=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(p,y);function p(){return y.call(this)||this}return p.prototype.getType=function(){return _h.JSON},p.prototype.readFeature=function(n,u){return this.readFeatureFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readFeatureFromObject=function(n,u){return jr()},p.prototype.readFeaturesFromObject=function(n,u){return jr()},p.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(lg(n),this.getReadOptions(n,u))},p.prototype.readGeometryFromObject=function(n,u){return jr()},p.prototype.readProjection=function(n){return this.readProjectionFromObject(lg(n))},p.prototype.readProjectionFromObject=function(n){return jr()},p.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},p.prototype.writeFeatureObject=function(n,u){return jr()},p.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},p.prototype.writeFeaturesObject=function(n,u){return jr()},p.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},p.prototype.writeGeometryObject=function(n,u){return jr()},p}(V0);function lg(y){if(typeof y=="string"){var p=JSON.parse(y);return p||null}else return y!==null?y:null}var G0=Q2;var eE=function(){var y=function(p,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(p,n)};return function(p,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(p,n);function u(){this.constructor=p}p.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),tE=function(y){eE(p,y);function p(n){var u=this,r=n||{};return u=y.call(this)||this,u.dataProjection=ya(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ya(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return p.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=I_(r.geometry,u),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},p.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,N=z.length;F<N;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},p.prototype.readGeometryFromObject=function(n,u){return I_(n,u)},p.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ya(u.properties.name):u.type==="EPSG"?r=ya("EPSG:"+u.properties.code):wn(!1,36):r=this.dataProjection,r},p.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=C_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},p.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},p.prototype.writeGeometryObject=function(n,u){return C_(n,this.adaptOptions(u))},p}(G0);function I_(y,p){if(!y)return null;var n;switch(y.type){case Mt.POINT:{n=iE(y);break}case Mt.LINE_STRING:{n=nE(y);break}case Mt.POLYGON:{n=lE(y);break}case Mt.MULTI_POINT:{n=aE(y);break}case Mt.MULTI_LINE_STRING:{n=oE(y);break}case Mt.MULTI_POLYGON:{n=sE(y);break}case Mt.GEOMETRY_COLLECTION:{n=rE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return S_(n,!1,p)}function rE(y,p){var n=y.geometries.map(function(u){return I_(u,p)});return new N0(n)}function iE(y){return new _a(y.coordinates)}function nE(y){return new uc(y.coordinates)}function oE(y){return new k0(y.coordinates)}function aE(y){return new sg(y.coordinates)}function sE(y){return new R0(y.coordinates)}function lE(y){return new md(y.coordinates)}function C_(y,p){y=S_(y,!0,p);var n=y.getType(),u;switch(n){case Mt.POINT:{u=dE(y,p);break}case Mt.LINE_STRING:{u=cE(y,p);break}case Mt.POLYGON:{u=mE(y,p);break}case Mt.MULTI_POINT:{u=pE(y,p);break}case Mt.MULTI_LINE_STRING:{u=hE(y,p);break}case Mt.MULTI_POLYGON:{u=fE(y,p);break}case Mt.GEOMETRY_COLLECTION:{u=uE(y,p);break}case Mt.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function uE(y,p){var n=y.getGeometriesArray().map(function(u){var r=Ra({},p);return delete r.featureProjection,C_(u,r)});return{type:"GeometryCollection",geometries:n}}function cE(y,p){return{type:"LineString",coordinates:y.getCoordinates()}}function hE(y,p){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function pE(y,p){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function fE(y,p){var n;return p&&(n=p.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function dE(y,p){return{type:"Point",coordinates:y.getCoordinates()}}function mE(y,p){var n;return p&&(n=p.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=tE;var ug,gE=new Uint8Array(16);function A_(){if(!ug&&(ug=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ug))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ug(gE)}var j0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function yE(y){return typeof y=="string"&&j0.test(y)}var q0=yE;var xa=[];for(cg=0;cg<256;++cg)xa.push((cg+256).toString(16).substr(1));var cg;function _E(y){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(xa[y[p+0]]+xa[y[p+1]]+xa[y[p+2]]+xa[y[p+3]]+"-"+xa[y[p+4]]+xa[y[p+5]]+"-"+xa[y[p+6]]+xa[y[p+7]]+"-"+xa[y[p+8]]+xa[y[p+9]]+"-"+xa[y[p+10]]+xa[y[p+11]]+xa[y[p+12]]+xa[y[p+13]]+xa[y[p+14]]+xa[y[p+15]]).toLowerCase();if(!q0(n))throw TypeError("Stringified UUID is invalid");return n}var Z0=_E;function vE(y,p,n){y=y||{};var u=y.random||(y.rng||A_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,p){n=n||0;for(var r=0;r<16;++r)p[n+r]=u[r];return p}return Z0(u)}var P_=vE;var ip=class extends Mo{constructor(n={}){super();this.properties={};this.options={};this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.options=n,this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=P_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let N=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",N||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(N=>N.visible)&&this.children.forEach(N=>{N.visible=!0}),this.parent&&this.group){let N=this.parent;for(;N.parent;)N=N.parent;let V=new sn("change:visible:group");V.target=this,N.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(N=>{N.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(N=>N.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(N=>{N.parent=void 0}),Array.isArray(F)&&F.forEach(N=>{N.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return Kf(this)}};function xE(y){return class extends y{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var hg=xE;var Td=class extends hg(ip){constructor(n){super(n);this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(n){super.defineProperties(n);let u=n.olLayer;Object.defineProperties(this,{olLayer:{get:()=>u,set:r=>{u!==r&&(u=r,u&&u.setVisible(this.visible),this.toggleVisibleListeners())}},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!this.map&&(this.olLayer?.setVisible(this.visible),this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ha(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ha([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new Td({...this.options,...n})}},Is=Td;var W0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),bE=new Xl({stroke:new va({color:[0,0,0,1],width:5})}),wE=new Xl({image:W0,stroke:new va({color:[255,0,0,1],width:3})}),EE=new Xl({image:W0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),TE=(y,p)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=p<=n&&p>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[bE,wE]:[EE]},Sd=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new tp({source:new rp,style:n.style||TE})}clone(n){return new Sd({...this.options,...n})}},pg=Sd;var SE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,X0=/^([\d.]+),([\d.]+)$/,$0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,fg="stop-fetch",K0=y=>{let p=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&p.push(...u)}),p},Id=class extends af{constructor(n={}){super(n);this.viaPoints=[];this.loading=!1;this.graphs=[];this.modify=!0;this.useRawViaPoints=!1;this.snapToClosestStation=!1;this.cacheStationData={};this.abortControllers={};this.segments=[];this.format=new bl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:u=>{u&&(this.set("mot",u),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:u=>{this.set("loading",u)}},modify:{get:()=>this.get("modify"),set:u=>{this.set("modify",u)}}}),this.loading=!1,this.graphs=n.graphs||[["osm",0,99]],this.mot=n.mot||"bus",this.modify=n.modify!==!1,this.routingApiParams=n.routingApiParams,this.useRawViaPoints=n.useRawViaPoints||!1,this.snapToClosestStation=n.snapToClosestStation||!1,this.apiKey=n.apiKey,this.stopsApiKey=n.stopsApiKey||this.apiKey,this.stopsApiUrl=n.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...n}),this.routingLayer=n.routingLayer||new pg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new sn("change:route")),this.reset(),console.error(u)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(n,u){let r=u.getView();return n.map(([,s,P])=>[r.getResolutionForZoom(s),r.getResolutionForZoom(P||s+1)])}addViaPoint(n,u=-1,r=0){this.viaPoints.splice(u===-1?this.viaPoints.length:u,r,n),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new sn("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new sn("change:route"))}abortRequests(){this.graphs.forEach(n=>{let u=n[0];this.abortControllers[u]&&this.abortControllers[u].abort(),this.abortControllers[u]=new AbortController}),this.abortControllers[fg]?.abort(),this.abortControllers[fg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer?.olLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[fg]);let n=this.viaPoints.map(u=>{if(Array.isArray(u)){let r=this.map?.getView().getProjection(),[s,P]=lh(u,r);return this.snapToClosestStation?[`@${P}`,s]:[P,s]}return this.useRawViaPoints?u:`!${u}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((u,r)=>this.drawViaPoint(u,r,this.abortControllers[fg])),Promise.all(this.graphs.map(([u],r)=>{let{signal:s}=this.abortControllers[u];return this.api?this.api.route({graph:u,via:`${n.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:s}).then(P=>{if(this.segments=this.format.readFeatures(P),this.mot==="foot"){let N=this.segments.reduce((V,me)=>{let _e=me.get("trg");return V.find(Se=>Se[0]===_e[0]&&Se[1]===_e[1])?V:[...V,_e]},[]);this.segments=N.map(V=>{let me=this.segments.filter(Se=>{let Ne=Se.get("trg");return Ne[0]===V[0]&&Ne[1]===V[1]}),_e=K0(me);return new lc({geometry:new uc(_e)})})}let z=K0(this.segments),F=new lc({geometry:new uc(z)});F.set("graph",u),F.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[r]?.length>=2&&(F.set("minResolution",this.graphsResolutions[r][0]),F.set("maxResolution",this.graphsResolutions[r][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(F),this.loading=!1}).catch(P=>{P.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new sn("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new lc;if(s.set("viaPointIdx",u),Array.isArray(n))return s.setGeometry(new _a(n)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s);if(!this.useRawViaPoints||$0.test(n)){let V,me;return this.useRawViaPoints?[,V,,me]=$0.exec(n)||[]:[V,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${V}?key=${this.stopsApiKey}`,{signal:r.signal}).then(_e=>_e.json()).then(_e=>{let{coordinates:Se}=_e.features[0].geometry;return this.cacheStationData[n]=co(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(co(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(_e=>{_e.name!=="AbortError"&&(this.dispatchEvent(new sn("error")),this.onRouteError(_e,this),this.loading=!1)})}if(this.useRawViaPoints&&X0.test(n)){let[V,me]=X0.exec(n)||[],_e=co([parseFloat(me),parseFloat(V)],this.map?.getView().getProjection());return s.setGeometry(new _a(_e)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,N]=SE.exec(n)||[];if(F&&z){let V=co([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",N),s.setGeometry(new _a(V)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}return P?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${P}&limit=1`,{signal:r.signal}).then(V=>V.json()).then(V=>{let{coordinates:me}=V.features[0].geometry;return this.cacheStationData[n]=co(me),s.set("viaPointTrack",N),s.setGeometry(new _a(co(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(V=>(this.dispatchEvent(new sn("error")),this.onRouteError(V,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("viaPointIdx")!==void 0);if(r){this.removeViaPoint(r.get("viaPointIdx"));return}this.addViaPoint(n.coordinate)}onModifyStart(n){let u=-1,r=n.features.getArray().find(P=>P.getGeometry()?.getType()===Mt.LINE_STRING);if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=yl(new _a(r.getGeometry()?.getClosestPoint(n.mapBrowserEvent.coordinate)).getExtent(),.001);u=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(P))}let s=(n.features.getArray().filter(P=>P.getGeometry()?.getType()===Mt.POINT)||[])[0];this.initialRouteDrag={viaPoint:s,oldRoute:r&&r.clone(),segmentIndex:u}}onModifyEnd(n){let u=n.mapBrowserEvent.coordinate,{oldRoute:r,viaPoint:s,segmentIndex:P}=this.initialRouteDrag||{};return s?this.addViaPoint(u,s.get("viaPointIdx"),1):r?P===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(u,(P||0)+1):this.addViaPoint(u,0,1)}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new T_({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:n=>{let r=n.target.getFeaturesAtPixel(n.pixel,{hitTolerance:5}).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("index"));return A0(n)&&r?(this.removeViaPoint(r.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){!this.modify||(this.removeListeners(),this.onMapClickKey=this.map?.on("singleclick",this.onMapClick))}removeListeners(){this.onMapClickKey&&Ha(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Id.getGraphsResolutions(this.graphs,this.map),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.routingLayer?.attachToMap(this.map),this.modifyInteraction&&this.map.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}deactivate(){this.map&&(this.routingLayer?.detachFromMap(),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}render(){}},H0=Id;var M_=class extends af{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s,placeholder:P}=n||{};this.apiParams={limit:20,...u||{}},this.placeholder=P||"Search for a stop...";let z={apiKey:r};s&&(z.url=s),this.api=new Wf(z),this.abortController=new AbortController}deactivate(){}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},Y0=M_;var k_=class extends Y0{onSuggestionClick(p){let n=co(p.geometry.coordinates);this.map.getView().setCenter(n)}},J0=k_;var e1=Gp(Q0());var z_=class extends Is{constructor(n){super(n);this.olLayer=new Hh({source:new cf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let u=this.getMapboxMapClass();this.mbMap=new u({style:Zh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new sn("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=oc(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},dg=z_;var np=class extends dg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{!this.mbMap||(this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return tf(this)}getMapboxMapClass(){return e1.Map}clone(n){return new np({...this.options,...n})}};var i1=Gp(r1());var op=class extends dg{getOlLayerRender(){return ef(this)}getMapboxMapClass(){return i1.Map}clone(n){return new op({...this.options,...n})}};var Cd=class extends Is{constructor(n){super(n);this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=u=>!!this.styleLayers?.find(r=>u.id===r.id))}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none",F=P.layers||[];for(let N=0;N<F.length;N+=1){let V=F[N];r(V)&&s.getLayer(V.id)&&s.setLayoutProperty(V.id,"visibility",z)}}}clone(n){return new Cd({...this.options,...n})}},n1=Cd;var N_=Gp(l1()),V_=Gp(f1());function aT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||ia.TOPOGRAPHIC,this.api=u.api||new $f(u),this.tenant=u.tenant||"",this.minZoomInterpolation=u.minZoomInterpolation||8,this.format=new bl;let r=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"];this.motsByZoom=u.motsByZoom||[r],this.getMotsByZoom=s=>u.getMotsByZoom&&u.getMotsByZoom(s,this.motsByZoom)||this.motsByZoom[s]||this.motsByZoom[this.motsByZoom.length-1],this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=s=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(s,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[s],this.renderTimeIntervalByZoom=u.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=s=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(s,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[s],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:N,sort:V,time:me,live:_e,canvas:Se,styleOptions:Ne}=u,Je=Se,Ce=s||1,Ue=me||new Date,Ye=r||Kh;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{get:()=>(Je||(Je=document.createElement("canvas")),Je),set:rt=>{Je=rt}},style:{get:()=>Ye,set:rt=>{Ye=rt,this.renderTrajectories()}},styleOptions:{value:{...rf,...Ne||{}}},speed:{get:()=>Ce,set:rt=>{Ce=rt,this.start()}},filter:{value:N,writable:!0},sort:{value:V,writable:!0},live:{value:_e===!1?_e:!0,writable:!0},time:{get:()=>Ue,set:rt=>{Ue=rt&&rt.getTime?rt:new Date(rt),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas&&(this.canvas.getContext("2d")?.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap())}start(){this.stop(),this.purgeOutOfDateTrajectories(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=Hf(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{filter:this.filter,noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(r),this.mots&&s.push(`mots=${this.mots}`)),this.api.bbox=s}setMode(u){this.mode!==u&&(this.mode=u,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=yl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let N=[];for(let V=0;V<F.length&&(F[V].properties.coordinate&&Kp(z,F[V].properties.coordinate)&&N.push(F[V]),N.length!==P);V+=1);return Promise.resolve({layer:this,features:N.map(V=>this.format.readFeature(V)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([u,r])=>{let s=r?.properties?.time_intervals;this.time&&s.length&&s[s.length-1][0]<this.time&&this.trackerLayer.removeTrajectory(u)})}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Lo(r,z)||this.mots&&!this.mots.includes(P)||P!=="rail"&&s<9?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?(this.stop(),this.trajectories={}):this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===ia.TOPOGRAPHIC&&F?r.properties.olGeometry={type:"Point",coordinates:co(F,this.map.getView().getProjection())}:r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var gg=aT;var sT=new Xl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),lT=(y,p,n)=>{let u="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[sT,new Xl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},yg=lT;var uT=new Xl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),cT=new Xl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),hT=()=>[uT,cT],d1=hT;var pT=new bl,Ad=class extends gg(Is){constructor(n){super({...n});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!n.allowRenderWhenAnimating,this.olLayer=n.olLayer||new x_({layers:[new tp({source:new rp({features:[]}),style:(u,r)=>(n.fullTrajectoryStyle||yg)(u,r,this.styleOptions)}),new Hh({source:new cf({}),render:u=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:r,resolution:s,rotation:P}=u.viewState,{center:z,resolution:F,rotation:N}=this.renderedViewState;if(F/s>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let V=this.map.getPixelFromCoordinate(z),me=this.map.getPixelFromCoordinate(r);this.transformContainer.style.transform=Rv(V[0]-me[0],V[1]-me[1],F/s,F/s,P-N,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],u=>{let r=(u.map||u.target).getView();if(r.getAnimating()||r.getInteracting())return;let s=r.getZoom();this.currentZoom!==s&&this.onZoomEnd(),this.currentZoom=s,this.onMoveEnd(u)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(n){if(this.map&&this.canvas){let u=this.canvas.getContext("2d"),r=this.map.getPixelFromCoordinate(n);return!!u?.getImageData(r[0]*(this.pixelRatio||1),r[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(n){if(!this.map)return;let u=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:u.calculateExtent(),resolution:u.getResolution(),rotation:u.getRotation(),zoom:u.getZoom(),pixelRatio:this.pixelRatio},n)}renderTrajectoriesInternal(n,u){if(!this.map)return!1;let r=!1;return r=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(n,u),r&&(this.renderedViewState={...n},this.transformContainer&&(this.transformContainer.style.transform="")),r}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(n,u={}){let r=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(n,{resolution:r,...u})}onMoveEnd(n){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd()}onFeatureHover(n,u,r){super.onFeatureHover(n,u,r),this.map.getTargetElement().style.cursor=n.length?"pointer":"auto"}onFeatureClick(n,u,r){super.onFeatureClick(n,u,r),!n.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(n,u,r){return super.purgeTrajectory(n,u||this.map.getView().calculateExtent(),r||this.map.getView().getZoom())}setBbox(n,u){let r=n,s=u;!r&&this.isUpdateBboxOnMoveEnd&&(r=n||this.map.getView().calculateExtent(),s=Math.floor(this.map.getView().getZoom())),super.setBbox(r,s)}highlightTrajectory(n){this.api.getFullTrajectory(n,this.mode,this.generalizationLevel).then(u=>{let r=u.content;if(this.vectorLayer.getSource().clear(),!r||!r.features||!r.features.length)return;let s=pT.readFeatures(r);this.vectorLayer.getSource().addFeatures(s)})}clone(n){return new Ad({...this.options,...n})}},m1=Ad;var Pd=class extends Is{getFeatureInfoAtCoordinate(p){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(p);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:p})}clone(p){return new Pd({...this.options,...p})}},g1=Pd;var Md=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Md({...this.options,...n})}},y1=Md;var wg={};ay(wg,{CopyrightControl:()=>_1,Layer:()=>vg,RealtimeAPI:()=>$f,RealtimeLayer:()=>L1,RealtimeModes:()=>ia,RoutingAPI:()=>Zf,StopsAPI:()=>Wf,compareDepartures:()=>id,createRealtimeFilters:()=>hy,debounceDeparturesMessages:()=>Ay,debounceWebsocketMessages:()=>Xf,getCircleCanvas:()=>Oy,getDelayBgCanvas:()=>zy,getDelayTextCanvas:()=>Dy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>Kf,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getMercatorResolution:()=>bg,getSourceCoordinates:()=>Rd,getTextCanvas:()=>Fy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Zh,pad:()=>zm,realtimeConfig:()=>rf,realtimeDefaultStyle:()=>Kh,realtimeDelayStyle:()=>By,realtimeSimpleStyle:()=>Uy,removeDuplicate:()=>Wh,renderTrajectories:()=>Hf,sortAndFilterDepartures:()=>nd,sortByDelay:()=>py});var G_=class extends Wm{constructor(p){super(p),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},_1=G_;var kd=class extends hg(ip){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ha(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let n=this.map.getBounds().toArray();return td([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new kd({...this.options,...n})}},vg=kd;var jo=63710088e-1,v1={centimeters:jo*100,centimetres:jo*100,degrees:jo/111325,feet:jo*3.28084,inches:jo*39.37,kilometers:jo/1e3,kilometres:jo/1e3,meters:jo,metres:jo,miles:jo/1609.344,millimeters:jo*1e3,millimetres:jo*1e3,nauticalmiles:jo/1852,radians:1,yards:jo*1.0936},P5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/jo,yards:1.0936133};function x1(y,p,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=p||{},u.geometry=y,u}function xh(y,p,n){if(n===void 0&&(n={}),!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!j_(y[0])||!j_(y[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:y};return x1(u,p,n)}function fT(y,p){p===void 0&&(p="kilometers");var n=v1[p];if(!n)throw new Error(p+" units is invalid");return y*n}function dT(y,p){p===void 0&&(p="kilometers");var n=v1[p];if(!n)throw new Error(p+" units is invalid");return y/n}function b1(y){var p=y%(2*Math.PI);return p*180/Math.PI}function ap(y){var p=y%360;return p*Math.PI/180}function xg(y,p,n){if(p===void 0&&(p="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return fT(dT(y,p),n)}function j_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function q_(y){return!!y&&y.constructor===Object}function Ld(y,p,n){if(y!==null)for(var u,r,s,P,z,F,N,V=0,me=0,_e,Se=y.type,Ne=Se==="FeatureCollection",Je=Se==="Feature",Ce=Ne?y.features.length:1,Ue=0;Ue<Ce;Ue++){N=Ne?y.features[Ue].geometry:Je?y.geometry:y,_e=N?N.type==="GeometryCollection":!1,z=_e?N.geometries.length:1;for(var Ye=0;Ye<z;Ye++){var rt=0,_t=0;if(P=_e?N.geometries[Ye]:N,P!==null){F=P.coordinates;var dt=P.type;switch(V=n&&(dt==="Polygon"||dt==="MultiPolygon")?1:0,dt){case null:break;case"Point":if(p(F,me,Ue,rt,_t)===!1)return!1;me++,rt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(p(F[u],me,Ue,rt,_t)===!1)return!1;me++,dt==="MultiPoint"&&rt++}dt==="LineString"&&rt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-V;r++){if(p(F[u][r],me,Ue,rt,_t)===!1)return!1;me++}dt==="MultiLineString"&&rt++,dt==="Polygon"&&_t++}dt==="Polygon"&&rt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(_t=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-V;s++){if(p(F[u][r][s],me,Ue,rt,_t)===!1)return!1;me++}_t++}rt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(Ld(P.geometries[u],p,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function mT(y,p){p===void 0&&(p={});var n=0,u=0,r=0;return Ld(y,function(s){n+=s[0],u+=s[1],r++},!0),xh([n/r,u/r],p.properties)}var w1=mT;function Mu(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function E1(y){if(Array.isArray(y))return y;if(y.type==="Feature"){if(y.geometry!==null)return y.geometry.coordinates}else if(y.coordinates)return y.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function gT(y,p,n){n===void 0&&(n={});var u;n.final?u=T1(Mu(p),Mu(y)):u=T1(Mu(y),Mu(p));var r=u>180?-(360-u):u;return r}function T1(y,p){var n=ap(y[1]),u=ap(p[1]),r=ap(p[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(b1(P)+360)%360}var S1=gT;function yT(y,p,n){n===void 0&&(n={});var u=Mu(y),r=Mu(p);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=_T(u,r),P=xg(s,"meters",n.units);return P}function _T(y,p,n){n=n===void 0?jo:Number(n);var u=n,r=y[1]*Math.PI/180,s=p[1]*Math.PI/180,P=s-r,z=Math.abs(p[0]-y[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(F)>1e-11?P/F:Math.cos(r),V=Math.sqrt(P*P+N*N*z*z),me=V*u;return me}var I1=yT;function vT(y,p,n,u){u===void 0&&(u={});var r=p<0,s=xg(Math.abs(p),u.units,"meters");r&&(s=-Math.abs(s));var P=Mu(y),z=xT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,xh(z,u.properties)}function xT(y,p,n,u){u=u===void 0?jo:Number(u);var r=p/u,s=y[0]*Math.PI/180,P=ap(y[1]),z=ap(n),F=r*Math.cos(z),N=P+F;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(V)>1e-11?F/V:Math.cos(P),_e=r*Math.sin(z)/me,Se=s+_e;return[(Se*180/Math.PI+540)%360-180,N*180/Math.PI]}var C1=vT;function bT(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return A1(y);case"FeatureCollection":return wT(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Z_(y);default:throw new Error("unknown GeoJSON type")}}function A1(y){var p={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:p[n]=y[n]}}),p.properties=P1(y.properties),p.geometry=Z_(y.geometry),p}function P1(y){var p={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?p[n]=null:Array.isArray(u)?p[n]=u.map(function(r){return r}):p[n]=P1(u):p[n]=u}),p}function wT(y){var p={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:p[n]=y[n]}}),p.features=y.features.map(function(n){return A1(n)}),p}function Z_(y){var p={type:y.type};return y.bbox&&(p.bbox=y.bbox),y.type==="GeometryCollection"?(p.geometries=y.geometries.map(function(n){return Z_(n)}),p):(p.coordinates=M1(y.coordinates),p)}function M1(y){var p=y;return typeof p[0]!="object"?p.slice():p.map(function(n){return M1(n)})}var k1=bT;function ET(y,p,n){if(n=n||{},!q_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!y)throw new Error("geojson is required");if(p==null||isNaN(p))throw new Error("angle is required");return p===0||(u||(u=w1(y)),(r===!1||r===void 0)&&(y=k1(y)),Ld(y,function(s){var P=S1(u,s),z=P+p,F=I1(u,s),N=E1(C1(u,F,z));s[0]=N[0],s[1]=N[1]})),y}var W_=ET;var TT=(y,p=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/p}),P=y.unproject({x:n/p,y:u/p}),z=y.unproject({x:n/p,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Rd=TT;var ST=y=>{let p=y.getBounds().toArray(),n=co(p[0]),u=co(p[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Eu(r)/P;return Math.max(z,F)},bg=ST;var X_=class extends gg(vg){constructor(p={}){super({...p}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(p,n){!p||(super.attachToMap(p),this.source={type:"canvas",canvas:this.canvas,coordinates:Rd(p,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},p.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(p=>{Ha(p)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(p){super.onUserMoveCallback({coordinate:co(p.lngLat.toArray()),...p})}renderTrajectories(p=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=W_(xh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=W_(xh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...co(z),...co(F)],V=bs(N)/(n/this.pixelRatio),me=Eu(N)/(u/this.pixelRatio),_e=Math.max(V,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:co([r.lng,r.lat]),extent:N,resolution:_e,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,p)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(p,n={}){let u=bg(this.map);return super.getFeatureInfoAtCoordinate(p,{resolution:u,...n})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(p,n,u){return super.purgeTrajectory(p,n||this.getMercatorExtent(),u||Math.floor(this.map.getZoom()+1))}setBbox(p,n){let u=p,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=p||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(p,n=!1){let u=super.renderTrajectoriesInternal(p,n);if(u&&this.map.style){let r=Rd(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(p,n,u){super.onFeatureHover(p,n,u),this.map.getCanvasContainer().style.cursor=p.length?"pointer":"auto"}},L1=X_;var $_={ol:_g,mapbox:wg};typeof window<"u"&&(window.mbt=$_);var M3=$_;})();
1083
1083
  //# sourceMappingURL=mbt.min.js.map