mobility-toolbox-js 2.0.0-beta.70 → 2.0.0-beta.71

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
  `||V===N){s=Math.max(s,P),r.push(P),P=0,z+=F;continue}var ve=h[V+1]||y.font,Se=ng(ve,me);n.push(Se),P+=Se;var Ue=kw(ve);u.push(Ue),F=Math.max(F,Ue)}return{width:s,height:z,widths:n,heights:u,lineWidths:r}}function Xx(y,h,n,u,r,s,P,z,F,V,N){y.save(),n!==1&&(y.globalAlpha*=n),h&&y.setTransform.apply(y,h),u.contextInstructions?(y.translate(F,V),y.scale(N[0],N[1]),Lw(u,y)):N[0]<0||N[1]<0?(y.translate(F,V),y.scale(N[0],N[1]),y.drawImage(u,r,s,P,z,0,0,P,z)):y.drawImage(u,r,s,P,z,F,V,P*N[0],z*N[1]),y.restore()}function Lw(y,h){for(var n=y.contextInstructions,u=0,r=n.length;u<r;u+=2)Array.isArray(n[u+1])?h[n[u]].apply(h,n[u+1]):h[n[u]]=n[u+1]}var Rw=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),zw=function(y){Rw(h,y);function h(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 h.prototype.clone=function(){var n=this.getScale(),u=new h({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},h.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]]},h.prototype.getAngle=function(){return this.angle_},h.prototype.getFill=function(){return this.fill_},h.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_},h.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},h.prototype.getPixelRatio=function(n){return n},h.prototype.getImageSize=function(){return this.size_},h.prototype.getImageState=function(){return Zi.LOADED},h.prototype.getOrigin=function(){return this.origin_},h.prototype.getPoints=function(){return this.points_},h.prototype.getRadius=function(){return this.radius_},h.prototype.getRadius2=function(){return this.radius2_},h.prototype.getSize=function(){return this.size_},h.prototype.getStroke=function(){return this.stroke_},h.prototype.listenImageChange=function(n){},h.prototype.load=function(){},h.prototype.unlistenImageChange=function(n){},h.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,V=2*Math.PI/F,N=P*Math.sin(V),me=Math.sqrt(P*P-N*N),ve=s-me,Se=Math.sqrt(N*N+ve*ve),Ue=Se/N;if(n==="miter"&&Ue<=r)return Ue*u;var et=u/2/Ue,Ie=u/2*(ve/Se),Ne=Math.sqrt((s+et)*(s+et)+Ie*Ie),He=Ne-s;if(this.radius2_===void 0||n==="bevel")return He*2;var nt=s*Math.sin(V),mt=Math.sqrt(s*s-nt*nt),ht=P-mt,pt=Math.sqrt(nt*nt+ht*ht),Tt=pt/nt;if(Tt<=r){var It=Tt*u/2-P-s;return 2*Math.max(He,It)}return He*2},h.prototype.createRenderOptions=function(){var n=Cu,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=Cu),u=this.stroke_.getMiterLimit(),u===void 0&&(u=pc));var F=this.calculateLineJoinSize_(n,z,u),V=Math.max(this.radius_,this.radius2_||0),N=Math.ceil(2*V+F);return{strokeStyle:P,strokeWidth:z,size:N,lineDash:r,lineDashOffset:s,lineJoin:n,miterLimit:u}},h.prototype.render=function(){this.renderOptions_=this.createRenderOptions();var n=this.renderOptions_.size;this.canvas_={},this.size_=[n,n]},h.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())},h.prototype.createHitDetectionCanvas_=function(n){if(this.fill_){var u=this.fill_.getColor(),r=0;if(typeof u=="string"&&(u=Qh(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))},h.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 V=P+F*z,N=F%2===0?r:s;n.lineTo(N*Math.cos(V),N*Math.sin(V))}n.closePath()}},h.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())},h}(rg),Wx=zw;var Dw=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Ow=function(y){Dw(h,y);function h(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 h.prototype.clone=function(){var n=this.getScale(),u=new h({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},h.prototype.setRadius=function(n){this.radius_=n,this.render()},h}(Wx),xl=Ow;var sf=function(){function y(h){var n=h||{};this.geometry_=null,this.geometryFunction_=$x,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 h=this.getGeometry();return h&&typeof h=="object"&&(h=h.clone()),new y({geometry:h,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(h){this.renderer_=h},y.prototype.setHitDetectionRenderer=function(h){this.hitDetectionRenderer_=h},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(h){this.fill_=h},y.prototype.getImage=function(){return this.image_},y.prototype.setImage=function(h){this.image_=h},y.prototype.getStroke=function(){return this.stroke_},y.prototype.setStroke=function(h){this.stroke_=h},y.prototype.getText=function(){return this.text_},y.prototype.setText=function(h){this.text_=h},y.prototype.getZIndex=function(){return this.zIndex_},y.prototype.setGeometry=function(h){typeof h=="function"?this.geometryFunction_=h:typeof h=="string"?this.geometryFunction_=function(n){return n.get(h)}:h?h!==void 0&&(this.geometryFunction_=function(){return h}):this.geometryFunction_=$x,this.geometry_=h},y.prototype.setZIndex=function(h){this.zIndex_=h},y}();function Kx(y){var h;if(typeof y=="function")h=y;else{var n;if(Array.isArray(y))n=y;else{En(typeof y.getZIndex=="function",41);var u=y;n=[u]}h=function(){return n}}return h}var i_=null;function Hx(y,h){if(!i_){var n=new Ks({color:"rgba(255,255,255,0.4)"}),u=new va({color:"#3399CC",width:1.25});i_=[new sf({image:new xl({fill:n,stroke:u,radius:5}),fill:n,stroke:u})]}return i_}function Yx(){var y={},h=[255,255,255,1],n=[0,153,255,1],u=3;return y[Ot.POLYGON]=[new sf({fill:new Ks({color:[255,255,255,.5]})})],y[Ot.MULTI_POLYGON]=y[Ot.POLYGON],y[Ot.LINE_STRING]=[new sf({stroke:new va({color:h,width:u+2})}),new sf({stroke:new va({color:n,width:u})})],y[Ot.MULTI_LINE_STRING]=y[Ot.LINE_STRING],y[Ot.CIRCLE]=y[Ot.POLYGON].concat(y[Ot.LINE_STRING]),y[Ot.POINT]=[new sf({image:new xl({radius:u*2,fill:new Ks({color:n}),stroke:new va({color:h,width:u/2})}),zIndex:1/0})],y[Ot.MULTI_POINT]=y[Ot.POINT],y[Ot.GEOMETRY_COLLECTION]=y[Ot.POLYGON].concat(y[Ot.LINE_STRING],y[Ot.POINT]),y}function $x(y){return y.getGeometry()}var $l=sf;var Jx={POINT:"point",LINE:"line"};var e0=jp(a_(),1);var Fw=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Qx={RENDER_ORDER:"renderOrder"},Bw=function(y){Fw(h,y);function h(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 h.prototype.getDeclutter=function(){return this.declutter_},h.prototype.getFeatures=function(n){return y.prototype.getFeatures.call(this,n)},h.prototype.getRenderBuffer=function(){return this.renderBuffer_},h.prototype.getRenderOrder=function(){return this.get(Qx.RENDER_ORDER)},h.prototype.getStyle=function(){return this.style_},h.prototype.getStyleFunction=function(){return this.styleFunction_},h.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},h.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},h.prototype.renderDeclutter=function(n){n.declutterTree||(n.declutterTree=new e0.default(9)),this.getRenderer().renderDeclutter(n)},h.prototype.setRenderOrder=function(n){this.set(Qx.RENDER_ORDER,n)},h.prototype.setStyle=function(n){this.style_=n!==void 0?n:Hx,this.styleFunction_=n===null?void 0:Kx(this.style_),this.changed()},h}(Jh),t0=Bw;var md={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},gd=[md.FILL],Au=[md.STROKE],gc=[md.BEGIN_PATH],s_=[md.CLOSE_PATH],qr=md;var Uw=function(){function y(){}return y.prototype.drawCustom=function(h,n,u,r){},y.prototype.drawGeometry=function(h){},y.prototype.setStyle=function(h){},y.prototype.drawCircle=function(h,n){},y.prototype.drawFeature=function(h,n){},y.prototype.drawGeometryCollection=function(h,n){},y.prototype.drawLineString=function(h,n){},y.prototype.drawMultiLineString=function(h,n){},y.prototype.drawMultiPoint=function(h,n){},y.prototype.drawMultiPolygon=function(h,n){},y.prototype.drawPoint=function(h,n){},y.prototype.drawPolygon=function(h,n){},y.prototype.drawText=function(h,n){},y.prototype.setFillStrokeStyle=function(h,n){},y.prototype.setImageStyle=function(h,n){},y.prototype.setTextStyle=function(h,n){},y}(),ag=Uw;var Nw=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Vw=function(y){Nw(h,y);function h(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 h.prototype.applyPixelRatio=function(n){var u=this.pixelRatio;return u==1?n:n.map(function(r){return r*u})},h.prototype.appendFlatPointCoordinates=function(n,u){for(var r=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,P=this.coordinates,z=P.length,F=0,V=n.length;F<V;F+=u)s[0]=n[F],s[1]=n[F+1],Wp(r,s)&&(P[z++]=s[0],P[z++]=s[1]);return z},h.prototype.appendFlatLineCoordinates=function(n,u,r,s,P,z){var F=this.coordinates,V=F.length,N=this.getBufferedMaxExtent();z&&(u+=s);var me=n[u],ve=n[u+1],Se=this.tmpCoordinate_,Ue=!0,et,Ie,Ne;for(et=u+s;et<r;et+=s)Se[0]=n[et],Se[1]=n[et+1],Ne=Dm(N,Se),Ne!==Ie?(Ue&&(F[V++]=me,F[V++]=ve,Ue=!1),F[V++]=Se[0],F[V++]=Se[1]):Ne===Lo.INTERSECTING?(F[V++]=Se[0],F[V++]=Se[1],Ue=!1):Ue=!0,me=Se[0],ve=Se[1],Ie=Ne;return(P&&Ue||et===u+s)&&(F[V++]=me,F[V++]=ve),V},h.prototype.drawCustomCoordinates_=function(n,u,r,s,P){for(var z=0,F=r.length;z<F;++z){var V=r[z],N=this.appendFlatLineCoordinates(n,u,V,s,!1,!1);P.push(N),u=V}return u},h.prototype.drawCustom=function(n,u,r,s){this.beginGeometry(n,u);var P=n.getType(),z=n.getStride(),F=this.coordinates.length,V,N,me,ve,Se;switch(P){case Ot.MULTI_POLYGON:V=n.getOrientedFlatCoordinates(),ve=[];var Ue=n.getEndss();Se=0;for(var et=0,Ie=Ue.length;et<Ie;++et){var Ne=[];Se=this.drawCustomCoordinates_(V,Se,Ue[et],z,Ne),ve.push(Ne)}this.instructions.push([qr.CUSTOM,F,ve,n,r,sd]),this.hitDetectionInstructions.push([qr.CUSTOM,F,ve,n,s||r,sd]);break;case Ot.POLYGON:case Ot.MULTI_LINE_STRING:me=[],V=P==Ot.POLYGON?n.getOrientedFlatCoordinates():n.getFlatCoordinates(),Se=this.drawCustomCoordinates_(V,0,n.getEnds(),z,me),this.instructions.push([qr.CUSTOM,F,me,n,r,hh]),this.hitDetectionInstructions.push([qr.CUSTOM,F,me,n,s||r,hh]);break;case Ot.LINE_STRING:case Ot.CIRCLE:V=n.getFlatCoordinates(),N=this.appendFlatLineCoordinates(V,0,V.length,z,!1,!1),this.instructions.push([qr.CUSTOM,F,N,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,N,n,s||r,vl]);break;case Ot.MULTI_POINT:V=n.getFlatCoordinates(),N=this.appendFlatPointCoordinates(V,z),N>F&&(this.instructions.push([qr.CUSTOM,F,N,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,N,n,s||r,vl]));break;case Ot.POINT:V=n.getFlatCoordinates(),this.coordinates.push(V[0],V[1]),N=this.coordinates.length,this.instructions.push([qr.CUSTOM,F,N,n,r]),this.hitDetectionInstructions.push([qr.CUSTOM,F,N,n,s||r]);break;default:}this.endGeometry(u)},h.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_)},h.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},h.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)},h.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:ep;var F=u.getLineDash();r.lineDash=F?F.slice():cc;var V=u.getLineDashOffset();r.lineDashOffset=V||hc;var N=u.getLineJoin();r.lineJoin=N!==void 0?N:Cu;var me=u.getWidth();r.lineWidth=me!==void 0?me:mc;var ve=u.getMiterLimit();r.miterLimit=ve!==void 0?ve: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},h.prototype.createFill=function(n){var u=n.fillStyle,r=[qr.SET_FILL_STYLE,u];return typeof u!="string"&&r.push(!0),r},h.prototype.applyStroke=function(n){this.instructions.push(this.createStroke(n))},h.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]},h.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)},h.prototype.updateStrokeStyle=function(n,u){var r=n.strokeStyle,s=n.lineCap,P=n.lineDash,z=n.lineDashOffset,F=n.lineJoin,V=n.lineWidth,N=n.miterLimit;(n.currentStrokeStyle!=r||n.currentLineCap!=s||P!=n.currentLineDash&&!_s(n.currentLineDash,P)||n.currentLineDashOffset!=z||n.currentLineJoin!=F||n.currentLineWidth!=V||n.currentMiterLimit!=N)&&(r!==void 0&&u.call(this,n),n.currentStrokeStyle=r,n.currentLineCap=s,n.currentLineDash=P,n.currentLineDashOffset=z,n.currentLineJoin=F,n.currentLineWidth=V,n.currentMiterLimit=N)},h.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)},h.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Dv(this.maxExtent),this.maxLineWidth>0)){var n=this.resolution*(this.maxLineWidth+1)/2;gl(this.bufferedMaxExtent_,n,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},h}(ag),Pu=Vw;var Gw=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),jw=function(y){Gw(h,y);function h(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 h.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)}},h.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)}},h.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)},h.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},h}(Pu),r0=jw;var qw=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Zw=function(y){qw(h,y);function h(n,u,r,s){return y.call(this,n,u,r,s)||this}return h.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},h.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(Au),this.endGeometry(u)}},h.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(),V=n.getStride(),N=0,me=0,ve=z.length;me<ve;++me)N=this.drawFlatCoordinates_(F,N,z[me],V);this.hitDetectionInstructions.push(Au),this.endGeometry(u)}},h.prototype.finish=function(){var n=this.state;return n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&this.instructions.push(Au),this.reverseHitDetectionInstructions(),this.state=null,y.prototype.finish.call(this)},h.prototype.applyStroke=function(n){n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&(this.instructions.push(Au),n.lastStroke=this.coordinates.length),n.lastStroke=0,y.prototype.applyStroke.call(this,n),this.instructions.push(gc)},h}(Pu),i0=Zw;var Xw=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Ww=function(y){Xw(h,y);function h(n,u,r,s){return y.call(this,n,u,r,s)||this}return h.prototype.drawFlatCoordinatess_=function(n,u,r,s){var P=this.state,z=P.fillStyle!==void 0,F=P.strokeStyle!==void 0,V=r.length;this.instructions.push(gc),this.hitDetectionInstructions.push(gc);for(var N=0;N<V;++N){var me=r[N],ve=this.coordinates.length,Se=this.appendFlatLineCoordinates(n,u,me,s,!0,!F),Ue=[qr.MOVE_TO_LINE_TO,ve,Se];this.instructions.push(Ue),this.hitDetectionInstructions.push(Ue),F&&(this.instructions.push(s_),this.hitDetectionInstructions.push(s_)),u=me}return z&&(this.instructions.push(gd),this.hitDetectionInstructions.push(gd)),F&&(this.instructions.push(Au),this.hitDetectionInstructions.push(Au)),u},h.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(),V=this.coordinates.length;this.appendFlatLineCoordinates(z,0,z.length,F,!1,!1);var N=[qr.CIRCLE,V];this.instructions.push(gc,N),this.hitDetectionInstructions.push(gc,N),r.fillStyle!==void 0&&(this.instructions.push(gd),this.hitDetectionInstructions.push(gd)),r.strokeStyle!==void 0&&(this.instructions.push(Au),this.hitDetectionInstructions.push(Au)),this.endGeometry(u)}},h.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(),V=n.getStride();this.drawFlatCoordinatess_(F,0,z,V),this.endGeometry(u)}},h.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(),V=n.getStride(),N=0,me=0,ve=z.length;me<ve;++me)N=this.drawFlatCoordinatess_(F,N,z[me],V);this.endGeometry(u)}},h.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]=ch(u[r],n);return y.prototype.finish.call(this)},h.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)},h}(Pu),l_=Ww;function n0(y,h,n,u,r){var s=n,P=n,z=0,F=0,V=n,N,me,ve,Se,Ue,et,Ie,Ne,He,nt;for(me=n;me<u;me+=r){var mt=h[me],ht=h[me+1];Ue!==void 0&&(He=mt-Ue,nt=ht-et,Se=Math.sqrt(He*He+nt*nt),Ie!==void 0&&(F+=ve,N=Math.acos((Ie*He+Ne*nt)/(ve*Se)),N>y&&(F>z&&(z=F,s=V,P=me),F=0,V=me-r)),ve=Se,Ie=He,Ne=nt),Ue=mt,et=ht}return F+=Se,F>z?[V,me]:[s,P]}var $w=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),yd={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Kw=function(y){$w(h,y);function h(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 h.prototype.finish=function(){var n=y.prototype.finish.call(this);return n.textStates=this.textStates,n.fillStates=this.fillStates,n.strokeStates=this.strokeStates,n},h.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,V=n.getType(),N=null,me=n.getStride();if(P.placement===Jx.LINE&&(V==Ot.LINE_STRING||V==Ot.MULTI_LINE_STRING||V==Ot.POLYGON||V==Ot.MULTI_POLYGON)){if(!Ro(this.getBufferedMaxExtent(),n.getExtent()))return;var ve=void 0;if(N=n.getFlatCoordinates(),V==Ot.LINE_STRING)ve=[N.length];else if(V==Ot.MULTI_LINE_STRING)ve=n.getEnds();else if(V==Ot.POLYGON)ve=n.getEnds().slice(0,1);else if(V==Ot.MULTI_POLYGON){var Se=n.getEndss();ve=[];for(var Ue=0,et=Se.length;Ue<et;++Ue)ve.push(Se[Ue][0])}this.beginGeometry(n,u);for(var Ie=P.textAlign,Ne=0,He=void 0,nt=0,mt=ve.length;nt<mt;++nt){if(Ie==null){var ht=n0(P.maxAngle,N,Ne,ve[nt],me);Ne=ht[0],He=ht[1]}else He=ve[nt];for(var Ue=Ne;Ue<He;Ue+=me)z.push(N[Ue],N[Ue+1]);var pt=z.length;Ne=ve[nt],this.drawChars_(F,pt),F=pt}this.endGeometry(u)}else{var Tt=P.overflow?null:[];switch(V){case Ot.POINT:case Ot.MULTI_POINT:N=n.getFlatCoordinates();break;case Ot.LINE_STRING:N=n.getFlatMidpoint();break;case Ot.CIRCLE:N=n.getCenter();break;case Ot.MULTI_LINE_STRING:N=n.getFlatMidpoints(),me=2;break;case Ot.POLYGON:N=n.getFlatInteriorPoint(),P.overflow||Tt.push(N[2]/this.resolution),me=3;break;case Ot.MULTI_POLYGON:var It=n.getFlatInteriorPoints();N=[];for(var Ue=0,et=It.length;Ue<et;Ue+=3)P.overflow||Tt.push(It[Ue+2]/this.resolution),N.push(It[Ue],It[Ue+1]);if(N.length===0)return;me=2;break;default:}var pt=this.appendFlatPointCoordinates(N,me);if(pt===F)return;if(Tt&&(pt-F)/2!==N.length/me){var Pt=F/2;Tt=Tt.filter(function(Ar,Rr){var Sr=z[(Pt+Rr)*2]===N[Rr*me]&&z[(Pt+Rr)*2+1]===N[Rr*me+1];return Sr||--Pt,Sr})}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 Qt=P.padding;if(Qt!=dc&&(P.scale[0]<0||P.scale[1]<0)){var Ft=P.padding[0],er=P.padding[1],hr=P.padding[2],kt=P.padding[3];P.scale[0]<0&&(er=-er,kt=-kt),P.scale[1]<0&&(Ft=-Ft,hr=-hr),Qt=[Ft,er,hr,kt]}var mr=this.pixelRatio;this.instructions.push([qr.DRAW_IMAGE,F,pt,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterImageWithText_,Qt==dc?dc:Qt.map(function(Ar){return Ar*mr}),!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]);var vr=1/mr;this.hitDetectionInstructions.push([qr.DRAW_IMAGE,F,pt,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[vr,vr],NaN,this.declutterImageWithText_,Qt,!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]),this.endGeometry(u)}}},h.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||gh,textBaseline:u.textBaseline||tp,scale:u.scale});var z=this.fillKey_;r&&(z in this.fillStates||(this.fillStates[z]={fillStyle:r.fillStyle}))},h.prototype.drawChars_=function(n,u){var r=this.textStrokeState_,s=this.textState_,P=this.strokeKey_,z=this.textKey_,F=this.fillKey_;this.saveTextStates_();var V=this.pixelRatio,N=yd[s.textBaseline],me=this.textOffsetY_*V,ve=this.text_,Se=r?r.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([qr.DRAW_CHARS,n,u,N,s.overflow,F,s.maxAngle,V,me,P,Se*V,ve,z,1]),this.hitDetectionInstructions.push([qr.DRAW_CHARS,n,u,N,s.overflow,F,s.maxAngle,1,me,P,Se,ve,z,1/V])},h.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 V=F.getLineDash(),N=F.getLineDashOffset(),me=F.getWidth(),ve=F.getMiterLimit();P.lineCap=F.getLineCap()||ep,P.lineDash=V?V.slice():cc,P.lineDashOffset=N===void 0?hc:N,P.lineJoin=F.getLineJoin()||Cu,P.lineWidth=me===void 0?mc:me,P.miterLimit=ve===void 0?pc:ve,P.strokeStyle=Ts(F.getColor()||fc)}r=this.textState_;var Se=n.getFont()||og;jx(Se);var Ue=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()||tp,r.backgroundFill=n.getBackgroundFill(),r.backgroundStroke=n.getBackgroundStroke(),r.padding=n.getPadding()||dc,r.scale=Ue===void 0?[1,1]:Ue;var et=n.getOffsetX(),Ie=n.getOffsetY(),Ne=n.getRotateWithView(),He=n.getRotation();this.text_=n.getText()||"",this.textOffsetX_=et===void 0?0:et,this.textOffsetY_=Ie===void 0?0:Ie,this.textRotateWithView_=Ne===void 0?!1:Ne,this.textRotation_=He===void 0?0:He,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},h}(Pu),o0=Kw;var Hw={Circle:l_,Default:Pu,Image:r0,LineString:i0,Polygon:l_,Text:o0},Yw=function(){function y(h,n,u,r){this.tolerance_=h,this.maxExtent_=n,this.pixelRatio_=r,this.resolution_=u,this.buildersByZIndex_={}}return y.prototype.finish=function(){var h={};for(var n in this.buildersByZIndex_){h[n]=h[n]||{};var u=this.buildersByZIndex_[n];for(var r in u){var s=u[r].finish();h[n][r]=s}}return h},y.prototype.getBuilder=function(h,n){var u=h!==void 0?h.toString():"0",r=this.buildersByZIndex_[u];r===void 0&&(r={},this.buildersByZIndex_[u]=r);var s=r[n];if(s===void 0){var P=Hw[n];s=new P(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[n]=s}return s},y}(),u_=Yw;var Jw=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Qw=function(y){Jw(h,y);function h(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 h.prototype.getFeatures=function(n){return jr()},h.prototype.getData=function(n){return null},h.prototype.prepareFrame=function(n){return jr()},h.prototype.renderFrame=function(n,u){return jr()},h.prototype.loadedTileCallback=function(n,u,r){n[u]||(n[u]={}),n[u][r.tileCoord.toString()]=r},h.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)},h.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){},h.prototype.getDataAtPixel=function(n,u,r){return null},h.prototype.getLayer=function(){return this.layer_},h.prototype.handleFontsChanged=function(){},h.prototype.handleImageChange_=function(n){var u=n.target;u.getState()===Zi.LOADED&&this.renderIfReadyAndVisible()},h.prototype.loadImage=function(n){var u=n.getState();return u!=Zi.LOADED&&u!=Zi.ERROR&&n.addEventListener(en.CHANGE,this.boundHandleImageChange_),u==Zi.IDLE&&(n.load(),u=n.getState()),u==Zi.LOADED},h.prototype.renderIfReadyAndVisible=function(){var n=this.getLayer();n.getVisible()&&n.getSourceState()==Iu.READY&&n.changed()},h.prototype.disposeInternal=function(){delete this.layer_,y.prototype.disposeInternal.call(this)},h}(Mm),a0=Qw;var e2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),t2=function(y){e2(h,y);function h(n,u,r,s){var P=y.call(this,n)||this;return P.inversePixelTransform=u,P.frameState=r,P.context=s,P}return h}(ln),s0=t2;var r2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),_d=null;function i2(){var y=document.createElement("canvas");y.width=1,y.height=1,_d=y.getContext("2d")}var n2=function(y){r2(h,y);function h(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 h.prototype.getImageData=function(n,u,r){_d||i2(),_d.clearRect(0,0,1,1);var s;try{_d.drawImage(n,u,r,1,1,0,0,1,1),s=_d.getImageData(0,0,1,1).data}catch{return null}return s},h.prototype.getBackground=function(n){var u=this.getLayer(),r=u.getBackground();return typeof r=="function"&&(r=r(n.viewState.resolution)),r||void 0},h.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(Qh(n.style.backgroundColor),Qh(s)))){var V=n.firstElementChild;V instanceof HTMLCanvasElement&&(F=V.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 N=z.style;N.position="absolute",N.width="100%",N.height="100%",s&&(N.backgroundColor=s),F=Ja();var V=F.canvas;z.appendChild(V),N=V.style,N.position="absolute",N.left="0",N.transformOrigin="top left",this.container=z,this.context=F}},h.prototype.clipUnrotated=function(n,u,r){var s=yy(r),P=_y(r),z=gy(r),F=my(r);bo(u.coordinateToPixelTransform,s),bo(u.coordinateToPixelTransform,P),bo(u.coordinateToPixelTransform,z),bo(u.coordinateToPixelTransform,F);var V=this.inversePixelTransform;bo(V,s),bo(V,P),bo(V,z),bo(V,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()},h.prototype.dispatchRenderEvent_=function(n,u,r){var s=this.getLayer();if(s.hasListener(n)){var P=new s0(n,this.inversePixelTransform,r,u);s.dispatchEvent(P)}},h.prototype.preRender=function(n,u){this.frameState=u,this.dispatchRenderEvent_(dd.PRERENDER,n,u)},h.prototype.postRender=function(n,u){this.dispatchRenderEvent_(dd.POSTRENDER,n,u)},h.prototype.getRenderTransform=function(n,u,r,s,P,z,F){var V=P/2,N=z/2,me=s/u,ve=-me,Se=-n[0]+F,Ue=-n[1];return vs(this.tempTransform,V,N,me,ve,-r,Se,Ue)},h.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 V=bo(u.pixelToCoordinateTransform,n.slice());if(!Wp(F,V))return null}var N=Math.round(s[0]),me=Math.round(s[1]),ve=this.pixelContext_;if(!ve){var Se=document.createElement("canvas");Se.width=1,Se.height=1,ve=Se.getContext("2d"),this.pixelContext_=ve}ve.clearRect(0,0,1,1);var Ue;try{ve.drawImage(P.canvas,N,me,1,1,0,0,1,1),Ue=ve.getImageData(0,0,1,1).data}catch(et){return et.name==="SecurityError"?(this.pixelContext_=null,new Uint8Array):Ue}return Ue[3]===0?null:Ue},h.prototype.disposeInternal=function(){delete this.frameState,y.prototype.disposeInternal.call(this)},h}(a0),l0=n2;var Fn={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function u0(y,h,n,u,r,s,P,z,F,V,N,me){var ve=y[h],Se=y[h+1],Ue=0,et=0,Ie=0,Ne=0;function He(){Ue=ve,et=Se,h+=u,ve=y[h],Se=y[h+1],Ne+=Ie,Ie=Math.sqrt((ve-Ue)*(ve-Ue)+(Se-et)*(Se-et))}do He();while(h<n-u&&Ne+Ie<s);for(var nt=Ie===0?0:(s-Ne)/Ie,mt=yl(Ue,ve,nt),ht=yl(et,Se,nt),pt=h-u,Tt=Ne,It=s+z*F(V,r,N);h<n-u&&Ne+Ie<It;)He();nt=Ie===0?0:(It-Ne)/Ie;var Pt=yl(Ue,ve,nt),Qt=yl(et,Se,nt),Ft;if(me){var er=[mt,ht,Pt,Qt];jm(er,0,4,2,me,er,er),Ft=er[0]>er[2]}else Ft=mt>Pt;var hr=Math.PI,kt=[],mr=pt+u===h;h=pt,Ie=0,Ne=Tt,ve=y[h],Se=y[h+1];var vr;if(mr){He(),vr=Math.atan2(Se-et,ve-Ue),Ft&&(vr+=vr>0?-hr:hr);var Lr=(Pt+mt)/2,Ar=(Qt+ht)/2;return kt[0]=[Lr,Ar,(It-s)/2,vr,r],kt}for(var Rr=0,Sr=r.length;Rr<Sr;){He();var vi=Math.atan2(Se-et,ve-Ue);if(Ft&&(vi+=vi>0?-hr:hr),vr!==void 0){var jt=vi-vr;if(jt+=jt>hr?-2*hr:jt<-hr?2*hr:0,Math.abs(jt)>P)return null}vr=vi;for(var ei=Rr,bi=0;Rr<Sr;++Rr){var ai=Ft?Sr-Rr-1:Rr,zi=z*F(V,r[ai],N);if(h+u<n&&Ne+Ie<s+bi+zi/2)break;bi+=zi}if(Rr!==ei){var Or=Ft?r.substring(Sr-ei,Sr-Rr):r.substring(ei,Rr);nt=Ie===0?0:(s+bi/2-Ne)/Ie;var Lr=yl(Ue,ve,nt),Ar=yl(et,Se,nt);kt.push([Lr,Ar,bi/2,vi,Or]),s+=bi}}return kt}var lf=Ya(),yh=[],yc=[],_c=[],_h=[];function c0(y){return y[3].declutterBox}var o2=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 h0(y,h){return(h==="start"||h==="end")&&!o2.test(y)&&(h=h==="start"?"left":"right"),yd[h]}function a2(y,h,n){return n>0&&y.push(`
1080
1080
  `,""),y.push(h,""),y}var s2=function(){function y(h,n,u,r){this.overlaps=u,this.pixelRatio=n,this.resolution=h,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(h,n,u,r){var s=h+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],V=this.pixelRatio,N=[F.scale[0]*V,F.scale[1]*V],me=Array.isArray(h),ve=h0(me?h[0]:h,F.textAlign||gh),Se=r&&P.lineWidth?P.lineWidth:0,Ue=me?h:h.split(`
1081
1081
  `).reduce(a2,[]),et=Zx(F,Ue),Ie=et.width,Ne=et.height,He=et.widths,nt=et.heights,mt=et.lineWidths,ht=Ie+Se,pt=[],Tt=(ht+2)*N[0],It=(Ne+Se)*N[1],Pt={width:Tt<0?Math.floor(Tt):Math.ceil(Tt),height:It<0?Math.floor(It):Math.ceil(It),contextInstructions:pt};if((N[0]!=1||N[1]!=1)&&pt.push("scale",N),r){pt.push("strokeStyle",P.strokeStyle),pt.push("lineWidth",Se),pt.push("lineCap",P.lineCap),pt.push("lineJoin",P.lineJoin),pt.push("miterLimit",P.miterLimit);var Qt=ah?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D;Qt.prototype.setLineDash&&(pt.push("setLineDash",[P.lineDash]),pt.push("lineDashOffset",P.lineDashOffset))}u&&pt.push("fillStyle",z.fillStyle),pt.push("textBaseline","middle"),pt.push("textAlign","center");for(var Ft=.5-ve,er=ve*ht+Ft*Se,hr=[],kt=[],mr=0,vr=0,Lr=0,Ar=0,Rr,Sr=0,vi=Ue.length;Sr<vi;Sr+=2){var jt=Ue[Sr];if(jt===`
1082
- `){vr+=mr,mr=0,er=ve*ht+Ft*Se,++Ar;continue}var ei=Ue[Sr+1]||F.font;ei!==Rr&&(r&&hr.push("font",ei),u&&kt.push("font",ei),Rr=ei),mr=Math.max(mr,nt[Lr]);var bi=[jt,er+Ft*He[Lr]+ve*(He[Lr]-mt[Ar]),.5*(Se+mr)+vr];er+=He[Lr],r&&hr.push("strokeText",bi),u&&kt.push("fillText",bi),++Lr}return Array.prototype.push.apply(pt,hr),Array.prototype.push.apply(pt,kt),this.labels_[s]=Pt,Pt},y.prototype.replayTextBackground_=function(h,n,u,r,s,P,z){h.beginPath(),h.moveTo.apply(h,n),h.lineTo.apply(h,u),h.lineTo.apply(h,r),h.lineTo.apply(h,s),h.lineTo.apply(h,n),P&&(this.alignFill_=P[2],this.fill_(h)),z&&(this.setStrokeStyle_(h,z),h.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(h,n,u,r,s,P,z,F,V,N,me,ve,Se,Ue,et,Ie){z*=ve[0],F*=ve[1];var Ne=u-z,He=r-F,nt=s+V>h?h-V:s,mt=P+N>n?n-N:P,ht=Ue[3]+nt*ve[0]+Ue[1],pt=Ue[0]+mt*ve[1]+Ue[2],Tt=Ne-Ue[3],It=He-Ue[0];(et||me!==0)&&(yh[0]=Tt,_h[0]=Tt,yh[1]=It,yc[1]=It,yc[0]=Tt+ht,_c[0]=yc[0],_c[1]=It+pt,_h[1]=_c[1]);var Pt;return me!==0?(Pt=vs(za(),u,r,1,1,me,-u,-r),bo(Pt,yh),bo(Pt,yc),bo(Pt,_c),bo(Pt,_h),sh(Math.min(yh[0],yc[0],_c[0],_h[0]),Math.min(yh[1],yc[1],_c[1],_h[1]),Math.max(yh[0],yc[0],_c[0],_h[0]),Math.max(yh[1],yc[1],_c[1],_h[1]),lf)):sh(Math.min(Tt,Tt+ht),Math.min(It,It+pt),Math.max(Tt,Tt+ht),Math.max(It,It+pt),lf),Se&&(Ne=Math.round(Ne),He=Math.round(He)),{drawImageX:Ne,drawImageY:He,drawImageW:nt,drawImageH:mt,originX:V,originY:N,declutterBox:{minX:lf[0],minY:lf[1],maxX:lf[2],maxY:lf[3],value:Ie},canvasTransform:Pt,scale:ve}},y.prototype.replayImageOrLabel_=function(h,n,u,r,s,P,z){var F=!!(P||z),V=r.declutterBox,N=h.canvas,me=z?z[2]*r.scale[0]/2:0,ve=V.minX-me<=N.width/n&&V.maxX+me>=0&&V.minY-me<=N.height/n&&V.maxY+me>=0;return ve&&(F&&this.replayTextBackground_(h,yh,yc,_c,_h,P,z),Xx(h,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(h){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;h.save(),h.translate(n[0]%u,n[1]%u),h.rotate(this.viewRotation_)}h.fill(),this.alignFill_&&h.restore()},y.prototype.setStrokeStyle_=function(h,n){h.strokeStyle=n[1],h.lineWidth=n[2],h.lineCap=n[3],h.lineJoin=n[4],h.miterLimit=n[5],h.setLineDash&&(h.lineDashOffset=n[7],h.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(h,n,u,r){var s=this.textStates[n],P=this.createLabel(h,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,V=h0(Array.isArray(h)?h[0]:h,s.textAlign||gh),N=yd[s.textBaseline||tp],me=z&&z.lineWidth?z.lineWidth:0,ve=P.width/F-2*s.scale[0],Se=V*ve+2*(.5-V)*me,Ue=N*P.height/F+2*(.5-N)*me;return{label:P,anchorX:Se,anchorY:Ue}},y.prototype.execute_=function(h,n,u,r,s,P,z,F){var V;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?V=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),V=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),kv(this.renderedTransform_,u));for(var N=0,me=r.length,ve=0,Se,Ue,et,Ie,Ne,He,nt,mt,ht,pt,Tt,It,Pt=0,Qt=0,Ft=null,er=null,hr=this.coordinateCache_,kt=this.viewRotation_,mr=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,vr={context:h,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:kt},Lr=this.instructions!=r||this.overlaps?0:200,Ar,Rr,Sr,vi;N<me;){var jt=r[N],ei=jt[0];switch(ei){case qr.BEGIN_GEOMETRY:Ar=jt[1],vi=jt[3],Ar.getGeometry()?z!==void 0&&!Ro(z,vi.getExtent())?N=jt[2]+1:++N:N=jt[2];break;case qr.BEGIN_PATH:Pt>Lr&&(this.fill_(h),Pt=0),Qt>Lr&&(h.stroke(),Qt=0),!Pt&&!Qt&&(h.beginPath(),Ie=NaN,Ne=NaN),++N;break;case qr.CIRCLE:ve=jt[1];var bi=V[ve],ai=V[ve+1],zi=V[ve+2],Or=V[ve+3],Mn=zi-bi,wo=Or-ai,Xi=Math.sqrt(Mn*Mn+wo*wo);h.moveTo(bi+Xi,ai),h.arc(bi,ai,Xi,0,2*Math.PI,!0),++N;break;case qr.CLOSE_PATH:h.closePath(),++N;break;case qr.CUSTOM:ve=jt[1],Se=jt[2];var Pr=jt[3],co=jt[4],Mi=jt.length==6?jt[5]:void 0;vr.geometry=Pr,vr.feature=Ar,N in hr||(hr[N]=[]);var di=hr[N];Mi?Mi(V,ve,Se,2,di):(di[0]=V[ve],di[1]=V[ve+1],di.length=2),co(di,vr),++N;break;case qr.DRAW_IMAGE:ve=jt[1],Se=jt[2],mt=jt[3],Ue=jt[4],et=jt[5];var $n=jt[6],mn=jt[7],Xr=jt[8],Wi=jt[9],kn=jt[10],Bn=jt[11],Un=jt[12],$i=jt[13],gn=jt[14];if(!mt&&jt.length>=19){ht=jt[18],pt=jt[19],Tt=jt[20],It=jt[21];var Tn=this.drawLabelWithPointPlacement_(ht,pt,Tt,It);mt=Tn.label,jt[3]=mt;var Eo=jt[22];Ue=(Tn.anchorX-Eo)*this.pixelRatio,jt[4]=Ue;var wt=jt[23];et=(Tn.anchorY-wt)*this.pixelRatio,jt[5]=et,$n=mt.height,jt[6]=$n,$i=mt.width,jt[13]=$i}var Wt=void 0;jt.length>24&&(Wt=jt[24]);var ho=void 0,yn=void 0,Wr=void 0;jt.length>16?(ho=jt[15],yn=jt[16],Wr=jt[17]):(ho=dc,yn=!1,Wr=!1),kn&&mr?Bn+=kt:!kn&&!mr&&(Bn-=kt);for(var Ln=0;ve<Se;ve+=2)if(!(Wt&&Wt[Ln++]<$i/this.pixelRatio)){var Bi=this.calculateImageOrLabelDimensions_(mt.width,mt.height,V[ve],V[ve+1],$i,$n,Ue,et,Xr,Wi,Bn,Un,s,ho,yn||Wr,Ar),fn=[h,n,mt,Bi,mn,yn?Ft:null,Wr?er:null],Kn=void 0,Zt=void 0;if(F&&gn){var Nr=Se-ve;if(!gn[Nr]){gn[Nr]=fn;continue}if(Kn=gn[Nr],delete gn[Nr],Zt=c0(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))}++N;break;case qr.DRAW_CHARS:var Fr=jt[1],Gi=jt[2],Sn=jt[3],Ir=jt[4];It=jt[5];var to=jt[6],Ki=jt[7],wi=jt[8];Tt=jt[9];var te=jt[10];ht=jt[11],pt=jt[12];var he=[jt[13],jt[13]],de=this.textStates[pt],Te=de.font,Le=[de.scale[0]*Ki,de.scale[1]*Ki],We=void 0;Te in this.widths_?We=this.widths_[Te]:(We={},this.widths_[Te]=We);var Je=$m(V,Fr,Gi,2),we=Math.abs(Le[0])*r_(Te,ht,We);if(Ir||we<=Je){var Ve=this.textStates[pt].textAlign,ie=(Je-we)*yd[Ve],X=u0(V,Fr,Gi,2,ht,ie,to,Math.abs(Le[0]),r_,Te,We,mr?0:this.viewRotation_);e:if(X){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,pt,"",Tt),Ue=ge[2]+(Le[0]<0?-te:te),et=Sn*ke.height+(.5-Sn)*2*te*Le[1]/Le[0]-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,et,0,0,ge[3],he,!1,dc,!1,Ar);if(F&&F.collides(Bi.declutterBox))break e;J.push([h,n,ke,Bi,1,null,null])}if(It)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,pt,It,""),Ue=ge[2],et=Sn*ke.height-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,et,0,0,ge[3],he,!1,dc,!1,Ar);if(F&&F.collides(Bi.declutterBox))break e;J.push([h,n,ke,Bi,1,null,null])}F&&F.load(J.map(c0));for(var Ce=0,Re=J.length;Ce<Re;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++N;break;case qr.END_GEOMETRY:if(P!==void 0){Ar=jt[1];var Ke=P(Ar,vi);if(Ke)return Ke}++N;break;case qr.FILL:Lr?Pt++:this.fill_(h),++N;break;case qr.MOVE_TO_LINE_TO:for(ve=jt[1],Se=jt[2],Rr=V[ve],Sr=V[ve+1],He=Rr+.5|0,nt=Sr+.5|0,(He!==Ie||nt!==Ne)&&(h.moveTo(Rr,Sr),Ie=He,Ne=nt),ve+=2;ve<Se;ve+=2)Rr=V[ve],Sr=V[ve+1],He=Rr+.5|0,nt=Sr+.5|0,(ve==Se-2||He!==Ie||nt!==Ne)&&(h.lineTo(Rr,Sr),Ie=He,Ne=nt);++N;break;case qr.SET_FILL_STYLE:Ft=jt,this.alignFill_=jt[2],Pt&&(this.fill_(h),Pt=0,Qt&&(h.stroke(),Qt=0)),h.fillStyle=jt[1],++N;break;case qr.SET_STROKE_STYLE:er=jt,Qt&&(h.stroke(),Qt=0),this.setStrokeStyle_(h,jt),++N;break;case qr.STROKE:Lr?Qt++:h.stroke(),++N;break;default:++N;break}}Pt&&this.fill_(h),Qt&&h.stroke()},y.prototype.execute=function(h,n,u,r,s,P){this.viewRotation_=r,this.execute_(h,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(h,n,u,r,s){return this.viewRotation_=u,this.execute_(h,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),p0=s2;var c_=[Fn.POLYGON,Fn.CIRCLE,Fn.LINE_STRING,Fn.IMAGE,Fn.TEXT,Fn.DEFAULT],l2=function(){function y(h,n,u,r,s,P){this.maxExtent_=h,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(h,n){var u=this.getClipCoords(n);h.beginPath(),h.moveTo(u[0],u[1]),h.lineTo(u[2],u[3]),h.lineTo(u[4],u[5]),h.lineTo(u[6],u[7]),h.clip()},y.prototype.createExecutors_=function(h){for(var n in h){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=h[n];for(var s in r){var P=r[s];u[s]=new p0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(h){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=h.length;r<s;++r)if(h[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(h,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,-h[0],-h[1]),V=!this.hitDetectionContext_;V&&(this.hitDetectionContext_=Ja(z,z));var N=this.hitDetectionContext_;N.canvas.width!==z||N.canvas.height!==z?(N.canvas.width=z,N.canvas.height=z):V||N.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),fy(me,h),gl(me,n*(this.renderBuffer_+r),me));var ve=u2(r),Se;function Ue(pt,Tt){for(var It=N.getImageData(0,0,z,z).data,Pt=0,Qt=ve.length;Pt<Qt;Pt++)if(It[ve[Pt]]>0){if(!P||Se!==Fn.IMAGE&&Se!==Fn.TEXT||P.indexOf(pt)!==-1){var Ft=(ve[Pt]-3)/4,er=r-Ft%z,hr=r-(Ft/z|0),kt=s(pt,Tt,er*er+hr*hr);if(kt)return kt}N.clearRect(0,0,z,z);break}}var et=Object.keys(this.executorsByZIndex_).map(Number);et.sort(rh);var Ie,Ne,He,nt,mt;for(Ie=et.length-1;Ie>=0;--Ie){var ht=et[Ie].toString();for(He=this.executorsByZIndex_[ht],Ne=c_.length-1;Ne>=0;--Ne)if(Se=c_[Ne],nt=He[Se],nt!==void 0&&(mt=nt.executeHitDetection(N,F,u,Ue,me),mt))return mt}},y.prototype.getClipCoords=function(h){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,h,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(h,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(h.save(),this.clip(h,u));var V=P||c_,N,me,ve,Se,Ue,et;for(z&&F.reverse(),N=0,me=F.length;N<me;++N){var Ie=F[N].toString();for(Ue=this.executorsByZIndex_[Ie],ve=0,Se=V.length;ve<Se;++ve){var Ne=V[ve];et=Ue[Ne],et!==void 0&&et.execute(h,n,u,r,s,z)}}this.maxExtent_&&h.restore()},y}(),h_={};function u2(y){if(h_[y]!==void 0)return h_[y];for(var h=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)*h+(y+s))*4+3),r>0&&z.push(((y-r)*h+(y+s))*4+3),s>0&&(z.push(((y+r)*h+(y-s))*4+3),r>0&&z.push(((y-r)*h+(y-s))*4+3))}for(var F=[],r=0,V=u.length;r<V;++r)u[r]&&F.push.apply(F,u[r]);return h_[y]=F,F}var p_=l2;var vd={ANIMATING:0,INTERACTING:1};var c2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),h2=function(y){c2(h,y);function h(n,u,r,s,P,z,F){var V=y.call(this)||this;return V.context_=n,V.pixelRatio_=u,V.extent_=r,V.transform_=s,V.viewRotation_=P,V.squaredTolerance_=z,V.userTransform_=F,V.contextFillState_=null,V.contextStrokeState_=null,V.contextTextState_=null,V.fillState_=null,V.strokeState_=null,V.image_=null,V.imageAnchorX_=0,V.imageAnchorY_=0,V.imageHeight_=0,V.imageOpacity_=0,V.imageOriginX_=0,V.imageOriginY_=0,V.imageRotateWithView_=!1,V.imageRotation_=0,V.imageScale_=[0,0],V.imageWidth_=0,V.text_="",V.textOffsetX_=0,V.textOffsetY_=0,V.textRotateWithView_=!1,V.textRotation_=0,V.textScale_=[0,0],V.textFillState_=null,V.textStrokeState_=null,V.textState_=null,V.pixelCoordinates_=[],V.tmpLocalTransform_=za(),V}return h.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_,V=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=V*this.imageOpacity_);var N=this.imageRotation_;this.imageRotateWithView_&&(N+=this.viewRotation_);for(var me=0,ve=P.length;me<ve;me+=2){var Se=P[me]-this.imageAnchorX_,Ue=P[me+1]-this.imageAnchorY_;if(N!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var et=Se+this.imageAnchorX_,Ie=Ue+this.imageAnchorY_;vs(F,et,Ie,1,1,N,-et,-Ie),z.setTransform.apply(z,F),z.translate(et,Ie),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,Ue,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=V)}},h.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 V=P[u]+this.textOffsetX_,N=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,V,N,1,1,F,-V,-N);z.setTransform.apply(z,me),z.translate(V,N),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_,V,N),this.textFillState_&&z.fillText(this.text_,V,N)}}},h.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 V=F.length;P&&(V-=2);for(var N=2;N<V;N+=2)z.lineTo(F[N],F[N+1]);return P&&z.closePath(),r},h.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},h.prototype.drawCircle=function(n){if(!!Ro(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=lx(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)}},h.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},h.prototype.setTransform=function(n){this.transform_=n},h.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Ot.POINT:this.drawPoint(n);break;case Ot.LINE_STRING:this.drawLineString(n);break;case Ot.POLYGON:this.drawPolygon(n);break;case Ot.MULTI_POINT:this.drawMultiPoint(n);break;case Ot.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Ot.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Ot.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Ot.CIRCLE:this.drawCircle(n);break;default:}},h.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Ro(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},h.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},h.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)},h.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)},h.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(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)}}},h.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Ro(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 V=0,N=z.length;V<N;++V)P=this.moveToLineTo_(s,P,z[V],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},h.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(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)}}},h.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(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,V=P.length;F<V;++F){var N=P[F];s=this.drawRings_(r,s,N,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},h.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})},h.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})},h.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:gh;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})},h.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(),V=u.getLineDashOffset(),N=u.getLineJoin(),me=u.getWidth(),ve=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:ep,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ue){return Ue*r.pixelRatio_}),lineDashOffset:(V||hc)*this.pixelRatio_,lineJoin:N!==void 0?N:Cu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:ve!==void 0?ve:pc,strokeStyle:Ts(P||fc)}}},h.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_},h.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(),V=s.getLineDashOffset(),N=s.getLineJoin(),me=s.getWidth(),ve=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:ep,lineDash:F||cc,lineDashOffset:V||hc,lineJoin:N!==void 0?N:Cu,lineWidth:me!==void 0?me:mc,miterLimit:ve!==void 0?ve:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ue=n.getOffsetX(),et=n.getOffsetY(),Ie=n.getRotateWithView(),Ne=n.getRotation(),He=n.getScaleArray(),nt=n.getText(),mt=n.getTextAlign(),ht=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:og,textAlign:mt!==void 0?mt:gh,textBaseline:ht!==void 0?ht:tp},this.text_=nt!==void 0?Array.isArray(nt)?nt.reduce(function(pt,Tt,It){return pt+=It%2?" ":Tt},""):nt:"",this.textOffsetX_=Ue!==void 0?this.pixelRatio_*Ue:0,this.textOffsetY_=et!==void 0?this.pixelRatio_*et:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ne!==void 0?Ne:0,this.textScale_=[this.pixelRatio_*He[0],this.pixelRatio_*He[1]]}},h}(ag),f0=h2;var Mu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var p2=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 h=0;for(var n in this.cache_){var u=this.cache_[n];(h++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(h,n,u){var r=d0(h,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(h,n,u,r){var s=d0(h,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(h){this.maxCacheSize_=h,this.expire()},y}();function d0(y,h,n){var u=n?ig(n):"null";return h+":"+y+":"+u}var f_=new p2;var f2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),d2=function(y){f2(h,y);function h(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 h.prototype.changed=function(){this.dispatchEvent(en.CHANGE)},h.prototype.getExtent=function(){return this.extent},h.prototype.getImage=function(){return jr()},h.prototype.getPixelRatio=function(){return this.pixelRatio_},h.prototype.getResolution=function(){return this.resolution},h.prototype.getState=function(){return this.state},h.prototype.load=function(){jr()},h}(nh),m0=d2;var m2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),sR=function(y){m2(h,y);function h(n,u,r,s,P,z){var F=y.call(this,n,u,r,Zi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=Zi.IDLE,F.imageLoadFunction_=z,F}return h.prototype.getImage=function(){return this.image_},h.prototype.handleImageError_=function(){this.state=Zi.ERROR,this.unlistenImage_(),this.changed()},h.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Tu(this.extent)/this.image_.height),this.state=Zi.LOADED,this.unlistenImage_(),this.changed()},h.prototype.load=function(){(this.state==Zi.IDLE||this.state==Zi.ERROR)&&(this.state=Zi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},h.prototype.setImage=function(n){this.image_=n,this.resolution=Tu(this.extent)/this.image_.height},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(m0);function d_(y,h,n){var u=y,r=!0,s=!1,P=!1,z=[Zp(u,en.LOAD,function(){P=!0,s||h()})];return u.src&&Pv?(s=!0,u.decode().then(function(){r&&h()}).catch(function(F){r&&(P?h():n())})):z.push(Zp(u,en.ERROR,n)),function(){r=!1,z.forEach(Mo)}}var g2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xd=null,y2=function(y){g2(h,y);function h(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 h.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===Zi.LOADED){xd||(xd=Ja(1,1)),xd.drawImage(this.image_,0,0);try{xd.getImageData(0,0,1,1),this.tainted_=!1}catch{xd=null,this.tainted_=!0}}return this.tainted_===!0},h.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(en.CHANGE)},h.prototype.handleImageError_=function(){this.imageState_=Zi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},h.prototype.handleImageLoad_=function(){this.imageState_=Zi.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_()},h.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},h.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},h.prototype.getImageState=function(){return this.imageState_},h.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_},h.prototype.getSize=function(){return this.size_},h.prototype.getSrc=function(){return this.src_},h.prototype.load=function(){if(this.imageState_==Zi.IDLE){this.imageState_=Zi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},h.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==Zi.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=ig(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,V=this.color_[2]/255,N=this.color_[3],me=0,ve=P.length;me<ve;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=V,P[me+3]*=N;r.putImageData(s,0,0)}}},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(nh);function g0(y,h,n,u,r,s){var P=f_.get(h,u,s);return P||(P=new y2(y,h,n,u,r,s),f_.set(h,u,s,P)),P}var _2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),v2=function(y){_2(h,y);function h(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:Mu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Mu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var V=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var N=r.src;En(!(N!==void 0&&V),4),En(!V||V&&u.imgSize_,5),(N===void 0||N.length===0)&&V&&(N=V.src||Pi(V)),En(N!==void 0&&N.length>0,6);var me=r.src!==void 0?Zi.IDLE:Zi.LOADED;return u.color_=r.color!==void 0?Qh(r.color):null,u.iconImage_=g0(V,N,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 h.prototype.clone=function(){var n=this.getScale();return new h({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()})},h.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Mu.FRACTION||this.anchorYUnits_==Mu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Mu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Mu.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]]},h.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},h.prototype.getColor=function(){return this.color_},h.prototype.getImage=function(n){return this.iconImage_.getImage(n)},h.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},h.prototype.getImageSize=function(){return this.iconImage_.getSize()},h.prototype.getImageState=function(){return this.iconImage_.getImageState()},h.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},h.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_},h.prototype.getSrc=function(){return this.iconImage_.getSrc()},h.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},h.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(en.CHANGE,n)},h.prototype.load=function(){this.iconImage_.load()},h.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(en.CHANGE,n)},h}(rg),m_=v2;var Kl=.5;function y0(y,h,n,u,r,s,P){var z=y[0]*Kl,F=y[1]*Kl,V=Ja(z,F);V.imageSmoothingEnabled=!1;for(var N=V.canvas,me=new f0(V,Kl,r,null,P),ve=n.length,Se=Math.floor((256*256*256-1)/ve),Ue={},et=1;et<=ve;++et){var Ie=n[et-1],Ne=Ie.getStyleFunction()||u;if(!!u){var He=Ne(Ie,s);if(!!He){Array.isArray(He)||(He=[He]);for(var nt=et*Se,mt="#"+("000000"+nt.toString(16)).slice(-6),ht=0,pt=He.length;ht<pt;++ht){var Tt=He[ht],It=Tt.getGeometryFunction()(Ie);if(!(!It||!Ro(r,It.getExtent()))){var Pt=Tt.clone(),Qt=Pt.getFill();Qt&&Qt.setColor(mt);var Ft=Pt.getStroke();Ft&&(Ft.setColor(mt),Ft.setLineDash(null)),Pt.setText(void 0);var er=Tt.getImage();if(er&&er.getOpacity()!==0){var hr=er.getImageSize();if(!hr)continue;var kt=Ja(hr[0],hr[1],void 0,{alpha:!1}),mr=kt.canvas;kt.fillStyle=mt,kt.fillRect(0,0,mr.width,mr.height),Pt.setImage(new m_({img:mr,imgSize:hr,anchor:er.getAnchor(),anchorXUnits:Mu.PIXELS,anchorYUnits:Mu.PIXELS,offset:er.getOrigin(),opacity:1,size:er.getSize(),scale:er.getScale(),rotation:er.getRotation(),rotateWithView:er.getRotateWithView()}))}var vr=Pt.getZIndex()||0,Lr=Ue[vr];Lr||(Lr={},Ue[vr]=Lr,Lr[Ot.POLYGON]=[],Lr[Ot.CIRCLE]=[],Lr[Ot.LINE_STRING]=[],Lr[Ot.POINT]=[]),Lr[It.getType().replace("Multi","")].push(It,Pt)}}}}}for(var Ar=Object.keys(Ue).map(Number).sort(rh),et=0,Rr=Ar.length;et<Rr;++et){var Lr=Ue[Ar[et]];for(var Sr in Lr)for(var vi=Lr[Sr],ht=0,pt=vi.length;ht<pt;ht+=2){me.setStyle(vi[ht+1]);for(var jt=0,ei=h.length;jt<ei;++jt)me.setTransform(h[jt]),me.drawGeometry(vi[ht])}}return V.getImageData(0,0,N.width,N.height)}function _0(y,h,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*Kl),s=Math.floor(Math.round(y[1])*Kl),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],V=n.data[P+2],N=V+256*(F+256*z),me=Math.floor((256*256*256-1)/h.length);N&&N%me===0&&u.push(h[N/me-1])}return u}var x2=.5,v0={Point:C2,LineString:T2,Polygon:P2,MultiPoint:A2,MultiLineString:S2,MultiPolygon:I2,GeometryCollection:E2,Circle:b2};function x0(y,h){return parseInt(Pi(y),10)-parseInt(Pi(h),10)}function b0(y,h){var n=sg(y,h);return n*n}function sg(y,h){return x2*y/h}function b2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Fn.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}function g_(y,h,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var V=F.getImageState();V==Zi.LOADED||V==Zi.ERROR?F.unlistenImageChange(r):(V==Zi.IDLE&&F.load(),V=F.getImageState(),F.listenImageChange(r),z=!0)}return w2(y,h,n,u,s,P),z}function w2(y,h,n,u,r,s){var P=n.getGeometryFunction()(h);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)w0(y,z,n,h);else{var V=v0[z.getType()];V(y,z,n,h,s)}}}function w0(y,h,n,u){if(h.getType()==Ot.GEOMETRY_COLLECTION){for(var r=h.getGeometries(),s=0,P=r.length;s<P;++s)w0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),Fn.DEFAULT);z.drawCustom(h,u,n.getRenderer(),n.getHitDetectionRenderer())}function E2(y,h,n,u,r){var s=h.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=v0[s[P].getType()];F(y,s[P],n,u,r)}}function T2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Fn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function S2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Fn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function I2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),Fn.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}function C2(y,h,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()!=Zi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Fn.IMAGE);F.setImageStyle(s,z),F.drawPoint(h,u)}if(P&&P.getText()){var V=y.getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(P,z),V.drawText(h,u)}}function A2(y,h,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()!=Zi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Fn.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(h,u)}if(P&&P.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(P,z),V.drawText(h,u)}}function P2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Fn.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}var M2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),k2=function(y){M2(h,y);function h(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 h.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,V=P.projection,N=P.rotation,me=V.getExtent(),ve=this.getLayer().getSource(),Se=u.pixelRatio,Ue=u.viewHints,et=!(Ue[vd.ANIMATING]||Ue[vd.INTERACTING]),Ie=this.context,Ne=Math.round(u.size[0]*Se),He=Math.round(u.size[1]*Se),nt=ve.getWrapX()&&V.canWrapX(),mt=nt?bs(me):null,ht=nt?Math.ceil((s[2]-me[2])/mt)+1:1,pt=nt?Math.floor((s[0]-me[0])/mt):0;do{var Tt=this.getRenderTransform(z,F,N,Se,Ne,He,pt*mt);n.execute(Ie,1,Tt,N,et,void 0,r)}while(++pt<ht)},h.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},h.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=py(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,V=this.replayGroup_,N=this.declutterExecutorGroup;if((!V||V.isEmpty())&&(!N||N.isEmpty()))return null;var me=Math.round(n.size[0]*r),ve=Math.round(n.size[1]*r);F.width!=me||F.height!=ve?(F.width=me,F.height=ve,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,ve),this.preRender(z,n);var Se=n.viewState,Ue=Se.projection,et=!1,Ie=!0;if(s.extent&&this.clipping){var Ne=ed(s.extent,Ue);Ie=Ro(Ne,n.extent),et=Ie&&!lc(Ne,n.extent),et&&this.clipUnrotated(z,n,Ne)}Ie&&this.renderWorlds(V,n),et&&z.restore(),this.postRender(z,n);var He=Gx(s.opacity),nt=this.container;return He!==nt.style.opacity&&(nt.style.opacity=He),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},h.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_,V=this.wrappedRenderedExtent_,N=this.getLayer(),me=[],ve=r[0]*Kl,Se=r[1]*Kl;me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,0).slice());var Ue=N.getSource(),et=F.getExtent();if(Ue.getWrapX()&&F.canWrapX()&&!lc(et,V)){for(var Ie=V[0],Ne=bs(et),He=0,nt=void 0;Ie<et[0];)--He,nt=Ne*He,me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,nt).slice()),Ie+=Ne;for(He=0,Ie=V[2];Ie>et[2];)++He,nt=Ne*He,me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,nt).slice()),Ie-=Ne}this.hitDetectionImageData_=y0(r,me,this.renderedFeatures_,N.getStyleFunction(),V,P,z)}u(_0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},h.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,V=u.viewState.rotation,N=this.getLayer(),me={},ve=function(et,Ie,Ne){var He=Pi(et),nt=me[He];if(nt){if(nt!==!0&&Ne<nt.distanceSq){if(Ne===0)return me[He]=!0,P.splice(P.lastIndexOf(nt),1),s(et,N,Ie);nt.geometry=Ie,nt.distanceSq=Ne}}else{if(Ne===0)return me[He]=!0,s(et,N,Ie);P.push(me[He]={feature:et,layer:N,geometry:Ie,distanceSq:Ne,callback:s})}},Se,Ue=[this.replayGroup_];return this.declutterExecutorGroup&&Ue.push(this.declutterExecutorGroup),Ue.some(function(et){return Se=et.forEachFeatureAtCoordinate(n,F,V,r,ve,et===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},h.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},h.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},h.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[vd.ANIMATING],P=n.viewHints[vd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var V=n.extent,N=n.viewState,me=N.projection,ve=N.resolution,Se=n.pixelRatio,Ue=u.getRevision(),et=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=x0);var Ne=N.center.slice(),He=gl(V,et*ve),nt=He.slice(),mt=[He.slice()],ht=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!lc(ht,n.extent)){var pt=bs(ht),Tt=Math.max(bs(He)/2,pt);He[0]=ht[0]-Tt,He[2]=ht[2]+Tt,Qv(Ne,me);var It=Gv(mt[0],me);It[0]<ht[0]&&It[2]<ht[2]?mt.push([It[0]+pt,It[1],It[2]+pt,It[3]]):It[0]>ht[0]&&It[2]>ht[2]&&mt.push([It[0]-pt,It[1],It[2]-pt,It[3]])}if(!this.dirty_&&this.renderedResolution_==ve&&this.renderedRevision_==Ue&&this.renderedRenderOrder_==Ie&&lc(this.wrappedRenderedExtent_,He))return _s(this.renderedExtent_,nt)||(this.hitDetectionImageData_=null,this.renderedExtent_=nt),this.renderedCenter_=Ne,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Pt=new u_(sg(ve,Se),He,ve,Se),Qt;this.getLayer().getDeclutter()&&(Qt=new u_(sg(ve,Se),He,ve,Se));var Ft=uh(),er;if(Ft){for(var hr=0,kt=mt.length;hr<kt;++hr){var mr=mt[hr],vr=ef(mr,me);r.loadFeatures(vr,ix(ve,me),Ft)}er=Vm(Ft,me)}else for(var hr=0,kt=mt.length;hr<kt;++hr)r.loadFeatures(mt[hr],ve,me);var Lr=b0(ve,Se),Ar=function(ei){var bi,ai=ei.getStyleFunction()||u.getStyleFunction();if(ai&&(bi=ai(ei,ve)),bi){var zi=this.renderFeature(ei,Lr,bi,Pt,er,Qt);this.dirty_=this.dirty_||zi}}.bind(this),Rr=ef(He,me),Sr=r.getFeaturesInExtent(Rr);Ie&&Sr.sort(Ie);for(var hr=0,kt=Sr.length;hr<kt;++hr)Ar(Sr[hr]);this.renderedFeatures_=Sr;var vi=Pt.finish(),jt=new p_(He,ve,Se,r.getOverlaps(),vi,u.getRenderBuffer());return Qt&&(this.declutterExecutorGroup=new p_(He,ve,Se,r.getOverlaps(),Qt.finish(),u.getRenderBuffer())),this.renderedResolution_=ve,this.renderedRevision_=Ue,this.renderedRenderOrder_=Ie,this.renderedExtent_=nt,this.wrappedRenderedExtent_=He,this.renderedCenter_=Ne,this.renderedProjection_=me,this.replayGroup_=jt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},h.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var V=0,N=r.length;V<N;++V)F=g_(s,n,r[V],u,this.boundHandleStyleImageChange_,P,z)||F;else F=g_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},h}(l0),E0=k2;var L2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),R2=function(y){L2(h,y);function h(n){return y.call(this,n)||this}return h.prototype.createRenderer=function(){return new E0(this)},h}(t0),rp=R2;var T0=jp(a_(),1);var z2=function(){function y(h){this.rbush_=new T0.default(h),this.items_={}}return y.prototype.insert=function(h,n){var u={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3],value:n};this.rbush_.insert(u),this.items_[Pi(n)]=u},y.prototype.load=function(h,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=h[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(h){var n=Pi(h),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(h,n){var u=this.items_[Pi(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Fm(r,h)||(this.remove(n),this.insert(h,n))},y.prototype.getAll=function(){var h=this.rbush_.all();return h.map(function(n){return n.value})},y.prototype.getInExtent=function(h){var n={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(h){return this.forEach_(this.getAll(),h)},y.prototype.forEachInExtent=function(h,n){return this.forEach_(this.getInExtent(h),n)},y.prototype.forEach_=function(h,n){for(var u,r=0,s=h.length;r<s;r++)if(u=n(h[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(h){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,h)},y.prototype.concat=function(h){this.rbush_.load(h.rbush_.all());for(var n in h.items_)this.items_[n]=h.items_[n]},y}(),bd=z2;var D2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(h,y);function h(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=S0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Iu.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 h.prototype.getAttributions=function(){return this.attributions_},h.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},h.prototype.getProjection=function(){return this.projection},h.prototype.getResolutions=function(){return jr()},h.prototype.getView=function(){return this.viewPromise_},h.prototype.getState=function(){return this.state_},h.prototype.getWrapX=function(){return this.wrapX_},h.prototype.getInterpolate=function(){return this.interpolate_},h.prototype.refresh=function(){this.changed()},h.prototype.setAttributions=function(n){this.attributions_=S0(n),this.changed()},h.prototype.setState=function(n){this.state_=n,this.changed()},h}(ko);function S0(y){return y?Array.isArray(y)?function(h){return y}:typeof y=="function"?y:function(h){return[y]}:null}var uf=O2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function I0(y,h){return[[-1/0,-1/0,1/0,1/0]]}var vh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var F2=!1;function B2(y,h,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),h.getType()==vh.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=F2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var V=h.getType(),N=void 0;V==vh.JSON||V==vh.TEXT?N=z.responseText:V==vh.XML?(N=z.responseXML,N||(N=new DOMParser().parseFromString(z.responseText,"application/xml"))):V==vh.ARRAY_BUFFER&&(N=z.response),N?s(h.readFeatures(N,{extent:n,featureProjection:r}),h.readProjection(N)):P()}else P()},z.onerror=P,z.send()}function y_(y,h){return function(n,u,r,s,P){var z=this;B2(y,h,n,u,r,function(F,V){z.addFeatures(F),s!==void 0&&s(F)},P||Zh)}}var C0=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xh=function(y){C0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return h}(ln);var U2=function(y){C0(h,y);function h(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Iu.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=Zh,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&&(En(u.format_,7),u.loader_=y_(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:I0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new bd:null,u.loadedExtentsRtree_=new bd,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 dh(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return h.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},h.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 xh(Qa.ADDFEATURE,n))},h.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[lo(u,en.CHANGE,this.handleFeatureChange_,this),lo(u,qp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},h.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&&(En(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},h.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},h.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],V=Pi(F);this.addToIndex_(V,F)&&r.push(F)}for(var P=0,N=r.length;P<N;P++){var F=r[P],V=Pi(F);this.setupChangeEvents_(V,F);var me=F.getGeometry();if(me){var ve=me.getExtent();u.push(ve),s.push(F)}else this.nullGeometryFeatures_[V]=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 xh(Qa.ADDFEATURE,r[P]))},h.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(Es.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(Es.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},h.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Mo)}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 xh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},h.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},h.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)})},h.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},h.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}})},h.prototype.getFeaturesCollection=function(){return this.featuresCollection_},h.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,Am(this.nullGeometryFeatures_))),n},h.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},h.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},h.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,V=[-1/0,-1/0,1/0,1/0],N=u||Cm;return this.featuresRtree_.forEachInExtent(V,function(me){if(N(me)){var ve=me.getGeometry(),Se=F;if(F=ve.closestPointXY(r,s,z,F),F<Se){P=me;var Ue=Math.sqrt(F);V[0]=r-Ue,V[1]=s-Ue,V[2]=r+Ue,V[3]=s+Ue}}}),P},h.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},h.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},h.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},h.prototype.getFormat=function(){return this.format_},h.prototype.getOverlaps=function(){return this.overlaps_},h.prototype.getUrl=function(){return this.url_},h.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 xh(Qa.CHANGEFEATURE,u))},h.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Pi(n)in this.uidIndex_},h.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},h.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,ve){var Se=P[me],Ue=s.forEachInExtent(Se,function(et){return lc(et.extent,Se)});Ue||(++F.loadingExtentsCount_,F.dispatchEvent(new xh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(et){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADEND,void 0,et))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,V=0,N=P.length;V<N;++V)z(V,N);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},h.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},h.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Fm(s.extent,n))return r=s,!0}),r&&u.remove(r)},h.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()}},h.prototype.removeFeatureInternal=function(n){var u=Pi(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Mo),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new xh(Qa.REMOVEFEATURE,n)),n}},h.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},h.prototype.setLoader=function(n){this.loader_=n},h.prototype.setUrl=function(n){En(this.format_,7),this.url_=n,this.setLoader(y_(n,this.format_))},h}(uf),ip=U2;var A0=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),cf=function(y){A0(h,y);function h(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return h}(ln);var __={LAYERS:"layers"},N2=function(y){A0(h,y);function h(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(__.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new dh(P.slice(),{unique:!0}):En(typeof P.getArray=="function",43):P=new dh(void 0,{unique:!0}),u.setLayers(P),u}return h.prototype.handleLayerChange_=function(){this.changed()},h.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Mo),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(lo(n,Es.ADD,this.handleLayersAdd_,this),lo(n,Es.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Mo);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 cf("addlayer",z))}this.changed()},h.prototype.registerLayerListeners_=function(n){var u=[lo(n,qp.PROPERTYCHANGE,this.handleLayerChange_,this),lo(n,en.CHANGE,this.handleLayerChange_,this)];n instanceof h&&u.push(lo(n,"addlayer",this.handleLayerGroupAdd_,this),lo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Pi(n)]=u},h.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new cf("addlayer",n.layer))},h.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new cf("removelayer",n.layer))},h.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new cf("addlayer",u)),this.changed()},h.prototype.handleLayersRemove_=function(n){var u=n.element,r=Pi(u);this.listenerKeys_[r].forEach(Mo),delete this.listenerKeys_[r],this.dispatchEvent(new cf("removelayer",u)),this.changed()},h.prototype.getLayers=function(){return this.get(__.LAYERS)},h.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 cf("removelayer",r[s]));this.set(__.LAYERS,n)},h.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},h.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(N){N.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 V=u[z];V.opacity*=s.opacity,V.visible=V.visible&&s.visible,V.maxResolution=Math.min(V.maxResolution,s.maxResolution),V.minResolution=Math.max(V.minResolution,s.minResolution),V.minZoom=Math.max(V.minZoom,s.minZoom),V.maxZoom=Math.min(V.maxZoom,s.maxZoom),s.extent!==void 0&&(V.extent!==void 0?V.extent=Bv(V.extent,s.extent):V.extent=s.extent),V.zIndex===void 0&&(V.zIndex=P)}return u},h.prototype.getSourceState=function(){return Iu.READY},h}(Qm),v_=N2;var na={SINGLECLICK:"singleclick",CLICK:en.CLICK,DBLCLICK:en.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var x_={ACTIVE:"active"};var V2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),G2=function(y){V2(h,y);function h(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 h.prototype.getActive=function(){return this.get(x_.ACTIVE)},h.prototype.getMap=function(){return this.map_},h.prototype.handleEvent=function(n){return!0},h.prototype.setActive=function(n){this.set(x_.ACTIVE,n)},h.prototype.setMap=function(n){this.map_=n},h}(ko);var P0=G2;var j2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),q2=function(y){j2(h,y);function h(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 h.prototype.getPointerCount=function(){return this.targetPointers.length},h.prototype.handleDownEvent=function(n){return!1},h.prototype.handleDragEvent=function(n){},h.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},h.prototype.handleMoveEvent=function(n){},h.prototype.handleUpEvent=function(n){return!1},h.prototype.stopDown=function(n){return n},h.prototype.updateTrackedPointers_=function(n){if(Z2(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=Am(this.trackedPointers_)}},h}(P0);function Z2(y){var h=y.type;return h===na.POINTERDOWN||h===na.POINTERDRAG||h===na.POINTERUP}var M0=q2;var k0=function(y){var h=y.originalEvent;return h.altKey&&!(h.metaKey||h.ctrlKey)&&!h.shiftKey};var L0=Cm,R0=function(y){return y.type==na.CLICK};var z0=function(y){return y.type==na.SINGLECLICK};var D0=function(y){var h=y.originalEvent;return En(h!==void 0,56),h.isPrimary&&h.button===0};var N0=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O0=0,wd=1,F0=[0,0,0,0],hf=[],b_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},w_=function(y){N0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return h}(ln);var X2=function(y){N0(h,y);function h(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:D0,u.defaultDeleteCondition_=function(s){return k0(s)&&z0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:L0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new bd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new rp({source:new ip({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 dh(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(Es.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(Es.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return h.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(en.CHANGE,this.boundHandleFeatureChange_)},h.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new dh;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,V=z.length;F<V;++F){var N=z[F].feature;N&&r.indexOf(N)===-1&&this.featuresBeingModified_.push(N)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new w_(b_.MODIFYSTART,this.featuresBeingModified_,n))}},h.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(en.CHANGE,this.boundHandleFeatureChange_)},h.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)}},h.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},h.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},h.prototype.getOverlay=function(){return this.overlay_},h.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},h.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},h.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},h.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},h.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},h.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},h.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)}},h.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(Eu(z),F)}},h.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,V=z.length-1;F<V;++F){var N=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:N};this.rBush_.insert(Eu(N),me)}},h.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,V=z.length-1;F<V;++F){var N=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:N};this.rBush_.insert(Eu(N),me)}},h.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,V=z.length;F<V;++F)for(var N=z[F],me=0,ve=N.length-1;me<ve;++me){var Se=N.slice(me,me+2),Ue={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(Eu(Se),Ue)}},h.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:O0,segment:[r,r]},P={feature:n,geometry:u,index:wd,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Kp(r),s);var F=u,V=uh();if(V&&this.getMap()){var N=this.getMap().getView().getProjection();F=F.clone().transform(V,N),F=Dy(F).transform(N,V)}this.rBush_.insert(F.getExtent(),P)},h.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)}},h.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new uc(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},h.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},h.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],V=F[0],N=V.feature;r.indexOf(N)===-1&&r.push(N);var me=V.geometry;s.indexOf(me)===-1&&s.push(me);for(var ve=V.depth,Se=void 0,Ue=V.segment,et=F[1];u.length<me.getStride();)u.push(Ue[et][u.length]);switch(me.getType()){case Ot.POINT:Se=u,Ue[0]=u,Ue[1]=u;break;case Ot.MULTI_POINT:Se=me.getCoordinates(),Se[V.index]=u,Ue[0]=u,Ue[1]=u;break;case Ot.LINE_STRING:Se=me.getCoordinates(),Se[V.index+et]=u,Ue[et]=u;break;case Ot.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.POLYGON:Se=me.getCoordinates(),Se[ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.MULTI_POLYGON:Se=me.getCoordinates(),Se[ve[1]][ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.CIRCLE:if(Ue[0]=u,Ue[1]=u,V.index===O0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ne=Ey(Xl(me.getCenter(),Ie),Xl(u,Ie)),He=uh();if(He){var nt=me.clone().transform(He,Ie);nt.setRadius(Ne),Ne=nt.transform(Ie,He).getRadius()}me.setRadius(Ne),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},h.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=Eu([z]),V=this.rBush_.getInExtent(F),N={};V.sort(W2);for(var me=0,ve=V.length;me<ve;++me){var Se=V[me],Ue=Se.segment,et=Pi(Se.geometry),Ie=Se.depth;if(Ie&&(et+="-"+Ie.join("-")),N[et]||(N[et]=new Array(2)),Se.geometry.getType()===Ot.CIRCLE&&Se.index===wd){var Ne=U0(u,Se,s);Su(Ne,z)&&!N[et][0]&&(this.dragSegments_.push([Se,0]),N[et][0]=Se);continue}if(Su(Ue[0],z)&&!N[et][0]){this.dragSegments_.push([Se,0]),N[et][0]=Se;continue}if(Su(Ue[1],z)&&!N[et][1]){if((Se.geometry.getType()===Ot.LINE_STRING||Se.geometry.getType()===Ot.MULTI_LINE_STRING)&&N[et][0]&&N[et][0].index===0)continue;this.dragSegments_.push([Se,1]),N[et][1]=Se;continue}Pi(Ue)in this.vertexSegments_&&!N[et][0]&&!N[et][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var He=P.length-1;He>=0;--He)this.insertVertex_(P[He],z)}return!!this.vertexFeature_},h.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()===Ot.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(Kp(P),z);var V=s,N=uh();if(N){var me=n.map.getView().getProjection();V=V.clone().transform(N,me),V=Dy(V).transform(me,N)}this.rBush_.update(V.getExtent(),F)}else this.rBush_.update(Eu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},h.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},h.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(kt,mr){return B0(P,kt,z)-B0(P,mr,z)},V,N;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(kt){return kt===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(kt,mr,vr){if(vr=vr||kt.getGeometry(),vr.getType()===Ot.POINT&&vv(s.features_.getArray(),kt)){N=vr;var Lr=vr.getFlatCoordinates().slice(0,2);V=[{feature:kt,geometry:vr,segment:[Lr,Lr]}]}return!0},{layerFilter:me})}if(!V){var ve=ed(Kp(P,F0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ue=ef(gl(ve,Se,F0),z);V=this.rBush_.getInExtent(Ue)}if(V&&V.length>0){var et=V.sort(F)[0],Ie=et.segment,Ne=U0(P,et,z),He=u.getPixelFromCoordinate(Ne),nt=Ey(n,He);if(N||nt<=this.pixelTolerance_){var mt={};if(mt[Pi(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ne[0]-P[0],this.delta_[1]=Ne[1]-P[1]),et.geometry.getType()===Ot.CIRCLE&&et.index===wd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ne,[et.feature],[et.geometry]);else{var ht=u.getPixelFromCoordinate(Ie[0]),pt=u.getPixelFromCoordinate(Ie[1]),Tt=Qp(He,ht),It=Qp(He,pt);nt=Math.sqrt(Math.min(Tt,It)),this.snappedToVertex_=nt<=this.pixelTolerance_,this.snappedToVertex_&&(Ne=Tt>It?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ne,[et.feature],[et.geometry]);var Pt={};Pt[Pi(et.geometry)]=!0;for(var Qt=1,Ft=V.length;Qt<Ft;++Qt){var er=V[Qt].segment;if(Su(Ie[0],er[0])&&Su(Ie[1],er[1])||Su(Ie[0],er[1])&&Su(Ie[1],er[0])){var hr=Pi(V[Qt].geometry);hr in Pt||(Pt[hr]=!0,mt[Pi(er)]=!0)}else break}}this.vertexSegments_=mt;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},h.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,V;u.length<P.getStride();)u.push(0);switch(P.getType()){case Ot.MULTI_LINE_STRING:V=P.getCoordinates(),V[z[0]].splice(F+1,0,u);break;case Ot.POLYGON:V=P.getCoordinates(),V[z[0]].splice(F+1,0,u);break;case Ot.MULTI_POLYGON:V=P.getCoordinates(),V[z[1]][z[0]].splice(F+1,0,u);break;case Ot.LINE_STRING:V=P.getCoordinates(),V.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,V);var N=this.rBush_;N.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};N.insert(Eu(me.segment),me),this.dragSegments_.push([me,1]);var ve={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};N.insert(Eu(ve.segment),ve),this.dragSegments_.push([ve,0]),this.ignoreNextSingleClick_=!0},h.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 w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},h.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,V,N,me,ve,Se,Ue,et;for(V=n.length-1;V>=0;--V)z=n[V],Ue=z[0],et=Pi(Ue.feature),Ue.depth&&(et+="-"+Ue.depth.join("-")),et in u||(u[et]={}),z[1]===0?(u[et].right=Ue,u[et].index=Ue.index):z[1]==1&&(u[et].left=Ue,u[et].index=Ue.index+1);for(et in u){switch(Se=u[et].right,me=u[et].left,N=u[et].index,ve=N-1,me!==void 0?Ue=me:Ue=Se,ve<0&&(ve=0),F=Ue.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Ot.MULTI_LINE_STRING:P[Ue.depth[0]].length>2&&(P[Ue.depth[0]].splice(N,1),r=!0);break;case Ot.LINE_STRING:P.length>2&&(P.splice(N,1),r=!0);break;case Ot.MULTI_POLYGON:s=s[Ue.depth[1]];case Ot.POLYGON:s=s[Ue.depth[0]],s.length>4&&(N==s.length-1&&(N=0),s.splice(N,1),r=!0,N===0&&(s.pop(),s.push(s[0]),ve=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ne={depth:Ue.depth,feature:Ue.feature,geometry:Ue.geometry,index:ve,segment:Ie};this.rBush_.insert(Eu(Ne.segment),Ne)}this.updateSegmentIndices_(F,N,Ue.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},h.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},h.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)})},h}(M0);function W2(y,h){return y.index-h.index}function B0(y,h,n){var u=h.geometry;if(u.getType()===Ot.CIRCLE){var r=u;if(h.index===wd){var s=uh();s&&(r=r.clone().transform(s,n));var P=Qp(r.getCenter(),Xl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Xl(y,n);return hf[0]=Xl(h.segment[0],n),hf[1]=Xl(h.segment[1],n),Jv(F,hf)}function U0(y,h,n){var u=h.geometry;if(u.getType()===Ot.CIRCLE&&h.index===wd){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Iy(r.getClosestPoint(Xl(y,n)),n)}var P=Xl(y,n);return hf[0]=Xl(h.segment[0],n),hf[1]=Xl(h.segment[1],n),Iy(wy(P,hf),n)}function $2(){var y=Yx();return function(h,n){return y[Ot.POINT]}}var E_=X2;var K2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(h,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(h);n.extent&&r&&r.getUnits()===sc.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(h){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},h)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(h,n){return jr()},y.prototype.readFeatures=function(h,n){return jr()},y.prototype.readGeometry=function(h,n){return jr()},y.prototype.readProjection=function(h){return jr()},y.prototype.writeFeature=function(h,n){return jr()},y.prototype.writeFeatures=function(h,n){return jr()},y.prototype.writeGeometry=function(h,n){return jr()},y}(),V0=K2;function T_(y,h,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!rx(u,r)?s=(h?y.clone():y).transform(h?u:r,h?r:u):s=y,h&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var V=0,N=F.length;V<N;++V)F[V]=Math.round(F[V]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var H2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y2=function(y){H2(h,y);function h(){return y.call(this)||this}return h.prototype.getType=function(){return vh.JSON},h.prototype.readFeature=function(n,u){return this.readFeatureFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readFeatureFromObject=function(n,u){return jr()},h.prototype.readFeaturesFromObject=function(n,u){return jr()},h.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readGeometryFromObject=function(n,u){return jr()},h.prototype.readProjection=function(n){return this.readProjectionFromObject(lg(n))},h.prototype.readProjectionFromObject=function(n){return jr()},h.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},h.prototype.writeFeatureObject=function(n,u){return jr()},h.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},h.prototype.writeFeaturesObject=function(n,u){return jr()},h.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},h.prototype.writeGeometryObject=function(n,u){return jr()},h}(V0);function lg(y){if(typeof y=="string"){var h=JSON.parse(y);return h||null}else return y!==null?y:null}var G0=Y2;var J2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(h,y);function h(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 h.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=S_(r.geometry,u),P=new uc;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},h.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,V=z.length;F<V;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},h.prototype.readGeometryFromObject=function(n,u){return S_(n,u)},h.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):En(!1,36):r=this.dataProjection,r},h.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=I_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},h.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}},h.prototype.writeGeometryObject=function(n,u){return I_(n,this.adaptOptions(u))},h}(G0);function S_(y,h){if(!y)return null;var n;switch(y.type){case Ot.POINT:{n=tE(y);break}case Ot.LINE_STRING:{n=rE(y);break}case Ot.POLYGON:{n=aE(y);break}case Ot.MULTI_POINT:{n=nE(y);break}case Ot.MULTI_LINE_STRING:{n=iE(y);break}case Ot.MULTI_POLYGON:{n=oE(y);break}case Ot.GEOMETRY_COLLECTION:{n=eE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return T_(n,!1,h)}function eE(y,h){var n=y.geometries.map(function(u){return S_(u,h)});return new px(n)}function tE(y){return new _a(y.coordinates)}function rE(y){return new Wl(y.coordinates)}function iE(y){return new Tx(y.coordinates)}function nE(y){return new Km(y.coordinates)}function oE(y){return new kx(y.coordinates)}function aE(y){return new cd(y.coordinates)}function I_(y,h){y=T_(y,!0,h);var n=y.getType(),u;switch(n){case Ot.POINT:{u=pE(y,h);break}case Ot.LINE_STRING:{u=lE(y,h);break}case Ot.POLYGON:{u=fE(y,h);break}case Ot.MULTI_POINT:{u=cE(y,h);break}case Ot.MULTI_LINE_STRING:{u=uE(y,h);break}case Ot.MULTI_POLYGON:{u=hE(y,h);break}case Ot.GEOMETRY_COLLECTION:{u=sE(y,h);break}case Ot.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function sE(y,h){var n=y.getGeometriesArray().map(function(u){var r=Ra({},h);return delete r.featureProjection,I_(u,r)});return{type:"GeometryCollection",geometries:n}}function lE(y,h){return{type:"LineString",coordinates:y.getCoordinates()}}function uE(y,h){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function cE(y,h){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function hE(y,h){var n;return h&&(n=h.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function pE(y,h){return{type:"Point",coordinates:y.getCoordinates()}}function fE(y,h){var n;return h&&(n=h.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=Q2;var ug,dE=new Uint8Array(16);function C_(){if(!ug&&(ug=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ug))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ug(dE)}var xa=[];for(let y=0;y<256;++y)xa.push((y+256).toString(16).slice(1));function j0(y,h=0){return(xa[y[h+0]]+xa[y[h+1]]+xa[y[h+2]]+xa[y[h+3]]+"-"+xa[y[h+4]]+xa[y[h+5]]+"-"+xa[y[h+6]]+xa[y[h+7]]+"-"+xa[y[h+8]]+xa[y[h+9]]+"-"+xa[y[h+10]]+xa[y[h+11]]+xa[y[h+12]]+xa[y[h+13]]+xa[y[h+14]]+xa[y[h+15]]).toLowerCase()}var mE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),A_={randomUUID:mE};function gE(y,h,n){if(A_.randomUUID&&!h&&!y)return A_.randomUUID();y=y||{};let u=y.random||(y.rng||C_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,h){n=n||0;for(let r=0;r<16;++r)h[n+r]=u[r];return h}return j0(u)}var P_=gE;var np=class extends ko{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 V=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",V||[])}},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(V=>V.visible)&&this.children.forEach(V=>{V.visible=!0}),this.parent&&this.group){let V=this.parent;for(;V.parent;)V=V.parent;let N=new ln("change:visible:group");N.target=this,V.dispatchEvent(N)}}else this.visible||(this.children&&this.children.forEach(V=>{V.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(V=>V.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(V=>{V.parent=void 0}),Array.isArray(F)&&F.forEach(V=>{V.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 $f(this)}};function yE(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||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new ln("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new ln("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var cg=yE;var Ed=class extends cg(np){constructor(n){super(n);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?.setVisible(this.visible),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 Ed({...this.options,...n})}},Is=Ed;var q0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),_E=new $l({stroke:new va({color:[0,0,0,1],width:5})}),vE=new $l({image:q0,stroke:new va({color:[255,0,0,1],width:3})}),xE=new $l({image:q0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),bE=(y,h)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=h<=n&&h>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[_E,vE]:[xE]},Td=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new rp({source:new ip,style:n.style||bE})}clone(n){return new Td({...this.options,...n})}},hg=Td;var wE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,Z0=/^([\d.]+),([\d.]+)$/,X0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,pg="stop-fetch",W0=y=>{let h=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&h.push(...u)}),h},Sd=class extends of{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 qf({...n}),this.routingLayer=n.routingLayer||new hg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new ln("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 ln("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new ln("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new ln("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new ln("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[pg]?.abort(),this.abortControllers[pg]=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[pg]);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[pg])),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 V=this.segments.reduce((N,me)=>{let ve=me.get("trg");return N.find(Se=>Se[0]===ve[0]&&Se[1]===ve[1])?N:[...N,ve]},[]);this.segments=V.map(N=>{let me=this.segments.filter(Se=>{let Ue=Se.get("trg");return Ue[0]===N[0]&&Ue[1]===N[1]}),ve=W0(me);return new uc({geometry:new Wl(ve)})})}let z=W0(this.segments),F=new uc({geometry:new Wl(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 ln("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new uc;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||X0.test(n)){let N,me;return this.useRawViaPoints?[,N,,me]=X0.exec(n)||[]:[N,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${N}?key=${this.stopsApiKey}`,{signal:r.signal}).then(ve=>ve.json()).then(ve=>{let{coordinates:Se}=ve.features[0].geometry;return this.cacheStationData[n]=uo(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(uo(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(ve=>{ve.name!=="AbortError"&&(this.dispatchEvent(new ln("error")),this.onRouteError(ve,this),this.loading=!1)})}if(this.useRawViaPoints&&Z0.test(n)){let[N,me]=Z0.exec(n)||[],ve=uo([parseFloat(me),parseFloat(N)],this.map?.getView().getProjection());return s.setGeometry(new _a(ve)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,V]=wE.exec(n)||[];if(F&&z){let N=uo([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",V),s.setGeometry(new _a(N)),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(N=>N.json()).then(N=>{let{coordinates:me}=N.features[0].geometry;return this.cacheStationData[n]=uo(me),s.set("viaPointTrack",V),s.setGeometry(new _a(uo(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(N=>(this.dispatchEvent(new ln("error")),this.onRouteError(N,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()==="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()==="LineString");if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=gl(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()==="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 E_({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()==="Point"&&s.get("index"));return R0(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=Sd.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(){}},$0=Sd;var M_=class extends of{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 Zf(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")}},K0=M_;var k_=class extends K0{onSuggestionClick(h){let n=uo(h.geometry.coordinates);this.map.getView().setCenter(n)}},H0=k_;var J0=jp(Y0());var z_=class extends Is{constructor(n){super(n);this.olLayer=new Jh({source:new uf({}),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:Xh(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 ln("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=ac(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}},fg=z_;var op=class extends fg{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=ac(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 rf(this)}getMapboxMapClass(){return J0.Map}clone(n){return new op({...this.options,...n})}};var t1=jp(e1());var ap=class extends fg{getOlLayerRender(){return tf(this)}getMapboxMapClass(){return t1.Map}clone(n){return new ap({...this.options,...n})}};var Id=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 V=0;V<F.length;V+=1){let N=F[V];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Id({...this.options,...n})}},r1=Id;var N_=jp(a1()),V_=jp(h1());function iT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||qo.TOPOGRAPHIC,this.api=u.api||new Wf(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"],s=["rail"],P=["tram","subway","rail","bus"];this.motsByZoom=u.motsByZoom||[s,s,s,s,s,s,s,s,s,P,P,r,r,r,r],this.getMotsByZoom=z=>u.getMotsByZoom&&u.getMotsByZoom(z,this.motsByZoom)||this.motsByZoom[z]||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=z=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(z,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[z],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=z=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(z,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[z],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:V,sort:N,time:me,live:ve,canvas:Se,styleOptions:Ue,mode:et}=u,Ie=Se,Ne=s||1,He=me||new Date,nt=et||qo.TOPOGRAPHIC,mt=r||Yh;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{get:()=>(Ie||(Ie=document.createElement("canvas")),Ie),set:ht=>{Ie=ht}},mode:{get:()=>nt,set:ht=>{ht!==nt&&(nt=ht,this.api?.wsApi?.open&&(this.stop(),this.start()))}},style:{get:()=>mt,set:ht=>{mt=ht,this.renderTrajectories()}},styleOptions:{value:{...nf,...Ue||{}}},speed:{get:()=>Ne,set:ht=>{Ne=ht,this.start()}},filter:{value:V,writable:!0},sort:{value:N,writable:!0},live:{value:ve===!1?ve:!0,writable:!0},time:{get:()=>He,set:ht=>{He=ht&&ht.getTime?ht:new Date(ht),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(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas){let u=this.canvas.getContext("2d");u&&u.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=hd(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}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=gl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let V=[];for(let N=0;N<F.length&&(F[N].properties.coordinate&&Wp(z,F[N].properties.coordinate)&&V.push(F[N]),V.length!==P);N+=1);return Promise.resolve({layer:this,features:V.map(N=>this.format.readFeature(N)),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.removeTrajectory(u)})}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Ro(r,z)||this.mots&&!this.mots.includes(P)?(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===qo.TOPOGRAPHIC&&F?r.properties.olGeometry=this.format.readGeometry({type:"Point",coordinates:uo(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 mg=iT;var nT=new $l({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),oT=(y,h,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,[nT,new $l({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},gg=oT;var aT=new $l({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),sT=new $l({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),lT=()=>[aT,sT],p1=lT;var uT=new bl,Cd=class extends mg(Is){constructor(n){super({...n});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!n.allowRenderWhenAnimating,this.olLayer=n.olLayer||new v_({layers:[new rp({source:new ip({features:[]}),style:(u,r)=>(n.fullTrajectoryStyle||gg)(u,r,this.styleOptions)}),new Jh({source:new uf({}),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:V}=this.renderedViewState;if(F/s>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let N=this.map.getPixelFromCoordinate(z),me=this.map.getPixelFromCoordinate(r);this.transformContainer.style.transform=Rv(N[0]-me[0],N[1]-me[1],F/s,F/s,P-V,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",{willReadFrequently:!0}),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={}){if(!this.map||!this.map.getView())return Promise.resolve({layer:this,features:[],coordinate:n});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(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}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=uT.readFeatures(r);this.vectorLayer.getSource().addFeatures(s)})}clone(n){return new Cd({...this.options,...n})}},f1=Cd;var Ad=class extends Is{getFeatureInfoAtCoordinate(h){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(h);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:h})}clone(h){return new Ad({...this.options,...h})}},d1=Ad;var Pd=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 Pd({...this.options,...n})}},m1=Pd;var bg={};oy(bg,{CopyrightControl:()=>g1,Layer:()=>_g,RealtimeAPI:()=>Wf,RealtimeLayer:()=>M1,RealtimeModes:()=>qo,RoutingAPI:()=>qf,StopsAPI:()=>Zf,compareDepartures:()=>pd,createRealtimeFilters:()=>cy,debounceDeparturesMessages:()=>Oy,debounceWebsocketMessages:()=>Xf,getCircleCanvas:()=>qy,getDelayBgCanvas:()=>Gy,getDelayTextCanvas:()=>jy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>ac,getMapboxRender:()=>rf,getMaplibreRender:()=>tf,getMercatorResolution:()=>xg,getSourceCoordinates:()=>Ld,getTextCanvas:()=>Zy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Xh,pad:()=>Rm,realtimeConfig:()=>nf,realtimeDefaultStyle:()=>Yh,realtimeDelayStyle:()=>Xy,realtimeSimpleStyle:()=>Wy,removeDuplicate:()=>Wh,renderTrajectories:()=>hd,sortAndFilterDepartures:()=>fd,sortByDelay:()=>hy});var G_=class extends eg{constructor(h){super(h),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 ac(this.map)}},g1=G_;var Md=class extends cg(np){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 Qf([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new Md({...this.options,...n})}},_g=Md;var Zo=63710088e-1,y1={centimeters:Zo*100,centimetres:Zo*100,degrees:Zo/111325,feet:Zo*3.28084,inches:Zo*39.37,kilometers:Zo/1e3,kilometres:Zo/1e3,meters:Zo,metres:Zo,miles:Zo/1609.344,millimeters:Zo*1e3,millimetres:Zo*1e3,nauticalmiles:Zo/1852,radians:1,yards:Zo*1.0936},T5={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/Zo,yards:1.0936133};function _1(y,h,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=h||{},u.geometry=y,u}function bh(y,h,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 _1(u,h,n)}function cT(y,h){h===void 0&&(h="kilometers");var n=y1[h];if(!n)throw new Error(h+" units is invalid");return y*n}function hT(y,h){h===void 0&&(h="kilometers");var n=y1[h];if(!n)throw new Error(h+" units is invalid");return y/n}function v1(y){var h=y%(2*Math.PI);return h*180/Math.PI}function sp(y){var h=y%360;return h*Math.PI/180}function vg(y,h,n){if(h===void 0&&(h="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return cT(hT(y,h),n)}function j_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function q_(y){return!!y&&y.constructor===Object}function kd(y,h,n){if(y!==null)for(var u,r,s,P,z,F,V,N=0,me=0,ve,Se=y.type,Ue=Se==="FeatureCollection",et=Se==="Feature",Ie=Ue?y.features.length:1,Ne=0;Ne<Ie;Ne++){V=Ue?y.features[Ne].geometry:et?y.geometry:y,ve=V?V.type==="GeometryCollection":!1,z=ve?V.geometries.length:1;for(var He=0;He<z;He++){var nt=0,mt=0;if(P=ve?V.geometries[He]:V,P!==null){F=P.coordinates;var ht=P.type;switch(N=n&&(ht==="Polygon"||ht==="MultiPolygon")?1:0,ht){case null:break;case"Point":if(h(F,me,Ne,nt,mt)===!1)return!1;me++,nt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(h(F[u],me,Ne,nt,mt)===!1)return!1;me++,ht==="MultiPoint"&&nt++}ht==="LineString"&&nt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-N;r++){if(h(F[u][r],me,Ne,nt,mt)===!1)return!1;me++}ht==="MultiLineString"&&nt++,ht==="Polygon"&&mt++}ht==="Polygon"&&nt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(mt=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-N;s++){if(h(F[u][r][s],me,Ne,nt,mt)===!1)return!1;me++}mt++}nt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(kd(P.geometries[u],h,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function pT(y,h){h===void 0&&(h={});var n=0,u=0,r=0;return kd(y,function(s){n+=s[0],u+=s[1],r++},!0),bh([n/r,u/r],h.properties)}var x1=pT;function ku(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 b1(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 fT(y,h,n){n===void 0&&(n={});var u;n.final?u=w1(ku(h),ku(y)):u=w1(ku(y),ku(h));var r=u>180?-(360-u):u;return r}function w1(y,h){var n=sp(y[1]),u=sp(h[1]),r=sp(h[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(v1(P)+360)%360}var E1=fT;function dT(y,h,n){n===void 0&&(n={});var u=ku(y),r=ku(h);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=mT(u,r),P=vg(s,"meters",n.units);return P}function mT(y,h,n){n=n===void 0?Zo:Number(n);var u=n,r=y[1]*Math.PI/180,s=h[1]*Math.PI/180,P=s-r,z=Math.abs(h[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)),V=Math.abs(F)>1e-11?P/F:Math.cos(r),N=Math.sqrt(P*P+V*V*z*z),me=N*u;return me}var T1=dT;function gT(y,h,n,u){u===void 0&&(u={});var r=h<0,s=vg(Math.abs(h),u.units,"meters");r&&(s=-Math.abs(s));var P=ku(y),z=yT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,bh(z,u.properties)}function yT(y,h,n,u){u=u===void 0?Zo:Number(u);var r=h/u,s=y[0]*Math.PI/180,P=sp(y[1]),z=sp(n),F=r*Math.cos(z),V=P+F;Math.abs(V)>Math.PI/2&&(V=V>0?Math.PI-V:-Math.PI-V);var N=Math.log(Math.tan(V/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(N)>1e-11?F/N:Math.cos(P),ve=r*Math.sin(z)/me,Se=s+ve;return[(Se*180/Math.PI+540)%360-180,V*180/Math.PI]}var S1=gT;function _T(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return I1(y);case"FeatureCollection":return vT(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 I1(y){var h={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:h[n]=y[n]}}),h.properties=C1(y.properties),h.geometry=Z_(y.geometry),h}function C1(y){var h={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?h[n]=null:Array.isArray(u)?h[n]=u.map(function(r){return r}):h[n]=C1(u):h[n]=u}),h}function vT(y){var h={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:h[n]=y[n]}}),h.features=y.features.map(function(n){return I1(n)}),h}function Z_(y){var h={type:y.type};return y.bbox&&(h.bbox=y.bbox),y.type==="GeometryCollection"?(h.geometries=y.geometries.map(function(n){return Z_(n)}),h):(h.coordinates=A1(y.coordinates),h)}function A1(y){var h=y;return typeof h[0]!="object"?h.slice():h.map(function(n){return A1(n)})}var P1=_T;function xT(y,h,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(h==null||isNaN(h))throw new Error("angle is required");return h===0||(u||(u=x1(y)),(r===!1||r===void 0)&&(y=P1(y)),kd(y,function(s){var P=E1(u,s),z=P+h,F=T1(u,s),V=b1(S1(u,F,z));s[0]=V[0],s[1]=V[1]})),y}var X_=xT;var bT=(y,h=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/h}),P=y.unproject({x:n/h,y:u/h}),z=y.unproject({x:n/h,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Ld=bT;var wT=y=>{let h=y.getBounds().toArray(),n=uo(h[0]),u=uo(h[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Tu(r)/P;return Math.max(z,F)},xg=wT;var W_=class extends mg(_g){constructor(h={}){super({...h}),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(h,n){!h||(super.attachToMap(h),this.source={type:"canvas",canvas:this.canvas,coordinates:Ld(h,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"}},h.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(h=>{Ha(h)}),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(h){super.onUserMoveCallback({coordinate:uo(h.lngLat.toArray()),...h})}renderTrajectories(h=!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=X_(bh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=X_(bh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,V=[...uo(z),...uo(F)],N=bs(V)/(n/this.pixelRatio),me=Tu(V)/(u/this.pixelRatio),ve=Math.max(N,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:uo([r.lng,r.lat]),extent:V,resolution:ve,zoom:this.getOlZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,h)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(h,n={}){let u=xg(this.map);return super.getFeatureInfoAtCoordinate(h,{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(h,n,u){return super.purgeTrajectory(h,n||this.getMercatorExtent(),u||Math.floor(this.getOlZoom()))}setBbox(h,n){let u=h,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=h||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(h,n=!1){let u=super.renderTrajectoriesInternal(h,n);if(u&&this.map.style){let r=Ld(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(h,n,u){super.onFeatureHover(h,n,u),this.map.getCanvasContainer().style.cursor=h.length?"pointer":"auto"}},M1=W_;var $_={ol:yg,mapbox:bg};typeof window<"u"&&(window.mbt=$_);var S3=$_;})();
1082
+ `){vr+=mr,mr=0,er=ve*ht+Ft*Se,++Ar;continue}var ei=Ue[Sr+1]||F.font;ei!==Rr&&(r&&hr.push("font",ei),u&&kt.push("font",ei),Rr=ei),mr=Math.max(mr,nt[Lr]);var bi=[jt,er+Ft*He[Lr]+ve*(He[Lr]-mt[Ar]),.5*(Se+mr)+vr];er+=He[Lr],r&&hr.push("strokeText",bi),u&&kt.push("fillText",bi),++Lr}return Array.prototype.push.apply(pt,hr),Array.prototype.push.apply(pt,kt),this.labels_[s]=Pt,Pt},y.prototype.replayTextBackground_=function(h,n,u,r,s,P,z){h.beginPath(),h.moveTo.apply(h,n),h.lineTo.apply(h,u),h.lineTo.apply(h,r),h.lineTo.apply(h,s),h.lineTo.apply(h,n),P&&(this.alignFill_=P[2],this.fill_(h)),z&&(this.setStrokeStyle_(h,z),h.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(h,n,u,r,s,P,z,F,V,N,me,ve,Se,Ue,et,Ie){z*=ve[0],F*=ve[1];var Ne=u-z,He=r-F,nt=s+V>h?h-V:s,mt=P+N>n?n-N:P,ht=Ue[3]+nt*ve[0]+Ue[1],pt=Ue[0]+mt*ve[1]+Ue[2],Tt=Ne-Ue[3],It=He-Ue[0];(et||me!==0)&&(yh[0]=Tt,_h[0]=Tt,yh[1]=It,yc[1]=It,yc[0]=Tt+ht,_c[0]=yc[0],_c[1]=It+pt,_h[1]=_c[1]);var Pt;return me!==0?(Pt=vs(za(),u,r,1,1,me,-u,-r),bo(Pt,yh),bo(Pt,yc),bo(Pt,_c),bo(Pt,_h),sh(Math.min(yh[0],yc[0],_c[0],_h[0]),Math.min(yh[1],yc[1],_c[1],_h[1]),Math.max(yh[0],yc[0],_c[0],_h[0]),Math.max(yh[1],yc[1],_c[1],_h[1]),lf)):sh(Math.min(Tt,Tt+ht),Math.min(It,It+pt),Math.max(Tt,Tt+ht),Math.max(It,It+pt),lf),Se&&(Ne=Math.round(Ne),He=Math.round(He)),{drawImageX:Ne,drawImageY:He,drawImageW:nt,drawImageH:mt,originX:V,originY:N,declutterBox:{minX:lf[0],minY:lf[1],maxX:lf[2],maxY:lf[3],value:Ie},canvasTransform:Pt,scale:ve}},y.prototype.replayImageOrLabel_=function(h,n,u,r,s,P,z){var F=!!(P||z),V=r.declutterBox,N=h.canvas,me=z?z[2]*r.scale[0]/2:0,ve=V.minX-me<=N.width/n&&V.maxX+me>=0&&V.minY-me<=N.height/n&&V.maxY+me>=0;return ve&&(F&&this.replayTextBackground_(h,yh,yc,_c,_h,P,z),Xx(h,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(h){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;h.save(),h.translate(n[0]%u,n[1]%u),h.rotate(this.viewRotation_)}h.fill(),this.alignFill_&&h.restore()},y.prototype.setStrokeStyle_=function(h,n){h.strokeStyle=n[1],h.lineWidth=n[2],h.lineCap=n[3],h.lineJoin=n[4],h.miterLimit=n[5],h.setLineDash&&(h.lineDashOffset=n[7],h.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(h,n,u,r){var s=this.textStates[n],P=this.createLabel(h,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,V=h0(Array.isArray(h)?h[0]:h,s.textAlign||gh),N=yd[s.textBaseline||tp],me=z&&z.lineWidth?z.lineWidth:0,ve=P.width/F-2*s.scale[0],Se=V*ve+2*(.5-V)*me,Ue=N*P.height/F+2*(.5-N)*me;return{label:P,anchorX:Se,anchorY:Ue}},y.prototype.execute_=function(h,n,u,r,s,P,z,F){var V;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?V=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),V=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),kv(this.renderedTransform_,u));for(var N=0,me=r.length,ve=0,Se,Ue,et,Ie,Ne,He,nt,mt,ht,pt,Tt,It,Pt=0,Qt=0,Ft=null,er=null,hr=this.coordinateCache_,kt=this.viewRotation_,mr=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,vr={context:h,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:kt},Lr=this.instructions!=r||this.overlaps?0:200,Ar,Rr,Sr,vi;N<me;){var jt=r[N],ei=jt[0];switch(ei){case qr.BEGIN_GEOMETRY:Ar=jt[1],vi=jt[3],Ar.getGeometry()?z!==void 0&&!Ro(z,vi.getExtent())?N=jt[2]+1:++N:N=jt[2];break;case qr.BEGIN_PATH:Pt>Lr&&(this.fill_(h),Pt=0),Qt>Lr&&(h.stroke(),Qt=0),!Pt&&!Qt&&(h.beginPath(),Ie=NaN,Ne=NaN),++N;break;case qr.CIRCLE:ve=jt[1];var bi=V[ve],ai=V[ve+1],zi=V[ve+2],Or=V[ve+3],Mn=zi-bi,wo=Or-ai,Xi=Math.sqrt(Mn*Mn+wo*wo);h.moveTo(bi+Xi,ai),h.arc(bi,ai,Xi,0,2*Math.PI,!0),++N;break;case qr.CLOSE_PATH:h.closePath(),++N;break;case qr.CUSTOM:ve=jt[1],Se=jt[2];var Pr=jt[3],co=jt[4],Mi=jt.length==6?jt[5]:void 0;vr.geometry=Pr,vr.feature=Ar,N in hr||(hr[N]=[]);var di=hr[N];Mi?Mi(V,ve,Se,2,di):(di[0]=V[ve],di[1]=V[ve+1],di.length=2),co(di,vr),++N;break;case qr.DRAW_IMAGE:ve=jt[1],Se=jt[2],mt=jt[3],Ue=jt[4],et=jt[5];var $n=jt[6],mn=jt[7],Xr=jt[8],Wi=jt[9],kn=jt[10],Bn=jt[11],Un=jt[12],$i=jt[13],gn=jt[14];if(!mt&&jt.length>=19){ht=jt[18],pt=jt[19],Tt=jt[20],It=jt[21];var Tn=this.drawLabelWithPointPlacement_(ht,pt,Tt,It);mt=Tn.label,jt[3]=mt;var Eo=jt[22];Ue=(Tn.anchorX-Eo)*this.pixelRatio,jt[4]=Ue;var wt=jt[23];et=(Tn.anchorY-wt)*this.pixelRatio,jt[5]=et,$n=mt.height,jt[6]=$n,$i=mt.width,jt[13]=$i}var Wt=void 0;jt.length>24&&(Wt=jt[24]);var ho=void 0,yn=void 0,Wr=void 0;jt.length>16?(ho=jt[15],yn=jt[16],Wr=jt[17]):(ho=dc,yn=!1,Wr=!1),kn&&mr?Bn+=kt:!kn&&!mr&&(Bn-=kt);for(var Ln=0;ve<Se;ve+=2)if(!(Wt&&Wt[Ln++]<$i/this.pixelRatio)){var Bi=this.calculateImageOrLabelDimensions_(mt.width,mt.height,V[ve],V[ve+1],$i,$n,Ue,et,Xr,Wi,Bn,Un,s,ho,yn||Wr,Ar),fn=[h,n,mt,Bi,mn,yn?Ft:null,Wr?er:null],Kn=void 0,Zt=void 0;if(F&&gn){var Nr=Se-ve;if(!gn[Nr]){gn[Nr]=fn;continue}if(Kn=gn[Nr],delete gn[Nr],Zt=c0(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))}++N;break;case qr.DRAW_CHARS:var Fr=jt[1],Gi=jt[2],Sn=jt[3],Ir=jt[4];It=jt[5];var to=jt[6],Ki=jt[7],wi=jt[8];Tt=jt[9];var te=jt[10];ht=jt[11],pt=jt[12];var he=[jt[13],jt[13]],de=this.textStates[pt],Te=de.font,Le=[de.scale[0]*Ki,de.scale[1]*Ki],We=void 0;Te in this.widths_?We=this.widths_[Te]:(We={},this.widths_[Te]=We);var Je=$m(V,Fr,Gi,2),we=Math.abs(Le[0])*r_(Te,ht,We);if(Ir||we<=Je){var Ve=this.textStates[pt].textAlign,ie=(Je-we)*yd[Ve],X=u0(V,Fr,Gi,2,ht,ie,to,Math.abs(Le[0]),r_,Te,We,mr?0:this.viewRotation_);e:if(X){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,pt,"",Tt),Ue=ge[2]+(Le[0]<0?-te:te),et=Sn*ke.height+(.5-Sn)*2*te*Le[1]/Le[0]-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,et,0,0,ge[3],he,!1,dc,!1,Ar);if(F&&F.collides(Bi.declutterBox))break e;J.push([h,n,ke,Bi,1,null,null])}if(It)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,pt,It,""),Ue=ge[2],et=Sn*ke.height-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,et,0,0,ge[3],he,!1,dc,!1,Ar);if(F&&F.collides(Bi.declutterBox))break e;J.push([h,n,ke,Bi,1,null,null])}F&&F.load(J.map(c0));for(var Ce=0,Re=J.length;Ce<Re;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++N;break;case qr.END_GEOMETRY:if(P!==void 0){Ar=jt[1];var Ke=P(Ar,vi);if(Ke)return Ke}++N;break;case qr.FILL:Lr?Pt++:this.fill_(h),++N;break;case qr.MOVE_TO_LINE_TO:for(ve=jt[1],Se=jt[2],Rr=V[ve],Sr=V[ve+1],He=Rr+.5|0,nt=Sr+.5|0,(He!==Ie||nt!==Ne)&&(h.moveTo(Rr,Sr),Ie=He,Ne=nt),ve+=2;ve<Se;ve+=2)Rr=V[ve],Sr=V[ve+1],He=Rr+.5|0,nt=Sr+.5|0,(ve==Se-2||He!==Ie||nt!==Ne)&&(h.lineTo(Rr,Sr),Ie=He,Ne=nt);++N;break;case qr.SET_FILL_STYLE:Ft=jt,this.alignFill_=jt[2],Pt&&(this.fill_(h),Pt=0,Qt&&(h.stroke(),Qt=0)),h.fillStyle=jt[1],++N;break;case qr.SET_STROKE_STYLE:er=jt,Qt&&(h.stroke(),Qt=0),this.setStrokeStyle_(h,jt),++N;break;case qr.STROKE:Lr?Qt++:h.stroke(),++N;break;default:++N;break}}Pt&&this.fill_(h),Qt&&h.stroke()},y.prototype.execute=function(h,n,u,r,s,P){this.viewRotation_=r,this.execute_(h,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(h,n,u,r,s){return this.viewRotation_=u,this.execute_(h,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),p0=s2;var c_=[Fn.POLYGON,Fn.CIRCLE,Fn.LINE_STRING,Fn.IMAGE,Fn.TEXT,Fn.DEFAULT],l2=function(){function y(h,n,u,r,s,P){this.maxExtent_=h,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(h,n){var u=this.getClipCoords(n);h.beginPath(),h.moveTo(u[0],u[1]),h.lineTo(u[2],u[3]),h.lineTo(u[4],u[5]),h.lineTo(u[6],u[7]),h.clip()},y.prototype.createExecutors_=function(h){for(var n in h){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=h[n];for(var s in r){var P=r[s];u[s]=new p0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(h){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=h.length;r<s;++r)if(h[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(h,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,-h[0],-h[1]),V=!this.hitDetectionContext_;V&&(this.hitDetectionContext_=Ja(z,z));var N=this.hitDetectionContext_;N.canvas.width!==z||N.canvas.height!==z?(N.canvas.width=z,N.canvas.height=z):V||N.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),fy(me,h),gl(me,n*(this.renderBuffer_+r),me));var ve=u2(r),Se;function Ue(pt,Tt){for(var It=N.getImageData(0,0,z,z).data,Pt=0,Qt=ve.length;Pt<Qt;Pt++)if(It[ve[Pt]]>0){if(!P||Se!==Fn.IMAGE&&Se!==Fn.TEXT||P.indexOf(pt)!==-1){var Ft=(ve[Pt]-3)/4,er=r-Ft%z,hr=r-(Ft/z|0),kt=s(pt,Tt,er*er+hr*hr);if(kt)return kt}N.clearRect(0,0,z,z);break}}var et=Object.keys(this.executorsByZIndex_).map(Number);et.sort(rh);var Ie,Ne,He,nt,mt;for(Ie=et.length-1;Ie>=0;--Ie){var ht=et[Ie].toString();for(He=this.executorsByZIndex_[ht],Ne=c_.length-1;Ne>=0;--Ne)if(Se=c_[Ne],nt=He[Se],nt!==void 0&&(mt=nt.executeHitDetection(N,F,u,Ue,me),mt))return mt}},y.prototype.getClipCoords=function(h){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,h,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(h,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(h.save(),this.clip(h,u));var V=P||c_,N,me,ve,Se,Ue,et;for(z&&F.reverse(),N=0,me=F.length;N<me;++N){var Ie=F[N].toString();for(Ue=this.executorsByZIndex_[Ie],ve=0,Se=V.length;ve<Se;++ve){var Ne=V[ve];et=Ue[Ne],et!==void 0&&et.execute(h,n,u,r,s,z)}}this.maxExtent_&&h.restore()},y}(),h_={};function u2(y){if(h_[y]!==void 0)return h_[y];for(var h=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)*h+(y+s))*4+3),r>0&&z.push(((y-r)*h+(y+s))*4+3),s>0&&(z.push(((y+r)*h+(y-s))*4+3),r>0&&z.push(((y-r)*h+(y-s))*4+3))}for(var F=[],r=0,V=u.length;r<V;++r)u[r]&&F.push.apply(F,u[r]);return h_[y]=F,F}var p_=l2;var vd={ANIMATING:0,INTERACTING:1};var c2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),h2=function(y){c2(h,y);function h(n,u,r,s,P,z,F){var V=y.call(this)||this;return V.context_=n,V.pixelRatio_=u,V.extent_=r,V.transform_=s,V.viewRotation_=P,V.squaredTolerance_=z,V.userTransform_=F,V.contextFillState_=null,V.contextStrokeState_=null,V.contextTextState_=null,V.fillState_=null,V.strokeState_=null,V.image_=null,V.imageAnchorX_=0,V.imageAnchorY_=0,V.imageHeight_=0,V.imageOpacity_=0,V.imageOriginX_=0,V.imageOriginY_=0,V.imageRotateWithView_=!1,V.imageRotation_=0,V.imageScale_=[0,0],V.imageWidth_=0,V.text_="",V.textOffsetX_=0,V.textOffsetY_=0,V.textRotateWithView_=!1,V.textRotation_=0,V.textScale_=[0,0],V.textFillState_=null,V.textStrokeState_=null,V.textState_=null,V.pixelCoordinates_=[],V.tmpLocalTransform_=za(),V}return h.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_,V=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=V*this.imageOpacity_);var N=this.imageRotation_;this.imageRotateWithView_&&(N+=this.viewRotation_);for(var me=0,ve=P.length;me<ve;me+=2){var Se=P[me]-this.imageAnchorX_,Ue=P[me+1]-this.imageAnchorY_;if(N!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var et=Se+this.imageAnchorX_,Ie=Ue+this.imageAnchorY_;vs(F,et,Ie,1,1,N,-et,-Ie),z.setTransform.apply(z,F),z.translate(et,Ie),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,Ue,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=V)}},h.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 V=P[u]+this.textOffsetX_,N=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,V,N,1,1,F,-V,-N);z.setTransform.apply(z,me),z.translate(V,N),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_,V,N),this.textFillState_&&z.fillText(this.text_,V,N)}}},h.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 V=F.length;P&&(V-=2);for(var N=2;N<V;N+=2)z.lineTo(F[N],F[N+1]);return P&&z.closePath(),r},h.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},h.prototype.drawCircle=function(n){if(!!Ro(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=lx(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)}},h.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},h.prototype.setTransform=function(n){this.transform_=n},h.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Ot.POINT:this.drawPoint(n);break;case Ot.LINE_STRING:this.drawLineString(n);break;case Ot.POLYGON:this.drawPolygon(n);break;case Ot.MULTI_POINT:this.drawMultiPoint(n);break;case Ot.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Ot.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Ot.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Ot.CIRCLE:this.drawCircle(n);break;default:}},h.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Ro(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},h.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},h.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)},h.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)},h.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(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)}}},h.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Ro(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 V=0,N=z.length;V<N;++V)P=this.moveToLineTo_(s,P,z[V],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},h.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(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)}}},h.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(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,V=P.length;F<V;++F){var N=P[F];s=this.drawRings_(r,s,N,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},h.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})},h.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})},h.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:gh;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})},h.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(),V=u.getLineDashOffset(),N=u.getLineJoin(),me=u.getWidth(),ve=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:ep,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ue){return Ue*r.pixelRatio_}),lineDashOffset:(V||hc)*this.pixelRatio_,lineJoin:N!==void 0?N:Cu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:ve!==void 0?ve:pc,strokeStyle:Ts(P||fc)}}},h.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_},h.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(),V=s.getLineDashOffset(),N=s.getLineJoin(),me=s.getWidth(),ve=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:ep,lineDash:F||cc,lineDashOffset:V||hc,lineJoin:N!==void 0?N:Cu,lineWidth:me!==void 0?me:mc,miterLimit:ve!==void 0?ve:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ue=n.getOffsetX(),et=n.getOffsetY(),Ie=n.getRotateWithView(),Ne=n.getRotation(),He=n.getScaleArray(),nt=n.getText(),mt=n.getTextAlign(),ht=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:og,textAlign:mt!==void 0?mt:gh,textBaseline:ht!==void 0?ht:tp},this.text_=nt!==void 0?Array.isArray(nt)?nt.reduce(function(pt,Tt,It){return pt+=It%2?" ":Tt},""):nt:"",this.textOffsetX_=Ue!==void 0?this.pixelRatio_*Ue:0,this.textOffsetY_=et!==void 0?this.pixelRatio_*et:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ne!==void 0?Ne:0,this.textScale_=[this.pixelRatio_*He[0],this.pixelRatio_*He[1]]}},h}(ag),f0=h2;var Mu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var p2=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 h=0;for(var n in this.cache_){var u=this.cache_[n];(h++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(h,n,u){var r=d0(h,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(h,n,u,r){var s=d0(h,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(h){this.maxCacheSize_=h,this.expire()},y}();function d0(y,h,n){var u=n?ig(n):"null";return h+":"+y+":"+u}var f_=new p2;var f2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),d2=function(y){f2(h,y);function h(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 h.prototype.changed=function(){this.dispatchEvent(en.CHANGE)},h.prototype.getExtent=function(){return this.extent},h.prototype.getImage=function(){return jr()},h.prototype.getPixelRatio=function(){return this.pixelRatio_},h.prototype.getResolution=function(){return this.resolution},h.prototype.getState=function(){return this.state},h.prototype.load=function(){jr()},h}(nh),m0=d2;var m2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),sR=function(y){m2(h,y);function h(n,u,r,s,P,z){var F=y.call(this,n,u,r,Zi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=Zi.IDLE,F.imageLoadFunction_=z,F}return h.prototype.getImage=function(){return this.image_},h.prototype.handleImageError_=function(){this.state=Zi.ERROR,this.unlistenImage_(),this.changed()},h.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Tu(this.extent)/this.image_.height),this.state=Zi.LOADED,this.unlistenImage_(),this.changed()},h.prototype.load=function(){(this.state==Zi.IDLE||this.state==Zi.ERROR)&&(this.state=Zi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},h.prototype.setImage=function(n){this.image_=n,this.resolution=Tu(this.extent)/this.image_.height},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(m0);function d_(y,h,n){var u=y,r=!0,s=!1,P=!1,z=[Zp(u,en.LOAD,function(){P=!0,s||h()})];return u.src&&Pv?(s=!0,u.decode().then(function(){r&&h()}).catch(function(F){r&&(P?h():n())})):z.push(Zp(u,en.ERROR,n)),function(){r=!1,z.forEach(Mo)}}var g2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xd=null,y2=function(y){g2(h,y);function h(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 h.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===Zi.LOADED){xd||(xd=Ja(1,1)),xd.drawImage(this.image_,0,0);try{xd.getImageData(0,0,1,1),this.tainted_=!1}catch{xd=null,this.tainted_=!0}}return this.tainted_===!0},h.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(en.CHANGE)},h.prototype.handleImageError_=function(){this.imageState_=Zi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},h.prototype.handleImageLoad_=function(){this.imageState_=Zi.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_()},h.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},h.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},h.prototype.getImageState=function(){return this.imageState_},h.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_},h.prototype.getSize=function(){return this.size_},h.prototype.getSrc=function(){return this.src_},h.prototype.load=function(){if(this.imageState_==Zi.IDLE){this.imageState_=Zi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},h.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==Zi.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=ig(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,V=this.color_[2]/255,N=this.color_[3],me=0,ve=P.length;me<ve;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=V,P[me+3]*=N;r.putImageData(s,0,0)}}},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(nh);function g0(y,h,n,u,r,s){var P=f_.get(h,u,s);return P||(P=new y2(y,h,n,u,r,s),f_.set(h,u,s,P)),P}var _2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),v2=function(y){_2(h,y);function h(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:Mu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Mu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var V=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var N=r.src;En(!(N!==void 0&&V),4),En(!V||V&&u.imgSize_,5),(N===void 0||N.length===0)&&V&&(N=V.src||Pi(V)),En(N!==void 0&&N.length>0,6);var me=r.src!==void 0?Zi.IDLE:Zi.LOADED;return u.color_=r.color!==void 0?Qh(r.color):null,u.iconImage_=g0(V,N,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 h.prototype.clone=function(){var n=this.getScale();return new h({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()})},h.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Mu.FRACTION||this.anchorYUnits_==Mu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Mu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Mu.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]]},h.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},h.prototype.getColor=function(){return this.color_},h.prototype.getImage=function(n){return this.iconImage_.getImage(n)},h.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},h.prototype.getImageSize=function(){return this.iconImage_.getSize()},h.prototype.getImageState=function(){return this.iconImage_.getImageState()},h.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},h.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_},h.prototype.getSrc=function(){return this.iconImage_.getSrc()},h.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},h.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(en.CHANGE,n)},h.prototype.load=function(){this.iconImage_.load()},h.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(en.CHANGE,n)},h}(rg),m_=v2;var Kl=.5;function y0(y,h,n,u,r,s,P){var z=y[0]*Kl,F=y[1]*Kl,V=Ja(z,F);V.imageSmoothingEnabled=!1;for(var N=V.canvas,me=new f0(V,Kl,r,null,P),ve=n.length,Se=Math.floor((256*256*256-1)/ve),Ue={},et=1;et<=ve;++et){var Ie=n[et-1],Ne=Ie.getStyleFunction()||u;if(!!u){var He=Ne(Ie,s);if(!!He){Array.isArray(He)||(He=[He]);for(var nt=et*Se,mt="#"+("000000"+nt.toString(16)).slice(-6),ht=0,pt=He.length;ht<pt;++ht){var Tt=He[ht],It=Tt.getGeometryFunction()(Ie);if(!(!It||!Ro(r,It.getExtent()))){var Pt=Tt.clone(),Qt=Pt.getFill();Qt&&Qt.setColor(mt);var Ft=Pt.getStroke();Ft&&(Ft.setColor(mt),Ft.setLineDash(null)),Pt.setText(void 0);var er=Tt.getImage();if(er&&er.getOpacity()!==0){var hr=er.getImageSize();if(!hr)continue;var kt=Ja(hr[0],hr[1],void 0,{alpha:!1}),mr=kt.canvas;kt.fillStyle=mt,kt.fillRect(0,0,mr.width,mr.height),Pt.setImage(new m_({img:mr,imgSize:hr,anchor:er.getAnchor(),anchorXUnits:Mu.PIXELS,anchorYUnits:Mu.PIXELS,offset:er.getOrigin(),opacity:1,size:er.getSize(),scale:er.getScale(),rotation:er.getRotation(),rotateWithView:er.getRotateWithView()}))}var vr=Pt.getZIndex()||0,Lr=Ue[vr];Lr||(Lr={},Ue[vr]=Lr,Lr[Ot.POLYGON]=[],Lr[Ot.CIRCLE]=[],Lr[Ot.LINE_STRING]=[],Lr[Ot.POINT]=[]),Lr[It.getType().replace("Multi","")].push(It,Pt)}}}}}for(var Ar=Object.keys(Ue).map(Number).sort(rh),et=0,Rr=Ar.length;et<Rr;++et){var Lr=Ue[Ar[et]];for(var Sr in Lr)for(var vi=Lr[Sr],ht=0,pt=vi.length;ht<pt;ht+=2){me.setStyle(vi[ht+1]);for(var jt=0,ei=h.length;jt<ei;++jt)me.setTransform(h[jt]),me.drawGeometry(vi[ht])}}return V.getImageData(0,0,N.width,N.height)}function _0(y,h,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*Kl),s=Math.floor(Math.round(y[1])*Kl),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],V=n.data[P+2],N=V+256*(F+256*z),me=Math.floor((256*256*256-1)/h.length);N&&N%me===0&&u.push(h[N/me-1])}return u}var x2=.5,v0={Point:C2,LineString:T2,Polygon:P2,MultiPoint:A2,MultiLineString:S2,MultiPolygon:I2,GeometryCollection:E2,Circle:b2};function x0(y,h){return parseInt(Pi(y),10)-parseInt(Pi(h),10)}function b0(y,h){var n=sg(y,h);return n*n}function sg(y,h){return x2*y/h}function b2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Fn.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}function g_(y,h,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var V=F.getImageState();V==Zi.LOADED||V==Zi.ERROR?F.unlistenImageChange(r):(V==Zi.IDLE&&F.load(),V=F.getImageState(),F.listenImageChange(r),z=!0)}return w2(y,h,n,u,s,P),z}function w2(y,h,n,u,r,s){var P=n.getGeometryFunction()(h);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)w0(y,z,n,h);else{var V=v0[z.getType()];V(y,z,n,h,s)}}}function w0(y,h,n,u){if(h.getType()==Ot.GEOMETRY_COLLECTION){for(var r=h.getGeometries(),s=0,P=r.length;s<P;++s)w0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),Fn.DEFAULT);z.drawCustom(h,u,n.getRenderer(),n.getHitDetectionRenderer())}function E2(y,h,n,u,r){var s=h.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=v0[s[P].getType()];F(y,s[P],n,u,r)}}function T2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Fn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function S2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Fn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function I2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),Fn.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}function C2(y,h,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()!=Zi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Fn.IMAGE);F.setImageStyle(s,z),F.drawPoint(h,u)}if(P&&P.getText()){var V=y.getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(P,z),V.drawText(h,u)}}function A2(y,h,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()!=Zi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Fn.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(h,u)}if(P&&P.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(P,z),V.drawText(h,u)}}function P2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Fn.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}var M2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),k2=function(y){M2(h,y);function h(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 h.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,V=P.projection,N=P.rotation,me=V.getExtent(),ve=this.getLayer().getSource(),Se=u.pixelRatio,Ue=u.viewHints,et=!(Ue[vd.ANIMATING]||Ue[vd.INTERACTING]),Ie=this.context,Ne=Math.round(u.size[0]*Se),He=Math.round(u.size[1]*Se),nt=ve.getWrapX()&&V.canWrapX(),mt=nt?bs(me):null,ht=nt?Math.ceil((s[2]-me[2])/mt)+1:1,pt=nt?Math.floor((s[0]-me[0])/mt):0;do{var Tt=this.getRenderTransform(z,F,N,Se,Ne,He,pt*mt);n.execute(Ie,1,Tt,N,et,void 0,r)}while(++pt<ht)},h.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},h.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=py(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,V=this.replayGroup_,N=this.declutterExecutorGroup;if((!V||V.isEmpty())&&(!N||N.isEmpty()))return null;var me=Math.round(n.size[0]*r),ve=Math.round(n.size[1]*r);F.width!=me||F.height!=ve?(F.width=me,F.height=ve,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,ve),this.preRender(z,n);var Se=n.viewState,Ue=Se.projection,et=!1,Ie=!0;if(s.extent&&this.clipping){var Ne=ed(s.extent,Ue);Ie=Ro(Ne,n.extent),et=Ie&&!lc(Ne,n.extent),et&&this.clipUnrotated(z,n,Ne)}Ie&&this.renderWorlds(V,n),et&&z.restore(),this.postRender(z,n);var He=Gx(s.opacity),nt=this.container;return He!==nt.style.opacity&&(nt.style.opacity=He),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},h.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_,V=this.wrappedRenderedExtent_,N=this.getLayer(),me=[],ve=r[0]*Kl,Se=r[1]*Kl;me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,0).slice());var Ue=N.getSource(),et=F.getExtent();if(Ue.getWrapX()&&F.canWrapX()&&!lc(et,V)){for(var Ie=V[0],Ne=bs(et),He=0,nt=void 0;Ie<et[0];)--He,nt=Ne*He,me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,nt).slice()),Ie+=Ne;for(He=0,Ie=V[2];Ie>et[2];)++He,nt=Ne*He,me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,nt).slice()),Ie-=Ne}this.hitDetectionImageData_=y0(r,me,this.renderedFeatures_,N.getStyleFunction(),V,P,z)}u(_0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},h.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,V=u.viewState.rotation,N=this.getLayer(),me={},ve=function(et,Ie,Ne){var He=Pi(et),nt=me[He];if(nt){if(nt!==!0&&Ne<nt.distanceSq){if(Ne===0)return me[He]=!0,P.splice(P.lastIndexOf(nt),1),s(et,N,Ie);nt.geometry=Ie,nt.distanceSq=Ne}}else{if(Ne===0)return me[He]=!0,s(et,N,Ie);P.push(me[He]={feature:et,layer:N,geometry:Ie,distanceSq:Ne,callback:s})}},Se,Ue=[this.replayGroup_];return this.declutterExecutorGroup&&Ue.push(this.declutterExecutorGroup),Ue.some(function(et){return Se=et.forEachFeatureAtCoordinate(n,F,V,r,ve,et===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},h.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},h.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},h.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[vd.ANIMATING],P=n.viewHints[vd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var V=n.extent,N=n.viewState,me=N.projection,ve=N.resolution,Se=n.pixelRatio,Ue=u.getRevision(),et=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=x0);var Ne=N.center.slice(),He=gl(V,et*ve),nt=He.slice(),mt=[He.slice()],ht=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!lc(ht,n.extent)){var pt=bs(ht),Tt=Math.max(bs(He)/2,pt);He[0]=ht[0]-Tt,He[2]=ht[2]+Tt,Qv(Ne,me);var It=Gv(mt[0],me);It[0]<ht[0]&&It[2]<ht[2]?mt.push([It[0]+pt,It[1],It[2]+pt,It[3]]):It[0]>ht[0]&&It[2]>ht[2]&&mt.push([It[0]-pt,It[1],It[2]-pt,It[3]])}if(!this.dirty_&&this.renderedResolution_==ve&&this.renderedRevision_==Ue&&this.renderedRenderOrder_==Ie&&lc(this.wrappedRenderedExtent_,He))return _s(this.renderedExtent_,nt)||(this.hitDetectionImageData_=null,this.renderedExtent_=nt),this.renderedCenter_=Ne,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Pt=new u_(sg(ve,Se),He,ve,Se),Qt;this.getLayer().getDeclutter()&&(Qt=new u_(sg(ve,Se),He,ve,Se));var Ft=uh(),er;if(Ft){for(var hr=0,kt=mt.length;hr<kt;++hr){var mr=mt[hr],vr=ef(mr,me);r.loadFeatures(vr,ix(ve,me),Ft)}er=Vm(Ft,me)}else for(var hr=0,kt=mt.length;hr<kt;++hr)r.loadFeatures(mt[hr],ve,me);var Lr=b0(ve,Se),Ar=function(ei){var bi,ai=ei.getStyleFunction()||u.getStyleFunction();if(ai&&(bi=ai(ei,ve)),bi){var zi=this.renderFeature(ei,Lr,bi,Pt,er,Qt);this.dirty_=this.dirty_||zi}}.bind(this),Rr=ef(He,me),Sr=r.getFeaturesInExtent(Rr);Ie&&Sr.sort(Ie);for(var hr=0,kt=Sr.length;hr<kt;++hr)Ar(Sr[hr]);this.renderedFeatures_=Sr;var vi=Pt.finish(),jt=new p_(He,ve,Se,r.getOverlaps(),vi,u.getRenderBuffer());return Qt&&(this.declutterExecutorGroup=new p_(He,ve,Se,r.getOverlaps(),Qt.finish(),u.getRenderBuffer())),this.renderedResolution_=ve,this.renderedRevision_=Ue,this.renderedRenderOrder_=Ie,this.renderedExtent_=nt,this.wrappedRenderedExtent_=He,this.renderedCenter_=Ne,this.renderedProjection_=me,this.replayGroup_=jt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},h.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var V=0,N=r.length;V<N;++V)F=g_(s,n,r[V],u,this.boundHandleStyleImageChange_,P,z)||F;else F=g_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},h}(l0),E0=k2;var L2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),R2=function(y){L2(h,y);function h(n){return y.call(this,n)||this}return h.prototype.createRenderer=function(){return new E0(this)},h}(t0),rp=R2;var T0=jp(a_(),1);var z2=function(){function y(h){this.rbush_=new T0.default(h),this.items_={}}return y.prototype.insert=function(h,n){var u={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3],value:n};this.rbush_.insert(u),this.items_[Pi(n)]=u},y.prototype.load=function(h,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=h[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(h){var n=Pi(h),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(h,n){var u=this.items_[Pi(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Fm(r,h)||(this.remove(n),this.insert(h,n))},y.prototype.getAll=function(){var h=this.rbush_.all();return h.map(function(n){return n.value})},y.prototype.getInExtent=function(h){var n={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(h){return this.forEach_(this.getAll(),h)},y.prototype.forEachInExtent=function(h,n){return this.forEach_(this.getInExtent(h),n)},y.prototype.forEach_=function(h,n){for(var u,r=0,s=h.length;r<s;r++)if(u=n(h[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(h){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,h)},y.prototype.concat=function(h){this.rbush_.load(h.rbush_.all());for(var n in h.items_)this.items_[n]=h.items_[n]},y}(),bd=z2;var D2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(h,y);function h(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=S0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Iu.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 h.prototype.getAttributions=function(){return this.attributions_},h.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},h.prototype.getProjection=function(){return this.projection},h.prototype.getResolutions=function(){return jr()},h.prototype.getView=function(){return this.viewPromise_},h.prototype.getState=function(){return this.state_},h.prototype.getWrapX=function(){return this.wrapX_},h.prototype.getInterpolate=function(){return this.interpolate_},h.prototype.refresh=function(){this.changed()},h.prototype.setAttributions=function(n){this.attributions_=S0(n),this.changed()},h.prototype.setState=function(n){this.state_=n,this.changed()},h}(ko);function S0(y){return y?Array.isArray(y)?function(h){return y}:typeof y=="function"?y:function(h){return[y]}:null}var uf=O2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function I0(y,h){return[[-1/0,-1/0,1/0,1/0]]}var vh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var F2=!1;function B2(y,h,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),h.getType()==vh.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=F2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var V=h.getType(),N=void 0;V==vh.JSON||V==vh.TEXT?N=z.responseText:V==vh.XML?(N=z.responseXML,N||(N=new DOMParser().parseFromString(z.responseText,"application/xml"))):V==vh.ARRAY_BUFFER&&(N=z.response),N?s(h.readFeatures(N,{extent:n,featureProjection:r}),h.readProjection(N)):P()}else P()},z.onerror=P,z.send()}function y_(y,h){return function(n,u,r,s,P){var z=this;B2(y,h,n,u,r,function(F,V){z.addFeatures(F),s!==void 0&&s(F)},P||Zh)}}var C0=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xh=function(y){C0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return h}(ln);var U2=function(y){C0(h,y);function h(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Iu.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=Zh,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&&(En(u.format_,7),u.loader_=y_(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:I0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new bd:null,u.loadedExtentsRtree_=new bd,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 dh(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return h.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},h.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 xh(Qa.ADDFEATURE,n))},h.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[lo(u,en.CHANGE,this.handleFeatureChange_,this),lo(u,qp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},h.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&&(En(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},h.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},h.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],V=Pi(F);this.addToIndex_(V,F)&&r.push(F)}for(var P=0,N=r.length;P<N;P++){var F=r[P],V=Pi(F);this.setupChangeEvents_(V,F);var me=F.getGeometry();if(me){var ve=me.getExtent();u.push(ve),s.push(F)}else this.nullGeometryFeatures_[V]=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 xh(Qa.ADDFEATURE,r[P]))},h.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(Es.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(Es.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},h.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Mo)}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 xh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},h.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},h.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)})},h.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},h.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}})},h.prototype.getFeaturesCollection=function(){return this.featuresCollection_},h.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,Am(this.nullGeometryFeatures_))),n},h.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},h.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},h.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,V=[-1/0,-1/0,1/0,1/0],N=u||Cm;return this.featuresRtree_.forEachInExtent(V,function(me){if(N(me)){var ve=me.getGeometry(),Se=F;if(F=ve.closestPointXY(r,s,z,F),F<Se){P=me;var Ue=Math.sqrt(F);V[0]=r-Ue,V[1]=s-Ue,V[2]=r+Ue,V[3]=s+Ue}}}),P},h.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},h.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},h.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},h.prototype.getFormat=function(){return this.format_},h.prototype.getOverlaps=function(){return this.overlaps_},h.prototype.getUrl=function(){return this.url_},h.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 xh(Qa.CHANGEFEATURE,u))},h.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Pi(n)in this.uidIndex_},h.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},h.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,ve){var Se=P[me],Ue=s.forEachInExtent(Se,function(et){return lc(et.extent,Se)});Ue||(++F.loadingExtentsCount_,F.dispatchEvent(new xh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(et){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADEND,void 0,et))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,V=0,N=P.length;V<N;++V)z(V,N);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},h.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},h.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Fm(s.extent,n))return r=s,!0}),r&&u.remove(r)},h.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()}},h.prototype.removeFeatureInternal=function(n){var u=Pi(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Mo),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new xh(Qa.REMOVEFEATURE,n)),n}},h.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},h.prototype.setLoader=function(n){this.loader_=n},h.prototype.setUrl=function(n){En(this.format_,7),this.url_=n,this.setLoader(y_(n,this.format_))},h}(uf),ip=U2;var A0=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),cf=function(y){A0(h,y);function h(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return h}(ln);var __={LAYERS:"layers"},N2=function(y){A0(h,y);function h(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(__.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new dh(P.slice(),{unique:!0}):En(typeof P.getArray=="function",43):P=new dh(void 0,{unique:!0}),u.setLayers(P),u}return h.prototype.handleLayerChange_=function(){this.changed()},h.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Mo),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(lo(n,Es.ADD,this.handleLayersAdd_,this),lo(n,Es.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Mo);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 cf("addlayer",z))}this.changed()},h.prototype.registerLayerListeners_=function(n){var u=[lo(n,qp.PROPERTYCHANGE,this.handleLayerChange_,this),lo(n,en.CHANGE,this.handleLayerChange_,this)];n instanceof h&&u.push(lo(n,"addlayer",this.handleLayerGroupAdd_,this),lo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Pi(n)]=u},h.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new cf("addlayer",n.layer))},h.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new cf("removelayer",n.layer))},h.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new cf("addlayer",u)),this.changed()},h.prototype.handleLayersRemove_=function(n){var u=n.element,r=Pi(u);this.listenerKeys_[r].forEach(Mo),delete this.listenerKeys_[r],this.dispatchEvent(new cf("removelayer",u)),this.changed()},h.prototype.getLayers=function(){return this.get(__.LAYERS)},h.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 cf("removelayer",r[s]));this.set(__.LAYERS,n)},h.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},h.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(N){N.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 V=u[z];V.opacity*=s.opacity,V.visible=V.visible&&s.visible,V.maxResolution=Math.min(V.maxResolution,s.maxResolution),V.minResolution=Math.max(V.minResolution,s.minResolution),V.minZoom=Math.max(V.minZoom,s.minZoom),V.maxZoom=Math.min(V.maxZoom,s.maxZoom),s.extent!==void 0&&(V.extent!==void 0?V.extent=Bv(V.extent,s.extent):V.extent=s.extent),V.zIndex===void 0&&(V.zIndex=P)}return u},h.prototype.getSourceState=function(){return Iu.READY},h}(Qm),v_=N2;var na={SINGLECLICK:"singleclick",CLICK:en.CLICK,DBLCLICK:en.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var x_={ACTIVE:"active"};var V2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),G2=function(y){V2(h,y);function h(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 h.prototype.getActive=function(){return this.get(x_.ACTIVE)},h.prototype.getMap=function(){return this.map_},h.prototype.handleEvent=function(n){return!0},h.prototype.setActive=function(n){this.set(x_.ACTIVE,n)},h.prototype.setMap=function(n){this.map_=n},h}(ko);var P0=G2;var j2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),q2=function(y){j2(h,y);function h(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 h.prototype.getPointerCount=function(){return this.targetPointers.length},h.prototype.handleDownEvent=function(n){return!1},h.prototype.handleDragEvent=function(n){},h.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},h.prototype.handleMoveEvent=function(n){},h.prototype.handleUpEvent=function(n){return!1},h.prototype.stopDown=function(n){return n},h.prototype.updateTrackedPointers_=function(n){if(Z2(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=Am(this.trackedPointers_)}},h}(P0);function Z2(y){var h=y.type;return h===na.POINTERDOWN||h===na.POINTERDRAG||h===na.POINTERUP}var M0=q2;var k0=function(y){var h=y.originalEvent;return h.altKey&&!(h.metaKey||h.ctrlKey)&&!h.shiftKey};var L0=Cm,R0=function(y){return y.type==na.CLICK};var z0=function(y){return y.type==na.SINGLECLICK};var D0=function(y){var h=y.originalEvent;return En(h!==void 0,56),h.isPrimary&&h.button===0};var N0=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O0=0,wd=1,F0=[0,0,0,0],hf=[],b_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},w_=function(y){N0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return h}(ln);var X2=function(y){N0(h,y);function h(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:D0,u.defaultDeleteCondition_=function(s){return k0(s)&&z0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:L0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new bd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new rp({source:new ip({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 dh(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(Es.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(Es.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return h.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(en.CHANGE,this.boundHandleFeatureChange_)},h.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new dh;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,V=z.length;F<V;++F){var N=z[F].feature;N&&r.indexOf(N)===-1&&this.featuresBeingModified_.push(N)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new w_(b_.MODIFYSTART,this.featuresBeingModified_,n))}},h.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(en.CHANGE,this.boundHandleFeatureChange_)},h.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)}},h.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},h.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},h.prototype.getOverlay=function(){return this.overlay_},h.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},h.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},h.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},h.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},h.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},h.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},h.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)}},h.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(Eu(z),F)}},h.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,V=z.length-1;F<V;++F){var N=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:N};this.rBush_.insert(Eu(N),me)}},h.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,V=z.length-1;F<V;++F){var N=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:N};this.rBush_.insert(Eu(N),me)}},h.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,V=z.length;F<V;++F)for(var N=z[F],me=0,ve=N.length-1;me<ve;++me){var Se=N.slice(me,me+2),Ue={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(Eu(Se),Ue)}},h.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:O0,segment:[r,r]},P={feature:n,geometry:u,index:wd,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Kp(r),s);var F=u,V=uh();if(V&&this.getMap()){var N=this.getMap().getView().getProjection();F=F.clone().transform(V,N),F=Dy(F).transform(N,V)}this.rBush_.insert(F.getExtent(),P)},h.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)}},h.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new uc(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},h.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},h.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],V=F[0],N=V.feature;r.indexOf(N)===-1&&r.push(N);var me=V.geometry;s.indexOf(me)===-1&&s.push(me);for(var ve=V.depth,Se=void 0,Ue=V.segment,et=F[1];u.length<me.getStride();)u.push(Ue[et][u.length]);switch(me.getType()){case Ot.POINT:Se=u,Ue[0]=u,Ue[1]=u;break;case Ot.MULTI_POINT:Se=me.getCoordinates(),Se[V.index]=u,Ue[0]=u,Ue[1]=u;break;case Ot.LINE_STRING:Se=me.getCoordinates(),Se[V.index+et]=u,Ue[et]=u;break;case Ot.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.POLYGON:Se=me.getCoordinates(),Se[ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.MULTI_POLYGON:Se=me.getCoordinates(),Se[ve[1]][ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.CIRCLE:if(Ue[0]=u,Ue[1]=u,V.index===O0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ne=Ey(Xl(me.getCenter(),Ie),Xl(u,Ie)),He=uh();if(He){var nt=me.clone().transform(He,Ie);nt.setRadius(Ne),Ne=nt.transform(Ie,He).getRadius()}me.setRadius(Ne),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},h.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=Eu([z]),V=this.rBush_.getInExtent(F),N={};V.sort(W2);for(var me=0,ve=V.length;me<ve;++me){var Se=V[me],Ue=Se.segment,et=Pi(Se.geometry),Ie=Se.depth;if(Ie&&(et+="-"+Ie.join("-")),N[et]||(N[et]=new Array(2)),Se.geometry.getType()===Ot.CIRCLE&&Se.index===wd){var Ne=U0(u,Se,s);Su(Ne,z)&&!N[et][0]&&(this.dragSegments_.push([Se,0]),N[et][0]=Se);continue}if(Su(Ue[0],z)&&!N[et][0]){this.dragSegments_.push([Se,0]),N[et][0]=Se;continue}if(Su(Ue[1],z)&&!N[et][1]){if((Se.geometry.getType()===Ot.LINE_STRING||Se.geometry.getType()===Ot.MULTI_LINE_STRING)&&N[et][0]&&N[et][0].index===0)continue;this.dragSegments_.push([Se,1]),N[et][1]=Se;continue}Pi(Ue)in this.vertexSegments_&&!N[et][0]&&!N[et][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var He=P.length-1;He>=0;--He)this.insertVertex_(P[He],z)}return!!this.vertexFeature_},h.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()===Ot.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(Kp(P),z);var V=s,N=uh();if(N){var me=n.map.getView().getProjection();V=V.clone().transform(N,me),V=Dy(V).transform(me,N)}this.rBush_.update(V.getExtent(),F)}else this.rBush_.update(Eu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},h.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},h.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(kt,mr){return B0(P,kt,z)-B0(P,mr,z)},V,N;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(kt){return kt===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(kt,mr,vr){if(vr=vr||kt.getGeometry(),vr.getType()===Ot.POINT&&vv(s.features_.getArray(),kt)){N=vr;var Lr=vr.getFlatCoordinates().slice(0,2);V=[{feature:kt,geometry:vr,segment:[Lr,Lr]}]}return!0},{layerFilter:me})}if(!V){var ve=ed(Kp(P,F0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ue=ef(gl(ve,Se,F0),z);V=this.rBush_.getInExtent(Ue)}if(V&&V.length>0){var et=V.sort(F)[0],Ie=et.segment,Ne=U0(P,et,z),He=u.getPixelFromCoordinate(Ne),nt=Ey(n,He);if(N||nt<=this.pixelTolerance_){var mt={};if(mt[Pi(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ne[0]-P[0],this.delta_[1]=Ne[1]-P[1]),et.geometry.getType()===Ot.CIRCLE&&et.index===wd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ne,[et.feature],[et.geometry]);else{var ht=u.getPixelFromCoordinate(Ie[0]),pt=u.getPixelFromCoordinate(Ie[1]),Tt=Qp(He,ht),It=Qp(He,pt);nt=Math.sqrt(Math.min(Tt,It)),this.snappedToVertex_=nt<=this.pixelTolerance_,this.snappedToVertex_&&(Ne=Tt>It?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ne,[et.feature],[et.geometry]);var Pt={};Pt[Pi(et.geometry)]=!0;for(var Qt=1,Ft=V.length;Qt<Ft;++Qt){var er=V[Qt].segment;if(Su(Ie[0],er[0])&&Su(Ie[1],er[1])||Su(Ie[0],er[1])&&Su(Ie[1],er[0])){var hr=Pi(V[Qt].geometry);hr in Pt||(Pt[hr]=!0,mt[Pi(er)]=!0)}else break}}this.vertexSegments_=mt;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},h.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,V;u.length<P.getStride();)u.push(0);switch(P.getType()){case Ot.MULTI_LINE_STRING:V=P.getCoordinates(),V[z[0]].splice(F+1,0,u);break;case Ot.POLYGON:V=P.getCoordinates(),V[z[0]].splice(F+1,0,u);break;case Ot.MULTI_POLYGON:V=P.getCoordinates(),V[z[1]][z[0]].splice(F+1,0,u);break;case Ot.LINE_STRING:V=P.getCoordinates(),V.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,V);var N=this.rBush_;N.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};N.insert(Eu(me.segment),me),this.dragSegments_.push([me,1]);var ve={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};N.insert(Eu(ve.segment),ve),this.dragSegments_.push([ve,0]),this.ignoreNextSingleClick_=!0},h.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 w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},h.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,V,N,me,ve,Se,Ue,et;for(V=n.length-1;V>=0;--V)z=n[V],Ue=z[0],et=Pi(Ue.feature),Ue.depth&&(et+="-"+Ue.depth.join("-")),et in u||(u[et]={}),z[1]===0?(u[et].right=Ue,u[et].index=Ue.index):z[1]==1&&(u[et].left=Ue,u[et].index=Ue.index+1);for(et in u){switch(Se=u[et].right,me=u[et].left,N=u[et].index,ve=N-1,me!==void 0?Ue=me:Ue=Se,ve<0&&(ve=0),F=Ue.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Ot.MULTI_LINE_STRING:P[Ue.depth[0]].length>2&&(P[Ue.depth[0]].splice(N,1),r=!0);break;case Ot.LINE_STRING:P.length>2&&(P.splice(N,1),r=!0);break;case Ot.MULTI_POLYGON:s=s[Ue.depth[1]];case Ot.POLYGON:s=s[Ue.depth[0]],s.length>4&&(N==s.length-1&&(N=0),s.splice(N,1),r=!0,N===0&&(s.pop(),s.push(s[0]),ve=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ne={depth:Ue.depth,feature:Ue.feature,geometry:Ue.geometry,index:ve,segment:Ie};this.rBush_.insert(Eu(Ne.segment),Ne)}this.updateSegmentIndices_(F,N,Ue.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},h.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},h.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)})},h}(M0);function W2(y,h){return y.index-h.index}function B0(y,h,n){var u=h.geometry;if(u.getType()===Ot.CIRCLE){var r=u;if(h.index===wd){var s=uh();s&&(r=r.clone().transform(s,n));var P=Qp(r.getCenter(),Xl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Xl(y,n);return hf[0]=Xl(h.segment[0],n),hf[1]=Xl(h.segment[1],n),Jv(F,hf)}function U0(y,h,n){var u=h.geometry;if(u.getType()===Ot.CIRCLE&&h.index===wd){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Iy(r.getClosestPoint(Xl(y,n)),n)}var P=Xl(y,n);return hf[0]=Xl(h.segment[0],n),hf[1]=Xl(h.segment[1],n),Iy(wy(P,hf),n)}function $2(){var y=Yx();return function(h,n){return y[Ot.POINT]}}var E_=X2;var K2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(h,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(h);n.extent&&r&&r.getUnits()===sc.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(h){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},h)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(h,n){return jr()},y.prototype.readFeatures=function(h,n){return jr()},y.prototype.readGeometry=function(h,n){return jr()},y.prototype.readProjection=function(h){return jr()},y.prototype.writeFeature=function(h,n){return jr()},y.prototype.writeFeatures=function(h,n){return jr()},y.prototype.writeGeometry=function(h,n){return jr()},y}(),V0=K2;function T_(y,h,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!rx(u,r)?s=(h?y.clone():y).transform(h?u:r,h?r:u):s=y,h&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var V=0,N=F.length;V<N;++V)F[V]=Math.round(F[V]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var H2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y2=function(y){H2(h,y);function h(){return y.call(this)||this}return h.prototype.getType=function(){return vh.JSON},h.prototype.readFeature=function(n,u){return this.readFeatureFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readFeatureFromObject=function(n,u){return jr()},h.prototype.readFeaturesFromObject=function(n,u){return jr()},h.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readGeometryFromObject=function(n,u){return jr()},h.prototype.readProjection=function(n){return this.readProjectionFromObject(lg(n))},h.prototype.readProjectionFromObject=function(n){return jr()},h.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},h.prototype.writeFeatureObject=function(n,u){return jr()},h.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},h.prototype.writeFeaturesObject=function(n,u){return jr()},h.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},h.prototype.writeGeometryObject=function(n,u){return jr()},h}(V0);function lg(y){if(typeof y=="string"){var h=JSON.parse(y);return h||null}else return y!==null?y:null}var G0=Y2;var J2=function(){var y=function(h,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(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(h,y);function h(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 h.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=S_(r.geometry,u),P=new uc;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},h.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,V=z.length;F<V;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},h.prototype.readGeometryFromObject=function(n,u){return S_(n,u)},h.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):En(!1,36):r=this.dataProjection,r},h.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=I_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},h.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}},h.prototype.writeGeometryObject=function(n,u){return I_(n,this.adaptOptions(u))},h}(G0);function S_(y,h){if(!y)return null;var n;switch(y.type){case Ot.POINT:{n=tE(y);break}case Ot.LINE_STRING:{n=rE(y);break}case Ot.POLYGON:{n=aE(y);break}case Ot.MULTI_POINT:{n=nE(y);break}case Ot.MULTI_LINE_STRING:{n=iE(y);break}case Ot.MULTI_POLYGON:{n=oE(y);break}case Ot.GEOMETRY_COLLECTION:{n=eE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return T_(n,!1,h)}function eE(y,h){var n=y.geometries.map(function(u){return S_(u,h)});return new px(n)}function tE(y){return new _a(y.coordinates)}function rE(y){return new Wl(y.coordinates)}function iE(y){return new Tx(y.coordinates)}function nE(y){return new Km(y.coordinates)}function oE(y){return new kx(y.coordinates)}function aE(y){return new cd(y.coordinates)}function I_(y,h){y=T_(y,!0,h);var n=y.getType(),u;switch(n){case Ot.POINT:{u=pE(y,h);break}case Ot.LINE_STRING:{u=lE(y,h);break}case Ot.POLYGON:{u=fE(y,h);break}case Ot.MULTI_POINT:{u=cE(y,h);break}case Ot.MULTI_LINE_STRING:{u=uE(y,h);break}case Ot.MULTI_POLYGON:{u=hE(y,h);break}case Ot.GEOMETRY_COLLECTION:{u=sE(y,h);break}case Ot.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function sE(y,h){var n=y.getGeometriesArray().map(function(u){var r=Ra({},h);return delete r.featureProjection,I_(u,r)});return{type:"GeometryCollection",geometries:n}}function lE(y,h){return{type:"LineString",coordinates:y.getCoordinates()}}function uE(y,h){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function cE(y,h){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function hE(y,h){var n;return h&&(n=h.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function pE(y,h){return{type:"Point",coordinates:y.getCoordinates()}}function fE(y,h){var n;return h&&(n=h.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=Q2;var ug,dE=new Uint8Array(16);function C_(){if(!ug&&(ug=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ug))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ug(dE)}var xa=[];for(let y=0;y<256;++y)xa.push((y+256).toString(16).slice(1));function j0(y,h=0){return(xa[y[h+0]]+xa[y[h+1]]+xa[y[h+2]]+xa[y[h+3]]+"-"+xa[y[h+4]]+xa[y[h+5]]+"-"+xa[y[h+6]]+xa[y[h+7]]+"-"+xa[y[h+8]]+xa[y[h+9]]+"-"+xa[y[h+10]]+xa[y[h+11]]+xa[y[h+12]]+xa[y[h+13]]+xa[y[h+14]]+xa[y[h+15]]).toLowerCase()}var mE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),A_={randomUUID:mE};function gE(y,h,n){if(A_.randomUUID&&!h&&!y)return A_.randomUUID();y=y||{};let u=y.random||(y.rng||C_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,h){n=n||0;for(let r=0;r<16;++r)h[n+r]=u[r];return h}return j0(u)}var P_=gE;var np=class extends ko{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 V=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",V||[])}},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(V=>V.visible)&&this.children.forEach(V=>{V.visible=!0}),this.parent&&this.group){let V=this.parent;for(;V.parent;)V=V.parent;let N=new ln("change:visible:group");N.target=this,V.dispatchEvent(N)}}else this.visible||(this.children&&this.children.forEach(V=>{V.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(V=>V.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(V=>{V.parent=void 0}),Array.isArray(F)&&F.forEach(V=>{V.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 $f(this)}};function yE(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||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new ln("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new ln("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var cg=yE;var Ed=class extends cg(np){constructor(n){super(n);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?.setVisible(this.visible),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 Ed({...this.options,...n})}},Is=Ed;var q0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),_E=new $l({stroke:new va({color:[0,0,0,1],width:5})}),vE=new $l({image:q0,stroke:new va({color:[255,0,0,1],width:3})}),xE=new $l({image:q0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),bE=(y,h)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=h<=n&&h>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[_E,vE]:[xE]},Td=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new rp({source:new ip,style:n.style||bE})}clone(n){return new Td({...this.options,...n})}},hg=Td;var wE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,Z0=/^([\d.]+),([\d.]+)$/,X0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,pg="stop-fetch",W0=y=>{let h=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&h.push(...u)}),h},Sd=class extends of{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 qf({...n}),this.routingLayer=n.routingLayer||new hg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new ln("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 ln("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new ln("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new ln("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new ln("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[pg]?.abort(),this.abortControllers[pg]=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[pg]);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[pg])),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 V=this.segments.reduce((N,me)=>{let ve=me.get("trg");return N.find(Se=>Se[0]===ve[0]&&Se[1]===ve[1])?N:[...N,ve]},[]);this.segments=V.map(N=>{let me=this.segments.filter(Se=>{let Ue=Se.get("trg");return Ue[0]===N[0]&&Ue[1]===N[1]}),ve=W0(me);return new uc({geometry:new Wl(ve)})})}let z=W0(this.segments),F=new uc({geometry:new Wl(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 ln("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new uc;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||X0.test(n)){let N,me;return this.useRawViaPoints?[,N,,me]=X0.exec(n)||[]:[N,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${N}?key=${this.stopsApiKey}`,{signal:r.signal}).then(ve=>ve.json()).then(ve=>{let{coordinates:Se}=ve.features[0].geometry;return this.cacheStationData[n]=uo(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(uo(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(ve=>{ve.name!=="AbortError"&&(this.dispatchEvent(new ln("error")),this.onRouteError(ve,this),this.loading=!1)})}if(this.useRawViaPoints&&Z0.test(n)){let[N,me]=Z0.exec(n)||[],ve=uo([parseFloat(me),parseFloat(N)],this.map?.getView().getProjection());return s.setGeometry(new _a(ve)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,V]=wE.exec(n)||[];if(F&&z){let N=uo([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",V),s.setGeometry(new _a(N)),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(N=>N.json()).then(N=>{let{coordinates:me}=N.features[0].geometry;return this.cacheStationData[n]=uo(me),s.set("viaPointTrack",V),s.setGeometry(new _a(uo(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(N=>(this.dispatchEvent(new ln("error")),this.onRouteError(N,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()==="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()==="LineString");if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=gl(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()==="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 E_({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()==="Point"&&s.get("index"));return R0(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=Sd.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(){}},$0=Sd;var M_=class extends of{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 Zf(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")}},K0=M_;var k_=class extends K0{onSuggestionClick(h){let n=uo(h.geometry.coordinates);this.map.getView().setCenter(n)}},H0=k_;var J0=jp(Y0());var z_=class extends Is{constructor(n){super(n);this.olLayer=new Jh({source:new uf({}),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:Xh(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 ln("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=ac(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}},fg=z_;var op=class extends fg{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=ac(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 rf(this)}getMapboxMapClass(){return J0.Map}clone(n){return new op({...this.options,...n})}};var t1=jp(e1());var ap=class extends fg{getOlLayerRender(){return tf(this)}getMapboxMapClass(){return t1.Map}clone(n){return new ap({...this.options,...n})}};var Id=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 V=0;V<F.length;V+=1){let N=F[V];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Id({...this.options,...n})}},r1=Id;var N_=jp(a1()),V_=jp(h1());function iT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||qo.TOPOGRAPHIC,this.api=u.api||new Wf(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"],s=["rail"],P=["tram","subway","rail","bus"];this.motsByZoom=u.motsByZoom||[s,s,s,s,s,s,s,s,s,P,P,r,r,r,r],this.getMotsByZoom=z=>u.getMotsByZoom&&u.getMotsByZoom(z,this.motsByZoom)||this.motsByZoom[z]||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=z=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(z,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[z],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=z=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(z,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[z],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:V,sort:N,time:me,live:ve,canvas:Se,styleOptions:Ue,mode:et}=u,Ie=Se,Ne=s||1,He=me||new Date,nt=et||qo.TOPOGRAPHIC,mt=r||Yh;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{get:()=>(Ie||(Ie=document.createElement("canvas")),Ie),set:ht=>{Ie=ht}},mode:{get:()=>nt,set:ht=>{ht!==nt&&(nt=ht,this.api?.wsApi?.open&&(this.stop(),this.start()))}},style:{get:()=>mt,set:ht=>{mt=ht,this.renderTrajectories()}},styleOptions:{value:{...nf,...Ue||{}}},speed:{get:()=>Ne,set:ht=>{Ne=ht,this.start()}},filter:{value:V,writable:!0},sort:{value:N,writable:!0},live:{value:ve===!1?ve:!0,writable:!0},time:{get:()=>He,set:ht=>{He=ht&&ht.getTime?ht:new Date(ht),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(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas){let u=this.canvas.getContext("2d");u&&u.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=hd(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}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=gl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let V=[];for(let N=0;N<F.length&&(F[N].properties.coordinate&&Wp(z,F[N].properties.coordinate)&&V.push(F[N]),V.length!==P);N+=1);return Promise.resolve({layer:this,features:V.map(N=>this.format.readFeature(N)),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.removeTrajectory(u)})}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Ro(r,z)||this.mots&&!this.mots.includes(P)?(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===qo.TOPOGRAPHIC&&F?r.properties.olGeometry=this.format.readGeometry({type:"Point",coordinates:uo(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 mg=iT;var nT=new $l({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),oT=(y,h,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,[nT,new $l({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},gg=oT;var aT=new $l({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),sT=new $l({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),lT=()=>[aT,sT],p1=lT;var uT=new bl,Cd=class extends mg(Is){constructor(n){super({...n});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!n.allowRenderWhenAnimating,this.olLayer=n.olLayer||new v_({layers:[new rp({source:new ip({features:[]}),style:(u,r)=>(n.fullTrajectoryStyle||gg)(u,r,this.styleOptions)}),new Jh({source:new uf({}),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:V}=this.renderedViewState;if(F/s>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let N=this.map.getPixelFromCoordinate(z),me=this.map.getPixelFromCoordinate(r);this.transformContainer.style.transform=Rv(N[0]-me[0],N[1]-me[1],F/s,F/s,P-V,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",{willReadFrequently:!0}),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();!u.getCenter()||super.renderTrajectories({size:this.map.getSize(),center:u.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={}){if(!this.map||!this.map.getView())return Promise.resolve({layer:this,features:[],coordinate:n});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(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}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){let s=this.map.getView().getCenter();return!u&&!s?!1: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=uT.readFeatures(r);this.vectorLayer.getSource().addFeatures(s)})}clone(n){return new Cd({...this.options,...n})}},f1=Cd;var Ad=class extends Is{getFeatureInfoAtCoordinate(h){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(h);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:h})}clone(h){return new Ad({...this.options,...h})}},d1=Ad;var Pd=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 Pd({...this.options,...n})}},m1=Pd;var bg={};oy(bg,{CopyrightControl:()=>g1,Layer:()=>_g,RealtimeAPI:()=>Wf,RealtimeLayer:()=>M1,RealtimeModes:()=>qo,RoutingAPI:()=>qf,StopsAPI:()=>Zf,compareDepartures:()=>pd,createRealtimeFilters:()=>cy,debounceDeparturesMessages:()=>Oy,debounceWebsocketMessages:()=>Xf,getCircleCanvas:()=>qy,getDelayBgCanvas:()=>Gy,getDelayTextCanvas:()=>jy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>ac,getMapboxRender:()=>rf,getMaplibreRender:()=>tf,getMercatorResolution:()=>xg,getSourceCoordinates:()=>Ld,getTextCanvas:()=>Zy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Xh,pad:()=>Rm,realtimeConfig:()=>nf,realtimeDefaultStyle:()=>Yh,realtimeDelayStyle:()=>Xy,realtimeSimpleStyle:()=>Wy,removeDuplicate:()=>Wh,renderTrajectories:()=>hd,sortAndFilterDepartures:()=>fd,sortByDelay:()=>hy});var G_=class extends eg{constructor(h){super(h),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 ac(this.map)}},g1=G_;var Md=class extends cg(np){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 Qf([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new Md({...this.options,...n})}},_g=Md;var Zo=63710088e-1,y1={centimeters:Zo*100,centimetres:Zo*100,degrees:Zo/111325,feet:Zo*3.28084,inches:Zo*39.37,kilometers:Zo/1e3,kilometres:Zo/1e3,meters:Zo,metres:Zo,miles:Zo/1609.344,millimeters:Zo*1e3,millimetres:Zo*1e3,nauticalmiles:Zo/1852,radians:1,yards:Zo*1.0936},T5={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/Zo,yards:1.0936133};function _1(y,h,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=h||{},u.geometry=y,u}function bh(y,h,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 _1(u,h,n)}function cT(y,h){h===void 0&&(h="kilometers");var n=y1[h];if(!n)throw new Error(h+" units is invalid");return y*n}function hT(y,h){h===void 0&&(h="kilometers");var n=y1[h];if(!n)throw new Error(h+" units is invalid");return y/n}function v1(y){var h=y%(2*Math.PI);return h*180/Math.PI}function sp(y){var h=y%360;return h*Math.PI/180}function vg(y,h,n){if(h===void 0&&(h="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return cT(hT(y,h),n)}function j_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function q_(y){return!!y&&y.constructor===Object}function kd(y,h,n){if(y!==null)for(var u,r,s,P,z,F,V,N=0,me=0,ve,Se=y.type,Ue=Se==="FeatureCollection",et=Se==="Feature",Ie=Ue?y.features.length:1,Ne=0;Ne<Ie;Ne++){V=Ue?y.features[Ne].geometry:et?y.geometry:y,ve=V?V.type==="GeometryCollection":!1,z=ve?V.geometries.length:1;for(var He=0;He<z;He++){var nt=0,mt=0;if(P=ve?V.geometries[He]:V,P!==null){F=P.coordinates;var ht=P.type;switch(N=n&&(ht==="Polygon"||ht==="MultiPolygon")?1:0,ht){case null:break;case"Point":if(h(F,me,Ne,nt,mt)===!1)return!1;me++,nt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(h(F[u],me,Ne,nt,mt)===!1)return!1;me++,ht==="MultiPoint"&&nt++}ht==="LineString"&&nt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-N;r++){if(h(F[u][r],me,Ne,nt,mt)===!1)return!1;me++}ht==="MultiLineString"&&nt++,ht==="Polygon"&&mt++}ht==="Polygon"&&nt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(mt=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-N;s++){if(h(F[u][r][s],me,Ne,nt,mt)===!1)return!1;me++}mt++}nt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(kd(P.geometries[u],h,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function pT(y,h){h===void 0&&(h={});var n=0,u=0,r=0;return kd(y,function(s){n+=s[0],u+=s[1],r++},!0),bh([n/r,u/r],h.properties)}var x1=pT;function ku(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 b1(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 fT(y,h,n){n===void 0&&(n={});var u;n.final?u=w1(ku(h),ku(y)):u=w1(ku(y),ku(h));var r=u>180?-(360-u):u;return r}function w1(y,h){var n=sp(y[1]),u=sp(h[1]),r=sp(h[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(v1(P)+360)%360}var E1=fT;function dT(y,h,n){n===void 0&&(n={});var u=ku(y),r=ku(h);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=mT(u,r),P=vg(s,"meters",n.units);return P}function mT(y,h,n){n=n===void 0?Zo:Number(n);var u=n,r=y[1]*Math.PI/180,s=h[1]*Math.PI/180,P=s-r,z=Math.abs(h[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)),V=Math.abs(F)>1e-11?P/F:Math.cos(r),N=Math.sqrt(P*P+V*V*z*z),me=N*u;return me}var T1=dT;function gT(y,h,n,u){u===void 0&&(u={});var r=h<0,s=vg(Math.abs(h),u.units,"meters");r&&(s=-Math.abs(s));var P=ku(y),z=yT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,bh(z,u.properties)}function yT(y,h,n,u){u=u===void 0?Zo:Number(u);var r=h/u,s=y[0]*Math.PI/180,P=sp(y[1]),z=sp(n),F=r*Math.cos(z),V=P+F;Math.abs(V)>Math.PI/2&&(V=V>0?Math.PI-V:-Math.PI-V);var N=Math.log(Math.tan(V/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(N)>1e-11?F/N:Math.cos(P),ve=r*Math.sin(z)/me,Se=s+ve;return[(Se*180/Math.PI+540)%360-180,V*180/Math.PI]}var S1=gT;function _T(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return I1(y);case"FeatureCollection":return vT(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 I1(y){var h={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:h[n]=y[n]}}),h.properties=C1(y.properties),h.geometry=Z_(y.geometry),h}function C1(y){var h={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?h[n]=null:Array.isArray(u)?h[n]=u.map(function(r){return r}):h[n]=C1(u):h[n]=u}),h}function vT(y){var h={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:h[n]=y[n]}}),h.features=y.features.map(function(n){return I1(n)}),h}function Z_(y){var h={type:y.type};return y.bbox&&(h.bbox=y.bbox),y.type==="GeometryCollection"?(h.geometries=y.geometries.map(function(n){return Z_(n)}),h):(h.coordinates=A1(y.coordinates),h)}function A1(y){var h=y;return typeof h[0]!="object"?h.slice():h.map(function(n){return A1(n)})}var P1=_T;function xT(y,h,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(h==null||isNaN(h))throw new Error("angle is required");return h===0||(u||(u=x1(y)),(r===!1||r===void 0)&&(y=P1(y)),kd(y,function(s){var P=E1(u,s),z=P+h,F=T1(u,s),V=b1(S1(u,F,z));s[0]=V[0],s[1]=V[1]})),y}var X_=xT;var bT=(y,h=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/h}),P=y.unproject({x:n/h,y:u/h}),z=y.unproject({x:n/h,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Ld=bT;var wT=y=>{let h=y.getBounds().toArray(),n=uo(h[0]),u=uo(h[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Tu(r)/P;return Math.max(z,F)},xg=wT;var W_=class extends mg(_g){constructor(h={}){super({...h}),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(h,n){!h||(super.attachToMap(h),this.source={type:"canvas",canvas:this.canvas,coordinates:Ld(h,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"}},h.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(h=>{Ha(h)}),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(h){super.onUserMoveCallback({coordinate:uo(h.lngLat.toArray()),...h})}renderTrajectories(h=!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=X_(bh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=X_(bh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,V=[...uo(z),...uo(F)],N=bs(V)/(n/this.pixelRatio),me=Tu(V)/(u/this.pixelRatio),ve=Math.max(N,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:uo([r.lng,r.lat]),extent:V,resolution:ve,zoom:this.getOlZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,h)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(h,n={}){let u=xg(this.map);return super.getFeatureInfoAtCoordinate(h,{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(h,n,u){return super.purgeTrajectory(h,n||this.getMercatorExtent(),u||Math.floor(this.getOlZoom()))}setBbox(h,n){let u=h,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=h||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(h,n=!1){let u=super.renderTrajectoriesInternal(h,n);if(u&&this.map.style){let r=Ld(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(h,n,u){super.onFeatureHover(h,n,u),this.map.getCanvasContainer().style.cursor=h.length?"pointer":"auto"}},M1=W_;var $_={ol:yg,mapbox:bg};typeof window<"u"&&(window.mbt=$_);var S3=$_;})();
1083
1083
  //# sourceMappingURL=mbt.min.js.map